[zaptel-commits] kpfleming: branch 1.4 r2215 - in /branches/1.4: ./ datamods/ firmware/ hpec/ ...

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Fri Feb 23 16:57:11 MST 2007


Author: kpfleming
Date: Fri Feb 23 17:57:10 2007
New Revision: 2215

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2215
Log:
partial update to support all the stuff that went into Zaptel 1.2 recently... this definitely still broken for 2.4 kernels, and maybe for 2.6 as well :-)

includes:
  Makefile split and reorganize
  TE120P driver
  TC400B driver
  HPEC support (not yet complete)

Added:
    branches/1.4/Makefile.kernel26   (with props)
    branches/1.4/hpec/
      - copied from r2214, branches/1.2/hpec/
    branches/1.4/wct4xxp/Makefile.kernel26
      - copied unchanged from r2214, branches/1.4/wct4xxp/Kbuild
    branches/1.4/wctc4xxp/
      - copied from r2214, branches/1.2/wctc4xxp/
    branches/1.4/wcte12xp.c
      - copied unchanged from r2214, branches/1.2/wcte12xp.c
    branches/1.4/zaptel-base.c
      - copied unchanged from r2214, branches/1.4/zaptel.c
Removed:
    branches/1.4/wct4xxp/Kbuild
    branches/1.4/zaptel.c
Modified:
    branches/1.4/Makefile
    branches/1.4/datamods/Makefile
    branches/1.4/firmware/firmware.xml
    branches/1.4/wct4xxp/Makefile
    branches/1.4/zaptel.h
    branches/1.4/zaptel.xml
    branches/1.4/zttranscode.c

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Fri Feb 23 17:57:10 2007
@@ -1,21 +1,22 @@
 #
 # Makefile for Zaptel driver modules and utilities
 #
-# Copyright (C) 2001-2006 Digium, Inc.
-#
-#
-
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: menuselect distclean dist-clean clean version.h all _all install b410p devices programs modules linux24 linux26 xpp tests devel data stackcheck install-udev config update install-programs install-modules install-linux24 install-linux26 firmware install-include install-libs xpp-install xpp-utils
-
-PWD=$(shell pwd)
+# Copyright (C) 2001-2007 Digium, Inc.
+#
+#
+
+CFLAGS+=-DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
+
+ifeq ($(MAKELEVEL),0)
+PWD:=$(shell pwd)
+endif
 
 ifeq ($(DEB_HOST_GNU_TYPE),)
 UNAME_M:=$(shell uname -m)
 else
 UNAME_M:=$(DEB_HOST_GNU_TYPE)
 endif
+
 # If you want to build for a kernel other than the current kernel, set KVERS
 ifndef KVERS
 KVERS:=$(shell uname -r)
@@ -31,6 +32,85 @@
 KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2)
 KINCLUDES:=$(KSRC)/include
 
+ifeq ($(KVERS_MAJ),2.4)
+  BUILDVER:=linux24
+else
+  BUILDVER:=linux26
+endif
+
+# Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support
+# if it is enabled in the kernel.
+ifeq ($(BUILDVER),linux26)
+  ifneq (,$(wildcard $(INSTALL_PREFIX)/etc/udev/rules.d))
+    DYNFS=yes
+    UDEVRULES=yes
+  endif
+  HOTPLUG_FIRMWARE:=$(shell if grep CONFIG_FW_LOADER $(KINCLUDES)/linux/autoconf.h | grep -q undef; then echo "no"; else echo "yes"; fi)
+endif
+
+ifeq ($(HOTPLUG_FIRMWARE),yes)
+  CFLAGS+=-DHOTPLUG_FIRMWARE
+endif
+
+ifeq ($(ARCH),i386)
+ifneq ($(wildcard $(PWD)/hpec/hpec_x86_32.o_shipped),)
+HPEC_PRESENT=yes
+endif
+endif
+
+ifeq ($(ARCH),x86_64)
+ifneq ($(wildcard $(PWD)/hpec/hpec_x86_64.o_shipped),)
+HPEC_PRESENT=yes
+endif
+endif
+
+ifeq ($(BUILDVER),linux24)
+MENUSELECT_MODULES+=xpp wctc4xxp zttranscode
+endif
+
+ifeq ($(findstring xpp,$(MENUSELECT_MODULES)),)
+  BUILD_XPP:=yes
+endif
+
+TOPDIR_MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wctdm24xxp wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic zttranscode wcte12xp
+SUBDIR_MODULES:=wct4xxp wctc4xxp xpp
+BUILD_TOPDIR_MODULES:=$(filter-out $(MENUSELECT_MODULES),$(TOPDIR_MODULES))
+BUILD_SUBDIR_MODULES:=$(filter-out $(MENUSELECT_MODULES),$(SUBDIR_MODULES))
+BUILD_MODULES:=$(BUILD_TOPDIR_MODULES) $(BUILD_SUBDIR_MODULES)
+
+MOD_DESTDIR:=zaptel
+
+#NOTE NOTE NOTE
+#
+# all variables set before the include of Makefile.kernel26 are needed by the 2.6 kernel module build process
+
+ifneq ($(KBUILD_EXTMOD),)
+
+obj-m:=$(BUILD_TOPDIR_MODULES:%=%.o)
+obj-m+=$(BUILD_SUBDIR_MODULES:%=%/)
+
+include $(src)/Makefile.kernel26
+
+else
+
+ifeq ($(BUILDVER),linux24)
+  INSTALL_MODULES:=$(BUILD_TOPDIR_MODULES:%=%.o)
+  INSTALL_MODULES+=$(BUILD_SUBDIR_MODULES:%=%/%.o)
+  ALL_MODULES:=$(TOPDIR_MODULES:%=%.o)
+  ALL_MODULES+=$(SUBDIR_MODULES:%=%/%.o)
+else
+  INSTALL_MODULES:=$(BUILD_TOPDIR_MODULES:%=%.ko)
+  INSTALL_MODULES+=$(foreach mod,$(filter-out xpp,$(BUILD_SUBDIR_MODULES)),$(mod)/$(mod).ko)
+  ifneq ($(filter xpp,$(BUILD_SUBDIR_MODULES)),)
+  INSTALL_MODULES+=$(patsubst %,xpp/%.ko,xpp_usb xpd_fxo xpd_fxs xpp)
+  endif
+
+  ALL_MODULES:=$(TOPDIR_MODULES:%=%.ko)
+  ALL_MODULES+=$(foreach mod,$(filter-out xpp,$(SUBDIR_MODULES)),$(mod)/$(mod).ko)
+  ALL_MODULES+=$(patsubst %,xpp/%.ko,xpp_usb xpd_fxo xpd_fxs xpp)
+  endif
+endif
+
 CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
 ifneq (,$(findstring ppc,$(UNAME_M)))
 CFLAGS_PPC:=-fsigned-char
@@ -81,6 +161,8 @@
 # Features are now configured in zconfig.h
 #
 
+MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
+
 KFLAGS+=-DSTANDALONE_ZAPATA
 CFLAGS+=-DSTANDALONE_ZAPATA
 KMAKE  = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
@@ -92,23 +174,6 @@
 
 CONFIG_FILE=$(INSTALL_PREFIX)/etc/zaptel.conf
 CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
-
-ifeq ($(KVERS_MAJ),2.4)
-  BUILDVER:=linux24
-else
-  BUILDVER:=linux26
-endif
-
-# This is not related to the version that we build. Rather, to the 
-# version that we runs. If we build for 2.4 using 2.4 headers on a 2.6
-# system with udev mounted on /dev , no point in installing files to /dev
-# because they'll be wiped at next reboot.
-DYNFS:=$(shell ps ax | grep -v grep | grep -qw 'devfsd\|udevd' && echo "yes")
-
-# Check for udev rules directories
-ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/rules.d))
-  UDEVRULES=yes
-endif
 
 CHKCONFIG:=$(shell sh -c 'type -p chkconfig' 2> /dev/null)
 ifndef CHKCONFIG
@@ -130,56 +195,11 @@
 LTZ_SO_MAJOR_VER:=1
 LTZ_SO_MINOR_VER:=0
 
-ifeq ($(findstring xpp_usb,$(MENUSELECT_MODULES)),)
-  BUILD_XPP:=yes
-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
-
-MODULESO:=$(MODULES:%=%.o)
-MODULESKO:=$(MODULES:%=%.ko)
-ifeq ($(BUILDVER),linux26)
-MODULES_BUILD:=$(MODULESKO)
-HOTPLUG_FIRMWARE:=$(shell if grep CONFIG_FW_LOADER $(KINCLUDES)/linux/autoconf.h | grep -q undef; then echo "no"; else echo "yes"; fi)
-else
-MODULES_BUILD:=$(MODULESO)
-endif
-
 BIN_DIR:=$(INSTALL_PREFIX)/sbin
 LIB_DIR:=$(INSTALL_PREFIX)/usr/lib
 INC_DIR:=$(INSTALL_PREFIX)/usr/include
 MOD_DIR:=$(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc
 
-MOD_DESTDIR:=zaptel
-
-obj-m:=$(MODULESO)
-ifeq ($(findstring wct4xxp,$(MENUSELECT_MODULES)),)
-obj-m+=wct4xxp/
-MODULES+=wct4xxp
-endif
-
-# Set this to override hotplug firmware loading and revert to classic header
-#HOTPLUG_FIRMWARE=no
-ifeq ($(HOTPLUG_FIRMWARE),yes)
-CFLAGS+=-DHOTPLUG_FIRMWARE
-endif	
-
-# Also build xpp in the subdirectory xpp/ . But only for >=2.6.8 and only 
-# for i386 or x86_64. On other platforms it has still not been tested well 
-# enough.
-# This does not affect kernel 2.4, because obj-m is only used for kernel 
-# 2.6's build. Note that it is only actually tested by the kernel 2.6 build 
-# system and not by the main makefile.
-ifneq (,$(shell [ 0$(SUBLEVEL) -ge 8 ] && echo 1))
-ifeq ($(ARCH),i386)
-obj-m+=xpp/
-endif
-ifeq ($(ARCH),x86_64)
-obj-m+=xpp/
-endif
-endif
-
 BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool
 UTILS:=$(filter-out zttool fxstest ztcfg,$(BINS))
 UTILSO:=$(UTILS:%=%.o)
@@ -188,7 +208,7 @@
 all: menuselect.makeopts 
 	@$(MAKE) _all
 
-_all: $(if $(MODULES),modules) programs $(LTZ_SO) $(LTZ_A)
+_all: $(if $(BUILD_MODULES),modules) programs $(LTZ_SO) $(LTZ_A)
 
 xpp-utils:
 ifeq (yes,$(BUILD_XPP))
@@ -197,15 +217,13 @@
 
 programs: $(BINS) xpp-utils
 
-modules: $(BUILDVER)
-
-linux24: prereq $(MODULESO) wct4xxp/wct4xxp.o
-
-linux26: prereq
+modules: prereq
 	@if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
-	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) modules
-
-xpp: linux26
+ifeq ($(BUILDVER),linux26)
+	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
+else
+modules: $(BUILD_MODULES)
+endif
 
 version.h:
 	@ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp
@@ -214,31 +232,7 @@
 	fi
 	@rm -f $@.tmp
 
-wct4xxp/wct4xxp.o:
-	$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
-
-devel: tor2ee 
-
 tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest
-
-tor2.o: tor2-hw.h tor2fw.h
-
-zaptel.o: digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h
-
-wcusb.o: wcusb.h
-
-wcfxsusb.o: wcfxsusb.h
-
-wctdm.o: wctdm.h
-
-wctdm24xxp.o: wctdm.h
-
-pciradio.o: radfw.h
-
-ztdummy.o: ztdummy.h
-
-$(MODULESO): %.o: %.c zaptel.h
-	$(CC) $(KFLAGS) -o $@ -c $<
 
 tor2ee.o: tor2-hw.h
 
@@ -267,8 +261,6 @@
 
 gendigits: LDLIBS+=-lm
 gendigits: CFLAGS=
-
-zaptel.c: tones.h 
 
 prereq: config.status tones.h tor2fw.h radfw.h version.h
 
@@ -316,6 +308,34 @@
 fxstest: LDLIBS+=-lm
 fxotune: LDLIBS+=-lm
 fxsdump: LDLIBS+=-lm
+
+devel: tor2ee 
+
+ifeq ($(BUILDVER),linux24)
+wct4xxp/wct4xxp.o:
+	$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
+
+tor2.o: tor2-hw.h tor2fw.h
+
+zaptel.o: digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h
+
+wcusb.o: wcusb.h
+
+wcfxsusb.o: wcfxsusb.h
+
+wctdm.o: wctdm.h
+
+wctdm24xxp.o: wctdm.h
+
+pciradio.o: radfw.h
+
+ztdummy.o: ztdummy.h
+
+$(BUILD_MODULES): %.o: %.c zaptel.h
+	$(CC) $(KFLAGS) -o $@ -c $<
+
+zaptel.c: tones.h
+endif
 
 stackcheck: checkstack $(BUILDVER)
 	./checkstack *.o
@@ -345,6 +365,60 @@
 
 $(UTILSO): %.o: %.c
 	$(CC) $(CFLAGS) -o $@ -c $<
+
+hotplug-uninstall:
+	$(MAKE) -C firmware hotplug-uninstall
+
+install: all devices install-modules install-libs install-include install-xpp
+ifeq ($(HOTPLUG_FIRMWARE),yes)
+	$(MAKE) -C firmware hotplug-install
+endif
+	if [ -f ztcfg ]; then \
+		$(INSTALL -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg; \
+	fi
+	if [ -f sethdlc-new ]; then \
+		$(INSTALL) -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
+	elif [ -f sethdlc ]; then \
+		$(INSTALL) -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc; \
+	fi
+	if [ -f zttool ]; then \
+		$(INSTALL) -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; \
+	fi
+	$(INSTALL) -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
+	$(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 xpp zttranscode ztdynamic,$(BUILD_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)
+	$(INSTALL) -D -m 755 $(LTZ_SO) $(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
+	if [ -z "$(INSTALL_PREFIX)" -a `id -u` = 0 ]; then \
+		/sbin/ldconfig || : ;\
+	fi
+	rm -f $(LIB_DIR)$(LTZ_SO)
+	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
+		$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER)
+	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
+		$(LIB_DIR)/$(LTZ_SO)
+	if [ -z "$(INSTALL_PREFIX)" ] && [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then /sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO); fi
+
+install-xpp:
+ifeq (yes,$(BUILD_XPP))
+	@$(MAKE) -C xpp/utils install
+endif
+
+install-include:
+	$(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel/zaptel.h
+	$(INSTALL) -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/zaptel/tonezone.h
+	rm -f $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
+	rm -f $(INSTALL_PREFIX)/usr/include/linux/torisa.h
+	rm -f $(INSTALL_PREFIX)/usr/include/zaptel.h
+	rm -f $(INSTALL_PREFIX)/usr/include/torisa.h
+	rm -f $(INSTALL_PREFIX)/usr/include/tonezone.h
 
 devices:
 ifndef DYNFS
@@ -377,80 +451,33 @@
   endif
 endif
 
-hotplug-uninstall:
-	$(MAKE) -C firmware hotplug-uninstall
-
-xpp-install:
-ifeq (yes,$(BUILD_XPP))
-	@$(MAKE) -C xpp/utils install
-endif
-
-install: all devices firmware install-libs install-include xpp-install
-ifeq ($(HOTPLUG_FIRMWARE),yes)
-	$(MAKE) -C firmware hotplug-install
-endif
-	if [ -f ztcfg ]; then \
-		$(INSTALL) -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg; \
-	fi
-	if [ -f sethdlc-new ]; then \
-		$(INSTALL) -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
-	elif [ -f sethdlc ]; then \
-		$(INSTALL) -D -m 755 sethdlc $(INSTALL_PREFIX)/sbin/sethdlc; \
-	fi
-	if [ -f zttool ]; then \
-		$(INSTALL) -D -m 755 zttool $(INSTALL_PREFIX)/sbin/zttool; \
-	fi
-ifeq ($(BUILDVER),linux26)
-	for x in $(MODULESKO); do \
+install-udev: devices
+
+# make should *fail* and not silently succeed if a program did not build
+install-programs: $(BINS)
+	$(INSTALL) -d $(BIN_DIR)
+	$(INSTALL) $(BINS) $(BIN_DIR)
+
+uninstall-modules:
+ifeq ($(BUILDVER),linux24)
+else
+	for x in $(ALL_MODULES); do \
 		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/extra/$$x ; \
+		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
+		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/zaptel/$$x ; \
 	done; \
-	$(KMAKE_INST); \
+endif
+
+install-modules: $(INSTALL_MODULES) uninstall-modules
+ifeq ($(BUILDVER),linux24)
+	$(INSTALL) -d $(MOD_DIR)
+	$(INSTALL) -m 644 $(INSTALL_MODULES) $(MOD_DIR)
+else
+	$(KMAKE_INST)
 	if [ -f datamods/syncppp.ko ]; then \
 		$(MAKE) -C datamods install; \
-	else \
-		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/{hdlc_*,syncppp}.ko; \
-	fi
-else
-	for x in $(MODULESO) wct4xxp/wct4xxp.o; do \
-		$(INSTALL) -D -m 644 $$x $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/$$x ; \
-	done
-endif
-	if ! [ -f wcfxsusb.o ]; then \
-		rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxsusb.o; \
-	fi; \
-	rm -f $(INSTALL_PREFIX)/lib/modules/$(KVERS)/misc/wcfxs.o
-	$(INSTALL) -m 644 doc/ztcfg.8 $(INSTALL_PREFIX)/usr/share/man/man8
-	$(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)
-	$(INSTALL) -D -m 755 $(LTZ_SO) $(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER)
-	if [ -z "$(INSTALL_PREFIX)" -a `id -u` = 0 ]; then \
-		/sbin/ldconfig || : ;\
-	fi
-	rm -f $(LIB_DIR)$(LTZ_SO)
-	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
-		$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER)
-	$(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \
-		$(LIB_DIR)/$(LTZ_SO)
-	if [ -z "$(INSTALL_PREFIX)" ] && [ -x /usr/sbin/sestatus ] && (/usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled") ; then /sbin/restorecon -v $(LIB_DIR)/$(LTZ_SO); fi
-
-install-include:
-	$(INSTALL) -D -m 644 zaptel.h $(INSTALL_PREFIX)/usr/include/zaptel/zaptel.h
-	$(INSTALL) -D -m 644 tonezone.h $(INSTALL_PREFIX)/usr/include/zaptel/tonezone.h
-	rm -f $(INSTALL_PREFIX)/usr/include/linux/zaptel.h
-	rm -f $(INSTALL_PREFIX)/usr/include/linux/torisa.h
-	rm -f $(INSTALL_PREFIX)/usr/include/zaptel.h
-	rm -f $(INSTALL_PREFIX)/usr/include/torisa.h
-	rm -f $(INSTALL_PREFIX)/usr/include/tonezone.h
-
-install-udev: devices
+	fi
+endif
 
 config:
 	if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \
@@ -488,19 +515,6 @@
 		echo "Not under version control";  \
 	fi
 
-# make should *fail* and not silently succeed if a program did not build
-install-programs: $(BINS) install-libs install-include
-	$(INSTALL) -d $(BIN_DIR)
-	$(INSTALL) $(BINS) $(BIN_DIR)
-
-install-modules: install-$(BUILDVER)
-install-linux24: $(MODULES_BUILD)
-	$(INSTALL) -d $(MOD_DIR)
-	$(INSTALL) -m 644 $(MODULES_BUILD) $(MOD_DIR)
-
-install-linux26: $(MODULESKO)
-	$(KMAKE_INST)
-
 clean:
 	-@$(MAKE) -C menuselect clean
 	rm -f torisatool makefw tor2fw.h radfw.h
@@ -509,13 +523,11 @@
 	rm -f $(LTZ_SO) $(LTZ_A) *.lo
 ifeq ($(BUILDVER),linux26)
 	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) clean
+	$(MAKE) -C xpp/utils clean
 else
 	$(MAKE) -C wct4xxp clean
 endif
 	$(MAKE) -C firmware clean
-	-@$(MAKE) -C xpp/utils clean
-	rm -f xpp/*.ko xpp/*.mod.c xpp/.*o.cmd
-	rm -f xpp/*.o xpp/*.mod.o
 	rm -rf .tmp_versions
 	rm -f gendigits tones.h
 	rm -f libtonezone*
@@ -556,3 +568,8 @@
 menuselect-tree: zaptel.xml firmware/firmware.xml
 	@echo "Generating input for menuselect ..."
 	@build_tools/make_tree > $@
+
+.EXPORT_ALL_VARIABLES:
+
+.PHONY: menuselect distclean dist-clean clean version.h all _all install b410p devices programs modules tests devel data stackcheck install-udev config update install-programs install-modules install-include install-libs install-xpp xpp-utils uninstall-modules
+endif

Added: branches/1.4/Makefile.kernel26
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile.kernel26?view=auto&rev=2215
==============================================================================
--- branches/1.4/Makefile.kernel26 (added)
+++ branches/1.4/Makefile.kernel26 Fri Feb 23 17:57:10 2007
@@ -1,0 +1,15 @@
+EXTRA_CFLAGS := -I$(src)
+
+zaptel-objs := zaptel-base.o
+
+ifeq ($(HPEC_PRESENT),yes)
+ifeq ($(ARCH),i386)
+zaptel-objs += hpec/hpec_x86_32.o
+endif
+
+ifeq ($(ARCH),x86_64)
+zaptel-objs += hpec/hpec_x86_64.o
+endif
+
+EXTRA_CFLAGS += -DECHO_CAN_HPEC -I$(src)/hpec
+endif

Propchange: branches/1.4/Makefile.kernel26
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.4/Makefile.kernel26
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: branches/1.4/Makefile.kernel26
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: branches/1.4/datamods/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/datamods/Makefile?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/datamods/Makefile (original)
+++ branches/1.4/datamods/Makefile Fri Feb 23 17:57:10 2007
@@ -2,7 +2,7 @@
 MODULES= \
 	hdlc_cisco  hdlc_generic  hdlc_raw      syncppp \
 	hdlc_fr     hdlc_ppp      hdlc_raw_eth  
-	
+
 
 PWD=$(shell pwd)
 
@@ -24,7 +24,7 @@
 
 install: $(MODULESKO)
 	$(KMAKE_INST)
-	
+
 datamods:
 	@echo "To build: $(obj-m)"
 	@echo $(KSRC)

Modified: branches/1.4/firmware/firmware.xml
URL: http://svn.digium.com/view/zaptel/branches/1.4/firmware/firmware.xml?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/firmware/firmware.xml (original)
+++ branches/1.4/firmware/firmware.xml Fri Feb 23 17:57:10 2007
@@ -1,11 +1,14 @@
 	<category name="MENUSELECT_FIRMWARE" displayname="Binary Firmware Packages" positive_output="yes">
-		<member name="FIRMWARE-OCT6114-064" displayname="Oct6114 064 Echo Cancellation Firmware" >
+		<member name="FIRMWARE-OCT6114-064" displayname="Digium VPMOCT064M" >
 			<defaultenabled>yes</defaultenabled>
+			<depend>wct4xxp</depend>
 		</member>
-                <member name="FIRMWARE-OCT6114-128" displayname="Oct6114 128 Echo Cancellation Firmware" >
+                <member name="FIRMWARE-OCT6114-128" displayname="Digium VPMOCT128M/VPM450M">
                         <defaultenabled>yes</defaultenabled>
+			<depend>wct4xxp</depend>
                 </member>
-                <member name="FIRMWARE-TC400M" displayname="TC400M Module Firmware" >
+                <member name="FIRMWARE-TC400M" displayname="Digium TC400M" >
                         <defaultenabled>yes</defaultenabled>
+			<depend>wctc4xxp</depend>
                 </member>
 	</category>

Modified: branches/1.4/wct4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct4xxp/Makefile?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/wct4xxp/Makefile (original)
+++ branches/1.4/wct4xxp/Makefile Fri Feb 23 17:57:10 2007
@@ -1,6 +1,6 @@
 ifneq ($(KBUILD_EXTMOD),)
 
-include $(obj)/Kbuild
+include $(obj)/Makefile.kernel26
 
 else
 

Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Fri Feb 23 17:57:10 2007
@@ -720,29 +720,31 @@
 #define ZT_TRANSCODE_MAGIC 0x74a9c0de
 
 /* Operations */
-#define ZT_TCOP_RESET		1			/* Reset the channel state / codec selection */
+#define ZT_TCOP_ALLOCATE	1			/* Allocate/reset DTE channel */
 #define ZT_TCOP_TRANSCODE	2			/* Begin transcoding a block */
 #define ZT_TCOP_GETINFO		3			/* Get information (use zt_transcode_info) */
-
+#define ZT_TCOP_RELEASE         4                       /* Release DTE channel */
+#define ZT_TCOP_TEST            5                       /* test DTE device */
 typedef struct zt_transcode_info {
 	unsigned int op;
 	unsigned int tcnum;
 	char name[80];
+	int numchannels;
 	unsigned int srcfmts;
 	unsigned int dstfmts;
 } ZT_TRANSCODE_INFO;
 
-#define ZT_TCCONF_USETS 	(1 << 0)	/* Use/update timestamp field */
-#define ZT_TCCONF_USESEQ 	(1 << 1)	/* Use/update seqno field */
-
-#define ZT_TCSTAT_DSTRDY	(1 << 0)	/* Destination data is ready */
-#define ZT_TCSTAT_DSTBUSY	(1 << 1)	/* Destination data is outstanding */
-
-#define __ZT_TRANSCODE_BUFSIZ		16384
-#define ZT_TRANSCODE_HDRLEN		256
-#define ZT_TRANSCODE_BUFSIZ		((__ZT_TRANSCODE_BUFSIZ) - (ZT_TRANSCODE_HDRLEN))
-#define ZT_TRANSCODE_DSTOFFSET		(((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
-#define ZT_TRANSCODE_SRCOFFSET		(((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
+#define ZT_TCCONF_USETS		(1 << 0)		/* Use/update timestamp field */
+#define ZT_TCCONF_USESEQ	(1 << 1)		/* Use/update seqno field */
+
+#define ZT_TCSTAT_DSTRDY	(1 << 0)		/* Destination data is ready */
+#define ZT_TCSTAT_DSTBUSY	(1 << 1)		/* Destination data is outstanding */
+
+#define __ZT_TRANSCODE_BUFSIZ	16384
+#define ZT_TRANSCODE_HDRLEN	256
+#define ZT_TRANSCODE_BUFSIZ	((__ZT_TRANSCODE_BUFSIZ) - (ZT_TRANSCODE_HDRLEN))
+#define ZT_TRANSCODE_DSTOFFSET	(((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
+#define ZT_TRANSCODE_SRCOFFSET	(((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
 
 typedef struct zt_transcode_header {
 	unsigned int srcfmt;		/* See formats.h -- use TCOP_RESET when you change */
@@ -761,8 +763,6 @@
 	unsigned int magic;		/* Magic value -- ZT_TRANSCODE_MAGIC, read by user */
 	unsigned int config;		/* Read/write by user */
 	unsigned int status;		/* Read/write by user */
-
-	/* XXX: fix this to automatically calculate somehow */
 	unsigned char userhdr[ZT_TRANSCODE_HDRLEN - (sizeof(unsigned int) * 14)];	/* Storage for user parameters */
 	unsigned char srcdata[ZT_TRANSCODE_BUFSIZ / 2];	/* Storage of source data */
 	unsigned char dstdata[ZT_TRANSCODE_BUFSIZ / 2];	/* Storage of destination data */
@@ -1438,6 +1438,8 @@
 	wait_queue_head_t ready;
 	int errorstatus;
 	int offset;
+	unsigned int chan_built;
+	unsigned int built_fmts;
 	unsigned int flags;
 	unsigned int srcfmt;
 	unsigned int dstfmt;
@@ -1538,26 +1540,6 @@
 
 /* Alert a transcoder */
 int zt_transcoder_alert(struct zt_transcoder_channel *ztc);
-
-/* Sanity check values */
-static inline int zt_tc_sanitycheck(struct zt_transcode_header *zth, unsigned int outbytes)
-{
-	if (zth->dstoffset >= sizeof(zth->dstdata))
-		return 0;
-	if (zth->dstlen >= sizeof(zth->dstdata))
-		return 0;
-	if (outbytes >= sizeof(zth->dstdata))
-		return 0;
-	if ((zth->dstoffset + zth->dstlen + outbytes) >= sizeof(zth->dstdata))
-		return 0;
-	if (zth->srcoffset >= sizeof(zth->srcdata))
-		return 0;
-	if (zth->srclen >= sizeof(zth->srcdata))
-		return 0;
-	if ((zth->srcoffset + zth->srclen) > sizeof(zth->srcdata))
-		return 0;
-	return 1;
-}
 
 /* Unregister a span */
 int zt_unregister(struct zt_span *span);

Modified: branches/1.4/zaptel.xml
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.xml?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/zaptel.xml (original)
+++ branches/1.4/zaptel.xml Fri Feb 23 17:57:10 2007
@@ -5,24 +5,26 @@
 	</member>
 	<member name="torisa" displayname="Tormenta ISA" remove_on_change="torisa.o torisa.ko">
 	</member>
-	<member name="wcfxo" displayname="Wildcard X100P" remove_on_change="wcfxo.o wcfxo.ko">
+	<member name="wcfxo" displayname="Digium Wildcard X100P" remove_on_change="wcfxo.o wcfxo.ko">
 	</member>
-	<member name="wct1xxp" displayname="Wildcard T100P / E100P" remove_on_change="wct1xxp.o wct1xxp.ko">
+	<member name="wct1xxp" displayname="Digium Wildcard T100P / E100P" remove_on_change="wct1xxp.o wct1xxp.ko">
 	</member>
-	<member name="wct4xxp" displayname="Wildcard TE4XXP / TE2XXP" remove_on_change="wct4xxp/wct4xxp.o wct4xxp/wct4xxp.ko">
+	<member name="wct4xxp" displayname="Digium Wildcard TE4XXP / TE2XXP" remove_on_change="wct4xxp/wct4xxp.o wct4xxp/wct4xxp.ko">
 	</member>
-	<member name="wctc4xxp" displayname="Wildcard TC400B" remove_on_change="wctc4xxp/wctc4xxp.o wctc4xxp/wctc4xxp.ko">
+	<member name="wctc4xxp" displayname="Digium Wildcard TC400B" remove_on_change="wctc4xxp/wctc4xxp.o wctc4xxp/wctc4xxp.ko">
 		<depend>zttranscode</depend>
 	</member>
-	<member name="wctdm" displayname="Wildcard TDM400P" remove_on_change="wctdm.o wctdm.ko">
+	<member name="wctdm" displayname="Digium Wildcard TDM400P" remove_on_change="wctdm.o wctdm.ko">
 	</member>
-	<member name="wctdm24xxp" displayname="Wildcard TDM2400P / TDM800P" remove_on_change="wctdm24xxp.o wctdm24xxp.ko">
+	<member name="wctdm24xxp" displayname="Digium Wildcard TDM2400P / TDM800P" remove_on_change="wctdm24xxp.o wctdm24xxp.ko">
 	</member>
-	<member name="wcte11xp" displayname="Wildcard TE110P" remove_on_change="wcte11xp.o wcte11xp.ko">
+	<member name="wcte11xp" displayname="Digium Wildcard TE110P" remove_on_change="wcte11xp.o wcte11xp.ko">
 	</member>
-	<member name="wcusb" displayname="Wildcard S100U" remove_on_change="wcusb.o wcusb.ko">
+	<member name="wcte12xp" displayname="Digium Wildcard TE120P" remove_on_change="wcte12xp.o wcte12xp.ko">
 	</member>
-	<member name="xpp_usb" displayname="Xorcom Astribank">
+	<member name="wcusb" displayname="Digium S100U" remove_on_change="wcusb.o wcusb.ko">
+	</member>
+	<member name="xpp" displayname="Xorcom Astribank">
 	</member>
 	<member name="ztd-eth" displayname="TDM-over-Ethernet Virtual Span" remove_on_change="ztd-eth.o ztd-eth.ko">
 		<depend>ztdynamic</depend>

Modified: branches/1.4/zttranscode.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zttranscode.c?view=diff&rev=2215&r1=2214&r2=2215
==============================================================================
--- branches/1.4/zttranscode.c (original)
+++ branches/1.4/zttranscode.c Fri Feb 23 17:57:10 2007
@@ -3,7 +3,7 @@
  *
  * Written by Mark Spencer <markster at digium.com>
  *
- * Copyright (C) 2006, Digium, Inc.
+ * Copyright (C) 2006-2007, Digium, Inc.
  *
  * All rights reserved.
  *
@@ -42,7 +42,7 @@
 #ifdef STANDALONE_ZAPATA
 #include "zaptel.h"
 #else
-#include <zaptel/zaptel.h>
+#include <linux/zaptel.h>
 #endif
 #ifdef LINUX26
 #include <linux/moduleparam.h>
@@ -74,6 +74,8 @@
 		init_waitqueue_head(&ztc->channels[x].ready);
 		ztc->channels[x].parent = ztc;
 		ztc->channels[x].offset = x;
+		ztc->channels[x].chan_built = 0;
+		ztc->channels[x].built_fmts = 0;
 	}
 
 	return ztc;
@@ -207,15 +209,18 @@
 	if (!ztc)
 		return;
 
-	for (page = virt_to_page(zth);
-	     page < virt_to_page((unsigned long) zth + sizeof(*zth));
-	     page++)
-		ClearPageReserved(page);
-
 	ztc->flags &= ~(ZT_TC_FLAG_BUSY);
-	if (ztc->tch)
+
+	if(ztc->tch) {
+		for (page = virt_to_page(zth);
+		     page < virt_to_page((unsigned long) zth + sizeof(*zth));
+		     page++)
+			ClearPageReserved(page);
 		kfree(ztc->tch);
+	}
+
 	ztc->tch = NULL;
+	/* Actually reset the transcoder channel */
 	if (ztc->flags & ZT_TC_FLAG_TRANSIENT)
 		kfree(ztc);
 	if (debug)
@@ -252,6 +257,8 @@
 			for (x = 0; x < tc->numchannels; x++) {
 				if (tc->channels[x].flags & ZT_TC_FLAG_BUSY)
 					continue;
+				if ((tc->channels[x].chan_built) && ((zth->srcfmt | zth->dstfmt) != tc->channels[x].built_fmts))
+					continue;
 
 				newztc = &tc->channels[x];
 				newztc->flags = ZT_TC_FLAG_BUSY;
@@ -274,7 +281,7 @@
 
 	/* Actually reset the transcoder channel */
 	if ((*ztc)->parent && ((*ztc)->parent->operation))
-		return (*ztc)->parent->operation((*ztc), ZT_TCOP_RESET);
+		return (*ztc)->parent->operation((*ztc), ZT_TCOP_ALLOCATE);
 
 	return -EINVAL;
 }
@@ -308,6 +315,7 @@
 		return -ENOSYS;
 
 	strncpy(info.name, tc->name, sizeof(info.name) - 1);
+	info.numchannels = tc->numchannels;
 	info.srcfmts = tc->srcfmts;
 	info.dstfmts = tc->dstfmts;
 
@@ -333,10 +341,16 @@
 	case ZT_TCOP_GETINFO:
 		ret = zt_tc_getinfo(data);
 		break;
-	case ZT_TCOP_RESET:
+	case ZT_TCOP_ALLOCATE:
 		/* Reset transcoder, possibly changing who we point to */
 		ret = do_reset(&ztc);
 		file->private_data = ztc;
+		break;
+	case ZT_TCOP_RELEASE:
+		ret = ztc->parent->operation(ztc, ZT_TCOP_RELEASE);
+		break;
+	case ZT_TCOP_TEST:
+		ret = ztc->parent->operation(ztc, ZT_TCOP_TEST);
 		break;
 	case ZT_TCOP_TRANSCODE:
 		if (!ztc->parent->operation)
@@ -449,7 +463,7 @@
 }
 
 #ifdef LINUX26
-module_param(debug, int, 0600);
+module_param(debug, int, S_IRUGO | S_IWUSR);
 #else
 MODULE_PARM(debug, "i");
 #endif



More information about the zaptel-commits mailing list