[svn-commits] kpfleming: branch 1.4 r2333 - in /branches/1.4: ./ hpec/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Mar 22 18:41:31 MST 2007


Author: kpfleming
Date: Thu Mar 22 20:41:31 2007
New Revision: 2333

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2333
Log:
bring in the rest of the support needed for HPEC

Modified:
    branches/1.4/hpec/hpec_zaptel.h
    branches/1.4/kb1ec.h
    branches/1.4/mec.h
    branches/1.4/mec2.h
    branches/1.4/mec3.h
    branches/1.4/mg2ec.h
    branches/1.4/sec-2.h
    branches/1.4/sec.h
    branches/1.4/zaptel-base.c
    branches/1.4/zaptel.h

Modified: branches/1.4/hpec/hpec_zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/hpec/hpec_zaptel.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/hpec/hpec_zaptel.h (original)
+++ branches/1.4/hpec/hpec_zaptel.h Thu Mar 22 20:41:31 2007
@@ -63,6 +63,11 @@
 {
 	printk("Zaptel Echo Canceller: Digium High-Performance Echo Canceller\n");
 	hpec_init(logger, debug, ZT_CHUNKSIZE, memalloc, memfree);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "HPEC", len);
 }
 
 static void echo_can_shutdown(void)

Modified: branches/1.4/kb1ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/kb1ec.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/kb1ec.h (original)
+++ branches/1.4/kb1ec.h Thu Mar 22 20:41:31 2007
@@ -140,6 +140,20 @@
 #endif 
 
 };
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: KB1%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "KB1", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
 {

Modified: branches/1.4/mec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mec.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/mec.h (original)
+++ branches/1.4/mec.h Thu Mar 22 20:41:31 2007
@@ -97,6 +97,20 @@
 #define MALLOC(a) malloc(a)
 #define FREE(a) free(a)
 #endif
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: MARK%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "MARK2", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 static INLINE struct echo_can_state *echo_can_create(int len, int adaption_mode)
 {

Modified: branches/1.4/mec2.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mec2.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/mec2.h (original)
+++ branches/1.4/mec2.h Thu Mar 22 20:41:31 2007
@@ -51,7 +51,7 @@
 
 // class definition
 //
-struct echo_can_state {
+struct echo_can_state { 
   /* Echo canceller definition */
 
   /* absolute time */
@@ -87,6 +87,20 @@
   int max_y_tilde_pos;
 
 };
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: MARK2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "MARK2", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
 {

Modified: branches/1.4/mec3.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mec3.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/mec3.h (original)
+++ branches/1.4/mec3.h Thu Mar 22 20:41:31 2007
@@ -86,6 +86,20 @@
 	int pos;						/* Position in curcular buffers */
 	int backup;						/* Backup timer */
 };
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: MARK3%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "MARK3", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 static inline void echo_can_free(struct echo_can_state *ec)
 {

Modified: branches/1.4/mg2ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mg2ec.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/mg2ec.h (original)
+++ branches/1.4/mg2ec.h Thu Mar 22 20:41:31 2007
@@ -166,6 +166,20 @@
 #endif
 
 };
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: MG2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "MG2", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where)
 {

Modified: branches/1.4/sec-2.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/sec-2.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/sec-2.h (original)
+++ branches/1.4/sec-2.h Thu Mar 22 20:41:31 2007
@@ -100,6 +100,20 @@
 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_identify(char *buf, size_t len)
+{
+	strncpy(buf, "STEVE2", len);
+}
+
+static void echo_can_shutdown(void)
+{
+}
 
 /*
  * According to Jim...

Modified: branches/1.4/sec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/sec.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/sec.h (original)
+++ branches/1.4/sec.h Thu Mar 22 20:41:31 2007
@@ -99,6 +99,20 @@
     				   adaption, or a code to indicate why adaption
 				   was skipped, for test purposes */
 };
+
+static void echo_can_init(void)
+{
+	printk("Zaptel Echo Canceller: STEVE%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+}
+
+static void echo_can_identify(char *buf, size_t len)
+{
+	strncpy(buf, "STEVE", len);
+}
+
+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);

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Thu Mar 22 20:41:31 2007
@@ -89,38 +89,6 @@
 #include <linux/moduleparam.h>
 #endif
 
-#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
-
 /* Get helper arithmetic */
 #include "arith.h"
 #if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP)
@@ -436,6 +404,31 @@
 
 #define NUM_SIGS	10	
 
+
+#ifdef AGGRESSIVE_SUPPRESSOR
+#define ZAPTEL_ECHO_AGGRESSIVE " (aggressive)"
+#else
+#define ZAPTEL_ECHO_AGGRESSIVE ""
+#endif
+
+/* Echo cancellation */
+#if defined(ECHO_CAN_HPEC)
+#include "hpec/hpec_zaptel.h"
+#elif defined(ECHO_CAN_STEVE)
+#include "sec.h"
+#elif defined(ECHO_CAN_STEVE2)
+#include "sec-2.h"
+#elif defined(ECHO_CAN_MARK)
+#include "mec.h"
+#elif defined(ECHO_CAN_MARK2)
+#include "mec2.h"
+#elif defined(ECHO_CAN_KB1)
+#include "kb1ec.h"
+#elif defined(ECHO_CAN_MG2)
+#include "mg2ec.h"
+#else
+#include "mec3.h"
+#endif
 
 static inline void rotate_sums(void)
 {
@@ -3576,11 +3569,11 @@
 	case ZT_GETVERSION:
 		memset(&vi, 0, sizeof(vi));
 		strncpy(vi.version, ZAPTEL_VERSION, sizeof(vi.version) - 1);
-		strncpy(vi.echo_canceller, ZAPTEL_ECHO_CANCELLER, sizeof(vi.echo_canceller) - 1);
+		echo_can_identify(vi.echo_canceller, sizeof(vi.echo_canceller) - 1);
 		if (copy_to_user((struct zt_versioninfo *) data, &vi, sizeof(vi)))
 			return -EFAULT;
 		break;
-	case ZT_MAINT:  /* do maintence stuff */
+	case ZT_MAINT:  /* do maintenance stuff */
 		  /* get struct from user */
 		if (copy_from_user(&maint,(struct zt_maintinfo *) data, sizeof(maint)))
 			return -EFAULT;
@@ -3631,6 +3624,11 @@
 				return zt_dynamic_ioctl(cmd, data);
 		}
 		return -ENOSYS;
+#if defined(ECHO_CAN_HPEC)
+	case ZT_EC_LICENSE_CHALLENGE:
+	case ZT_EC_LICENSE_RESPONSE:
+		return hpec_license_ioctl(cmd, data);
+#endif /* defined(ECHO_CAN_HPEC) */
 	default:
 		return zt_common_ioctl(inode, file, cmd, data, 0);
 	}
@@ -5704,11 +5702,22 @@
 				rxchunk[x] = ZT_LIN2X((int)rxlin, ss);
 			}
 		} else {
+#if !defined(ZT_EC_ARRAY_UPDATE)
 			for (x=0;x<ZT_CHUNKSIZE;x++) {
 				rxlin = ZT_XLAW(rxchunk[x], ss);
 				rxlin = echo_can_update(ss->ec, ZT_XLAW(txchunk[x], ss), rxlin);
-				rxchunk[x] = ZT_LIN2X((int)rxlin, ss);
-			}
+				rxchunk[x] = ZT_LIN2X((int) rxlin, ss);
+			}
+#else /* defined(ZT_EC_ARRAY_UPDATE) */
+			short rxlins[ZT_CHUNKSIZE], txlins[ZT_CHUNKSIZE];
+			for (x = 0; x < ZT_CHUNKSIZE; x++) {
+				rxlins[x] = ZT_XLAW(rxchunk[x], ss);
+				txlins[x] = ZT_XLAW(txchunk[x], ss);
+			}
+			echo_can_array_update(ss->ec, rxlins, txlins);
+			for (x = 0; x < ZT_CHUNKSIZE; x++)
+				rxchunk[x] = ZT_LIN2X((int) rxlins[x], ss);
+#endif /* defined(ZT_EC_ARRAY_UPDATE) */
 		}
 #if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP)
 		kernel_fpu_end();
@@ -7002,8 +7011,8 @@
 		mfv1_tones_continuous[i].next = mfv1_tones_continuous + i;
 
 	printk(KERN_INFO "Zapata Telephony Interface Registered on major %d\n", ZT_MAJOR);
-	printk(KERN_INFO "Zaptel Version: %s Echo Canceller: %s\n", ZAPTEL_VERSION,
-	       ZAPTEL_ECHO_CANCELLER ZAPTEL_ECHO_AGGRESSIVE);
+	printk(KERN_INFO "Zaptel Version: %s\n", ZAPTEL_VERSION);
+	echo_can_init();
 	zt_conv_init();
 	tone_zone_init();
 	fasthdlc_precalc();
@@ -7060,6 +7069,8 @@
 #ifdef CONFIG_ZAPTEL_WATCHDOG
 	watchdog_cleanup();
 #endif
+
+	echo_can_shutdown();
 }
 
 module_init(zt_init);

Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=2333&r1=2332&r2=2333
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Thu Mar 22 20:41:31 2007
@@ -1057,6 +1057,20 @@
 #endif
 	struct zt_chan *chan;
 };
+#endif
+
+/* 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);
+void echo_can_identify(char *buf, size_t len);
+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 */



More information about the svn-commits mailing list