[Asterisk-cvs] zaptel wcfxo.c,1.19,1.20

markster at lists.digium.com markster at lists.digium.com
Mon Nov 17 15:39:59 CST 2003


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

Modified Files:
	wcfxo.c 
Log Message:
Rid ourselves of static local variables


Index: wcfxo.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxo.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- wcfxo.c	11 Aug 2003 19:27:14 -0000	1.19
+++ wcfxo.c	17 Nov 2003 22:06:15 -0000	1.20
@@ -118,6 +118,7 @@
 	int rreadpos;
 	unsigned int pegtimer;
 	int pegcount;
+	int peg;
 	int battdebounce;
 	int nobatttimer;
 	int ringdebounce;
@@ -140,6 +141,9 @@
 	dma_addr_t	writedma;
 	volatile int *writechunk;					/* Double-word aligned write memory */
 	volatile int *readchunk;					/* Double-word aligned read memory */
+#ifdef ZERO_BATT_RING
+	int onhook;
+#endif
 #ifdef ENABLE_TASKLETS
 	int taskletrun;
 	int taskletsched;
@@ -287,7 +291,6 @@
 	int realreg;
 	int realval;
 	int sample;
-	static int peg = 0;
 	if (ints & 0x04)
 		/* Read is at interrupt address.  Valid data is available at normal offset */
 		readchunk = wc->readchunk;
@@ -323,12 +326,12 @@
 			if ((wc->pegtimer < PEGTIME) && (wc->pegtimer > MINPEGTIME))
 				wc->pegcount++;
 			wc->pegtimer = 0;
-			peg = 1;
+			wc->peg = 1;
 		} else if ((sample < -32000) && (peg != -1)) {
 			if ((wc->pegtimer < PEGTIME) && (wc->pegtimer > MINPEGTIME))
 				wc->pegcount++;
 			wc->pegtimer = 0;
-			peg = -1;
+			wc->peg = -1;
 		}
 		wc->chan.readchunk[x] = ZT_LIN2X((sample), (&wc->chan));
 	}
@@ -389,9 +392,6 @@
 	struct wcfxo *wc = dev_id;
 	unsigned char ints;
 	unsigned char b;
-#ifdef ZERO_BATT_RING
-	static int onhook = 0;
-#endif
 #ifdef DEBUG_RING
 	static int oldb = 0;
 	static int oldcnt = 0;
@@ -451,7 +451,7 @@
 					if (debug)
 						printk("Signalled On Hook\n");
 #ifdef	ZERO_BATT_RING
-					onhook++;
+					wc->onhook++;
 #endif
 				}
 #else
@@ -473,8 +473,8 @@
 				if (debug)
 					printk("BATTERY!\n");
 #ifdef	ZERO_BATT_RING
-				if (onhook) {
-					onhook = 0;
+				if (wc->onhook) {
+					wc->onhook = 0;
 					zt_hooksig(&wc->chan, ZT_RXSIG_OFFHOOK);
 					if (debug)
 						printk("Signalled Off Hook\n");




More information about the svn-commits mailing list