[zaptel-commits] kpfleming: branch kpfleming/echocanparams r3522 - /team/kpfleming/echocanparams/

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Tue Dec 18 15:16:37 CST 2007


Author: kpfleming
Date: Tue Dec 18 15:16:37 2007
New Revision: 3522

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3522
Log:
update the echo cancelers and remove some old ones that are obsolete

Removed:
    team/kpfleming/echocanparams/mec.h
    team/kpfleming/echocanparams/mec2.h
    team/kpfleming/echocanparams/mec2_const.h
    team/kpfleming/echocanparams/mec3-float.h
    team/kpfleming/echocanparams/mec3.h
Modified:
    team/kpfleming/echocanparams/Makefile
    team/kpfleming/echocanparams/kb1ec.h
    team/kpfleming/echocanparams/sec-2.h
    team/kpfleming/echocanparams/sec.h
    team/kpfleming/echocanparams/zaptel-base.c
    team/kpfleming/echocanparams/zconfig.h

Modified: team/kpfleming/echocanparams/Makefile
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/Makefile?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/Makefile (original)
+++ team/kpfleming/echocanparams/Makefile Tue Dec 18 15:16:37 2007
@@ -372,7 +372,7 @@
 
 tor2.o: tor2-hw.h tor2fw.h
 
-zaptel-base.o: digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h
+zaptel-base.o: digits.h arith.h sec.h sec-2.h kb1ec.h mg2ec.h zconfig.h
 
 wcusb.o: wcusb.h
 

Modified: team/kpfleming/echocanparams/kb1ec.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/kb1ec.h?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/kb1ec.h (original)
+++ team/kpfleming/echocanparams/kb1ec.h Tue Dec 18 15:16:37 2007
@@ -529,12 +529,19 @@
 	return u;
 }
 
-static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
-{
-	struct echo_can_state *ec;
+static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p,
+			   struct echo_can_state **ec)
+{
 	int maxy;
 	int maxu;
-	maxy = len + DEFAULT_M;
+	size_t size;
+
+	if (ecp->param_count > 0) {
+		printk(KERN_WARNING "KB1 echo canceler does not support parameters; failing request\n");
+		return -EINVAL;
+	}
+
+	maxy = ecp->tap_length + DEFAULT_M;
 	maxu = DEFAULT_M;
 	if (maxy < (1 << DEFAULT_ALPHA_YT_I))
 		maxy = (1 << DEFAULT_ALPHA_YT_I);
@@ -542,26 +549,24 @@
 		maxy = (1 << DEFAULT_SIGMA_LY_I);
 	if (maxu < (1 << DEFAULT_SIGMA_LU_I))
 		maxu = (1 << DEFAULT_SIGMA_LU_I);
-	ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) +
-									4 + 						/* align */
-									sizeof(int) * len +			/* a_i */
-									sizeof(short) * len + 		/* a_s */
-									2 * sizeof(short) * (maxy) +	/* y_s */
-									2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */
-									2 * sizeof(short) * (maxu) +		/* u_s */
-									2 * sizeof(short) * len);			/* y_tilde_s */
-	if (ec) {
-		memset(ec, 0, sizeof(struct echo_can_state) +
-									4 + 						/* align */
-									sizeof(int) * len +			/* a_i */
-									sizeof(short) * len + 		/* a_s */
-									2 * sizeof(short) * (maxy) +	/* y_s */
-									2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */
-									2 * sizeof(short) * (maxu) +		/* u_s */
-									2 * sizeof(short) * len);			/* y_tilde_s */
-	  init_cc(ec, len, maxy, maxu);
-	}
-	return ec;
+
+	size = sizeof(*ec) +
+		4 + 						/* align */
+		sizeof(int) * ecp->tap_length +			/* a_i */
+		sizeof(short) * ecp->tap_length + 		/* a_s */
+		2 * sizeof(short) * (maxy) +			/* y_s */
+		2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */
+		2 * sizeof(short) * (maxu) +			/* u_s */
+		2 * sizeof(short) * ecp->tap_length;		/* y_tilde_s */
+
+	if (!(*ec = MALLOC(size)))
+		return -ENOMEM;
+
+	memset(*ec, 0, size);
+
+	init_cc(*ec, ecp->tap_length, maxy, maxu);
+	
+	return 0;
 }
 
 static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)

Modified: team/kpfleming/echocanparams/sec-2.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/sec-2.h?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/sec-2.h (original)
+++ team/kpfleming/echocanparams/sec-2.h Tue Dec 18 15:16:37 2007
@@ -97,7 +97,6 @@
 				   was skipped, for test purposes */
 };
 
-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);
 
@@ -127,36 +126,44 @@
 /* #define MIN_TX_POWER_FOR_ADAPTION 4096
 #define MIN_RX_POWER_FOR_ADAPTION 64 */
 
-static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
-{
-    struct echo_can_state *ec;
-    void *ptr;
-    
-    ptr = ec = (struct echo_can_state *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
-						   len * sizeof(int16_t));
-    if (ec == NULL)
-    	return  NULL;
-    memset(ec, 0, sizeof(*ec) + len * sizeof(int32_t) + len * sizeof(int16_t));
-    ec->taps = len;
-    ec->curr_pos = len - 1;
-    ec->tap_mask = len - 1;
-    ec->fir_taps32 = (int32_t *) (ptr + sizeof(*ec));
-    ec->fir_taps16 = (int16_t *) (ptr + sizeof(*ec) + len * sizeof(int32_t));
-    /* Create FIR filter */
-    fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps);
-    ec->rx_power_threshold = 10000000;
-    ec->use_suppressor = FALSE;
-    /* Non-linear processor - a fancy way to say "zap small signals, to avoid
-       accumulating noise". */
-    ec->use_nlp = FALSE;
-    return  ec;
+static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p,
+			   struct echo_can_state **ec)
+{
+	size_t size;
+
+	if (ecp->param_count > 0) {
+		printk(KERN_WARNING "SEC-2 echo canceler does not support parameters; failing request\n");
+		return -EINVAL;
+	}
+
+	size = sizeof(**ec) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t);
+	
+	if (!(*ec = MALLOC(size)))
+		return -ENOMEM;
+	
+	memset(*ec, 0, size);
+
+	(*ec)->taps = ecp->tap_length;
+	(*ec)->curr_pos = ecp->tap_length - 1;
+	(*ec)->tap_mask = ecp->tap_length - 1;
+	(*ec)->fir_taps32 = (int32_t *) (*ec + sizeof(**ec));
+	(*ec)->fir_taps16 = (int16_t *) (*ec + sizeof(**ec) + ecp->tap_length * sizeof(int32_t));
+	/* Create FIR filter */
+	fir16_create(&(*ec)->fir_state, (*ec)->fir_taps16, (*ec)->taps);
+	(*ec)->rx_power_threshold = 10000000;
+	(*ec)->use_suppressor = FALSE;
+	/* Non-linear processor - a fancy way to say "zap small signals, to avoid
+	   accumulating noise". */
+	(*ec)->use_nlp = FALSE;
+
+	return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
 static inline void echo_can_free(struct echo_can_state *ec)
 {
-    fir16_free(&ec->fir_state);
-    FREE(ec);
+	fir16_free(&ec->fir_state);
+	FREE(ec);
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: team/kpfleming/echocanparams/sec.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/sec.h?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/sec.h (original)
+++ team/kpfleming/echocanparams/sec.h Tue Dec 18 15:16:37 2007
@@ -114,7 +114,6 @@
 {
 }
 
-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);
 
@@ -131,33 +130,44 @@
 #define MIN_RX_POWER_FOR_ADAPTION   64
 */
 
-static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
-{
-    struct echo_can_state *ec;
-    void *ptr;
-    
-    ptr = ec = (struct echo_can_state *) MALLOC(sizeof(*ec) + len * sizeof(int32_t) +
-						   len * 3 * sizeof(int16_t));
-    if (ec == NULL)
-    	return  NULL;
-    memset(ec, 0, sizeof(*ec) + len * sizeof(int32_t) + len * 3 * sizeof(int16_t));
-    ec->taps = len;
-    ec->tap_mask = len - 1;
-    ec->tx_history = (int16_t *) (ptr + sizeof(*ec) );
-    ec->fir_taps = (int32_t *) (ptr + sizeof(*ec) + len * 2 * sizeof(int16_t));
-    ec->fir_taps_short = (int16_t *) (ptr + sizeof(*ec) + len * sizeof(int32_t) + len * 2 * sizeof(int16_t));
-    ec->rx_power_threshold = 10000000;
-    ec->use_suppressor = FALSE;
-    /* Non-linear processor - a fancy way to say "zap small signals, to avoid
-       accumulating noise". */
-    ec->use_nlp = TRUE;
-    return  ec;
+static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p,
+			   struct echo_can_state **ec)
+{
+	size_t size;
+	
+	if (ecp->param_count > 0) {
+		printk(KERN_WARNING "SEC echo canceler does not support parameters; failing request\n");
+		return -EINVAL;
+	}
+	
+	size = sizeof(**ec) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t);
+	
+	if (!(*ec = MALLOC(size)))
+		return -ENOMEM;
+	
+	memset(*ec, 0, size);
+
+	(*ec)->taps = ecp->tap_length;
+	(*ec)->tap_mask = ecp->tap_length - 1;
+	(*ec)->tx_history = (int16_t *) (*ec + sizeof(**ec));
+	(*ec)->fir_taps = (int32_t *) (*ec + sizeof(**ec) +
+				       ecp->tap_length * 2 * sizeof(int16_t));
+	(*ec)->fir_taps_short = (int16_t *) (*ec + sizeof(**ec) +
+					     ecp->tap_length * sizeof(int32_t) +
+					     ecp->tap_length * 2 * sizeof(int16_t));
+	(*ec)->rx_power_threshold = 10000000;
+	(*ec)->use_suppressor = FALSE;
+	/* Non-linear processor - a fancy way to say "zap small signals, to avoid
+	   accumulating noise". */
+	(*ec)->use_nlp = TRUE;
+
+	return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
 static inline void echo_can_free(struct echo_can_state *ec)
 {
-    FREE(ec);
+	FREE(ec);
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: team/kpfleming/echocanparams/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/zaptel-base.c?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/zaptel-base.c (original)
+++ team/kpfleming/echocanparams/zaptel-base.c Tue Dec 18 15:16:37 2007
@@ -419,18 +419,12 @@
 #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"
 #elif defined(ECHO_CAN_JP1)
 #include "jpah.h"
-#else
-#include "mec3.h"
 #endif
 
 static inline void rotate_sums(void)

Modified: team/kpfleming/echocanparams/zconfig.h
URL: http://svn.digium.com/view/zaptel/team/kpfleming/echocanparams/zconfig.h?view=diff&rev=3522&r1=3521&r2=3522
==============================================================================
--- team/kpfleming/echocanparams/zconfig.h (original)
+++ team/kpfleming/echocanparams/zconfig.h Tue Dec 18 15:16:37 2007
@@ -63,9 +63,6 @@
  */ 
 /* #define ECHO_CAN_STEVE */
 /* #define ECHO_CAN_STEVE2 */
-/* #define ECHO_CAN_MARK */
-/* #define ECHO_CAN_MARK2 */
-/* #define ECHO_CAN_MARK3 */
 /* #define ECHO_CAN_KB1 */
 /* This is the new latest and greatest */
 #define ECHO_CAN_MG2




More information about the zaptel-commits mailing list