[dahdi-commits] dahdi/tools.git branch "2.5.y" created.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Feb 14 15:41:43 CST 2013


branch "2.5.y" has been created
        at  0870fc1201abca5905548053604cfad9cdd7efff (commit)

- Log -----------------------------------------------------------------
commit 0870fc1201abca5905548053604cfad9cdd7efff
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Sun Jul 29 11:37:55 2012 +0000

    README.Astribank: load module => module load
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10701
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10702 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/README.Astribank b/xpp/README.Astribank
index 7f61886..76a5049 100644
--- a/xpp/README.Astribank
+++ b/xpp/README.Astribank
@@ -634,7 +634,13 @@ Asterisk Level Information
 
   * the chan_dahdi.so file exists but it is not loaded. Try to load it manually:
 
-       asterisk -rx 'load module chan_dahdi.so'
+       asterisk -rx 'module load chan_dahdi.so'
+
+  * In some cases chan_dahdi failed to load properly and needs to be unloaded
+    before re-loading:
+
+       asterisk -rx 'module unload chan_dahdi.so'
+       asterisk -rx 'module   load chan_dahdi.so'
 
 - You see "pseudo" channel only. It means that you have not configured any
   channels. If you have configured channels in chan_dahdi.conf, you may

commit c4fe52e7699ae3d0b19a176d70a09d0f8097a677
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Mar 22 18:58:39 2012 +0000

    xpp: astribank_hook: wait for udev to settle
    
    When running the astribank_hook (only on Astribanks, in XPP_HOTPLUG_DAHDI
    mode), wait for all other Astribanks to create all the required device
    files.
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10585
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10595 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/astribank_hook b/xpp/astribank_hook
index 074ea31..0888733 100755
--- a/xpp/astribank_hook
+++ b/xpp/astribank_hook
@@ -68,7 +68,34 @@ NUM_WANTED=`clean_lines | sed '/^$/d' | wc -l`
 NUM_GOOD=`matched_devices | wc -l`
 LOCK="/var/lock/twinstar_startup"
 
+# Wait until udev finished processing our requests
+# so we know the device files were actually created
+# before trying dahdi_cfg et-al.
+wait_for_udev() {
+	UDEV_SETTLE_MAX_TIME=10
+
+	echo "Waiting for udev to settle down..."
+	if [ -x /sbin/udevsettle ]; then
+		# Old system, stand-alone udevsettle command
+		time /sbin/udevsettle --timeout="$UDEV_SETTLE_MAX_TIME"
+	elif [ -x /sbin/udevadm ]; then
+		# Assume modern system, udevadm has settle parameter
+		if ! time /sbin/udevadm settle --timeout="$UDEV_SETTLE_MAX_TIME"
+		then
+			echo "udevadm failed ($?)."
+			echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
+			sleep "$UDEV_SETTLE_MAX_TIME"
+		fi
+	else
+		echo "No udevsettle/udevadm."
+		echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
+		sleep "$UDEV_SETTLE_MAX_TIME"
+	fi
+	sleep 1	# Wait a bit more (races)
+}
+
 start_dahdi() {
+	wait_for_udev
 	script=/etc/init.d/dahdi
 	echo "Starting $script."
 	"$script" start | logger -i -t "$script"

commit c57672cd88b4f98e6d8b70aa9016aaffeba126d1
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Tue Mar 20 11:43:35 2012 +0000

    xpp: astribank_allow: useless debug on write
    
    Remove a useless debug message in the "write" operation.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10549
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10554 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/astribank_license.c b/xpp/astribank_license.c
index 93c0d26..88d2af7 100644
--- a/xpp/astribank_license.c
+++ b/xpp/astribank_license.c
@@ -311,7 +311,6 @@ int read_from_file(
 			case STATE_READ_DATA:
 				license_marker_end = marker_find(line, 1);
 				if (license_marker_end) {
-					printf("DEBUG: end=%d begin=%d\n", license_marker_end, license_marker_begin);
 					if (license_marker_end != license_marker_begin) {
 						ERR("Line %d: End marker != Begin marker\n", lineno);
 						return -1;

commit c256218779ecc485e463a578236a686741940f50
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Tue Mar 20 06:02:41 2012 +0000

    xpp: fix build warnings
    
    Unlike original: also fixed fpga_load.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10543
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10546 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/astribank_allow.c b/xpp/astribank_allow.c
index 39b7521..8f1ea92 100644
--- a/xpp/astribank_allow.c
+++ b/xpp/astribank_allow.c
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 	if (do_write) {
-		int used_marker;
+		unsigned int used_marker;
 		/* update capabilities based on input file */
 		file = stdin;
 		if (filename) {
diff --git a/xpp/astribank_license.c b/xpp/astribank_license.c
index 8eeb7c2..93c0d26 100644
--- a/xpp/astribank_license.c
+++ b/xpp/astribank_license.c
@@ -22,6 +22,7 @@
 
 #include <errno.h>
 #include <stdio.h>
+#include <ctype.h>
 #include <string.h>
 #include <debug.h>
 #include "astribank_license.h"
@@ -230,7 +231,7 @@ int read_from_file(
 	char buf[256];
 	char *line, *key, *value;
 	int lineno = 0;
-	unsigned int license_marker_begin;
+	unsigned int license_marker_begin = 0;
 	unsigned int license_marker_end;
 	struct table {
 		struct eeprom_table eeprom_table;
diff --git a/xpp/echo_loader.c b/xpp/echo_loader.c
index 8077b0a..17ab108 100644
--- a/xpp/echo_loader.c
+++ b/xpp/echo_loader.c
@@ -123,7 +123,7 @@ static void usb_buffer_showstatistics(struct astribank_device *astribank, struct
 	long	usec;
 
 	usec = usb_buffer_usec(ub);
-	AB_INFO(astribank, "Octasic statistics: packet_size=[%d, %ld, %d] packets=%d, bytes=%ld msec=%ld usec/packet=%d\n",
+	AB_INFO(astribank, "Octasic statistics: packet_size=[%d, %ld, %d] packets=%d, bytes=%ld msec=%ld usec/packet=%ld\n",
 		ub->min_send,
 		ub->total_bytes / ub->num_sends,
 		ub->max_send,
@@ -801,9 +801,7 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
 
 int load_echo(struct astribank_device *astribank, char *filename, int is_alaw)
 {
-	int		iLen;
 	int		ret;
-	unsigned char	*pbyFileData = NULL; 
 	UINT32		octasic_status;
 
 	AB_INFO(astribank, "Loading ECHOCAN Firmware: %s (%s)\n",
diff --git a/xpp/fpga_load.c b/xpp/fpga_load.c
index e120b26..650ff00 100644
--- a/xpp/fpga_load.c
+++ b/xpp/fpga_load.c
@@ -557,7 +557,6 @@ int match_usb_device_identity(const struct usb_config_descriptor *config_desc,
 
 const struct astribank_type *my_usb_device_identify(const char devpath[], struct my_usb_device *mydev)
 {
-	struct usb_device_descriptor	*dev_desc;
 	struct usb_config_descriptor	*config_desc;
 	int				i;
 
@@ -570,7 +569,6 @@ const struct astribank_type *my_usb_device_identify(const char devpath[], struct
 		ERR("Bailing out\n");
 		return 0;
 	}
-	dev_desc = &mydev->dev->descriptor;
 	config_desc = mydev->dev->config;
 	for(i = 0; i < sizeof(astribank_types)/sizeof(astribank_types[0]); i++) {
 		if(match_usb_device_identity(config_desc, &astribank_types[i])) {
@@ -592,7 +590,6 @@ int my_usb_device_init(const char devpath[], struct my_usb_device *mydev, const
 	struct usb_interface		*interface;
 	struct usb_interface_descriptor	*iface_desc;
 	struct usb_endpoint_descriptor	*endpoint;
-	int				ret;
 	int				i;
 
 	assert(mydev != NULL);
@@ -638,10 +635,10 @@ int my_usb_device_init(const char devpath[], struct my_usb_device *mydev, const
 	mydev->abtype = abtype;
 	mydev->my_ep_in = abtype->my_ep_in;
 	mydev->my_ep_out = abtype->my_ep_out;
-	ret = get_usb_string(mydev->iManufacturer, BUFSIZ, dev_desc->iManufacturer, mydev->handle);
-	ret = get_usb_string(mydev->iProduct, BUFSIZ, dev_desc->iProduct, mydev->handle);
-	ret = get_usb_string(mydev->iSerialNumber, BUFSIZ, dev_desc->iSerialNumber, mydev->handle);
-	ret = get_usb_string(mydev->iInterface, BUFSIZ, iface_desc->iInterface, mydev->handle);
+	get_usb_string(mydev->iManufacturer, BUFSIZ, dev_desc->iManufacturer, mydev->handle);
+	get_usb_string(mydev->iProduct, BUFSIZ, dev_desc->iProduct, mydev->handle);
+	get_usb_string(mydev->iSerialNumber, BUFSIZ, dev_desc->iSerialNumber, mydev->handle);
+	get_usb_string(mydev->iInterface, BUFSIZ, iface_desc->iInterface, mydev->handle);
 	INFO("ID=%04X:%04X Manufacturer=[%s] Product=[%s] SerialNumber=[%s] Interface=[%s]\n",
 		dev_desc->idVendor,
 		dev_desc->idProduct,
diff --git a/xpp/xtalk/xtalk.c b/xpp/xtalk/xtalk.c
index d3da5e0..7bfd359 100644
--- a/xpp/xtalk/xtalk.c
+++ b/xpp/xtalk/xtalk.c
@@ -243,16 +243,17 @@ static int send_command(struct xtalk_device *xtalk_dev, struct xtalk_command *cm
 {
 	int		ret;
 	int		len;
-	char		*buf;
 	void		*priv = xtalk_dev->transport_priv;
 
 	len = cmd->header.len;
 	cmd->header.seq = xtalk_dev->tx_sequenceno;
 
-	buf = (char *)cmd;
 	//printf("%s: len=%d\n", __FUNCTION__, len);
 #if 0
 	extern	FILE	*fp;
+	char		*buf;
+
+	buf = (char *)cmd;
 	if(fp) {
 		int	i;
 

commit 261869a4377c8ae39ec55a746ecbdd479852c3eb
Author: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Date:   Tue Mar 20 05:54:32 2012 +0000

    xpp: oct612x: fix build warnings
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10542
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10545 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
index caefd6e..2a9f940 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
@@ -1500,7 +1500,6 @@ UINT32 Oct6100ApiReserveChannelResources(
 				IN  tPOCT6100_CHANNEL_OPEN				f_pChannelOpen,
 				OUT tPOCT6100_API_ECHO_CHAN_INDEX		f_pChanIndexConf )
 {
-	tPOCT6100_SHARED_INFO			pSharedInfo;
 	tPOCT6100_CHANNEL_OPEN_TDM		pTdmConfig;
 	tPOCT6100_CHANNEL_OPEN_CODEC	pCodecConfig;
 
@@ -1526,9 +1525,6 @@ UINT32 Oct6100ApiReserveChannelResources(
 	BOOL	fExtToneChanEntry	= FALSE;
 	BOOL	fExtToneTsiEntry	= FALSE;
 	BOOL	fExtToneMixerEntry	= FALSE;
-	
-	/* Obtain local pointer to shared portion of instance. */
-	pSharedInfo = f_pApiInstance->pSharedInfo;
 
 	/* Obtain a local pointer to the configuration structures.*/
 	pTdmConfig		= &f_pChannelOpen->TdmConfig;
@@ -1951,7 +1947,6 @@ UINT32 Oct6100ApiWriteChannelStructs(
 	UINT32	ulResult;
 	UINT32	ulDwordAddress;
 	UINT32	ulDwordData;
-	BOOL	fConversionEnabled = FALSE;
 	BOOL	fProgramAdpcmMem;
 	UINT32	ulCompType = 0;
 	UINT32	ulPcmLaw;
@@ -2036,62 +2031,50 @@ UINT32 Oct6100ApiWriteChannelStructs(
 			break;
 		case cOCT6100_G726_40KBPS:				
 			ulCompType = 0x3;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_32KBPS:				
 			ulCompType = 0x2;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_24KBPS:				
 			ulCompType = 0x1;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_16KBPS:				
 			ulCompType = 0x0;		
-			fConversionEnabled = TRUE;
 			break;		
 
 		case cOCT6100_G727_2C_ENCODED:			
 			ulCompType = 0x4;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_3C_ENCODED:			
 			ulCompType = 0x5;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_4C_ENCODED:			
 			ulCompType = 0x6;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_ENCODED:				
 			ulCompType = 0x9;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G711_G726_ENCODED:		
 			ulCompType = 0xA;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G711_G727_2C_ENCODED:		
 			ulCompType = 0xC;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G711_G727_3C_ENCODED:		
 			ulCompType = 0xD;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G711_G727_4C_ENCODED:		
 			ulCompType = 0xE;		
-			fConversionEnabled = TRUE;
 			break;
 		default:
 			return cOCT6100_ERR_FATAL_D4;
@@ -2182,67 +2165,54 @@ UINT32 Oct6100ApiWriteChannelStructs(
 			break;
 		case cOCT6100_G726_40KBPS:				
 			ulCompType = 0x3;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_32KBPS:				
 			ulCompType = 0x2;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_24KBPS:				
 			ulCompType = 0x1;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G726_16KBPS:				
 			ulCompType = 0x0;		
-			fConversionEnabled = TRUE;
 			break;		
 
 		case cOCT6100_G727_40KBPS_4_1:			
 			ulCompType = 0xD;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_40KBPS_3_2:			
 			ulCompType = 0xA;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_40KBPS_2_3:			
 			ulCompType = 0x6;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_32KBPS_4_0:			
 			ulCompType = 0xE;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_32KBPS_3_1:			
 			ulCompType = 0xB;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_32KBPS_2_2:			
 			ulCompType = 0x7;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_24KBPS_3_0:			
 			ulCompType = 0xC;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_24KBPS_2_1:			
 			ulCompType = 0x8;		
-			fConversionEnabled = TRUE;
 			break;
 
 		case cOCT6100_G727_16KBPS_2_0:			
 			ulCompType = 0x9;		
-			fConversionEnabled = TRUE;
 			break;
 
 		default:
@@ -3807,10 +3777,8 @@ UINT32 Oct6100ApiCheckChannelModify(
 	/* Check the TDM config.*/
 	if ( f_pChannelModify->fTdmConfigModified == TRUE )
 	{
-		tPOCT6100_CHANNEL_MODIFY_TDM		pModifyTdm;
 		tPOCT6100_CHANNEL_OPEN_TDM			pOpenTdm;
 
-		pModifyTdm = &f_pChannelModify->TdmConfig;
 		pOpenTdm = &f_pTempChanOpen->TdmConfig;
 
 		ulResult = Oct6100ApiCheckTdmConfig( f_pApiInstance,
@@ -4706,7 +4674,6 @@ UINT32 Oct6100ApiModifyChannelStructs(
 	tOCT6100_WRITE_PARAMS	WriteParams;
 	tPOCT6100_API_CHANNEL_CODEC	pApiCodecConf;
 	tPOCT6100_API_CHANNEL_TDM	pApiTdmConf;
-	tPOCT6100_API_CHANNEL_VQE	pApiVqeConf;
 
 	UINT32	ulResult;
 	UINT16	usReadData;
@@ -4717,8 +4684,6 @@ UINT32 Oct6100ApiModifyChannelStructs(
 	UINT32	ulToneConfIndex;
 	BOOL	fClearPlayoutPointers = FALSE;
 
-	BOOL	fConversionEnabled = FALSE;
-
 
 
 	/* Obtain local pointer to shared portion of instance. */
@@ -4740,7 +4705,6 @@ UINT32 Oct6100ApiModifyChannelStructs(
 	/* Obtain local pointer to the configuration structures of the tPOCT6100_API_CHANNEL structure. */
 	pApiCodecConf = &pChanEntry->CodecConfig;
 	pApiTdmConf   = &pChanEntry->TdmConfig;
-	pApiVqeConf   = &pChanEntry->VqeConfig;
 
 	/*=======================================================================*/
 	/* Init the RIN and SIN TSST index */
@@ -5090,62 +5054,50 @@ UINT32 Oct6100ApiModifyChannelStructs(
 				break;
 			case cOCT6100_G726_40KBPS:				
 				ulCompType = 0x3;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G726_32KBPS:				
 				ulCompType = 0x2;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G726_24KBPS:				
 				ulCompType = 0x1;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G726_16KBPS:				
 				ulCompType = 0x0;		
-				fConversionEnabled = TRUE;
 				break;		
 
 			case cOCT6100_G727_2C_ENCODED:			
 				ulCompType = 0x4;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G727_3C_ENCODED:			
 				ulCompType = 0x5;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G727_4C_ENCODED:			
 				ulCompType = 0x6;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G726_ENCODED:				
 				ulCompType = 0x9;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G711_G726_ENCODED:		
 				ulCompType = 0xA;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G711_G727_2C_ENCODED:		
 				ulCompType = 0xC;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G711_G727_3C_ENCODED:		
 				ulCompType = 0xD;		
-				fConversionEnabled = TRUE;
 				break;
 
 			case cOCT6100_G711_G727_4C_ENCODED:		
 				ulCompType = 0xE;		
-				fConversionEnabled = TRUE;
 				break;
 
 			default:
@@ -5262,67 +5214,54 @@ UINT32 Oct6100ApiModifyChannelStructs(
 					break;
 				case cOCT6100_G726_40KBPS:				
 					ulCompType = 0x3;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G726_32KBPS:				
 					ulCompType = 0x2;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G726_24KBPS:				
 					ulCompType = 0x1;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G726_16KBPS:				
 					ulCompType = 0x0;		
-					fConversionEnabled = TRUE;
 					break;		
 
 				case cOCT6100_G727_40KBPS_4_1:			
 					ulCompType = 0xD;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_40KBPS_3_2:			
 					ulCompType = 0xA;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_40KBPS_2_3:			
 					ulCompType = 0x6;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_32KBPS_4_0:			
 					ulCompType = 0xE;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_32KBPS_3_1:			
 					ulCompType = 0xB;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_32KBPS_2_2:			
 					ulCompType = 0x7;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_24KBPS_3_0:			
 					ulCompType = 0xC;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_24KBPS_2_1:			
 					ulCompType = 0x8;		
-					fConversionEnabled = TRUE;
 					break;
 
 				case cOCT6100_G727_16KBPS_2_0:			
 					ulCompType = 0x9;		
-					fConversionEnabled = TRUE;
 					break;
 
 				default:
@@ -8885,7 +8824,6 @@ UINT32 Oct6100ApiWriteVqeNlpMemory(
 {
 	tPOCT6100_API_CHANNEL			pChanEntry;
 	tPOCT6100_SHARED_INFO			pSharedInfo;
-	tOCT6100_WRITE_PARAMS			WriteParams;
 	tOCT6100_BUFFER_PLAYOUT_STOP	BufferPlayoutStop;
 	UINT32							ulResult;
 	UINT32							ulTempData;
@@ -8899,10 +8837,6 @@ UINT32 Oct6100ApiWriteVqeNlpMemory(
 	
 	pSharedInfo = f_pApiInstance->pSharedInfo;
 
-	WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
-
 	/* Obtain a pointer to the new buffer's list entry. */
 	mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex );
 
@@ -9856,7 +9790,6 @@ UINT32 Oct6100ApiWriteVqeAfMemory(
 {
 	tPOCT6100_API_CHANNEL			pChanEntry;
 	tPOCT6100_SHARED_INFO			pSharedInfo;
-	tOCT6100_WRITE_PARAMS			WriteParams;
 	UINT32							ulResult;
 	UINT32							ulTempData;
 	UINT32							ulAfConfigBaseAddress;
@@ -9868,10 +9801,6 @@ UINT32 Oct6100ApiWriteVqeAfMemory(
 	
 	pSharedInfo = f_pApiInstance->pSharedInfo;
 
-	WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
-
 	/* Obtain a pointer to the new buffer's list entry. */
 	mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex );
 
@@ -12338,12 +12267,8 @@ UINT32 Oct6100ApiWriteDebugChanMemory(
 				IN	UINT16							f_usRinRoutTsiIndex,
 				IN	UINT16							f_usSinSoutTsiIndex )
 {
-	tPOCT6100_SHARED_INFO	pSharedInfo;
 	UINT32					ulResult;
 
-	/* Obtain pointer to local portion of the instance. */
-	pSharedInfo = f_pApiInstance->pSharedInfo;
-
 	/*==============================================================================*/
 	/* Write the VQE configuration of the debug channel. */
 
diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
index 819ac84..0303688 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
@@ -3569,9 +3569,7 @@ UINT32 Oct6100ApiBootSdram(
 	tPOCT6100_SHARED_INFO		pSharedInfo;
 	tPOCT6100_API_CHIP_CONFIG	pChipConfig;
 	tOCT6100_WRITE_PARAMS		WriteParams;
-	tOCT6100_READ_PARAMS		ReadParams;
 	UINT32	ulResult;
-	UINT16	usReadData;
 	UINT16	usWriteData23E;
 	UINT16	usWriteData230;
 	UINT32	i;
@@ -3587,11 +3585,6 @@ UINT32 Oct6100ApiBootSdram(
 
 	WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
 
-	ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
-	ReadParams.pusReadData = &usReadData;
-
 	usWriteData23E = 0x0000;
 	usWriteData230 = 0x0000;
 
@@ -4995,7 +4988,6 @@ UINT32 Oct6100ApiRunEgo(
 				OUT		PUINT32							f_aulEntry )
 {
 	tPOCT6100_SHARED_INFO		pSharedInfo;
-	tPOCT6100_API_CHIP_CONFIG	pChipConfig;
 	tOCT6100_WRITE_PARAMS		WriteParams;
 	tOCT6100_READ_PARAMS		ReadParams;
 	UINT32	ulResult;
@@ -5008,9 +5000,6 @@ UINT32 Oct6100ApiRunEgo(
 	/* Get local pointer to shared portion of instance. */
 	pSharedInfo = f_pApiInstance->pSharedInfo;
 
-	/* Get local pointer to the chip configuration structure. */
-	pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig;
-
 	/* Set the process context and user chip ID parameters once and for all. */
 	WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
 
@@ -5210,7 +5199,6 @@ UINT32 Oct6100ApiInitChannels(
 	tPOCT6100_SHARED_INFO		pSharedInfo;
 	UINT32 i;
 	UINT32 ulResult;
-	tOCT6100_WRITE_BURST_PARAMS	BurstParams;
 	tOCT6100_WRITE_PARAMS		WriteParams;
 	tOCT6100_READ_PARAMS		ReadParams;
 	UINT16						usReadData;
@@ -5220,7 +5208,6 @@ UINT32 Oct6100ApiInitChannels(
 	UINT32						ulFeatureBitOffset;
 	UINT32						ulFeatureFieldLength;
 	UINT32						ulMask;
-	UINT16						ausWriteData[ 4 ];
 	UINT16						usLoopCount = 0;
 	UINT16						usWriteData = 0;
 	UINT16						usMclkRead;
@@ -5235,11 +5222,6 @@ UINT32 Oct6100ApiInitChannels(
 
 	WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId;
 
-	BurstParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId;
-	BurstParams.pusWriteData = ausWriteData;
-
 	ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
 
 	ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId;
diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c
index 1fc539e..1b279d6 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c
@@ -2893,7 +2893,6 @@ UINT32	Oct6100ApiBridgeAddParticipantToChannel(
 	tPOCT6100_API_CHANNEL				pSourceChanEntry;
 	tPOCT6100_API_CHANNEL				pDestinationChanEntry;
 
-	tPOCT6100_API_FLEX_CONF_PARTICIPANT	pSourceParticipant;
 	tPOCT6100_API_FLEX_CONF_PARTICIPANT	pDestinationParticipant;
 
 	tPOCT6100_SHARED_INFO			pSharedInfo;
@@ -2914,7 +2913,6 @@ UINT32	Oct6100ApiBridgeAddParticipantToChannel(
 	mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
 
 	mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex );
-	mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex );
 	mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
 	mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
 
@@ -5069,12 +5067,9 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 	tPOCT6100_API_MIXER_EVENT			pTempEntry;
 	tPOCT6100_API_MIXER_EVENT			pLoadTempEntry;
 	tPOCT6100_API_MIXER_EVENT			pLastEventEntry;
-	tPOCT6100_API_MIXER_EVENT			pLastLoadOrAccumulateEventEntry;
 
-	tPOCT6100_API_CHANNEL				pSourceChanEntry;
 	tPOCT6100_API_CHANNEL				pDestinationChanEntry;
 
-	tPOCT6100_API_FLEX_CONF_PARTICIPANT	pSourceParticipant;
 	tPOCT6100_API_FLEX_CONF_PARTICIPANT	pDestinationParticipant;
 
 	tPOCT6100_SHARED_INFO				pSharedInfo;
@@ -5083,7 +5078,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 
 	UINT32								ulResult;
 	UINT32								ulLoopCount;
-	UINT16								usLastLoadEventIndex;
 	UINT16								usLoadOrAccumulateEventIndex;
 	UINT16								usTempEventIndex;
 	UINT16								usPreviousEventIndex;
@@ -5091,7 +5085,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 
 	UINT16								usReadData;
 	BOOL								fLastEvent = FALSE;
-	BOOL								fSoutCopyEvent = FALSE;
 
 	/* Obtain local pointer to shared portion of instance. */
 	pSharedInfo = f_pApiInstance->pSharedInfo;
@@ -5107,8 +5100,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 
 	mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
 
-	mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex );
-	mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex );
 	mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex );
 	mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex );
 
@@ -5127,8 +5118,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 		mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
 
 		pLastEventEntry = pLoadEventEntry;
-		pLastLoadOrAccumulateEventEntry = pLoadEventEntry;
-		usLastLoadEventIndex = usTempEventIndex;
 		usLastEventIndex = usTempEventIndex;
 
 		while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && 
@@ -5224,9 +5213,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 				}
 			}
 
-			pLastLoadOrAccumulateEventEntry = pTempEntry;
-			usLastLoadEventIndex = usTempEventIndex;
-
 			/* Go to the next entry into the list. */
 			usTempEventIndex = pTempEntry->usNextEventPtr;
 			mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex );
@@ -5362,7 +5348,6 @@ UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel(
 			if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_COPY )
 			{
 				/* No more previous bridges. */
-				fSoutCopyEvent = TRUE;
 			}
 
 			/* Now modify the previous last Store or Sub-Store or Head-Node event from another bridge/channel. */
@@ -7412,7 +7397,6 @@ UINT32 Oct6100ApiGetPrevLastSubStoreEvent(
 				IN		UINT16							f_usBridgeFirstLoadEventPtr,
 				OUT		PUINT16							f_pusLastSubStoreEventIndex )
 {
-	tPOCT6100_API_CONF_BRIDGE	pBridgeEntry;
 	tPOCT6100_API_MIXER_EVENT	pTempMixerEntry;
 	UINT16						usNextEventPtr;
 	UINT16						usHeadEventPtr;
@@ -7421,9 +7405,6 @@ UINT32 Oct6100ApiGetPrevLastSubStoreEvent(
 	UINT16						usCurrentPtr;
 	UINT32						ulResult = cOCT6100_ERR_OK;
 
-	/* Get current entry to obtain the link to the previous entry.*/
-	mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex );
-
 	/* Since we have flexible bridges, we have to */
 	/* run down the list and check for the appropriate event. */
 
diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c
index 58a7194..898267d 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c
@@ -798,7 +798,6 @@ UINT32 Oct6100ApiReadIntrptRegs(
 	tPOCT6100_API_CHIP_ERROR_STATS	pErrorStats;
 	tPOCT6100_API_INTRPT_MANAGE		pIntrptManage;
 	tOCT6100_READ_PARAMS			ReadParams;
-	tOCT6100_WRITE_PARAMS			WriteParams;
 
 	UINT32	ulResult;
 	UINT16	usReadData;
@@ -820,13 +819,6 @@ UINT32 Oct6100ApiReadIntrptRegs(
 	ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
 	ReadParams.pusReadData = &usReadData;
 
-	/* Set some parameters of write struct. */
-	WriteParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId;
-
-
-
 	/* CPU registers. */
 	if ( (f_ulRegister210h & 0x00001) != 0 )
 	{
@@ -1296,7 +1288,6 @@ UINT32 Oct6100ApiWriteIeRegs(
 {
 	tPOCT6100_API_INTRPT_MANAGE	pIntrptManage;
 	tOCT6100_WRITE_PARAMS		WriteParams;
-	tOCT6100_READ_PARAMS		ReadParams;
 	UINT32	ulResult;
 
 	/* Get some local pointers. */
@@ -1307,12 +1298,6 @@ UINT32 Oct6100ApiWriteIeRegs(
 
 	WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId;
 
-
-	/* Set some parameters of read struct. */
-	ReadParams.pProcessContext = f_pApiInstance->pProcessContext;
-
-	ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId;
-	
 	/*==================================================================================*/
 	WriteParams.ulWriteAddress = 0x104;
 	WriteParams.usWriteData = 0x0000;
diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c
index 02fbd8f..d3235a1 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c
@@ -175,12 +175,9 @@ UINT32 Oct6100ApiValidateTsst(
 {
 	tPOCT6100_SHARED_INFO		pSharedInfo;
 	tPOCT6100_API_CHIP_CONFIG	pChipConfig;	
-	PUINT32						pulTsstAlloc;
 	
 	/* Obtain local pointer to shared portion of instance. */
 	pSharedInfo = f_pApiInstance->pSharedInfo;
-	
-	mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
 
 	/* Obtain local pointer to chip configuration. */
 	pChipConfig = &pSharedInfo->ChipConfig;
diff --git a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
index c0381f4..70d2fc0 100644
--- a/xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
+++ b/xpp/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
@@ -84,14 +84,12 @@ $Octasic_Revision: 20 $
 {																				\
 	PVOID	_pProcessContext;													\
 	UINT32	_ulUserChipId;														\
-	UINT32	_ulWriteAddress;													\
 	UINT16	_usWriteData;														\
 	UINT32	_ulWriteLength;														\
 																				\
 	/* Store the data that is to be passed to the user. */						\
 	_pProcessContext = SmearParams.pProcessContext;								\
 	_ulUserChipId = SmearParams.ulUserChipId;									\
-	_ulWriteAddress = SmearParams.ulWriteAddress;								\
 	_usWriteData = SmearParams.usWriteData;										\
 	_ulWriteLength = SmearParams.ulWriteLength;									\
 																				\

commit 57749f1c265d7c24cb912fa28981709448a0db59
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Mar 15 21:22:05 2012 +0000

    xpp: Update product ID's in Dahdi::Hardware::USB
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10505
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10514 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm
index 60df56b..6c4afce 100644
--- a/xpp/perl_modules/Dahdi/Hardware/USB.pm
+++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm
@@ -34,6 +34,7 @@ my %usb_ids = (
 	'e4e4:1161'	=> { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular USB-firmware' },
 	'e4e4:1162'	=> { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular FPGA-firmware' },
 	'e4e4:1163'	=> { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-TwinStar monitor' },
+	'e4e4:1164'	=> { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-EEPROM burner' },
 	
 	# Sangoma USB FXO:
 	'10c4:8461'	=> { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma WANPIPE USB-FXO Device' },

commit 6da1f767e5854061ff19b62de9640abae01bf456
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Mar 15 21:21:27 2012 +0000

    xpp: fix manpage of astribank_hexload
    
    * Fixed 'astribanks_tool' string
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10503
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10513 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/astribank_hexload.8 b/xpp/astribank_hexload.8
index 82573a8..6bf1d3e 100644
--- a/xpp/astribank_hexload.8
+++ b/xpp/astribank_hexload.8
@@ -1,19 +1,19 @@
 .TH "ASTRIBANK_HEXLOAD" "8" "30 May 2011" "" ""
 
 .SH NAME
-astribank_tool \- Xorcom Astribank (xpp) firmware loader
+astribank_hexload \- Xorcom Astribank (xpp) firmware loader
 .SH SYNOPSIS
-.B astribank_tool \-D \fIdevice-path\fR \-F [\fIoptions\fR] \fIhexfile\fR
+.B astribank_hexload \-D \fIdevice-path\fR \-F [\fIoptions\fR] \fIhexfile\fR
 
-.B astribank_tool \-D \fIdevice-path\fR \-p [\fIoptions\fR] \fIhexfile1 .. hexfile4\fR
+.B astribank_hexload \-D \fIdevice-path\fR \-p [\fIoptions\fR] \fIhexfile1 .. hexfile4\fR
 
-.B astribank_tool \-D \fIdevice-path\fR \-O [-A] [\fIoptions\fR] \fIimagefile\fR
+.B astribank_hexload \-D \fIdevice-path\fR \-O [-A] [\fIoptions\fR] \fIimagefile\fR
 
-.B astribank_tool \-D \fIdevice-path\fR \-o [\fIoptions\fR]
+.B astribank_hexload \-D \fIdevice-path\fR \-o [\fIoptions\fR]
 
-.B astribank_tool \-D \fIdevice-path\fR \-E [\fIoptions\fR] \fIhexfile\fR
+.B astribank_hexload \-D \fIdevice-path\fR \-E [\fIoptions\fR] \fIhexfile\fR
 
-.B astribank_tool \-h
+.B astribank_hexload \-h
 
 .SH DESCRIPTION
 .B astribank_hexload

commit 3a147a35c2fdaddb7a57661365f802fd22baa770
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Mar 15 21:21:06 2012 +0000

    xpp: Customizable license markers
    
    * License strings markers (BEGIN.../END...) can be customized
    * By default, generate a "generic" license markers
    * We accept any (paired) markers from the valid list
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10502
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10512 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/Makefile b/xpp/Makefile
index 9b49e7e..6fa04a4 100644
--- a/xpp/Makefile
+++ b/xpp/Makefile
@@ -74,7 +74,7 @@ ASTRIBANK_OBJS		= astribank_usb.o mpptalk.o $(XTALK_OBJS)
 
 ABHEXLOAD_OBJS		= astribank_hexload.o hexfile.o pic_loader.o $(ECHO_LOADER) $(ASTRIBANK_OBJS) $(OCT_HERE_OBJS)
 ABTOOL_OBJS		= astribank_tool.o $(ASTRIBANK_OBJS)
-ABALLOW_OBJS		= astribank_allow.o $(ASTRIBANK_OBJS)
+ABALLOW_OBJS		= astribank_allow.o astribank_license.o $(ASTRIBANK_OBJS)
 
 TARGETS	= .perlcheck astribank_is_starting
 PROG_INSTALL	= astribank_is_starting
diff --git a/xpp/astribank_allow.8 b/xpp/astribank_allow.8
index 6675432..3ac5b23 100644
--- a/xpp/astribank_allow.8
+++ b/xpp/astribank_allow.8
@@ -48,6 +48,16 @@ Write capabilities to EEPROM, otherwise read capabilities
 License filename (stdin/stdout if not specified)
 .RE
 
+.B \-m \fInum\fR
+.RS
+Choose the numeric code of license markers to generate.
+This code select the type of \fIBEGIN\fR.../\fIEND\fR... strings
+that delimit the license body.
+
+Valid marker codes are listed with the \fB-h\fR option.
+The default (and first) code is \fB1\fR. Zero is illegal value.
+.RE
+
 .B \-v
 .RS
 Increase verbosity. May be used multiple times.
diff --git a/xpp/astribank_allow.c b/xpp/astribank_allow.c
index 18c7573..39b7521 100644
--- a/xpp/astribank_allow.c
+++ b/xpp/astribank_allow.c
@@ -34,6 +34,7 @@
 #include "mpp.h"
 #include "mpptalk.h"
 #include <debug.h>
+#include "astribank_license.h"
 
 static const char rcsid[] = "$Id$";
 
@@ -49,6 +50,8 @@ static void usage()
 	fprintf(stderr, "\t\t[-d mask]          # Debug mask (0xFF for everything)\n");
 	fprintf(stderr, "\t\t[-w]               # Write capabilities to EEPROM, otherwise read capabilities\n");
 	fprintf(stderr, "\t\t[-f filename]      # License filename (stdin/stdout if not specified)\n\n");
+	fprintf(stderr, "\t\t[-m num]           # Numeric code of License markers to generate\n");
+	license_markers_help("\t", stderr);
 	exit(1);
 }
 
@@ -70,216 +73,6 @@ static int capabilities_burn(
 	return 0;
 }
 
-static int bin_to_file(void *buf, int len, FILE *f)
-{
-	static int bytes_on_line;
-	unsigned char *p = buf;
-	if (buf == NULL) {
-		if (bytes_on_line != 0) {
-			if (fprintf(f, "\n") != 1)
-				return -1;
-			bytes_on_line = 0;
-		}
-		return 0;
-	}
-	int i;
-	for (i = 0; i < len; i++) {
-		if (fprintf(f, "%02x", *p++) != 2)
-			return -1;
-		bytes_on_line++;
-		if (bytes_on_line >= 16) {
-			if (fprintf(f, "\n") != 1)
-				return -1;
-			bytes_on_line = 0;
-		}
-	}
-	return 0;
-}
-
-static int write_to_file(struct eeprom_table *eeprom_table, struct capabilities *caps, struct capkey *key, FILE *f)
-{
-	fprintf(f, "-----BEGIN XORCOM LICENSE BLOCK-----\n");
-	fprintf(f, "Version: 1.0\n");
-	fprintf(f, "Timestamp: %u\n", caps->timestamp);
-	fprintf(f, "Serial: %.*s\n", LABEL_SIZE, eeprom_table->label);
-	fprintf(f, "Capabilities.Port.FXS: %d\n", caps->ports_fxs);
-	fprintf(f, "Capabilities.Port.FXO: %d\n", caps->ports_fxo);
-	fprintf(f, "Capabilities.Port.BRI: %d\n", caps->ports_bri);
-	fprintf(f, "Capabilities.Port.PRI: %d\n", caps->ports_pri);
-	fprintf(f, "Capabilities.Port.ECHO: %d\n", caps->ports_echo);
-	fprintf(f, "Capabilities.Twinstar: %d\n", CAP_EXTRA_TWINSTAR(caps));
-	fprintf(f, "Data:\n");
-	bin_to_file(eeprom_table, sizeof(*eeprom_table), f);
-	bin_to_file(caps, sizeof(*caps), f);
-	bin_to_file(key, sizeof(*key), f);
-	bin_to_file(NULL, 0, f);
-	fprintf(f, "-----END XORCOM LICENSE BLOCK-----\n");
-	return 0;
-}
-
-/*
- * Removes whitespace on both sizes of the string.
- * Returns a pointer to the first non-space char. The string
- * is modified in place to trim trailing whitespace.
- * If the whole string is whitespace, returns NULL.
- */
-char *trim(char *s)
-{
-	int len = strlen(s);
-	while (len > 0 && isspace(s[len-1])) {
-		len--;
-	}
-	if (len == 0)
-		return NULL;
-	s[len] = '\0';
-	while (isspace(*s))
-		s++;
-	/* *s is not a space, since in this case we'd return NULL above */
-	return s;
-}
-
-int get_key_value(char *line, char **key, char **value)
-{
-	char *p = strchr(line, ':');
-	if (p == NULL)
-		return -1;
-	*p = '\0';
-	*key = trim(line);
-	*value = trim(p + 1);
-	return 0;
-}
-
-static int hex_digit_to_int(char c)
-{
-	if (c >= '0' && c <= '9')
-		return c - '0';
-	else if (c >= 'a' && c <= 'f')
-		return c - 'a' + 10;
-	else
-		return -1;
-}
-
-static int str_to_bin(char *line, void *buf, int maxlen)
-{
-	static int offset;
-	unsigned char *p = buf;
-	if (strlen(line) % 2 != 0)
-		return -1;
-	while (offset < maxlen && *line) {
-		uint8_t value;
-		char c = hex_digit_to_int(*line++);
-		if (c < 0 || *line == '\0')
-			return -1;
-		value = c << 4;
-		c = hex_digit_to_int(*line++);
-		if (c < 0)
-			return -1;
-		value |= c;
-		p[offset++] = value;
-	}
-	if (offset == maxlen && *line)
-		return -1;
-	return offset;
-}
-
-static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities *caps, struct capkey *capkey, FILE *f)
-{
-	char buf[256];
-	char *line, *key, *value;
-	int state = 0;
-	int lineno = 0;
-	struct table {
-		struct eeprom_table eeprom_table;
-		struct capabilities capabilities;
-		struct capkey capkey;
-	} PACKED table;
-
-	memset(&table, 0, sizeof(struct table));
-	/*
-	 * states:
-	 * 0: start - before BEGIN_LICENSE_BLOCK line. on BEGIN_LICENSE_BLOCK line goto 1.
-	 * 1: read Version, goto 2. if not version line then error.
-	 * 2: after BEGIN line. split line into key:value. if line is Data:, goto 3.
-	 * 3: read binary data. if line is END_LICENSE_BLOCK goto 4.
-	 * 4: END_LICENSE_BLOCK - ignore lines.
-	 */
-	while (fgets(buf, 256, f) != NULL) {
-		lineno++;
-		int len = strlen(buf);
-		if (len > 0 && buf[len-1] != '\n') {
-			ERR("Line %d: Line too long\n", lineno);
-			return -1;
-		}
-		line = trim(buf);
-		if (line == NULL) {
- 			if (state > 0 && state < 4) {
-				ERR("Line %d: Empty line\n", lineno);
-				return -1;
-			}
-			else
-				continue;
-		}
-		switch (state) {
-			case 0:
-				if (strcmp(line, "-----BEGIN XORCOM LICENSE BLOCK-----") == 0)
-					state = 1;
-				else {
-					ERR("Line %d: Invalid license begin block\n", lineno);
-					return -1;
-				}
-				break;
-			case 1:
-				if (get_key_value(line, &key, &value) < 0) {
-					ERR("Line %d: Can't parse line\n", lineno);
-					return -1;
-				}
-				if (strcmp(key, "Version") == 0) {
-					if (strcmp(value, "1.0") == 0) {
-						state = 2;
-					} else {
-						ERR("Line %d: Unknown license file version '%s', need version '1.0'\n", lineno, value);
-						return -1;
-					}
-				} else {
-					ERR("Line %d: No license file version\n", lineno);
-					return -1;
-				}
-				break;
-			case 2:
-				if (get_key_value(line, &key, &value) < 0) {
-					ERR("Line %d: Can't parse line\n", lineno);
-					return -1;
-				}
-				if (strcmp(key, "Data") == 0) {
-					state = 3;
-					break;
-				}
-				break;
-			case 3:
-				if (strcmp(line, "-----END XORCOM LICENSE BLOCK-----") == 0) {
-					state = 4;
-					break;
-				}
-				if (str_to_bin(line, &table, sizeof(table)) < 0) {
-					ERR("Line %d: Error in data block\n", lineno);
-					return -1;
-				}
-				break;
-			case 4:
-				break;
-
-		}
-	}
-	if (state != 4) {
-		ERR("Invalid license file\n");
-		return -1;
-	}
-	memcpy(eeprom_table, &table.eeprom_table, sizeof(*eeprom_table));
-	memcpy(caps, &table.capabilities, sizeof(*caps));
-	memcpy(capkey, &table.capkey, sizeof(*capkey));
-	return 0;
-}
-
 int main(int argc, char *argv[])
 {
 	char			*devpath = NULL;
@@ -287,8 +80,9 @@ int main(int argc, char *argv[])
 	struct eeprom_table	eeprom_table;
 	struct capabilities	caps;
 	struct capkey		key;
-	const char		options[] = "vd:D:wf:";
+	const char		options[] = "vd:D:wf:m:";
 	int			do_write = 0;
+	unsigned int		marker = LICENSE_MARKER_GENERIC;
 	FILE			*file;
 	char			*filename = NULL;
 	int			ret;
@@ -317,6 +111,11 @@ int main(int argc, char *argv[])
 			case 'f':
 				filename = optarg;
 				break;
+			case 'm':
+				marker = strtoul(optarg, NULL, 0);
+				if (!license_marker_valid(marker))
+					usage();
+				break;
 			case 'h':
 			default:
 				ERR("Unknown option '%c'\n", c);
@@ -343,6 +142,7 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 	if (do_write) {
+		int used_marker;
 		/* update capabilities based on input file */
 		file = stdin;
 		if (filename) {
@@ -352,7 +152,7 @@ int main(int argc, char *argv[])
 				return 1;
 			}
 		}
-		ret = read_from_file(&eeprom_table, &caps, &key, file);
+		ret = read_from_file(&eeprom_table, &caps, &key, &used_marker, file);
 		if (ret < 0) {
 			ERR("Failed to read capabilities from file: %d\n", ret);
 			return 1;
@@ -372,7 +172,7 @@ int main(int argc, char *argv[])
 				return 1;
 			}
 		}
-		ret = write_to_file(&eeprom_table, &caps, &key, file);
+		ret = write_to_file(&eeprom_table, &caps, &key, marker, file);
 		if (ret < 0) {
 			ERR("Failed to write capabilities to file: %d\n", ret);
 			return 1;
diff --git a/xpp/astribank_allow.c b/xpp/astribank_license.c
similarity index 55%
copy from xpp/astribank_allow.c
copy to xpp/astribank_license.c
index 18c7573..8eeb7c2 100644
--- a/xpp/astribank_allow.c
+++ b/xpp/astribank_license.c
@@ -1,7 +1,6 @@
 /*
- * Written by Oron Peled <oron at actcom.co.il> and
- *            Alex Landau <alex.landau at xorcom.com>
- * Copyright (C) 2008, Xorcom
+ * Written by Oron Peled <oron at actcom.co.il>
+ * Copyright (C) 2012, Xorcom
  *
  * All rights reserved.
  *
@@ -21,52 +20,86 @@
  *
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-#include <getopt.h>
-#include <time.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <ctype.h>
-#include "mpp.h"
-#include "mpptalk.h"
 #include <debug.h>
+#include "astribank_license.h"
+
+#define	ARRAY_SIZE(a)	(sizeof(a)/sizeof((a)[0]))
 
-static const char rcsid[] = "$Id$";
+static const struct boundary {
+	const char *name;
+	const char *markers[2];
+} boundaries[] = {
+	[LICENSE_MARKER_NONE] = {	/* Skip 0 */
+	},
+	[LICENSE_MARKER_XORCOM] = {
+		"Xorcom",
+		{
+			"-----BEGIN XORCOM LICENSE BLOCK-----",
+			"-----END XORCOM LICENSE BLOCK-----",
+		},
+	},
+	[LICENSE_MARKER_GENERIC] = {
+		"Generic",
+		{
+			"-----BEGIN TELEPHONY DEVICE LICENSE BLOCK-----",
+			"-----END TELEPHONY DEVICE LICENSE BLOCK-----",
+		}
+	},
+};
 
-#define	DBG_MASK	0x80
+void license_markers_help(const char *prefix, FILE *fp)
+{
+	int i;
 
-static char	*progname;
+	fprintf(fp, "%sValid license markers:\n", prefix);
+	for (i = LICENSE_MARKER_NONE + 1; i < ARRAY_SIZE(boundaries); i++) {
+		const struct boundary *b = &boundaries[i];
+		if (b->markers[0] != 0)
+			fprintf(fp, "%s\t%d - %s\n", prefix, i, b->name);
+	}
+}
+
+int license_marker_valid(unsigned int which)
+{
+	if (which >= ARRAY_SIZE(boundaries))
+		return 0;
+	if (boundaries[which].markers[0] == NULL)
+		return 0;
+	return 1;
+}
 
-static void usage()
+static const char *marker_string(unsigned int which, int end_marker)
 {
-	fprintf(stderr, "Usage: %s [options...] -D {/proc/bus/usb|/dev/bus/usb}/<bus>/<dev> options\n", progname);
-	fprintf(stderr, "\tOptions:\n");
-	fprintf(stderr, "\t\t[-v]               # Increase verbosity\n");
-	fprintf(stderr, "\t\t[-d mask]          # Debug mask (0xFF for everything)\n");
-	fprintf(stderr, "\t\t[-w]               # Write capabilities to EEPROM, otherwise read capabilities\n");
-	fprintf(stderr, "\t\t[-f filename]      # License filename (stdin/stdout if not specified)\n\n");
-	exit(1);
+	int selector = (end_marker) ? 1 : 0;
+
+	if (license_marker_valid(which)) {
+		return boundaries[which].markers[selector];
+	}
+	ERR("gen_marker: invalid marker %d\n", which);
+	return NULL;
 }
 
-static int capabilities_burn(
-		struct astribank_device *astribank,
-		struct eeprom_table *eeprom_table,
-		struct capabilities *capabilities,
-		struct capkey *key)
+static int marker_find(const char *str, int end_marker)
 {
-	int	ret;
+	int selector = (end_marker) ? 1 : 0;
+	int i;
+
+	for (i = LICENSE_MARKER_NONE + 1; i < ARRAY_SIZE(boundaries); i++) {
+		const struct boundary *b = &boundaries[i];
+		const char *marker_str = b->markers[selector];
 
-	INFO("Burning capabilities\n");
-	ret = mpp_caps_set(astribank, eeprom_table, capabilities, key);
-	if(ret < 0) {
-		ERR("Capabilities burning failed: %d\n", ret);
-		return ret;
+#if 0
+		DBG("marker_find(%s,%d)[%d]: %s\n",
+			str, end_marker, i, marker_str);
+#endif
+		if (!marker_str)
+			continue;
+		if (strcmp(str, marker_str) == 0)
+			return i;
 	}
-	INFO("Done\n");
 	return 0;
 }
 
@@ -96,9 +129,14 @@ static int bin_to_file(void *buf, int len, FILE *f)
 	return 0;
 }
 
-static int write_to_file(struct eeprom_table *eeprom_table, struct capabilities *caps, struct capkey *key, FILE *f)
+int write_to_file(
+	struct eeprom_table *eeprom_table,
+	struct capabilities *caps,
+	struct capkey *key,
+	unsigned int marker,
+	FILE *f)
 {
-	fprintf(f, "-----BEGIN XORCOM LICENSE BLOCK-----\n");
+	fprintf(f, "%s\n", marker_string(marker, 0));
 	fprintf(f, "Version: 1.0\n");
 	fprintf(f, "Timestamp: %u\n", caps->timestamp);
 	fprintf(f, "Serial: %.*s\n", LABEL_SIZE, eeprom_table->label);
@@ -113,7 +151,7 @@ static int write_to_file(struct eeprom_table *eeprom_table, struct capabilities
 	bin_to_file(caps, sizeof(*caps), f);
 	bin_to_file(key, sizeof(*key), f);
 	bin_to_file(NULL, 0, f);
-	fprintf(f, "-----END XORCOM LICENSE BLOCK-----\n");
+	fprintf(f, "%s\n", marker_string(marker, 1));
 	return 0;
 }
 
@@ -123,7 +161,7 @@ static int write_to_file(struct eeprom_table *eeprom_table, struct capabilities
  * is modified in place to trim trailing whitespace.
  * If the whole string is whitespace, returns NULL.
  */
-char *trim(char *s)
+static char *trim(char *s)
 {
 	int len = strlen(s);
 	while (len > 0 && isspace(s[len-1])) {
@@ -138,7 +176,7 @@ char *trim(char *s)
 	return s;
 }
 
-int get_key_value(char *line, char **key, char **value)
+static int get_key_value(char *line, char **key, char **value)
 {
 	char *p = strchr(line, ':');
 	if (p == NULL)
@@ -182,17 +220,30 @@ static int str_to_bin(char *line, void *buf, int maxlen)
 	return offset;
 }
 
-static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities *caps, struct capkey *capkey, FILE *f)
+int read_from_file(
+	struct eeprom_table *eeprom_table,
+	struct capabilities *caps,
+	struct capkey *capkey,
+	unsigned int *used_marker,
+	FILE *f)
 {
 	char buf[256];
 	char *line, *key, *value;
-	int state = 0;
 	int lineno = 0;
+	unsigned int license_marker_begin;
+	unsigned int license_marker_end;
 	struct table {
 		struct eeprom_table eeprom_table;
 		struct capabilities capabilities;
 		struct capkey capkey;
 	} PACKED table;
+	enum PARSE_STATES {
+		STATE_BEFORE_LICENSE = 0,
+		STATE_EXPECT_VERSION = 1,
+		STATE_EXPECT_DATA = 2,
+		STATE_READ_DATA = 3,
+		STATE_AFTER_LICENSE = 4,
+	} state = STATE_BEFORE_LICENSE;
 
 	memset(&table, 0, sizeof(struct table));
 	/*
@@ -212,7 +263,7 @@ static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities
 		}
 		line = trim(buf);
 		if (line == NULL) {
- 			if (state > 0 && state < 4) {
+			if (state > STATE_BEFORE_LICENSE && state < STATE_AFTER_LICENSE) {
 				ERR("Line %d: Empty line\n", lineno);
 				return -1;
 			}
@@ -220,22 +271,23 @@ static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities
 				continue;
 		}
 		switch (state) {
-			case 0:
-				if (strcmp(line, "-----BEGIN XORCOM LICENSE BLOCK-----") == 0)
-					state = 1;
+			case STATE_BEFORE_LICENSE:
+				license_marker_begin = marker_find(line, 0);
+				if (license_marker_begin)
+					state = STATE_EXPECT_VERSION;
 				else {
 					ERR("Line %d: Invalid license begin block\n", lineno);
 					return -1;
 				}
 				break;
-			case 1:
+			case STATE_EXPECT_VERSION:
 				if (get_key_value(line, &key, &value) < 0) {
 					ERR("Line %d: Can't parse line\n", lineno);
 					return -1;
 				}
 				if (strcmp(key, "Version") == 0) {
 					if (strcmp(value, "1.0") == 0) {
-						state = 2;
+						state = STATE_EXPECT_DATA;
 					} else {
 						ERR("Line %d: Unknown license file version '%s', need version '1.0'\n", lineno, value);
 						return -1;
@@ -245,19 +297,25 @@ static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities
 					return -1;
 				}
 				break;
-			case 2:
+			case STATE_EXPECT_DATA:
 				if (get_key_value(line, &key, &value) < 0) {
 					ERR("Line %d: Can't parse line\n", lineno);
 					return -1;
 				}
 				if (strcmp(key, "Data") == 0) {
-					state = 3;
+					state = STATE_READ_DATA;
 					break;
 				}
 				break;
-			case 3:
-				if (strcmp(line, "-----END XORCOM LICENSE BLOCK-----") == 0) {
-					state = 4;
+			case STATE_READ_DATA:
+				license_marker_end = marker_find(line, 1);
+				if (license_marker_end) {
+					printf("DEBUG: end=%d begin=%d\n", license_marker_end, license_marker_begin);
+					if (license_marker_end != license_marker_begin) {
+						ERR("Line %d: End marker != Begin marker\n", lineno);
+						return -1;
+					}
+					state = STATE_AFTER_LICENSE;
 					break;
 				}
 				if (str_to_bin(line, &table, sizeof(table)) < 0) {
@@ -265,12 +323,12 @@ static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities
 					return -1;
 				}
 				break;
-			case 4:
+			case STATE_AFTER_LICENSE:
 				break;
 
 		}
 	}
-	if (state != 4) {
+	if (state != STATE_AFTER_LICENSE) {
 		ERR("Invalid license file\n");
 		return -1;
 	}
@@ -280,106 +338,3 @@ static int read_from_file(struct eeprom_table *eeprom_table, struct capabilities
 	return 0;
 }
 
-int main(int argc, char *argv[])
-{
-	char			*devpath = NULL;
-	struct astribank_device *astribank;
-	struct eeprom_table	eeprom_table;
-	struct capabilities	caps;
-	struct capkey		key;
-	const char		options[] = "vd:D:wf:";
-	int			do_write = 0;
-	FILE			*file;
-	char			*filename = NULL;
-	int			ret;
-
-	progname = argv[0];
-	while (1) {
-		int	c;
-
-		c = getopt (argc, argv, options);
-		if (c == -1)
-			break;
-
-		switch (c) {
-			case 'D':
-				devpath = optarg;
-				break;
-			case 'v':
-				verbose++;
-				break;
-			case 'd':
-				debug_mask = strtoul(optarg, NULL, 0);
-				break;
-			case 'w':
-				do_write = 1;
-				break;
-			case 'f':
-				filename = optarg;
-				break;
-			case 'h':
-			default:
-				ERR("Unknown option '%c'\n", c);
-				usage();
-		}
-	}
-	if(!devpath) {
-		ERR("Missing device path\n");
-		usage();
-	}
-	DBG("Startup %s\n", devpath);
-	if((astribank = mpp_init(devpath, 1)) == NULL) {
-		ERR("Failed initializing MPP\n");
-		return 1;
-	}
-	if(astribank->eeprom_type != EEPROM_TYPE_LARGE) {
-		ERR("Cannot use this program with astribank EEPROM type %d (need %d)\n",
-			astribank->eeprom_type, EEPROM_TYPE_LARGE);
-		return 1;
-	}
-	ret = mpp_caps_get(astribank, &eeprom_table, &caps, &key);
-	if(ret < 0) {
-		ERR("Failed to get original capabilities: %d\n", ret);
-		return 1;
-	}
-	if (do_write) {
-		/* update capabilities based on input file */
-		file = stdin;
-		if (filename) {
-			file = fopen(filename, "r");
-			if (file == NULL) {
-				ERR("Can't open file '%s'\n", filename);
-				return 1;
-			}
-		}
-		ret = read_from_file(&eeprom_table, &caps, &key, file);
-		if (ret < 0) {
-			ERR("Failed to read capabilities from file: %d\n", ret);
-			return 1;
-		}
-		show_capabilities(&caps, stderr);
-		if (capabilities_burn(astribank, &eeprom_table, &caps, &key) < 0)
-			return 1;
-		if (file != stdin)
-			fclose(file);
-	} else {
-		/* print capabilities to stdout */
-		file = stdout;
-		if (filename) {
-			file = fopen(filename, "w");
-			if (file == NULL) {
-				ERR("Can't create file '%s'\n", filename);
-				return 1;
-			}
-		}
-		ret = write_to_file(&eeprom_table, &caps, &key, file);
-		if (ret < 0) {
-			ERR("Failed to write capabilities to file: %d\n", ret);
-			return 1;
-		}
-		if (file != stdout)
-			fclose(file);
-	}
-	mpp_exit(astribank);
-	return 0;
-}
diff --git a/xpp/astribank_license.h b/xpp/astribank_license.h
new file mode 100644
index 0000000..74d6a31
--- /dev/null
+++ b/xpp/astribank_license.h
@@ -0,0 +1,29 @@
+#ifndef	ASTRIBANK_ALLOW_H
+#define	ASTRIBANK_ALLOW_H
+
+#include "mpp.h"
+
+enum license_markers {
+	LICENSE_MARKER_NONE = 0,
+	LICENSE_MARKER_XORCOM = 1,
+	LICENSE_MARKER_GENERIC = 2,
+};
+
+int license_marker_valid(unsigned int which);
+void license_markers_help(const char *prefix, FILE *fp);
+
+int write_to_file(
+	struct eeprom_table *eeprom_table,
+	struct capabilities *caps,
+	struct capkey *key,
+	unsigned int marker,
+	FILE *f);
+
+int read_from_file(
+	struct eeprom_table *eeprom_table,
+	struct capabilities *caps,
+	struct capkey *capkey,
+	unsigned int *used_marker,
+	FILE *f);
+
+#endif	/* ASTRIBANK_ALLOW_H */

commit a8c8435ea8318d44b2d620602142d9814d9aa5b4
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Thu Mar 15 21:19:34 2012 +0000

    xpp: bugfix: handle echo_loader errors
    
    * I/O errors of the device were not propagated up by echo_loader
    * As a result, Octasic load failure did not prevented USB renumeration
    * Make consistent return values:
      - In our functions: ret < 0 is error
      - In Octasic functions (UINT32): return Octasic error codes
    * All error paths prints error messages (so we see how the error propagates)
    * Also changed error order testing in init_octasic():
      Return status should be tested before the values of by-reference parameters
    
    Signed-off-by: Oron Peled <oron.peled at xorcom.com>
    Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10499
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/branches/2.5@10510 17933a7a-c749-41c5-a318-cba88f637d49

diff --git a/xpp/echo_loader.c b/xpp/echo_loader.c
index 2e9e696..8077b0a 100644
--- a/xpp/echo_loader.c
+++ b/xpp/echo_loader.c
@@ -292,8 +292,9 @@ int test_send(struct astribank_device *astribank)
         return ret;
 }
 
-void echo_send_data(struct astribank_device *astribank, const unsigned int addr, const unsigned int data)
+int echo_send_data(struct astribank_device *astribank, const unsigned int addr, const unsigned int data)
 {
+	int ret;
 /*	DBG("SEND: %04X -> [%04X]\n", data, addr);
 	DBG("\t\t[%04X] <- %04X\n", 0x0008, (addr >> 20));
 	DBG("\t\t[%04X] <- %04X\n", 0x000A, (addr >> 4) & ((1 << 16) - 1));
@@ -302,25 +303,48 @@ void echo_send_data(struct astribank_device *astribank, const unsigned int addr,
  */
 
 	DBG("SND:\n");
-	spi_send(astribank, 0x0008, (addr >> 20)			, 0, 0);
-	spi_send(astribank, 0x000A, (addr >> 4) & ((1 << 16) - 1)	, 0, 0);
-	spi_send(astribank, 0x0004, data				, 0, 0);
-	spi_send(astribank, 0x0000, (((addr >> 1) & 0x7) << 9) | 
+	ret = spi_send(astribank, 0x0008, (addr >> 20)			, 0, 0);
+	if (ret < 0)
+		goto failed;
+	ret = spi_send(astribank, 0x000A, (addr >> 4) & ((1 << 16) - 1)	, 0, 0);
+	if (ret < 0)
+		goto failed;
+	ret = spi_send(astribank, 0x0004, data				, 0, 0);
+	if (ret < 0)
+		goto failed;
+	ret = spi_send(astribank, 0x0000, (((addr >> 1) & 0x7) << 9) |
 				(1 << 8) | (3 << 12) | 1		, 0, 0);
+	if (ret < 0)
+		goto failed;
+	return cOCT6100_ERR_OK;
+failed:
+	AB_ERR(astribank, "echo_send_data: spi_send failed (ret = %d)\n", ret);
+	return ret;
 }
 
-unsigned int echo_recv_data(struct astribank_device *astribank, const unsigned int addr)
+int echo_recv_data(struct astribank_device *astribank, const unsigned int addr)
 {
 	unsigned int data = 0x00;
-	unsigned int ret;
+	int ret;
 
 	DBG("RCV:\n");
-	spi_send(astribank, 0x0008, (addr >> 20)			, 0, 0);
-	spi_send(astribank, 0x000A, (addr >> 4) & ((1 << 16) - 1)	, 0, 0);
-	spi_send(astribank, 0x0000, (((addr >> 1) & 0x7) << 9) | 
+	ret = spi_send(astribank, 0x0008, (addr >> 20)			, 0, 0);
+	if (ret < 0)
+		goto failed;
+	ret = spi_send(astribank, 0x000A, (addr >> 4) & ((1 << 16) - 1)	, 0, 0);
+	if (ret < 0)
+		goto failed;
+	ret = spi_send(astribank, 0x0000, (((addr >> 1) & 0x7) << 9) |
 				(1 << 8) | 1				, 0, 0);
+	if (ret < 0)
+		goto failed;
 	ret = spi_send(astribank, 0x0004, data				, 1, 0);
+	if (ret < 0)
+		goto failed;
 	return ret; 
+failed:
+	AB_ERR(astribank, "echo_recv_data: spi_send failed (ret = %d)\n", ret);
+	return ret;
 }
 
 int load_file(char *filename, unsigned char **ppBuf, UINT32 *pLen)
@@ -416,9 +440,13 @@ UINT32 Oct6100UserDriverWriteApi(tPOCT6100_WRITE_PARAMS f_pWriteParams)
 	const unsigned int 		data 		= f_pWriteParams->usWriteData;
 	const struct echo_mod		*echo_mod 	= (struct echo_mod *)(f_pWriteParams->pProcessContext);
 	struct astribank_device 	*astribank 	= echo_mod->astribank;
+	int ret;
 
-	echo_send_data(astribank, addr, data);
-
+	ret = echo_send_data(astribank, addr, data);
+	if (ret < 0) {
+		ERR("echo_send_data failed (ret = %d)\n", ret);
+		return cOCT6100_ERR_FATAL_DRIVER_WRITE_API;
+	}
 	return cOCT6100_ERR_OK;
 }
 
@@ -432,9 +460,15 @@ UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParam
 	unsigned int 			i;
 
 	for (i = 0; i < len; i++) {
+		int ret;
+
 		addr = f_pSmearParams->ulWriteAddress + (i << 1);
 		data = f_pSmearParams->usWriteData;
-		echo_send_data(astribank, addr, data);
+		ret = echo_send_data(astribank, addr, data);
+		if (ret < 0) {
+			ERR("echo_send_data failed (ret = %d)\n", ret);
+			return cOCT6100_ERR_FATAL_DRIVER_WRITE_API;
+		}
 	}
 	return cOCT6100_ERR_OK;
 }
@@ -449,9 +483,15 @@ UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParam
 	unsigned int 			i;
 
 	for (i = 0; i < len; i++) {
+		int ret;
+
 		addr = f_pBurstParams->ulWriteAddress + (i << 1);
 		data = f_pBurstParams->pusWriteData[i];
-		echo_send_data(astribank, addr, data);
+		ret = echo_send_data(astribank, addr, data);
+		if (ret < 0) {
+			ERR("echo_send_data failed (ret = %d)\n", ret);
+			return cOCT6100_ERR_FATAL_DRIVER_WRITE_API;
+		}
 	}
 	return cOCT6100_ERR_OK;
 }
@@ -461,8 +501,14 @@ UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams)
         const unsigned int              addr  		=  f_pReadParams->ulReadAddress;
 	const struct echo_mod		*echo_mod 	= (struct echo_mod *)f_pReadParams->pProcessContext;
 	struct astribank_device 	*astribank 	= echo_mod->astribank;
+	int ret;
 
-	*f_pReadParams->pusReadData = echo_recv_data(astribank, addr);
+	ret = echo_recv_data(astribank, addr);
+	if (ret < 0) {
+		ERR("echo_recv_data failed (%d)\n", ret);
+		return cOCT6100_ERR_FATAL_DRIVER_READ_API;
+	}
+	*f_pReadParams->pusReadData = ret;
 	return cOCT6100_ERR_OK;
 }
 
@@ -475,8 +521,15 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
 	unsigned int 			i;
 
 	for (i = 0;i < len; i++) {
+		unsigned int ret;
+
 		addr = f_pBurstParams->ulReadAddress + (i << 1);
-		f_pBurstParams->pusReadData[i] = echo_recv_data(astribank, addr);
+		ret = echo_recv_data(astribank, addr);
+		if (ret < 0) {
+			ERR("echo_recv_data failed (%d)\n", ret);
+			return cOCT6100_ERR_FATAL_DRIVER_READ_API;
+		}
+		f_pBurstParams->pusReadData[i] = ret;
 	}
 	return cOCT6100_ERR_OK;
 }
@@ -484,7 +537,7 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
 inline int get_ver(struct astribank_device *astribank)
 {
  
-	return  spi_send(astribank, 0, 0, 1, 1);
+	return spi_send(astribank, 0, 0, 1, 1);
 }
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -509,11 +562,12 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
 	tOCT6100_CHANNEL_OPEN					ChannelOpen;
 	UINT32							ulChanHndl;
 
-	test_send(astribank);
+	if (test_send(astribank) < 0)
+		return cOCT6100_ERR_FATAL;
 	cpld_ver = get_ver(astribank);
 	AB_INFO(astribank, "Check EC_CPLD version: %d\n", cpld_ver);
 	if (cpld_ver < 0)
-		return cpld_ver;
+		return cOCT6100_ERR_FATAL;
 	else if (cpld_ver == EC_VER_TEST) {
 		AB_INFO(astribank, "+---------------------------------------------------------+\n");
 		AB_INFO(astribank, "| WARNING: TEST HARDWARE IS ON THE BOARD INSTEAD OF EC!!! |\n");
@@ -533,9 +587,9 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
 
         if (!(echo_mod = malloc(sizeof(struct echo_mod)))) {
                 AB_ERR(astribank, "cannot allocate memory for echo_mod\n");
-                return 1;
+                return cOCT6100_ERR_FATAL;
         }
-                DBG("allocated mem for echo_mod\n");
+	DBG("allocated mem for echo_mod\n");
 
         memset(echo_mod, 0, sizeof(struct echo_mod));
 
@@ -588,14 +642,14 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
 				&pbyImageData,
 				&ulImageByteSize );
 
-	if (pbyImageData == NULL || ulImageByteSize == 0){
-		AB_ERR(astribank, "Bad pbyImageData or ulImageByteSize\n");
-		return 1;
-	}
 	if ( ulResult != 0 ) {
 		AB_ERR(astribank, "Failed load_file %s (%08X)\n", filename, ulResult);
 		return ulResult;
 	}
+	if (pbyImageData == NULL || ulImageByteSize == 0){
+		AB_ERR(astribank, "Bad pbyImageData or ulImageByteSize\n");
+		return cOCT6100_ERR_FATAL;
+	}
 
 	/* Assign the image file.*/
 	OpenChip.pbyImageFile				= pbyImageData;
@@ -618,7 +672,7 @@ UINT32 init_octasic(char *filename, struct astribank_device *astribank, int is_a
 
         if (!pApiInstance) {
                 AB_ERR(astribank, "Out of memory (can't allocate %d bytes)!\n", InstanceSize.ulApiInstanceSize);
-                return 1;
+                return cOCT6100_ERR_FATAL;
         }
 
 	/* Perform actual open of chip */
@@ -750,14 +804,15 @@ int load_echo(struct astribank_device *astribank, char *filename, int is_alaw)
 	int		iLen;
 	int		ret;
... 2030 lines suppressed ...


-- 
dahdi/tools.git



More information about the dahdi-commits mailing list