[Asterisk-cvs] zaptel wctdm.c,1.90,1.91
markster at lists.digium.com
markster at lists.digium.com
Tue Nov 23 12:55:05 CST 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv10169
Modified Files:
wctdm.c
Log Message:
Make threshold and debounce for battery configurable
Index: wctdm.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- wctdm.c 9 Nov 2004 14:45:20 -0000 1.90
+++ wctdm.c 23 Nov 2004 17:54:43 -0000 1.91
@@ -246,9 +246,9 @@
#define FLAG_READ 2
#define RING_DEBOUNCE 64 /* Ringer Debounce (in ms) */
-#define BATT_DEBOUNCE 64 /* Battery debounce (in ms) */
+#define DEFAULT_BATT_DEBOUNCE 64 /* Battery debounce (in ms) */
#define POLARITY_DEBOUNCE 64 /* Polarity debounce (in ms) */
-#define BATT_THRESH 3 /* Anything under this is "no battery" */
+#define DEFAULT_BATT_THRESH 3 /* Anything under this is "no battery" */
#define OHT_TIMER 6000 /* How long after RING to retain OHT */
@@ -347,6 +347,8 @@
static void wctdm_release(struct wctdm *wc);
+static int battdebounce = DEFAULT_BATT_DEBOUNCE;
+static int battthresh = DEFAULT_BATT_THRESH;
static int debug = 0;
static int robust = 0;
static int timingonly = 0;
@@ -1444,7 +1446,7 @@
}
}
#endif
- if (abs(b) < BATT_THRESH) {
+ if (abs(b) < battthresh) {
wc->mod.fxo.nobatttimer[card]++;
#if 0
if (wc->mod.fxo.battery[card])
@@ -1466,10 +1468,10 @@
#else
zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
#endif
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod.fxo.battdebounce[card] = battdebounce;
} else if (!wc->mod.fxo.battery[card])
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
- } else if (abs(b) > BATT_THRESH) {
+ wc->mod.fxo.battdebounce[card] = battdebounce;
+ } else if (abs(b) > battthresh) {
if (!wc->mod.fxo.battery[card] && !wc->mod.fxo.battdebounce[card]) {
if (debug)
printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1,
@@ -1486,9 +1488,9 @@
#endif
wc->mod.fxo.battery[card] = 1;
wc->mod.fxo.nobatttimer[card] = 0;
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod.fxo.battdebounce[card] = battdebounce;
} else if (wc->mod.fxo.battery[card])
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod.fxo.battdebounce[card] = battdebounce;
if (wc->mod.fxo.lastpol[card] >= 0) {
if (b < 0) {
@@ -1504,7 +1506,7 @@
}
} else {
/* It's something else... */
- wc->mod.fxo.battdebounce[card] = BATT_DEBOUNCE;
+ wc->mod.fxo.battdebounce[card] = battdebounce;
}
if (wc->mod.fxo.battdebounce[card])
wc->mod.fxo.battdebounce[card]--;
@@ -2188,6 +2190,8 @@
MODULE_PARM(lowpower, "i");
MODULE_PARM(boostringer, "i");
MODULE_PARM(fxshonormode, "i");
+MODULE_PARM(battdebounce, "i");
+MODULE_PARM(battthresh, "i");
MODULE_DESCRIPTION("Wildcard TDM400P Zaptel Driver");
MODULE_AUTHOR("Mark Spencer <markster at digium.com>");
#ifdef MODULE_LICENSE
More information about the svn-commits
mailing list