summaryrefslogtreecommitdiff
path: root/xpp
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-12-01 05:31:16 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-12-01 05:31:16 +0000
commita2e05541b879e26431191518851392c2b4e016d3 (patch)
tree14091b2533a370c2b07ebc3917602695ebdfacea /xpp
parentb557eec0f88781388d4fc45ad0774224ddc45427 (diff)
r1676@boole: tzafrir | 2006-12-01 02:09:53 +0200
r1668@boole: tzafrir | 2006-11-30 23:48:25 +0200 r2832@boole: tzafrir | 2006-11-29 11:06:06 +0200 Add parameter xpp_ec to the module xpp (xpp_zap.c). Defaults to 1. If 0, module will use Zaptel echo canceller even with XPP_EC_CHUNK. Parameter is read-only for now: cannot be set through /sys/modules. (Merge of changeset:2830) git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1682 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp')
-rw-r--r--xpp/xpd.h4
-rw-r--r--xpp/xpp_zap.c33
2 files changed, 23 insertions, 14 deletions
diff --git a/xpp/xpd.h b/xpp/xpd.h
index 74b759d..4f19679 100644
--- a/xpp/xpd.h
+++ b/xpp/xpd.h
@@ -44,6 +44,10 @@ typedef unsigned gfp_t; /* Added in 2.6.14 */
type name = init; \
module_param(name, type, 0600); \
MODULE_PARM_DESC(name, desc)
+#define DEF_PARM_RO(type,name,init,desc) \
+ type name = init; \
+ module_param(name, type, 0400); \
+ MODULE_PARM_DESC(name, desc)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
/*
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index 0512dcc..533a93f 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -66,6 +66,11 @@ static unsigned int xpp_last_jiffies = 0;
DEF_PARM(int, print_dbg, 0, "Print DBG statements");
DEF_PARM(bool, zap_autoreg, 1, "Register spans automatically (1) or not (0)");
DEF_PARM(bool, prefmaster, 1, "Do we want to be zaptel preferred sync master");
+#ifdef XPP_EC_CHUNK
+DEF_PARM_RO(bool, xpp_ec, 1, "Do we use our own (1) or Zaptel's (0) echo canceller");
+#else
+static int xpp_ec = 0;
+#endif
// DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit");
#include "zap_debug.h"
@@ -1042,11 +1047,13 @@ static void xpp_receiveprep(xpd_t *xpd)
for (i = 0;i < xpd->span.channels; i++) {
if(IS_SET(xpd->digital_signalling, i)) /* Don't echo cancel PRI/BRI D-chans */
continue;
-#ifdef XPP_EC_CHUNK
- xpp_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]);
-#else
- zt_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]);
+#ifdef XPP_EC_CHUNK
+ /* even if defined, parameterr xpp_ec can override at run-time */
+ if (xpp_ec)
+ xpp_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]);
+ else
#endif
+ zt_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]);
memcpy(xpd->ec_chunk2[i], xpd->ec_chunk1[i], ZT_CHUNKSIZE);
memcpy(xpd->ec_chunk1[i], chans[i].writechunk, ZT_CHUNKSIZE);
}
@@ -1270,9 +1277,9 @@ int (*hooksig)(struct zt_chan *chan, zt_txsig_t hookstate);
int (*sethook)(struct zt_chan *chan, int hookstate);
#endif
-#ifdef XPP_EC_CHUNK
static int xpp_echocan(struct zt_chan *chan, int len)
{
+#ifdef XPP_EC_CHUNK
if(len == 0) { /* shut down */
/* zaptel calls this also during channel initialization */
if(chan->ec) {
@@ -1289,9 +1296,9 @@ static int xpp_echocan(struct zt_chan *chan, int len)
ERR("%s: Failed creating xpp EC (len=%d)\n", __FUNCTION__, len);
return -EINVAL;
}
+#endif
return 0;
}
-#endif
#ifdef CONFIG_ZAPTEL_WATCHDOG
/*
@@ -1389,9 +1396,8 @@ static int zaptel_register_xpd(xpd_t *xpd)
span->hooksig = xpp_hooksig; /* Only with RBS bits */
span->ioctl = xpp_ioctl;
span->maint = xpp_maint;
-#ifdef XPP_EC_CHUNK
- span->echocan = xpp_echocan;
-#endif
+ if (xpp_ec)
+ span->echocan = xpp_echocan;
#ifdef CONFIG_ZAPTEL_WATCHDOG
span->watchdog = xpp_watchdog;
#endif
@@ -1449,11 +1455,10 @@ int __init xpp_zap_init(void)
#else
INFO("FEATURE: %s (without ECHO_SUPPRESSION)\n", THIS_MODULE->name);
#endif
-#ifdef XPP_EC_CHUNK
- INFO("FEATURE: %s (with XPP_EC_CHUNK)\n", THIS_MODULE->name);
-#else
- INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name);
-#endif
+ if (xpp_ec)
+ INFO("FEATURE: %s (with XPP_EC_CHUNK)\n", THIS_MODULE->name);
+ else
+ INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name);
#ifdef CONFIG_ZAPATA_BRI_DCHANS
INFO("FEATURE: %s (with BRISTUFF support)\n", THIS_MODULE->name);
#else