diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-06-19 18:53:18 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-06-19 18:53:18 +0000 |
commit | 85d82e003f9dd3cfbc8733a537746750dbd0e5e0 (patch) | |
tree | 8a8aa2ffbf957fd4a2b6a170c4bab456b0c586d6 /zaptel.h | |
parent | c63dd8597671fa41afb9fe9a1909ace27c6c447c (diff) |
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@85 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.h')
-rwxr-xr-x | zaptel.h | 107 |
1 files changed, 94 insertions, 13 deletions
@@ -38,7 +38,16 @@ #include <linux/ppp_channel.h> #endif #include <linux/fs.h> + +#if defined(ECHO_CAN_STEVE) #include "sec.h" +#elif defined(ECHO_CAN_STEVE2) +#include "sec-2.h" +#else +#include "mec.h" +#endif + +#include "ecdis.h" #include "fasthdlc.h" #endif #ifdef CONFIG_DEVFS_FS @@ -88,6 +97,7 @@ #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_CAS (1 << 12) /* Just get bits */ #define ZT_ABIT 8 #define ZT_BBIT 4 @@ -102,9 +112,10 @@ variable sometime. 8 samples = 1 ms = most frequent service interval possible for a USB device */ #define ZT_CHUNKSIZE 8 -#define ZT_MIN_CHUNKSIZE 8 -#define ZT_DEFAULT_CHUNKSIZE 8 -#define ZT_MAX_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 @@ -129,6 +140,7 @@ 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; @@ -175,7 +187,7 @@ unsigned char rxgain[256]; /* Receive gain table */ unsigned char txgain[256]; /* Transmit gain table */ } ZT_GAINS; -struct zt_lineconfig +typedef struct zt_lineconfig { int span; /* Which span number (0 to use name) */ char name[20]; /* Name of span to use */ @@ -184,13 +196,14 @@ int lineconfig; /* line config parameters (framing, coding) */ int sync; /* what level of sync source we are */ } ZT_LINECONFIG; -struct zt_chanconfig +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) */ } ZT_CHANCONFIG; typedef struct zt_bufferinfo @@ -456,6 +469,16 @@ char dialstr[ZT_MAX_DTMF_BUF]; #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) + +/* * 60-80 are reserved for private drivers * 80-85 are reserved for dynamic span stuff */ @@ -495,6 +518,10 @@ char dialstr[ZT_MAX_DTMF_BUF]; #define ZT_MAX_CADENCE 16 +struct 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 */ @@ -623,6 +650,9 @@ struct zt_tone_def { /* Structure for zone programming */ /* 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 + /* Flag Value for IOMUX, read avail */ #define ZT_IOMUX_READ 1 @@ -725,6 +755,14 @@ struct zt_hdlc { }; #endif +/* Conference queue stucture */ +struct confq { + u_char buffer[ZT_CHUNKSIZE * ZT_CB_SIZE]; + u_char *buf[ZT_CB_SIZE]; + int inbuf; + int outbuf; +}; + struct zt_chan { #ifdef CONFIG_ZAPATA_NET /* Must be first */ @@ -740,10 +778,10 @@ struct zt_chan { int chanpos; int flags; - /* Slaves */ - unsigned int slavemask; - 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 */ @@ -806,6 +844,9 @@ struct zt_chan { int tonep; /* Current position in tone */ struct zt_tone_state ts; /* Tone state */ + /* Ring cadence */ + int ringcadence[ZT_MAX_CADENCE]; + /* Digit string dialing stuff */ int digitmode; /* What kind of tones are we sending? */ char txdialbuf[ZT_MAX_DTMF_BUF]; @@ -823,10 +864,17 @@ struct zt_chan { int infcs; /* Conferencing stuff */ - int confn; /* conference number */ + int confna; /* conference number (alias) */ + int _confn; /* Actual conference number */ int confmode; /* conference mode */ int confmute; /* conference mute mode */ + /* Incoming and outgoing conference chunk queues for + communicating between zaptel master time and + other boards */ + struct confq confin; + struct confq confout; + short getlin[ZT_MAX_CHUNKSIZE]; /* Last transmitted samples */ short getlin_lastchunk[ZT_MAX_CHUNKSIZE]; /* Last transmitted samples from last chunk */ short putlin[ZT_MAX_CHUNKSIZE]; /* Last received samples */ @@ -838,6 +886,8 @@ struct zt_chan { /* Is echo cancellation enabled or disabled */ int echocancel; echo_can_state_t *ec; + echo_can_disable_detector_state_t txecdis; + echo_can_disable_detector_state_t rxecdis; /* RBS timings */ int prewinktime; /* pre-wink time (ms) */ @@ -865,9 +915,16 @@ struct zt_chan { int txhooksig; int kewlonhook; + /* Idle signalling if CAS signalling */ + int idlebits; + int deflaw; /* 1 = mulaw, 2=alaw, 0=undefined */ short *xlaw; +#ifdef CONFIG_CALC_XLAW + unsigned char (*lineartoxlaw)(short a); +#else unsigned char *lin2x; +#endif #ifdef CONFIG_DEVFS_FS devfs_handle_t fhandle; /* File handle in devfs for the channel */ @@ -1063,10 +1120,25 @@ extern void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt); Set 'mf' to 0 for DTMF or 1 for MFv1 */ extern struct zt_tone *zt_dtmf_tone(char digit, int mf); +/* Echo cancel a receive and transmit chunk for a given channel. This + should be called by the low-level driver as close to the interface + as possible. ECHO CANCELLATION IS NO LONGER AUTOMATICALLY DONE + AT THE ZAPTEL LEVEL. zt_ec_chunk will not echo cancel if it should + not be doing so. rxchunk is modified in-place */ + +extern void zt_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk); + /* Don't use these directly -- they're not guaranteed to be there. */ extern short __zt_mulaw[256]; +extern short __zt_alaw[256]; +#ifdef CONFIG_CALC_XLAW +extern u_char __zt_lineartoulaw(short a); +extern u_char __zt_lineartoalaw(short a); +#else extern u_char __zt_lin2mu[16384]; +extern u_char __zt_lin2a[16384]; +#endif /* Used by dynamic zaptel -- don't use directly */ extern void zt_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data)); @@ -1104,16 +1176,25 @@ static inline short zt_tone_nextsample(struct zt_tone_state *ts, struct zt_tone /* These are the right functions to use. */ -#define ZT_LIN2MU(a) (__zt_lin2mu[((unsigned short)(a)) >> 2]) #define ZT_MULAW(a) (__zt_mulaw[(a)]) +#define ZT_ALAW(a) (__zt_alaw[(a)]) +#define ZT_XLAW(a,c) (c->xlaw[(a)]) + +#ifdef CONFIG_CALC_XLAW +#define ZT_LIN2MU(a) (__zt_lineartoulaw((a))) +#define ZT_LIN2A(a) (__zt_lineartoalaw((a))) + +#define ZT_LIN2X(a,c) ((c)->lineartoxlaw((a))) +#else +/* Use tables */ +#define ZT_LIN2MU(a) (__zt_lin2mu[((unsigned short)(a)) >> 2]) #define ZT_LIN2A(a) (__zt_lin2a[((unsigned short)(a)) >> 2]) -#define ZT_ALAW(a) (__zt_alaw[(a)]) /* Manipulate as appropriate for x-law */ #define ZT_LIN2X(a,c) ((c)->lin2x[((unsigned short)(a)) >> 2]) -#define ZT_XLAW(a,c) (c->xlaw[(a)]) -#endif +#endif /* CONFIG_CALC_XLAW */ +#endif /* __KERNEL__ */ #endif /* _LINUX_ZAPTEL_H */ |