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

📄 zaptel.h

📁 This a SOFTWARE pbx DRIVER
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Return a flag indicating whether channel is currently dialing */#define ZT_DIALING		_IOR (ZT_CODE, 35, int)/* Numbers 60 to 90 are reserved for private use of low level hardware   drivers *//* * Set a clear channel into HDLC w/out FCS checking/calculation mode */#define ZT_HDLCRAWMODE		_IOW (ZT_CODE, 36, int)/* * Set a clear channel into HDLC w/ FCS mode */#define ZT_HDLCFCSMODE		_IOW (ZT_CODE, 37, int)/*  * Specify a channel on /dev/zap/chan -- must be done before any other ioctl's and is only * valid on /dev/zap/chan */#define ZT_SPECIFY		_IOW (ZT_CODE, 38, int)/* * Temporarily set the law on a channel to  * ZT_LAW_DEFAULT, ZT_LAW_ALAW, or ZT_LAW_MULAW.  Is reset on close.   */#define ZT_SETLAW		_IOW (ZT_CODE, 39, int)/* * Temporarily set the channel to operate in linear mode when non-zero * or default law if 0 */#define ZT_SETLINEAR		_IOW (ZT_CODE, 40, int)/* * Set a clear channel into HDLC w/ PPP interface mode */#define ZT_HDLCPPP		_IOW (ZT_CODE, 41, int)/* * Set the ring cadence for FXS interfaces */#define ZT_SETCADENCE		_IOW (ZT_CODE, 42, struct zt_ring_cadence)/* * Set the bits going out for CAS interface */#define ZT_SETTXBITS			_IOW (ZT_CODE, 43, int)/* * Display Channel Diagnostic Information on Console */#define ZT_CHANDIAG		_IOR (ZT_CODE, 44, int) /*  * Obtain received signalling */#define ZT_GETRXBITS _IOR (ZT_CODE, 45, int)/* * Set Channel's SF Tone Configuration */#define	ZT_SFCONFIG		_IOW (ZT_CODE, 46, struct zt_sfconfig)/* * Set timer expiration (in samples) */#define ZT_TIMERCONFIG	_IOW (ZT_CODE, 47, int)/* * Acknowledge timer expiration (number to acknowledge, or -1 for all) */#define ZT_TIMERACK _IOW (ZT_CODE, 48, int)/* * Get Conference to mute mode */#define	ZT_GETCONFMUTE		_IOR (ZT_CODE, 49, int)/* * Request echo training in some number of ms (with muting in the mean time) */#define	ZT_ECHOTRAIN		_IOW (ZT_CODE, 50, int)/* * Set on hook transfer for n number of ms -- implemnted by low level driver */#define	ZT_ONHOOKTRANSFER		_IOW (ZT_CODE, 51, int)/* * Queue Ping */#define ZT_TIMERPING _IOW (ZT_CODE, 42, int) /* Should be 52, but works *//* * Acknowledge ping */#define ZT_TIMERPONG _IOW (ZT_CODE, 53, int)/* * Set/get signalling freeze */#define ZT_SIGFREEZE _IOW (ZT_CODE, 54, int)#define ZT_GETSIGFREEZE _IOR (ZT_CODE, 55, int)/* *  60-80 are reserved for private drivers *  80-85 are reserved for dynamic span stuff *//* * Create a dynamic span */#define ZT_DYNAMIC_CREATE	_IOWR (ZT_CODE, 80, struct zt_dynamic_span)/*  * Destroy a dynamic span  */#define ZT_DYNAMIC_DESTROY	_IOW (ZT_CODE, 81, struct zt_dynamic_span)/*  * Startup or Shutdown a span */#define ZT_STARTUP		_IOW (ZT_CODE, 99, int)#define ZT_SHUTDOWN		_IOW (ZT_CODE, 100, int)#define ZT_TONE_ZONE_MAX		128#define ZT_TONE_ZONE_DEFAULT 	-1	/* To restore default */#define ZT_TONE_STOP		-1#define ZT_TONE_DIALTONE	0#define ZT_TONE_BUSY		1#define ZT_TONE_RINGTONE	2#define ZT_TONE_CONGESTION	3#define ZT_TONE_CALLWAIT	4#define ZT_TONE_DIALRECALL	5#define ZT_TONE_RECORDTONE	6#define ZT_TONE_INFO		7#define ZT_TONE_CUST1		8#define ZT_TONE_CUST2		9#define ZT_TONE_STUTTER		10#define ZT_TONE_MAX		16#define ZT_MAX_CADENCE		16struct zt_ring_cadence {	int ringcadence [ZT_MAX_CADENCE];};struct zt_tone_def_header {	int count;		/* How many samples follow */	int zone;		/* Which zone we are loading */	int ringcadence[ZT_MAX_CADENCE];	/* Ring cadence in ms (0=on, 1=off, ends with 0 value) */	char name[40];		/* Informational name of zone */	/* Immediately follow the ZT_tone_def_header by ZT_tone_def's */};struct zt_tone_def {		/* Structure for zone programming */	int tone;		/* See ZT_TONE_* */	int next;		/* What the next position in the cadence is				   (They're numbered by the order the appear here) */	int samples;		/* How many samples to play for this cadence */				/* Now come the constants we need to make tones */	int shift;		/* How much to scale down the volume (2 is nice) */	/* 		Calculate the next 6 factors using the following equations:		l = <level in dbm>, f1 = <freq1>, f2 = <freq2>		gain = pow(10.0, (l - 3.14) / 20.0) * 65536.0 / 2.0;		// Frequency factor 1 		fac_1 = 2.0 * cos(2.0 * M_PI * (f1/8000.0)) * 32768.0;		// Last previous two samples 		init_v2_1 = sin(-4.0 * M_PI * (f1/8000.0)) * gain;		init_v3_1 = sin(-2.0 * M_PI * (f1/8000.0)) * gain;		// Frequency factor 2 		fac_2 = 2.0 * cos(2.0 * M_PI * (f2/8000.0)) * 32768.0;		// Last previous two samples 		init_v2_2 = sin(-4.0 * M_PI * (f2/8000.0)) * gain;		init_v3_2 = sin(-2.0 * M_PI * (f2/8000.0)) * gain;	*/	int fac1;			int init_v2_1;			int init_v3_1;			int fac2;			int init_v2_2;			int init_v3_2;	int modulate;};#ifdef __KERNEL__#endif /* KERNEL *//* Define the maximum block size */#define	ZT_MAX_BLOCKSIZE	8192/* Define the default network block size */#define ZT_DEFAULT_MTU_MRU	2048/* Flush and stop the read (input) process */#define	ZT_FLUSH_READ		1/* Flush and stop the write (output) process */#define	ZT_FLUSH_WRITE		2/* Flush and stop both (input and output) processes */#define	ZT_FLUSH_BOTH		(ZT_FLUSH_READ | ZT_FLUSH_WRITE)/* Flush the event queue */#define	ZT_FLUSH_EVENT		4/* Flush everything */#define	ZT_FLUSH_ALL		(ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT)/* Value for ZT_HOOK, set to ON hook */#define	ZT_ONHOOK	0/* Value for ZT_HOOK, set to OFF hook */#define	ZT_OFFHOOK	1/* Value for ZT_HOOK, wink (off hook momentarily) */#define	ZT_WINK		2/* Value for ZT_HOOK, flash (on hook momentarily) */#define	ZT_FLASH	3/* Value for ZT_HOOK, start line */#define	ZT_START	4/* Value for ZT_HOOK, ring line (same as start line) */#define	ZT_RING		5/* Value for ZT_HOOK, turn ringer off */#define ZT_RINGOFF  6/* Ret. Value for GET/WAIT Event, no event */#define	ZT_EVENT_NONE	0/* Ret. Value for GET/WAIT Event, Went Onhook */#define	ZT_EVENT_ONHOOK 1/* Ret. Value for GET/WAIT Event, Went Offhook or got Ring */#define	ZT_EVENT_RINGOFFHOOK 2/* Ret. Value for GET/WAIT Event, Got Wink or Flash */#define	ZT_EVENT_WINKFLASH 3/* Ret. Value for GET/WAIT Event, Got Alarm */#define	ZT_EVENT_ALARM	4/* Ret. Value for GET/WAIT Event, Got No Alarm (after alarm) */#define	ZT_EVENT_NOALARM 5/* Ret. Value for GET/WAIT Event, HDLC Abort frame */#define ZT_EVENT_ABORT 6/* Ret. Value for GET/WAIT Event, HDLC Frame overrun */#define ZT_EVENT_OVERRUN 7/* Ret. Value for GET/WAIT Event, Bad FCS */#define ZT_EVENT_BADFCS 8/* Ret. Value for dial complete */#define ZT_EVENT_DIALCOMPLETE	9/* Ret Value for ringer going on */#define ZT_EVENT_RINGERON 10/* Ret Value for ringer going off */#define ZT_EVENT_RINGEROFF 11/* Ret Value for hook change complete */#define ZT_EVENT_HOOKCOMPLETE 12/* Ret Value for bits changing on a CAS / User channel */#define ZT_EVENT_BITSCHANGED 13/* Ret value for the beginning of a pulse coming on its way */#define ZT_EVENT_PULSE_START 14/* Timer event -- timer expired */#define ZT_EVENT_TIMER_EXPIRED	15/* Timer event -- ping ready */#define ZT_EVENT_TIMER_PING		16/* Polarity reversal event */#define ZT_EVENT_POLARITY  17#define ZT_EVENT_PULSEDIGIT (1 << 16)	/* This is OR'd with the digit received */#define ZT_EVENT_DTMFDIGIT  (1 << 17)	/* Ditto for DTMF *//* Flag Value for IOMUX, read avail */#define	ZT_IOMUX_READ	1/* Flag Value for IOMUX, write avail */#define	ZT_IOMUX_WRITE	2/* Flag Value for IOMUX, write done */#define	ZT_IOMUX_WRITEEMPTY	4/* Flag Value for IOMUX, signalling event avail */#define	ZT_IOMUX_SIGEVENT	8/* Flag Value for IOMUX, Do Not Wait if nothing to report */#define	ZT_IOMUX_NOWAIT	0x100/* Alarm Condition bits */#define	ZT_ALARM_NONE		0	/* No alarms */#define	ZT_ALARM_RECOVER	1	/* Recovering from alarm */#define	ZT_ALARM_LOOPBACK	2	/* In loopback */#define	ZT_ALARM_YELLOW		4	/* Yellow Alarm */#define	ZT_ALARM_RED		8	/* Red Alarm */#define	ZT_ALARM_BLUE		16	/* Blue Alarm */#define ZT_ALARM_NOTOPEN	32/* Maintenance modes */#define	ZT_MAINT_NONE		0	/* Normal Mode */#define	ZT_MAINT_LOCALLOOP	1	/* Local Loopback */#define	ZT_MAINT_REMOTELOOP	2	/* Remote Loopback */#define	ZT_MAINT_LOOPUP	3	/* send loopup code */#define	ZT_MAINT_LOOPDOWN	4	/* send loopdown code */#define	ZT_MAINT_LOOPSTOP	5	/* stop sending loop codes *//* Conference modes */#define	ZT_CONF_MODE_MASK 0xff		/* mask for modes */#define	ZT_CONF_NORMAL	0		/* normal mode */#define	ZT_CONF_MONITOR 1		/* monitor mode (rx of other chan) */#define	ZT_CONF_MONITORTX 2		/* monitor mode (tx of other chan) */#define	ZT_CONF_MONITORBOTH 3		/* monitor mode (rx & tx of other chan) */#define	ZT_CONF_CONF 4			/* conference mode */#define	ZT_CONF_CONFANN 5		/* conference announce mode */#define	ZT_CONF_CONFMON 6		/* conference monitor mode */#define	ZT_CONF_CONFANNMON 7		/* conference announce/monitor mode */#define	ZT_CONF_REALANDPSEUDO 8	/* real and pseudo port both on conf */#define ZT_CONF_DIGITALMON 9	/* Do not decode or interpret */#define	ZT_CONF_FLAG_MASK 0xff00	/* mask for flags */#define	ZT_CONF_LISTENER 0x100		/* is a listener on the conference */#define	ZT_CONF_TALKER 0x200		/* is a talker on the conference */#define	ZT_CONF_PSEUDO_LISTENER 0x400	/* pseudo is a listener on the conference */#define	ZT_CONF_PSEUDO_TALKER 0x800	/* pseudo is a talker on the conference */#define	ZT_DEFAULT_WINKTIME	150	/* 150 ms default wink time */#define	ZT_DEFAULT_FLASHTIME	750	/* 750 ms default flash time */#define	ZT_DEFAULT_PREWINKTIME	50	/* 50 ms before wink */#define	ZT_DEFAULT_PREFLASHTIME 50	/* 50 ms before flash */#define	ZT_DEFAULT_STARTTIME 1500	/* 1500 ms of start */#define	ZT_DEFAULT_RINGTIME 2000	/* 2000 ms of ring on (start, FXO) */#if 0#define	ZT_DEFAULT_RXWINKTIME 250	/* 250ms longest rx wink */#endif#define	ZT_DEFAULT_RXWINKTIME 300	/* 300ms longest rx wink (to work with the Atlas) */#define	ZT_DEFAULT_RXFLASHTIME 1250	/* 1250ms longest rx flash */#define	ZT_DEFAULT_DEBOUNCETIME 600	/* 600ms of FXS GS signalling debounce */#define	ZT_DEFAULT_PULSEMAKETIME 50	/* 50 ms of line closed when dial pulsing */#define	ZT_DEFAULT_PULSEBREAKTIME 50	/* 50 ms of line open when dial pulsing */#define	ZT_DEFAULT_PULSEAFTERTIME 750	/* 750ms between dial pulse digits */#define	ZT_MINPULSETIME (15 * 8)	/* 15 ms minimum */#define	ZT_MAXPULSETIME (150 * 8)	/* 150 ms maximum */#define	ZT_PULSETIMEOUT ((ZT_MAXPULSETIME / 8) + 50)#define ZT_RINGTRAILER (50 * 8)	/* Don't consider a ring "over" until it's been gone at least this									   much time */#define	ZT_LOOPCODE_TIME 10000		/* send loop codes for 10 secs */#define	ZT_ALARMSETTLE_TIME	5000	/* allow alarms to settle for 5 secs */#define	ZT_AFTERSTART_TIME 500		/* 500ms after start */#define ZT_RINGOFFTIME 4000		/* Turn off ringer for 4000 ms */#define	ZT_KEWLTIME 500		/* 500ms for kewl pulse */#define	ZT_AFTERKEWLTIME 300    /* 300ms after kewl pulse */#define ZT_MAX_PRETRAINING   1000	/* 1000ms max pretraining time */#define ZT_MAX_SPANS		128		/* Max, 128 spans */#define ZT_MAX_CHANNELS		1024	/* Max, 1024 channels */#define ZT_MAX_CONF			1024	/* Max, 1024 conferences */#ifdef __KERNEL__#include <linux/types.h>#include <linux/poll.h>#define	ZT_MAX_EVENTSIZE	64	/* 64 events max in buffer */struct zt_span;struct zt_chan;struct zt_tone_state {	int v1_1;	int v2_1;	int v3_1;	int v1_2;	int v2_2;	int v3_2;	int modulate;};#ifdef CONFIG_ZAPATA_NETstruct zt_hdlc {#ifdef LINUX26		struct net_device *netdev;#else	hdlc_device netdev;#endif	struct zt_chan *chan;};#endif/* Conference queue stucture */struct confq {	u_char buffer[ZT_CHUNKSIZE * ZT_CB_SIZE];	u_char *buf[ZT_CB_SIZE];	int inbuf;	int outbuf;};typedef struct{	long	x1;	long	x2;	long	y1;	long	y2;	long	e1;	long	e2;	int	samps;	int	lastdetect;} sf_detect_state_t;struct zt_chan {#ifdef CONFIG_ZAPATA_NET	/* Must be first */	struct zt_hdlc *hdlcnetdev;#endif#ifdef CONFIG_ZAPATA_PPP	struct ppp_channel *ppp;	struct tasklet_struct ppp_calls;	int do_ppp_wakeup;	int do_ppp_error;	struct sk_buff_head ppp_rq;#endif	spinlock_t lock;	char name[40];		/* Name */	/* Specified by zaptel */	int channo;			/* Zaptel Channel number */	int chanpos;	int flags;	long rxp1;	long rxp2;	long rxp3;	int txtone;	int tx_v2;	int tx_v3;	int v1_1;	int v2_1;	int v3_1;	int toneflags;	sf_detect_state_t rd;	struct zt_chan *master;	/* Our Master channel (could be us) */	/* Next slave (if appropriate) */	int nextslave;	u_char *writechunk;						/* Actual place to write to */	u_char swritechunk[ZT_MAX_CHUNKSIZE];	/* Buffer to be written */	u_char *readchunk;						/* Actual place to read from */	u_char sreadchunk[ZT_MAX_CHUNKSIZE];	/* Preallocated static area */		/* Pointer to tx and rx gain tables */	u_char *rxgain;	u_char *txgain;

⌨️ 快捷键说明

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