[dahdi-commits] kpfleming: branch linux/kpfleming/echocan_work r6424 - in /linux/team/kpflemi...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Apr 21 12:27:01 CDT 2009
Author: kpfleming
Date: Tue Apr 21 12:26:57 2009
New Revision: 6424
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6424
Log:
create an ECHO_MODE_FAX, and use ECHO_MODE_ACTIVE and ECHO_MODE_FAX instead of trying to remember whether the NLP is enabled or not (for echocans without NLP control, this doesn't work at all)
Modified:
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c
linux/team/kpfleming/echocan_work/include/dahdi/kernel.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=6424&r1=6423&r2=6424
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c Tue Apr 21 12:26:57 2009
@@ -4954,6 +4954,7 @@
spin_lock_irqsave(&chan->lock, flags);
chan->ec_current = ec_current;
chan->ec_state = ec;
+ ec->status.mode = ECHO_MODE_ACTIVE;
if (!ec->features.CED_tx_detect) {
echo_can_disable_detector_init(&chan->ec_state->txecdis);
}
@@ -4975,6 +4976,7 @@
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);
+ chan->ec_state->status.mode = ECHO_MODE_FAX;
} 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);
@@ -5756,7 +5758,7 @@
for (x=0;x<DAHDI_CHUNKSIZE;x++)
getlin[x] = DAHDI_XLAW(txb[x], ms);
- if (ms->ec_state && ms->ec_state->status.NLP_enabled && !ms->ec_state->features.CED_tx_detect) {
+ if (ms->ec_state && (ms->ec_state->status.mode == ECHO_MODE_ACTIVE) && !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, "CED tx detected");
@@ -6557,7 +6559,7 @@
if (events.CED_tx_detected) {
dahdi_qevent_nolock(chan, DAHDI_EVENT_TX_CED_DETECTED);
if (chan->ec_state) {
- if (chan->ec_state->status.NLP_enabled) {
+ if (chan->ec_state->status.mode == ECHO_MODE_ACTIVE) {
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);
@@ -6568,7 +6570,7 @@
if (events.CED_rx_detected) {
dahdi_qevent_nolock(chan, DAHDI_EVENT_RX_CED_DETECTED);
if (chan->ec_state) {
- if (chan->ec_state->status.NLP_enabled) {
+ if (chan->ec_state->status.mode == ECHO_MODE_ACTIVE) {
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);
@@ -6586,10 +6588,12 @@
if (events.NLP_auto_disabled) {
dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_DISABLED);
+ chan->ec_state->status.mode = ECHO_MODE_FAX;
}
if (events.NLP_auto_enabled) {
dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_ENABLED);
+ chan->ec_state->status.mode = ECHO_MODE_ACTIVE;
}
}
@@ -6744,7 +6748,7 @@
putlin[x] = DAHDI_XLAW(rxb[x], ms);
}
- if (ms->ec_state && ms->ec_state->status.NLP_enabled && !ms->ec_state->features.CED_rx_detect) {
+ if (ms->ec_state && (ms->ec_state->status.mode == ECHO_MODE_ACTIVE) && !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, "CED rx detected");
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c?view=diff&rev=6424&r1=6423&r2=6424
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c Tue Apr 21 12:26:57 2009
@@ -169,7 +169,6 @@
/* Non-linear processor - a fancy way to say "zap small signals, to avoid
accumulating noise". */
pvt->use_nlp = TRUE;
- pvt->dahdi.status.NLP_enabled = 1;
*ec = &pvt->dahdi;
return 0;
@@ -326,7 +325,6 @@
struct ec_pvt *pvt = dahdi_to_pvt(ec);
pvt->use_nlp = enable ? 1 : 0;
- pvt->dahdi.status.NLP_enabled = enable;
}
static int __init mod_init(void)
Modified: linux/team/kpfleming/echocan_work/include/dahdi/kernel.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/include/dahdi/kernel.h?view=diff&rev=6424&r1=6423&r2=6424
==============================================================================
--- linux/team/kpfleming/echocan_work/include/dahdi/kernel.h (original)
+++ linux/team/kpfleming/echocan_work/include/dahdi/kernel.h Tue Apr 21 12:26:57 2009
@@ -184,8 +184,7 @@
/*! If the echocan will automatically disable itself (or even just its NLP) based on
* detection of a CED tone in either direction, this feature flag should be set (along
- * with the tone detection feature flags). When the disable/enable occurs, the
- * status.NLP_enabled field of the dahdi_echocan_state structure should be updated.
+ * with the tone detection feature flags).
*/
u32 NLP_automatic:1;
};
@@ -279,6 +278,7 @@
ECHO_MODE_AWAITINGECHO = 3 | __ECHO_MODE_MUTE,
ECHO_MODE_TRAINING = 4 | __ECHO_MODE_MUTE,
ECHO_MODE_ACTIVE = 5,
+ ECHO_MODE_FAX = 6,
};
/*! An instance of a DAHDI echo canceler (software or hardware). */
@@ -303,9 +303,6 @@
struct dahdi_echocan_features features;
struct {
- /*! Whether the echocan's NLP is currently enabled or disabled. */
- u32 NLP_enabled:1;
-
/*! The mode the echocan is currently in. */
enum dahdi_echocan_mode mode;
@@ -327,16 +324,14 @@
struct {
/*! CED tone was detected in the transmit direction. If the
* echocan automatically disables its NLP when this occurs,
- * it must also signal the NLP_auto_disabled event and
- * set the status.NLP_enabled flag to zero during the *same*
+ * it must also signal the NLP_auto_disabled event during the *same*
* call to echocan_array_update that reports the CED detection.
*/
u32 CED_tx_detected:1;
/*! CED tone was detected in the receive direction. If the
* echocan automatically disables its NLP when this occurs,
- * it must also signal the NLP_auto_disabled event and
- * set the status.NLP_enabled flag to zero during the *same*
+ * it must also signal the NLP_auto_disabled event during the *same*
* call to echocan_array_update that reports the CED detection.
*/
u32 CED_rx_detected:1;
@@ -347,17 +342,11 @@
/*! CNG tone was detected in the receive direction. */
u32 CNG_rx_detected:1;
- /*! The echocan disabled its NLP automatically. The echocan
- * must also set the status.NLP_enabled flag to zero during
- * the *same* call to echocan_array_update that reports the
- * NLP disablement.
+ /*! The echocan disabled its NLP automatically.
*/
u32 NLP_auto_disabled:1;
- /*! The echocan enabled its NLP automatically. The echocan
- * must also set the status.NLP_enabled flag to non-zero during
- * the *same* call to echocan_array_update that reports the
- * NLP enablement.
+ /*! The echocan enabled its NLP automatically.
*/
u32 NLP_auto_enabled:1;
};
More information about the dahdi-commits
mailing list