[svn-commits] kpfleming: branch 1.2 r2076 - in /branches/1.2: ./
build_tools/ hpec/ wct4xxp...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Jan 31 17:55:42 MST 2007
Author: kpfleming
Date: Wed Jan 31 18:55:41 2007
New Revision: 2076
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2076
Log:
add support for Digium's High Performance Echo Canceller
rework the top-level Makefile so kernel 2.6 modules are built by a dedicated Makefile
Added:
branches/1.2/Makefile.kernel26
- copied unchanged from r2075, betas/1.2-hpec/Makefile.kernel26
branches/1.2/hpec/ (props changed)
- copied from r2075, betas/1.2-hpec/hpec/
branches/1.2/hpec/hpec.h
- copied unchanged from r2075, betas/1.2-hpec/hpec/hpec.h
branches/1.2/hpec/hpec_user.h
- copied unchanged from r2075, betas/1.2-hpec/hpec/hpec_user.h
branches/1.2/hpec/hpec_zaptel.h
- copied unchanged from r2075, betas/1.2-hpec/hpec/hpec_zaptel.h
branches/1.2/wct4xxp/Makefile.kernel26
- copied unchanged from r2075, betas/1.2-hpec/wct4xxp/Makefile.kernel26
branches/1.2/wctc4xxp/Makefile.kernel26
- copied unchanged from r2074, branches/1.2/wctc4xxp/Kbuild
branches/1.2/zaptel-base.c
- copied unchanged from r2075, betas/1.2-hpec/zaptel-base.c
Removed:
branches/1.2/wct4xxp/Kbuild
branches/1.2/wctc4xxp/Kbuild
branches/1.2/zaptel.c
Modified:
branches/1.2/Makefile
branches/1.2/build_tools/make_svn_branch_name
branches/1.2/kb1ec.h
branches/1.2/mec.h
branches/1.2/mec2.h
branches/1.2/mec3.h
branches/1.2/mg2ec.h
branches/1.2/sec-2.h
branches/1.2/sec.h
branches/1.2/tor2.c
branches/1.2/wct1xxp.c
branches/1.2/wct4xxp/Makefile
branches/1.2/wctc4xxp/Makefile
branches/1.2/zaptel.h
branches/1.2/zconfig.h
Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Wed Jan 31 18:55:41 2007
@@ -1,15 +1,17 @@
#
# Makefile for Zaptel driver modules and utilities
#
-# Copyright (C) 2001-2006 Digium, Inc.
-#
-#
-
-
-HOSTCC=gcc
+# Copyright (C) 2001-2007 Digium, Inc.
+#
+#
+
+CFLAGS+=-DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
+
+ifeq ($(MAKELEVEL),0)
PWD:=$(shell pwd)
-
-INSTALL_PREFIX:=$(DESTDIR)
+endif
+
+ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
# If you want to build for a kernel other than the current kernel, set KVERS
ifndef KVERS
@@ -25,7 +27,69 @@
endif
KINCLUDES:=$(KSRC)/include
-CFLAGS+=-I. -O4 -g -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
+ifeq (2.6,$(shell echo $(KVERS) | cut -d. -f1-2))
+ BUILDVER:=linux26
+else
+ BUILDVER:=linux24
+endif
+
+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
+
+# Set this to override hotplug firmware loading and revert to embedded firmware
+HOTPLUG_FIRMWARE?=yes
+
+ifeq ($(HOTPLUG_FIRMWARE),yes)
+ CFLAGS+=-DHOTPLUG_FIRMWARE
+endif
+
+MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
+ ztdynamic ztd-eth wct1xxp wcte11xp pciradio \
+ ztd-loc # ztdummy
+#MODULES+=wcfxsusb
+ifeq ($(BUILDVER),linux26)
+MODULES+=ztdummy zttranscode
+endif
+MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
+
+MODULESO:=$(MODULES:%=%.o)
+MODULESKO:=$(MODULES:%=%.ko)
+
+# add this later, so it doesn't become part of MODULESO/MODULESKO
+MODULES+=wct4xxp wctc4xxp
+
+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
+
+#NOTE NOTE NOTE
+#
+# all variables set before the include of Kbuild are needed by the 2.6 kernel module build process
+
+ifneq ($(KBUILD_EXTMOD),)
+
+include $(src)/Makefile.kernel26
+
+else
+
+HOSTCC=gcc
+
+INSTALL_PREFIX:=$(DESTDIR)
+
+CFLAGS+=-I. -O4 -g -Wall
CFLAGS_PPC:=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
CFLAGS_X86-64:=$(shell if uname -m | grep -q x86_64; then echo "-m64"; fi)
CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_X86-64)
@@ -45,32 +109,17 @@
#
KFLAGS+=-DSTANDALONE_ZAPATA
-CFLAGS+=-DSTANDALONE_ZAPATA
KMAKE:= $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
KMAKE_INST:= $(KMAKE) INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
CONFIG_FILE:=$(INSTALL_PREFIX)/etc/zaptel.conf
CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\"
-
-ifeq (2.6,$(shell echo $(KVERS) | cut -d. -f1-2))
- BUILDVER:=linux26
-else
- BUILDVER:=linux24
-endif
ifeq ($(BUILDVER),linux24)
#We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
DYNFS:=$(shell ps ax | grep -v grep | grep -q devfsd && echo "yes")
endif
-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
-
CHKCONFIG:=$(shell sh -c 'type -p chkconfig' 2> /dev/null)
ifndef CHKCONFIG
CHKCONFIG:=:
@@ -80,22 +129,8 @@
ZAPTELVERSION:=$(shell cat .version)
endif
-# Set this to override hotplug firmware loading and revert to classic header based
-#HOTPLUG_FIRMWARE=no
-
-ifeq ($(HOTPLUG_FIRMWARE),yes)
- CFLAGS+=-DHOTPLUG_FIRMWARE
-endif
-
-# CVS mirrors of SVN have .svnrevision files showing
-# which SVN revision they are based on, and .svnbranch
-# showing the branch they are made from
-ifneq ($(wildcard .svnrevision),)
- ZAPTELVERSION:=SVN-$(shell cat .svnbranch)-r$(shell cat .svnrevision)
-else
- ifneq ($(wildcard .svn),)
- ZAPTELVERSION=SVN-$(shell build_tools/make_svn_branch_name)
- endif
+ifneq ($(wildcard .svn),)
+ ZAPTELVERSION=SVN-$(shell build_tools/make_svn_branch_name)
endif
TZOBJS:=zonedata.lo tonezone.lo
@@ -103,53 +138,42 @@
LIBTONEZONE_SO_MAJOR_VER:=1
LIBTONEZONE_SO_MINOR_VER:=0
-MODULES:=zaptel tor2 torisa wcusb wcfxo wctdm wctdm24xxp \
- ztdynamic ztd-eth wct1xxp wcte11xp pciradio \
- ztd-loc # ztdummy
-#MODULES+=wcfxsusb
+MOD_DESTDIR:=zaptel
+
+BINS=ztcfg torisatool makefw ztmonitor ztspeed zttest fxotune
+ifneq (,$(wildcard /usr/include/newt.h))
+BINS+=zttool
+endif
+
+ifeq ($(BUILDVER),linux24)
+all: prereq $(MODULESO) wct4xxp/wct4xxp.o $(BINS) $(LIBTONEZONE_SO)
+endif
+
ifeq ($(BUILDVER),linux26)
-MODULES+=ztdummy zttranscode
-endif
-MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp
-
-MODULESO:=$(MODULES:%=%.o)
-MODULESKO:=$(MODULES:%=%.ko)
-
-MOD_DESTDIR:=zaptel
-
-obj-m:=$(MODULESO)
-obj-m+=wct4xxp/ wctc4xxp/
-MODULES+=wct4xxp wctc4xxp
-
-# Also build xpp in the subdirectory xpp/ . But only for >=2.6.10 and only
-# for i386. On other archs the module will probably build but panic.
-# This line is only meaningful when this Makefile is used as kconfig for
-# 2.6 build
-
-ifneq (,$(shell [ 0$(SUBLEVEL) -ge 8 ] && echo 1))
-obj-m+=xpp/
-endif
-
-ifneq (,$(wildcard /usr/include/newt.h))
-ZTTOOL:=zttool
-endif
-BINS=ztcfg torisatool makefw ztmonitor ztspeed $(ZTTOOL) zttest fxotune
-
-all: $(BUILDVER) $(LIBTONEZONE_SO)
-
-linux24: prereq $(MODULESO) wct4xxp/wct4xxp.o $(BINS)
-
-linux26: prereq $(BINS)
- @echo $(KSRC)
+all: prereq $(BINS) $(LIBTONEZONE_SO)
@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
+endif
+
+ifeq ($(HPEC_PRESENT),yes)
+ifeq ($(ARCH),i386)
+ZAPTEL_HPEC:=hpec/hpec_x86_32.o_shipped
+endif
+
+ifeq ($(ARCH),x86_64)
+ZAPTEL_HPEC:=hpec/hpec_x86_64.o_shipped
+endif
+
+CFLAGS+=-DECHO_CAN_HPEC -I$(PWD)/hpec
+zaptel-base.o: hpec/hpec_zaptel.h hpec/hpec_user.h
+endif
version.h: FORCE
- ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp
- if cmp -s $@.tmp $@ ; then echo; else \
+ @ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp
+ @if cmp -s $@.tmp $@ ; then echo; else \
mv $@.tmp $@ ; \
fi
- rm -f $@.tmp
+ @rm -f $@.tmp
wct4xxp/wct4xxp.o:
$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."
@@ -159,9 +183,11 @@
tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest
$(MAKE) -C wctc4xxp tests CFLAGS="$(CFLAGS) -I.."
+$(MODULESO): zaptel.h
+
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 version.h
+zaptel-base.o: digits.h arith.h sec.h sec-2.h mec.h mec2.h mec3.h mg2ec.h kb1ec.h zconfig.h version.h tones.h
torisa.o: torisa.h
@@ -177,7 +203,10 @@
ztdummy.o: ztdummy.h
-$(MODULESO): %.o: %.c zaptel.h
+zaptel.o: zaptel-base.o $(ZAPTEL_HPEC)
+ $(LD) -r -o $@ $< $(ZAPTEL_HPEC)
+
+$(filter-out zaptel.o,$(MODULESO)) zaptel-base.o: %.o: %.c
$(CC) $(KFLAGS) -o $@ -c $<
tor2ee.o: tor2-hw.h
@@ -205,8 +234,6 @@
gendigits: gendigits.o
$(CC) -o $@ $^ -lm
-
-zaptel.c: tones.h
prereq: tones.h tor2fw.h radfw.h version.h
@@ -428,3 +455,6 @@
rm -rf mISDNuser*
FORCE:
+
+endif
+
Modified: branches/1.2/build_tools/make_svn_branch_name
URL: http://svn.digium.com/view/zaptel/branches/1.2/build_tools/make_svn_branch_name?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/build_tools/make_svn_branch_name (original)
+++ branches/1.2/build_tools/make_svn_branch_name Wed Jan 31 18:55:41 2007
@@ -1,6 +1,7 @@
#!/bin/sh
PARTS=`LANG=C svn info | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/zaptel/:: | sed -e 's:/: :g'`
+BETA=0
BRANCH=0
TEAM=0
@@ -14,6 +15,12 @@
for PART in $PARTS
do
+ if [ ${BETA} != 0 ]
+ then
+ RESULT="${RESULT}-${PART}"
+ break
+ fi
+
if [ ${BRANCH} != 0 ]
then
RESULT="${RESULT}-${PART}"
@@ -23,6 +30,13 @@
if [ ${TEAM} != 0 ]
then
RESULT="${RESULT}-${PART}"
+ continue
+ fi
+
+ if [ "${PART}" = "betas" ]
+ then
+ BETA=1
+ RESULT="beta"
continue
fi
Propchange: branches/1.2/hpec/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 31 18:55:41 2007
@@ -1,0 +1,1 @@
+*.o_shipped
Modified: branches/1.2/kb1ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/kb1ec.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/kb1ec.h (original)
+++ branches/1.2/kb1ec.h Wed Jan 31 18:55:41 2007
@@ -74,7 +74,7 @@
} echo_can_cb_s;
/* Echo canceller definition */
-typedef struct {
+struct echo_can_state {
/* an arbitrary ID for this echo can - this really should be settable from the calling channel... */
int id;
@@ -139,7 +139,16 @@
int avg_Lu_i_ok;
#endif
-} echo_can_state_t;
+};
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: KB1%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
{
@@ -167,13 +176,13 @@
return cb->buf_d[cb->idx_d + pos];
}
-static inline void init_cc(echo_can_state_t *ec, int N, int maxy, int maxu)
+static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu)
{
void *ptr = ec;
unsigned long tmp;
/* Double-word align past end of state */
- ptr += sizeof(echo_can_state_t);
+ ptr += sizeof(struct echo_can_state);
tmp = (unsigned long)ptr;
tmp += 3;
tmp &= ~3L;
@@ -232,12 +241,12 @@
}
-static inline void echo_can_free(echo_can_state_t *ec)
+static inline void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
-static inline short echo_can_update(echo_can_state_t *ec, short iref, short isig)
+static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig)
{
/* Declare local variables that are used more than once */
@@ -515,9 +524,9 @@
return u;
}
-static inline echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
int maxy;
int maxu;
maxy = len + DEFAULT_M;
@@ -528,7 +537,7 @@
maxy = (1 << DEFAULT_SIGMA_LY_I);
if (maxu < (1 << DEFAULT_SIGMA_LU_I))
maxu = (1 << DEFAULT_SIGMA_LU_I);
- ec = (echo_can_state_t *)MALLOC(sizeof(echo_can_state_t) +
+ ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -537,7 +546,7 @@
2 * sizeof(short) * (maxu) + /* u_s */
2 * sizeof(short) * len); /* y_tilde_s */
if (ec) {
- memset(ec, 0, sizeof(echo_can_state_t) +
+ memset(ec, 0, sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -550,7 +559,7 @@
return ec;
}
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Set the hangover counter to the length of the can to
* avoid adjustments occuring immediately after initial forced training
Modified: branches/1.2/mec.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/mec.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/mec.h (original)
+++ branches/1.2/mec.h Wed Jan 31 18:55:41 2007
@@ -53,7 +53,7 @@
#define HANG_T 600 /* 600 samples, or 75ms */
-typedef struct mark_ec {
+struct echo_can_state {
/* Circular position */
int cpos;
short y[NUM_TAPS]; /* Last N samples (relative to cpos) transmitted */
@@ -80,7 +80,7 @@
int lastmax; /* Optimize maximum search */
int maxTy; /* Maximum Ty */
-} echo_can_state_t;
+};
#define INLINE inline
@@ -98,11 +98,20 @@
#define FREE(a) free(a)
#endif
-static INLINE echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: MARK%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
+
+static INLINE struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
/* Uhm, we're only one length, sorry. */
- ec = MALLOC(sizeof(echo_can_state_t));
+ ec = MALLOC(sizeof(struct echo_can_state));
if (ec)
memset(ec, 0, sizeof(*ec));
return ec;
@@ -111,12 +120,12 @@
#define PASSPOS 32000
#undef PASSPOS
-static INLINE void echo_can_free(echo_can_state_t *ec)
+static INLINE void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
-static INLINE int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+static INLINE int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
{
/* Process a sample, where tx is the near end and rx is the far end + echo */
@@ -292,7 +301,7 @@
return suppr;
}
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
Modified: branches/1.2/mec2.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/mec2.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/mec2.h (original)
+++ branches/1.2/mec2.h Wed Jan 31 18:55:41 2007
@@ -51,7 +51,7 @@
// class definition
//
-typedef struct {
+struct echo_can_state {
/* Echo canceller definition */
/* absolute time */
@@ -86,7 +86,16 @@
short max_y_tilde;
int max_y_tilde_pos;
-} echo_can_state_t;
+};
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: MARK2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
{
@@ -112,12 +121,12 @@
return cb->buf_d[cb->idx_d + pos];
}
-static inline void init_cc(echo_can_state_t *ec, int N, int maxy, int maxu) {
+static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu) {
void *ptr = ec;
unsigned long tmp;
/* double-word align past end of state */
- ptr += sizeof(echo_can_state_t);
+ ptr += sizeof(struct echo_can_state);
tmp = (unsigned long)ptr;
tmp += 3;
tmp &= ~3L;
@@ -170,12 +179,12 @@
//
}
-static inline void echo_can_free(echo_can_state_t *ec)
+static inline void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
-static inline short echo_can_update(echo_can_state_t *ec, short iref, short isig) {
+static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) {
/* declare local variables that are used more than once
*/
@@ -370,9 +379,9 @@
return u;
}
-static inline echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
int maxy;
int maxu;
maxy = len + DEFAULT_M;
@@ -383,7 +392,7 @@
maxy = (1 << DEFAULT_SIGMA_LY_I);
if (maxu < (1 << DEFAULT_SIGMA_LU_I))
maxu = (1 << DEFAULT_SIGMA_LU_I);
- ec = (echo_can_state_t *)MALLOC(sizeof(echo_can_state_t) +
+ ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -392,7 +401,7 @@
2 * sizeof(short) * (maxu) + /* u_s */
2 * sizeof(short) * len); /* y_tilde_s */
if (ec) {
- memset(ec, 0, sizeof(echo_can_state_t) +
+ memset(ec, 0, sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -405,7 +414,7 @@
return ec;
}
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
Modified: branches/1.2/mec3.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/mec3.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/mec3.h (original)
+++ branches/1.2/mec3.h Wed Jan 31 18:55:41 2007
@@ -69,7 +69,7 @@
int maxexp;
} cbuf_s;
-typedef struct {
+struct echo_can_state {
short a_s[NTAPS]; /* Coefficients in shorts */
int a_i[NTAPS]; /* Coefficients in ints*/
#ifdef DO_BACKUP
@@ -85,9 +85,18 @@
int hcntr; /* Hangtime counter */
int pos; /* Position in curcular buffers */
int backup; /* Backup timer */
-} echo_can_state_t;
-
-static inline void echo_can_free(echo_can_state_t *ec)
+};
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: MARK3%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
+
+static inline void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
@@ -114,7 +123,7 @@
}
}
-static inline short echo_can_update(echo_can_state_t *ec, short ref, short sig)
+static inline short echo_can_update(struct echo_can_state *ec, short ref, short sig)
{
int x;
short u;
@@ -204,15 +213,15 @@
return u;
}
-static inline echo_can_state_t *echo_can_create(int taps, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int taps, int adaption_mode)
+{
+ struct echo_can_state *ec;
int x;
taps = NTAPS;
- ec = MALLOC(sizeof(echo_can_state_t));
+ ec = MALLOC(sizeof(struct echo_can_state));
if (ec) {
- memset(ec, 0, sizeof(echo_can_state_t));
+ memset(ec, 0, sizeof(struct echo_can_state));
ec->taps = taps;
ec->pos = ec->taps-1;
for (x=0;x<31;x++) {
@@ -225,7 +234,7 @@
return ec;
}
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
Modified: branches/1.2/mg2ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/mg2ec.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/mg2ec.h (original)
+++ branches/1.2/mg2ec.h Wed Jan 31 18:55:41 2007
@@ -76,7 +76,7 @@
} echo_can_cb_s;
/* Echo canceller definition */
-typedef struct {
+struct echo_can_state {
/* an arbitrary ID for this echo can - this really should be settable from the calling channel... */
int id;
@@ -143,7 +143,16 @@
short lastsig[256];
int lastpos;
-} echo_can_state_t;
+};
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: MG2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
{
@@ -171,13 +180,13 @@
return cb->buf_d[cb->idx_d + pos];
}
-static inline void init_cc(echo_can_state_t *ec, int N, int maxy, int maxu)
+static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu)
{
void *ptr = ec;
unsigned long tmp;
/* Double-word align past end of state */
- ptr += sizeof(echo_can_state_t);
+ ptr += sizeof(struct echo_can_state);
tmp = (unsigned long)ptr;
tmp += 3;
tmp &= ~3L;
@@ -236,12 +245,12 @@
}
-static inline void echo_can_free(echo_can_state_t *ec)
+static inline void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
-static inline short echo_can_update(echo_can_state_t *ec, short iref, short isig)
+static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig)
{
/* Declare local variables that are used more than once */
@@ -556,9 +565,9 @@
return u;
}
-static inline echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
int maxy;
int maxu;
maxy = len + DEFAULT_M;
@@ -569,7 +578,7 @@
maxy = (1 << DEFAULT_SIGMA_LY_I);
if (maxu < (1 << DEFAULT_SIGMA_LU_I))
maxu = (1 << DEFAULT_SIGMA_LU_I);
- ec = (echo_can_state_t *)MALLOC(sizeof(echo_can_state_t) +
+ ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -578,7 +587,7 @@
2 * sizeof(short) * (maxu) + /* u_s */
2 * sizeof(short) * len); /* y_tilde_s */
if (ec) {
- memset(ec, 0, sizeof(echo_can_state_t) +
+ memset(ec, 0, sizeof(struct echo_can_state) +
4 + /* align */
sizeof(int) * len + /* a_i */
sizeof(short) * len + /* a_s */
@@ -591,7 +600,7 @@
return ec;
}
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Set the hangover counter to the length of the can to
* avoid adjustments occuring immediately after initial forced training
Modified: branches/1.2/sec-2.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/sec-2.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/sec-2.h (original)
+++ branches/1.2/sec-2.h Wed Jan 31 18:55:41 2007
@@ -67,7 +67,7 @@
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
-typedef struct
+struct echo_can_state
{
int tx_power;
int rx_power;
@@ -95,11 +95,20 @@
int32_t latest_correction; /* Indication of the magnitude of the latest
adaption, or a code to indicate why adaption
was skipped, for test purposes */
-} echo_can_state_t;
-
-static echo_can_state_t *echo_can_create(int len, int adaption_mode);
-static void echo_can_free(echo_can_state_t *ec);
-static int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
+};
+
+static struct echo_can_state *echo_can_create(int len, int adaption_mode);
+static void echo_can_free(struct echo_can_state *ec);
+static int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx);
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: STEVE2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
/*
* According to Jim...
@@ -113,12 +122,12 @@
/* #define MIN_TX_POWER_FOR_ADAPTION 4096
#define MIN_RX_POWER_FOR_ADAPTION 64 */
-static inline echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
void *ptr;
- ptr = ec = (echo_can_state_t *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
+ ptr = ec = (struct echo_can_state *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
len * sizeof(int16_t));
if (ec == NULL)
return NULL;
@@ -139,14 +148,14 @@
}
/*- End of function --------------------------------------------------------*/
-static inline void echo_can_free(echo_can_state_t *ec)
+static inline void echo_can_free(struct echo_can_state *ec)
{
fir16_free(&ec->fir_state);
FREE(ec);
}
/*- End of function --------------------------------------------------------*/
-static inline int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
{
int offset1;
int offset2;
@@ -278,7 +287,7 @@
}
#if 0
-static inline int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
{
int offset;
int limit;
@@ -412,7 +421,7 @@
/*- End of function --------------------------------------------------------*/
#endif
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
Modified: branches/1.2/sec.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/sec.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/sec.h (original)
+++ branches/1.2/sec.h Wed Jan 31 18:55:41 2007
@@ -70,7 +70,7 @@
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
-typedef struct
+struct echo_can_state
{
int tx_power;
int rx_power;
@@ -98,11 +98,20 @@
int32_t latest_correction; /* Indication of the magnitude of the latest
adaption, or a code to indicate why adaption
was skipped, for test purposes */
-} echo_can_state_t;
-
-static echo_can_state_t *echo_can_create(int len, int adaption_mode);
-static void echo_can_free(echo_can_state_t *ec);
-static int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
+};
+
+static void echo_can_init(void)
+{
+ printk("Zaptel Echo Canceller: STEVE%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_shutdown(void)
+{
+}
+
+static struct echo_can_state *echo_can_create(int len, int adaption_mode);
+static void echo_can_free(struct echo_can_state *ec);
+static int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx);
/* Original parameters :
#define MIN_TX_POWER_FOR_ADAPTION 256
@@ -117,12 +126,12 @@
#define MIN_RX_POWER_FOR_ADAPTION 64
*/
-static inline echo_can_state_t *echo_can_create(int len, int adaption_mode)
-{
- echo_can_state_t *ec;
+static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
+{
+ struct echo_can_state *ec;
void *ptr;
- ptr = ec = (echo_can_state_t *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
+ ptr = ec = (struct echo_can_state *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
len * 3 * sizeof(int16_t));
if (ec == NULL)
return NULL;
@@ -141,13 +150,13 @@
}
/*- End of function --------------------------------------------------------*/
-static inline void echo_can_free(echo_can_state_t *ec)
+static inline void echo_can_free(struct echo_can_state *ec)
{
FREE(ec);
}
/*- End of function --------------------------------------------------------*/
-static inline int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
{
int32_t echo_value;
int clean_rx;
@@ -268,7 +277,7 @@
}
/*- End of function --------------------------------------------------------*/
-static inline int echo_can_traintap(echo_can_state_t *ec, int pos, short val)
+static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
Modified: branches/1.2/tor2.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/tor2.c?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/tor2.c (original)
+++ branches/1.2/tor2.c Wed Jan 31 18:55:41 2007
@@ -23,8 +23,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
*/
#include <linux/kernel.h>
Modified: branches/1.2/wct1xxp.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct1xxp.c?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/wct1xxp.c (original)
+++ branches/1.2/wct1xxp.c Wed Jan 31 18:55:41 2007
@@ -22,8 +22,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
*/
#include <linux/kernel.h>
Modified: branches/1.2/wct4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/wct4xxp/Makefile?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/wct4xxp/Makefile (original)
+++ branches/1.2/wct4xxp/Makefile Wed Jan 31 18:55:41 2007
@@ -1,6 +1,6 @@
ifneq ($(KBUILD_EXTMOD),)
-include $(obj)/Kbuild
+include $(src)/Makefile.kernel26
else
Modified: branches/1.2/wctc4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctc4xxp/Makefile?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/wctc4xxp/Makefile (original)
+++ branches/1.2/wctc4xxp/Makefile Wed Jan 31 18:55:41 2007
@@ -1,6 +1,6 @@
ifneq ($(KBUILD_EXTMOD),)
-include $(obj)/Kbuild
+include $(obj)/Makefile.kernel26
endif
Modified: branches/1.2/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/zaptel.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/zaptel.h (original)
+++ branches/1.2/zaptel.h Wed Jan 31 18:55:41 2007
@@ -23,8 +23,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
*/
#ifndef _LINUX_ZAPTEL_H
@@ -170,38 +168,6 @@
#define ZT_POLICY_WHEN_FULL 1 /* Start play/record when buffer is full */
#define RING_DEBOUNCE_TIME 2000 /* 2000 ms ring debounce time */
-
-#ifdef AGGRESSIVE_SUPPRESSOR
-#define ZAPTEL_ECHO_AGGRESSIVE " (aggressive)"
-#else
-#define ZAPTEL_ECHO_AGGRESSIVE
-#endif
-
-#ifdef __KERNEL__
-/* Echo cancellation */
-#if defined(ECHO_CAN_STEVE)
-#define ZAPTEL_ECHO_CANCELLER "STEVE"
-#include "sec.h"
-#elif defined(ECHO_CAN_STEVE2)
-#define ZAPTEL_ECHO_CANCELLER "STEVE2"
-#include "sec-2.h"
-#elif defined(ECHO_CAN_MARK)
-#define ZAPTEL_ECHO_CANCELLER "MARK"
-#include "mec.h"
-#elif defined(ECHO_CAN_MARK2)
-#define ZAPTEL_ECHO_CANCELLER "MARK2"
-#include "mec2.h"
-#elif defined(ECHO_CAN_KB1)
-#define ZAPTEL_ECHO_CANCELLER "KB1"
-#include "kb1ec.h"
-#elif defined(ECHO_CAN_MG2)
-#define ZAPTEL_ECHO_CANCELLER "MG2"
-#include "mg2ec.h"
-#else
-#define ZAPTEL_ECHO_CANCELLER "MARK3"
-#include "mec3.h"
-#endif
-#endif
#define ZT_GET_PARAMS_RETURN_MASTER 0x40000000
@@ -1021,8 +987,20 @@
#endif
struct zt_chan *chan;
};
-
#endif /* CONFIG_ZAPATA_NET */
+
+/* Echo cancellation */
+struct echo_can_state;
+#if 0
+/* echo can API consists of these functions */
+void echo_can_init(void);
+void echo_chan_shutdown(void);
+struct echo_can_state *echo_can_create(int len, int adaption_mode);
+void echo_can_free(struct echo_can_state *ec);
+short echo_can_update(struct echo_can_state *ec, short iref, short isig);
+void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig);
+int echo_can_traintap(struct echo_can_state *ec, int pos, short val);
+#endif
/* Conference queue stucture */
struct confq {
@@ -1187,7 +1165,7 @@
/* Is echo cancellation enabled or disabled */
int echocancel;
- echo_can_state_t *ec;
+ struct echo_can_state *ec;
echo_can_disable_detector_state_t txecdis;
echo_can_disable_detector_state_t rxecdis;
Modified: branches/1.2/zconfig.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/zconfig.h?view=diff&rev=2076&r1=2075&r2=2076
==============================================================================
--- branches/1.2/zconfig.h (original)
+++ branches/1.2/zconfig.h Wed Jan 31 18:55:41 2007
@@ -45,7 +45,7 @@
/* #define CONFIG_ZAPTEL_MMX */
/*
- * Pick your echo canceller: MARK2, MARK3, STEVE, or STEVE2 :)
+ * Pick your echo canceller.
*
*/
/* #define ECHO_CAN_STEVE */
More information about the svn-commits
mailing list