[dahdi-commits] kpfleming: branch linux/kpfleming/modular_ec r4390 - in /linux/team/kpfleming...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Jun 18 11:28:37 CDT 2008


Author: kpfleming
Date: Wed Jun 18 10:01:47 2008
New Revision: 4390

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4390
Log:
save some work in progress

Added:
    linux/team/kpfleming/modular_ec/
      - copied from r4388, linux/trunk/
    linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c
      - copied, changed from r4388, linux/trunk/drivers/dahdi/jpah.h
Removed:
    linux/team/kpfleming/modular_ec/drivers/dahdi/jpah.h
Modified:
    linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild
    linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c
    linux/team/kpfleming/modular_ec/include/dahdi/kernel.h

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=4390&r1=4388&r2=4390
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild Wed Jun 18 10:01:47 2008
@@ -23,6 +23,8 @@
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_PCIRADIO)		+= pciradio.o
 
 obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP)		+= xpp/
+
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_JPAH)	+= dahdi_echocan_jpah.o
 
 CFLAGS_MODULE += -I$(src)
 EXTRA_CFLAGS += $(ECHO_CAN_CFLAGS)

Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c?view=diff&rev=4390&r1=4388&r2=4390
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c Wed Jun 18 10:01:47 2008
@@ -141,6 +141,9 @@
 EXPORT_SYMBOL(dahdi_register_chardev);
 EXPORT_SYMBOL(dahdi_unregister_chardev);
 
+EXPORT_SYMBOL(dahdi_register_echocan);
+EXPORT_SYMBOL(dahdi_unregister_echocan);
+
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *proc_entries[DAHDI_MAX_SPANS]; 
 #endif
@@ -331,7 +334,6 @@
 
 #define NUM_SIGS	10	
 
-
 /* Echo cancellation */
 #if defined(ECHO_CAN_HPEC)
 #include "hpec/hpec_dahdi.h"
@@ -347,6 +349,21 @@
 #include "jpah.h"
 #endif
 
+struct echocan {
+	struct dahdi_echocan *ec;
+	struct module *owner;
+	struct echocan *next;
+};
+
+int dahdi_register_echocan(struct dahdi_echocan *ec, struct module *owner)
+{
+	return -1;
+}
+
+void dahdi_unregister_echocan(struct dahdi_echocan *ec)
+{
+}
+
 static inline void rotate_sums(void)
 {
 	/* Rotate where we sum and so forth */
@@ -361,26 +378,26 @@
   /* return quiescent (idle) signalling states, for the various signalling types */
 static int dahdi_q_sig(struct dahdi_chan *chan)
 {
-int	x;
-
-static unsigned int in_sig[NUM_SIGS][2] = {
-	{ DAHDI_SIG_NONE, 0},
-	{ DAHDI_SIG_EM, 0 | (DAHDI_ABIT << 8)},
-	{ DAHDI_SIG_FXSLS,DAHDI_BBIT | (DAHDI_BBIT << 8)},
-	{ DAHDI_SIG_FXSGS,DAHDI_ABIT | DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
-	{ DAHDI_SIG_FXSKS,DAHDI_BBIT | DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
-	{ DAHDI_SIG_FXOLS,0 | (DAHDI_ABIT << 8)},
-	{ DAHDI_SIG_FXOGS,DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
-	{ DAHDI_SIG_FXOKS,0 | (DAHDI_ABIT << 8)},
-	{ DAHDI_SIG_SF, 0},
-	{ DAHDI_SIG_EM_E1, DAHDI_DBIT | ((DAHDI_ABIT | DAHDI_DBIT) << 8) },
+	int	x;
+
+	static unsigned int in_sig[NUM_SIGS][2] = {
+		{ DAHDI_SIG_NONE, 0},
+		{ DAHDI_SIG_EM, 0 | (DAHDI_ABIT << 8)},
+		{ DAHDI_SIG_FXSLS,DAHDI_BBIT | (DAHDI_BBIT << 8)},
+		{ DAHDI_SIG_FXSGS,DAHDI_ABIT | DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
+		{ DAHDI_SIG_FXSKS,DAHDI_BBIT | DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
+		{ DAHDI_SIG_FXOLS,0 | (DAHDI_ABIT << 8)},
+		{ DAHDI_SIG_FXOGS,DAHDI_BBIT | ((DAHDI_ABIT | DAHDI_BBIT) << 8)},
+		{ DAHDI_SIG_FXOKS,0 | (DAHDI_ABIT << 8)},
+		{ DAHDI_SIG_SF, 0},
+		{ DAHDI_SIG_EM_E1, DAHDI_DBIT | ((DAHDI_ABIT | DAHDI_DBIT) << 8) },
 	} ;
-
+	
 	/* must have span to begin with */
 	if (!chan->span) return(-1);
-	  /* if RBS does not apply, return error */
+	/* if RBS does not apply, return error */
 	if (!(chan->span->flags & DAHDI_FLAG_RBS) || 
-		!chan->span->rbsbits) return(-1);
+	    !chan->span->rbsbits) return(-1);
 	if (chan->sig == DAHDI_SIG_CAS)
 		return chan->idlebits;
 	for (x=0;x<NUM_SIGS;x++) {

Copied: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c (from r4388, linux/trunk/drivers/dahdi/jpah.h)
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c?view=diff&rev=4390&p1=linux/trunk/drivers/dahdi/jpah.h&r1=4388&p2=linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c&r2=4390
==============================================================================
--- linux/trunk/drivers/dahdi/jpah.h (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_jpah.c Wed Jun 18 10:01:47 2008
@@ -1,5 +1,5 @@
 /*
- * ECHO_CAN_JP1
+ * ECHO_CAN_JPAH
  *
  * by Jason Parker
  *
@@ -16,89 +16,86 @@
  *
  */
 
-#ifndef _JP_ECHO_H
-#define _JP_ECHO_H
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ctype.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 <dahdi/kernel.h>
 
-/* Echo canceller definition */
 struct echo_can_state {
-	/* an arbitrary ID for this echo can - this really should be settable from the calling channel... */
-	int id;
-
-	/* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */
-	int i_d;
+	int blah;
 };
 
-static void echo_can_init(void)
+static int echo_can_create(struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p,
+			   struct echo_can_state **ec)
 {
-	printk("DAHDI Audio Hoser: JP1\n");
+	unsigned int x;
+	char *c;
+
+	if ((*ec = kmalloc(sizeof(**ec), GFP_KERNEL))) {
+		memset(ec, 0, sizeof(**ec));
+	}
+
+	for (x = 0; x < ecp->param_count; x++) {
+		for (c = p[x].name; *c; c++)
+			*c = tolower(*c);
+		printk(KERN_WARNING "Unknown parameter supplied to JPAH echo canceler: '%s'\n", p[x].name);
+		kfree(*ec);
+
+		return -EINVAL;
+	}
+
+	return 0;
 }
 
-static void echo_can_identify(char *buf, size_t len)
+static void echo_can_free(struct echo_can_state *ec)
 {
-	dahdi_copy_string(buf, "JP1", len);
+	kfree(ec);
 }
 
-static void echo_can_shutdown(void)
+static void echo_can_update(struct echo_can_state *ec, short *iref, short *isig) 
+{
+	unsigned int x;
+
+	for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
+		if (ec->blah < 2) {
+			ec->blah++;
+
+			*isig++ = 0;
+		} else {
+			ec->blah = 0;
+			
+			isig++;
+		}
+	}
+}
+
+static int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
+{
+	return 0;
+}
+
+static const struct dahdi_echocan me = {
+	.name = "JPAH",
+	.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)
 {
 }
 
-static inline void init_cc(struct echo_can_state *ec)
+static void __exit mod_exit(void)
 {
-	void *ptr = ec;
-	unsigned long tmp;
-	/* Double-word align past end of state */
-	ptr += sizeof(struct echo_can_state);
-	tmp = (unsigned long)ptr;
-	tmp += 3;
-	tmp &= ~3L;
-	ptr = (void *)tmp;
 }
 
-static inline void echo_can_free(struct echo_can_state *ec)
-{
-	FREE(ec);
-}
+MODULE_DESCRIPTION("DAHDI Jason Parker Audio Hoser");
+MODULE_AUTHOR("Jason Parker <jparker at digium.com>");
+MODULE_LICENSE("GPL");
 
-static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) 
-{
-	static int blah = 0;
-
-	if (blah < 2) {
-		blah++;
-		return 0;
-	} else {
-		blah = (blah + 1) % 3;
-		return isig;
-	}
-}
-
-static inline struct echo_can_state *echo_can_create(int len, int adaption_mode)
-{
-	struct echo_can_state *ec;
-	ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) + 4); /* align */
-	if (ec) {
-		memset(ec, 0, sizeof(struct echo_can_state) + 4); /* align */
-		init_cc(ec);
-	}
-	return ec;
-}
-
-static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val)
-{
-	return 0;
-}
-#endif
+module_init(mod_init);
+module_exit(mod_exit);

Modified: linux/team/kpfleming/modular_ec/include/dahdi/kernel.h
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/include/dahdi/kernel.h?view=diff&rev=4390&r1=4388&r2=4390
==============================================================================
--- linux/team/kpfleming/modular_ec/include/dahdi/kernel.h (original)
+++ linux/team/kpfleming/modular_ec/include/dahdi/kernel.h Wed Jun 18 10:01:47 2008
@@ -1,7 +1,7 @@
 /*
  * DAHDI Telephony Interface
  *
- * Written by Mark Spencer <markster at linux-suppot.net>
+ * Written by Mark Spencer <markster at linux-support.net>
  * Based on previous works, designs, and architectures conceived and
  * written by Jim Dixon <jim at lambdatel.com>.
  *
@@ -870,6 +870,20 @@
 	struct dahdi_echocanparam params[0];
 };
 
+/* Echo cancellation */
+struct echo_can_state;
+
+struct dahdi_echocan {
+	const char *name;
+	int (*echo_can_create)(struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p, struct echo_can_state **ec);
+	void (*echo_can_free)(struct echo_can_state *ec);
+	void (*echo_can_array_update)(struct echo_can_state *ec, short *iref, short *isig);
+	int (*echo_can_traintap)(struct echo_can_state *ec, int pos, short val);
+};
+
+int dahdi_register_echocan(struct dahdi_echocan *ec, struct module *owner);
+void dahdi_unregister_echocan(struct dahdi_echocan *ec);
+
 struct dahdi_tone_def_header {
 	int count;		/* How many samples follow */
 	int zone;		/* Which zone we are loading */
@@ -1167,20 +1181,6 @@
 	struct net_device *netdev;
 	struct dahdi_chan *chan;
 };
-#endif
-
-/* Echo cancellation */
-struct echo_can_state;
-#if 0
-/* echo can API consists of these functions */
-void echo_can_init(void);
-void echo_chan_shutdown(void);
-void echo_can_identify(char *buf, size_t len);
-int echo_can_create(struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p, struct echo_can_state **ec);
-void echo_can_free(struct echo_can_state *ec);
-short echo_can_update(struct echo_can_state *ec, short iref, short isig);
-void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig);
-int echo_can_traintap(struct echo_can_state *ec, int pos, short val);
 #endif
 
 /* Conference queue stucture */




More information about the dahdi-commits mailing list