⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zaptel.h

📁 This a SOFTWARE pbx DRIVER
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Zapata Telephony Interface * * Written by Mark Spencer <markster@linux-suppot.net> * Based on previous works, designs, and architectures conceived and * written by Jim Dixon <jim@lambdatel.com>. * * 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: zaptel.h,v 1.38 2004/09/27 19:50:03 markster Exp $ */#ifndef _LINUX_ZAPTEL_H#define _LINUX_ZAPTEL_H#ifdef __KERNEL__#include "zconfig.h"#include <linux/config.h>#include <linux/version.h>#ifdef CONFIG_ZAPATA_NET	#include <linux/hdlc.h>#endif#ifdef CONFIG_ZAPATA_PPP#include <linux/ppp_channel.h>#include <linux/skbuff.h>#include <linux/interrupt.h>#endif#include <linux/fs.h>#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)#define LINUX26#endif#include "ecdis.h"#include "fasthdlc.h"#endif#ifdef CONFIG_DEVFS_FS#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)#include <linux/devfs_fs_kernel.h>#else#undef CONFIG_DEVFS_FS//#warning "Zaptel doesn't support DEVFS in post 2.4 kernels.  Disabling DEVFS in zaptel"#endif#endif /* CONFIG_DEVFS_FS */#include <linux/ioctl.h>#ifndef ELAST#define ELAST 500#endif/* Per-span configuration values */#define	ZT_CONFIG_TXLEVEL	7	/* bits 0-2 are tx level *//* Line configuration *//* These apply to T1 */#define ZT_CONFIG_D4	 (1 << 4)	#define ZT_CONFIG_ESF	 (1 << 5)#define ZT_CONFIG_AMI	 (1 << 6)#define ZT_CONFIG_B8ZS 	 (1 << 7)/* These apply to E1 */#define	ZT_CONFIG_CCS	 (1 << 8)	/* CCS (ISDN) instead of CAS (Robbed Bit) */#define	ZT_CONFIG_HDB3	 (1 << 9)	/* HDB3 instead of AMI (line coding) */#define	ZT_CONFIG_CRC4   (1 << 10)	/* CRC4 framing */#define ZT_CONFIG_NOTOPEN (1 << 16)/* Signalling types */#define __ZT_SIG_FXO	 (1 << 12)	/* Never use directly */#define __ZT_SIG_FXS	 (1 << 13)	/* Never use directly */#define ZT_SIG_NONE		(0)			/* Channel not configured */#define ZT_SIG_FXSLS	((1 << 0) | __ZT_SIG_FXS)	/* FXS, Loopstart */#define ZT_SIG_FXSGS	((1 << 1) | __ZT_SIG_FXS)	/* FXS, Groundstart */#define ZT_SIG_FXSKS	((1 << 2) | __ZT_SIG_FXS)	/* FXS, Kewlstart */#define ZT_SIG_FXOLS	((1 << 3) | __ZT_SIG_FXO)	/* FXO, Loopstart */#define ZT_SIG_FXOGS	((1 << 4) | __ZT_SIG_FXO)	/* FXO, Groupstart */#define ZT_SIG_FXOKS	((1 << 5) | __ZT_SIG_FXO)	/* FXO, Kewlstart */#define ZT_SIG_EM	(1 << 6)		/* Ear & Mouth (E&M) *//* The following are all variations on clear channel */#define __ZT_SIG_DACS	 (1 << 16)#define ZT_SIG_CLEAR	 (1 << 7)					/* Clear channel */#define ZT_SIG_HDLCRAW	((1 << 8)  | ZT_SIG_CLEAR)	/* Raw unchecked HDLC */#define ZT_SIG_HDLCFCS	((1 << 9)  | ZT_SIG_HDLCRAW)	/* HDLC with FCS calculation */#define ZT_SIG_HDLCNET	((1 << 10) | ZT_SIG_HDLCFCS)	/* HDLC Network */#define ZT_SIG_SLAVE	 (1 << 11) 					/* Slave to another channel */#define	ZT_SIG_SF	 (1 << 14)			/* Single Freq. tone only, no sig bits */#define ZT_SIG_CAS	 (1 << 15)			/* Just get bits */#define ZT_SIG_DACS	(__ZT_SIG_DACS | ZT_SIG_CLEAR)	/* Cross connect */#define ZT_SIG_EM_E1	 (1 << 17)			/* E1 E&M Variation */#define ZT_SIG_DACS_RBS	 ((1 << 18) | __ZT_SIG_DACS)	/* Cross connect w/ RBS *//* tone flag values */#define	ZT_REVERSE_RXTONE 1  /* reverse polarity rx tone logic */#define	ZT_REVERSE_TXTONE 2  /* reverse polarity tx tone logic */#define ZT_ABIT			8#define ZT_BBIT			4#define	ZT_CBIT			2#define	ZT_DBIT			1#define ZT_MAJOR	196#define ZT_CODE	'J'/* Default chunk size for conferences and such -- static right now, might make   variable sometime.  8 samples = 1 ms = most frequent service interval possible   for a USB device */#define ZT_CHUNKSIZE		 8#define ZT_MIN_CHUNKSIZE	 ZT_CHUNKSIZE#define ZT_DEFAULT_CHUNKSIZE	 ZT_CHUNKSIZE#define ZT_MAX_CHUNKSIZE 	 ZT_CHUNKSIZE#define ZT_CB_SIZE		 2#define ZT_MAX_BLOCKSIZE 	 8192#define ZT_DEFAULT_NUM_BUFS	 2#define ZT_MAX_NUM_BUFS		 32#define ZT_MAX_BUF_SPACE         32768#define ZT_DEFAULT_BLOCKSIZE 1024#define ZT_DEFAULT_MTR_MRU	 2048#define ZT_POLICY_IMMEDIATE	 0		/* Start play/record immediately */#define ZT_POLICY_WHEN_FULL  1		/* Start play/record when buffer is full */#define	RING_DEBOUNCE_TIME	2000	/* 2000 ms ring debounce time */#ifdef __KERNEL__/* Echo cancellation */#if defined(ECHO_CAN_STEVE)#include "sec.h"#elif defined(ECHO_CAN_STEVE2)#include "sec-2.h"#elif defined(ECHO_CAN_MARK)#include "mec.h"#elif defined(ECHO_CAN_MARK2)#include "mec2.h"#else#include "mec3.h"#endif#endiftypedef struct zt_params{int channo;		/* Channel number */int spanno;		/* Span itself */int chanpos;	/* Channel number in span */int	sigtype;  /* read-only */int sigcap;	 /* read-only */int rxisoffhook; /* read-only */int rxbits;	/* read-only */int txbits;	/* read-only */int txhooksig;	/* read-only */int rxhooksig;	/* read-only */int curlaw;	/* read-only  -- one of ZT_LAW_MULAW or ZT_LAW_ALAW */int idlebits;	/* read-only  -- What is considered the idle state */char name[40];	/* Name of channel */int	prewinktime;int	preflashtime;int	winktime;int	flashtime;int	starttime;int	rxwinktime;int	rxflashtime;int	debouncetime;int	pulsebreaktime;int	pulsemaketime;int	pulseaftertime;} ZT_PARAMS;typedef struct zt_spaninfo{int	spanno;		/* span number (or -1 to use name) */char name[20];	/* Name of span */char desc[40];	/* Description of span */int	alarms;		/* alarms status */int	txlevel;	/* what TX level is set to */int	rxlevel;	/* current RX level */int	bpvcount;	/* current BPV count */int	crc4count;	/* current CRC4 error count */int	ebitcount;	/* current E-bit error count */int	fascount;	/* current FAS error count */int	irqmisses;	/* current IRQ misses */int	syncsrc;	/* span # of current sync source, or 0 for free run  */int	numchans;	/* number of configured channels on this span */int	totalchans;	/* total number of channels on the span */int	totalspans;	/* total number of zaptel spans in entire system */} ZT_SPANINFO;typedef struct zt_maintinfo{int	spanno;		/* span number 1-2 */int	command;	/* command */} ZT_MAINTINFO;typedef struct zt_confinfo{int	chan;		/* channel number, 0 for current */int	confno;		/* conference number */int	confmode;	/* conferencing mode */} ZT_CONFINFO;typedef struct zt_gains{int	chan;		/* channel number, 0 for current */unsigned char rxgain[256];	/* Receive gain table */unsigned char txgain[256];	/* Transmit gain table */} ZT_GAINS;typedef struct zt_lineconfig{int span;		/* Which span number (0 to use name) */char name[20];	/* Name of span to use */int	lbo;		/* line build-outs */int	lineconfig;	/* line config parameters (framing, coding) */int	sync;		/* what level of sync source we are */} ZT_LINECONFIG;typedef struct zt_chanconfig{int	chan;		/* Channel we're applying this to (0 to use name) */char name[40];		/* Name of channel to use */int	sigtype;	/* Signal type */int	deflaw;		/* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */int	master;		/* Master channel if sigtype is ZT_SLAVE */int	idlebits;	/* Idle bits (if this is a CAS channel) or			   channel to monitor (if this is DACS channel) */} ZT_CHANCONFIG;typedef struct zt_sfconfig{int	chan;		/* Channel we're applying this to (0 to use name) */char name[40];		/* Name of channel to use */long	rxp1;		/* receive tone det. p1 */long	rxp2;		/* receive tone det. p2 */long	rxp3;		/* receive tone det. p3 */int	txtone;		/* Tx tone factor */int	tx_v2;		/* initial v2 value */int	tx_v3;		/* initial v3 value */int	toneflag;	/* Tone flags */} ZT_SFCONFIG;typedef struct zt_bufferinfo{int txbufpolicy;	/* Policy for handling receive buffers */int rxbufpolicy;	/* Policy for handling receive buffers */int numbufs;		/* How many buffers to use */int bufsize;		/* How big each buffer is */int readbufs;		/* How many read buffers are full (read-only) */int writebufs;		/* How many write buffers are full (read-only) */} ZT_BUFFERINFO;typedef struct zt_dialparams{int mfv1_tonelen;	/* MF tone length (KP = this * 5/3) */int dtmf_tonelen;	/* DTMF tone length */int reserved[4];	/* Reserved for future expansion -- always set to 0 */} ZT_DIAL_PARAMS;typedef struct zt_dynamic_span {	char driver[20];	/* Which low-level driver to use */	char addr[40];		/* Destination address */	int numchans;		/* Number of channels */	int timing;		/* Timing source preference */	int spanno;		/* Span number (filled in by zaptel) */} ZT_DYNAMIC_SPAN;/* Define the max # of outgoing DTMF or MFv1 digits to queue in-kernel */#define ZT_MAX_DTMF_BUF 256#define ZT_DIAL_OP_APPEND	1#define ZT_DIAL_OP_REPLACE	2#define ZT_DIAL_OP_CANCEL	3#define ZT_LAW_DEFAULT	0	/* Default law for span */#define ZT_LAW_MULAW	1	/* Mu-law */#define ZT_LAW_ALAW	2	/* A-law */typedef struct zt_dialoperation{int op;char dialstr[ZT_MAX_DTMF_BUF];} ZT_DIAL_OPERATION;/* ioctl definitions */#define ZT_CODE	'J'/* * Get Transfer Block Size. */#define ZT_GET_BLOCKSIZE	_IOR (ZT_CODE, 1, int)/* * Set Transfer Block Size. */#define ZT_SET_BLOCKSIZE	_IOW (ZT_CODE, 2, int)/* * Flush Buffer(s) and stop I/O */#define	ZT_FLUSH		_IOW (ZT_CODE, 3, int)/* * Wait for Write to Finish */#define	ZT_SYNC		_IOW (ZT_CODE, 4, int)/* * Get channel parameters */#define ZT_GET_PARAMS		_IOR (ZT_CODE, 5, struct zt_params)/* * Get channel parameters */#define ZT_SET_PARAMS		_IOW (ZT_CODE, 6, struct zt_params)/* * Set Hookswitch Status */#define ZT_HOOK		_IOW (ZT_CODE, 7, int)/* * Get Signalling Event */#define ZT_GETEVENT		_IOR (ZT_CODE, 8, int)/* * Wait for something to happen (IO Mux) */#define ZT_IOMUX		_IOWR (ZT_CODE, 9, int)/* * Get Span Status */#define ZT_SPANSTAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo)/* * Set Maintenance Mode */#define ZT_MAINT		_IOW (ZT_CODE, 11, struct zt_maintinfo)/* * Get Conference Mode */#define ZT_GETCONF		_IOWR (ZT_CODE, 12, struct zt_confinfo)/* * Set Conference Mode */#define ZT_SETCONF		_IOWR (ZT_CODE, 13, struct zt_confinfo)/* * Setup or Remove Conference Link */#define ZT_CONFLINK		_IOW (ZT_CODE, 14, struct zt_confinfo)/* * Display Conference Diagnostic Information on Console */#define ZT_CONFDIAG		_IOR (ZT_CODE, 15, int)/* * Get Channel audio gains */#define ZT_GETGAINS		_IOWR (ZT_CODE, 16, struct zt_gains)/* * Set Channel audio gains */#define ZT_SETGAINS		_IOWR (ZT_CODE, 17, struct zt_gains)/* * Set Line (T1) Configurations and start system */#define	ZT_SPANCONFIG		_IOW (ZT_CODE, 18, struct zt_lineconfig)/* * Set Channel Configuration */#define	ZT_CHANCONFIG		_IOW (ZT_CODE, 19, struct zt_chanconfig)/* * Set Conference to mute mode */#define	ZT_CONFMUTE		_IOW (ZT_CODE, 20, int)/* * Send a particular tone (see ZT_TONE_*) */#define	ZT_SENDTONE		_IOW (ZT_CODE, 21, int)/* * Set your region for tones (see ZT_TONE_ZONE_*) */#define	ZT_SETTONEZONE		_IOW (ZT_CODE, 22, int)/* * Retrieve current region for tones (see ZT_TONE_ZONE_*) */#define	ZT_GETTONEZONE		_IOR (ZT_CODE, 23, int)/* * Master unit only -- set default zone (see ZT_TONE_ZONE_*) */#define	ZT_DEFAULTZONE		_IOW (ZT_CODE, 24, int)/* * Load a tone zone from a ZT_tone_def_header, see * below... */#define ZT_LOADZONE		_IOW (ZT_CODE, 25, struct zt_tone_def_header)/* * Free a tone zone  */#define ZT_FREEZONE		_IOW (ZT_CODE, 26, int)/* * Set buffer policy  */#define ZT_SET_BUFINFO		_IOW (ZT_CODE, 27, struct zt_bufferinfo)/* * Get current buffer info */#define ZT_GET_BUFINFO		_IOR (ZT_CODE, 28, struct zt_bufferinfo)/* * Get dialing parameters */#define ZT_GET_DIALPARAMS	_IOR (ZT_CODE, 29, struct zt_dialparams)/* * Set dialing parameters */#define ZT_SET_DIALPARAMS	_IOW (ZT_CODE, 30, struct zt_dialparams)/* * Append, replace, or cancel a dial string */#define ZT_DIAL			_IOW (ZT_CODE, 31, struct zt_dialoperation)/* * Set a clear channel into audio mode */#define ZT_AUDIOMODE		_IOW (ZT_CODE, 32, int)/* * Enable or disable echo cancellation on a channel  * The number is zero to disable echo cancellation and non-zero * to enable echo cancellation.  If the number is between 32 * and 256, it will also set the number of taps in the echo canceller */#define ZT_ECHOCANCEL		_IOW (ZT_CODE, 33, int)/* * Return a channel's channel number (useful for the /dev/zap/pseudo type interfaces  */#define ZT_CHANNO		_IOR (ZT_CODE, 34, int)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -