[svn-commits] kpfleming: branch linux/kpfleming/modular_ec r4394 - /linux/team/kpfleming/mo...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 18 16:16:33 CDT 2008
Author: kpfleming
Date: Wed Jun 18 16:16:32 2008
New Revision: 4394
URL: http://svn.digium.com/view/dahdi?view=rev&rev=4394
Log:
convert sec.h to a module
Added:
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c
- copied, changed from r4392, linux/team/kpfleming/modular_ec/drivers/dahdi/sec.h
Removed:
linux/team/kpfleming/modular_ec/drivers/dahdi/sec.h
Modified:
linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild?view=diff&rev=4394&r1=4393&r2=4394
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild Wed Jun 18 16:16:32 2008
@@ -25,6 +25,7 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP) += xpp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_JPAH) += dahdi_echocan_jpah.o
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_STEVE) += dahdi_echocan_sec.o
CFLAGS_MODULE += -I$(src)
EXTRA_CFLAGS += $(ECHO_CAN_CFLAGS)
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c?view=diff&rev=4394&r1=4393&r2=4394
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c Wed Jun 18 16:16:32 2008
@@ -71,7 +71,7 @@
kfree(ec);
}
-static void echo_can_update(struct echo_can_state *ec, short *iref, short *isig)
+static void echo_can_update(struct echo_can_state *ec, short *iref, short *isig)
{
unsigned int x;
Copied: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c (from r4392, linux/team/kpfleming/modular_ec/drivers/dahdi/sec.h)
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c?view=diff&rev=4394&p1=linux/team/kpfleming/modular_ec/drivers/dahdi/sec.h&r1=4392&p2=linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c&r2=4394
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/sec.h (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c Wed Jun 18 16:16:32 2008
@@ -37,22 +37,20 @@
Improve double talk detector (iterative!)
*/
-#ifndef _DAHDI_SEC_H
-#define _DAHDI_SEC_H
-
-#ifdef __KERNEL__
#include <linux/kernel.h>
#include <linux/slab.h>
-#define MALLOC(a) kmalloc((a), GFP_KERNEL)
-#define FREE(a) kfree(a)
-#else
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <string.h>
-#define MALLOC(a) malloc(a)
-#define FREE(a) free(a)
-#endif
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ctype.h>
+#include <linux/moduleparam.h>
+
+#include <dahdi/kernel.h>
+
+static int debug;
+
+#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
+#define debug_printk(level, fmt, args...) if (debug >= level) printk("%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
#include "arith.h"
@@ -100,23 +98,6 @@
was skipped, for test purposes */
};
-static void echo_can_init(void)
-{
- printk("DAHDI Echo Canceller: STEVE%s\n", DAHDI_ECHO_AGGRESSIVE);
-}
-
-static void echo_can_identify(char *buf, size_t len)
-{
- dahdi_copy_string(buf, "STEVE", len);
-}
-
-static void echo_can_shutdown(void)
-{
-}
-
-static void echo_can_free(struct echo_can_state *ec);
-static int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx);
-
/* Original parameters :
#define MIN_TX_POWER_FOR_ADAPTION 256
#define MIN_RX_POWER_FOR_ADAPTION 128
@@ -142,7 +123,7 @@
size = sizeof(**ec) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t);
- if (!(*ec = MALLOC(size)))
+ if (!(*ec = kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
memset(*ec, 0, size);
@@ -165,13 +146,13 @@
}
/*- End of function --------------------------------------------------------*/
-static inline void echo_can_free(struct echo_can_state *ec)
-{
- FREE(ec);
-}
-/*- End of function --------------------------------------------------------*/
-
-static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
+static void echo_can_free(struct echo_can_state *ec)
+{
+ kfree(ec);
+}
+/*- End of function --------------------------------------------------------*/
+
+static inline int16_t sample_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
{
int32_t echo_value;
int clean_rx;
@@ -292,7 +273,19 @@
}
/*- End of function --------------------------------------------------------*/
-static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
+static void echo_can_update(struct echo_can_state *ec, short *iref, short *isig)
+{
+ unsigned int x;
+ short result;
+
+ for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
+ result = sample_update(ec, *iref, *isig);
+ *isig++ = result;
+ }
+}
+/*- End of function --------------------------------------------------------*/
+
+static int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
{
/* Reset hang counter to avoid adjustments after
initial forced training */
@@ -305,6 +298,37 @@
return 1;
return 0;
}
-
-/*- End of file ------------------------------------------------------------*/
-#endif
+/*- End of function --------------------------------------------------------*/
+
+static const struct dahdi_echocan me = {
+ .name = "STEVE",
+ .echo_can_create = echo_can_create,
+ .echo_can_free = echo_can_free,
+ .echo_can_array_update = echo_can_update,
+ .echo_can_traintap = echo_can_traintap,
+};
+
+static int __init mod_init(void)
+{
+ if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ module_printk(KERN_ERR, "could not register with DAHDI core");
+
+ return -EPERM;
+ }
+
+ return 0;
+}
+
+static void __exit mod_exit(void)
+{
+ dahdi_unregister_echocan(&me);
+}
+
+module_param(debug, int, S_IRUGO | S_IWUSR);
+
+MODULE_DESCRIPTION("DAHDI 'STEVE' Echo Canceler");
+MODULE_AUTHOR("Steve Underwood <steveu at coppice.org>");
+MODULE_LICENSE("GPL");
+
+module_init(mod_init);
+module_exit(mod_exit);
More information about the svn-commits
mailing list