[Asterisk-cvs] zaptel wcfxs.c,1.58,1.59

markster at lists.digium.com markster at lists.digium.com
Sat May 15 18:08:26 CDT 2004


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

Modified Files:
	wcfxs.c 
Log Message:
Save calibration registers, add "lowpower" option


Index: wcfxs.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxs.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- wcfxs.c	15 May 2004 19:26:16 -0000	1.58
+++ wcfxs.c	15 May 2004 22:19:51 -0000	1.59
@@ -150,6 +150,11 @@
 #define PEGTIME		50 * 8		/* 50ms peak to peak gets us rings of 10 Hz or more */
 #define PEGCOUNT	5		/* 5 cycles of pegging means RING */
 
+#define NUM_CAL_REGS 12
+
+struct calregs {
+	unsigned char vals[NUM_CAL_REGS];
+};
 
 struct wcfxs {
 	struct pci_dev *dev;
@@ -194,6 +199,7 @@
 			int idletxhookstate[NUM_CARDS];		/* IDLE changing hook state */
 			int lasttxhook[NUM_CARDS];
 			int palarms[NUM_CARDS];
+			struct calregs calregs[NUM_CARDS];
 		} fxs;
 	} mod;
 
@@ -224,6 +230,7 @@
 static int debug = 0;
 static int robust = 0;
 static int timingonly = 0;
+static int lowpower = 0;
 
 static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast , int manual, int sane);
 
@@ -1101,8 +1108,15 @@
 				printk("Proslic Passed Auto Calibration on Second Attempt\n");
 			}
 		}
+		/* Save calibration vectors */
+		for (x=0;x<NUM_CAL_REGS;x++)
+			wc->mod.fxs.calregs[card].vals[x] = wcfxs_getreg(wc, card, 96 + x);
 #endif
 
+	} else {
+		/* Restore calibration registers */
+		for (x=0;x<NUM_CAL_REGS;x++)
+			wcfxs_setreg(wc, card, 96 + x, wc->mod.fxs.calregs[card].vals[x]);
 	}
 	/* Calibration complete, restore original values */
 	for (x=0;x<5;x++) {
@@ -1138,12 +1152,13 @@
     wcfxs_setreg(wc, card, 19, 0xff);
     wcfxs_setreg(wc, card, 20, 0xff);
     wcfxs_setreg(wc, card, 73, 0x04);
+    if (lowpower)
+    	wcfxs_setreg(wc, card, 72, 0x10);
 
 #if 0
     wcfxs_setreg(wc, card, 21, 0x00); 	// enable interrupt
     wcfxs_setreg(wc, card, 22, 0x02); 	// Loop detection interrupt
     wcfxs_setreg(wc, card, 23, 0x01); 	// DTMF detection interrupt
-    wcfxs_setreg(wc, card, 72, 0x20);
 #endif
 
 #if 0
@@ -1888,7 +1903,8 @@
 MODULE_PARM(debug, "i");
 MODULE_PARM(robust, "i");
 MODULE_PARM(timingonly, "i");
-MODULE_DESCRIPTION("Wildcard S100P Zaptel Driver");
+MODULE_PARM(lowpower, "i");
+MODULE_DESCRIPTION("Wildcard TDM400P Zaptel Driver");
 MODULE_AUTHOR("Mark Spencer <markster at linux-support.net>");
 #ifdef MODULE_LICENSE
 MODULE_LICENSE("GPL");




More information about the svn-commits mailing list