summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2014-09-03 17:35:52 +0000
committerShaun Ruffell <sruffell@digium.com>2014-09-03 17:35:52 +0000
commit19e5621b53930e912b17d4a81e943ee6cf49f9ad (patch)
tree40a5a2294c4deb8baa63111402a3ac703a8b2602 /include
parent9df2805ef9a14d731fcaa1325b6b1054c1f2c101 (diff)
Point people to where active development is taking placesvn_trunk
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10748 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r--include/dahdi/Kbuild4
-rw-r--r--include/dahdi/dahdi_config.h193
-rw-r--r--include/dahdi/fasthdlc.h533
-rw-r--r--include/dahdi/kernel.h1567
-rw-r--r--include/dahdi/user.h1215
-rw-r--r--include/dahdi/wctdm_user.h68
6 files changed, 0 insertions, 3580 deletions
diff --git a/include/dahdi/Kbuild b/include/dahdi/Kbuild
deleted file mode 100644
index 5dfee8c..0000000
--- a/include/dahdi/Kbuild
+++ /dev/null
@@ -1,4 +0,0 @@
-header-y += kernel.h
-header-y += user.h
-header-y += wctdm_user.h
-header-y += version.h
diff --git a/include/dahdi/dahdi_config.h b/include/dahdi/dahdi_config.h
deleted file mode 100644
index 0957689..0000000
--- a/include/dahdi/dahdi_config.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * DAHDI configuration options
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2 as published by the
- * Free Software Foundation. See the LICENSE file included with
- * this program for more details.
- */
-
-#ifndef _DAHDI_CONFIG_H
-#define _DAHDI_CONFIG_H
-
-#ifdef __KERNEL__
-#include <linux/version.h>
-#endif
-
-/* DAHDI compile time options */
-
-/* These default tone lengths are in units of milliseconds. */
-#define DAHDI_CONFIG_DEFAULT_DTMF_LENGTH 100
-#define DAHDI_CONFIG_DEFAULT_MFR1_LENGTH 68
-#define DAHDI_CONFIG_DEFAULT_MFR2_LENGTH 100
-#define DAHDI_CONFIG_PAUSE_LENGTH 500
-
-/*
- * Uncomment if you have a European phone, or any other phone with a
- * short flash time.
- * This will stop the flash being mis-detected as a pulse dial "1" on
- * phones with short flashes
- */
-/* #define SHORT_FLASH_TIME */
-
-/*
- * Uncomment to disable calibration and/or DC/DC converter tests
- * (not generally recommended)
- */
-/* #define NO_CALIBRATION */
-/* #define NO_DCDC */
-
-/*
- * Boost ring voltage (Higher ring voltage, takes more power)
- * Note: this only affects the wcfxsusb and wcusb drivers; all other
- * drivers have a 'boostringer' module parameter.
- */
-/* #define BOOST_RINGER */
-
-/*
- * Define CONFIG_CALC_XLAW if you have a small number of channels and/or
- * a small level 2 cache, to optimize for few channels
- *
- */
-/* #define CONFIG_CALC_XLAW */
-
-/*
- * Define if you want MMX optimizations in DAHDI
- *
- * Note: CONFIG_DAHDI_MMX is generally incompatible with AMD
- * processors and can cause system instability!
- *
- */
-/* #define CONFIG_DAHDI_MMX */
-
-/* We now use the linux kernel config to detect which options to use */
-/* You can still override them below */
-#if defined(CONFIG_HDLC) || defined(CONFIG_HDLC_MODULE)
-#define DAHDI_HDLC_TYPE_TRANS
-#define HDLC_MAINTAINERS_ARE_MORE_STUPID_THAN_I_THOUGHT
-#endif
-
-/*
- * Uncomment CONFIG_DAHDI_NET to enable SyncPPP, CiscoHDLC, and Frame Relay
- * support.
- */
-/* #define CONFIG_DAHDI_NET */
-
-/*
- * Uncomment for Generic PPP support (i.e. DAHDIRAS)
- */
-
-#if defined(CONFIG_PPP) || defined(CONFIG_PPP_MODULE)
-/* #define CONFIG_DAHDI_PPP */
-#endif
-
-/*
- * Uncomment to enable "watchdog" to monitor if interfaces
- * stop taking interrupts or otherwise misbehave
- */
-/* #define CONFIG_DAHDI_WATCHDOG */
-
-/*
- * Uncomment the following to include extra debugging output.
- */
-/* #define CONFIG_DAHDI_DEBUG */
-
-/*
- * Uncomment for Non-standard FXS groundstart start state (A=Low, B=Low)
- * particularly for CAC channel bank groundstart FXO ports.
- */
-/* #define CONFIG_CAC_GROUNDSTART */
-
-/*
- * Define CONFIG_DAHDI_CORE_TIMER if you would like dahdi to always provide a
- * timing source regardless of which spans / drivers are configured.
- */
-#define CONFIG_DAHDI_CORE_TIMER
-
-/*
- * Define CONFIG_DAHDI_NO_ECHOCAN_DISABLE to prevent the 2100Hz tone detector
- * from disabling any installed software echocan.
- *
- */
-/* #define CONFIG_DAHDI_NO_ECHOCAN_DISABLE */
-
-/*
- * Define if you would like to allow software echocans to process the tx audio
- * in addition to the rx audio. Used for things like DC removal.
- *
- */
-/* #define CONFIG_DAHDI_ECHOCAN_PROCESS_TX */
-
-/*
- * Uncomment if you happen have an early TDM400P Rev H which
- * sometimes forgets its PCI ID to have wcfxs match essentially all
- * subvendor ID's
- */
-/* #define TDM_REVH_MATCHALL */
-
-/*
- * Uncomment the following if you want to support E&M trunks being
- * able to "flash" after going off-hook (dont ask why, just nod :-) ).
- *
- * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!!
- *
- */
-/* #define EMFLASH */
-
-/*
- * Uncomment the following if you want to support E&M trunks being
- * able to recognize Dial Pulse digits. This can validly be enabled
- * so that either Dial Pulse or DTMF/MF tones will be recognized, but
- * the drawback is that the ONHOOK will take an extra {rxwinktime}
- * to be recognized.
- *
- * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!!
- *
- */
-/* #define EMPULSE */
-
-/*
- * Comment out the following if you dont want events to indicate the
- * beginning of an incoming ring. Most non-Asterisk applications will
- * want this commented out.
- */
-#define RINGBEGIN
-
-/*
- * Uncomment the following if you need to support FXS Flash events.
- * Most applications will want this commented out.
- */
-/* #define FXSFLASH */
-
-/*
- * Enable sync_tick() calls. Allows low-level drivers to synchronize
- * their internal clocks to the DAHDI master clock.
- */
-#define DAHDI_SYNC_TICK
-
-/*
- * Skip processing PCM if low-level driver won't use it anyway
- */
-/* #define OPTIMIZE_CHANMUTE */
-
-
-/*
- * Pass DAHDI_AUDIOMODE to channel driver as well
- */
-/* #define DAHDI_AUDIO_NOTIFY */
-
-/*
- * Creates an interface for mirroring the raw channel data out to a pseudo-chan
- */
-/* #define CONFIG_DAHDI_MIRROR */
-
-#endif
diff --git a/include/dahdi/fasthdlc.h b/include/dahdi/fasthdlc.h
deleted file mode 100644
index bcfa9b8..0000000
--- a/include/dahdi/fasthdlc.h
+++ /dev/null
@@ -1,533 +0,0 @@
-/*
- * Mark's Mythical Table-based raw HDLC implementation
- *
- * This is designed to be a very fast, but memory efficient
- * implementation of standard HDLC protocol.
- *
- * This table based HDLC technology is PATENT PENDING, but will always be
- * remain freely distributable under the terms of the GPL version 2.
- *
- * For non-GPL licensing, please contact Mark Spencer at
- * the below e-mail address.
- *
- * Copyright (C) 2001-2008, Digium, Inc.
- *
- * Written by Mark Spencer <markster@digium.com>
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2 as published by the
- * Free Software Foundation. See the LICENSE file included with
- * this program for more details.
- */
-
-#ifndef _FASTHDLC_H
-#define _FASTHDLC_H
-
-enum fasthdlc_mode {
- FASTHDLC_MODE_64 = 0,
- FASTHDLC_MODE_56,
- FASTHDLC_MODE_16,
-};
-
-struct fasthdlc_state {
- int state; /* What state we are in */
- unsigned int data; /* Our current data queue */
- int bits; /* Number of bits in our data queue */
- int ones; /* Number of ones */
- enum fasthdlc_mode mode;
- unsigned int minbits;
-};
-
-#ifdef FAST_HDLC_NEED_TABLES
-#define RETURN_COMPLETE_FLAG (0x1000)
-#define RETURN_DISCARD_FLAG (0x2000)
-#define RETURN_EMPTY_FLAG (0x4000)
-
-/* Unlike most HDLC implementations, we define only two states,
- when we are in a valid frame, and when we are searching for
- a frame header */
-
-#define FRAME_SEARCH 0
-#define PROCESS_FRAME 1
-
-/*
-
- HDLC Search State table -- Look for a frame header. The return value
- of this table is as follows:
-
- |---8---|---7---|---6---|---5---|---4---|---3---|---2---|---1---|
- | Z E R O E S | Next | Bits Consumed |
- |-------|-------|-------|-------|-------|-------|-------|-------|
-
- The indexes for this table are the state (0 or 1) and the next 8
- bits of the stream.
-
- Note that this table is only used for state 0 and 1.
-
- The user should discard the top "bits consumed" bits of data before
- the next call. "Next state" represents the actual next state for
- decoding.
-
-*/
-static unsigned char hdlc_search[256];
-
-/*
- HDLC Data Table
-
- The indexes to this table are the number of one's we've seen so far (0-5) and
- the next 10 bits of input (which is enough to guarantee us that we
- will retrieve at least one byte of data (or frame or whatever).
-
- The format for the return value is:
-
- Bits 15: Status (1=Valid Data, 0=Control Frame (see bits 7-0 for type))
- Bits 14-12: Number of ones in a row, so far
- Bits 11-8: The number of bits consumed (0-10)
- Bits 7-0: The return data (if appropriate)
-
- The next state is simply bit #15
-
-*/
-
-#define CONTROL_COMPLETE 1
-#define CONTROL_ABORT 2
-
-#define STATUS_MASK (1 << 15)
-#define STATUS_VALID (1 << 15)
-#define STATUS_CONTROL (0 << 15)
-#define STATE_MASK (1 << 15)
-#define ONES_MASK (7 << 12)
-#define DATA_MASK (0xff)
-
-static unsigned short hdlc_frame[6][1024];
-
-static unsigned int minbits[2] = { 8, 10 };
-
-/*
- Last, but not least, we have the encoder table. It takes
- as its indices the number of ones so far and a byte of data
- and returns an int composed of the following fields:
-
- Bots 31-22: Actual Data
- Bits 21-16: Unused
- Bits 15-8: Number of ones
- Bits 3-0: Number of bits of output (13-4) to use
-
- Of course we could optimize by reducing to two tables, but I don't
- really think it's worth the trouble at this point.
- */
-
-static unsigned int hdlc_encode[6][256];
-
-static inline char hdlc_search_precalc(unsigned char c)
-{
- int x, p=0;
- /* Look for a flag. If this isn't a flag,
- line us up for the next possible shot at
- a flag */
-
- /* If it's a flag, we go to state 1, and have
- consumed 8 bits */
- if (c == 0x7e)
- return 0x10 | 8;
-
- /* If it's an abort, we stay in the same state
- and have consumed 8 bits */
- if (c == 0x7f)
- return 0x00 | 8;
-
- /* If it's all 1's, we state in the same state and
- have consumed 8 bits */
- if (c == 0xff)
- return 0x00 | 8;
-
- /* If we get here, we must have at least one zero in us
- but we're not the flag. So, start at the end (LSB) and
- work our way to the top (MSB) looking for a zero. The
- position of that 0 is most optimistic start of a real
- frame header */
- x=1;
- p=7;
- while(p && (c & x)) {
- x <<= 1;
- p--;
- }
- return p;
-}
-
-#ifdef DEBUG_PRECALC
-static inline void hdlc_search_print(char c, char r)
-{
- int x=0x80;
- while(x) {
- printf("%s", c & x ? "1" : "0");
- x >>= 1;
- }
- printf(" => State %d, Consume %d\n", (r & 0x10) >> 4, r & 0xf);
-}
-#endif
-
-#define HFP(status, ones, bits, data) \
- ((status) | ((ones) << 12) | ((bits) << 8) | (data))
-
-static inline unsigned int hdlc_frame_precalc(unsigned char x, unsigned short c)
-{
- /* Assume we have seen 'x' one's so far, and have read the
- bottom 10 bytes of c (MSB first). Now, we HAVE to have
- a byte of data or a frame or something. We are assumed
- to be at the beginning of a byte of data or something */
- unsigned char ones = x;
- unsigned char data=0;
- int bits=0;
- int consumed=0;
- while(bits < 8) {
- data >>=1;
- consumed++;
- if (ones == 5) {
- /* We've seen five ones */
- if (c & 0x0200) {
- /* Another one -- Some sort of signal frame */
- if ((!(c & 0x0100)) && (bits == 6)) {
- /* This is a frame terminator (10) */
- return HFP(0,
- 0, 8, CONTROL_COMPLETE);
- } else {
- /* Yuck! It's something else...
- Abort this entire frame, and
- start looking for a good frame */
- return HFP(0,
- 0, consumed+1, CONTROL_ABORT);
- }
- } else {
- /* It's an inserted zero, just skip it */
- ones = 0;
- data <<= 1;
- }
- } else {
- /* Add it to our bit list, LSB to
- MSB */
- if (c & 0x0200) {
- data |= 0x80;
- ones++;
- } else
- ones=0;
- bits++;
- }
- c <<= 1;
- }
- /* Consume the extra 0 now rather than later. */
- if (ones == 5) {
- ones = 0;
- consumed++;
- }
- return HFP(STATUS_VALID, ones, consumed, data);
-}
-
-#ifdef DEBUG_PRECALC
-
-static inline void hdlc_frame_print(unsigned char x, unsigned short c, unsigned int res)
-{
- int z=0x0200;
- char *status[] = {
- "Control",
- "Valid",
- };
- printf("%d one's then ", x);
- while(z) {
- printf("%s", c & z ? "1" : "0");
- z >>= 1;
- }
- printf(" => Status %s, ", res & STATUS_MASK ? "1" : "0");
- printf("Consumed: %d, ", (res & 0x0f00) >> 8);
- printf("Status: %s, ", status[(res & STATUS_MASK) >> 15]);
- printf("Ones: %d, ", (res & ONES_MASK) >> 12);
- printf("Data: %02x\n", res & 0xff);
-
-}
-
-#endif
-
-static inline unsigned int hdlc_encode_precalc(int x, unsigned char y)
-{
- int bits=0;
- int ones=x;
- unsigned short data=0;
- int z;
- for (z=0;z<8;z++) {
- /* Zero-stuff if needed */
- if (ones == 5) {
- /* Stuff a zero */
- data <<= 1;
- ones=0;
- bits++;
- }
- if (y & 0x01) {
- /* There's a one */
- data <<= 1;
- data |= 0x1;
- ones++;
- bits++;
- } else {
- data <<= 1;
- ones = 0;
- bits++;
- }
- y >>= 1;
- }
- /* Special case -- Stuff the zero at the end if appropriate */
- if (ones == 5) {
- /* Stuff a zero */
- data <<= 1;
- ones=0;
- bits++;
- }
- data <<= (10-bits);
- return (data << 22) | (ones << 8) | (bits);
-}
-
-#ifdef DEBUG_PRECALC
-static inline void hdlc_encode_print(int x, unsigned char y, unsigned int val)
-{
- unsigned int z;
- unsigned short c;
- printf("%d ones, %02x (", x, y);
- z = 0x80;
- while(z) {
- printf("%s", y & z ? "1" : "0");
- z >>= 1;
- }
- printf(") encoded as ");
- z = 1 << 31;
- for (x=0;x<(val & 0xf);x++) {
- printf("%s", val & z ? "1" : "0");
- z >>= 1;
- }
- printf(" with %d ones now, %d bits in len\n", (val & 0xf00) >> 8, val & 0xf);
-
-
-}
-#endif
-
-static inline void fasthdlc_precalc(void)
-{
- int x;
- int y;
- /* First the easy part -- the searching */
- for (x=0;x<256;x++) {
- hdlc_search[x] = hdlc_search_precalc(x);
-#ifdef DEBUG_PRECALC
- hdlc_search_print(x, hdlc_search[x]);
-#endif
- }
- /* Now the hard part -- the frame tables */
- for (x=0;x<6;x++) {
- /* Given the # of preceeding ones, process the next
- byte of input (up to 10 actual bits) */
- for (y=0;y<1024;y++) {
- hdlc_frame[x][y] = hdlc_frame_precalc(x, y);
-#ifdef DEBUG_PRECALC
- hdlc_frame_print(x, y, hdlc_frame[x][y]);
-#endif
- }
- }
- /* Now another not-so-hard part, the encoding table */
- for (x=0;x<6;x++) {
- for (y=0;y<256;y++) {
- hdlc_encode[x][y] = hdlc_encode_precalc(x,y);
-#ifdef DEBUG_PRECALC
- hdlc_encode_print(x,y,hdlc_encode[x][y]);
-#endif
- }
- }
-}
-
-
-static inline void fasthdlc_init(struct fasthdlc_state *h, enum fasthdlc_mode mode)
-{
- /* Initializes all states appropriately */
- h->mode = mode;
- h->state = 0;
- h->bits = 0;
- h->data = 0;
- h->ones = 0;
-
- switch (mode) {
- case FASTHDLC_MODE_64:
- h->minbits = 8;
- break;
- case FASTHDLC_MODE_56:
- h->minbits = 7;
- break;
- case FASTHDLC_MODE_16:
- h->minbits = 2;
- break;
- }
-
-}
-
-static inline int fasthdlc_tx_load_nocheck(struct fasthdlc_state *h, unsigned char c)
-{
- unsigned int res;
- res = hdlc_encode[h->ones][c];
- h->ones = (res & 0xf00) >> 8;
- h->data |= (res & 0xffc00000) >> h->bits;
- h->bits += (res & 0xf);
- return 0;
-}
-
-static inline int fasthdlc_tx_load(struct fasthdlc_state *h, unsigned char c)
-{
- /* Gotta have at least 10 bits left */
- if (h->bits > 22)
- return -1;
- return fasthdlc_tx_load_nocheck(h, c);
-}
-
-static inline int fasthdlc_tx_frame_nocheck(struct fasthdlc_state *h)
-{
- h->ones = 0;
- h->data |= ( 0x7e000000 >> h->bits);
- h->bits += 8;
- return 0;
-}
-
-static inline int fasthdlc_tx_frame(struct fasthdlc_state *h)
-{
- if (h->bits > 24)
- return -1;
- return fasthdlc_tx_frame_nocheck(h);
-}
-
-static inline int fasthdlc_tx_need_data(struct fasthdlc_state *h)
-{
- if (h->mode == FASTHDLC_MODE_56) {
- if (h->bits < 7)
- return 1;
- } else if (h->mode == FASTHDLC_MODE_16) {
- if (h->bits < 2)
- return 1;
- } else {
- if (h->bits < 8)
- return 1;
- }
-
- return 0;
-}
-
-static inline int fasthdlc_tx_run_nocheck(struct fasthdlc_state *h)
-{
- unsigned char b;
- if (h->mode == FASTHDLC_MODE_16) {
- b = h->data >> 30;
- h->bits -= 2;
- h->data <<= 2;
-
- return (b & 3) << 6;
- } else if (h->mode == FASTHDLC_MODE_56) {
- b = h->data >> 25;
- h->bits -= 7;
- h->data <<= 7;
-
- return ((b & 0x7f) << 1) | 1;
- } else {
- b = h->data >> 24;
- h->bits -= 8;
- h->data <<= 8;
-
- return b;
- }
-
-}
-
-static inline int fasthdlc_tx_run(struct fasthdlc_state *h)
-{
- if (h->bits < h->minbits)
- return -1;
- return fasthdlc_tx_run_nocheck(h);
-}
-
-static inline int fasthdlc_rx_load_nocheck(struct fasthdlc_state *h, unsigned char b)
-{
- if (h->mode == FASTHDLC_MODE_16) {
- h->data |= (b >> 6) << (30-h->bits);
- h->bits += 2;
- } else if (h->mode == FASTHDLC_MODE_56) {
- h->data |= (b >> 1) << (25-h->bits);
- h->bits += 7;
- } else {
- /* Put the new byte in the data stream */
- h->data |= b << (24-h->bits);
- h->bits += 8;
- }
- return 0;
-}
-
-static inline int fasthdlc_rx_load(struct fasthdlc_state *h, unsigned char b)
-{
- /* Make sure we have enough space */
- if (h->bits > 24)
- return -1;
- return fasthdlc_rx_load_nocheck(h, b);
-}
-
-/*
- Returns a data character if available, logical OR'd with
- zero or more of RETURN_COMPLETE_FLAG, RETURN_DISCARD_FLAG,
- and RETURN_EMPTY_FLAG, signifying a complete frame, a
- discarded frame, or there is nothing to return.
- */
-
-static inline int fasthdlc_rx_run(struct fasthdlc_state *h)
-{
- unsigned short next;
- int retval=RETURN_EMPTY_FLAG;
- while ((h->bits >= minbits[h->state]) && (retval == RETURN_EMPTY_FLAG)) {
- /* Run until we can no longer be assured that we will
- have enough bits to continue */
- switch(h->state) {
- case FRAME_SEARCH:
- /* Look for an HDLC frame, keying from
- the top byte. */
- next = hdlc_search[h->data >> 24];
- h->bits -= next & 0x0f;
- h->data <<= next & 0x0f;
- h->state = next >> 4;
- h->ones = 0;
- break;
- case PROCESS_FRAME:
- /* Process as much as the next ten bits */
- next = hdlc_frame[h->ones][h->data >> 22];
- h->bits -= ((next & 0x0f00) >> 8);
- h->data <<= ((next & 0x0f00) >> 8);
- h->state = (next & STATE_MASK) >> 15;
- h->ones = (next & ONES_MASK) >> 12;
- switch(next & STATUS_MASK) {
- case STATUS_CONTROL:
- if (next & CONTROL_COMPLETE) {
- /* A complete, valid frame received */
- retval = (RETURN_COMPLETE_FLAG);
- /* Stay in this state */
- h->state = 1;
- } else {
- /* An abort (either out of sync of explicit) */
- retval = (RETURN_DISCARD_FLAG);
- }
- break;
- case STATUS_VALID:
- retval = (next & DATA_MASK);
- }
- }
- }
- return retval;
-}
-#endif /* FAST_HDLC_NEED_TABLES */
-#endif
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
deleted file mode 100644
index 65dfd89..0000000
--- a/include/dahdi/kernel.h
+++ /dev/null
@@ -1,1567 +0,0 @@
-/*
- * DAHDI Telephony Interface
- *
- * Written by Mark Spencer <markster@digium.com>
- * 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 - 2012 Digium, Inc.
- *
- * All rights reserved.
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2 as published by the
- * Free Software Foundation. See the LICENSE file included with
- * this program for more details.
- */
-
-/*!
- * \file
- * \brief DAHDI kernel interface definitions
- */
-
-#ifndef _DAHDI_KERNEL_H
-#define _DAHDI_KERNEL_H
-
-#include <dahdi/user.h>
-#include <dahdi/fasthdlc.h>
-
-#include <dahdi/dahdi_config.h>
-#include <linux/version.h>
-#include <linux/fs.h>
-#include <linux/device.h>
-#include <linux/module.h>
-#include <linux/ioctl.h>
-
-#ifdef CONFIG_DAHDI_NET
-#include <linux/hdlc.h>
-#endif
-
-#ifdef CONFIG_DAHDI_PPP
-#include <linux/ppp_channel.h>
-#include <linux/skbuff.h>
-#include <linux/interrupt.h>
-#endif
-#include <linux/device.h>
-#include <linux/sysfs.h>
-
-#include <linux/poll.h>
-
-#define dahdi_pci_module pci_register_driver
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
-#define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id)
-#else
-#define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id, struct pt_regs *regs)
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
-#ifdef CONFIG_PCI
-#include <linux/pci-aspm.h>
-#endif
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
-#define HAVE_NET_DEVICE_OPS
-#endif
-
-#define DAHDI_IRQ_SHARED IRQF_SHARED
-#define DAHDI_IRQ_DISABLED IRQF_DISABLED
-#define DAHDI_IRQ_SHARED_DISABLED IRQF_SHARED | IRQF_DISABLED
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
-# ifdef RHEL_RELEASE_VERSION
-# if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5, 6)
-#define dev_name(dev) ((dev)->bus_id)
-#define dev_set_name(dev, format, ...) \
- snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
-# else
-#define dev_set_name(dev, format, ...) \
- do { \
- kobject_set_name(&(dev)->kobj, format, ## __VA_ARGS__); \
- snprintf((dev)->bus_id, BUS_ID_SIZE, \
- kobject_name(&(dev)->kobj)); \
- } while (0)
-# endif
-# else
-#define dev_name(dev) ((dev)->bus_id)
-#define dev_set_name(dev, format, ...) \
- snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
-# endif
-#endif
-
-/*! 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 DAHDI_CHUNKSIZE 8
-#define DAHDI_MIN_CHUNKSIZE DAHDI_CHUNKSIZE
-#define DAHDI_DEFAULT_CHUNKSIZE DAHDI_CHUNKSIZE
-#define DAHDI_MAX_CHUNKSIZE DAHDI_CHUNKSIZE
-#define DAHDI_CB_SIZE (1 << 3)
-
-/* DAHDI operates at 8Khz by default */
-#define DAHDI_MS_TO_SAMPLES(ms) ((ms) * 8)
-
-#define DAHDI_MSECS_PER_CHUNK (DAHDI_CHUNKSIZE/DAHDI_MS_TO_SAMPLES(1))
-
-#define RING_DEBOUNCE_TIME 2000 /*!< 2000 ms ring debounce time */
-
-typedef struct
-{
- int32_t gain;
- int32_t a1;
- int32_t a2;
- int32_t b1;
- int32_t b2;
-
- int32_t z1;
- int32_t z2;
-} biquad2_state_t;
-
-typedef struct
-{
- biquad2_state_t notch;
- int notch_level;
- int channel_level;
- int tone_present;
- int tone_cycle_duration;
- int good_cycles;
- int hit;
-} echo_can_disable_detector_state_t;
-
-struct sf_detect_state {
- long x1;
- long x2;
- long y1;
- long y2;
- long e1;
- long e2;
- int samps;
- int lastdetect;
-};
-
-struct dahdi_tone_state {
- int v1_1;
- int v2_1;
- int v3_1;
- int v1_2;
- int v2_2;
- int v3_2;
- int modulate;
-};
-
-/*! \brief Conference queue structure */
-struct confq {
- u_char buffer[DAHDI_CHUNKSIZE * DAHDI_CB_SIZE];
- u_char *buf[DAHDI_CB_SIZE];
- int inbuf;
- int outbuf;
-};
-
-struct dahdi_chan;
-struct dahdi_echocan_state;
-
-/*! Features a DAHDI echo canceler (software or hardware) can provide to the DAHDI core. */
-struct dahdi_echocan_features {
-
- /*! Able to detect CED tone (2100 Hz with phase reversals) in the transmit direction.
- * If the echocan can detect this tone, it may report it it as an event (see
- * the events.CED_tx_detected field of dahdi_echocan_state), and if it will automatically
- * disable itself or its non-linear processor, then the NLP_automatic feature flag should also
- * be set so that the DAHDI core doesn't bother trying to do so.
- */
- u32 CED_tx_detect:1;
-
- /*! Able to detect CED tone (2100 Hz with phase reversals) in the receive direction.
- * If the echocan can detect this tone, it may report it it as an event (see
- * the events.CED_rx_detected field of dahdi_echocan_state), and if it will automatically
- * disable itself or its non-linear processor, then the NLP_automatic flag feature should also
- * be set so that the DAHDI core doesn't bother trying to do so.
- */
- u32 CED_rx_detect:1;
-
- /*! Able to detect CNG tone (1100 Hz) in the transmit direction. */
- u32 CNG_tx_detect:1;
-
- /*! Able to detect CNG tone (1100 Hz) in the receive direction. */
- u32 CNG_rx_detect:1;
-
- /*! If the echocan's NLP can be enabled and disabled without requiring destruction
- * and recreation of the state structure, this feature flag should be set and the
- * echocan_NLP_toggle field of the dahdi_echocan_ops structure should be filled with a
- * pointer to the function to perform that operation.
- */
- u32 NLP_toggle:1;
-
- /*! If the echocan will automatically disable itself (or even just its NLP) based on
- * detection of a CED tone in either direction, this feature flag should be set (along
- * with the tone detection feature flags).
- */
- u32 NLP_automatic:1;
-};
-
-/*! Operations (methods) that can be performed on a DAHDI echo canceler instance (state
- * structure) after it has been created, by either a software or hardware echo canceller.
- * The echo canceler must populate the owner field of the dahdi_echocan_state structure
- * with a pointer to the relevant operations structure for that instance.
- */
-struct dahdi_echocan_ops {
-
- /*! \brief Free an echocan state structure.
- * \param[in,out] ec Pointer to the state structure to free.
- *
- * \return Nothing.
- */
- void (*echocan_free)(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
-
- /*! \brief Process an array of audio samples through the echocan.
- * \param[in,out] ec Pointer to the state structure.
- * \param[in,out] isig The receive direction data (will be modified).
- * \param[in] iref The transmit direction data.
- * \param[in] size The number of elements in the isig and iref arrays.
- *
- * Note: This function can also return events in the events field of the
- * dahdi_echocan_state structure. If it can do so, then the echocan does
- * not need to provide the echocan_events function.
- *
- * \return Nothing.
- */
- void (*echocan_process)(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
-
- /*! \brief Retrieve events from the echocan.
- * \param[in,out] ec Pointer to the state structure.
- *
- *
- * If any events have occurred, the events field of the dahdi_echocan_state
- * structure should be updated to include them.
- *
- * \return Nothing.
- */
- void (*echocan_events)(struct dahdi_echocan_state *ec);
-
- /*! \brief Feed a sample (and its position) for echocan training.
- * \param[in,out] ec Pointer to the state structure.
- * \param[in] pos The tap position to be 'trained'.
- * \param[in] val The receive direction sample for the specified tap position.
- *
- * \retval Zero if training should continue.
- * \retval Non-zero if training is complete.
- */
- int (*echocan_traintap)(struct dahdi_echocan_state *ec, int pos, short val);
-
- /*! \brief Enable or disable non-linear processing (NLP) in the echocan.
- * \param[in,out] ec Pointer to the state structure.
- * \param[in] enable Zero to disable, non-zero to enable.
- *
- * \return Nothing.
- */
- void (*echocan_NLP_toggle)(struct dahdi_echocan_state *ec, unsigned int enable);
-
-#ifdef CONFIG_DAHDI_ECHOCAN_PROCESS_TX
- /*! \brief Process an array of TX audio samples.
- *
- * \return Nothing.
- */
- void (*echocan_process_tx)(struct dahdi_echocan_state *ec,
- short *tx, u32 size);
-#endif
-};
-
-/*! A factory for creating instances of software echo cancelers to be used on DAHDI channels. */
-struct dahdi_echocan_factory {
-
- /*! Get the name of the factory. */
- const char *(*get_name)(const struct dahdi_chan *chan);
-
- /*! Pointer to the module that owns this factory; the module's reference count will be
- * incremented/decremented by the DAHDI core as needed.
- */
- struct module *owner;
-
- /*! \brief Function to create an instance of the echocan.
- * \param[in] ecp Structure defining parameters to be used for the instance creation.
- * \param[in] p Pointer to the beginning of an (optional) array of user-defined parameters.
- * \param[out] ec Pointer to the state structure that is created, if any.
- *
- * \retval Zero on success.
- * \retval Non-zero on failure (return value will be returned to userspace so it should be a
- * standard error number).
- */
- int (*echocan_create)(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
-};
-
-/*! \brief Register an echo canceler factory with the DAHDI core.
- * \param[in] ec Pointer to the dahdi_echocan_factory structure to be registered.
- *
- * \retval Zero on success.
- * \retval Non-zero on failure (return value will be a standard error number).
- */
-int dahdi_register_echocan_factory(const struct dahdi_echocan_factory *ec);
-
-/*! \brief Unregister a previously-registered echo canceler factory from the DAHDI core.
- * \param[in] ec Pointer to the dahdi_echocan_factory structure to be unregistered.
- *
- * \return Nothing.
- */
-void dahdi_unregister_echocan_factory(const struct dahdi_echocan_factory *ec);
-
-enum dahdi_echocan_mode {
- __ECHO_MODE_MUTE = 1 << 8,
- ECHO_MODE_IDLE = 0,
- ECHO_MODE_PRETRAINING = 1 | __ECHO_MODE_MUTE,
- ECHO_MODE_STARTTRAINING = 2 | __ECHO_MODE_MUTE,
- ECHO_MODE_AWAITINGECHO = 3 | __ECHO_MODE_MUTE,
- ECHO_MODE_TRAINING = 4 | __ECHO_MODE_MUTE,
- ECHO_MODE_ACTIVE = 5,
- ECHO_MODE_FAX = 6,
-};
-
-/*! An instance of a DAHDI echo canceler (software or hardware). */
-struct dahdi_echocan_state {
-
- /*! Pointer to a dahdi_echocan_ops structure of operations that can be
- * performed on this instance.
- */
- const struct dahdi_echocan_ops *ops;
-
- /*! State data used by the DAHDI core's CED detector for the transmit
- * direction, if needed.
- */
- echo_can_disable_detector_state_t txecdis;
-
- /*! State data used by the DAHDI core's CED detector for the receive
- * direction, if needed.
- */
- echo_can_disable_detector_state_t rxecdis;
-
- /*! Features offered by the echo canceler that provided this instance. */
- struct dahdi_echocan_features features;
-
- struct {
- /*! The mode the echocan is currently in. */
- enum dahdi_echocan_mode mode;
-
- /*! The last tap position that was fed to the echocan's training function. */
- u32 last_train_tap;
-
- /*! How many samples to wait before beginning the training operation. */
- u32 pretrain_timer;
- } status;
-
- /*! This structure contains event flags, allowing the echocan to report
- * events that occurred as it processed the transmit and receive streams
- * of samples. Each call to the echocan_process operation for this
- * instance may report events, so the structure should be cleared before
- * calling that operation.
- */
- union dahdi_echocan_events {
- u32 all;
- struct {
- /*! CED tone was detected in the transmit direction. If the
- * echocan automatically disables its NLP when this occurs,
- * it must also signal the NLP_auto_disabled event during the *same*
- * call to echocan_process that reports the CED detection.
- */
- u32 CED_tx_detected:1;
-
- /*! CED tone was detected in the receive direction. If the
- * echocan automatically disables its NLP when this occurs,
- * it must also signal the NLP_auto_disabled event during the *same*
- * call to echocan_process that reports the CED detection.
- */
- u32 CED_rx_detected:1;
-
- /*! CNG tone was detected in the transmit direction. */
- u32 CNG_tx_detected:1;
-
- /*! CNG tone was detected in the receive direction. */
- u32 CNG_rx_detected:1;
-
- /*! The echocan disabled its NLP automatically.
- */
- u32 NLP_auto_disabled:1;
-
- /*! The echocan enabled its NLP automatically.
- */
- u32 NLP_auto_enabled:1;
- } bit;
- } events;
-};
-
-struct dahdi_chan {
-#ifdef CONFIG_DAHDI_NET
- /*! \note Must be first */
- struct dahdi_hdlc *hdlcnetdev;
-#endif
-#ifdef CONFIG_DAHDI_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
-#ifdef BUFFER_DEBUG
- int statcount;
- int lastnumbufs;
-#endif
- spinlock_t lock;
- char name[40];
- /* Specified by DAHDI */
- /*! \brief DAHDI channel number */
- int channo;
- int chanpos;
- unsigned long 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;
- struct sf_detect_state rd;
-
- struct dahdi_chan *master; /*!< Our Master channel (could be us) */
- /*! \brief Next slave (if appropriate) */
- struct dahdi_chan *nextslave;
-
- u_char *writechunk; /*!< Actual place to write to */
- u_char swritechunk[DAHDI_MAX_CHUNKSIZE]; /*!< Buffer to be written */
- u_char *readchunk; /*!< Actual place to read from */
- u_char sreadchunk[DAHDI_MAX_CHUNKSIZE]; /*!< Preallocated static area */
- short *readchunkpreec;
-
- /* Channel from which to read when DACSed. */
- struct dahdi_chan *dacs_chan;
-
- /*! Pointer to tx and rx gain tables */
- const u_char *rxgain;
- const u_char *txgain;
-
- /* Specified by driver, readable by DAHDI */
- void *pvt; /*!< Private channel data */
- struct file *file; /*!< File structure */
-
-
-#ifdef CONFIG_DAHDI_MIRROR
- struct dahdi_chan *rxmirror; /*!< channel we mirror reads to */
- struct dahdi_chan *txmirror; /*!< channel we mirror writes to */
- struct dahdi_chan *srcmirror; /*!< channel we mirror from */
-#endif /* CONFIG_DAHDI_MIRROR */
- struct dahdi_span *span; /*!< Span we're a member of */
- int sig; /*!< Signalling */
- int sigcap; /*!< Capability for signalling */
- __u32 chan_alarms; /*!< alarms status */
-
- wait_queue_head_t waitq;
-
- /* Used only by DAHDI -- NO DRIVER SERVICEABLE PARTS BELOW */
- /* Buffer declarations */
- u_char *readbuf[DAHDI_MAX_NUM_BUFS]; /*!< read buffer */
- int inreadbuf;
- int outreadbuf;
-
- u_char *writebuf[DAHDI_MAX_NUM_BUFS]; /*!< write buffers */
- int inwritebuf;
- int outwritebuf;
-
- int blocksize; /*!< Block size */
-
- int eventinidx; /*!< out index in event buf (circular) */
- int eventoutidx; /*!< in index in event buf (circular) */
- unsigned int eventbuf[DAHDI_MAX_EVENTSIZE]; /*!< event circ. buffer */
-
- int readn[DAHDI_MAX_NUM_BUFS]; /*!< # of bytes ready in read buf */
- int readidx[DAHDI_MAX_NUM_BUFS]; /*!< current read pointer */
- int writen[DAHDI_MAX_NUM_BUFS]; /*!< # of bytes ready in write buf */
- int writeidx[DAHDI_MAX_NUM_BUFS]; /*!< current write pointer */
-
- int numbufs; /*!< How many buffers in channel */
- int txbufpolicy; /*!< Buffer policy */
- int txdisable; /*!< Disable transmitter */
-
- /* Tone zone stuff */
- struct dahdi_zone *curzone; /*!< Zone for selecting tones */
- struct dahdi_tone *curtone; /*!< Current tone we're playing (if any) */
- int tonep; /*!< Current position in tone */
- struct dahdi_tone_state ts; /*!< Tone state */
-
- /* Pulse dial stuff */
- int pdialcount; /*!< pulse dial count */
-
- /*! Ring cadence */
- int ringcadence[DAHDI_MAX_CADENCE];
- int firstcadencepos; /*!< Where to restart ring cadence */
-
- /* Digit string dialing stuff */
- int digitmode; /*!< What kind of tones are we sending? */
- char txdialbuf[DAHDI_MAX_DTMF_BUF];
- int dialing;
- int afterdialingtimer;
- int cadencepos; /*!< Where in the cadence we are */
-
- /* I/O Mask */
- unsigned int iomask; /*! I/O Mux signal mask */
-
- /* HDLC state machines */
- struct fasthdlc_state txhdlc;
- struct fasthdlc_state rxhdlc;
- int infcs;
-
- /* Conferencing stuff */
- int confna; /*! conference number (alias) */
- int _confn; /*! Actual conference number */
- int confmode; /*! conference mode */
- int confmute; /*! conference mute mode */
- struct dahdi_chan *conf_chan;
-
- /* Incoming and outgoing conference chunk queues for
- communicating between DAHDI master time and
- other boards */
- struct confq confin;
- struct confq confout;
-
- short getlin[DAHDI_MAX_CHUNKSIZE]; /*!< Last transmitted samples */
- unsigned char getraw[DAHDI_MAX_CHUNKSIZE]; /*!< Last received raw data */
- short putlin[DAHDI_MAX_CHUNKSIZE]; /*!< Last received samples */
- unsigned char putraw[DAHDI_MAX_CHUNKSIZE]; /*!< Last received raw data */
- short conflast[DAHDI_MAX_CHUNKSIZE]; /*!< Last conference sample -- base part of channel */
- short conflast1[DAHDI_MAX_CHUNKSIZE]; /*!< Last conference sample -- pseudo part of channel */
- short conflast2[DAHDI_MAX_CHUNKSIZE]; /*!< Previous last conference sample -- pseudo part of channel */
-
-
- /*! The echo canceler module that should be used to create an
- instance when this channel needs one */
- const struct dahdi_echocan_factory *ec_factory;
- /*! The echo canceler module that owns the instance currently
- on this channel, if one is present */
- const struct dahdi_echocan_factory *ec_current;
- /*! The state data of the echo canceler instance in use */
- struct dahdi_echocan_state *ec_state;
-
- /* RBS timings */
- int prewinktime; /*!< pre-wink time (ms) */
- int preflashtime; /*!< pre-flash time (ms) */
- int winktime; /*!< wink time (ms) */
- int flashtime; /*!< flash time (ms) */
- int starttime; /*!< start time (ms) */
- int rxwinktime; /*!< rx wink time (ms) */
- int rxflashtime; /*!< rx flash time (ms) */
- int debouncetime; /*!< FXS GS sig debounce time (ms) */
- int pulsebreaktime; /*!< pulse line open time (ms) */
- int pulsemaketime; /*!< pulse line closed time (ms) */
- int pulseaftertime; /*!< pulse time between digits (ms) */
-
- /*! RING debounce timer */
- int ringdebtimer;
-
- /*! RING trailing detector to make sure a RING is really over */
- int ringtrailer;
-
- /* PULSE digit receiver stuff */
- int pulsecount;
- int pulsetimer;
-
- /* RBS timers */
- int itimerset; /*!< what the itimer was set to last */
- int itimer;
- int otimer;
-
- /* RBS state */
- int gotgs;
- int txstate;
- int rxsig;
- int txsig;
- int rxsigstate;
-
- /* non-RBS rx state */
- int rxhooksig;
- int txhooksig;
- int kewlonhook;
-
- /*! Idle signalling if CAS signalling */
- int idlebits;
-
- int deflaw; /*! 1 = mulaw, 2=alaw, 0=undefined */
- short *xlaw;
-#ifdef OPTIMIZE_CHANMUTE
- int chanmute; /*!< no need for PCM data */
-#endif
-#ifdef CONFIG_CALC_XLAW
- unsigned char (*lineartoxlaw)(short a);
-#else
- unsigned char *lin2x;
-#endif
-};
-
-#ifdef CONFIG_DAHDI_NET
-struct dahdi_hdlc {
- struct net_device *netdev;
- struct dahdi_chan *chan;
-};
-#endif
-
-/*! Define the maximum block size */
-#define DAHDI_MAX_BLOCKSIZE 8192
-
-
-#define DAHDI_DEFAULT_WINKTIME 150 /*!< 150 ms default wink time */
-#define DAHDI_DEFAULT_FLASHTIME 750 /*!< 750 ms default flash time */
-
-#define DAHDI_DEFAULT_PREWINKTIME 50 /*!< 50 ms before wink */
-#define DAHDI_DEFAULT_PREFLASHTIME 50 /*!< 50 ms before flash */
-#define DAHDI_DEFAULT_STARTTIME 1500 /*!< 1500 ms of start */
-#define DAHDI_DEFAULT_RINGTIME 2000 /*!< 2000 ms of ring on (start, FXO) */
-#if 0
-#define DAHDI_DEFAULT_RXWINKTIME 250 /*!< 250ms longest rx wink */
-#endif
-#define DAHDI_DEFAULT_RXWINKTIME 300 /*!< 300ms longest rx wink (to work with the Atlas) */
-#define DAHDI_DEFAULT_RXFLASHTIME 1250 /*!< 1250ms longest rx flash */
-#define DAHDI_DEFAULT_DEBOUNCETIME 600 /*!< 600ms of FXS GS signalling debounce */
-#define DAHDI_DEFAULT_PULSEMAKETIME 50 /*!< 50 ms of line closed when dial pulsing */
-#define DAHDI_DEFAULT_PULSEBREAKTIME 50 /*!< 50 ms of line open when dial pulsing */
-#define DAHDI_DEFAULT_PULSEAFTERTIME 750 /*!< 750ms between dial pulse digits */
-
-#define DAHDI_MINPULSETIME (15 * 8) /*!< 15 ms minimum */
-
-#ifdef SHORT_FLASH_TIME
-#define DAHDI_MAXPULSETIME (80 * 8) /*!< we need 80 ms, not 200ms, as we have a short flash */
-#else
-#define DAHDI_MAXPULSETIME (200 * 8) /*!< 200 ms maximum */
-#endif
-
-#define DAHDI_PULSETIMEOUT ((DAHDI_MAXPULSETIME / 8) + 50)
-
-#define DAHDI_RINGTRAILER (50 * 8) /*!< Don't consider a ring "over" until it's been gone at least this
- much time */
-
-#define DAHDI_LOOPCODE_TIME 10000 /*!< send loop codes for 10 secs */
-#define DAHDI_ALARMSETTLE_TIME 5000 /*!< allow alarms to settle for 5 secs */
-#define DAHDI_AFTERSTART_TIME 500 /*!< 500ms after start */
-
-#define DAHDI_RINGOFFTIME 4000 /*!< Turn off ringer for 4000 ms */
-#define DAHDI_KEWLTIME 500 /*!< 500ms for kewl pulse */
-#define DAHDI_AFTERKEWLTIME 300 /*!< 300ms after kewl pulse */
-
-#define DAHDI_MAX_PRETRAINING 1000 /*!< 1000ms max pretraining time */
-
-#ifdef FXSFLASH
-#define DAHDI_FXSFLASHMINTIME 450 /*!< min 450ms */
-#define DAHDI_FXSFLASHMAXTIME 550 /*!< max 550ms */
-#endif
-
-
-struct dahdi_chardev {
- const char *name;
- __u8 minor;
-};
-
-int dahdi_register_chardev(struct dahdi_chardev *dev);
-int dahdi_unregister_chardev(struct dahdi_chardev *dev);
-
-/*! \brief defines for transmit signalling */
-enum dahdi_txsig {
- DAHDI_TXSIG_ONHOOK, /*!< On hook */
- DAHDI_TXSIG_OFFHOOK, /*!< Off hook */
- DAHDI_TXSIG_START, /*!< Start / Ring */
- DAHDI_TXSIG_KEWL, /*!< Drop battery if possible */
- /*! Leave this as the last entry */
- DAHDI_TXSIG_TOTAL,
-};
-
-enum dahdi_rxsig {
- DAHDI_RXSIG_ONHOOK,
- DAHDI_RXSIG_OFFHOOK,
- DAHDI_RXSIG_START,
- DAHDI_RXSIG_RING,
- DAHDI_RXSIG_INITIAL
-};
-
-enum {
- /* Span flags */
- DAHDI_FLAGBIT_REGISTERED= 0,
- DAHDI_FLAGBIT_RUNNING = 1,
- DAHDI_FLAGBIT_RBS = 12, /*!< Span uses RBS signalling */
-
- /* Channel flags */
- DAHDI_FLAGBIT_DTMFDECODE= 2, /*!< Channel supports native DTMF decode */
- DAHDI_FLAGBIT_MFDECODE = 3, /*!< Channel supports native MFr2 decode */
- DAHDI_FLAGBIT_ECHOCANCEL= 4, /*!< Channel supports native echo cancellation */
- DAHDI_FLAGBIT_HDLC = 5, /*!< Perform HDLC */
-#ifdef CONFIG_DAHDI_NET
- DAHDI_FLAGBIT_NETDEV = 6, /*!< Send to network */
-#endif
- DAHDI_FLAGBIT_CLEAR = 8, /*!< Clear channel */
- DAHDI_FLAGBIT_AUDIO = 9, /*!< Audio mode channel */
- DAHDI_FLAGBIT_OPEN = 10, /*!< Channel is open */
- DAHDI_FLAGBIT_FCS = 11, /*!< Calculate FCS */
- /* Reserve 12 for uniqueness with span flags */
- DAHDI_FLAGBIT_LINEAR = 13, /*!< Talk to user space in linear */
- DAHDI_FLAGBIT_PPP = 14, /*!< PPP is available */
- DAHDI_FLAGBIT_T1PPP = 15,
- DAHDI_FLAGBIT_SIGFREEZE = 16, /*!< Freeze signalling */
- DAHDI_FLAGBIT_NOSTDTXRX = 17, /*!< Do NOT do standard transmit and receive on every interrupt */
- DAHDI_FLAGBIT_LOOPED = 18, /*!< Loopback the receive data from the channel to the transmit */
- DAHDI_FLAGBIT_MTP2 = 19, /*!< Repeats last message in buffer and also discards repeating messages sent to us */
- DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */
- DAHDI_FLAGBIT_BUFEVENTS = 21, /*!< Report buffer events */
- DAHDI_FLAGBIT_TXUNDERRUN = 22, /*!< Transmit underrun condition */
- DAHDI_FLAGBIT_RXOVERRUN = 23, /*!< Receive overrun condition */
- DAHDI_FLAGBIT_DEVFILE = 25, /*!< Channel has a sysfs dev file */
-};
-
-#ifdef CONFIG_DAHDI_NET
-/**
- * have_netdev() - Return true if a channel has an associated network device.
- * @chan: Then channel to check.
- *
- */
-static inline int dahdi_have_netdev(const struct dahdi_chan *chan)
-{
- return test_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags);
-}
-#else
-static inline int dahdi_have_netdev(const struct dahdi_chan *chan) { return 0; }
-#endif
-
-struct dahdi_count {
- __u32 fe; /*!< Framing error counter */
- __u32 cv; /*!< Coding violations counter */
- __u32 bpv; /*!< Bipolar Violation counter */
- __u32 crc4; /*!< CRC4 error counter */
- __u32 ebit; /*!< current E-bit error count */
- __u32 fas; /*!< current FAS error count */
- __u32 be; /*!< current bit error count */
- __u32 prbs; /*!< current PRBS detected pattern */
- __u32 errsec; /*!< errored seconds */
-};
-
-/* map flagbits to flag masks */
-#define DAHDI_FLAG(x) (1 << (DAHDI_FLAGBIT_ ## x))
-
-/*! This is a redefinition of the flags from above to allow use of the
- * legacy drivers that do not use the kernel atomic bit testing and
- * changing routines.
- *
- * See the above descriptions for DAHDI_FLAGBIT_.... for documentation
- * about function. */
-/* Span flags */
-#define DAHDI_FLAG_REGISTERED DAHDI_FLAG(REGISTERED)
-#define DAHDI_FLAG_RUNNING DAHDI_FLAG(RUNNING)
-#define DAHDI_FLAG_RBS DAHDI_FLAG(RBS)
-
-/* Channel flags */
-#define DAHDI_FLAG_DTMFDECODE DAHDI_FLAG(DTMFDECODE)
-#define DAHDI_FLAG_MFDECODE DAHDI_FLAG(MFDECODE)
-#define DAHDI_FLAG_ECHOCANCEL DAHDI_FLAG(ECHOCANCEL)
-
-#define DAHDI_FLAG_HDLC DAHDI_FLAG(HDLC)
-/* #define DAHDI_FLAG_NETDEV DAHDI_FLAG(NETDEV) */
-#define DAHDI_FLAG_CLEAR DAHDI_FLAG(CLEAR)
-#define DAHDI_FLAG_AUDIO DAHDI_FLAG(AUDIO)
-
-#define DAHDI_FLAG_OPEN DAHDI_FLAG(OPEN)
-#define DAHDI_FLAG_FCS DAHDI_FLAG(FCS)
-/* Reserve 12 for uniqueness with span flags */
-#define DAHDI_FLAG_LINEAR DAHDI_FLAG(LINEAR)
-#define DAHDI_FLAG_PPP DAHDI_FLAG(PPP)
-#define DAHDI_FLAG_T1PPP DAHDI_FLAG(T1PPP)
-#define DAHDI_FLAG_SIGFREEZE DAHDI_FLAG(SIGFREEZE)
-#define DAHDI_FLAG_NOSTDTXRX DAHDI_FLAG(NOSTDTXRX)
-#define DAHDI_FLAG_LOOPED DAHDI_FLAG(LOOPED)
-#define DAHDI_FLAG_MTP2 DAHDI_FLAG(MTP2)
-#define DAHDI_FLAG_HDLC56 DAHDI_FLAG(HDLC56)
-#define DAHDI_FLAG_BUFEVENTS DAHDI_FLAG(BUFEVENTS)
-#define DAHDI_FLAG_TXUNDERRUN DAHDI_FLAG(TXUNDERRUN)
-#define DAHDI_FLAG_RXOVERRUN DAHDI_FLAG(RXOVERRUN)
-
-enum spantypes {
- SPANTYPE_INVALID = 0,
- SPANTYPE_ANALOG_FXS,
- SPANTYPE_ANALOG_FXO,
- SPANTYPE_ANALOG_MIXED,
- SPANTYPE_DIGITAL_E1,
- SPANTYPE_DIGITAL_T1,
- SPANTYPE_DIGITAL_J1,
- SPANTYPE_DIGITAL_BRI_NT,
- SPANTYPE_DIGITAL_BRI_TE,
- SPANTYPE_DIGITAL_BRI_SOFT,
-};
-const char *dahdi_spantype2str(enum spantypes st);
-enum spantypes dahdi_str2spantype(const char *name);
-const char *dahdi_lineconfig_bit_name(int lineconfig_bit);
-ssize_t lineconfig_str(int lineconfig, char buf[], size_t size);
-
-struct file;
-
-struct dahdi_span_ops {
- struct module *owner; /*!< Which module is exporting this span. */
-
- /* ==== Span Callback Operations ==== */
- /*! Req: Set the requested chunk size. This is the unit in which you must
- report results for conferencing, etc */
- int (*setchunksize)(struct dahdi_span *span, int chunksize);
-
- /*! Opt: Configure the span (if appropriate) */
- int (*spanconfig)(struct file *file, struct dahdi_span *span,
- struct dahdi_lineconfig *lc);
-
- /*! Opt: Start the span */
- int (*startup)(struct file *file, struct dahdi_span *span);
-
- /*! Opt: Shutdown the span */
- int (*shutdown)(struct dahdi_span *span);
-
- /*! Opt: Enable maintenance modes */
- int (*maint)(struct dahdi_span *span, int mode);
-
-#ifdef DAHDI_SYNC_TICK
- /*! Opt: send sync to spans. Called in hard_irq context with chan_lock
- * held.*/
- void (*sync_tick)(struct dahdi_span *span, int is_master);
-#endif
- /* ==== Channel Callback Operations ==== */
- /*! Opt: Set signalling type (if appropriate) */
- int (*chanconfig)(struct file *file, struct dahdi_chan *chan,
- int sigtype);
-
- /*! Opt: Prepare a channel for I/O */
- int (*open)(struct dahdi_chan *chan);
-
- /*! Opt: Close channel for I/O */
- int (*close)(struct dahdi_chan *chan);
-
- /*! Opt: IOCTL */
- int (*ioctl)(struct dahdi_chan *chan, unsigned int cmd, unsigned long data);
-
- /* Okay, now we get to the signalling. You have several options: */
-
- /* Option 1: If you're a T1 like interface, you can just provide a
- rbsbits function and we'll assert robbed bits for you. Be sure to
- set the DAHDI_FLAG_RBS in this case. */
-
- /*! Opt: If the span uses A/B bits, set them here */
- int (*rbsbits)(struct dahdi_chan *chan, int bits);
-
- /*! Option 2: If you don't know about sig bits, but do have their
- equivalents (i.e. you can disconnect battery, detect off hook,
- generate ring, etc directly) then you can just specify a
- sethook function, and we'll call you with appropriate hook states
- to set. Still set the DAHDI_FLAG_RBS in this case as well */
- int (*hooksig)(struct dahdi_chan *chan, enum dahdi_txsig hookstate);
-
- /*! Option 3: If you can't use sig bits, you can write a function
- which handles the individual hook states */
- int (*sethook)(struct dahdi_chan *chan, int hookstate);
-
- /*! Opt: Used to tell an onboard HDLC controller that there is data ready to transmit */
- void (*hdlc_hard_xmit)(struct dahdi_chan *chan);
-
- /*! If the watchdog detects no received data, it will call the
- watchdog routine */
- int (*watchdog)(struct dahdi_span *span, int cause);
-
-#ifdef DAHDI_AUDIO_NOTIFY
- /*! Opt: audio is used, don't optimize out */
- int (*audio_notify)(struct dahdi_chan *chan, int yes);
-#endif
-
- /*! Opt: Enable preechocan stream from inline HW echocanceler. */
- int (*enable_hw_preechocan)(struct dahdi_chan *chan);
-
- /*! Opt: Disable preechocan stream from inline HW echocanceler. */
- void (*disable_hw_preechocan)(struct dahdi_chan *chan);
-
- /*! Opt: Dacs the contents of chan2 into chan1 if possible */
- int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
-
- /*! Opt: Provide echo cancellation on a channel */
- int (*echocan_create)(struct dahdi_chan *chan,
- struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p,
- struct dahdi_echocan_state **ec);
-
- /*! Opt: Provide the name of the echo canceller on a channel */
- const char *(*echocan_name)(const struct dahdi_chan *chan);
-
- /*! When using "pinned_spans", this function is called back when this
- * span has been assigned with the system. */
- void (*assigned)(struct dahdi_span *span);
-
- /*! Called when the spantype / linemode is changed before the span is
- * assigned a number. */
- int (*set_spantype)(struct dahdi_span *span, enum spantypes st);
-};
-
-/**
- * dahdi_device - Represents a device that can contain one or more spans.
- *
- * @spans: List of child spans.
- * @manufacturer: Device manufacturer.
- * @location: The location of this device. This should not change if
- * the device is replaced (e.g: in the same PCI slot)
- * @hardware_id: The hardware_id of this device (NULL for devices without
- * a hardware_id). This should not change if the device is
- * relocated to a different location (e.g: different PCI slot)
- * @devicetype: What type of device this is.
- * @irqmisses: Count of "interrupt misses" for this device.
- *
- */
-struct dahdi_device {
- struct list_head spans;
- const char *manufacturer;
- const char *location;
- const char *hardware_id;
- const char *devicetype;
- struct device dev;
- unsigned int irqmisses;
-};
-
-struct dahdi_span {
- spinlock_t lock;
- char name[40]; /*!< Span name */
- char desc[80]; /*!< Span description */
- enum spantypes spantype; /*!< span type */
- int deflaw; /*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */
- int alarms; /*!< Pending alarms on span */
- unsigned long flags;
- u8 cannot_provide_timing:1;
- int lbo; /*!< Span Line-Buildout */
- int lineconfig; /*!< Span line configuration */
- int linecompat; /*!< Span line compatibility (0 for
- analog spans)*/
- int channels; /*!< Number of channels in span */
- int txlevel; /*!< Tx level */
- int rxlevel; /*!< Rx level */
- int syncsrc; /*!< current sync src (gets copied here) */
- struct dahdi_count count; /*!< Performance and Error counters */
-
- int maintstat; /*!< Maintenance state */
- int mainttimer; /*!< Maintenance timer */
-
- int timingslips; /*!< Clock slips */
-
- struct dahdi_chan **chans; /*!< Member channel structures */
-
- const struct dahdi_span_ops *ops; /*!< span callbacks. */
-
- /* Used by DAHDI only -- no user servicable parts inside */
- int spanno; /*!< Span number for DAHDI */
- int offset; /*!< Offset within a given card */
- int lastalarms; /*!< Previous alarms */
-
-#ifdef CONFIG_DAHDI_WATCHDOG
- int watchcounter;
- int watchstate;
-#endif
-
-#ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_entry;
-#endif
- struct list_head spans_node;
-
- struct dahdi_device *parent;
- struct list_head device_node;
- struct device *span_device;
-};
-
-struct dahdi_transcoder_channel {
- void *pvt;
- struct dahdi_transcoder *parent;
- wait_queue_head_t ready;
- __u32 built_fmts;
-#define DAHDI_TC_FLAG_BUSY 1
-#define DAHDI_TC_FLAG_CHAN_BUILT 2
-#define DAHDI_TC_FLAG_NONBLOCK 3
-#define DAHDI_TC_FLAG_DATA_WAITING 4
- unsigned long flags;
- u32 dstfmt;
- u32 srcfmt;
-};
-
-int dahdi_is_sync_master(const struct dahdi_span *span);
-
-static inline int
-dahdi_tc_is_built(struct dahdi_transcoder_channel *dtc) {
- return test_bit(DAHDI_TC_FLAG_CHAN_BUILT, &dtc->flags);
-}
-static inline void
-dahdi_tc_set_built(struct dahdi_transcoder_channel *dtc) {
- set_bit(DAHDI_TC_FLAG_CHAN_BUILT, &dtc->flags);
-}
-static inline void
-dahdi_tc_clear_built(struct dahdi_transcoder_channel *dtc) {
- clear_bit(DAHDI_TC_FLAG_CHAN_BUILT, &dtc->flags);
-}
-static inline int
-dahdi_tc_is_nonblock(struct dahdi_transcoder_channel *dtc) {
- return test_bit(DAHDI_TC_FLAG_NONBLOCK, &dtc->flags);
-}
-static inline void
-dahdi_tc_set_nonblock(struct dahdi_transcoder_channel *dtc) {
- set_bit(DAHDI_TC_FLAG_NONBLOCK, &dtc->flags);
-}
-static inline void
-dahdi_tc_clear_nonblock(struct dahdi_transcoder_channel *dtc) {
- clear_bit(DAHDI_TC_FLAG_NONBLOCK, &dtc->flags);
-}
-static inline int
-dahdi_tc_is_data_waiting(struct dahdi_transcoder_channel *dtc) {
- return test_bit(DAHDI_TC_FLAG_DATA_WAITING, &dtc->flags);
-}
-static inline int
-dahdi_tc_is_busy(struct dahdi_transcoder_channel *dtc) {
- return test_bit(DAHDI_TC_FLAG_BUSY, &dtc->flags);
-}
-static inline void
-dahdi_tc_set_busy(struct dahdi_transcoder_channel *dtc) {
- set_bit(DAHDI_TC_FLAG_BUSY, &dtc->flags);
-}
-static inline void
-dahdi_tc_clear_busy(struct dahdi_transcoder_channel *dtc) {
- clear_bit(DAHDI_TC_FLAG_BUSY, &dtc->flags);
-}
-static inline void
-dahdi_tc_set_data_waiting(struct dahdi_transcoder_channel *dtc) {
- set_bit(DAHDI_TC_FLAG_DATA_WAITING, &dtc->flags);
-}
-static inline void
-dahdi_tc_clear_data_waiting(struct dahdi_transcoder_channel *dtc) {
- clear_bit(DAHDI_TC_FLAG_DATA_WAITING, &dtc->flags);
-}
-
-struct dahdi_transcoder {
- struct list_head active_list_node;
- struct list_head registration_list_node;
- char name[80];
- int numchannels;
- unsigned int srcfmts;
- unsigned int dstfmts;
- struct file_operations fops;
- int (*allocate)(struct dahdi_transcoder_channel *channel);
- int (*release)(struct dahdi_transcoder_channel *channel);
- /* Transcoder channels */
- struct dahdi_transcoder_channel channels[0];
-};
-
-#define DAHDI_WATCHDOG_NOINTS (1 << 0)
-
-#define DAHDI_WATCHDOG_INIT 1000
-
-#define DAHDI_WATCHSTATE_UNKNOWN 0
-#define DAHDI_WATCHSTATE_OK 1
-#define DAHDI_WATCHSTATE_RECOVERING 2
-#define DAHDI_WATCHSTATE_FAILED 3
-
-
-struct dahdi_dynamic {
- char addr[40];
- char dname[20];
- int err;
- struct kref kref;
- long rxjif;
- unsigned short txcnt;
- unsigned short rxcnt;
- struct dahdi_device *ddev;
- struct dahdi_span span;
- struct dahdi_chan *chans[256];
- struct dahdi_dynamic_driver *driver;
- void *pvt;
- int timing;
- int master;
- unsigned char *msgbuf;
- struct device *dev;
-
- struct list_head list;
-};
-
-struct dahdi_dynamic_driver {
- /*! Driver name (e.g. Eth) */
- const char *name;
-
- /*! Driver description */
- const char *desc;
-
- /*! Create a new transmission pipe */
- int (*create)(struct dahdi_dynamic *d, const char *address);
-
- /*! Destroy a created transmission pipe */
- void (*destroy)(struct dahdi_dynamic *d);
-
- /*! Transmit a given message */
- void (*transmit)(struct dahdi_dynamic *d, u8 *msg, size_t msglen);
-
- /*! Flush any pending messages */
- int (*flush)(void);
-
- struct list_head list;
- struct module *owner;
-
- /*! Numberic id of next device created by this driver. */
- unsigned int id;
-};
-
-/*! \brief Receive a dynamic span message */
-void dahdi_dynamic_receive(struct dahdi_span *span, unsigned char *msg, int msglen);
-
-/*! \brief Register a dynamic driver */
-int dahdi_dynamic_register_driver(struct dahdi_dynamic_driver *driver);
-
-/*! \brief Unregister a dynamic driver */
-void dahdi_dynamic_unregister_driver(struct dahdi_dynamic_driver *driver);
-
-int _dahdi_receive(struct dahdi_span *span);
-
-/*! Receive on a span. The DAHDI interface will handle all the calculations for
- all member channels of the span, pulling the data from the readchunk buffer */
-static inline int dahdi_receive(struct dahdi_span *span)
-{
- unsigned long flags;
- int ret;
- local_irq_save(flags);
- ret = _dahdi_receive(span);
- local_irq_restore(flags);
- return ret;
-}
-
-int _dahdi_transmit(struct dahdi_span *span);
-
-/*! Prepare writechunk buffers on all channels for this span */
-static inline int dahdi_transmit(struct dahdi_span *span)
-{
- unsigned long flags;
- int ret;
- local_irq_save(flags);
- ret = _dahdi_transmit(span);
- local_irq_restore(flags);
- return ret;
-}
-
-static inline int dahdi_is_digital_span(const struct dahdi_span *s)
-{
- return (s->linecompat > 0);
-}
-
-static inline int dahdi_is_t1_span(const struct dahdi_span *s)
-{
- return (s->linecompat & (DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF |
- DAHDI_CONFIG_B8ZS)) > 0;
-}
-
-static inline int dahdi_is_e1_span(const struct dahdi_span *s)
-{
- return dahdi_is_digital_span(s) && !dahdi_is_t1_span(s);
-}
-
-/*! Abort the buffer currently being receive with event "event" */
-void dahdi_hdlc_abort(struct dahdi_chan *ss, int event);
-
-/*! Indicate to DAHDI that the end of frame was received and rotate buffers */
-void dahdi_hdlc_finish(struct dahdi_chan *ss);
-
-/*! Put a chunk of data into the current receive buffer */
-void dahdi_hdlc_putbuf(struct dahdi_chan *ss, unsigned char *rxb, int bytes);
-
-/*! Get a chunk of data from the current transmit buffer. Returns -1 if no data
- * is left to send, 0 if there is data remaining in the current message to be sent
- * and 1 if the currently transmitted message is now done */
-int dahdi_hdlc_getbuf(struct dahdi_chan *ss, unsigned char *bufptr, unsigned int *size);
-
-/*! Register a device. Returns 0 on success, -1 on failure. */
-struct dahdi_device *dahdi_create_device(void);
-int dahdi_register_device(struct dahdi_device *ddev, struct device *parent);
-void dahdi_unregister_device(struct dahdi_device *ddev);
-void dahdi_free_device(struct dahdi_device *ddev);
-void dahdi_init_span(struct dahdi_span *span);
-
-/*! Allocate / free memory for a transcoder */
-struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans);
-void dahdi_transcoder_free(struct dahdi_transcoder *ztc);
-
-/*! \brief Register a transcoder */
-int dahdi_transcoder_register(struct dahdi_transcoder *tc);
-
-/*! \brief Unregister a transcoder */
-int dahdi_transcoder_unregister(struct dahdi_transcoder *tc);
-
-/*! \brief Alert a transcoder */
-int dahdi_transcoder_alert(struct dahdi_transcoder_channel *ztc);
-
-/*! \brief Gives a name to an LBO */
-const char *dahdi_lboname(int lbo);
-
-/*! \brief Tell DAHDI about changes in received rbs bits */
-void dahdi_rbsbits(struct dahdi_chan *chan, int bits);
-
-/*! \brief Tell DAHDI abou changes in received signalling */
-void dahdi_hooksig(struct dahdi_chan *chan, enum dahdi_rxsig rxsig);
-
-/*! \brief Queue an event on a channel */
-void dahdi_qevent_nolock(struct dahdi_chan *chan, int event);
-
-/*! \brief Queue an event on a channel, locking it first */
-void dahdi_qevent_lock(struct dahdi_chan *chan, int event);
-
-/*! \brief Notify a change possible change in alarm status on a channel */
-void dahdi_alarm_channel(struct dahdi_chan *chan, int alarms);
-
-/*! \brief Notify a change possible change in alarm status on a span */
-void dahdi_alarm_notify(struct dahdi_span *span);
-
-/*! \brief Initialize a tone state */
-void dahdi_init_tone_state(struct dahdi_tone_state *ts, struct dahdi_tone *zt);
-
-/*! \brief Get a given MF tone struct, suitable for dahdi_tone_nextsample. */
-struct dahdi_tone *dahdi_mf_tone(const struct dahdi_chan *chan, char digit, int digitmode);
-
-/* 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 DAHDI LEVEL. dahdi_ec_chunk will not echo cancel if it should
- not be doing so. rxchunk is modified in-place */
-void __dahdi_ec_chunk(struct dahdi_chan *ss, u8 *rxchunk,
- const u8 *preecchunk, const u8 *txchunk);
-
-static inline void _dahdi_ec_chunk(struct dahdi_chan *chan,
- u8 *rxchunk, const u8 *txchunk)
-{
- __dahdi_ec_chunk(chan, rxchunk, rxchunk, txchunk);
-}
-
-static inline void dahdi_ec_chunk(struct dahdi_chan *ss, unsigned char *rxchunk,
- const unsigned char *txchunk)
-{
- unsigned long flags;
- local_irq_save(flags);
- _dahdi_ec_chunk(ss, rxchunk, txchunk);
- local_irq_restore(flags);
-}
-
-void _dahdi_ec_span(struct dahdi_span *span);
-static inline void dahdi_ec_span(struct dahdi_span *span)
-{
- unsigned long flags;
- local_irq_save(flags);
- _dahdi_ec_span(span);
- local_irq_restore(flags);
-}
-
-extern struct file_operations *dahdi_transcode_fops;
-
-/* Don't use these directly -- they're not guaranteed to
- be there. */
-extern short __dahdi_mulaw[256];
-extern short __dahdi_alaw[256];
-#ifdef CONFIG_CALC_XLAW
-u_char __dahdi_lineartoulaw(short a);
-u_char __dahdi_lineartoalaw(short a);
-#else
-extern u_char __dahdi_lin2mu[16384];
-extern u_char __dahdi_lin2a[16384];
-#endif
-
-struct dahdi_dynamic_ops {
- struct module *owner;
- int (*ioctl)(unsigned int cmd, unsigned long data);
-};
-
-/*! \brief Used by dynamic DAHDI -- don't use directly */
-void dahdi_set_dynamic_ops(const struct dahdi_dynamic_ops *ops);
-
-/*! \brief Used by DAHDI HPEC module -- don't use directly */
-void dahdi_set_hpec_ioctl(int (*func)(unsigned int cmd, unsigned long data));
-
-/*! \brief Used privately by DAHDI. Avoid touching directly */
-struct dahdi_tone {
- int fac1;
- int init_v2_1;
- int init_v3_1;
-
- int fac2;
- int init_v2_2;
- int init_v3_2;
-
- int tonesamples; /*!< How long to play this tone before
- going to the next (in samples) */
- struct dahdi_tone *next; /* Next tone in this sequence */
-
- int modulate;
-};
-
-static inline short dahdi_tone_nextsample(struct dahdi_tone_state *ts, struct dahdi_tone *zt)
-{
- /* follow the curves, return the sum */
-
- int p;
-
- ts->v1_1 = ts->v2_1;
- ts->v2_1 = ts->v3_1;
- ts->v3_1 = (zt->fac1 * ts->v2_1 >> 15) - ts->v1_1;
-
- ts->v1_2 = ts->v2_2;
- ts->v2_2 = ts->v3_2;
- ts->v3_2 = (zt->fac2 * ts->v2_2 >> 15) - ts->v1_2;
-
- /* Return top 16 bits */
- if (!ts->modulate) return ts->v3_1 + ts->v3_2;
- /* we are modulating */
- p = ts->v3_2 - 32768;
- if (p < 0) p = -p;
- p = ((p * 9) / 10) + 1;
- return (ts->v3_1 * p) >> 15;
-
-}
-
-static inline short dahdi_txtone_nextsample(struct dahdi_chan *ss)
-{
- /* follow the curves, return the sum */
-
- ss->v1_1 = ss->v2_1;
- ss->v2_1 = ss->v3_1;
- ss->v3_1 = (ss->txtone * ss->v2_1 >> 15) - ss->v1_1;
- return ss->v3_1;
-}
-
-/* These are the right functions to use. */
-
-#define DAHDI_MULAW(a) (__dahdi_mulaw[(a)])
-#define DAHDI_ALAW(a) (__dahdi_alaw[(a)])
-#define DAHDI_XLAW(a,c) (c->xlaw[(a)])
-
-#ifdef CONFIG_CALC_XLAW
-#define DAHDI_LIN2MU(a) (__dahdi_lineartoulaw((a)))
-#define DAHDI_LIN2A(a) (__dahdi_lineartoalaw((a)))
-
-#define DAHDI_LIN2X(a,c) ((c)->lineartoxlaw((a)))
-
-#else
-/* Use tables */
-#define DAHDI_LIN2MU(a) (__dahdi_lin2mu[((unsigned short)(a)) >> 2])
-#define DAHDI_LIN2A(a) (__dahdi_lin2a[((unsigned short)(a)) >> 2])
-
-/* Manipulate as appropriate for x-law */
-#define DAHDI_LIN2X(a,c) ((c)->lin2x[((unsigned short)(a)) >> 2])
-
-#endif /* CONFIG_CALC_XLAW */
-
-/* Data formats for capabilities and frames alike (from Asterisk) */
-/*! G.723.1 compression */
-#define DAHDI_FORMAT_G723_1 (1 << 0)
-/*! GSM compression */
-#define DAHDI_FORMAT_GSM (1 << 1)
-/*! Raw mu-law data (G.711) */
-#define DAHDI_FORMAT_ULAW (1 << 2)
-/*! Raw A-law data (G.711) */
-#define DAHDI_FORMAT_ALAW (1 << 3)
-/*! ADPCM (G.726, 32kbps) */
-#define DAHDI_FORMAT_G726 (1 << 4)
-/*! ADPCM (IMA) */
-#define DAHDI_FORMAT_ADPCM (1 << 5)
-/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
-#define DAHDI_FORMAT_SLINEAR (1 << 6)
-/*! LPC10, 180 samples/frame */
-#define DAHDI_FORMAT_LPC10 (1 << 7)
-/*! G.729A audio */
-#define DAHDI_FORMAT_G729A (1 << 8)
-/*! SpeeX Free Compression */
-#define DAHDI_FORMAT_SPEEX (1 << 9)
-/*! iLBC Free Compression */
-#define DAHDI_FORMAT_ILBC (1 << 10)
-/*! Maximum audio format */
-#define DAHDI_FORMAT_MAX_AUDIO (1 << 15)
-/*! Maximum audio mask */
-#define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1)
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
-#define KERN_CONT ""
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
-#ifndef clamp
-#define clamp(x, low, high) min(max(low, x), high)
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
-
-/* Some distributions backported fatal_signal_pending so we'll use a macro to
- * override the inline function definition. */
-#define fatal_signal_pending(p) \
- (signal_pending((p)) && sigismember(&(p)->pending.signal, SIGKILL))
-
-#ifdef CONFIG_PCI
-#ifndef PCIE_LINK_STATE_L0S
-#define PCIE_LINK_STATE_L0S 1
-#define PCIE_LINK_STATE_L1 2
-#define PCIE_LINK_STATE_CLKPM 4
-#endif
-#define pci_disable_link_state dahdi_pci_disable_link_state
-void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state);
-#endif /* CONFIG_PCI */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
-
-#ifndef __packed
-#define __packed __attribute__((packed))
-#endif
-
-#include <linux/ctype.h>
-/* A define of 'clamp_val' happened to be added in the patch
- * linux-2.6-sata-prep-work-for-rhel5-3.patch kernel-2.6.spec that also
- * backported support for strcasecmp to some later RHEL/Centos kernels.
- * If you have an older kernel that breaks because strcasecmp is already
- * defined, somebody out-smarted us. In that case, replace the line below
- * with '#if 0' to get the code building, and file a bug report at
- * https://issues.asterisk.org/ .
- */
-#ifndef clamp_val
-static inline int strcasecmp(const char *s1, const char *s2)
-{
- int c1, c2;
-
- do {
- c1 = tolower(*s1++);
- c2 = tolower(*s2++);
- } while (c1 == c2 && c1 != 0);
- return c1 - c2;
-}
-#endif /* clamp_val */
-
-#endif /* 2.6.22 */
-#endif /* 2.6.25 */
-#endif /* 2.6.26 */
-#endif /* 2.6.31 */
-
-#ifndef CONFIG_TRACING
-#define trace_printk printk
-#endif
-
-#ifndef DEFINE_SPINLOCK
-#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
-#endif
-
-#ifndef DEFINE_SEMAPHORE
-#define DEFINE_SEMAPHORE(name) \
- struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
-#endif
-
-#ifndef DEFINE_MUTEX
-struct mutex {
- struct semaphore sem;
-};
-#define DEFINE_MUTEX(name) \
- struct mutex name = { \
- .sem = __SEMAPHORE_INITIALIZER((name).sem, 1), \
- }
-#define mutex_lock(_x) down(&(_x)->sem)
-#define mutex_unlock(_x) up(&(_x)->sem)
-#define mutex_init(_x) sema_init(&(_x)->sem, 1)
-#endif
-
-#ifndef DEFINE_PCI_DEVICE_TABLE
-#define DEFINE_PCI_DEVICE_TABLE(_x) \
- const struct pci_device_id _x[] __devinitdata
-#endif
-
-#ifndef DMA_BIT_MASK
-#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
-#endif
-
-/* WARN_ONCE first showed up in the kernel in 2.6.27 but it may have been
- * backported. */
-#ifndef WARN_ONCE
-#define WARN_ONCE(condition, format...) WARN_ON_ONCE(condition)
-#endif
-
-#define DAHDI_CTL 0
-#define DAHDI_TRANSCODE 250
-#define DAHDI_TIMER 253
-#define DAHDI_CHANNEL 254
-#define DAHDI_PSEUDO 255
-
-/* prink-wrapper macros */
-
-#define module_printk(level, fmt, args...) \
- printk(level "%s: " fmt, THIS_MODULE->name, ## args)
-
-#define DAHDI_PRINTK(level, category, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
- THIS_MODULE->name, ## __VA_ARGS__)
-#define span_printk(level, category, span, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: span-%d: " fmt, #level, \
- category, THIS_MODULE->name, (span)->spanno, ## __VA_ARGS__)
-#define chan_printk(level, category, chan, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: chan-%d: " fmt, #level, \
- category, THIS_MODULE->name, (chan)->channo, ## __VA_ARGS__)
-#define dahdi_err(fmt, ...) DAHDI_PRINTK(ERR, "", fmt, ## __VA_ARGS__)
-#define span_info(span, fmt, ...) span_printk(INFO, "", span, fmt, \
- ## __VA_ARGS__)
-#define span_notice(span, fmt, ...) span_printk(NOTICE, "", span, fmt, \
- ## __VA_ARGS__)
-#define span_err(span, fmt, ...) span_printk(ERR, "", span, fmt, \
- ## __VA_ARGS__)
-#define chan_notice(chan, fmt, ...) chan_printk(NOTICE, "", chan, fmt, \
- ## __VA_ARGS__)
-#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
- ## __VA_ARGS__)
-
-#ifndef pr_err
-#define pr_err(fmt, ...) \
- printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#endif
-#ifndef pr_warning
-#define pr_warning(fmt, ...) \
- printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#endif
-#ifndef pr_warn
-#define pr_warn pr_warning
-#endif
-#ifndef pr_notice
-#define pr_notice(fmt, ...) \
- printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
-#endif
-#ifndef pr_info
-#define pr_info(fmt, ...) \
- printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
-#endif
-
-/* The dbg_* ones use a magical variable 'debug' and the user should be
- * aware of that.
-*/
-#ifdef DAHDI_PRINK_MACROS_USE_debug
-#ifndef BIT /* added in 2.6.24 */
-#define BIT(i) (1UL << (i))
-#endif
-/* Standard debug bit values. Any module may define others. They must
- * be of the form DAHDI_DBG_*
- */
-#define DAHDI_DBG_GENERAL BIT(0)
-#define DAHDI_DBG_ASSIGN BIT(1)
-#define DAHDI_DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
-#define dahdi_dbg(bits, fmt, ...) \
- ((void)((debug & (DAHDI_DBG_ ## bits)) && DAHDI_PRINTK(DEBUG, \
- "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define span_dbg(bits, span, fmt, ...) \
- ((void)((debug & (DAHDI_DBG_ ## bits)) && \
- span_printk(DEBUG, "-" #bits, span, "%s: " \
- fmt, __func__, ## __VA_ARGS__)))
-#define chan_dbg(bits, chan, fmt, ...) \
- ((void)((debug & (DAHDI_DBG_ ## bits)) && \
- chan_printk(DEBUG, "-" #bits, chan, \
- "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define dahdi_dev_dbg(bits, dev, fmt, ...) \
- ((void)((debug & (DAHDI_DBG_ ## bits)) && \
- dev_printk(KERN_DEBUG, dev, \
- "DBG-%s(%s): " fmt, #bits, __func__, ## __VA_ARGS__)))
-#endif /* DAHDI_PRINK_MACROS_USE_debug */
-
-#endif /* _DAHDI_KERNEL_H */
diff --git a/include/dahdi/user.h b/include/dahdi/user.h
deleted file mode 100644
index 5f2d192..0000000
--- a/include/dahdi/user.h
+++ /dev/null
@@ -1,1215 +0,0 @@
-/*
- * DAHDI Telephony Interface
- *
- * Written by Mark Spencer <markster@digium.com>
- * 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 - 2008 Digium, Inc.
- *
- * All rights reserved.
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU Lesser General Public License Version 2.1 as published
- * by the Free Software Foundation. See the LICENSE.LGPL file
- * included with this program for more details.
- *
- * In addition, when this program is distributed with Asterisk in
- * any form that would qualify as a 'combined work' or as a
- * 'derivative work' (but not mere aggregation), you can redistribute
- * and/or modify the combination under the terms of the license
- * provided with that copy of Asterisk, instead of the license
- * terms granted here.
- */
-
-#ifndef _DAHDI_USER_H
-#define _DAHDI_USER_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <dahdi/dahdi_config.h>
-
-#ifndef ELAST
-#define ELAST 500
-#endif
-
-/* Per-span configuration values */
-#define DAHDI_CONFIG_TXLEVEL 7 /* bits 0-2 are tx level */
-
-/* Line configuration */
-/* These apply to T1 */
-#define DAHDI_CONFIG_D4 (1 << 4)
-#define DAHDI_CONFIG_ESF (1 << 5)
-#define DAHDI_CONFIG_AMI (1 << 6)
-#define DAHDI_CONFIG_B8ZS (1 << 7)
-/* These apply to E1 */
-#define DAHDI_CONFIG_CCS (1 << 8) /* CCS (ISDN) instead of CAS (Robbed Bit) */
-#define DAHDI_CONFIG_HDB3 (1 << 9) /* HDB3 instead of AMI (line coding) */
-#define DAHDI_CONFIG_CRC4 (1 << 10) /* CRC4 framing */
-#define DAHDI_CONFIG_NOTOPEN (1 << 16)
-/* These apply to BRI */
-#define DAHDI_CONFIG_NTTE (1 << 11) /* To enable NT mode, set this bit to 1, for TE this should be 0 */
-#define DAHDI_CONFIG_TERM (1 << 12) /* To enable Termination resistance set this bit to 1 */
-
-/* Signalling types */
-#define DAHDI_SIG_BROKEN (1 << 31) /* The port is broken and/or failed initialization */
-
-#define __DAHDI_SIG_FXO (1 << 12) /* Never use directly */
-#define __DAHDI_SIG_FXS (1 << 13) /* Never use directly */
-
-#define DAHDI_SIG_NONE (0) /* Channel not configured */
-#define DAHDI_SIG_FXSLS ((1 << 0) | __DAHDI_SIG_FXS) /* FXS, Loopstart */
-#define DAHDI_SIG_FXSGS ((1 << 1) | __DAHDI_SIG_FXS) /* FXS, Groundstart */
-#define DAHDI_SIG_FXSKS ((1 << 2) | __DAHDI_SIG_FXS) /* FXS, Kewlstart */
-
-#define DAHDI_SIG_FXOLS ((1 << 3) | __DAHDI_SIG_FXO) /* FXO, Loopstart */
-#define DAHDI_SIG_FXOGS ((1 << 4) | __DAHDI_SIG_FXO) /* FXO, Groupstart */
-#define DAHDI_SIG_FXOKS ((1 << 5) | __DAHDI_SIG_FXO) /* FXO, Kewlstart */
-
-#define DAHDI_SIG_EM (1 << 6) /* Ear & Mouth (E&M) */
-
-/* The following are all variations on clear channel */
-
-#define __DAHDI_SIG_DACS (1 << 16)
-
-#define DAHDI_SIG_CLEAR (1 << 7) /* Clear channel */
-#define DAHDI_SIG_HDLCRAW ((1 << 8) | DAHDI_SIG_CLEAR) /* Raw unchecked HDLC */
-#define DAHDI_SIG_HDLCFCS ((1 << 9) | DAHDI_SIG_HDLCRAW) /* HDLC with FCS calculation */
-#define DAHDI_SIG_HDLCNET ((1 << 10) | DAHDI_SIG_HDLCFCS) /* HDLC Network */
-#define DAHDI_SIG_SLAVE (1 << 11) /* Slave to another channel */
-#define DAHDI_SIG_SF (1 << 14) /* Single Freq. tone only, no sig bits */
-#define DAHDI_SIG_CAS (1 << 15) /* Just get bits */
-#define DAHDI_SIG_DACS (__DAHDI_SIG_DACS | DAHDI_SIG_CLEAR) /* Cross connect */
-#define DAHDI_SIG_EM_E1 (1 << 17) /* E1 E&M Variation */
-#define DAHDI_SIG_DACS_RBS ((1 << 18) | __DAHDI_SIG_DACS) /* Cross connect w/ RBS */
-#define DAHDI_SIG_HARDHDLC ((1 << 19) | DAHDI_SIG_CLEAR)
-#define DAHDI_SIG_MTP2 ((1 << 20) | DAHDI_SIG_HDLCFCS) /* MTP2 support Need HDLC bitstuff and FCS calcuation too */
-
-/* tone flag values */
-#define DAHDI_REVERSE_RXTONE 1 /* reverse polarity rx tone logic */
-#define DAHDI_REVERSE_TXTONE 2 /* reverse polarity tx tone logic */
-
-#define DAHDI_ABIT (1 << 3)
-#define DAHDI_BBIT (1 << 2)
-#define DAHDI_CBIT (1 << 1)
-#define DAHDI_DBIT (1 << 0)
-
-#define DAHDI_BITS_ABCD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
-#define DAHDI_BITS_ABD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_DBIT)
-#define DAHDI_BITS_ACD (DAHDI_ABIT | DAHDI_CBIT | DAHDI_DBIT)
-#define DAHDI_BITS_BCD (DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
-#define DAHDI_BITS_AC (DAHDI_ABIT | DAHDI_CBIT)
-#define DAHDI_BITS_BD (DAHDI_BBIT | DAHDI_DBIT)
-
-#define DAHDI_MAJOR 196
-
-#define DAHDI_MAX_BLOCKSIZE 8192
-#define DAHDI_DEFAULT_NUM_BUFS 2
-#define DAHDI_MAX_NUM_BUFS 32
-#define DAHDI_MAX_BUF_SPACE 32768
-
-#define DAHDI_DEFAULT_BLOCKSIZE 1024
-#define DAHDI_DEFAULT_MTR_MRU 2048
-
-/*! Define the default network block size */
-#define DAHDI_DEFAULT_MTU_MRU 2048
-
-#define DAHDI_POLICY_IMMEDIATE 0 /* Start play/record immediately */
-#define DAHDI_POLICY_WHEN_FULL 1 /* Start play/record when buffer is full */
-#define DAHDI_POLICY_HALF_FULL 2 /* Start play/record when buffer is half full.
- Note -- This policy only works on tx buffers */
-
-#define DAHDI_GET_PARAMS_RETURN_MASTER 0x40000000
-
-#define DAHDI_TONE_ZONE_MAX 128
-
-#define DAHDI_TONE_ZONE_DEFAULT -1 /* To restore default */
-
-#define DAHDI_TONE_STOP -1
-#define DAHDI_TONE_DIALTONE 0
-#define DAHDI_TONE_BUSY 1
-#define DAHDI_TONE_RINGTONE 2
-#define DAHDI_TONE_CONGESTION 3
-#define DAHDI_TONE_CALLWAIT 4
-#define DAHDI_TONE_DIALRECALL 5
-#define DAHDI_TONE_RECORDTONE 6
-#define DAHDI_TONE_INFO 7
-#define DAHDI_TONE_CUST1 8
-#define DAHDI_TONE_CUST2 9
-#define DAHDI_TONE_STUTTER 10
-#define DAHDI_TONE_MAX 16
-
-#define DAHDI_TONE_DTMF_BASE 64
-#define DAHDI_TONE_MFR1_BASE 80
-#define DAHDI_TONE_MFR2_FWD_BASE 96
-#define DAHDI_TONE_MFR2_REV_BASE 112
-
-enum {
- DAHDI_TONE_DTMF_0 = DAHDI_TONE_DTMF_BASE,
- DAHDI_TONE_DTMF_1,
- DAHDI_TONE_DTMF_2,
- DAHDI_TONE_DTMF_3,
- DAHDI_TONE_DTMF_4,
- DAHDI_TONE_DTMF_5,
- DAHDI_TONE_DTMF_6,
- DAHDI_TONE_DTMF_7,
- DAHDI_TONE_DTMF_8,
- DAHDI_TONE_DTMF_9,
- DAHDI_TONE_DTMF_s,
- DAHDI_TONE_DTMF_p,
- DAHDI_TONE_DTMF_A,
- DAHDI_TONE_DTMF_B,
- DAHDI_TONE_DTMF_C,
- DAHDI_TONE_DTMF_D
-};
-
-#define DAHDI_TONE_DTMF_MAX DAHDI_TONE_DTMF_D
-
-enum {
- DAHDI_TONE_MFR1_0 = DAHDI_TONE_MFR1_BASE,
- DAHDI_TONE_MFR1_1,
- DAHDI_TONE_MFR1_2,
- DAHDI_TONE_MFR1_3,
- DAHDI_TONE_MFR1_4,
- DAHDI_TONE_MFR1_5,
- DAHDI_TONE_MFR1_6,
- DAHDI_TONE_MFR1_7,
- DAHDI_TONE_MFR1_8,
- DAHDI_TONE_MFR1_9,
- DAHDI_TONE_MFR1_KP,
- DAHDI_TONE_MFR1_ST,
- DAHDI_TONE_MFR1_STP,
- DAHDI_TONE_MFR1_ST2P,
- DAHDI_TONE_MFR1_ST3P,
-};
-
-#define DAHDI_TONE_MFR1_MAX DAHDI_TONE_MFR1_ST3P
-
-enum {
- DAHDI_TONE_MFR2_FWD_1 = DAHDI_TONE_MFR2_FWD_BASE,
- DAHDI_TONE_MFR2_FWD_2,
- DAHDI_TONE_MFR2_FWD_3,
- DAHDI_TONE_MFR2_FWD_4,
- DAHDI_TONE_MFR2_FWD_5,
- DAHDI_TONE_MFR2_FWD_6,
- DAHDI_TONE_MFR2_FWD_7,
- DAHDI_TONE_MFR2_FWD_8,
- DAHDI_TONE_MFR2_FWD_9,
- DAHDI_TONE_MFR2_FWD_10,
- DAHDI_TONE_MFR2_FWD_11,
- DAHDI_TONE_MFR2_FWD_12,
- DAHDI_TONE_MFR2_FWD_13,
- DAHDI_TONE_MFR2_FWD_14,
- DAHDI_TONE_MFR2_FWD_15,
-};
-
-#define DAHDI_TONE_MFR2_FWD_MAX DAHDI_TONE_MFR2_FWD_15
-
-enum {
- DAHDI_TONE_MFR2_REV_1 = DAHDI_TONE_MFR2_REV_BASE,
- DAHDI_TONE_MFR2_REV_2,
- DAHDI_TONE_MFR2_REV_3,
- DAHDI_TONE_MFR2_REV_4,
- DAHDI_TONE_MFR2_REV_5,
- DAHDI_TONE_MFR2_REV_6,
- DAHDI_TONE_MFR2_REV_7,
- DAHDI_TONE_MFR2_REV_8,
- DAHDI_TONE_MFR2_REV_9,
- DAHDI_TONE_MFR2_REV_10,
- DAHDI_TONE_MFR2_REV_11,
- DAHDI_TONE_MFR2_REV_12,
- DAHDI_TONE_MFR2_REV_13,
- DAHDI_TONE_MFR2_REV_14,
- DAHDI_TONE_MFR2_REV_15,
-};
-
-#define DAHDI_TONE_MFR2_REV_MAX DAHDI_TONE_MFR2_REV_15
-
-#define DAHDI_LAW_DEFAULT 0 /* Default law for span */
-#define DAHDI_LAW_MULAW 1 /* Mu-law */
-#define DAHDI_LAW_ALAW 2 /* A-law */
-
-#define DAHDI_DIAL_OP_APPEND 1
-#define DAHDI_DIAL_OP_REPLACE 2
-#define DAHDI_DIAL_OP_CANCEL 3
-
-#define DAHDI_MAX_CADENCE 16
-
-#define DAHDI_TONEDETECT_ON (1 << 0) /* Detect tones */
-#define DAHDI_TONEDETECT_MUTE (1 << 1) /* Mute audio in received channel */
-
-/* Define the max # of outgoing DTMF, MFR1 or MFR2 digits to queue */
-#define DAHDI_MAX_DTMF_BUF 256
-
-#define DAHDI_MAX_EVENTSIZE 64 /* 64 events max in buffer */
-
-/* Value for DAHDI_HOOK, set to ON hook */
-#define DAHDI_ONHOOK 0
-
-/* Value for DAHDI_HOOK, set to OFF hook */
-#define DAHDI_OFFHOOK 1
-
-/* Value for DAHDI_HOOK, wink (off hook momentarily) */
-#define DAHDI_WINK 2
-
-/* Value for DAHDI_HOOK, flash (on hook momentarily) */
-#define DAHDI_FLASH 3
-
-/* Value for DAHDI_HOOK, start line */
-#define DAHDI_START 4
-
-/* Value for DAHDI_HOOK, ring line (same as start line) */
-#define DAHDI_RING 5
-
-/* Value for DAHDI_HOOK, turn ringer off */
-#define DAHDI_RINGOFF 6
-
-/* Flush and stop the read (input) process */
-#define DAHDI_FLUSH_READ 1
-
-/* Flush and stop the write (output) process */
-#define DAHDI_FLUSH_WRITE 2
-
-/* Flush and stop both (input and output) processes */
-#define DAHDI_FLUSH_BOTH (DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE)
-
-/* Flush the event queue */
-#define DAHDI_FLUSH_EVENT 4
-
-/* Flush everything */
-#define DAHDI_FLUSH_ALL (DAHDI_FLUSH_BOTH | DAHDI_FLUSH_EVENT)
-
-#define DAHDI_MAX_SPANS 128 /* Max, 128 spans */
-#define DAHDI_MAX_CHANNELS 1024 /* Max, 1024 channels */
-#define DAHDI_MAX_CONF 1024 /* Max, 1024 conferences */
-
-/* Conference modes */
-#define DAHDI_CONF_MODE_MASK 0xFF /* mask for modes */
-#define DAHDI_CONF_NORMAL 0 /* normal mode */
-#define DAHDI_CONF_MONITOR 1 /* monitor mode (rx of other chan) */
-#define DAHDI_CONF_MONITORTX 2 /* monitor mode (tx of other chan) */
-#define DAHDI_CONF_MONITORBOTH 3 /* monitor mode (rx & tx of other chan) */
-#define DAHDI_CONF_CONF 4 /* conference mode */
-#define DAHDI_CONF_CONFANN 5 /* conference announce mode */
-#define DAHDI_CONF_CONFMON 6 /* conference monitor mode */
-#define DAHDI_CONF_CONFANNMON 7 /* conference announce/monitor mode */
-#define DAHDI_CONF_REALANDPSEUDO 8 /* real and pseudo port both on conf */
-#define DAHDI_CONF_DIGITALMON 9 /* Do not decode or interpret */
-#define DAHDI_CONF_MONITOR_RX_PREECHO 10 /* monitor mode (rx of other chan) - before echo can is done */
-#define DAHDI_CONF_MONITOR_TX_PREECHO 11 /* monitor mode (tx of other chan) - before echo can is done */
-#define DAHDI_CONF_MONITORBOTH_PREECHO 12 /* monitor mode (rx & tx of other chan) - before echo can is done */
-#define DAHDI_CONF_FLAG_MASK 0xFF00 /* mask for flags */
-#define DAHDI_CONF_LISTENER 0x100 /* is a listener on the conference */
-#define DAHDI_CONF_TALKER 0x200 /* is a talker on the conference */
-#define DAHDI_CONF_PSEUDO_LISTENER 0x400 /* pseudo is a listener on the conference */
-#define DAHDI_CONF_PSEUDO_TALKER 0x800 /* pseudo is a talker on the conference */
-
-/* Alarm Condition bits */
-#define DAHDI_ALARM_NONE 0 /* No alarms */
-#define DAHDI_ALARM_RECOVER (1 << 0) /* Recovering from alarm */
-#define DAHDI_ALARM_LOOPBACK (1 << 1) /* In loopback */
-#define DAHDI_ALARM_YELLOW (1 << 2) /* Yellow Alarm */
-#define DAHDI_ALARM_RED (1 << 3) /* Red Alarm */
-#define DAHDI_ALARM_BLUE (1 << 4) /* Blue Alarm */
-#define DAHDI_ALARM_NOTOPEN (1 << 5)
-/* Verbose alarm states (upper byte) */
-#define DAHDI_ALARM_LOS (1 << 8) /* Loss of Signal */
-#define DAHDI_ALARM_LFA (1 << 9) /* Loss of Frame Alignment */
-#define DAHDI_ALARM_LMFA (1 << 10)/* Loss of Multi-Frame Align */
-
-/* Maintenance modes */
-#define DAHDI_MAINT_NONE 0 /* Normal Mode */
-#define DAHDI_MAINT_LOCALLOOP 1 /* Local Loopback */
-#define DAHDI_MAINT_REMOTELOOP 2 /* Remote Loopback */
-#define DAHDI_MAINT_NETWORKLINELOOP 2 /* Remote Loopback */
-#define DAHDI_MAINT_LOOPUP 3 /* send loopup code */
-#define DAHDI_MAINT_LOOPDOWN 4 /* send loopdown code */
-#define DAHDI_MAINT_FAS_DEFECT 6 /* insert a FAS defect */
-#define DAHDI_MAINT_MULTI_DEFECT 7 /* insert a Multiframe defect */
-#define DAHDI_MAINT_CRC_DEFECT 8 /* insert a FAS defect */
-#define DAHDI_MAINT_CAS_DEFECT 9 /* insert a FAS defect */
-#define DAHDI_MAINT_PRBS_DEFECT 10 /* insert a FAS defect */
-#define DAHDI_MAINT_BIPOLAR_DEFECT 11 /* insert a FAS defect */
-#define DAHDI_MAINT_PRBS 12 /* enable the PRBS gen/mon */
-#define DAHDI_MAINT_NETWORKPAYLOADLOOP 13 /* Remote Loopback */
-#define DAHDI_RESET_COUNTERS 14 /* Clear the error counters */
-#define DAHDI_MAINT_ALARM_SIM 15 /* Simulate alarms */
-
-/* Flag Value for IOMUX, read avail */
-#define DAHDI_IOMUX_READ 1
-
-/* Flag Value for IOMUX, write avail */
-#define DAHDI_IOMUX_WRITE 2
-
-/* Flag Value for IOMUX, write done */
-#define DAHDI_IOMUX_WRITEEMPTY 4
-
-/* Flag Value for IOMUX, signalling event avail */
-#define DAHDI_IOMUX_SIGEVENT 8
-
-/* Flag Value for IOMUX, Do Not Wait if nothing to report */
-#define DAHDI_IOMUX_NOWAIT 0x100
-
-/* Ret. Value for GET/WAIT Event, no event */
-#define DAHDI_EVENT_NONE 0
-
-/* Ret. Value for GET/WAIT Event, Went Onhook */
-#define DAHDI_EVENT_ONHOOK 1
-
-/* Ret. Value for GET/WAIT Event, Went Offhook or got Ring */
-#define DAHDI_EVENT_RINGOFFHOOK 2
-
-/* Ret. Value for GET/WAIT Event, Got Wink or Flash */
-#define DAHDI_EVENT_WINKFLASH 3
-
-/* Ret. Value for GET/WAIT Event, Got Alarm */
-#define DAHDI_EVENT_ALARM 4
-
-/* Ret. Value for GET/WAIT Event, Got No Alarm (after alarm) */
-#define DAHDI_EVENT_NOALARM 5
-
-/* Ret. Value for GET/WAIT Event, HDLC Abort frame */
-#define DAHDI_EVENT_ABORT 6
-
-/* Ret. Value for GET/WAIT Event, HDLC Frame overrun */
-#define DAHDI_EVENT_OVERRUN 7
-
-/* Ret. Value for GET/WAIT Event, Bad FCS */
-#define DAHDI_EVENT_BADFCS 8
-
-/* Ret. Value for dial complete */
-#define DAHDI_EVENT_DIALCOMPLETE 9
-
-/* Ret Value for ringer going on */
-#define DAHDI_EVENT_RINGERON 10
-
-/* Ret Value for ringer going off */
-#define DAHDI_EVENT_RINGEROFF 11
-
-/* Ret Value for hook change complete */
-#define DAHDI_EVENT_HOOKCOMPLETE 12
-
-/* Ret Value for bits changing on a CAS / User channel */
-#define DAHDI_EVENT_BITSCHANGED 13
-
-/* Ret value for the beginning of a pulse coming on its way */
-#define DAHDI_EVENT_PULSE_START 14
-
-/* Timer event -- timer expired */
-#define DAHDI_EVENT_TIMER_EXPIRED 15
-
-/* Timer event -- ping ready */
-#define DAHDI_EVENT_TIMER_PING 16
-
-/* Polarity reversal event */
-#define DAHDI_EVENT_POLARITY 17
-
-/* Ring Begin event */
-#define DAHDI_EVENT_RINGBEGIN 18
-
-/* Echo can disabled event */
-#define DAHDI_EVENT_EC_DISABLED 19
-
-/* Channel was disconnected. Hint user to close channel */
-#define DAHDI_EVENT_REMOVED 20
-
-/* A neon MWI pulse was detected */
-#define DAHDI_EVENT_NEONMWI_ACTIVE 21
-
-/* No neon MWI pulses were detected over some period of time */
-#define DAHDI_EVENT_NEONMWI_INACTIVE 22
-
-/* A CED tone was detected on the channel in the transmit direction */
-#define DAHDI_EVENT_TX_CED_DETECTED 23
-
-/* A CED tone was detected on the channel in the receive direction */
-#define DAHDI_EVENT_RX_CED_DETECTED 24
-
-/* A CNG tone was detected on the channel in the transmit direction */
-#define DAHDI_EVENT_TX_CNG_DETECTED 25
-
-/* A CNG tone was detected on the channel in the receive direction */
-#define DAHDI_EVENT_RX_CNG_DETECTED 26
-
-/* The echo canceler's NLP (only) was disabled */
-#define DAHDI_EVENT_EC_NLP_DISABLED 27
-
-/* The echo canceler's NLP (only) was enabled */
-#define DAHDI_EVENT_EC_NLP_ENABLED 28
-
-/* The channel's read buffer encountered an overrun condition */
-#define DAHDI_EVENT_READ_OVERRUN 29
-
-/* The channel's write buffer encountered an underrun condition */
-#define DAHDI_EVENT_WRITE_UNDERRUN 30
-
-#define DAHDI_EVENT_PULSEDIGIT (1 << 16) /* This is OR'd with the digit received */
-#define DAHDI_EVENT_DTMFDOWN (1 << 17) /* Ditto for DTMF key down event */
-#define DAHDI_EVENT_DTMFUP (1 << 18) /* Ditto for DTMF key up event */
-
-/* Transcoder related definitions */
-
-struct dahdi_transcoder_formats {
- __u32 srcfmt;
- __u32 dstfmt;
-};
-struct dahdi_transcoder_info {
- __u32 tcnum;
- char name[80];
- __u32 numchannels;
- __u32 dstfmts;
- __u32 srcfmts;
-};
-
-#define DAHDI_MAX_ECHOCANPARAMS 8
-
-/* ioctl definitions */
-#define DAHDI_CODE 0xDA
-
-/*
- * Get/Set Transfer Block Size.
- */
-#define DAHDI_GET_BLOCKSIZE _IOR(DAHDI_CODE, 1, int)
-#define DAHDI_SET_BLOCKSIZE _IOW(DAHDI_CODE, 1, int)
-
-/*
- * Flush Buffer(s) and stop I/O
- */
-#define DAHDI_FLUSH _IOW(DAHDI_CODE, 3, int)
-
-/*
- * Wait for Write to Finish
- */
-#define DAHDI_SYNC _IO(DAHDI_CODE, 4)
-
-/*
- * Get/set channel parameters
- */
-
-struct dahdi_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 DAHDI_LAW_MULAW or DAHDI_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;
- __u32 chan_alarms; /* alarms on this channel */
-};
-
-#define DAHDI_GET_PARAMS_V1 _IOR(DAHDI_CODE, 5, struct dahdi_params)
-#define DAHDI_GET_PARAMS _IOWR(DAHDI_CODE, 5, struct dahdi_params)
-#define DAHDI_SET_PARAMS _IOW(DAHDI_CODE, 5, struct dahdi_params)
-
-/*
- * Set Hookswitch Status
- */
-#define DAHDI_HOOK _IOW(DAHDI_CODE, 7, int)
-
-/*
- * Get Signalling Event
- */
-#define DAHDI_GETEVENT _IOR(DAHDI_CODE, 8, int)
-
-/*
- * Wait for something to happen (IO Mux)
- */
-#define DAHDI_IOMUX _IOWR(DAHDI_CODE, 9, int)
-
-/*
- * Get Span Status
- */
-struct dahdi_spaninfo {
- int spanno; /* span number */
- char name[20]; /* Name */
- char desc[40]; /* Description */
- 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 */
- __u32 fecount; /* Framing error counter */
- __u32 cvcount; /* Coding violations counter */
- __u32 becount; /* current bit error count */
- __u32 prbs; /* current PRBS detected pattern */
- __u32 errsec; /* errored seconds */
-
- 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 spans in entire system */
- int lbo; /* line build out */
- int lineconfig; /* framing/coding */
- char lboname[40]; /* line build out in text form */
- char location[40]; /* span's device location in system */
- char manufacturer[40]; /* manufacturer of span's device */
- char devicetype[40]; /* span's device type */
- int irq; /* span's device IRQ */
- int linecompat; /* span global signaling or 0 for
- analog spans.*/
- char spantype[6]; /* type of span in text form */
-} __attribute__((packed));
-
-struct dahdi_spaninfo_v1 {
- int spanno; /* span number */
- char name[20]; /* Name */
- char desc[40]; /* Description */
- 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 spans in entire system */
- int lbo; /* line build out */
- int lineconfig; /* framing/coding */
- char lboname[40]; /* line build out in text form */
- char location[40]; /* span's device location in system */
- char manufacturer[40]; /* manufacturer of span's device */
- char devicetype[40]; /* span's device type */
- int irq; /* span's device IRQ */
- int linecompat; /* signaling modes possible on this span */
- char spantype[6]; /* type of span in text form */
-};
-#define DAHDI_SPANSTAT _IOWR(DAHDI_CODE, 10, struct dahdi_spaninfo)
-#define DAHDI_SPANSTAT_V1 _IOWR(DAHDI_CODE, 10, struct dahdi_spaninfo_v1)
-
-/*
- * Set Maintenance Mode
- */
-struct dahdi_maintinfo {
- int spanno; /* span number */
- int command; /* command */
-};
-
-#define DAHDI_MAINT _IOW(DAHDI_CODE, 11, struct dahdi_maintinfo)
-
-/*
- * Get/Set Conference Mode
- */
-struct dahdi_confinfo {
- int chan; /* channel number, 0 for current */
- int confno; /* conference number */
- int confmode; /* conferencing mode */
-};
-
-#define DAHDI_GETCONF_V1 _IOR(DAHDI_CODE, 12, struct dahdi_confinfo)
-#define DAHDI_GETCONF _IOWR(DAHDI_CODE, 12, struct dahdi_confinfo)
-
-#define DAHDI_SETCONF_V1 _IOW(DAHDI_CODE, 12, struct dahdi_confinfo)
-#define DAHDI_SETCONF _IOWR(DAHDI_CODE, 13, struct dahdi_confinfo)
-
-/*
- * Display Conference Diagnostic Information on Console
- */
-#define DAHDI_CONFDIAG_V1 _IOR(DAHDI_CODE, 15, int)
-#define DAHDI_CONFDIAG _IOW(DAHDI_CODE, 15, int)
-
-/*
- * Get/Set Channel audio gains
- */
-struct dahdi_gains {
- int chan; /* channel number, 0 for current */
- unsigned char rxgain[256]; /* Receive gain table */
- unsigned char txgain[256]; /* Transmit gain table */
-};
-
-#define DAHDI_GETGAINS_V1 _IOR(DAHDI_CODE, 16, struct dahdi_gains)
-#define DAHDI_GETGAINS _IOWR(DAHDI_CODE, 16, struct dahdi_gains)
-#define DAHDI_SETGAINS _IOW(DAHDI_CODE, 16, struct dahdi_gains)
-
-/*
- * Set Line (T1) Configurations
- */
-struct dahdi_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 */
-};
-
-#define DAHDI_SPANCONFIG _IOW(DAHDI_CODE, 18, struct dahdi_lineconfig)
-
-/*
- * Set Channel Configuration
- */
-struct dahdi_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 (DAHDI_LAW_DEFAULT, DAHDI_LAW_MULAW, or DAHDI_LAW_ALAW) */
- int master; /* Master channel if sigtype is DAHDI_SLAVE */
- int idlebits; /* Idle bits (if this is a CAS channel) or
- channel to monitor (if this is DACS channel) */
- char netdev_name[16];/* name for the hdlc network device*/
-};
-
-#define DAHDI_CHANCONFIG _IOW(DAHDI_CODE, 19, struct dahdi_chanconfig)
-
-/*
- * Set Conference to mute mode
- */
-#define DAHDI_CONFMUTE _IOW(DAHDI_CODE, 20, int)
-
-/*
- * Send a particular tone (see DAHDI_TONE_*)
- */
-#define DAHDI_SENDTONE _IOW(DAHDI_CODE, 21, int)
-
-/*
- * Get/Set your region for tones
- */
-#define DAHDI_GETTONEZONE _IOR(DAHDI_CODE, 22, int)
-#define DAHDI_SETTONEZONE _IOW(DAHDI_CODE, 22, int)
-
-/*
- * Master unit only -- set default zone (see DAHDI_TONE_ZONE_*)
- */
-#define DAHDI_DEFAULTZONE _IOW(DAHDI_CODE, 24, int)
-
-/*
- * Load a tone zone from a dahdi_tone_def_header
- */
-struct dahdi_tone_def {
- int tone; /* See DAHDI_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 */
- int shift; /* How much to scale down the volume (2 is nice) */
-
- /* Now come the constants we need to make tones */
-
- /*
- 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;
-};
-
-struct dahdi_tone_def_header {
- int count; /* How many samples follow */
- int zone; /* Which zone we are loading */
- int ringcadence[DAHDI_MAX_CADENCE]; /* Ring cadence in ms (0=on, 1=off, ends with 0 value) */
- char name[40]; /* Informational name of zone */
- /* immediately follow this structure with dahdi_tone_def structures */
- struct dahdi_tone_def tones[0];
-};
-
-#define DAHDI_LOADZONE _IOW(DAHDI_CODE, 25, struct dahdi_tone_def_header)
-
-/*
- * Free a tone zone
- */
-#define DAHDI_FREEZONE _IOW(DAHDI_CODE, 26, int)
-
-/*
- * Get/Set buffer policy
- */
-struct dahdi_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) */
-};
-
-#define DAHDI_GET_BUFINFO _IOR(DAHDI_CODE, 27, struct dahdi_bufferinfo)
-#define DAHDI_SET_BUFINFO _IOW(DAHDI_CODE, 27, struct dahdi_bufferinfo)
-
-/*
- * Get/Set dialing parameters
- */
-struct dahdi_dialparams {
- int mfv1_tonelen; /* MF R1 tone length for digits */
- int dtmf_tonelen; /* DTMF tone length */
- int mfr2_tonelen; /* MF R2 tone length */
- int reserved[3]; /* Reserved for future expansion -- always set to 0 */
-};
-
-#define DAHDI_GET_DIALPARAMS _IOR(DAHDI_CODE, 29, struct dahdi_dialparams)
-#define DAHDI_SET_DIALPARAMS _IOW(DAHDI_CODE, 29, struct dahdi_dialparams)
-
-/*
- * Append, replace, or cancel a dial string
- */
-struct dahdi_dialoperation {
- int op;
- char dialstr[DAHDI_MAX_DTMF_BUF];
-};
-
-#define DAHDI_DIAL _IOW(DAHDI_CODE, 31, struct dahdi_dialoperation)
-
-/*
- * Set a clear channel into audio mode
- */
-#define DAHDI_AUDIOMODE _IOW(DAHDI_CODE, 32, int)
-
-/*
- * Enable or disable echo cancellation on a channel
- *
- * For ECHOCANCEL:
- * The number is zero to disable echo cancellation and non-zero
- * to enable echo cancellation. If the number is between 32
- * and 1024, it will also set the number of taps in the echo canceller
- *
- * For ECHOCANCEL_PARAMS:
- * The structure contains parameters that should be passed to the
- * echo canceler instance for the selected channel.
- */
-#define DAHDI_ECHOCANCEL _IOW(DAHDI_CODE, 33, int)
-
-struct dahdi_echocanparam {
- char name[16];
- __s32 value;
-};
-
-struct dahdi_echocanparams {
- /* 8 taps per millisecond */
- __u32 tap_length;
- /* number of parameters supplied */
- __u32 param_count;
- /* immediately follow this structure with dahdi_echocanparam structures */
- struct dahdi_echocanparam params[0];
-};
-
-#define DAHDI_ECHOCANCEL_PARAMS _IOW(DAHDI_CODE, 33, struct dahdi_echocanparams)
-
-/*
- * Return a channel's channel number
- */
-#define DAHDI_CHANNO _IOR(DAHDI_CODE, 34, int)
-
-/*
- * Return a flag indicating whether channel is currently dialing
- */
-#define DAHDI_DIALING _IOR(DAHDI_CODE, 35, int)
-
-/*
- * Set a clear channel into HDLC w/out FCS checking/calculation mode
- */
-#define DAHDI_HDLCRAWMODE _IOW(DAHDI_CODE, 36, int)
-
-/*
- * Set a clear channel into HDLC w/ FCS mode
- */
-#define DAHDI_HDLCFCSMODE _IOW(DAHDI_CODE, 37, int)
-
-/*
- * Specify a channel on generic channel selector - must be done before
- * performing any other ioctls
- */
-#define DAHDI_SPECIFY _IOW(DAHDI_CODE, 38, int)
-
-/*
- * Temporarily set the law on a channel to
- * DAHDI_LAW_DEFAULT, DAHDI_LAW_ALAW, or DAHDI_LAW_MULAW. Is reset on close.
- */
-#define DAHDI_SETLAW _IOW(DAHDI_CODE, 39, int)
-
-/*
- * Temporarily set the channel to operate in linear mode when non-zero
- * or default law if 0
- */
-#define DAHDI_SETLINEAR _IOW(DAHDI_CODE, 40, int)
-
-/*
- * Set a clear channel into HDLC w/ PPP interface mode
- */
-#define DAHDI_HDLCPPP _IOW(DAHDI_CODE, 41, int)
-
-/*
- * Set the ring cadence for FXS interfaces
- */
-struct dahdi_ring_cadence {
- int ringcadence[DAHDI_MAX_CADENCE];
-};
-
-#define DAHDI_SETCADENCE _IOW(DAHDI_CODE, 42, struct dahdi_ring_cadence)
-
-/*
- * Get/Set the signaling bits for CAS interface
- */
-#define DAHDI_GETRXBITS _IOR(DAHDI_CODE, 43, int)
-#define DAHDI_SETTXBITS _IOW(DAHDI_CODE, 43, int)
-
-/*
- * Display Channel Diagnostic Information on Console
- */
-#define DAHDI_CHANDIAG_V1 _IOR(DAHDI_CODE, 44, int)
-#define DAHDI_CHANDIAG _IOW(DAHDI_CODE, 44, int)
-
-/*
- * Set Channel's SF Tone Configuration
- */
-struct dahdi_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 */
-};
-
-#define DAHDI_SFCONFIG _IOW(DAHDI_CODE, 46, struct dahdi_sfconfig)
-
-/*
- * Set timer expiration (in samples)
- */
-#define DAHDI_TIMERCONFIG _IOW(DAHDI_CODE, 47, int)
-
-/*
- * Acknowledge timer expiration (number to acknowledge, or -1 for all)
- */
-#define DAHDI_TIMERACK _IOW(DAHDI_CODE, 48, int)
-
-/*
- * Get Conference to mute mode
- */
-#define DAHDI_GETCONFMUTE _IOR(DAHDI_CODE, 49, int)
-
-/*
- * Request echo training in some number of ms (with muting in the mean time)
- */
-#define DAHDI_ECHOTRAIN _IOW(DAHDI_CODE, 50, int)
-
-/*
- * Set on hook transfer for n number of ms -- implemented by low level driver
- */
-#define DAHDI_ONHOOKTRANSFER _IOW(DAHDI_CODE, 51, int)
-
-/*
- * Queue Ping
- */
-#define DAHDI_TIMERPING _IO(DAHDI_CODE, 52)
-
-/*
- * Acknowledge ping
- */
-#define DAHDI_TIMERPONG _IO(DAHDI_CODE, 53)
-
-/*
- * Get/set signalling freeze
- */
-#define DAHDI_GETSIGFREEZE _IOR(DAHDI_CODE, 54, int)
-#define DAHDI_SETSIGFREEZE _IOW(DAHDI_CODE, 54, int)
-
-/*
- * Perform an indirect ioctl (on a specified channel via master interface)
- */
-struct dahdi_indirect_data {
- int chan;
- int op;
- void *data;
-};
-
-#define DAHDI_INDIRECT _IOWR(DAHDI_CODE, 56, struct dahdi_indirect_data)
-
-
-/*
- * Get the version of DAHDI that is running, and a description
- * of the compiled-in echo cancellers (if any)
- */
-struct dahdi_versioninfo {
- char version[80];
- char echo_canceller[80];
-};
-
-#define DAHDI_GETVERSION _IOR(DAHDI_CODE, 57, struct dahdi_versioninfo)
-
-/*
- * Put the channel in loopback mode (receive from the channel is
- * transmitted back on the interface)
- */
-#define DAHDI_LOOPBACK _IOW(DAHDI_CODE, 58, int)
-
-/*
- Attach the desired echo canceler module (or none) to a channel in an
- audio-supporting mode, so that when the channel needs an echo canceler
- that module will be used to supply one.
- */
-struct dahdi_attach_echocan {
- int chan; /* Channel we're applying this to */
- char echocan[16]; /* Name of echo canceler to attach to this channel
- (leave empty to have no echocan attached */
-};
-
-#define DAHDI_ATTACH_ECHOCAN _IOW(DAHDI_CODE, 59, struct dahdi_attach_echocan)
-
-
-/*
- * 60-80 are reserved for private drivers
- * 80-85 are reserved for dynamic span stuff
- */
-
-/*
- * Create a dynamic span
- */
-struct dahdi_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 DAHDI) */
-};
-
-#define DAHDI_DYNAMIC_CREATE _IOWR(DAHDI_CODE, 80, struct dahdi_dynamic_span)
-
-/*
- * Destroy a dynamic span
- */
-#define DAHDI_DYNAMIC_DESTROY _IOW(DAHDI_CODE, 81, struct dahdi_dynamic_span)
-
-/*
- * Set the HW gain for a device
- */
-struct dahdi_hwgain {
- __s32 newgain; /* desired gain in dB but x10. -3.5dB would be -35 */
- __u32 tx:1; /* 0=rx; 1=tx */
-};
-#define DAHDI_SET_HWGAIN _IOW(DAHDI_CODE, 86, struct dahdi_hwgain)
-
-/*
- * Enable tone detection -- implemented by low level driver
- */
-#define DAHDI_TONEDETECT _IOW(DAHDI_CODE, 91, int)
-
-/*
- * Set polarity -- implemented by individual driver. 0 = forward, 1 = reverse
- */
-#define DAHDI_SETPOLARITY _IOW(DAHDI_CODE, 92, int)
-
-/*
- * Transcoder operations
- */
-
-/* DAHDI_TRANSCODE_OP is an older interface that is deprecated and no longer
- * supported.
- */
-#define DAHDI_TRANSCODE_OP _IOWR(DAHDI_CODE, 93, int)
-
-#define DAHDI_TC_CODE 'T'
-#define DAHDI_TC_ALLOCATE _IOW(DAHDI_TC_CODE, 1, struct dahdi_transcoder_formats)
-#define DAHDI_TC_GETINFO _IOWR(DAHDI_TC_CODE, 2, struct dahdi_transcoder_info)
-
-/*
- * VMWI Specification
- */
-struct dahdi_vmwi_info {
- unsigned int vmwi_type;
-};
-
-#define DAHDI_VMWI_LREV (1 << 0) /* Line Reversal */
-#define DAHDI_VMWI_HVDC (1 << 1) /* HV 90VDC */
-#define DAHDI_VMWI_HVAC (1 << 2) /* HV 90VAC Neon lamp */
-
-/*
- * VoiceMail Waiting Indication (VMWI) -- implemented by low-level driver.
- * Value: number of waiting messages (hence 0: switch messages off).
- */
-#define DAHDI_VMWI _IOWR(DAHDI_CODE, 94, int)
-#define DAHDI_VMWI_CONFIG _IOW(DAHDI_CODE, 95, struct dahdi_vmwi_info)
-
-/*
- * Startup or Shutdown a span
- */
-#define DAHDI_STARTUP _IOW(DAHDI_CODE, 99, int)
-#define DAHDI_SHUTDOWN _IOW(DAHDI_CODE, 100, int)
-
-#define DAHDI_HDLC_RATE _IOW(DAHDI_CODE, 101, int)
-
-/* Put a channel's echo canceller into 'FAX mode' if possible */
-
-#define DAHDI_ECHOCANCEL_FAX_MODE _IOW(DAHDI_CODE, 102, int)
-
-/*
- * Defines which channel to receive mirrored traffic from
- */
-#ifdef CONFIG_DAHDI_MIRROR
-#define DAHDI_RXMIRROR _IOW(DAHDI_CODE, 103, int)
-#define DAHDI_TXMIRROR _IOW(DAHDI_CODE, 104, int)
-#endif /* CONFIG_DAHDI_MIRROR */
-
-/*
- Set the desired state for channel buffer event generation which is disabled
- by default to allow for backwards compatibility for dumb users of channels
- such as pattern utilities.
- */
-#define DAHDI_BUFFER_EVENTS _IOW(DAHDI_CODE, 105, int)
-
-/* Get current status IOCTL */
-/* Defines for Radio Status (dahdi_radio_stat.radstat) bits */
-
-#define DAHDI_RADSTAT_RX 1 /* currently "receiving " */
-#define DAHDI_RADSTAT_TX 2 /* currently "transmitting" */
-#define DAHDI_RADSTAT_RXCT 4 /* currently receiving continuous tone with
- current settings */
-#define DAHDI_RADSTAT_RXCOR 8 /* currently receiving COR (irrelevant of COR
- ignore) */
-#define DAHDI_RADSTAT_IGNCOR 16 /* currently ignoring COR */
-#define DAHDI_RADSTAT_IGNCT 32 /* currently ignoring CTCSS/DCS decode */
-#define DAHDI_RADSTAT_NOENCODE 64 /* currently blocking CTCSS/DCS encode */
-
-struct dahdi_radio_stat {
- unsigned short ctcode_rx; /* code of currently received CTCSS
- or DCS, 0 for none */
- unsigned short ctclass; /* class of currently received CTCSS or
- DCS code */
- unsigned short ctcode_tx; /* code of currently encoded CTCSS or
- DCS, 0 for none */
- unsigned char radstat; /* status bits of radio */
-};
-
-#define DAHDI_RADIO_GETSTAT _IOR(DAHDI_CODE, 57, struct dahdi_radio_stat)
-
-/* Get/Set a radio channel parameter */
-/* Defines for Radio Parameters (dahdi_radio_param.radpar) */
-#define DAHDI_RADPAR_INVERTCOR 1 /* invert the COR signal (0/1) */
-#define DAHDI_RADPAR_IGNORECOR 2 /* ignore the COR signal (0/1) */
-#define DAHDI_RADPAR_IGNORECT 3 /* ignore the CTCSS/DCS decode (0/1) */
-#define DAHDI_RADPAR_NOENCODE 4 /* block the CTCSS/DCS encode (0/1) */
-#define DAHDI_RADPAR_CORTHRESH 5 /* COR trigger threshold (0-7) */
-
-#define DAHDI_RADPAR_EXTRXTONE 6 /* 0 means use internal decoder, 1 means UIOA
- logic true is CT decode, 2 means UIOA logic
- false is CT decode */
-#define DAHDI_RADPAR_NUMTONES 7 /* returns maximum tone index (curently 15) */
-#define DAHDI_RADPAR_INITTONE 8 /* init all tone indexes to 0 (no tones) */
-#define DAHDI_RADPAR_RXTONE 9 /* CTCSS tone, (1-32) or DCS tone (1-777),
- or 0 meaning no tone, set index also (1-15) */
-#define DAHDI_RADPAR_RXTONECLASS 10 /* Tone class (0-65535), set index also (1-15) */
-#define DAHDI_RADPAR_TXTONE 11 /* CTCSS tone (1-32) or DCS tone (1-777) or 0
- to indicate no tone, to transmit
- for this tone index (0-32, 0 disables
- transmit CTCSS), set index also (0-15) */
-#define DAHDI_RADPAR_DEBOUNCETIME 12 /* receive indication debounce time,
- milliseconds (1-999) */
-#define DAHDI_RADPAR_BURSTTIME 13 /* end of transmit with no CT tone in
- milliseconds (0-999) */
-
-
-#define DAHDI_RADPAR_UIODATA 14 /* read/write UIOA and UIOB data. Bit 0 is
- UIOA, bit 1 is UIOB */
-#define DAHDI_RADPAR_UIOMODE 15 /* 0 means UIOA and UIOB are both outputs, 1
- means UIOA is input, UIOB is output, 2
- means UIOB is input and UIOA is output,
- 3 means both UIOA and UIOB are inputs. Note
- mode for UIOA is overridden when in
- EXTRXTONE mode. */
-
-#define DAHDI_RADPAR_REMMODE 16 /* Remote control data mode */
- #define DAHDI_RADPAR_REM_NONE 0 /* no remote control data mode */
- #define DAHDI_RADPAR_REM_RBI1 1 /* Doug Hall RBI-1 data mode */
- #define DAHDI_RADPAR_REM_SERIAL 2 /* Serial Data, 9600 BPS */
- #define DAHDI_RADPAR_REM_SERIAL_ASCII 3 /* Serial Ascii Data, 9600 BPS */
-
-#define DAHDI_RADPAR_REMCOMMAND 17 /* Remote conrtol write data block & do cmd */
-
-#define DAHDI_RADPAR_DEEMP 18 /* Audio De-empahsis (on or off) */
-
-#define DAHDI_RADPAR_PREEMP 19 /* Audio Pre-empahsis (on or off) */
-
-#define DAHDI_RADPAR_RXGAIN 20 /* Audio (In to system) Rx Gain */
-
-#define DAHDI_RADPAR_TXGAIN 21 /* Audio (Out from system) Tx Gain */
-
-#define RAD_SERIAL_BUFLEN 128
-
-struct dahdi_radio_param {
- unsigned short radpar; /* param identifier */
- unsigned short index; /* tone number */
- int data; /* param */
- int data2; /* param 2 */
- unsigned char buf[RAD_SERIAL_BUFLEN];
-};
-#define DAHDI_RADIO_GETPARAM _IOR(DAHDI_CODE, 58, struct dahdi_radio_param)
-#define DAHDI_RADIO_SETPARAM _IOW(DAHDI_CODE, 58, struct dahdi_radio_param)
-
-
-/*!
- \brief Size-limited null-terminating string copy.
- \param dst The destination buffer
- \param src The source string
- \param size The size of the destination buffer
- \return Nothing.
-
- This is similar to \a strncpy, with two important differences:
- - the destination buffer will \b always be null-terminated
- - the destination buffer is not filled with zeros past the copied string length
- These differences make it slightly more efficient, and safer to use since it will
- not leave the destination buffer unterminated. There is no need to pass an artificially
- reduced buffer size to this function (unlike \a strncpy), and the buffer does not need
- to be initialized to zeroes prior to calling this function.
-*/
-static inline void dahdi_copy_string(char *dst, const char *src, unsigned int size)
-{
- while (*src && size) {
- *dst++ = *src++;
- size--;
- }
- if (__builtin_expect(!size, 0))
- dst--;
- *dst = '\0';
-}
-
-#endif /* _DAHDI_USER_H */
diff --git a/include/dahdi/wctdm_user.h b/include/dahdi/wctdm_user.h
deleted file mode 100644
index 38a1cb3..0000000
--- a/include/dahdi/wctdm_user.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Wildcard S100P FXS Interface Driver for DAHDI Telephony interface
- *
- * Written by Mark Spencer <markster@digium.com>
- *
- * Copyright (C) 2001-2008, Digium, Inc.
- *
- * All rights reserved.
- *
- */
-
-/*
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2 as published by the
- * Free Software Foundation. See the LICENSE file included with
- * this program for more details.
- */
-
-#ifndef _WCTDM_H
-#define _WCTDM_H
-
-#include <linux/ioctl.h>
-
-#define NUM_REGS 109
-#define NUM_INDIRECT_REGS 105
-
-struct wctdm_stats {
- int tipvolt; /* TIP voltage (mV) */
- int ringvolt; /* RING voltage (mV) */
- int batvolt; /* VBAT voltage (mV) */
-};
-
-struct wctdm_regs {
- unsigned char direct[NUM_REGS];
- unsigned short indirect[NUM_INDIRECT_REGS];
-};
-
-struct wctdm_regop {
- int indirect;
- unsigned char reg;
- unsigned short val;
-};
-
-struct wctdm_echo_coefs {
- unsigned char acim;
- unsigned char coef1;
- unsigned char coef2;
- unsigned char coef3;
- unsigned char coef4;
- unsigned char coef5;
- unsigned char coef6;
- unsigned char coef7;
- unsigned char coef8;
-};
-
-#define WCTDM_GET_STATS _IOR (DAHDI_CODE, 60, struct wctdm_stats)
-#define WCTDM_GET_REGS _IOR (DAHDI_CODE, 61, struct wctdm_regs)
-#define WCTDM_SET_REG _IOW (DAHDI_CODE, 62, struct wctdm_regop)
-#define WCTDM_SET_ECHOTUNE _IOW (DAHDI_CODE, 63, struct wctdm_echo_coefs)
-
-
-#endif /* _WCTDM_H */