[zaptel-commits] kpfleming: branch kpfleming/battery_alarms r3907 - in /team/kpfleming/battery...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Thu Feb 28 11:05:12 CST 2008


Author: kpfleming
Date: Thu Feb 28 11:05:11 2008
New Revision: 3907

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3907
Log:
various things:

- move battery debounce, battery alarm and battery threshold values into fxo_modes structure so their defaults can be set on a regional basis
- change the variables for these items to unsigned, since signed values are not appropriate
- store these values in milliseconds, and put the appropriate divisor into voicedaa_check_hook() to simplify conversion from milliseconds to 'number of function calls per second'
- remove '_opermode' module parameter, since it would always be overwritten anyway
- copy special 'AUSTRALIA' mode triggers to wctdm24xxp from wctdm



Modified:
    team/kpfleming/battery_alarms/kernel/wctdm.c
    team/kpfleming/battery_alarms/kernel/wctdm24xxp/base.c
    team/kpfleming/battery_alarms/kernel/wctdm24xxp/wctdm24xxp.h

Modified: team/kpfleming/battery_alarms/kernel/wctdm.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/battery_alarms/kernel/wctdm.c?view=diff&rev=3907&r1=3906&r2=3907
==============================================================================
--- team/kpfleming/battery_alarms/kernel/wctdm.c (original)
+++ team/kpfleming/battery_alarms/kernel/wctdm.c Thu Feb 28 11:05:11 2008
@@ -110,7 +110,6 @@
 
 static struct fxo_mode {
 	char *name;
-	/* FXO */
 	int ohs;
 	int ohs2;
 	int rz;
@@ -121,84 +120,87 @@
 	int acim;
 	int ring_osc;
 	int ring_x;
+	unsigned int battdebounce; /* in milliseconds */
+	unsigned int battalarm; /* in milliseconds */
+	unsigned int battthresh; /* unknown units */
 } fxo_modes[] =
 {
-	{ "FCC", 0, 0, 0, 1, 0, 0x3, 0, 0, }, 	/* US, Canada */
-	{ "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a, },
+	{ "FCC", 0, 0, 0, 1, 0, 0x3, 0, 0, 64, 1000, 3, }, 	/* US, Canada */
+	{ "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a, 64, 1000, 3, },
 										/* Austria, Belgium, Denmark, Finland, France, Germany, 
 										   Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands,
 										   Norway, Portugal, Spain, Sweden, Switzerland, and UK */
-	{ "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, },
-	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, },
-	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, },
-	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, },
-	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, },
-	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, },
-	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },	/* Current loop >= 20ma */
-	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, },
-	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, },
-	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, },
-	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, },
-	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, },
-	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, },
-	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, },
-	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, },
-	{ "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, },
+	{ "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, 64, 1000, 3, },
+	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, 64, 1000, 3, },
+	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, 64, 1000, 3, },
+	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 64, 1000, 3, },
+	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },	/* Current loop >= 20ma */
+	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 64, 1000, 3, },
+	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, 64, 1000, 3, },
+	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, 64, 1000, 3, },
+	{ "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
 };
 
 #include "zaptel.h"
@@ -249,15 +251,7 @@
 
 #define DEFAULT_RING_DEBOUNCE	64		/* Ringer Debounce (64 ms) */
 
-/* the constants below control the 'debounce' periods enforced by the
-   check_hook routines; these routines are called once every 4 interrupts
-   (the interrupt cycles around the four modules), but each function is only performed
-   once every four cycles, so the periods are specified in _16 millisecond_ increments
-*/
-#define DEFAULT_BATT_DEBOUNCE	4		/* Battery debounce (64 ms) */
-#define DEFAULT_BATT_ALARM	62		/* Battery alarm debounce (992 ms) */
-#define POLARITY_DEBOUNCE 	4		/* Polarity debounce (64 ms) */
-#define DEFAULT_BATT_THRESH	3		/* Anything under this is "no battery" */
+#define POLARITY_DEBOUNCE 	64		/* Polarity debounce (64 ms) */
 
 #define OHT_TIMER		6000	/* How long after RING to retain OHT */
 
@@ -322,8 +316,8 @@
 #endif			
 			int ringdebounce;
 			int offhook;
-			int battdebounce;
-			int battalarm;
+			unsigned int battdebounce;
+			unsigned int battalarm;
 			enum battery_state battery;
 		        int lastpol;
 		        int polarity;
@@ -371,9 +365,9 @@
 
 static void wctdm_release(struct wctdm *wc);
 
-static int battdebounce = DEFAULT_BATT_DEBOUNCE;
-static int battalarm = DEFAULT_BATT_ALARM;
-static int battthresh = DEFAULT_BATT_THRESH;
+static unsigned int battdebounce;
+static unsigned int battalarm;
+static unsigned int battthresh;
 static int ringdebounce = DEFAULT_RING_DEBOUNCE;
 static int fwringdetect = 0;
 static int debug = 0;
@@ -842,6 +836,8 @@
 
 static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card)
 {
+#define MS_PER_CHECK_HOOK 16
+
 #ifndef AUDIO_RINGCHECK
 	unsigned char res;
 #endif	
@@ -867,7 +863,6 @@
 	}
 	if (poopy)
 		return;
-#ifndef AUDIO_RINGCHECK
 	if (!fxo->offhook) {
 		if (fwringdetect) {
 			res = wc->reg0shadow[card] & 0x60;
@@ -921,8 +916,9 @@
 			}
 		}
 	}
-#endif
+
 	b = wc->reg1shadow[card];
+
 	if (abs(b) < battthresh) {
 		/* possible existing states:
 		   battery lost, no debounce timer
@@ -957,12 +953,12 @@
 					zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
 					/* set the alarm timer, taking into account that part of its time
 					   period has already passed while debouncing occurred */
-					fxo->battalarm = battalarm - battdebounce;
+					fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK;
 #endif
 				}
 			} else {
 				/* start the debounce timer to verify that battery has been lost */
-				fxo->battdebounce = battdebounce;
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
 			}
 		}
 	} else {
@@ -999,25 +995,25 @@
 #endif
 					/* set the alarm timer, taking into account that part of its time
 					   period has already passed while debouncing occurred */
-					fxo->battalarm = battalarm - battdebounce;
+					fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK;
 				}
 			} else {
 				/* start the debounce timer to verify that battery has appeared */
-				fxo->battdebounce = battdebounce;
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
 			}
 		}
 
 		if (fxo->lastpol >= 0) {
-		    if (b < 0) {
-			fxo->lastpol = -1;
-			fxo->polaritydebounce = POLARITY_DEBOUNCE;
-		    }
+			if (b < 0) {
+				fxo->lastpol = -1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
+			}
 		} 
 		if (fxo->lastpol <= 0) {
-		    if (b > 0) {
-			fxo->lastpol = 1;
-			fxo->polaritydebounce = POLARITY_DEBOUNCE;
-		    }
+			if (b > 0) {
+				fxo->lastpol = 1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
+			}
 		}
 	}
 
@@ -1030,19 +1026,19 @@
 	}
 
 	if (fxo->polaritydebounce) {
-	        fxo->polaritydebounce--;
-		if (fxo->polaritydebounce < 1) {
+		if (--fxo->polaritydebounce == 0) {
 		    if (fxo->lastpol != fxo->polarity) {
 				if (debug)
 					printk("%lu Polarity reversed (%d -> %d)\n", jiffies, 
 				       fxo->polarity, 
 				       fxo->lastpol);
 				if (fxo->polarity)
-				    zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
+					zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
 				fxo->polarity = fxo->lastpol;
 		    }
 		}
 	}
+#undef MS_PER_CHECK_HOOK
 }
 
 static inline void wctdm_proslic_check_hook(struct wctdm *wc, int card)
@@ -2553,7 +2549,8 @@
 {
 	int res;
 	int x;
-	for (x=0;x<(sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) {
+
+	for (x = 0; x < (sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) {
 		if (!strcmp(fxo_modes[x].name, opermode))
 			break;
 	}
@@ -2561,16 +2558,30 @@
 		_opermode = x;
 	} else {
 		printk("Invalid/unknown operating mode '%s' specified.  Please choose one of:\n", opermode);
-		for (x=0;x<sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++)
+		for (x = 0; x < sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++)
 			printk("  %s\n", fxo_modes[x].name);
 		printk("Note this option is CASE SENSITIVE!\n");
 		return -ENODEV;
 	}
-	if (!strcmp(fxo_modes[_opermode].name, "AUSTRALIA")) {
-		boostringer=1;
-		fxshonormode=1;
-	}
-	
+
+	if (!strcmp(opermode, "AUSTRALIA")) {
+		boostringer = 1;
+		fxshonormode = 1;
+	}
+
+	/* for the voicedaa_check_hook defaults, if the user has not overridden
+	   them by specifying them as module parameters, then get the values
+	   from the selected operating mode
+	*/
+	if (battdebounce != 0) {
+		battdebounce = fxo_modes[_opermode].battdebounce;
+	}
+	if (battalarm != 0) {
+		battalarm = fxo_modes[_opermode].battalarm;
+	}
+	if (battthresh != 0) {
+		battthresh = fxo_modes[_opermode].battthresh;
+	}
 
 	res = zap_pci_module(&wctdm_driver);
 	if (res)
@@ -2588,16 +2599,15 @@
 module_param(loopcurrent, int, 0600);
 module_param(reversepolarity, int, 0600);
 module_param(robust, int, 0600);
-module_param(_opermode, int, 0600);
 module_param(opermode, charp, 0600);
 module_param(timingonly, int, 0600);
 module_param(lowpower, int, 0600);
 module_param(boostringer, int, 0600);
 module_param(fastringer, int, 0600);
 module_param(fxshonormode, int, 0600);
-module_param(battdebounce, int, 0600);
-module_param(battalarm, int, 0600);
-module_param(battthresh, int, 0600);
+module_param(battdebounce, uint, 0600);
+module_param(battalarm, uint, 0600);
+module_param(battthresh, uint, 0600);
 module_param(ringdebounce, int, 0600);
 module_param(fwringdetect, int, 0600);
 module_param(alawoverride, int, 0600);
@@ -2611,7 +2621,6 @@
 MODULE_PARM(loopcurrent, "i");
 MODULE_PARM(reversepolarity, "i");
 MODULE_PARM(robust, "i");
-MODULE_PARM(_opermode, "i");
 MODULE_PARM(opermode, "s");
 MODULE_PARM(timingonly, "i");
 MODULE_PARM(lowpower, "i");

Modified: team/kpfleming/battery_alarms/kernel/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/battery_alarms/kernel/wctdm24xxp/base.c?view=diff&rev=3907&r1=3906&r2=3907
==============================================================================
--- team/kpfleming/battery_alarms/kernel/wctdm24xxp/base.c (original)
+++ team/kpfleming/battery_alarms/kernel/wctdm24xxp/base.c Thu Feb 28 11:05:11 2008
@@ -148,7 +148,6 @@
 
 static struct fxo_mode {
 	char *name;
-	/* FXO */
 	int ohs;
 	int ohs2;
 	int rz;
@@ -159,84 +158,87 @@
 	int acim;
 	int ring_osc;
 	int ring_x;
+	unsigned int battdebounce; /* in milliseconds */
+	unsigned int battalarm; /* in milliseconds */
+	unsigned int battthresh; /* unknown units */
 } fxo_modes[] =
 {
-	{ "FCC", 0, 0, 0, 1, 0, 0x3, 0, 0, }, 	/* US, Canada */
-	{ "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a, },
+	{ "FCC", 0, 0, 0, 1, 0, 0x3, 0, 0, 64, 1000, 3, }, 	/* US, Canada */
+	{ "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a, 64, 1000, 3, },
 										/* Austria, Belgium, Denmark, Finland, France, Germany, 
 										   Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands,
 										   Norway, Portugal, Spain, Sweden, Switzerland, and UK */
-	{ "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, },
-	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, },
-	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, },
-	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, },
-	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, },
-	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, },
-	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },	/* Current loop >= 20ma */
-	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, },
-	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, },
-	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, },
-	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, },
-	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, },
-	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, },
-	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, },
-	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, },
-	{ "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, },
-	{ "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, },
-	{ "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, },
-	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, },
+	{ "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, 64, 1000, 3, },
+	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, 64, 1000, 3, },
+	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, 64, 1000, 3, },
+	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 64, 1000, 3, },
+	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },	/* Current loop >= 20ma */
+	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 64, 1000, 3, },
+	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, 64, 1000, 3, },
+	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, 64, 1000, 3, },
+	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 64, 1000, 3, },
+	{ "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, 64, 1000, 3, },
+	{ "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, 64, 1000, 3, },
+	{ "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, 64, 1000, 3, },
 };
 
 #define DEBUG_CARD (1 << 0)
@@ -262,9 +264,9 @@
 static void wctdm_release(struct wctdm *wc);
 
 static int fxovoltage = 0;
-static int battdebounce = DEFAULT_BATT_DEBOUNCE;
-static int battalarm = DEFAULT_BATT_ALARM;
-static int battthresh = DEFAULT_BATT_THRESH;
+static unsigned int battdebounce;
+static unsigned int battalarm;
+static unsigned int battthresh;
 static int debug = 0;
 static int robust = 0;
 static int lowpower = 0;
@@ -1331,6 +1333,8 @@
 
 static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card)
 {
+#define MS_PER_CHECK_HOOK 1
+
 	unsigned char res;
 	signed char b;
 	struct fxo *fxo = &wc->mods[card].fxo;
@@ -1441,12 +1445,12 @@
 					zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
 					/* set the alarm timer, taking into account that part of its time
 					   period has already passed while debouncing occurred */
-					fxo->battalarm = battalarm - battdebounce;
+					fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK;
 #endif
 				}
 			} else {
 				/* start the debounce timer to verify that battery has been lost */
-				fxo->battdebounce = battdebounce;
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
 			}
 		}
 	} else {
@@ -1483,25 +1487,25 @@
 #endif
 					/* set the alarm timer, taking into account that part of its time
 					   period has already passed while debouncing occurred */
-					fxo->battalarm = battalarm - battdebounce;
+					fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK;
 				}
 			} else {
 				/* start the debounce timer to verify that battery has appeared */
-				fxo->battdebounce = battdebounce;
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
 			}
 		}
 
 		if (fxo->lastpol >= 0) {
-		    if (b < 0) {
-			fxo->lastpol = -1;
-			fxo->polaritydebounce = POLARITY_DEBOUNCE;
-		    }
+			if (b < 0) {
+				fxo->lastpol = -1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
+			}
 		} 
 		if (fxo->lastpol <= 0) {
-		    if (b > 0) {
-			fxo->lastpol = 1;
-			fxo->polaritydebounce = POLARITY_DEBOUNCE;
-		    }
+			if (b > 0) {
+				fxo->lastpol = 1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
+			}
 		}
 	}
 
@@ -1519,14 +1523,15 @@
 		    if (fxo->lastpol != fxo->polarity) {
 			if (debug & DEBUG_CARD)
 				printk("%lu Polarity reversed (%d -> %d)\n", jiffies, 
-			       fxo->polarity, 
-			       fxo->lastpol);
+				       fxo->polarity, 
+				       fxo->lastpol);
 			if (fxo->polarity)
-			    zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
+				zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
 			fxo->polarity = fxo->lastpol;
 		    }
 		}
 	}
+#undef MS_PER_CHECK_HOOK
 }
 
 static inline void wctdm_proslic_check_hook(struct wctdm *wc, int card)
@@ -4427,7 +4432,7 @@
 	int res;
 	int x;
 
-	for (x=0;x<(sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) {
+	for (x = 0; x < (sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) {
 		if (!strcmp(fxo_modes[x].name, opermode))
 			break;
 	}
@@ -4435,10 +4440,29 @@
 		_opermode = x;
 	} else {
 		printk("Invalid/unknown operating mode '%s' specified.  Please choose one of:\n", opermode);
-		for (x=0;x<sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++)
+		for (x = 0; x < sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++)
 			printk("  %s\n", fxo_modes[x].name);
 		printk("Note this option is CASE SENSITIVE!\n");
 		return -ENODEV;
+	}
+
+	if (!strcmp(opermode, "AUSTRALIA")) {
+		boostringer = 1;
+		fxshonormode = 1;
+	}
+
+	/* for the voicedaa_check_hook defaults, if the user has not overridden
+	   them by specifying them as module parameters, then get the values
+	   from the selected operating mode
+	*/
+	if (battdebounce != 0) {
+		battdebounce = fxo_modes[_opermode].battdebounce;
+	}
+	if (battalarm != 0) {
+		battalarm = fxo_modes[_opermode].battalarm;
+	}
+	if (battthresh != 0) {
+		battthresh = fxo_modes[_opermode].battthresh;
 	}
 
 	res = zap_pci_module(&wctdm_driver);
@@ -4457,15 +4481,14 @@
 module_param(fxovoltage, int, 0600);
 module_param(loopcurrent, int, 0600);
 module_param(robust, int, 0600);
-module_param(_opermode, int, 0600);
 module_param(opermode, charp, 0600);
 module_param(lowpower, int, 0600);
 module_param(boostringer, int, 0600);
 module_param(fastringer, int, 0600);
 module_param(fxshonormode, int, 0600);
-module_param(battdebounce, int, 0600);
-module_param(battalarm, int, 0600);
-module_param(battthresh, int, 0600);
+module_param(battdebounce, uint, 0600);
+module_param(battalarm, uint, 0600);
+module_param(battthresh, uint, 0600);
 module_param(alawoverride, int, 0600);
 module_param(nativebridge, int, 0600);
 module_param(fxotxgain, int, 0600);
@@ -4487,7 +4510,6 @@
 MODULE_PARM(fxovoltage, "i");
 MODULE_PARM(loopcurrent, "i");
 MODULE_PARM(robust, "i");
-MODULE_PARM(_opermode, "i");
 MODULE_PARM(opermode, "s");
 MODULE_PARM(lowpower, "i");
 MODULE_PARM(boostringer, "i");

Modified: team/kpfleming/battery_alarms/kernel/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/battery_alarms/kernel/wctdm24xxp/wctdm24xxp.h?view=diff&rev=3907&r1=3906&r2=3907
==============================================================================
--- team/kpfleming/battery_alarms/kernel/wctdm24xxp/wctdm24xxp.h (original)
+++ team/kpfleming/battery_alarms/kernel/wctdm24xxp/wctdm24xxp.h Thu Feb 28 11:05:11 2008
@@ -33,15 +33,10 @@
 
 /*!
  * \brief Default ringer debounce (in ms)
- *
- * \todo This value differs from that in wctdm.  In that module, it is 64 ms
- *       instead of 128 ms.  Which one is more appropriate?
  */
 #define DEFAULT_RING_DEBOUNCE	128
-#define DEFAULT_BATT_DEBOUNCE	64		/* Battery debounce (in ms) */
-#define DEFAULT_BATT_ALARM	1000		/* Battery alarm (in ms) */
+
 #define POLARITY_DEBOUNCE	64		/* Polarity debounce (in ms) */
-#define DEFAULT_BATT_THRESH	3		/* Anything under this is "no battery" */
 
 #define OHT_TIMER		6000	/* How long after RING to retain OHT */
 




More information about the zaptel-commits mailing list