/*
* Zapata Telephony Interface Driver
*
* Written by Mark Spencer <markster@linux-support.net>
* Based on previous works, designs, and architectures conceived and
* written by Jim Dixon <jim@lambdatel.com>.
*
* Special thanks to Steve Underwood <steve@coppice.org>
* for substantial contributions to signal processing functions
* in zaptel and the zapata library.
*
* Yury Bokhoncovich <byg@cf1.ru>
* Adaptation for 2.4.20+ kernels (HDLC API was changed)
* The work has been performed as a part of our move
* from Cisco 3620 to IBM x305 here in F1 Group
*
* Copyright (C) 2001 Jim Dixon / Zapata Telephony.
* Copyright (C) 2001 Linux Support Services, 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: zaptel1.c 2959 2007-03-30 04:02:22Z cooloney $
*/
#include "zconfig.h"
#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>
#include <linux/kmod.h>
#ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h>
#endif /* CONFIG_DEVFS_FS */
#ifdef CONFIG_ZAPATA_NET
#include <linux/netdevice.h>
#endif /* CONFIG_ZAPATA_NET */
#include <linux/ppp_defs.h>
#ifdef CONFIG_ZAPATA_PPP
#include <linux/netdevice.h>
#include <linux/if.h>
#include <linux/if_ppp.h>
#endif
#ifndef CONFIG_OLD_HDLC_API
#define NEW_HDLC_INTERFACE
#endif
#define __ECHO_STATE_MUTE (1 << 8)
#define ECHO_STATE_IDLE (0)
#define ECHO_STATE_PRETRAINING (1 | (__ECHO_STATE_MUTE))
#define ECHO_STATE_STARTTRAINING (2 | (__ECHO_STATE_MUTE))
#define ECHO_STATE_AWAITINGECHO (3 | (__ECHO_STATE_MUTE))
#define ECHO_STATE_TRAINING (4 | (__ECHO_STATE_MUTE))
#define ECHO_STATE_ACTIVE (5)
/* #define BUF_MUNGE */
/* Grab fasthdlc with tables */
#define FAST_HDLC_NEED_TABLES
#include "fasthdlc.h"
#define STANDALONE_ZAPATA
#ifdef STANDALONE_ZAPATA
#include "zaptel.h"
#else
#include <linux/zaptel.h>
#endif
#ifdef LINUX26
#include <linux/moduleparam.h>
#endif
/* Get helper arithmetic */
#include "arith.h"
#if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP)
#include <asm/i387.h>
#endif
#define hdlc_to_ztchan(h) (((struct zt_hdlc *)(h))->chan)
#define dev_to_ztchan(h) (((struct zt_hdlc *)(dev_to_hdlc(h)->priv))->chan)
#ifdef LINUX26
#define ztchan_to_dev(h) ((h)->hdlcnetdev->netdev)
#else
#define ztchan_to_dev(h) (&((h)->hdlcnetdev->netdev.netdev))
#endif
/* macro-oni for determining a unit (channel) number */
#define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev)
/* 0 -- not print debug info; 1 -- print debug info */
#define CONFIG_ZAPATA_DEBUG 0
/* names of tx level settings */
static char *zt_txlevelnames[] = {
"0 db (CSU)/0-133 feet (DSX-1)",
"133-266 feet (DSX-1)",
"266-399 feet (DSX-1)",
"399-533 feet (DSX-1)",
"533-655 feet (DSX-1)",
"-7.5db (CSU)",
"-15db (CSU)",
"-22.5db (CSU)"
} ;
EXPORT_SYMBOL(zt_init_tone_state);
EXPORT_SYMBOL(zt_dtmf_tone);
EXPORT_SYMBOL(zt_register);
EXPORT_SYMBOL(zt_unregister);
EXPORT_SYMBOL(__zt_mulaw);
EXPORT_SYMBOL(__zt_alaw);
#ifdef CONFIG_CALC_XLAW
EXPORT_SYMBOL(__zt_lineartoulaw);
EXPORT_SYMBOL(__zt_lineartoalaw);
#else
EXPORT_SYMBOL(__zt_lin2mu);
EXPORT_SYMBOL(__zt_lin2a);
#endif
EXPORT_SYMBOL(zt_lboname);
EXPORT_SYMBOL(zt_transmit);
EXPORT_SYMBOL(zt_receive);
EXPORT_SYMBOL(zt_rbsbits);
EXPORT_SYMBOL(zt_qevent_nolock);
EXPORT_SYMBOL(zt_qevent_lock);
EXPORT_SYMBOL(zt_hooksig);
EXPORT_SYMBOL(zt_alarm_notify);
EXPORT_SYMBOL(zt_set_dynamic_ioctl);
EXPORT_SYMBOL(zt_ec_chunk);
EXPORT_SYMBOL(zt_ec_span);
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_entries[ZT_MAX_SPANS];
#endif
/* Here are a couple important little additions for devfs */
#ifdef CONFIG_DEVFS_FS
static devfs_handle_t zaptel_devfs_dir;
static devfs_handle_t channel;
static devfs_handle_t pseudo;
static devfs_handle_t ctl;
static devfs_handle_t timer;
#endif
/* udev necessary data structures. Yeah! */
#ifdef CONFIG_ZAP_UDEV
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
static struct class *zap_class = NULL;
#else
static struct class_simple *zap_class = NULL;
#define class_create class_simple_create
#define class_destroy class_simple_destroy
#define class_device_create class_simple_device_add
#define class_device_destroy(a, b) class_simple_device_remove(b)
#endif
#endif
/* There is a table like this in the PPP driver, too */
static int deftaps = 64;
static
__u16 fcstab[256] =
{
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
static int debug;
/* states for transmit signalling */
typedef enum {ZT_TXSTATE_ONHOOK,ZT_TXSTATE_OFFHOOK,ZT_TXSTATE_START,
ZT_TXSTATE_PREWINK,ZT_TXSTATE_WINK,ZT_TXSTATE_PREFLASH,
ZT_TXSTATE_FLASH,ZT_TXSTATE_DEBOUNCE,ZT_TXSTATE_AFTERSTART,
ZT_TXSTATE_RINGON,ZT_TXSTATE_RINGOFF,ZT_TXSTATE_KEWL,
ZT_TXSTATE_AFTERKEWL,ZT_TXSTATE_PULSEBREAK,ZT_TXSTATE_PULSEMAKE,
ZT_TXSTATE_PULSEAFTER
} ZT_TXSTATE_t;
typedef short sumtype[ZT_MAX_CHUNKSIZE];
static sumtype sums[(ZT_MAX_CONF + 1) * 3];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
#define CLASS_DEV_CREATE(class, devt, device, name) \
class_device_create(class, NULL, devt, device, name)
#else
#define CLASS_DEV_CREATE(class, devt, device, name) \
class_device_create(class, devt, device, name)
#endif
/* Translate conference aliases into actual conferences
and vice-versa */
s
没有合适的资源?快使用搜索试试~ 我知道了~
zaptel-uclinux
需积分: 0 15 下载量 99 浏览量
2009-01-03
11:13:47
上传
评论
收藏 511KB GZ 举报
温馨提示
共101个文件
c:46个
h:30个
swp:2个
在Blackfin处理器上移植的zaptel构架的TDM400p 板卡驱动
资源推荐
资源详情
资源评论
收起资源包目录
zaptel-uclinux (101个子文件)
] 72KB
zaptel1.c 185KB
zaptel.c 185KB
zaptel-old.c 185KB
wct4xxp.c 79KB
wcfxs.c 72KB
tor2.c 44KB
wcte11xp.c 43KB
wcfxsusb.c 38KB
wcusb.c 38KB
wct1xxp.c 34KB
torisa.c 33KB
tor2ee.c 29KB
wcfxo.c 26KB
bfsi-spi-framework.c 24KB
ztcfg-dude.c 22KB
ztcfg.c 22KB
bfsi.c 21KB
zonedata.c 19KB
ztdynamic.c 19KB
sethdlc-new.c 15KB
zttool.c 13KB
ztd-eth.c 9KB
sethdlc.c 9KB
ztmonitor.c 9KB
wct4xxp-diag.c 8KB
tonezone.c 8KB
hdlctest.c 7KB
ztdummy.c 6KB
hdlcstress.c 6KB
gendigits.c 4KB
fxstest.c 3KB
fxsdump.c 3KB
hdlcgen.c 3KB
patlooptest.c 2KB
hdlcverify.c 2KB
makefw.c 2KB
pattest.c 2KB
torisatool.c 2KB
patgen.c 2KB
usbfxstest.c 2KB
zttest.c 2KB
timertest.c 1KB
genconst.c 875B
ztspeed.c 555B
ztdiag.c 527B
mksine.c 346B
mknotch.cc 5KB
complex.cc 2KB
ChangeLog 1KB
checkstack 2KB
zaptel.conf 5KB
README.fxsusb 510B
zaptel.h 41KB
sec-2.h 14KB
fasthdlc.h 11KB
mec2.h 10KB
sec.h 9KB
mec.h 8KB
arith.h 8KB
tor2-hw.h 6KB
mec3.h 6KB
mec3-float.h 5KB
proslic.h 4KB
ecdis.h 4KB
fir.h 4KB
wcusb.h 4KB
ztdummy.h 3KB
tones.h 3KB
zconfig.h 3KB
tonezone.h 3KB
biquad.h 2KB
wcfxs.h 1KB
complex.h 1KB
mkfilter.h 1KB
torisa.h 1KB
digits.h 1KB
wct4xxp.h 1KB
wcfxsusb.h 1KB
ztcfg.h 933B
mec2_const.h 573B
bfsi.h 489B
bittest.h 60B
ifcfg-hdlc0 87B
ifup-hdlc 818B
zaptel.init 2KB
Kconfig 1KB
LICENSE 18KB
README.Linux26 517B
Makefile 124B
Makefile-old 1KB
tormenta2.rbt 563KB
README 2KB
zaptel.conf.sample 5KB
.wcfxs.c.swp 16KB
.wcfxo.c.swp 16KB
zaptel.sysconfig 25B
tags 275KB
tormenta2.ucf 6KB
README.udev 2KB
共 101 条
- 1
- 2
资源评论
逆流老鱼
- 粉丝: 15
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功