[zaptel-commits] mogorman: trunk r1704 - /trunk/ztcodec_dte.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Dec 12 13:10:45 MST 2006


Author: mogorman
Date: Tue Dec 12 14:10:44 2006
New Revision: 1704

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1704
Log:
improved support for loading multiple cards.

Modified:
    trunk/ztcodec_dte.c

Modified: trunk/ztcodec_dte.c
URL: http://svn.digium.com/view/zaptel/trunk/ztcodec_dte.c?view=diff&rev=1704&r1=1703&r2=1704
==============================================================================
--- trunk/ztcodec_dte.c (original)
+++ trunk/ztcodec_dte.c Tue Dec 12 14:10:44 2006
@@ -318,6 +318,7 @@
 	unsigned int last_rcommand;
 	unsigned int last_rparm2;
 	unsigned int seq_num;
+	long timeout;
 
 	unsigned int ztsnd_rtx;
 	unsigned int ztsnd_0010_rtx;
@@ -1158,18 +1159,15 @@
 	wcdte_setctl(wc, 0x0084, 0x00000000);
 }
 
-
-static long timeout = 1 * HZ;		/* 1 sec */
-
 static int wcdte_waitfor_csmencaps(struct wcdte *wc, unsigned int mask, int use_mask)
 {
 	int ret;
 
 
 	if (use_mask)
-		ret = wait_event_interruptible_timeout(wc->regq, (wc->rcvflags == mask), timeout);
+		ret = wait_event_interruptible_timeout(wc->regq, (wc->rcvflags == mask), wc->timeout);
 	else
-		ret = wait_event_interruptible_timeout(wc->regq, (wc->last_rcommand == wc->last_command_sent), timeout);
+		ret = wait_event_interruptible_timeout(wc->regq, (wc->last_rcommand == wc->last_command_sent), wc->timeout);
 	wc->rcvflags = 0;
 	wc->last_rcommand = 0;
 	wc->last_command_sent = 0;
@@ -1266,7 +1264,7 @@
 
 	} while (byteloc < sizeof(wcdte_firmware)-20);
 
-	/* Waitfor code to start */
+	wc->timeout = 10 * HZ;
 	if (wcdte_waitfor_csmencaps(wc, RCV_CSMENCAPS, 1))
 		return(1);
 	
@@ -1309,7 +1307,6 @@
 	zt_send_cmd(wc, CMD_MSG_VOIP_INDCTRL(wc->seq_num++, chan2), CMD_MSG_VOIP_INDCTRL_LEN, 0x8084);
 	zt_send_cmd(wc, CMD_MSG_VOIP_VOPENA(wc->seq_num++, chan1, complicated), CMD_MSG_VOIP_VOPENA_LEN, 0x8000);
 	zt_send_cmd(wc, CMD_MSG_VOIP_VOPENA(wc->seq_num++, chan2, simple), CMD_MSG_VOIP_VOPENA_LEN, 0x8000);
-	debug_packets = 0;
 
 	*dte_chan1 = chan1;
 	*dte_chan2 = chan2;
@@ -1331,8 +1328,6 @@
 	/* Remove the channels */
 	zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan1), CMD_MSG_DESTROY_CHANNEL_LEN,  0x0011);
 	zt_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan2), CMD_MSG_DESTROY_CHANNEL_LEN, 0x0011);
-
-	debug_packets=0;
 
 	return 1;
 }
@@ -1371,7 +1366,7 @@
 	zt_send_cmd(wc, CMD_MSG_TDM_OPT(wc->seq_num++), CMD_MSG_TDM_OPT_LEN, 0x0435);
 #endif
 
-	timeout = HZ/100 + 1; 	/* 10msec */
+	wc->timeout = HZ/100 + 1; 	/* 10msec */
 
 	return(0);
 }
@@ -1424,6 +1419,7 @@
 			wc->cmdq_wndx = 0;
 			wc->cmdq_rndx = 0;
 			wc->seq_num = 6;
+			wc->timeout = 1 * HZ;		/* 1 sec */
 			wc->ztsnd_rtx = 0;
 			wc->ztsnd_0010_rtx = 0;
 			



More information about the zaptel-commits mailing list