[zaptel-commits] sruffell: branch sruffell/voicebus r3935 - in /team/sruffell/voicebus: ./ bui...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Wed Mar 5 12:41:13 CST 2008


Author: sruffell
Date: Wed Mar  5 12:41:13 2008
New Revision: 3935

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3935
Log:
Merging in the changes from the zaptel/team/kpfleming/battery_alarms into the
head of the voicebus branch.



Modified:
    team/sruffell/voicebus/   (props changed)
    team/sruffell/voicebus/Makefile
    team/sruffell/voicebus/README
    team/sruffell/voicebus/build_tools/test_kernel_git
    team/sruffell/voicebus/hdlcstress.c
    team/sruffell/voicebus/hdlctest.c
    team/sruffell/voicebus/kernel/GNUmakefile
    team/sruffell/voicebus/kernel/wctdm.c
    team/sruffell/voicebus/kernel/wctdm24xxp/base.c
    team/sruffell/voicebus/kernel/wctdm24xxp/wctdm24xxp.h
    team/sruffell/voicebus/kernel/zaptel-base.c
    team/sruffell/voicebus/zaptel.conf.sample
    team/sruffell/voicebus/zonedata.c

Propchange: team/sruffell/voicebus/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/sruffell/voicebus/
------------------------------------------------------------------------------
    automerge-email = kpfleming at digium.com

Propchange: team/sruffell/voicebus/
------------------------------------------------------------------------------
--- branch-1.2-blocked (original)
+++ branch-1.2-blocked Wed Mar  5 12:41:13 2008
@@ -1,1 +1,1 @@
-/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847
+/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847,3917

Modified: team/sruffell/voicebus/Makefile
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/Makefile?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/Makefile (original)
+++ team/sruffell/voicebus/Makefile Wed Mar  5 12:41:13 2008
@@ -165,6 +165,8 @@
 CFLAGS+=-DSTANDALONE_ZAPATA
 ifeq ($(BUILDVER),linux24)
 KMAKE	= $(MAKE) -C kernel HOTPLUG_FIRMWARE=no \
+  HOSTCC=$(HOSTCC) ARCH=$(ARCH) KSRC=$(KSRC) LD=$(LD) CC=$(CC) \
+  UNAME_M=$(UNAME_M) \
   BUILD_TOPDIR_MODULES="$(BUILD_TOPDIR_MODULES)" BUILD_SUBDIR_MODULES="$(BUILD_SUBDIR_MODULES)"
 else
 KMAKE  = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)/kernel \

Modified: team/sruffell/voicebus/README
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/README?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/README (original)
+++ team/sruffell/voicebus/README Wed Mar  5 12:41:13 2008
@@ -384,9 +384,7 @@
     * 16: DEBUG_ECHOCAN
     * 32: DEBUG_RBS
     * 64: DEBUG_FRAMER
-  +
-  +
-  The xpp modules use 'print_dbg' instead of 'debug' . Refer to
+  The 'xpp' modules use 'print_dbg' instead of 'debug' . Refer to
   README.Astribank.
 
 deftaps (zaptel)::

Modified: team/sruffell/voicebus/build_tools/test_kernel_git
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/build_tools/test_kernel_git?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/build_tools/test_kernel_git (original)
+++ team/sruffell/voicebus/build_tools/test_kernel_git Wed Mar  5 12:41:13 2008
@@ -28,7 +28,7 @@
 	if grep -q "^$var=" $CONF_FILE 2>/dev/null; then
 		sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE
 	else
-		echo "$var=\"$value\"" >>$CONF_FILE
+		echo "$var=\"$val\"" >>$CONF_FILE
 	fi
 }
 

Modified: team/sruffell/voicebus/hdlcstress.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/hdlcstress.c?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/hdlcstress.c (original)
+++ team/sruffell/voicebus/hdlcstress.c Wed Mar  5 12:41:13 2008
@@ -75,7 +75,6 @@
 {
 	int res;
 	int x;
-	int out;
 	unsigned char outbuf[BLOCK_SIZE];
 	int pos=0;
 	unsigned int fcs = PPP_INITFCS;
@@ -113,17 +112,12 @@
 
 int main(int argc, char *argv[])
 {
-	int fd2;
-	int ires, res, x;
-	int i;
+	int res, x;
 	ZT_PARAMS tp;
 	ZT_BUFFERINFO bi;
 	int bs = BLOCK_SIZE;
 	unsigned char c=0;
-	unsigned char inbuf[BLOCK_SIZE];
 	unsigned char outbuf[BLOCK_SIZE];
-	unsigned int fcs;
-	static int packets=0;
 	if (argc < 2) {
 		fprintf(stderr, "Usage: markhdlctest <tor device>\n");
 		exit(1);

Modified: team/sruffell/voicebus/hdlctest.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/hdlctest.c?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/hdlctest.c (original)
+++ team/sruffell/voicebus/hdlctest.c Wed Mar  5 12:41:13 2008
@@ -130,17 +130,13 @@
 int main(int argc, char *argv[])
 {
 	int fd;
-	int fd2;
-	int ires, res, x;
-	int i;
+	int res, x;
 	ZT_PARAMS tp;
 	ZT_BUFFERINFO bi;
 	int bs = BLOCK_SIZE;
 	int pos = 0;
 	unsigned char inbuf[BLOCK_SIZE];
 	unsigned char outbuf[BLOCK_SIZE];
-	unsigned int fcs;
-	static int packets=0;
 	int bytes=0;
 	int out;
 	unsigned int olddata1;

Modified: team/sruffell/voicebus/kernel/GNUmakefile
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/kernel/GNUmakefile?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/kernel/GNUmakefile (original)
+++ team/sruffell/voicebus/kernel/GNUmakefile Wed Mar  5 12:41:13 2008
@@ -67,7 +67,10 @@
 
 KFLAGS+=-DSTANDALONE_ZAPATA
 
-MOD_DIR:=$(DESTDIR)/lib/modules/$(KVERS)/misc
+MOD_DIR:=/lib/modules/$(KVERS)/misc
+
+MAKE_SUBDIR	= $(MAKE) CC=$(CC) LD=$(LD) \
+		  KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
 
 all: modules
 
@@ -99,7 +102,7 @@
 modules: $(ALL_MODULES)
 
 wct4xxp/wct4xxp.o:
-	$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
+	$(MAKE_SUBDIR) -C wct4xxp
 
 tor2.o: tor2-hw.h tor2fw.h
 
@@ -110,10 +113,10 @@
 wctdm.o: wctdm.h
 
 wctdm24xxp/wctdm24xxp.o:
-	$(MAKE) -C wctdm24xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
+	$(MAKE_SUBDIR) -C wctdm24xxp
 
 wcte12xp/wcte12xp.o:
-	$(MAKE) -C wcte12xp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
+	$(MAKE_SUBDIR) -C wcte12xp
 
 pciradio.o: radfw.h
 
@@ -125,30 +128,11 @@
 $(filter-out zaptel.o,$(BUILD_TOPDIR_MODULES:%=%.o)) zaptel-base.o: %.o: %.c zaptel.h
 	$(CC) $(KFLAGS) -o $@ -c $<
 
-install: all devices install-modules install-programs install-firmware
-	@echo "###################################################"
-	@echo "###"
-	@echo "### Zaptel installed successfully."
-	@echo "### If you have not done so before, install init scripts with:"
-	@echo "###"
-	@echo "###   make config"
-	@echo "###"
-	@echo "###################################################"
-
-BASENAMES=$(sort $(shell for x in $(ALL_MODULES); do basename $x; done))
-uninstall-modules:
-
-BASENAMES=$(sort $(shell for mod in $(ALL_MODULES); do basename $$mod; done))
-
-install-modules: $(INSTALL_MODULES) uninstall-modules
-	$(INSTALL) -d $(DESTDIR)$(MOD_DIR)
-	$(INSTALL) -m 644 $(INSTALL_MODULES) $(DESTDIR)$(MOD_DIR)
-	[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
 
 clean:
 	rm -f makefw tor2fw.h radfw.h
 	rm -f *.o 
-	$(MAKE) -C wct4xxp clean
+	$(MAKE_SUBDIR) -C wct4xxp clean
 	rm -rf .tmp_versions
 	rm -f core
 
@@ -156,5 +140,5 @@
 
 dist-clean: clean
 
-.PHONY: menuselect distclean dist-clean clean all _all install modules config install-modules uninstall-modules
+.PHONY: distclean dist-clean clean all modules
 

Modified: team/sruffell/voicebus/kernel/wctdm.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/kernel/wctdm.c?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/kernel/wctdm.c (original)
+++ team/sruffell/voicebus/kernel/wctdm.c Wed Mar  5 12:41:13 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, 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, 0, 0, 64, 1000, 3, },
+	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, 0, 0, 64, 1000, 3, },
+	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, 0, 0, 64, 1000, 3, },
+	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 0, 0, 64, 1000, 3, },
+	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },	/* Current loop >= 20ma */
+	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 0, 0, 64, 1000, 3, },
+	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, 0, 0, 64, 1000, 3, },
+	{ "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
 };
 
 #include "zaptel.h"
@@ -249,14 +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), so the periods are
-   specified in _4 millisecond_ increments
-*/
-#define DEFAULT_BATT_DEBOUNCE	62		/* Battery debounce (1000 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 */
 
@@ -283,6 +278,12 @@
 	PROSLIC_POWER_UNKNOWN = 0,
 	PROSLIC_POWER_ON,
 	PROSLIC_POWER_WARNED,
+};
+
+enum battery_state {
+	BATTERY_UNKNOWN = 0,
+	BATTERY_PRESENT,
+	BATTERY_LOST,
 };
 
 struct wctdm {
@@ -303,7 +304,7 @@
 	spinlock_t lock;
 
 	union {
-		struct {
+		struct fxo {
 #ifdef AUDIO_RINGCHECK
 			unsigned int pegtimer;
 			int pegcount;
@@ -315,14 +316,14 @@
 #endif			
 			int ringdebounce;
 			int offhook;
-			int battdebounce;
-			int nobatttimer;
-			int battery;
+			unsigned int battdebounce;
+			unsigned int battalarm;
+			enum battery_state battery;
 		        int lastpol;
 		        int polarity;
 		        int polaritydebounce;
 		} fxo;
-		struct {
+		struct fxs {
 			int oldrxhook;
 			int debouncehook;
 			int lastrxhook;
@@ -364,8 +365,9 @@
 
 static void wctdm_release(struct wctdm *wc);
 
-static int battdebounce = DEFAULT_BATT_DEBOUNCE;
-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;
@@ -834,11 +836,15 @@
 
 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	
 	signed char b;
 	int poopy = 0;
+	struct fxo *fxo = &wc->mod[card].fxo;
+
 	/* Try to track issues that plague slot one FXO's */
 	b = wc->reg0shadow[card];
 	if ((b & 0x2) || !(b & 0x8)) {
@@ -848,7 +854,7 @@
 		poopy++;
 	}
 	b &= 0x9b;
-	if (wc->mod[card].fxo.offhook) {
+	if (fxo->offhook) {
 		if (b != 0x9)
 			wctdm_setreg(wc, card, 5, 0x9);
 	} else {
@@ -857,150 +863,182 @@
 	}
 	if (poopy)
 		return;
-#ifndef AUDIO_RINGCHECK
-	if (!wc->mod[card].fxo.offhook) {
+	if (!fxo->offhook) {
 		if (fwringdetect) {
 			res = wc->reg0shadow[card] & 0x60;
-			if (wc->mod[card].fxo.ringdebounce--) {
-				if (res && (res != wc->mod[card].fxo.lastrdtx) && (wc->mod[card].fxo.battery == 1)) {
-					if (!wc->mod[card].fxo.wasringing) {
-						wc->mod[card].fxo.wasringing = 1;
+			if (fxo->ringdebounce--) {
+				if (res && (res != fxo->lastrdtx) &&
+				    (fxo->battery == BATTERY_PRESENT)) {
+					if (!fxo->wasringing) {
+						fxo->wasringing = 1;
 						if (debug)
 							printk("RING on %d/%d!\n", wc->span.spanno, card + 1);
 						zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
 					}
-					wc->mod[card].fxo.lastrdtx = res;
-					wc->mod[card].fxo.ringdebounce = 10;
+					fxo->lastrdtx = res;
+					fxo->ringdebounce = 10;
 				} else if (!res) {
-					if ((wc->mod[card].fxo.ringdebounce == 0) && wc->mod[card].fxo.wasringing) {
-						wc->mod[card].fxo.wasringing = 0;
+					if ((fxo->ringdebounce == 0) && fxo->wasringing) {
+						fxo->wasringing = 0;
 						if (debug)
 							printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1);
 						zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
 					}
 				}
-			} else if (res && (wc->mod[card].fxo.battery == 1)) {
-				wc->mod[card].fxo.lastrdtx = res;
-				wc->mod[card].fxo.ringdebounce = 10;
+			} else if (res && (fxo->battery == BATTERY_PRESENT)) {
+				fxo->lastrdtx = res;
+				fxo->ringdebounce = 10;
 			}
 		} else {
 			res = wc->reg0shadow[card];
-			if ((res & 0x60) && (wc->mod[card].fxo.battery == 1)) {
-				wc->mod[card].fxo.ringdebounce += (ZT_CHUNKSIZE * 16);
-				if (wc->mod[card].fxo.ringdebounce >= ZT_CHUNKSIZE * ringdebounce) {
-					if (!wc->mod[card].fxo.wasringing) {
-						wc->mod[card].fxo.wasringing = 1;
+			if ((res & 0x60) && (fxo->battery == BATTERY_PRESENT)) {
+				fxo->ringdebounce += (ZT_CHUNKSIZE * 16);
+				if (fxo->ringdebounce >= ZT_CHUNKSIZE * ringdebounce) {
+					if (!fxo->wasringing) {
+						fxo->wasringing = 1;
 						zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
 						if (debug)
 							printk("RING on %d/%d!\n", wc->span.spanno, card + 1);
 					}
-					wc->mod[card].fxo.ringdebounce = ZT_CHUNKSIZE * ringdebounce;
+					fxo->ringdebounce = ZT_CHUNKSIZE * ringdebounce;
 				}
 			} else {
-				wc->mod[card].fxo.ringdebounce -= ZT_CHUNKSIZE * 4;
-				if (wc->mod[card].fxo.ringdebounce <= 0) {
-					if (wc->mod[card].fxo.wasringing) {
-						wc->mod[card].fxo.wasringing = 0;
+				fxo->ringdebounce -= ZT_CHUNKSIZE * 4;
+				if (fxo->ringdebounce <= 0) {
+					if (fxo->wasringing) {
+						fxo->wasringing = 0;
 						zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
 						if (debug)
 							printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1);
 					}
-					wc->mod[card].fxo.ringdebounce = 0;
+					fxo->ringdebounce = 0;
 				}
 			}
 		}
 	}
+
+	b = wc->reg1shadow[card];
+
+	if (abs(b) < battthresh) {
+		/* possible existing states:
+		   battery lost, no debounce timer
+		   battery lost, debounce timer (going to battery present)
+		   battery present or unknown, no debounce timer
+		   battery present or unknown, debounce timer (going to battery lost)
+		*/
+
+		if (fxo->battery == BATTERY_LOST) {
+			if (fxo->battdebounce) {
+				/* we were going to BATTERY_PRESENT, but battery was lost again,
+				   so clear the debounce timer */
+				fxo->battdebounce = 0;
+			}
+		} else {
+			if (fxo->battdebounce) {
+				/* going to BATTERY_LOST, see if we are there yet */
+				if (--fxo->battdebounce == 0) {
+					fxo->battery = BATTERY_LOST;
+					if (debug)
+						printk("NO BATTERY on %d/%d!\n", wc->span.spanno, card + 1);
+#ifdef	JAPAN
+					if (!wc->ohdebounce && wc->offhook) {
+						zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
+						if (debug)
+							printk("Signalled On Hook\n");
+#ifdef	ZERO_BATT_RING
+						wc->onhook++;
 #endif
-	b = wc->reg1shadow[card];
-#if 0 
-	{
-		static int count = 0;
-		if (!(count++ % 100)) {
-			printk("Card %d: Voltage: %d  Debounce %d\n", card + 1, 
-			       b, wc->mod[card].fxo.battdebounce);
-		}
-	}
-#endif	
-	if (abs(b) < battthresh) {
-		wc->mod[card].fxo.nobatttimer++;
-#if 0
-		if (wc->mod[card].fxo.battery == 1)
-			printk("Battery loss: %d (%d debounce)\n", b, wc->mod[card].fxo.battdebounce);
+					}
+#else
+					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) / MS_PER_CHECK_HOOK;
 #endif
-		if (wc->mod[card].fxo.battery && !wc->mod[card].fxo.battdebounce) {
-			if (debug)
-				printk("NO BATTERY on %d/%d!\n", wc->span.spanno, card + 1);
-			wc->mod[card].fxo.battery =  0;
-#ifdef	JAPAN
-			if ((!wc->ohdebounce) && wc->offhook) {
-				zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
-				if (debug)
-					printk("Signalled On Hook\n");
+				}
+			} else {
+				/* start the debounce timer to verify that battery has been lost */
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
+			}
+		}
+	} else {
+		/* possible existing states:
+		   battery lost or unknown, no debounce timer
+		   battery lost or unknown, debounce timer (going to battery present)
+		   battery present, no debounce timer
+		   battery present, debounce timer (going to battery lost)
+		*/
+
+		if (fxo->battery == BATTERY_PRESENT) {
+			if (fxo->battdebounce) {
+				/* we were going to BATTERY_LOST, but battery appeared again,
+				   so clear the debounce timer */
+				fxo->battdebounce = 0;
+			}
+		} else {
+			if (fxo->battdebounce) {
+				/* going to BATTERY_PRESENT, see if we are there yet */
+				if (--fxo->battdebounce == 0) {
+					fxo->battery = BATTERY_PRESENT;
+					if (debug)
+						printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1, 
+						       (b < 0) ? "-" : "+");			    
 #ifdef	ZERO_BATT_RING
-				wc->onhook++;
+					if (wc->onhook) {
+						wc->onhook = 0;
+						zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
+						if (debug)
+							printk("Signalled Off Hook\n");
+					}
+#else
+					zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
 #endif
+					/* set the alarm timer, taking into account that part of its time
+					   period has already passed while debouncing occurred */
+					fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK;
+				}
+			} else {
+				/* start the debounce timer to verify that battery has appeared */
+				fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK;
 			}
-#else
-			zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK);
-			zt_alarm_channel(&wc->chans[card], ZT_ALARM_RED);
-#endif
-			wc->mod[card].fxo.battdebounce = battdebounce;
-		} else if (!wc->mod[card].fxo.battery)
-			wc->mod[card].fxo.battdebounce = battdebounce;
-	} else if (abs(b) > battthresh) {
-		if ((wc->mod[card].fxo.battery < 1) && !wc->mod[card].fxo.battdebounce) {
-			if (debug)
-				printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1, 
-					(b < 0) ? "-" : "+");			    
-#ifdef	ZERO_BATT_RING
-			if (wc->onhook) {
-				wc->onhook = 0;
-				zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
-				if (debug)
-					printk("Signalled Off Hook\n");
+		}
+
+		if (fxo->lastpol >= 0) {
+			if (b < 0) {
+				fxo->lastpol = -1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
 			}
-#else
-			zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK);
-			zt_alarm_channel(&wc->chans[card], ZT_ALARM_NONE);
-#endif
-			wc->mod[card].fxo.battery = 1;
-			wc->mod[card].fxo.nobatttimer = 0;
-			wc->mod[card].fxo.battdebounce = battdebounce;
-		} else if (wc->mod[card].fxo.battery == 1)
-			wc->mod[card].fxo.battdebounce = battdebounce;
-
-		if (wc->mod[card].fxo.lastpol >= 0) {
-		    if (b < 0) {
-			wc->mod[card].fxo.lastpol = -1;
-			wc->mod[card].fxo.polaritydebounce = POLARITY_DEBOUNCE;
-		    }
 		} 
-		if (wc->mod[card].fxo.lastpol <= 0) {
-		    if (b > 0) {
-			wc->mod[card].fxo.lastpol = 1;
-			wc->mod[card].fxo.polaritydebounce = POLARITY_DEBOUNCE;
-		    }
-		}
-	} else {
-		/* It's something else... */
-		wc->mod[card].fxo.battdebounce = battdebounce;
-	}
-	if (wc->mod[card].fxo.battdebounce)
-		wc->mod[card].fxo.battdebounce--;
-	if (wc->mod[card].fxo.polaritydebounce) {
-	        wc->mod[card].fxo.polaritydebounce--;
-		if (wc->mod[card].fxo.polaritydebounce < 1) {
-		    if (wc->mod[card].fxo.lastpol != wc->mod[card].fxo.polarity) {
+		if (fxo->lastpol <= 0) {
+			if (b > 0) {
+				fxo->lastpol = 1;
+				fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK;
+			}
+		}
+	}
+
+	if (fxo->battalarm) {
+		if (--fxo->battalarm == 0) {
+			/* the alarm timer has expired, so update the battery alarm state
+			   for this channel */
+			zt_alarm_channel(&wc->chans[card], fxo->battery ? ZT_ALARM_NONE : ZT_ALARM_RED);
+		}
+	}
+
+	if (fxo->polaritydebounce) {
+		if (--fxo->polaritydebounce == 0) {
+		    if (fxo->lastpol != fxo->polarity) {
 				if (debug)
 					printk("%lu Polarity reversed (%d -> %d)\n", jiffies, 
-				       wc->mod[card].fxo.polarity, 
-				       wc->mod[card].fxo.lastpol);
-				if (wc->mod[card].fxo.polarity)
-				    zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);
-				wc->mod[card].fxo.polarity = wc->mod[card].fxo.lastpol;
+				       fxo->polarity, 
+				       fxo->lastpol);
+				if (fxo->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)
@@ -1607,9 +1645,6 @@
 	if(debug)
 		printk("DEBUG fxotxgain:%i.%i fxorxgain:%i.%i\n", (wctdm_getreg(wc, card, 38)/16)?-(wctdm_getreg(wc, card, 38) - 16) : wctdm_getreg(wc, card, 38), (wctdm_getreg(wc, card, 40)/16)? -(wctdm_getreg(wc, card, 40) - 16):wctdm_getreg(wc, card, 40), (wctdm_getreg(wc, card, 39)/16)? -(wctdm_getreg(wc, card, 39) - 16) : wctdm_getreg(wc, card, 39),(wctdm_getreg(wc, card, 41)/16)?-(wctdm_getreg(wc, card, 41) - 16):wctdm_getreg(wc, card, 41));
 
-	/* battery state still unknown */
-	wc->mod[card].fxo.battery = -1;
-	
 	return 0;
 		
 }
@@ -2514,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;
 	}
@@ -2522,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)
@@ -2549,15 +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(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);
@@ -2571,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");
@@ -2579,6 +2628,7 @@
 MODULE_PARM(fastringer, "i");
 MODULE_PARM(fxshonormode, "i");
 MODULE_PARM(battdebounce, "i");
+MODULE_PARM(battalarm, "i");
 MODULE_PARM(battthresh, "i");
 MODULE_PARM(ringdebounce, "i");
 MODULE_PARM(fwringdetect, "i");

Modified: team/sruffell/voicebus/kernel/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/kernel/wctdm24xxp/base.c?view=diff&rev=3935&r1=3934&r2=3935
==============================================================================
--- team/sruffell/voicebus/kernel/wctdm24xxp/base.c (original)
+++ team/sruffell/voicebus/kernel/wctdm24xxp/base.c Wed Mar  5 12:41:13 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, 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, 0, 0, 1000, 3, },
+	{ "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, 0, 0, 64, 1000, 3, },
+	{ "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, 0, 0, 64, 1000, 3, },
+	{ "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 0, 0, 64, 1000, 3, },
+	{ "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },	/* Current loop >= 20ma */
+	{ "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 0, 0, 64, 1000, 3, },
+	{ "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 64, 1000, 3, },
+	{ "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },
+	{ "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, 0, 0, 64, 1000, 3, },
+	{ "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0, 0, 64, 1000, 3, },
+	{ "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0, 0, 64, 1000, 3, },

[... 766 lines stripped ...]



More information about the zaptel-commits mailing list