[Asterisk-cvs] zaptel wct4xxp.c, 1.59, 1.60 zaptel.c, 1.104,
1.105 zaptel.h, 1.41, 1.42
markster at lists.digium.com
markster at lists.digium.com
Mon May 2 16:07:54 CDT 2005
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv2871
Modified Files:
wct4xxp.c zaptel.c zaptel.h
Log Message:
Add support for TE410P/TE405P 2nd gen features (TSI, ECHOCAN, NATIVELAYOUT, IRQ, DTMFDETECT)
Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- wct4xxp.c 13 Apr 2005 03:52:17 -0000 1.59
+++ wct4xxp.c 2 May 2005 20:15:07 -0000 1.60
@@ -1,12 +1,12 @@
/*
* TE410P Quad-T1/E1 PCI Driver version 0.1, 12/16/02
*
- * Written by Mark Spencer <markster at linux-support.net>
+ * Written by Mark Spencer <markster at digium.com>
* Based on previous works, designs, and archetectures conceived and
* written by Jim Dixon <jim at lambdatel.com>.
*
* Copyright (C) 2001 Jim Dixon / Zapata Telephony.
- * Copyright (C) 2001, Linux Support Services, Inc.
+ * Copyright (C) 2001-2005, Digium, Inc.
[...1179 lines suppressed...]
@@ -1765,11 +2479,18 @@
module_param(t1e1override, int, 0600);
module_param(alarmdebounce, int, 0600);
module_param(j1mode, int, 0600);
+module_param(debugslips, int, 0600);
+module_param(polling, int, 0600);
#else
MODULE_PARM(debug, "i");
MODULE_PARM(loopback, "i");
MODULE_PARM(noburst, "i");
+MODULE_PARM(debugslips, "i");
+MODULE_PARM(polling, "i");
MODULE_PARM(timingcable, "i");
+#ifdef VPM_SUPPORT
+MODULE_PARM(vpmsupport,"i");
+#endif
MODULE_PARM(t1e1override, "i");
MODULE_PARM(alarmdebounce, "i");
MODULE_PARM(j1mode, "i");
Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- zaptel.c 27 Apr 2005 20:35:05 -0000 1.104
+++ zaptel.c 2 May 2005 20:15:07 -0000 1.105
@@ -140,6 +140,7 @@
EXPORT_SYMBOL(zt_alarm_notify);
EXPORT_SYMBOL(zt_set_dynamic_ioctl);
EXPORT_SYMBOL(zt_ec_chunk);
+EXPORT_SYMBOL(zt_ec_span);
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_entries[ZT_MAX_SPANS];
@@ -958,6 +959,11 @@
memset(chan->conflast1, 0, sizeof(chan->conflast1));
memset(chan->conflast2, 0, sizeof(chan->conflast2));
+ if (chan->span && chan->span->echocan)
+ chan->span->echocan(chan, 0);
+ if (chan->span && chan->span->dacs && oldconf)
+ chan->span->dacs(chan, NULL);
+
spin_unlock_irqrestore(&chan->lock, flags);
if (rxgain)
@@ -1563,8 +1569,11 @@
(chans[x]->confmode == ZT_CONF_DIGITALMON))) {
/* Take them out of conference with us */
/* release conference resource if any */
- if (chans[x]->confna)
+ if (chans[x]->confna) {
zt_check_conf(chans[x]->confna);
+ if (chans[x]->span && chans[x]->span->dacs)
+ chans[x]->span->dacs(chans[x], NULL);
+ }
chans[x]->confna = 0;
chans[x]->_confn = 0;
chans[x]->confmode = 0;
@@ -2041,6 +2050,8 @@
if ((chan->sig & __ZT_SIG_DACS) != __ZT_SIG_DACS) {
chan->confna = 0;
chan->confmode = 0;
+ if (chan->span && chan->span->dacs)
+ chan->span->dacs(chan, NULL);
}
chan->_confn = 0;
memset(chan->conflast, 0, sizeof(chan->conflast));
@@ -2078,6 +2089,8 @@
chan->ringcadence[0] = chan->starttime;
chan->ringcadence[1] = ZT_RINGOFFTIME;
}
+ if (chan->span && chan->span->echocan)
+ chan->span->echocan(chan, 0);
spin_unlock_irqrestore(&chan->lock, flags);
if (rxgain)
@@ -3138,7 +3151,14 @@
/* Setup conference properly */
chans[ch.chan]->confmode = ZT_CONF_DIGITALMON;
chans[ch.chan]->confna = ch.idlebits;
- }
+ if (chans[ch.chan]->span &&
+ chans[ch.chan]->span->dacs &&
+ chans[ch.idlebits] &&
+ chans[ch.chan]->span &&
+ (chans[ch.chan]->span->dacs == chans[ch.idlebits]->span->dacs))
+ chans[ch.chan]->span->dacs(chans[ch.chan], chans[ch.idlebits]);
+ } else if (chans[ch.chan]->span && chans[ch.chan]->span->dacs)
+ chans[ch.chan]->span->dacs(chans[ch.chan], NULL);
chans[ch.chan]->master = newmaster;
/* Note new slave if we are not our own master */
if (newmaster != chans[ch.chan]) {
@@ -3658,6 +3678,14 @@
chans[i]->_confn = 0; /* Clear confn */
zt_check_conf(j);
zt_check_conf(stack.conf.confno);
+ if (chans[i]->span && chans[i]->span->dacs) {
+ if ((stack.conf.confmode == ZT_CONF_DIGITALMON) && chans[stack.conf.confno]->span &&
+ (chans[stack.conf.confno]->span->dacs == chans[i]->span->dacs)) {
+ chans[i]->span->dacs(chans[i], chans[stack.conf.confno]);
+ } else {
+ chans[i]->span->dacs(chans[i], NULL);
+ }
+ }
/* k will be non-zero if in a real conf */
k = stack.conf.confmode & (ZT_CONF_CONF | ZT_CONF_CONFANN | ZT_CONF_CONFMON | ZT_CONF_CONFANNMON | ZT_CONF_REALANDPSEUDO);
/* if we are going onto a conf */
@@ -3920,6 +3948,8 @@
/* initialize conference variables */
chan->_confn = 0;
chan->confna = 0;
+ if (chan->span && chan->span->dacs)
+ chan->span->dacs(chan, NULL);
chan->confmode = 0;
chan->confmute = 0;
memset(chan->conflast, 0, sizeof(chan->conflast));
@@ -3937,6 +3967,9 @@
chan->rxgain = defgain;
chan->txgain = defgain;
chan->gainalloc = 0;
+ /* Disable any native echo cancellation as well */
+ if (chan->span && chan->span->echocan)
+ chan->span->echocan(chan, 0);
spin_unlock_irqrestore(&chan->lock, flags);
if (rxgain)
@@ -3988,6 +4021,8 @@
chan->gainalloc = 0;
chan->flags &= ~ZT_FLAG_AUDIO;
chan->flags |= (ZT_FLAG_PPP | ZT_FLAG_HDLC | ZT_FLAG_FCS);
+ if (chan->span && chan->span->echocan)
+ chan->span->echocan(chan, 0);
if (tec)
echo_can_free(tec);
} else
@@ -4034,27 +4069,38 @@
return -EINVAL;
get_user(j, (int *)data);
if (j) {
- if ((j == 32) ||
- (j == 64) ||
- (j == 128) ||
- (j == 256)) {
- /* Okay */
- } else {
- j = deftaps;
- }
- ec = echo_can_create(j, 0);
- if (!ec)
- return -ENOMEM;
spin_lock_irqsave(&chan->lock, flags);
/* If we had an old echo can, zap it now */
tec = chan->ec;
- chan->echocancel = j;
- chan->ec = ec;
- chan->echostate = ECHO_STATE_IDLE;
- chan->echolastupdate = 0;
- chan->echotimer = 0;
- echo_can_disable_detector_init(&chan->txecdis);
- echo_can_disable_detector_init(&chan->rxecdis);
+ chan->ec = NULL;
+ /* Attempt hardware native echo can */
+ if (chan->span && chan->span->echocan)
+ ret = chan->span->echocan(chan, j);
+ else
+ ret = -ENOTTY;
+ if (ret) {
+ /* Use built-in echo can */
+ if ((j == 32) ||
+ (j == 64) ||
+ (j == 128) ||
+ (j == 256)) {
+ /* Okay */
+ } else {
+ j = deftaps;
+ }
+ spin_unlock_irqrestore(&chan->lock, flags);
+ ec = echo_can_create(j, 0);
+ if (!ec)
+ return -ENOMEM;
+ spin_lock_irqsave(&chan->lock, flags);
+ chan->echocancel = j;
+ chan->ec = ec;
+ chan->echostate = ECHO_STATE_IDLE;
+ chan->echolastupdate = 0;
+ chan->echotimer = 0;
+ echo_can_disable_detector_init(&chan->txecdis);
+ echo_can_disable_detector_init(&chan->rxecdis);
+ }
spin_unlock_irqrestore(&chan->lock, flags);
if (tec)
echo_can_free(tec);
@@ -4066,6 +4112,9 @@
chan->echostate = ECHO_STATE_IDLE;
chan->echolastupdate = 0;
chan->echotimer = 0;
+ /* Attempt hardware native echo can */
+ if (chan->span && chan->span->echocan)
+ chan->span->echocan(chan, 0);
spin_unlock_irqrestore(&chan->lock, flags);
if (tec)
echo_can_free(tec);
@@ -5228,7 +5277,7 @@
spin_unlock_irqrestore(&chan->lock, flags);
}
-void zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char *txchunk)
+static inline void __zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char *txchunk)
{
short rxlin, txlin;
int x;
@@ -5279,6 +5328,20 @@
spin_unlock_irqrestore(&ss->lock, flags);
}
+void zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char *txchunk)
+{
+ __zt_ec_chunk(ss, rxchunk, txchunk);
+}
+
+void zt_ec_span(struct zt_span *span)
+{
+ int x;
+ for (x = 0; x < span->channels; x++) {
+ if (span->chans[x].ec)
+ __zt_ec_chunk(&span->chans[x], span->chans[x].readchunk, span->chans[x].writechunk);
+ }
+}
+
/* return 0 if nothing detected, 1 if lack of tone, 2 if presence of tone */
/* modifies buffer pointed to by 'amp' with notched-out values */
static inline int sf_detect (sf_detect_state_t *s,
Index: zaptel.h
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- zaptel.h 21 Jan 2005 01:46:41 -0000 1.41
+++ zaptel.h 2 May 2005 20:15:07 -0000 1.42
@@ -618,6 +618,11 @@
*/
#define ZT_DYNAMIC_DESTROY _IOW (ZT_CODE, 81, struct zt_dynamic_span)
+/*
+ * Enable tone detection -- implemented by low level driver
+ */
+#define ZT_TONEDETECT _IOW (ZT_CODE, 91, int)
+
/*
* Startup or Shutdown a span
*/
@@ -644,6 +649,9 @@
#define ZT_MAX_CADENCE 16
+#define ZT_TONEDETECT_ON (1 << 0) /* Detect tones */
+#define ZT_TONEDETECT_MUTE (1 << 1) /* Mute audio in received channel */
+
struct zt_ring_cadence {
int ringcadence [ZT_MAX_CADENCE];
};
@@ -792,7 +800,8 @@
#define ZT_EVENT_POLARITY 17
#define ZT_EVENT_PULSEDIGIT (1 << 16) /* This is OR'd with the digit received */
-#define ZT_EVENT_DTMFDIGIT (1 << 17) /* Ditto for DTMF */
+#define ZT_EVENT_DTMFDOWN (1 << 17) /* Ditto for DTMF key down event */
+#define ZT_EVENT_DTMFUP (1 << 18) /* Ditto for DTMF key up event */
/* Flag Value for IOMUX, read avail */
#define ZT_IOMUX_READ 1
@@ -1242,6 +1251,9 @@
/* Opt: IOCTL */
int (*ioctl)(struct zt_chan *chan, unsigned int cmd, unsigned long data);
+ /* Opt: Native echo cancellation */
+ int (*echocan)(struct zt_chan *chan, int ecval);
+
/* Okay, now we get to the signalling. You have several options: */
/* Option 1: If you're a T1 like interface, you can just provide a
@@ -1261,6 +1273,9 @@
/* Option 3: If you can't use sig bits, you can write a function
which handles the individual hook states */
int (*sethook)(struct zt_chan *chan, int hookstate);
+
+ /* Opt: Dacs the contents of chan2 into chan1 if possible */
+ int (*dacs)(struct zt_chan *chan1, struct zt_chan *chan2);
/* Used by zaptel only -- no user servicable parts inside */
int spanno; /* Span number for zaptel */
@@ -1364,6 +1379,7 @@
not be doing so. rxchunk is modified in-place */
extern void zt_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk);
+extern void zt_ec_span(struct zt_span *span);
/* Don't use these directly -- they're not guaranteed to
be there. */
More information about the svn-commits
mailing list