[zaptel-commits] mattf: branch mattf/zaptel-hotwct4xxp r2306 - in /team/mattf/zaptel-hotwct4xx...

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Mar 12 10:01:04 MST 2007


Author: mattf
Date: Mon Mar 12 12:01:03 2007
New Revision: 2306

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2306
Log:
Merged revisions 2210,2226,2231,2234,2247-2249,2254,2256,2260,2264-2265,2269-2270,2272,2284,2289,2291,2295,2298,2303 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/trunk

................
r2210 | mattf | 2007-02-21 11:30:09 -0600 (Wed, 21 Feb 2007) | 18 lines

Merged revisions 2209 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2209 | mattf | 2007-02-21 11:27:59 -0600 (Wed, 21 Feb 2007) | 10 lines

Merged revisions 2208 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2208 | mattf | 2007-02-21 11:26:05 -0600 (Wed, 21 Feb 2007) | 2 lines

Make sure we do the IRQ fix in the gen1 interrupt handler as well.

........

................

................
r2226 | tzafrir | 2007-02-25 15:17:56 -0600 (Sun, 25 Feb 2007) | 2 lines

Ignore generated files in ztcodec_dte .

................
r2231 | file | 2007-02-26 09:18:51 -0600 (Mon, 26 Feb 2007) | 10 lines

Merged revisions 2230 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

........
r2230 | file | 2007-02-26 10:16:46 -0500 (Mon, 26 Feb 2007) | 2 lines

Move menuselect build options inclusion to before it is initially used otherwise the needed variables may not be present at time of use. (issue #9145 reported by jmls)

........

................
r2234 | file | 2007-02-26 12:23:15 -0600 (Mon, 26 Feb 2007) | 18 lines

Merged revisions 2233 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2233 | file | 2007-02-26 13:20:40 -0500 (Mon, 26 Feb 2007) | 10 lines

Merged revisions 2232 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2232 | file | 2007-02-26 13:18:13 -0500 (Mon, 26 Feb 2007) | 2 lines

Just in case... set hotplug firmware loading option to no if on a 2.4 kernel. (issue #9140 reported by velter)

........

................

................
r2247 | tzafrir | 2007-02-27 19:23:19 -0600 (Tue, 27 Feb 2007) | 40 lines

Merge xpp rev. 3495:
------------------------------------------------------------------------
r2243 | tzafrir | 2007-02-28 02:05:59 +0200 (Wed, 28 Feb 2007) | 4 lines

* xpp rev. 3495: fix a race in the FXO driver of recent weeks.
* Add the Astribank BRI driver (though still needs bristuffed zaptel
  to build and thus will not build by default)

------------------------------------------------------------------------
r2239 | tzafrir | 2007-02-27 08:14:18 +0200 (Tue, 27 Feb 2007) | 18 lines

Xorcom rev. 3491:
 * Version of xpp modules is set from xpp/.version, rather than "unknown".
 * Astribank devices are now initialized in parallel: faster startup
   when there are multiple Astribanks.
 * Re-added support for the old format of /proc/xpp/sync write:
   (echo N 0 > /proc/xpp/sync ) . The new format (SYNC=NN) is preffered.
 * Firmware update to fix a PCM issue.
 * Fixed a build issue with kernel 2.6.8 .
 * Fixed missing initialization in Zaptel::Xpp::Xbus .
 * genzaptelconf will now set FXS ports as LS by default. To set them as 
   KS, use fxs_default_start=ks in /etc/default/zaptel / /etc/sysconfig/zaptel
   (Also a workaround for #7755 ).
 * Groundwork for sync from zaptel master span: if zaptel is built with
   ZAPTEL_SYNC_TIC (see zaptel/team/tzafrir/sync ), xpp will report its 
   drift from the zaptel sync master.
 * USB firmware update: had bad lines checksums (and fxload did not report).
 * fpga_load can now better report bad hex file checksum ;-) .

------------------------------------------------------------------------
r2223 | tzafrir | 2007-02-24 03:05:05 +0200 (Sat, 24 Feb 2007) | 3 lines

Add the Zaptel and Zaptel::Xpp perl modules, and some simple 
utilities that use them. disabled by default for now.

------------------------------------------------------------------------
r2222 | tzafrir | 2007-02-24 02:55:05 +0200 (Sat, 24 Feb 2007) | 2 lines

Make the xpp/utils/Makefile in 1.2 closer to the one in 1.4 .

................
r2248 | tzafrir | 2007-02-28 02:28:17 -0600 (Wed, 28 Feb 2007) | 3 lines

The module rules broke INSTALL_PREFIX installation, and are generally useless.
Remove them in trunk and see how it goes.

................
r2249 | tzafrir | 2007-02-28 02:31:15 -0600 (Wed, 28 Feb 2007) | 3 lines

If the span sets its sync_tick method, call it on every tick of the sync
master.

................
r2254 | tzafrir | 2007-02-28 15:05:12 -0600 (Wed, 28 Feb 2007) | 5 lines

r2252 | tzafrir | 2007-02-28 22:57:52 +0200 (Wed, 28 Feb 2007) | 3 lines

Make the xpp/utils/Makefile in 1.2 closer to the one in 1.4 
(and actually work, this tine).

................
r2256 | tzafrir | 2007-03-01 02:16:41 -0600 (Thu, 01 Mar 2007) | 2 lines

Fixed module unloading in the zaptel init script.

................
r2260 | tzafrir | 2007-03-01 14:09:16 -0600 (Thu, 01 Mar 2007) | 4 lines

r2257 | tzafrir | 2007-03-01 21:29:12 +0200 (Thu, 01 Mar 2007) | 2 lines

SLAB_KERNEL is an obsolete alias of GFP_KERNEL. Fix build on Vanilla 2.6.20 .

................
r2264 | tzafrir | 2007-03-02 10:32:40 -0600 (Fri, 02 Mar 2007) | 2 lines

The "unload" target actually works.

................
r2265 | tzafrir | 2007-03-02 13:47:05 -0600 (Fri, 02 Mar 2007) | 5 lines

Fix the usage of ztcfg in the init script:
 * The debian variant has failed to report errors.
 * Remove duplication.
 * Allow overriding the location of ztcfg and zaptel.conf in the config file.

................
r2269 | tzafrir | 2007-03-02 14:53:48 -0600 (Fri, 02 Mar 2007) | 4 lines

Clarify a cyptic build message.

r2266 | tzafrir | 2007-03-02 22:40:06 +0200 (Fri, 02 Mar 2007) | 2 lines

................
r2270 | tzafrir | 2007-03-02 15:36:22 -0600 (Fri, 02 Mar 2007) | 2 lines

Support loading an Astribank (xpp) device in the init script.

................
r2272 | tzafrir | 2007-03-02 15:58:48 -0600 (Fri, 02 Mar 2007) | 2 lines

Blocking 2271 from trunk: modprobe rules are not there anymore.

................
r2284 | kpfleming | 2007-03-04 23:43:50 -0600 (Sun, 04 Mar 2007) | 28 lines

Merged revisions 2283 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2283 | kpfleming | 2007-03-04 23:42:41 -0600 (Sun, 04 Mar 2007) | 20 lines

Merged revisions 2280-2282 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2280 | kpfleming | 2007-03-04 23:34:43 -0600 (Sun, 04 Mar 2007) | 2 lines

ensure that we run objdump in the most generic language possible to avoid complications on non-English systems (issue #9196)

........
r2281 | kpfleming | 2007-03-04 23:40:37 -0600 (Sun, 04 Mar 2007) | 2 lines

remove stray character that my editor decided to add

........
r2282 | kpfleming | 2007-03-04 23:41:30 -0600 (Sun, 04 Mar 2007) | 2 lines

this driver does not use workqueues, so does not need this header (issue #9196)

........

................

................
r2289 | tzafrir | 2007-03-05 11:21:05 -0600 (Mon, 05 Mar 2007) | 4 lines

Found a proper "marker" for the gfp_t typedef. Now every 2.6.9 is supported.

r2286 | tzafrir | 2007-03-05 18:14:11 +0200 (Mon, 05 Mar 2007) | 2 lines

................
r2291 | tzafrir | 2007-03-07 13:18:33 -0600 (Wed, 07 Mar 2007) | 5 lines

Don't die when there is no udev rules dir (on an installtion with 
INSTALL_PREFIX explicitly set).

r2290 | tzafrir | 2007-03-07 21:14:30 +0200 (Wed, 07 Mar 2007) | 3 lines

................
r2295 | russell | 2007-03-07 18:50:35 -0600 (Wed, 07 Mar 2007) | 11 lines

Merged revisions 2294 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

........
r2294 | russell | 2007-03-07 18:48:22 -0600 (Wed, 07 Mar 2007) | 3 lines

Add a constant for ZT_EVENT_REMOVED to allow a driver to hint to userspace that
a channel has been removed. (issue #7256, tzafrir)

........

................
r2298 | file | 2007-03-08 10:00:29 -0600 (Thu, 08 Mar 2007) | 17 lines

Blocked revisions 2297 via svnmerge

................
r2297 | file | 2007-03-08 10:58:10 -0500 (Thu, 08 Mar 2007) | 10 lines

Merged revisions 2296 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2296 | file | 2007-03-08 10:56:05 -0500 (Thu, 08 Mar 2007) | 2 lines

vprintk is only available on 2.6.9+ (issue #9232 reported by baconbuttie)

........

................

................
r2303 | mattf | 2007-03-09 14:05:17 -0600 (Fri, 09 Mar 2007) | 18 lines

Merged revisions 2302 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2302 | mattf | 2007-03-09 14:04:07 -0600 (Fri, 09 Mar 2007) | 10 lines

Merged revisions 2301 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2301 | mattf | 2007-03-09 13:59:43 -0600 (Fri, 09 Mar 2007) | 2 lines

Make sure we don't allocate as GFP_KERNEL in atomic context

........

................

................

Added:
    team/mattf/zaptel-hotwct4xxp/xpp/.version   (props changed)
      - copied unchanged from r2303, trunk/xpp/.version
    team/mattf/zaptel-hotwct4xxp/xpp/card_bri.c   (props changed)
      - copied unchanged from r2303, trunk/xpp/card_bri.c
    team/mattf/zaptel-hotwct4xxp/xpp/card_bri.h   (props changed)
      - copied unchanged from r2303, trunk/xpp/card_bri.h
    team/mattf/zaptel-hotwct4xxp/xpp/utils/lszaptel   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/lszaptel
    team/mattf/zaptel-hotwct4xxp/xpp/utils/xpp_sync   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/xpp_sync
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/
      - copied from r2303, trunk/xpp/utils/zconf/
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/
      - copied from r2303, trunk/xpp/utils/zconf/Zaptel/
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Chans.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel/Chans.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Span.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel/Span.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Xpp/
      - copied from r2303, trunk/xpp/utils/zconf/Zaptel/Xpp/
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Xpp.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel/Xpp.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm
    team/mattf/zaptel-hotwct4xxp/xpp/utils/zt_registration   (props changed)
      - copied unchanged from r2303, trunk/xpp/utils/zt_registration
Modified:
    team/mattf/zaptel-hotwct4xxp/   (props changed)
    team/mattf/zaptel-hotwct4xxp/Makefile
    team/mattf/zaptel-hotwct4xxp/build_tools/make_firmware_object
    team/mattf/zaptel-hotwct4xxp/wct4xxp/vpm450m.c
    team/mattf/zaptel-hotwct4xxp/xpp/Makefile
    team/mattf/zaptel-hotwct4xxp/xpp/card_fxo.c
    team/mattf/zaptel-hotwct4xxp/xpp/card_fxs.c
    team/mattf/zaptel-hotwct4xxp/xpp/card_global.c
    team/mattf/zaptel-hotwct4xxp/xpp/firmwares/FPGA_1141.hex
    team/mattf/zaptel-hotwct4xxp/xpp/firmwares/FPGA_1151.hex
    team/mattf/zaptel-hotwct4xxp/xpp/firmwares/FPGA_FXS.hex
    team/mattf/zaptel-hotwct4xxp/xpp/firmwares/USB_1140.hex
    team/mattf/zaptel-hotwct4xxp/xpp/firmwares/USB_1150.hex
    team/mattf/zaptel-hotwct4xxp/xpp/utils/Makefile
    team/mattf/zaptel-hotwct4xxp/xpp/utils/fpga_load.c
    team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf
    team/mattf/zaptel-hotwct4xxp/xpp/utils/hexfile.c
    team/mattf/zaptel-hotwct4xxp/xpp/utils/hexfile.h
    team/mattf/zaptel-hotwct4xxp/xpp/utils/test_parse.c
    team/mattf/zaptel-hotwct4xxp/xpp/utils/xpp_fxloader
    team/mattf/zaptel-hotwct4xxp/xpp/xbus-core.c
    team/mattf/zaptel-hotwct4xxp/xpp/xbus-core.h
    team/mattf/zaptel-hotwct4xxp/xpp/xpd.h
    team/mattf/zaptel-hotwct4xxp/xpp/xpp_usb.c
    team/mattf/zaptel-hotwct4xxp/xpp/xpp_zap.c
    team/mattf/zaptel-hotwct4xxp/xpp/xpp_zap.h
    team/mattf/zaptel-hotwct4xxp/xpp/xproto.c
    team/mattf/zaptel-hotwct4xxp/xpp/xproto.h
    team/mattf/zaptel-hotwct4xxp/zaptel.c
    team/mattf/zaptel-hotwct4xxp/zaptel.h
    team/mattf/zaptel-hotwct4xxp/zaptel.init
    team/mattf/zaptel-hotwct4xxp/zconfig.h
    team/mattf/zaptel-hotwct4xxp/ztcodec_dte/   (props changed)

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
--- branch-1.4-blocked (original)
+++ branch-1.4-blocked Mon Mar 12 12:01:03 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1889
+/branches/1.4:1889,2271,2297

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 12 12:01:03 2007
@@ -1,1 +1,1 @@
-/trunk:1-2204
+/trunk:1-2305

Modified: team/mattf/zaptel-hotwct4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/Makefile?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/Makefile (original)
+++ team/mattf/zaptel-hotwct4xxp/Makefile Mon Mar 12 12:01:03 2007
@@ -56,27 +56,6 @@
   endif
 endif
 
-# If the file .zaptel.makeopts is present in your home directory, you can
-# include all of your favorite menuselect options so that every time you download
-# a new version of Asterisk, you don't have to run menuselect to set them.
-# The file /etc/zaptel.makeopts will also be included but can be overridden
-# by the file in your home directory.
-
-GLOBAL_MAKEOPTS=$(wildcard /etc/zaptel.makeopts)
-USER_MAKEOPTS=$(wildcard ~/.zaptel.makeopts)
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard menuselect.makeopts),)
-  include menuselect.makeopts
- endif
-endif
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard makeopts),)
-  include makeopts
- endif
-endif
-
 #
 # Features are now configured in zconfig.h
 #
@@ -130,6 +109,27 @@
 LTZ_SO_MAJOR_VER:=1
 LTZ_SO_MINOR_VER:=0
 
+# If the file .zaptel.makeopts is present in your home directory, you can
+# include all of your favorite menuselect options so that every time you download
+# a new version of Asterisk, you don't have to run menuselect to set them.
+# The file /etc/zaptel.makeopts will also be included but can be overridden
+# by the file in your home directory.
+
+GLOBAL_MAKEOPTS=$(wildcard /etc/zaptel.makeopts)
+USER_MAKEOPTS=$(wildcard ~/.zaptel.makeopts)
+
+ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
+ ifneq ($(wildcard menuselect.makeopts),)
+  include menuselect.makeopts
+ endif
+endif
+
+ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
+ ifneq ($(wildcard makeopts),)
+  include makeopts
+ endif
+endif
+
 MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic zttranscode
 MODULES:=$(filter-out $(MENUSELECT_MODULES),$(MODULES))
 MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
@@ -138,6 +138,8 @@
 MODULESKO:=$(MODULES:%=%.ko)
 ifeq ($(BUILDVER),linux26)
 HOTPLUG_FIRMWARE:=$(shell if grep CONFIG_FW_LOADER $(KINCLUDES)/linux/autoconf.h | grep -q undef; then echo "no"; else echo "yes"; fi)
+else
+HOTPLUG_FIRMWARE:=no
 endif
 
 BIN_DIR:=$(INSTALL_PREFIX)/sbin
@@ -363,6 +365,7 @@
 	done
 else # DYNFS
   ifdef UDEVRULES
+	install -d $(INSTALL_PREFIX)/etc/udev/rules.d
 	build_tools/genudevrules > $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
   else # !UDEVRULES
 	@echo "**** Dynamic filesystem detected -- not creating device nodes"
@@ -415,10 +418,6 @@
 	$(INSTALL) -m 644 doc/zttool.8 $(INSTALL_PREFIX)/usr/share/man/man8
 	[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
 	[ -f $(CONFIG_FILE) ] || $(INSTALL) -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
-	build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel,$(MODULES)) $(MODULE_ALIASES)"
-	@if [ -d /etc/modutils ]; then \
-		/sbin/update-modules ; \
-	fi
 
 install-libs: $(LTZ_SO) $(LTZ_A)
 	$(INSTALL) -D -m 755 $(LTZ_A) $(LIB_DIR)/$(LTZ_A)

Modified: team/mattf/zaptel-hotwct4xxp/build_tools/make_firmware_object
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/build_tools/make_firmware_object?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/build_tools/make_firmware_object (original)
+++ team/mattf/zaptel-hotwct4xxp/build_tools/make_firmware_object Mon Mar 12 12:01:03 2007
@@ -6,7 +6,7 @@
 #   2 - output file
 #   3 - template output file (used to learn desired format)
 
-bfdname=`objdump -f ${3} | grep -e "${3}:" | sed "s/.*file format \(.*\)/\1/"`
-bfdarch=`objdump -f ${3} | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`
+bfdname=`LANG=C objdump -f ${3} | grep -e "${3}:" | sed "s/.*file format \(.*\)/\1/"`
+bfdarch=`LANG=C objdump -f ${3} | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`
 
 objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2} --rename-section .data=.rodata,alloc,load,data,contents,readonly

Modified: team/mattf/zaptel-hotwct4xxp/wct4xxp/vpm450m.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/wct4xxp/vpm450m.c?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/wct4xxp/vpm450m.c (original)
+++ team/mattf/zaptel-hotwct4xxp/wct4xxp/vpm450m.c Mon Mar 12 12:01:03 2007
@@ -209,7 +209,7 @@
 
 	if (vpm450m->ecmode[channel] == mode)
 		return;
-	modify = kmalloc(sizeof(tOCT6100_CHANNEL_MODIFY), GFP_KERNEL);
+	modify = kmalloc(sizeof(tOCT6100_CHANNEL_MODIFY), GFP_ATOMIC);
 	if (!modify) {
 		printk("wct4xxp: Unable to allocate memory for setec!\n");
 		return;

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/.version
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/.version
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/.version
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/mattf/zaptel-hotwct4xxp/xpp/Makefile
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/Makefile?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/Makefile (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/Makefile Mon Mar 12 12:01:03 2007
@@ -1,5 +1,7 @@
+ZAPTEL_DIR	= $(SUBDIRS)
+
 EXTRA_CFLAGS	=	$(XPP_LOCAL_CFLAGS)	\
-			-g3 -I$(SUBDIRS)	\
+			-g3 -I$(ZAPTEL_DIR)	\
 			-DDEBUG			\
 			-DPOLL_DIGITAL_INPUTS	\
 			-DWITH_ECHO_SUPPRESSION	\
@@ -8,9 +10,6 @@
 ifneq	(,$(filter y m,$(CONFIG_DEBUG_FS)))
 EXTRA_CFLAGS	+=	-DXPP_DEBUGFS
 endif
-
-ZAPTEL_DIR	= $(SUBDIRS)
-
 ifneq	(,$(shell grep -w echo_can_state_t $(ZAPTEL_DIR)/zaptel.h))
 EXTRA_CFLAGS	+=	-DZAPTEL_EC_TYPEDEF
 endif
@@ -42,6 +41,7 @@
 $(obj)/card_fxs.o $(obj)/card_fxo.o $(obj)/card_bri.o $(obj)/xpp_usb.o $(obj)/xpp.o: $(obj)/xpp_version.h
 
 $(obj)/xpp_version.h: FORCE
+	$(Q)echo "Compile xpp (version $(XPP_VERSION_STR))"
 	$(Q)echo '#define	XPP_VERSION	$(XPP_VERSION_STR)' > $@.tmp
 	$(Q)if cmp -s $@.tmp $@ ; then echo; else \
 		mv $@.tmp $@ ; \

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/mattf/zaptel-hotwct4xxp/xpp/card_bri.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/mattf/zaptel-hotwct4xxp/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/card_fxo.c?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/card_fxo.c (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/card_fxo.c Mon Mar 12 12:01:03 2007
@@ -417,6 +417,23 @@
 	return 0;
 }
 
+static int FXO_card_open(xpd_t *xpd, lineno_t chan)
+{
+	struct FXO_priv_data	*priv;
+
+	BUG_ON(!xpd);
+	priv = xpd->priv;
+	/*
+	 * We pretend to have battery. If this is really the case
+	 * than next calls to update_battery_status() won't change it.
+	 * If we don't have battery, than on the next calls to
+	 * update_battery_status() a battery_debounce[] cycle would start.
+	 * Than, if no-battery is persistent, asterisk would be notified.
+	 */
+	BIT_SET(priv->battery, chan);
+	return 0;
+}
+
 static void poll_battery(xbus_t *xbus, xpd_t *xpd)
 {
 	int	i;
@@ -634,13 +651,17 @@
 		if(IS_SET(priv->battery, chipsel) && priv->battery_debounce[chipsel]++ > BAT_DEBOUNCE) {
 			DBG("%s/%s/%d: BATTERY OFF voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
 			BIT_CLR(priv->battery, chipsel);
-			update_line_status(xpd, chipsel, 0);
+			if(SPAN_REGISTERED(xpd))
+				zt_qevent_lock(&xpd->chans[chipsel], ZT_EVENT_ALARM);
+
 		}
 	} else {
 		priv->battery_debounce[chipsel] = 0;
 		if(!IS_SET(priv->battery, chipsel)) {
 			DBG("%s/%s/%d: BATTERY ON voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
 			BIT_SET(priv->battery, chipsel);
+			if(SPAN_REGISTERED(xpd))
+				zt_qevent_lock(&xpd->chans[chipsel], ZT_EVENT_NOALARM);
 		}
 	}
 	/*
@@ -700,7 +721,6 @@
 HANDLER_DEF(FXO, DAA_REPLY)
 {
 	reg_cmd_t		*info = &RPACKET_FIELD(pack, FXO, DAA_REPLY, regcmd);
-	unsigned long		flags;
 	struct FXO_priv_data	*priv;
 	lineno_t		chipsel;
 
@@ -709,7 +729,6 @@
 				__FUNCTION__, cmd->name, XPD_NUM(pack->addr));
 		return -EPROTO;
 	}
-	spin_lock_irqsave(&xpd->lock, flags);
 	priv = xpd->priv;
 	BUG_ON(!priv);
 	chipsel = REG_FIELD(info, chipsel);
@@ -734,7 +753,6 @@
 			REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) {
 		xpd->last_reply = *info;
 	}
-	spin_unlock_irqrestore(&xpd->lock, flags);
 	return 0;
 }
 
@@ -757,12 +775,11 @@
 		.card_hooksig	= FXO_card_hooksig,
 		.card_tick	= FXO_card_tick,
 		.card_ioctl	= FXO_card_ioctl,
+		.card_open	= FXO_card_open,
 
 		.RING		= XPROTO_CALLER(FXO, RING),
 		.RELAY_OUT	= XPROTO_CALLER(FXO, RELAY_OUT),
 		.XPD_STATE	= XPROTO_CALLER(FXO, XPD_STATE),
-
-		.SYNC_SOURCE	= XPROTO_CALLER(GLOBAL, SYNC_SOURCE),
 	},
 	.packet_is_valid = fxo_packet_is_valid,
 	.packet_dump = fxo_packet_dump,

Modified: team/mattf/zaptel-hotwct4xxp/xpp/card_fxs.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/card_fxs.c?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/card_fxs.c (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/card_fxs.c Mon Mar 12 12:01:03 2007
@@ -34,7 +34,8 @@
 static const char rcsid[] = "$Id$";
 
 DEF_PARM(int, print_dbg, 0, 0600, "Print DBG statements");	/* must be before zap_debug.h */
-DEF_PARM_BOOL(poll_digital_inputs, 1, 0600, "Poll Digital Inputs");	/* must be before zap_debug.h */
+DEF_PARM_BOOL(poll_digital_inputs, 1, 0600, "Poll Digital Inputs");
+DEF_PARM_BOOL(reversepolarity, 0, 0600, "Reverse Line Polarity");
 
 /* Signaling is opposite (fxo signalling for fxs card) */
 #if 1
@@ -69,6 +70,22 @@
 
 #define	VALID_CHIPSEL(x)	(((chipsel) >= 0 && (chipsel) <= 7) || (chipsel) == ALL_CHANS)
 
+/* Values of SLIC linefeed control register (0x40) */
+enum fxs_state {
+	FXS_LINE_OPEN		= 0x00,	/* Open */
+	FXS_LINE_ACTIVE		= 0x01,	/* Forward active */
+	FXS_LINE_OHTRANS	= 0x02,	/* Forward on-hook transmission */
+	FXS_LINE_TIPOPEN	= 0x03,	/* TIP open */
+	FXS_LINE_RING		= 0x04,	/* Ringing */
+	FXS_LINE_REV_ACTIVE	= 0x05,	/* Reverse active */
+	FXS_LINE_REV_OHTRANS	= 0x06,	/* Reverse on-hook transmission */
+	FXS_LINE_RING_OPEN	= 0x07	/* RING open */
+};
+
+#define	FXS_LINE_POL_ACTIVE	((reversepolarity) ? FXS_LINE_REV_ACTIVE : FXS_LINE_ACTIVE)
+#define	FXS_LINE_POL_OHTRANS	((reversepolarity) ? FXS_LINE_REV_OHTRANS : FXS_LINE_OHTRANS)
+
+
 /*---------------- FXS Protocol Commands ----------------------------------*/
 
 static /* 0x0F */ DECLARE_CMD(FXS, XPD_STATE, bool on);
@@ -86,13 +103,18 @@
 #define	PROC_FXS_INFO_FNAME	"fxs_info"
 
 struct FXS_priv_data {
-	struct proc_dir_entry		*regfile;
-	struct proc_dir_entry		*fxs_info;
-	xpp_line_t			ledstate[NUM_LEDS];	/* 0 - OFF, 1 - ON */
-	xpp_line_t			ledcontrol[NUM_LEDS];	/* 0 - OFF, 1 - ON */
-	xpp_line_t			found_fsk_pattern;
-	xpp_line_t			msg_waiting;
-	int				led_counter[NUM_LEDS][CHANNELS_PERXPD];
+	struct proc_dir_entry	*regfile;
+	struct proc_dir_entry	*fxs_info;
+	xpp_line_t		ledstate[NUM_LEDS];	/* 0 - OFF, 1 - ON */
+	xpp_line_t		ledcontrol[NUM_LEDS];	/* 0 - OFF, 1 - ON */
+	xpp_line_t		found_fsk_pattern;
+	xpp_line_t		msg_waiting;
+	xpp_line_t		update_offhook_state;
+	int			led_counter[NUM_LEDS][CHANNELS_PERXPD];
+	int			ohttimer[CHANNELS_PERXPD];
+#define OHT_TIMER		6000	/* How long after RING to retain OHT */
+	enum fxs_state		idletxhookstate[CHANNELS_PERXPD];	/* IDLE changing hook state */
+	enum fxs_state		lasttxhook[CHANNELS_PERXPD];
 };
 
 /*
@@ -108,6 +130,16 @@
 #define	LED_BLINK_RING			(1000/8)	/* in ticks */
 
 /*---------------- FXS: Static functions ----------------------------------*/
+static int linefeed_control(xbus_t *xbus, xpd_t *xpd, lineno_t chan, enum fxs_state value)
+{
+	struct FXS_priv_data	*priv;
+
+	priv = xpd->priv;
+	DBG("%s/%s/%d: value=0x%02X\n", xbus->busname, xpd->xpdname, chan, value);
+	priv->lasttxhook[chan] = value;
+	return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
+}
+
 static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on)
 {
 	int		value = (on) ? 0x06 : 0x00;
@@ -223,20 +255,19 @@
 	}
 }
 
-static int do_callerid(xbus_t *xbus, xpd_t *xpd, lineno_t chan)
-{
-	int		ret = 0;
-	int		i;
-
-	BUG_ON(!xbus);
-	BUG_ON(!xpd);
-	DBG("%s/%s/%d:\n", xbus->busname, xpd->xpdname, chan);
-	ret = SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, FXS_LINE_CID);
-	for_each_line(xpd, i)
-		xpd->lasttxhook[i] = FXS_LINE_CID;
-	return ret;
-}
-
+static void restore_leds(xpd_t *xpd)
+{
+	struct FXS_priv_data	*priv;
+	int			i;
+
+	priv = xpd->priv;
+	for_each_line(xpd, i) {
+		if(IS_SET(xpd->offhook, i))
+			MARK_ON(priv, i, LED_GREEN);
+		else
+			MARK_OFF(priv, i, LED_GREEN);
+	}
+}
 
 /*---------------- FXS: Methods -------------------------------------------*/
 
@@ -310,6 +341,9 @@
 	priv->regfile->read_proc = proc_xpd_register_read;
 	priv->regfile->data = xpd;
 #endif
+	for_each_line(xpd, i) {
+		priv->idletxhookstate[i] = FXS_LINE_POL_ACTIVE;
+	}
 	ret = run_initialize_registers(xpd);
 	if(ret < 0)
 		goto err;
@@ -333,6 +367,7 @@
 		do_led(xpd, i, LED_GREEN, 0);
 		msleep(50);
 	}
+	restore_leds(xpd);
 	return 0;
 err:
 	clean_proc(xbus, xpd);
@@ -404,19 +439,26 @@
 		MARK_OFF(priv, i, LED_RED);
 		msleep(2);
 	}
+	restore_leds(xpd);
 	return 0;
 }
 
 int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
 {
-	int		ret = 0;
+	struct FXS_priv_data	*priv;
+	int			ret = 0;
+	struct zt_chan		*chan = NULL;
+	enum fxs_state		txhook;
 
 	DBG("%s/%s/%d: %s\n", xbus->busname, xpd->xpdname, pos, txsig2str(txsig));
+	priv = xpd->priv;
 	BUG_ON(xpd->direction != TO_PHONE);
 	if (IS_SET(xpd->digital_inputs, pos)) {
 		DBG("Ignoring signal sent to digital input line\n");
 		return 0;
 	}
+	if(SPAN_REGISTERED(xpd))
+		chan = &xpd->span.chans[pos];
 	switch(txsig) {
 		case ZT_TXSIG_ONHOOK:
 			xpd->ringing[pos] = 0;
@@ -426,41 +468,54 @@
 				ret = CALL_XMETHOD(RELAY_OUT, xpd->xbus, xpd, pos-8, 0);
 				return ret;
 			}
+			if (priv->lasttxhook[pos] == FXS_LINE_OPEN) {
+				/*
+				 * Restore state after KEWL hangup.
+				 */
+				DBG("%s/%s/%d: KEWL STOP\n",
+						xbus->busname, xpd->xpdname, pos);
+				linefeed_control(xbus, xpd, pos, FXS_LINE_POL_ACTIVE);
+				if(IS_SET(xpd->offhook, pos))
+					MARK_ON(priv, pos, LED_GREEN);
+			}
 			ret = CALL_XMETHOD(RING, xbus, xpd, pos, 0);			// RING off
 			if (!IS_SET(xpd->offhook, pos))
 				start_stop_vm_led(xbus, xpd, pos);
-#if 0
-			switch(chan->sig) {
-				case ZT_SIG_EM:
-				case ZT_SIG_FXOKS:
-				case ZT_SIG_FXOLS:
-					xpd->lasttxhook[pos] = xpd->idletxhookstate[pos];
-					break;
-				case ZT_SIG_FXOGS:
-					xpd->lasttxhook[pos] = FXS_LINE_TIPOPEN;
-					break;
+			txhook = priv->lasttxhook[pos];
+			if(chan) {
+				switch(chan->sig) {
+					case ZT_SIG_EM:
+					case ZT_SIG_FXOKS:
+					case ZT_SIG_FXOLS:
+						txhook = priv->idletxhookstate[pos];
+						break;
+					case ZT_SIG_FXOGS:
+						txhook = FXS_LINE_TIPOPEN;
+						break;
+				}
 			}
-#endif
+			ret = linefeed_control(xbus, xpd, pos, txhook);
 			break;
 		case ZT_TXSIG_OFFHOOK:
+			txhook = priv->lasttxhook[pos];
 			if(xpd->ringing[pos]) {
 				BIT_SET(xpd->cid_on, pos);
-				ret = do_callerid(xpd->xbus, xpd, pos);		// CALLER ID
+				txhook = FXS_LINE_OHTRANS;
 			}
 			xpd->ringing[pos] = 0;
-#if 0
-			switch(chan->sig) {
-				case ZT_SIG_EM:
-					xpd->lasttxhook[pos] = FXS_LINE_REV_ACTIVE;
-					break;
-				default:
-					xpd->lasttxhook[pos] = xpd->idletxhookstate[pos];
-					break;
+			if(chan) {
+				switch(chan->sig) {
+					case ZT_SIG_EM:
+						txhook = FXS_LINE_POL_ACTIVE;
+						break;
+					default:
+						txhook = priv->idletxhookstate[pos];
+						break;
+				}
 			}
-#endif
+			ret = linefeed_control(xbus, xpd, pos, txhook);
 			break;
 		case ZT_TXSIG_START:
-			xpd->lasttxhook[pos] = FXS_LINE_RING;
 			xpd->ringing[pos] = 1;
 			BIT_CLR(xpd->cid_on, pos);
 			if(IS_SET(xpd->digital_outputs, pos)) {
@@ -471,7 +526,9 @@
 			ret = CALL_XMETHOD(RING, xbus, xpd, pos, 1);			// RING on
 			break;
 		case ZT_TXSIG_KEWL:
-			xpd->lasttxhook[pos] = FXS_LINE_DISABLED;
+			DBG("%s/%s/%d: KEWL START\n", xbus->busname, xpd->xpdname, pos);
+			linefeed_control(xbus, xpd, pos, FXS_LINE_OPEN);
+			MARK_OFF(priv, pos, LED_GREEN);
 			break;
 		default:
 			NOTICE("%s: Can't set tx state to %s (%d)\n", __FUNCTION__, txsig2str(txsig), txsig);
@@ -553,32 +610,63 @@
 
 static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos)
 {
+	struct FXS_priv_data	*priv;
 	bool		on;
 
+	BUG_ON(!xpd);
 	if (IS_SET(xpd->digital_outputs | xpd->digital_inputs, pos))
 		return;
+	priv = xpd->priv;
 	on = IS_SET(((struct FXS_priv_data *)xpd->priv)->msg_waiting, pos);
 	DBG("%s/%s/%d %s\n", xbus->busname, xpd->xpdname, pos, (on)?"ON":"OFF");
 	set_vm_led_mode(xbus, xpd, pos, on);
 	do_chan_power(xbus, xpd, pos, on);
-	SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x40, (on) ? 0x04 : 0x01);
+	linefeed_control(xbus, xpd, pos, (on) ? FXS_LINE_RING : priv->idletxhookstate[pos]);
 }
 
 static int FXS_chan_onhooktransfer(xbus_t *xbus, xpd_t *xpd, lineno_t chan, int millies)
 {
-	int	ret = 0;
-
-	BUG_ON(!xpd);
+	struct FXS_priv_data	*priv;
+	int			ret = 0;
+
+	BUG_ON(!xpd);
+	priv = xpd->priv;
 	BUG_ON(chan == ALL_CHANS);
 	DBG("%s/%s/%d: (%d millies)\n", xbus->busname, xpd->xpdname, chan, millies);
-	xpd->ohttimer[chan] = millies << 3;
-	xpd->idletxhookstate[chan] = FXS_LINE_CID;	/* OHT mode when idle */
-	if (xpd->lasttxhook[chan] == FXS_LINE_ENABLED) {
-		/* Apply the change if appropriate */
-		ret = do_callerid(xpd->xbus, xpd, chan);		// CALLER ID
-	}
-	start_stop_vm_led(xbus, xpd, chan);
+	if(!IS_SET(xpd->offhook, chan))
+		start_stop_vm_led(xbus, xpd, chan);
 	return ret;
+}
+
+static int FXS_card_open(xpd_t *xpd, lineno_t chan)
+{
+	struct FXS_priv_data	*priv;
+	bool			is_offhook;
+
+	BUG_ON(!xpd);
+	priv = xpd->priv;
+	is_offhook = IS_SET(xpd->offhook, chan);
+	DBG("%s/%s:%d (is %shook)\n", xpd->xbus->busname, xpd->xpdname,
+			chan, (is_offhook)?"off":"on");
+	/*
+	 * Delegate updating zaptel to FXS_card_tick():
+	 *   The problem is that zt_hooksig() is spinlocking the channel and
+	 *   we are called by zaptel with the spinlock already held on the
+	 *   same channel.
+	 */
+	BIT_SET(priv->update_offhook_state, chan);
+	return 0;
+}
+
+static int FXS_card_close(xpd_t *xpd, lineno_t chan)
+{
+	struct FXS_priv_data	*priv;
+
+	BUG_ON(!xpd);
+	DBG("%s/%s:%d\n", xpd->xbus->busname, xpd->xpdname, chan);
+	priv = xpd->priv;
+	priv->idletxhookstate[chan] = FXS_LINE_POL_ACTIVE;
+	return 0;
 }
 
 /*
@@ -600,6 +688,36 @@
 		byte	pos = input_channels[i];
 
 		SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_READ, 0x06, 0);
+	}
+}
+
+void handle_linefeed(xpd_t *xpd)
+{
+	struct FXS_priv_data	*priv;
+	int			i;
+
+	BUG_ON(!xpd);
+	priv = xpd->priv;
+	BUG_ON(!priv);
+	for_each_line(xpd, i) {
+		if (priv->lasttxhook[i] == FXS_LINE_RING) {
+			/* RINGing, prepare for OHT */
+			priv->ohttimer[i] = OHT_TIMER;
+			priv->idletxhookstate[i] = FXS_LINE_POL_OHTRANS;
+		} else {
+			if (priv->ohttimer[i]) {
+				priv->ohttimer[i]--;
+				if (!priv->ohttimer[i]) {
+					priv->idletxhookstate[i] = FXS_LINE_POL_ACTIVE;
+					if (priv->lasttxhook[i] == FXS_LINE_POL_OHTRANS) {
+						enum fxs_state	txhook = FXS_LINE_POL_ACTIVE;
+						/* Apply the change if appropriate */
+						BIT_CLR(xpd->cid_on, i);
+						linefeed_control(xpd->xbus, xpd, i, txhook);
+					}
+				}
+			}
+		}
 	}
 }
 
@@ -678,6 +796,28 @@
 	}
 #endif
 	handle_fxs_leds(xpd);
+	handle_linefeed(xpd);
+	if(priv->update_offhook_state) {	/* set in FXS_card_open() */
+		int	i;
+
+		for_each_line(xpd, i) {
+			if(!IS_SET(priv->update_offhook_state, i))
+				continue;
+			/*
+			 * Update LEDs and zaptel with current state of line.
+			 */
+			if(IS_SET(xpd->offhook, i)) {
+				NOTICE("%s/%s/%d: Already offhook during open. OK.\n",
+						xbus->busname, xpd->xpdname, i);
+				MARK_ON(priv, i, LED_GREEN);
+				update_line_status(xpd, i, 1);
+			} else {
+				MARK_OFF(priv, i, LED_GREEN);
+				update_line_status(xpd, i, 0);
+			}
+			BIT_CLR(priv->update_offhook_state, i);
+		}
+	}
 #ifndef	VMWI_IOCTL
 	if(SPAN_REGISTERED(xpd))
 		detect_vmwi(xpd);
@@ -721,9 +861,8 @@
 
 static /* 0x0F */ HOSTCMD(FXS, XPD_STATE, bool on)
 {
-	int		ret = 0;
 	int		i;
-	enum fxs_state	value = (on) ? 0x01 : 0x00;
+	enum fxs_state	value = (on) ? FXS_LINE_POL_ACTIVE : FXS_LINE_OPEN;
 	unsigned long		flags;
 	struct FXS_priv_data	*priv;
 
@@ -732,23 +871,22 @@
 	priv = xpd->priv;
 	spin_lock_irqsave(&xpd->lock, flags);
 	DBG("%s/%s: %s\n", xbus->busname, xpd->xpdname, (on) ? "on" : "off");
-	ret = SLIC_DIRECT_REQUEST(xbus, xpd, ALL_CHANS, SLIC_WRITE, 0x40, value);
 	for_each_line(xpd, i)
-		xpd->lasttxhook[i] = value;
+		linefeed_control(xbus, xpd, i, value);
 	if(on) {
 		MARK_ON(priv, ALL_CHANS, LED_GREEN);
 	} else {
 		MARK_OFF(priv, ALL_CHANS, LED_GREEN);
 	}
 	spin_unlock_irqrestore(&xpd->lock, flags);
-	return ret;
+	return 0;
 }
 
 static /* 0x0F */ HOSTCMD(FXS, RING, lineno_t chan, bool on)
 {
 	int			ret = 0;
 	struct FXS_priv_data	*priv;
-	enum fxs_state		value = (on) ? 0x04 : 0x01;
+	enum fxs_state		value = (on) ? FXS_LINE_RING : FXS_LINE_POL_ACTIVE;
 
 	BUG_ON(!xbus);
 	BUG_ON(!xpd);
@@ -756,8 +894,7 @@
 	priv = xpd->priv;
 	set_vm_led_mode(xbus, xpd, chan, 0);
 	do_chan_power(xbus, xpd, chan, on);		// Power up (for ring)
-	ret = SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
-	xpd->lasttxhook[chan] = value;
+	ret = linefeed_control(xbus, xpd, chan, value);
 	if(on) {
 		MARK_BLINK(priv, chan, LED_GREEN, LED_BLINK_RING);
 	} else {
@@ -819,7 +956,6 @@
 				DBG("%s/%s/%d: ONHOOK\n", xbus->busname, xpd->xpdname, i);
 				MARK_OFF(priv, i, LED_GREEN);
 				update_line_status(xpd, i, 0);
-				start_stop_vm_led(xbus, xpd, i);
 			}
 		}
 	}
@@ -910,6 +1046,8 @@
 		.card_hooksig	= FXS_card_hooksig,
 		.card_tick	= FXS_card_tick,
 		.chan_onhooktransfer = FXS_chan_onhooktransfer,
+		.card_open	= FXS_card_open,
+		.card_close	= FXS_card_close,
 #ifdef	VMWI_IOCTL
 		.card_ioctl	= FXS_card_ioctl,
 #endif
@@ -917,8 +1055,6 @@
 		.RING		= XPROTO_CALLER(FXS, RING),
 		.RELAY_OUT	= XPROTO_CALLER(FXS, RELAY_OUT),
 		.XPD_STATE	= XPROTO_CALLER(FXS, XPD_STATE),
-
-		.SYNC_SOURCE	= XPROTO_CALLER(GLOBAL, SYNC_SOURCE),
 	},
 	.packet_is_valid = fxs_packet_is_valid,
 	.packet_dump = fxs_packet_dump,
@@ -954,10 +1090,28 @@
 	spin_lock_irqsave(&xpd->lock, flags);
 	priv = xpd->priv;
 	BUG_ON(!priv);
-	len += sprintf(page + len, "\t%-17s: ", "Channel");
+	len += sprintf(page + len, "%-8s %-10s %-10s %-10s\n",
+			"Channel",
+			"idletxhookstate",
+			"lasttxhook",
+			"ohttimer"
+			);
 	for_each_line(xpd, i) {
-		if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i))
-			len += sprintf(page + len, "%d ", i % 10);
+		char	pref;
+
+		if(IS_SET(xpd->digital_outputs, i))
+			pref = 'O';
+		else if(IS_SET(xpd->digital_inputs, i))
+			pref = 'I';
+		else
+			pref = ' ';
+		len += sprintf(page + len, "%c%7d %10d %10d %10d\n",
+				pref,
+				i,
+				priv->idletxhookstate[i],
+				priv->lasttxhook[i],
+				priv->ohttimer[i]
+			      );
 	}
 	len += sprintf(page + len, "\n");
 	for(led = 0; led < NUM_LEDS; led++) {

Modified: team/mattf/zaptel-hotwct4xxp/xpp/card_global.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/card_global.c?view=diff&rev=2306&r1=2305&r2=2306
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/card_global.c (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/card_global.c Mon Mar 12 12:01:03 2007
@@ -59,6 +59,9 @@
 	return ret;
 }
 
+/*
+ * The XPD parameter is totaly ignored by the driver and firmware as well.
+ */
 /* 0x19 */ HOSTCMD(GLOBAL, SYNC_SOURCE, bool setit, bool is_master)
 {
 	xframe_t	*xframe;
@@ -66,14 +69,14 @@
 	byte		mask = 0;
 
 	BUG_ON(!xbus);
-	BUG_ON(!xpd);
 	if(is_master)
 		mask |= BIT(0);
 	if(!setit)
 		mask |= BIT(1);
-	DBG("SYNC_SOURCE %s setit=%s is_master=%s (mask=0x%X)\n",
-			xpd->xpdname, (setit)?"yes":"no", (is_master)?"yes":"no", mask);
-	XFRAME_NEW(xframe, pack, xbus, GLOBAL, SYNC_SOURCE, xpd->id);
+	DBG("%s: setit=%s is_master=%s\n",
+			xbus->busname,
+			(setit)?"yes":"no", (is_master)?"yes":"no");
+	XFRAME_NEW(xframe, pack, xbus, GLOBAL, SYNC_SOURCE, 0);
 	RPACKET_FIELD(pack, GLOBAL, SYNC_SOURCE, mask) = mask;
 	xframe_send(xbus, xframe);
 	return 0;
@@ -94,7 +97,6 @@
 	xpp_line_t		line_status = RPACKET_FIELD(pack, GLOBAL, DEV_DESC, line_status);
 	xpd_addr_t		xpd_addr = RPACKET_FIELD(pack, GLOBAL, DEV_DESC, addr);
 	struct card_desc_struct	*card_desc;
-	unsigned long		flags;
 
 	BUG_ON(!xbus);

[... 5910 lines stripped ...]


More information about the zaptel-commits mailing list