summaryrefslogtreecommitdiff
path: root/wcte12xp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-01-10 23:15:28 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-01-10 23:15:28 +0000
commit979697a315b42d16aa1deae6bddf15ec3f00e777 (patch)
tree700b8d21cc5c94ed3053f12e4f6f461a345f9fd4 /wcte12xp
parent1044a5a044a0ba24358c2d2d9462ab281aee6b06 (diff)
add some code to parse parameters for ADT-based echo cancelers, and update the wcte12xp driver to be able to push the parameters all the way down to the DSP initialization function (actually pushing them out to the DSP will come later)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3649 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcte12xp')
-rw-r--r--wcte12xp/base.c59
-rw-r--r--wcte12xp/vpmadt032.c9
-rw-r--r--wcte12xp/vpmadt032.h4
3 files changed, 45 insertions, 27 deletions
diff --git a/wcte12xp/base.c b/wcte12xp/base.c
index 3079eb8..1332828 100644
--- a/wcte12xp/base.c
+++ b/wcte12xp/base.c
@@ -1286,32 +1286,43 @@ static int t1xxp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
}
#ifdef VPM_SUPPORT
-static int t1xxp_echocan(struct zt_chan *chan, int eclen)
+
+#include "adt_lec.c"
+
+static int t1xxp_echocan_with_params(struct zt_chan *chan, struct zt_echocanparams *ecp, struct zt_echocanparam *p)
{
+ struct adt_lec_params params;
struct t1 *wc = chan->pvt;
- if (wc->vpm150m) {
- struct vpm150m *vpm150m = wc->vpm150m;
- unsigned int flags;
-
- /* add this to our list of work to do */
- struct vpm150m_workentry *work;
- work = kmalloc(sizeof(*work), GFP_ATOMIC);
- if(!work)
- return -ENODEV;
- work->eclen = eclen;
- work->wc = wc;
- work->chan = chan;
- spin_lock_irqsave(&vpm150m->lock, flags);
- list_add_tail(&work->list, &vpm150m->worklist);
- spin_unlock_irqrestore(&vpm150m->lock, flags);
-
- /* we must do this later since we cannot sleep in the echocan function */
- if (test_bit(VPM150M_ACTIVE, &vpm150m->control))
- queue_work(vpm150m->wq, &vpm150m->work_echocan);
- return 0; /* how do I return the status since it is done later by the workqueue? */
- } else
- return -ENODEV;
+ struct vpm150m *vpm150m = wc->vpm150m;
+ unsigned int flags;
+ struct vpm150m_workentry *work;
+ unsigned int ret;
+ if (!wc->vpm150m)
+ return -ENODEV;
+
+ adt_lec_init_defaults(&params, 32);
+
+ if ((ret = adt_lec_parse_params(&params, ecp, p)))
+ return ret;
+
+ work = kmalloc(sizeof(*work), GFP_ATOMIC);
+ if(!work)
+ return -ENODEV;
+ work->params = params;
+ /* we can't really control the tap length, but the value is used
+ to control whether the ec is on or off, so translate it */
+ work->params.tap_length = ecp->tap_length ? 1 : 0;
+ work->wc = wc;
+ work->chan = chan;
+ spin_lock_irqsave(&vpm150m->lock, flags);
+ list_add_tail(&work->list, &vpm150m->worklist);
+ spin_unlock_irqrestore(&vpm150m->lock, flags);
+
+ /* we must do this later since we cannot sleep in the echocan function */
+ if (test_bit(VPM150M_ACTIVE, &vpm150m->control))
+ queue_work(vpm150m->wq, &vpm150m->work_echocan);
+ return 0; /* how do I return the status since it is done later by the workqueue? */
}
#endif
@@ -1353,7 +1364,7 @@ static int t1_software_init(struct t1 *wc)
wc->span.close = t1xxp_close;
wc->span.ioctl = t1xxp_ioctl;
#ifdef VPM_SUPPORT
- wc->span.echocan = t1xxp_echocan;
+ wc->span.echocan_with_params = t1xxp_echocan_with_params;
#endif
if (wc->spantype == TYPE_E1) {
diff --git a/wcte12xp/vpmadt032.c b/wcte12xp/vpmadt032.c
index efdb679..d86cafc 100644
--- a/wcte12xp/vpmadt032.c
+++ b/wcte12xp/vpmadt032.c
@@ -506,12 +506,17 @@ static void vpm150m_echocan_bh(struct work_struct *data)
int res;
GPAK_AlgControlStat_t pstatus;
- if (we->eclen) {
+ if (we->params.tap_length) {
/* configure channel for the ulaw/alaw */
unsigned int start = wc->intcount;
+ if (memcmp(&we->params, &vpm150m->chan_params[chan->chanpos - 1], sizeof(we->params))) {
+ /* set parameters */
+ vpm150m->chan_params[chan->chanpos - 1] = we->params;
+ }
+
deflaw = chan->span->deflaw;
- debug_printk(1, "Enabling EC on channel %d (law %d and eclen %d)\n", chan->chanpos, deflaw, we->eclen);
+ debug_printk(1, "Enabling EC on channel %d (law %d)\n", chan->chanpos, deflaw);
if (deflaw == 2) /* alaw */
res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, EnableALawSwCompanding, &pstatus);
else if (deflaw == 1) /* alaw */
diff --git a/wcte12xp/vpmadt032.h b/wcte12xp/vpmadt032.h
index 55620f1..e103e05 100644
--- a/wcte12xp/vpmadt032.h
+++ b/wcte12xp/vpmadt032.h
@@ -32,6 +32,7 @@
#define _VPM150M_H
#include "wcte12xp.h"
+#include "adt_lec.h"
struct t1_firmware {
const struct firmware *fw;
@@ -96,6 +97,7 @@ struct vpm150m {
unsigned char curtone[32];
unsigned long curdtmfmutestate;
unsigned long desireddtmfmutestate;
+ struct adt_lec_params chan_params[32];
struct t1 *wc;
};
@@ -104,7 +106,7 @@ struct vpm150m_workentry {
struct list_head list;
struct t1 *wc; /* what card are we dealing with? */
struct zt_chan *chan; /* what channels are we going to deal with? */
- int eclen; /* how should we behave? */
+ struct adt_lec_params params; /* how should we behave? */
};
extern int debug;