diff options
author | Shaun Ruffell <sruffell@digium.com> | 2009-04-29 18:24:04 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2009-04-29 18:24:04 +0000 |
commit | 5f94a3b91de2c3835d6852d59cab9f6876177156 (patch) | |
tree | 4c25956b6ecdcd5b902ac80b40237bc3e938be44 /drivers/dahdi/voicebus/GpakCust.c | |
parent | 4a192a3e8f16ed6143377b5726e1fb53b446f5e9 (diff) |
echocan: Improve interface for echo cancelers.
Echo cancelers are now able to report if they are able to automatically disable
their NLP portions in the presence of tones in the audio stream. Also, the
interface is changed to allow user space to just disable the NLP portion of the
echo canceler. These changes improve fax and modem handling in DAHDI.
This commit merges in the changes on
http://svn.digium.com/svn/dahdi/linux/team/kpfleming/echocan_work
Patch by: kpfleming
Also contains improvements to CED tone detection.
(closes issue #13286)
Reported by: viniciusfontes
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6529 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/voicebus/GpakCust.c')
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c index 386c916..ccd880c 100644 --- a/drivers/dahdi/voicebus/GpakCust.c +++ b/drivers/dahdi/voicebus/GpakCust.c @@ -293,21 +293,9 @@ vpm_bh_out: return; } #include "adt_lec.c" -int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo, - struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p) +static void vpmadt032_check_and_schedule_update(struct vpmadt032 *vpm, int channo) { int update; - unsigned int ret; - - ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p); - if (ret) - return ret; - - /* The driver cannot control the number of taps on the VPMADT032 - * module. Instead, it uses tap_length to enable or disable the echo - * cancellation. */ - vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0; - /* Only update the parameters if the new state of the echo canceller * is different than the current state. */ update = memcmp(&vpm->curecstate[channo], @@ -322,10 +310,41 @@ int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo, */ schedule_work(&vpm->work); } +} +int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo, + struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p) +{ + unsigned int ret; + ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p); + if (ret) + return ret; + + if (vpm->options.debug & DEBUG_ECHOCAN) + printk(KERN_DEBUG "echocan: Channel is %d length %d\n", channo, ecp->tap_length); + + /* The driver cannot control the number of taps on the VPMADT032 + * module. Instead, it uses tap_length to enable or disable the echo + * cancellation. */ + vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0; + + vpmadt032_check_and_schedule_update(vpm, channo); return 0; } -EXPORT_SYMBOL(vpmadt032_echocan_with_params); +EXPORT_SYMBOL(vpmadt032_echocan_create); + +void vpmadt032_echocan_free(struct vpmadt032 *vpm, struct dahdi_chan *chan, + struct dahdi_echocan_state *ec) +{ + int channo = chan->chanpos - 1; + adt_lec_init_defaults(&vpm->desiredecstate[channo], 0); + + if (vpm->options.debug & DEBUG_ECHOCAN) + printk(KERN_DEBUG "echocan: Channel is %d length 0\n", channo); + + vpmadt032_check_and_schedule_update(vpm, channo); +} +EXPORT_SYMBOL(vpmadt032_echocan_free); struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options) { |