[dahdi-commits] kpfleming: branch linux/kpfleming/echocan_work r6361 - in /linux/team/kpflemi...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Apr 14 12:22:36 CDT 2009
Author: kpfleming
Date: Tue Apr 14 12:22:33 2009
New Revision: 6361
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6361
Log:
more documentation and cleanup
Modified:
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_jpah.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_oslec.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec2.c
linux/team/kpfleming/echocan_work/drivers/dahdi/hpec/dahdi_echocan_hpec.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=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi-base.c Tue Apr 14 12:22:33 2009
@@ -1251,7 +1251,7 @@
chan->span->dacs(chan, NULL);
if (ec_state) {
- ec_state->owner->echocan_free(ec_state);
+ ec_state->ops->echocan_free(ec_state);
release_echocan(ec_current);
}
@@ -2561,7 +2561,7 @@
}
if (ec_state) {
- ec_state->owner->echocan_free(ec_state);
+ ec_state->ops->echocan_free(ec_state);
release_echocan(ec_current);
}
@@ -4875,7 +4875,7 @@
chan->echotimer = 0;
spin_unlock_irqrestore(&chan->lock, flags);
if (ec_state) {
- ec_state->owner->echocan_free(ec_state);
+ ec_state->ops->echocan_free(ec_state);
release_echocan(ec_current);
}
hw_echocancel_off(chan);
@@ -4908,7 +4908,7 @@
chan->ec_current = NULL;
spin_unlock_irqrestore(&chan->lock, flags);
if (ec_state) {
- ec_state->owner->echocan_free(ec_state);
+ ec_state->ops->echocan_free(ec_state);
release_echocan(ec_current);
}
@@ -5057,7 +5057,7 @@
spin_unlock_irqrestore(&chan->lock, flags);
if (ec_state) {
- ec_state->owner->echocan_free(ec_state);
+ ec_state->ops->echocan_free(ec_state);
release_echocan(ec_current);
}
@@ -5736,14 +5736,14 @@
{
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);
- chan->ec_state->owner->echocan_NLP_toggle(chan->ec_state, 0);
+ 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);
chan->echocancel = 0;
chan->echostate = ECHO_STATE_IDLE;
chan->echolastupdate = 0;
chan->echotimer = 0;
- chan->ec_state->owner->echocan_free(chan->ec_state);
+ chan->ec_state->ops->echocan_free(chan->ec_state);
chan->ec_state = NULL;
release_echocan(chan->ec_current);
chan->ec_current = NULL;
@@ -6610,7 +6610,7 @@
ss->echostate = ECHO_STATE_TRAINING;
}
if (ss->echostate == ECHO_STATE_TRAINING) {
- if (ss->ec_state->owner->echocan_traintap(ss->ec_state, ss->echolastupdate++, rxlin)) {
+ if (ss->ec_state->ops->echocan_traintap(ss->ec_state, ss->echolastupdate++, rxlin)) {
#if 0
module_printk(KERN_NOTICE, "Finished training (%d taps trained)!\n", ss->echolastupdate);
#endif
@@ -6627,7 +6627,7 @@
txlins[x] = DAHDI_XLAW(txchunk[x], ss);
}
ss->ec_state->events.all = 0;
- ss->ec_state->owner->echocan_array_update(ss->ec_state, rxlins, txlins, DAHDI_CHUNKSIZE);
+ ss->ec_state->ops->echocan_array_update(ss->ec_state, rxlins, txlins, DAHDI_CHUNKSIZE);
if (ss->ec_state->events.all) {
process_echocan_events(ss);
}
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_jpah.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_jpah.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_jpah.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_jpah.c Tue Apr 14 12:22:33 2009
@@ -52,7 +52,7 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -79,7 +79,7 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
+ pvt->dahdi.ops = &my_ops;
*ec = &pvt->dahdi;
return 0;
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c Tue Apr 14 12:22:33 2009
@@ -154,7 +154,7 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -650,7 +650,7 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
+ pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c Tue Apr 14 12:22:33 2009
@@ -186,7 +186,7 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -791,7 +791,7 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
+ pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_oslec.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_oslec.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_oslec.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_oslec.c Tue Apr 14 12:22:33 2009
@@ -49,7 +49,7 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -97,7 +97,7 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
+ pvt->dahdi.ops = &my_ops;
pvt->oslec = oslec_create(ecp->tap_length, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP | ECHO_CAN_USE_CLIP | ECHO_CAN_USE_TX_HPF | ECHO_CAN_USE_RX_HPF);
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=6361&r1=6360&r2=6361
==============================================================================
--- 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 14 12:22:33 2009
@@ -93,11 +93,11 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_features sec_features = {
+static const struct dahdi_echocan_features my_features = {
.NLP_toggle = 1,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -153,8 +153,8 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
- pvt->dahdi.features = sec_features;
+ pvt->dahdi.ops = &my_ops;
+ pvt->dahdi.features = my_features;
pvt->taps = ecp->tap_length;
pvt->tap_mask = ecp->tap_length - 1;
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec2.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec2.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec2.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_sec2.c Tue Apr 14 12:22:33 2009
@@ -88,7 +88,7 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -143,7 +143,7 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
+ pvt->dahdi.ops = &my_ops;
if (ecp->param_count > 0) {
printk(KERN_WARNING "SEC-2 echo canceler does not support parameters; failing request\n");
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/hpec/dahdi_echocan_hpec.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/hpec/dahdi_echocan_hpec.c?view=diff&rev=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/hpec/dahdi_echocan_hpec.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/hpec/dahdi_echocan_hpec.c Tue Apr 14 12:22:33 2009
@@ -48,13 +48,13 @@
.echocan_create = echo_can_create,
};
-static const struct dahdi_echocan_features hpec_features = {
+static const struct dahdi_echocan_features my_features = {
.NLP_automatic = 1,
.CED_tx_detect = 1,
.CED_rx_detect = 1,
};
-static const struct dahdi_echocan_ops me = {
+static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
@@ -129,8 +129,8 @@
return -ENOMEM;
}
- pvt->dahdi.owner = &me;
- pvt->dahdi.features = hpec_features;
+ pvt->dahdi.ops = &my_ops;
+ pvt->dahdi.features = my_features;
if (down_interruptible(&alloc_lock))
return -ENOTTY;
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=6361&r1=6360&r2=6361
==============================================================================
--- linux/team/kpfleming/echocan_work/include/dahdi/kernel.h (original)
+++ linux/team/kpfleming/echocan_work/include/dahdi/kernel.h Tue Apr 14 12:22:33 2009
@@ -150,7 +150,7 @@
struct dahdi_echocan_state;
-/*! Features a DAHDI echo canceler (software or hardware) can provide to the DAHDI core */
+/*! Features a DAHDI echo canceler (software or hardware) can provide to the DAHDI core. */
struct dahdi_echocan_features {
/*! Able to detect CED tone (2100 Hz with phase reversals) in the transmit direction.
@@ -219,8 +219,8 @@
* \param[in] pos The tap position to be 'trained'.
* \param[in] val The receive direction sample for the specified tap position.
*
- * \retval zero if training should continue
- * \retval non-zero if training is complete
+ * \retval Zero if training should continue.
+ * \retval Non-zero if training is complete.
*/
int (*echocan_traintap)(struct dahdi_echocan_state *ec, int pos, short val);
@@ -233,18 +233,47 @@
void (*echocan_NLP_toggle)(struct dahdi_echocan_state *ec, unsigned int enable);
};
+/*! A factory for creating instances of software echo cancelers to be used on DAHDI channels. */
struct dahdi_echocan_factory {
+
+ /*! The name of the factory. */
const char *name;
+
+ /*! Pointer to the module that owns this factory; the module's reference count will be
+ * incremented/decremented by the DAHDI core as needed.
+ */
struct module *owner;
+
+ /*! \brief Function to create an instance of the echocan.
+ * \param[in] ecp Structure defining parameters to be used for the instance creation.
+ * \param[in] p Pointer to the beginning of an (optional) array of user-defined parameters.
+ * \param[out] ec Pointer to the state structure that is created, if any.
+ *
+ * \retval Zero on success.
+ * \retval Non-zero on failure (return value will be returned to userspace so it should be a
+ * standard error number).
+ */
int (*echocan_create)(struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
};
+/*! \brief Register an echo canceler factory with the DAHDI core.
+ * \param[in] ec Pointer to the dahdi_echocan_factory structure to be registered.
+ *
+ * \retval Zero on success.
+ * \retval Non-zero on failure (return value will be a standard error number).
+ */
int dahdi_register_echocan_factory(const struct dahdi_echocan_factory *ec);
+/*! \brief Unregister a previously-registered echo canceler factory from the DAHDI core.
+ * \param[in] ec Pointer to the dahdi_echocan_factory structure to be unregistered.
+ *
+ * \return Nothing.
+ */
void dahdi_unregister_echocan_factory(const struct dahdi_echocan_factory *ec);
+/*! An instance of a DAHDI echo canceler (software or hardware). */
struct dahdi_echocan_state {
- const struct dahdi_echocan_ops *owner;
+ const struct dahdi_echocan_ops *ops;
echo_can_disable_detector_state_t txecdis;
echo_can_disable_detector_state_t rxecdis;
struct dahdi_echocan_features features;
More information about the dahdi-commits
mailing list