diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-11-23 17:54:43 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-11-23 17:54:43 +0000 |
commit | 29ed443345be85e6575e39444bd8377ca0d8f56d (patch) | |
tree | b72c464efefa31b7ef053d49a0a5259ea35a157d /wctdm.c | |
parent | 2c3fd9352ea6baff51849b3a16a8c6654e9a8d73 (diff) |
Make threshold and debounce for battery configurable
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@503 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm.c')
-rwxr-xr-x | wctdm.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -246,9 +246,9 @@ static struct fxo_mode { #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 struct wctdm *ifaces[WC_MAX_IFACES]; 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 @@ static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) } } #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 @@ static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) #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 @@ static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) #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 @@ static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) } } 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(timingonly, "i"); 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@digium.com>"); #ifdef MODULE_LICENSE |