[dahdi-commits] kpfleming: branch linux/kpfleming/modular_ec r4402 - in /linux/team/kpfleming...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Jun 18 20:27:09 CDT 2008
Author: kpfleming
Date: Wed Jun 18 20:27:09 2008
New Revision: 4402
URL: http://svn.digium.com/view/dahdi?view=rev&rev=4402
Log:
add echocan name to dahdi_chanconfig (will be used for selecting echocan for a channel)
move 'owner' field into struct dahdi_echocan so it can be used for releasing references
get HPEC module converted and buildable
Added:
linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/dahdi_echocan_hpec.c
- copied, changed from r4400, linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/hpec_dahdi.h
Removed:
linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/hpec_dahdi.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/drivers/dahdi/dahdi_echocan_jpah.c
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_kb1.c
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_mg2.c
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c
linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec2.c
linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/ (props changed)
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=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/Kbuild Wed Jun 18 20:27:09 2008
@@ -46,23 +46,25 @@
dahdi-objs := dahdi-base.o
+dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o
+CFLAGS_dahdi_echocan_hpec.o := -I$(src)/hpec
+
ifeq ($(ARCH),i386)
ifneq ($(wildcard $(src)/hpec/hpec_x86_32.o_shipped),)
HPEC_PRESENT=yes
-dahdi-objs += hpec/hpec_x86_32.o
+dahdi_echocan_hpec-objs += hpec/hpec_x86_32.o
endif
endif
ifeq ($(ARCH),x86_64)
ifneq ($(wildcard $(src)/hpec/hpec_x86_64.o_shipped),)
HPEC_PRESENT=yes
-dahdi-objs += hpec/hpec_x86_64.o
+dahdi_echocan_hpec-objs += hpec/hpec_x86_64.o
endif
endif
ifeq ($(HPEC_PRESENT),yes)
-EXTRA_CFLAGS += -DECHO_CAN_HPEC -I$(src)/hpec
-$(obj)/dahdi-base.o: $(src)/hpec/hpec_dahdi.h $(src)/hpec/hpec_user.h
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC) += dahdi_echocan_hpec.o
endif
$(obj)/pciradio.o: $(obj)/radfw.h
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=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c Wed Jun 18 20:27:09 2008
@@ -84,6 +84,8 @@
#include <dahdi/kernel.h>
#include <dahdi/user.h>
+#include "hpec/hpec_user.h"
+
/* Get helper arithmetic */
#include "arith.h"
#if defined(CONFIG_DAHDI_MMX) || defined(ECHO_CAN_FP)
@@ -145,6 +147,8 @@
EXPORT_SYMBOL(dahdi_register_echocan);
EXPORT_SYMBOL(dahdi_unregister_echocan);
+EXPORT_SYMBOL(dahdi_set_hpec_ioctl);
+
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_entries[DAHDI_MAX_SPANS];
#endif
@@ -344,7 +348,7 @@
struct list_head list;
};
-int dahdi_register_echocan(const struct dahdi_echocan *ec, struct module *owner)
+int dahdi_register_echocan(const struct dahdi_echocan *ec)
{
struct echocan *cur;
@@ -366,7 +370,6 @@
memset(cur, 0, sizeof(*cur));
cur->ec = ec;
- cur->owner = owner;
INIT_LIST_HEAD(&cur->list);
list_add_tail(&cur->list, &echocan_list);
@@ -3436,6 +3439,13 @@
dahdi_dynamic_ioctl = func;
}
+static int (*dahdi_hpec_ioctl)(unsigned int cmd, unsigned long data);
+
+void dahdi_set_hpec_ioctl(int (*func)(unsigned int cmd, unsigned long data))
+{
+ dahdi_hpec_ioctl = func;
+}
+
static void recalc_slaves(struct dahdi_chan *chan)
{
int x;
@@ -3885,19 +3895,24 @@
}
case DAHDI_DYNAMIC_CREATE:
case DAHDI_DYNAMIC_DESTROY:
- if (dahdi_dynamic_ioctl)
+ if (dahdi_dynamic_ioctl) {
return dahdi_dynamic_ioctl(cmd, data);
- else {
+ } else {
request_module("dahdi_dynamic");
if (dahdi_dynamic_ioctl)
return dahdi_dynamic_ioctl(cmd, data);
}
return -ENOSYS;
-#if defined(ECHO_CAN_HPEC)
case DAHDI_EC_LICENSE_CHALLENGE:
case DAHDI_EC_LICENSE_RESPONSE:
- return hpec_license_ioctl(cmd, data);
-#endif /* defined(ECHO_CAN_HPEC) */
+ if (dahdi_hpec_ioctl) {
+ return dahdi_hpec_ioctl(cmd, data);
+ } else {
+ request_module("dahdi_echocan_hpec");
+ if (dahdi_hpec_ioctl)
+ return dahdi_hpec_ioctl(cmd, data);
+ }
+ return -ENOSYS;
default:
return dahdi_common_ioctl(inode, file, cmd, data, 0);
}
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=4402&r1=4401&r2=4402
==============================================================================
--- 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 20:27:09 2008
@@ -95,6 +95,7 @@
static const struct dahdi_echocan me = {
.name = "JPAH",
+ .owner = THIS_MODULE,
.echo_can_create = echo_can_create,
.echo_can_free = echo_can_free,
.echo_can_array_update = echo_can_update,
@@ -103,7 +104,7 @@
static int __init mod_init(void)
{
- if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ if (dahdi_register_echocan(&me)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_kb1.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_kb1.c?view=diff&rev=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_kb1.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_kb1.c Wed Jun 18 20:27:09 2008
@@ -659,6 +659,7 @@
static const struct dahdi_echocan me = {
.name = "KB1",
+ .owner = THIS_MODULE,
.echo_can_create = echo_can_create,
.echo_can_free = echo_can_free,
.echo_can_array_update = echo_can_update,
@@ -667,7 +668,7 @@
static int __init mod_init(void)
{
- if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ if (dahdi_register_echocan(&me)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_mg2.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_mg2.c?view=diff&rev=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_mg2.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_mg2.c Wed Jun 18 20:27:09 2008
@@ -803,6 +803,7 @@
static const struct dahdi_echocan me = {
.name = "MG2",
+ .owner = THIS_MODULE,
.echo_can_create = echo_can_create,
.echo_can_free = echo_can_free,
.echo_can_array_update = echo_can_update,
@@ -811,7 +812,7 @@
static int __init mod_init(void)
{
- if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ if (dahdi_register_echocan(&me)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c?view=diff&rev=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec.c Wed Jun 18 20:27:09 2008
@@ -302,6 +302,7 @@
static const struct dahdi_echocan me = {
.name = "SEC",
+ .owner = THIS_MODULE,
.echo_can_create = echo_can_create,
.echo_can_free = echo_can_free,
.echo_can_array_update = echo_can_update,
@@ -310,7 +311,7 @@
static int __init mod_init(void)
{
- if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ if (dahdi_register_echocan(&me)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec2.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec2.c?view=diff&rev=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec2.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi_echocan_sec2.c Wed Jun 18 20:27:09 2008
@@ -308,6 +308,7 @@
static const struct dahdi_echocan me = {
.name = "SEC2",
+ .owner = THIS_MODULE,
.echo_can_create = echo_can_create,
.echo_can_free = echo_can_free,
.echo_can_array_update = echo_can_update,
@@ -316,7 +317,7 @@
static int __init mod_init(void)
{
- if (dahdi_register_echocan(&me, THIS_MODULE)) {
+ if (dahdi_register_echocan(&me)) {
module_printk(KERN_ERR, "could not register with DAHDI core\n");
return -EPERM;
Propchange: linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun 18 20:27:09 2008
@@ -1,2 +1,3 @@
*.o_shipped
+*.o.cmd
LICENSE
Copied: linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/dahdi_echocan_hpec.c (from r4400, linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/hpec_dahdi.h)
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/dahdi_echocan_hpec.c?view=diff&rev=4402&p1=linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/hpec_dahdi.h&r1=4400&p2=linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/dahdi_echocan_hpec.c&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/hpec_dahdi.h (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/hpec/dahdi_echocan_hpec.c Wed Jun 18 20:27:09 2008
@@ -1,14 +1,13 @@
/*
* DAHDI Telephony Interface to Digium High-Performance Echo Canceller
*
- * Copyright (C) 2006 Digium, Inc.
+ * Copyright (C) 2006-2008 Digium, Inc.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,10 +19,19 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if !defined(_HPEC_DAHDI_H)
-#define _HPEC_DAHDI_H
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ctype.h>
+#include <linux/moduleparam.h>
-#define DAHDI_EC_ARRAY_UPDATE
+#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 "hpec_user.h"
#include "hpec.h"
@@ -59,28 +67,12 @@
kfree(ptr);
}
-static void echo_can_init(void)
-{
- printk("DAHDI Echo Canceller: Digium High-Performance Echo Canceller\n");
- hpec_init(logger, debug, DAHDI_CHUNKSIZE, memalloc, memfree);
-}
-
-static void echo_can_identify(char *buf, size_t len)
-{
- dahdi_copy_string(buf, "HPEC", len);
-}
-
-static void echo_can_shutdown(void)
-{
- hpec_shutdown();
-}
-
-static inline void echo_can_free(struct echo_can_state *ec)
+static void echo_can_free(struct echo_can_state *ec)
{
hpec_channel_free(ec);
}
-static inline void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig)
+static void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig)
{
hpec_channel_update(ec, iref, isig);
}
@@ -143,4 +135,46 @@
}
}
-#endif /* !defined(_HPEC_DAHDI_H) */
+static const struct dahdi_echocan me = {
+ .name = "HPEC",
+ .owner = THIS_MODULE,
+ .echo_can_create = echo_can_create,
+ .echo_can_free = echo_can_free,
+ .echo_can_array_update = echo_can_array_update,
+ .echo_can_traintap = echo_can_traintap,
+};
+
+static int __init mod_init(void)
+{
+ if (dahdi_register_echocan(&me)) {
+ module_printk(KERN_ERR, "could not register with DAHDI core\n");
+
+ return -EPERM;
+ }
+
+ module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", me.name);
+
+ hpec_init(logger, debug, DAHDI_CHUNKSIZE, memalloc, memfree);
+
+ dahdi_set_hpec_ioctl(hpec_license_ioctl);
+
+ return 0;
+}
+
+static void __exit mod_exit(void)
+{
+ dahdi_unregister_echocan(&me);
+
+ dahdi_set_hpec_ioctl(NULL);
+
+ hpec_shutdown();
+}
+
+module_param(debug, int, S_IRUGO | S_IWUSR);
+
+MODULE_DESCRIPTION("DAHDI High Performance Echo Canceller");
+MODULE_AUTHOR("Kevin P. Fleming <kpfleming at digium.com>");
+MODULE_LICENSE("Digium Commercial");
+
+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=4402&r1=4401&r2=4402
==============================================================================
--- linux/team/kpfleming/modular_ec/include/dahdi/kernel.h (original)
+++ linux/team/kpfleming/modular_ec/include/dahdi/kernel.h Wed Jun 18 20:27:09 2008
@@ -252,13 +252,14 @@
typedef struct dahdi_chanconfig
{
int chan; /* Channel we're applying this to (0 to use name) */
-char name[40]; /* Name of channel to use */
+char name[40]; /* Name of channel to use */
int sigtype; /* Signal type */
-int deflaw; /* Default law (DAHDI_LAW_DEFAULT, DAHDI_LAW_MULAW, or DAHDI_LAW_ALAW */
+int deflaw; /* Default law (DAHDI_LAW_DEFAULT, DAHDI_LAW_MULAW, or DAHDI_LAW_ALAW) */
int master; /* Master channel if sigtype is DAHDI_SLAVE */
int idlebits; /* Idle bits (if this is a CAS channel) or
channel to monitor (if this is DACS channel) */
-char netdev_name[16]; /*name for the hdlc network device*/
+char netdev_name[16];/* name for the hdlc network device*/
+char echocan[16]; /* echo canceler to use on this channel */
} DAHDI_CHANCONFIG;
typedef struct dahdi_sfconfig
@@ -875,13 +876,14 @@
struct dahdi_echocan {
const char *name;
+ struct module *owner;
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(const struct dahdi_echocan *ec, struct module *owner);
+int dahdi_register_echocan(const struct dahdi_echocan *ec);
void dahdi_unregister_echocan(const struct dahdi_echocan *ec);
struct dahdi_tone_def_header {
@@ -1758,6 +1760,9 @@
/* Used by dynamic DAHDI -- don't use directly */
void dahdi_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data));
+/* Used by DAHDI HPEC module -- don't use directly */
+void dahdi_set_hpec_ioctl(int (*func)(unsigned int cmd, unsigned long data));
+
/* Used privately by DAHDI. Avoid touching directly */
struct dahdi_tone {
int fac1;
More information about the dahdi-commits
mailing list