[Asterisk-cvs] zaptel pciradio.c,1.1,1.2 ztcfg.c,1.17,1.18

jim at lists.digium.com jim at lists.digium.com
Thu Nov 4 21:53:45 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv11879

Modified Files:
	pciradio.c ztcfg.c 
Log Message:
Fixed bugs in pciradio.c and ztcfg.c regarding pciradio stuff.


Index: pciradio.c
===================================================================
RCS file: /usr/cvsroot/zaptel/pciradio.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pciradio.c	4 Nov 2004 20:04:53 -0000	1.1
+++ pciradio.c	5 Nov 2004 02:55:58 -0000	1.2
@@ -157,6 +157,7 @@
 	int bursttime[NUM_CHANS];
 	int bursttimer[NUM_CHANS];
 	unsigned short present_code[NUM_CHANS];
+	unsigned short last_code[NUM_CHANS];
 	unsigned short rxcode[NUM_CHANS][NUM_CODES + 1];
 	unsigned short rxclass[NUM_CHANS][NUM_CODES + 1];
 	unsigned short txcode[NUM_CHANS][NUM_CODES + 1];;
@@ -629,12 +630,12 @@
 	}		
 	/* get index for tx code. Will be 0 if not receiving a CT */
 	myindex = 0;
-	if (ctrx && (rad->present_code[n])) myindex = rad->present_code[n];
+	if (rad->gotrx[n] && ctrx && (rad->present_code[n])) myindex = rad->present_code[n];
 	/* get actual tx code from array */
 	txcode = rad->txcode[n][myindex];
 	if (txcode & 0x8000) dcstx = 1; else if (txcode) cttx = 1;
 	if (rad->radmode[n] & RADMODE_NOENCODE) dcstx = cttx = 0;
-	if (rad->bursttimer[n]) dcstx = cttx = 0;
+	if ((!rad->gottx[n]) || rad->bursttimer[n]) dcstx = cttx = 0;
 	saudio_ctrl = 0;
 	saudio_setup = 0;
 	if (dcstx && (!dcsrx)) /* if to transmit DCS */
@@ -828,6 +829,11 @@
 			rad->gotrxtimer[x] = rad->debouncetime[x];
 		}
 		rad->gotrx[x] = gotrx;
+		if (rad->present_code[x] != rad->last_code[x])
+		{
+			_set_encdec(rad,x);
+			rad->last_code[x] = rad->present_code[x];
+		}
 		for(x = 0; x < rad->nchans; x++)
 		{
 			unsigned char mask = 1 << x;
@@ -883,7 +889,14 @@
 					if (rad->gotrx[x] != rad->gotrx1[x])
 					{
 						if (rad->gotrx[x]) {
-						    if (debug) printk("Chan %d got rx (ctcss code %d)\n",x + 1,rad->present_code[x]);
+						    if (debug)
+							{
+								if (rad->present_code[x])
+								    printk("Chan %d got rx (ctcss code %d)\n",x + 1,
+									cttable_rx[rad->rxcode[x][rad->present_code[x]]].code);
+								else
+								    printk("Chan %d got rx\n",x + 1);
+							}
 						    zt_qevent_lock(&rad->chans[x], ZT_EVENT_RINGOFFHOOK);
 						} else {
 						    if (debug) printk("Chan %d lost rx\n",x + 1);
@@ -1325,29 +1338,9 @@
 		byte1 = 0x3f;
 		byte2 = 0x3f;
 		mx828_command(rad,x, MX828_AUD_CTRL, &byte1, &byte2 );
-		byte1 = 0x09;
-		byte2 = 0xD8;
-		mx828_command(rad,x, MX828_TX_TONE, &byte1, &byte2 );
-		byte1 = 0x35;
-		byte2 = 0xcb;
-		mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-		byte1 = 0x47;
-		byte2 = 0xc0;
-		mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-#if	0
-		byte1 = 0x1e;
-		byte2 = 0x88;
-		mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-		byte1 = 0x23;
-		byte2 = 0xd8;
-		mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-		byte1 = 0x34;
-		byte2 = 0xcb;
-		mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-#endif
-		byte1 = 0x80;
+		byte1 = 0;
 		mx828_command(rad,x, MX828_SAUDIO_SETUP, &byte1, &byte2 );
-		byte1 = 0xe0;
+		byte1 = 0;
 		mx828_command(rad,x, MX828_SAUDIO_CTRL, &byte1, &byte2 );
 		byte1 = 0xc0;
 		mx828_command(rad,x, MX828_GEN_CTRL, &byte1, &byte2);
@@ -1451,7 +1444,7 @@
 			rad->readdma = rad->writedma + ZT_MAX_CHUNKSIZE * 8;		/* in bytes */
 
 			if (pciradio_initialize(rad)) {
-				printk("pciradio: Unable to intialize FXS\n");
+				printk("pciradio: Unable to intialize\n");
 				/* Set Reset Low */
 				x=inb(rad->ioaddr + RAD_CNTL);
 				outb((~0x1)&x, rad->ioaddr + RAD_CNTL);

Index: ztcfg.c
===================================================================
RCS file: /usr/cvsroot/zaptel/ztcfg.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ztcfg.c	4 Nov 2004 20:04:53 -0000	1.17
+++ ztcfg.c	5 Nov 2004 02:55:58 -0000	1.18
@@ -906,7 +906,7 @@
 				}
 				if (txtones[i])
 				{
-					p.radpar = ZT_RADPAR_RXTONE;
+					p.radpar = ZT_RADPAR_TXTONE;
 					p.index = i;
 					p.data = txtones[i];
 					if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)




More information about the svn-commits mailing list