summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2008-08-06 18:09:58 +0000
committerShaun Ruffell <sruffell@digium.com>2008-08-06 18:09:58 +0000
commitcd4763bcfad087a8e2e33464e79b4f69a5f31094 (patch)
treed83edd7008142c8d6c7625b7dde044277925a84f /include
parent44ff5a846de3b86f60ae420e3e67a2827fb68f11 (diff)
A significant change to the DAHDI transcoder interface and the wctc4xxp
driver which breaks backwards compatibility. Basically, I've replaced the memory mapped interface with a read/write interface that allows codec_dahdi to communicate with the hardware transcoder the exact size of the packet to be transcoded. This eliminates issues with remote devices that send G729.B CNG packets even though asterisk does not support them. From a user standpoint: - The transcoder drivers are much more robust in light of system / external conditions. From a developer standpoint: - DAHDI_TRANSCODE_OP is no longer supported, instead use DAHDI_TC_ALLOCATE, DAHDI_TC_GETINFO, and write/read. - Memory and stack usage is reduced (stack usage could still be reduced some more by continuing the process of getting rid of the users of wctc4xxp_send_cmd and wctc4xxp_create_cmd). - If more than one card is in the system channels will be allocated in a round-robin fashion from all available cards, reducing contention for the supervisor channel. - There is no longer a tc400b workqueue created that will not show up in the process list. - Commands and their responses are now explicitly matched up which elimated certain errors caused by unsolicited messages from the transcoder confusing the driver. - There is now an option to export a network interface for capturing traffic to/from the hardware transcoder. - codec_test has been removed from the dadhi/linux package. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4717 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r--include/dahdi/kernel.h75
-rw-r--r--include/dahdi/user.h66
2 files changed, 78 insertions, 63 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index ce7d889..ec6a7a2 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -606,28 +606,75 @@ struct dahdi_transcoder_channel {
void *pvt;
struct dahdi_transcoder *parent;
wait_queue_head_t ready;
- int errorstatus;
- int offset;
- unsigned int chan_built;
- unsigned int built_fmts;
- unsigned int flags;
- unsigned int srcfmt;
- unsigned int dstfmt;
- struct dahdi_transcode_header *tch;
+ __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;
};
-#define DAHDI_TC_FLAG_BUSY (1 << 0)
-#define DAHDI_TC_FLAG_TRANSIENT (1 << 1)
-
+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 dahdi_transcoder *next;
+ struct list_head node;
char name[80];
int numchannels;
unsigned int srcfmts;
unsigned int dstfmts;
- int (*operation)(struct dahdi_transcoder_channel *channel, int op);
- /*! Transcoder channels */
+ 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];
};
diff --git a/include/dahdi/user.h b/include/dahdi/user.h
index 4fc22ef..c71848b 100644
--- a/include/dahdi/user.h
+++ b/include/dahdi/user.h
@@ -411,56 +411,16 @@ enum {
/* Transcoder related definitions */
-#define DAHDI_TRANSCODE_MAGIC 0x74a9c0de
-
-/* Operations */
-#define DAHDI_TCOP_ALLOCATE 1 /* Allocate/reset DTE channel */
-#define DAHDI_TCOP_TRANSCODE 2 /* Begin transcoding a block */
-#define DAHDI_TCOP_GETINFO 3 /* Get information (use dahdi_transcode_info) */
-#define DAHDI_TCOP_RELEASE 4 /* Release DTE channel */
-#define DAHDI_TCOP_TEST 5 /* test DTE device */
-
-#define DAHDI_TCCONF_USETS (1 << 0) /* Use/update timestamp field */
-#define DAHDI_TCCONF_USESEQ (1 << 1) /* Use/update seqno field */
-
-#define DAHDI_TCSTAT_DSTRDY (1 << 0) /* Destination data is ready */
-#define DAHDI_TCSTAT_DSTBUSY (1 << 1) /* Destination data is outstanding */
-
-#define __DAHDI_TRANSCODE_BUFSIZ 16384
-#define DAHDI_TRANSCODE_HDRLEN 256
-#define DAHDI_TRANSCODE_BUFSIZ ((__DAHDI_TRANSCODE_BUFSIZ) - (DAHDI_TRANSCODE_HDRLEN))
-#define DAHDI_TRANSCODE_DSTOFFSET (((DAHDI_TRANSCODE_BUFSIZ) / 2) + DAHDI_TRANSCODE_HDRLEN)
-#define DAHDI_TRANSCODE_SRCOFFSET (((DAHDI_TRANSCODE_BUFSIZ) / 2) + DAHDI_TRANSCODE_HDRLEN)
-
-struct dahdi_transcode_info {
- unsigned int op;
- unsigned int tcnum;
- char name[80];
- int numchannels;
- unsigned int srcfmts;
- unsigned int dstfmts;
+struct dahdi_transcoder_formats {
+ __u32 srcfmt;
+ __u32 dstfmt;
};
-
-struct dahdi_transcode_header {
- unsigned int srcfmt; /* See formats.h -- use TCOP_RESET when you change */
- unsigned int srcoffset; /* In bytes -- written by user */
- unsigned int srclen; /* In bytes -- written by user */
- unsigned int srctimestamp; /* In samples -- written by user (only used if DAHDI_TCCONF_USETS is set) */
- unsigned int srcseqno; /* In units -- written by user (only used if DAHDI_TCCONF_USESEQ is set) */
-
- unsigned int dstfmt; /* See formats.h -- use TCOP_RESET when you change */
- unsigned int dstoffset; /* In bytes -- written by user */
- unsigned int dsttimestamp; /* In samples -- read by user */
- unsigned int dstseqno; /* In units -- read by user (only used if DAHDI_TCCONF_USESEQ is set) */
- unsigned int dstlen; /* In bytes -- read by user */
- unsigned int dstsamples; /* In timestamp units -- read by user */
-
- unsigned int magic; /* Magic value -- DAHDI_TRANSCODE_MAGIC, read by user */
- unsigned int config; /* Read/write by user */
- unsigned int status; /* Read/write by user */
- unsigned char userhdr[DAHDI_TRANSCODE_HDRLEN - (sizeof(unsigned int) * 14)]; /* Storage for user parameters */
- unsigned char srcdata[DAHDI_TRANSCODE_BUFSIZ / 2]; /* Storage of source data */
- unsigned char dstdata[DAHDI_TRANSCODE_BUFSIZ / 2]; /* Storage of destination data */
+struct dahdi_transcoder_info {
+ __u32 tcnum;
+ char name[80];
+ __u32 numchannels;
+ __u32 dstfmts;
+ __u32 srcfmts;
};
#define DAHDI_MAX_ECHOCANPARAMS 8
@@ -994,8 +954,16 @@ struct dahdi_hwgain {
/*
* 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)
+
/*
* VoiceMail Waiting Indication (WMWI) -- implemented by low-level driver.
* Value: number of waiting messages (hence 0: switch messages off).