[svn-commits] kpfleming: branch linux/kpfleming/echocan_work r6366 - in /linux/team/kpflemi...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Apr 14 14:38:08 CDT 2009
Author: kpfleming
Date: Tue Apr 14 14:38:05 2009
New Revision: 6366
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6366
Log:
add an ioctl for explicitly placing the echocan into FAX mode
change the echocan mode change messages to be able to handle non-tone-detection events that cause changes
Modified:
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c
linux/team/kpfleming/echocan_work/include/dahdi/user.h
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c?view=diff&rev=6366&r1=6365&r2=6366
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c Tue Apr 14 14:38:05 2009
@@ -4977,6 +4977,26 @@
return ret;
}
+static void set_echocan_fax_mode(struct dahdi_chan *chan, unsigned int channo, const char *reason)
+{
+ if (chan->ec_state->features.NLP_toggle) {
+ module_printk(KERN_NOTICE, "Disabled echo canceller NLP because of %s on channel %d\n", reason, channo);
+ dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_DISABLED);
+ chan->ec_state->ops->echocan_NLP_toggle(chan->ec_state, 0);
+ } else {
+ module_printk(KERN_NOTICE, "Disabled echo canceller because of %s on channel %d\n", reason, channo);
+ dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_DISABLED);
+ chan->echocancel = 0;
+ chan->echostate = ECHO_STATE_IDLE;
+ chan->echolastupdate = 0;
+ chan->echotimer = 0;
+ chan->ec_state->ops->echocan_free(chan->ec_state);
+ chan->ec_state = NULL;
+ release_echocan(chan->ec_current);
+ chan->ec_current = NULL;
+ }
+}
+
static int dahdi_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit)
{
struct dahdi_chan *chan = chans[unit];
@@ -5208,6 +5228,13 @@
chan->echotimer = j;
} else
return -EINVAL;
+ break;
+ case DAHDI_ECHOCANCEL_FAX_MODE:
+ if (!chan->ec_state) {
+ return -EINVAL;
+ }
+ set_echocan_fax_mode(chan, chan->channo, "ioctl");
+ rv = 0;
break;
case DAHDI_SETTXBITS:
if (chan->sig != DAHDI_SIG_CAS)
@@ -5732,26 +5759,6 @@
#endif
}
-static void set_echocan_fax_mode(struct dahdi_chan *chan, unsigned int channo, const char *direction)
-{
- if (chan->ec_state->features.NLP_toggle) {
- module_printk(KERN_NOTICE, "Disabled echo canceller NLP because of tone (%s) on channel %d\n", direction, channo);
- dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_DISABLED);
- chan->ec_state->ops->echocan_NLP_toggle(chan->ec_state, 0);
- } else {
- module_printk(KERN_NOTICE, "Disabled echo canceller because of tone (%s) on channel %d\n", direction, channo);
- dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_DISABLED);
- chan->echocancel = 0;
- chan->echostate = ECHO_STATE_IDLE;
- chan->echolastupdate = 0;
- chan->echotimer = 0;
- chan->ec_state->ops->echocan_free(chan->ec_state);
- chan->ec_state = NULL;
- release_echocan(chan->ec_current);
- chan->ec_current = NULL;
- }
-}
-
static inline void __dahdi_process_getaudio_chunk(struct dahdi_chan *ss, unsigned char *txb)
{
/* We transmit data from our master channel */
@@ -5768,7 +5775,7 @@
if (ms->ec_state && ms->ec_state->status.NLP_enabled && !ms->ec_state->features.CED_tx_detect) {
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
if (echo_can_disable_detector_update(&ms->ec_state->txecdis, getlin[x])) {
- set_echocan_fax_mode(ms, ss->channo, "tx");
+ set_echocan_fax_mode(ms, ss->channo, "CED tx detected");
dahdi_qevent_nolock(ms, DAHDI_EVENT_TX_CED_DETECTED);
break;
}
@@ -6567,7 +6574,7 @@
dahdi_qevent_nolock(chan, DAHDI_EVENT_TX_CED_DETECTED);
if (chan->ec_state) {
if (chan->ec_state->status.NLP_enabled) {
- set_echocan_fax_mode(chan, chan->channo, "tx");
+ set_echocan_fax_mode(chan, chan->channo, "CED tx detected");
} else {
module_printk(KERN_NOTICE, "Detected CED tone (tx) on channel %d\n", chan->channo);
}
@@ -6578,7 +6585,7 @@
dahdi_qevent_nolock(chan, DAHDI_EVENT_RX_CED_DETECTED);
if (chan->ec_state) {
if (chan->ec_state->status.NLP_enabled) {
- set_echocan_fax_mode(chan, chan->channo, "rx");
+ set_echocan_fax_mode(chan, chan->channo, "CED rx detected");
} else {
module_printk(KERN_NOTICE, "Detected CED tone (rx) on channel %d\n", chan->channo);
}
@@ -6756,7 +6763,7 @@
if (ms->ec_state && ms->ec_state->status.NLP_enabled && !ms->ec_state->features.CED_rx_detect) {
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
if (echo_can_disable_detector_update(&ms->ec_state->rxecdis, putlin[x])) {
- set_echocan_fax_mode(ms, ss->channo, "rx");
+ set_echocan_fax_mode(ms, ss->channo, "CED rx detected");
dahdi_qevent_nolock(ms, DAHDI_EVENT_RX_CED_DETECTED);
break;
}
Modified: linux/team/kpfleming/echocan_work/include/dahdi/user.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/include/dahdi/user.h?view=diff&rev=6366&r1=6365&r2=6366
==============================================================================
--- linux/team/kpfleming/echocan_work/include/dahdi/user.h (original)
+++ linux/team/kpfleming/echocan_work/include/dahdi/user.h Tue Apr 14 14:38:05 2009
@@ -1017,8 +1017,11 @@
#define DAHDI_STARTUP _IOW(DAHDI_CODE, 99, int)
#define DAHDI_SHUTDOWN _IOW(DAHDI_CODE, 100, int)
-
#define DAHDI_HDLC_RATE _IOW(DAHDI_CODE, 101, int)
+
+/* Put a channel's echo canceller into 'FAX mode' if possible */
+
+#define DAHDI_ECHOCANCEL_FAX_MODE _IO(DAHDI_CODE, 102)
struct torisa_debug {
unsigned int txerrors;
More information about the svn-commits
mailing list