diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-10-29 15:21:58 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-10-29 15:21:58 +0000 |
commit | c9bc9503a0a580f2663ffd19e0ba4712e89813eb (patch) | |
tree | ed33558df68c8f9ae19de3331d62896875f9e5ba /zaptel.c | |
parent | 7f5c6e162a9c5ff654115136ccc6783a67749a72 (diff) |
Version 0.3.2 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@125 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-x | zaptel.c | 150 |
1 files changed, 142 insertions, 8 deletions
@@ -33,6 +33,7 @@ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/module.h> +#include <linux/proc_fs.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/version.h> @@ -108,6 +109,10 @@ EXPORT_SYMBOL(zt_alarm_notify); EXPORT_SYMBOL(zt_set_dynamic_ioctl); EXPORT_SYMBOL(zt_ec_chunk); +#ifdef CONFIG_PROC_FS +static struct proc_dir_entry *zaptel_proc_entry; +#endif + /* Here are a couple important little additions for devfs */ #ifdef CONFIG_DEVFS_FS static devfs_handle_t zaptel_devfs_dir; @@ -1310,7 +1315,7 @@ static ssize_t zt_chan_write(struct file *file, const char *usrbuf, size_t count return -EINVAL; for(;;) { spin_lock_irqsave(&chan->lock, flags); - if (chan->curtone) { + if (chan->curtone && !(chan->flags & ZT_FLAG_PSEUDO)) { chan->curtone = NULL; chan->tonep = 0; chan->txdialbuf[0] = '\0'; @@ -2280,6 +2285,15 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c (int) mychan.ec, mychan.echocancel, mychan.deflaw, (int) mychan.xlaw); printk("itimer: %d, otimer: %d\n\n", mychan.itimer,mychan.otimer); +#if 0 + if (mychan.ec) { + int x; + /* Dump the echo canceller parameters */ + for (x=0;x<mychan.ec->taps;x++) { + printk("tap %d: %d\n", x, mychan.ec->fir_taps[x]); + } + } +#endif break; default: return -ENOTTY; @@ -4189,15 +4203,23 @@ void zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char { short rxlin; int x; - + long flags; + spin_lock_irqsave(&ss->lock, flags); /* Perform echo cancellation on a chunk if necessary */ - if (!ss->ec) - return; - for (x=0;x<ZT_CHUNKSIZE;x++) { - rxlin = ZT_XLAW(rxchunk[x], ss); - rxlin = echo_can_update(ss->ec, ZT_XLAW(txchunk[x], ss), rxlin); - rxchunk[x] = ZT_LIN2X((int)rxlin, ss); + if (ss->ec) { +#ifdef CONFIG_ZAPTEL_MMX + kernel_fpu_begin(); +#endif + for (x=0;x<ZT_CHUNKSIZE;x++) { + rxlin = ZT_XLAW(rxchunk[x], ss); + rxlin = echo_can_update(ss->ec, ZT_XLAW(txchunk[x], ss), rxlin); + rxchunk[x] = ZT_LIN2X((int)rxlin, ss); + } +#ifdef CONFIG_ZAPTEL_MMX + kernel_fpu_end(); +#endif } + spin_unlock_irqrestore(&ss->lock, flags); } static inline void zt_process_putaudio_chunk(struct zt_chan *ss, unsigned char *rxb) @@ -4906,6 +4928,111 @@ int zt_receive(struct zt_span *span) return 0; } +#ifdef CONFIG_PROC_FS +static char *sigstr(int sig) +{ + switch (sig) { + case ZT_SIG_FXSLS: + return "FXSLS"; + case ZT_SIG_FXSKS: + return "FXSKS"; + case ZT_SIG_FXSGS: + return "FXSGS"; + case ZT_SIG_FXOLS: + return "FXOLS"; + case ZT_SIG_FXOKS: + return "FXOKS"; + case ZT_SIG_FXOGS: + return "FXOGS"; + case ZT_SIG_EM: + return "E&M"; + case ZT_SIG_CLEAR: + return "ClearChannel"; + case ZT_SIG_HDLCRAW: + return "HDLCRAW"; + case ZT_SIG_HDLCFCS: + return "HDLCFCS"; + case ZT_SIG_HDLCNET: + return "HDLCNET"; + case ZT_SIG_SLAVE: + return "Slave"; + case ZT_SIG_CAS: + return "CAS"; + case ZT_SIG_NONE: + default: + return "Unconfigured"; + } + +} + +static int zaptel_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int x, oldspan = 0, len = 0; + + for (x=1;x<ZT_MAX_CHANNELS;x++) { + if (chans[x]) { + if (chans[x]->span->spanno != oldspan) { + len += sprintf(page + len, "Span %d: %s \"%s\"", x, spans[x]->name, spans[x]->desc); + /* framing first */ + if (chans[x]->span->lineconfig & ZT_CONFIG_B8ZS) + len += sprintf(page + len, " B8ZS/"); + else if (chans[x]->span->lineconfig & ZT_CONFIG_AMI) + len += sprintf(page + len, " AMI/"); + else if (chans[x]->span->lineconfig & ZT_CONFIG_HDB3) + len += sprintf(page + len, " HDB3/"); + /* then coding */ + if (chans[x]->span->lineconfig & ZT_CONFIG_ESF) + len += sprintf(page + len, "ESF"); + else if (chans[x]->span->lineconfig & ZT_CONFIG_D4) + len += sprintf(page + len, "D4"); + else if (chans[x]->span->lineconfig & ZT_CONFIG_CCS) + len += sprintf(page + len, "CCS"); + /* E1's can enable CRC checking */ + if (chans[x]->span->lineconfig & ZT_CONFIG_CRC4) + len += sprintf(page + len, "/CRC4"); + + len += sprintf(page + len, " "); + + /* list alarms */ + if (chans[x]->span->alarms > 0) { + if (chans[x]->span->alarms & ZT_ALARM_BLUE) + len += sprintf(page + len, "BLUE "); + if (chans[x]->span->alarms & ZT_ALARM_YELLOW) + len += sprintf(page + len, "YELLOW "); + if (chans[x]->span->alarms & ZT_ALARM_RED) + len += sprintf(page + len, "RED "); + if (chans[x]->span->alarms & ZT_ALARM_LOOPBACK) + len += sprintf(page + len, "LOOP "); + if (chans[x]->span->alarms & ZT_ALARM_RECOVER) + len += sprintf(page + len, "RECOVERING "); + if (chans[x]->span->alarms & ZT_ALARM_NOTOPEN) + len += sprintf(page + len, "NOTOPEN "); + + } + + if (chans[x]->span->syncsrc == chans[x]->span->spanno) + len += sprintf(page + len, "ClockSource "); + len += sprintf(page + len, "\n"); + oldspan = chans[x]->span->spanno; + } + + len += sprintf(page + len, "\t%d %s ", x, chans[x]->name ); + if (chans[x]->sig == ZT_SIG_SLAVE) + len += sprintf(page + len, "%s", sigstr(chans[x]->master->sig)); + else { + len += sprintf(page + len, "%s", sigstr(chans[x]->sig)); + if (chans[x]->nextslave && chans[x]->master->channo == x) + len += sprintf(page + len, "Master "); + } + len += sprintf(page + len, "\n"); + + } + } + + return len; +} +#endif + MODULE_AUTHOR("Mark Spencer <markster@linux-support.net>"); MODULE_DESCRIPTION("Zapata Telephony Interface"); #ifdef MODULE_LICENSE @@ -4932,6 +5059,9 @@ static struct file_operations zt_fops = { static int __init zt_init(void) { int res = 0; +#ifdef CONFIG_PROC_FS + zaptel_proc_entry = create_proc_read_entry("zaptel", 0444, NULL , zaptel_proc_read, NULL); +#endif #ifdef CONFIG_DEVFS_FS { umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO; @@ -4961,6 +5091,10 @@ static int __init zt_init(void) { static void __exit zt_cleanup(void) { int x; +#ifdef CONFIG_PROC_FS + remove_proc_entry("zaptel", NULL); +#endif + printk(KERN_INFO "Zapata Telephony Interface Unloaded\n"); for (x=0;x<ZT_TONE_ZONE_MAX;x++) if (tone_zones[x]) |