summaryrefslogtreecommitdiff
path: root/xpp/xpp_zap.c
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r--xpp/xpp_zap.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index 52b2846..9a9ab0a 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -896,6 +896,30 @@ void fill_beep(u_char *buf, int duration)
memcpy(buf, &beep[(which*8) % ARRAY_SIZE(beep)], ZT_CHUNKSIZE);
}
+#ifdef XPP_EC_CHUNK
+/*
+ * Taken from zaptel.c
+ */
+static inline void xpp_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk)
+{
+ short rxlin;
+ int x;
+ unsigned long flags;
+
+ /* Perform echo cancellation on a chunk if necessary */
+ if (!chan->ec)
+ return;
+ spin_lock_irqsave(&chan->lock, flags);
+ for (x=0;x<ZT_CHUNKSIZE;x++) {
+ rxlin = ZT_XLAW(rxchunk[x], chan);
+ rxlin = echo_can_update(chan->ec, ZT_XLAW(txchunk[x], chan), rxlin);
+ rxchunk[x] = ZT_LIN2X((int)rxlin, chan);
+ }
+ spin_unlock_irqrestore(&chan->lock, flags);
+}
+#endif
+
+
static void xpp_receiveprep(xpd_t *xpd)
{
volatile u_char *readchunk;
@@ -924,10 +948,14 @@ static void xpp_receiveprep(xpd_t *xpd)
readchunk += ZT_CHUNKSIZE;
}
-#if 0
+#if WITH_ECHO_SUPPRESSION
/* FIXME: need to Echo cancel double buffered data */
for (i = 0;i < xpd->span.channels; i++) {
+#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]);
+#endif
memcpy(xpd->ec_chunk2[i], xpd->ec_chunk1[i], ZT_CHUNKSIZE);
memcpy(xpd->ec_chunk1[i], chans[i].writechunk, ZT_CHUNKSIZE);
}
@@ -1517,18 +1545,19 @@ int __init xpp_zap_init(void)
INFO("%s revision %s\n", THIS_MODULE->name, ZAPTEL_VERSION);
#ifdef WITH_RBS
- INFO("%s (RBS signalling)\n", THIS_MODULE->name);
+ INFO("FEATURE: %s (RBS signalling)\n", THIS_MODULE->name);
#else
- INFO("%s (NO RBS signalling)\n", THIS_MODULE->name);
+ INFO("FEATURE: %s (NO RBS signalling)\n", THIS_MODULE->name);
#endif
-#ifdef HARD_CODED_INIT
-#ifdef OLD_CARD
- INFO("%s (HARD_CODED_INIT: OLD_CARD)\n", THIS_MODULE->name);
+#if WITH_ECHO_SUPPRESSION
+ INFO("FEATURE: %s (with ECHO_SUPPRESSION)\n", THIS_MODULE->name);
#else
- INFO("%s (HARD_CODED_INIT: NEW_CARD)\n", THIS_MODULE->name);
+ 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("%s (DYNAMIC INIT REGISTERS)\n", THIS_MODULE->name);
+ INFO("FEATURE: %s (without XPP_EC_CHUNK)\n", THIS_MODULE->name);
#endif
#ifdef CONFIG_PROC_FS