[svn-commits] kpfleming: branch linux/kpfleming/echocan_work r6365 - in /linux/team/kpflemi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Apr 14 14:16:07 CDT 2009


Author: kpfleming
Date: Tue Apr 14 14:16:04 2009
New Revision: 6365

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6365
Log:
generate events to userspace when tones are detected, if the echocan is disabled, or if the NLP is disabled or enabled


Modified:
    linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c
    linux/team/kpfleming/echocan_work/include/dahdi/kernel.h
    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=6365&r1=6364&r2=6365
==============================================================================
--- 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:16:04 2009
@@ -5736,9 +5736,11 @@
 {
 	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;
@@ -5767,6 +5769,7 @@
 		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");
+				dahdi_qevent_nolock(ms, DAHDI_EVENT_TX_CED_DETECTED);
 				break;
 			}
 		}
@@ -6558,19 +6561,44 @@
 
 static void process_echocan_events(struct dahdi_chan *chan)
 {
-	if (chan->ec_state->events.CED_tx_detected) {
-		if (chan->ec_state->status.NLP_enabled) {
-			set_echocan_fax_mode(chan, chan->channo, "tx");
-		} else {
-			module_printk(KERN_NOTICE, "Detected CED tone (tx) on channel %d\n", chan->channo);
-		}
-	}
-	if (chan->ec_state->events.CED_rx_detected) {
-		if (chan->ec_state->status.NLP_enabled) {
-			set_echocan_fax_mode(chan, chan->channo, "rx");
-		} else {
-			module_printk(KERN_NOTICE, "Detected CED tone (rx) on channel %d\n", chan->channo);
-		}
+	union dahdi_echocan_events events = chan->ec_state->events;
+
+	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) {
+				set_echocan_fax_mode(chan, chan->channo, "tx");
+			} else {
+				module_printk(KERN_NOTICE, "Detected CED tone (tx) on channel %d\n", chan->channo);
+			}
+		}
+	}
+
+	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) {
+				set_echocan_fax_mode(chan, chan->channo, "rx");
+			} else {
+				module_printk(KERN_NOTICE, "Detected CED tone (rx) on channel %d\n", chan->channo);
+			}
+		}
+	}
+
+	if (events.CNG_tx_detected) {
+		dahdi_qevent_nolock(chan, DAHDI_EVENT_TX_CNG_DETECTED);
+	}
+
+	if (events.CNG_rx_detected) {
+		dahdi_qevent_nolock(chan, DAHDI_EVENT_RX_CNG_DETECTED);
+	}
+
+	if (events.NLP_auto_disabled) {
+		dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_DISABLED);
+	}
+
+	if (events.NLP_auto_enabled) {
+		dahdi_qevent_nolock(chan, DAHDI_EVENT_EC_NLP_ENABLED);
 	}
 }
 
@@ -6729,6 +6757,7 @@
 		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");
+				dahdi_qevent_nolock(ms, DAHDI_EVENT_RX_CED_DETECTED);
 				break;
 			}
 		}

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=6365&r1=6364&r2=6365
==============================================================================
--- linux/team/kpfleming/echocan_work/include/dahdi/kernel.h (original)
+++ linux/team/kpfleming/echocan_work/include/dahdi/kernel.h Tue Apr 14 14:16:04 2009
@@ -303,7 +303,7 @@
 	 * instance may report events, so the structure should be cleared before
 	 * calling that operation.
 	 */
-	union {
+	union dahdi_echocan_events {
 		__u32 all;
 		struct {
 			/*! CED tone was detected in the transmit direction. If the

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=6365&r1=6364&r2=6365
==============================================================================
--- linux/team/kpfleming/echocan_work/include/dahdi/user.h (original)
+++ linux/team/kpfleming/echocan_work/include/dahdi/user.h Tue Apr 14 14:16:04 2009
@@ -406,6 +406,24 @@
 
 /* No neon MWI pulses were detected over some period of time */
 #define DAHDI_EVENT_NEONMWI_INACTIVE	22
+
+/* A CED tone was detected on the channel in the transmit direction */
+#define DAHDI_EVENT_TX_CED_DETECTED	23
+
+/* A CED tone was detected on the channel in the receive direction */
+#define DAHDI_EVENT_RX_CED_DETECTED	24
+
+/* A CNG tone was detected on the channel in the transmit direction */
+#define DAHDI_EVENT_TX_CNG_DETECTED	25
+
+/* A CNG tone was detected on the channel in the receive direction */
+#define DAHDI_EVENT_RX_CNG_DETECTED	26
+
+/* The echo canceler's NLP (only) was disabled */
+#define DAHDI_EVENT_EC_NLP_DISABLED	27
+
+/* The echo canceler's NLP (only) was enabled */
+#define DAHDI_EVENT_EC_NLP_ENABLED	28
 
 #define DAHDI_EVENT_PULSEDIGIT		(1 << 16)	/* This is OR'd with the digit received */
 #define DAHDI_EVENT_DTMFDOWN		(1 << 17)	/* Ditto for DTMF key down event */




More information about the svn-commits mailing list