summaryrefslogtreecommitdiff
path: root/kernel/zaptel.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/zaptel.h')
-rw-r--r--kernel/zaptel.h146
1 files changed, 82 insertions, 64 deletions
diff --git a/kernel/zaptel.h b/kernel/zaptel.h
index 157747a..fd57755 100644
--- a/kernel/zaptel.h
+++ b/kernel/zaptel.h
@@ -777,8 +777,30 @@ struct zt_hwgain{
/*
* Transcoder operations
*/
+
+/* ZT_TRANSCODE_OP is an older interface that is deprecated and no longer
+ * supported.
+ */
#define ZT_TRANSCODE_OP _IOWR(ZT_CODE, 93, int)
+/* Transcoder related definitions */
+
+struct zt_transcoder_formats {
+ __u32 srcfmt;
+ __u32 dstfmt;
+};
+struct zt_transcoder_info {
+ __u32 tcnum;
+ char name[80];
+ __u32 numchannels;
+ __u32 dstfmts;
+ __u32 srcfmts;
+};
+
+#define ZT_TC_CODE 'T'
+#define ZT_TC_ALLOCATE _IOW(ZT_TC_CODE, 1, struct zt_transcoder_formats)
+#define ZT_TC_GETINFO _IOWR(ZT_TC_CODE, 2, struct zt_transcoder_info)
+
/*
* VoiceMail Waiting Indication (WMWI) -- implemented by low-level driver.
* Value: number of waiting messages (hence 0: switch messages off).
@@ -900,57 +922,6 @@ enum {
#define ZT_TONEDETECT_ON (1 << 0) /* Detect tones */
#define ZT_TONEDETECT_MUTE (1 << 1) /* Mute audio in received channel */
-#define ZT_TRANSCODE_MAGIC 0x74a9c0de
-
-/* Operations */
-#define ZT_TCOP_ALLOCATE 1 /* Allocate/reset DTE channel */
-#define ZT_TCOP_TRANSCODE 2 /* Begin transcoding a block */
-#define ZT_TCOP_GETINFO 3 /* Get information (use zt_transcode_info) */
-#define ZT_TCOP_RELEASE 4 /* Release DTE channel */
-#define ZT_TCOP_TEST 5 /* test DTE device */
-typedef struct zt_transcode_info {
- unsigned int op;
- unsigned int tcnum;
- char name[80];
- int numchannels;
- unsigned int srcfmts;
- unsigned int dstfmts;
-} ZT_TRANSCODE_INFO;
-
-#define ZT_TCCONF_USETS (1 << 0) /* Use/update timestamp field */
-#define ZT_TCCONF_USESEQ (1 << 1) /* Use/update seqno field */
-
-#define ZT_TCSTAT_DSTRDY (1 << 0) /* Destination data is ready */
-#define ZT_TCSTAT_DSTBUSY (1 << 1) /* Destination data is outstanding */
-
-#define __ZT_TRANSCODE_BUFSIZ 16384
-#define ZT_TRANSCODE_HDRLEN 256
-#define ZT_TRANSCODE_BUFSIZ ((__ZT_TRANSCODE_BUFSIZ) - (ZT_TRANSCODE_HDRLEN))
-#define ZT_TRANSCODE_DSTOFFSET (((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
-#define ZT_TRANSCODE_SRCOFFSET (((ZT_TRANSCODE_BUFSIZ) / 2) + ZT_TRANSCODE_HDRLEN)
-
-typedef struct zt_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 ZT_TCCONF_USETS is set) */
- unsigned int srcseqno; /* In units -- written by user (only used if ZT_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 ZT_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 -- ZT_TRANSCODE_MAGIC, read by user */
- unsigned int config; /* Read/write by user */
- unsigned int status; /* Read/write by user */
- unsigned char userhdr[ZT_TRANSCODE_HDRLEN - (sizeof(unsigned int) * 14)]; /* Storage for user parameters */
- unsigned char srcdata[ZT_TRANSCODE_BUFSIZ / 2]; /* Storage of source data */
- unsigned char dstdata[ZT_TRANSCODE_BUFSIZ / 2]; /* Storage of destination data */
-} ZT_TRANSCODE_HEADER;
-
struct zt_ring_cadence {
int ringcadence[ZT_MAX_CADENCE];
};
@@ -1711,27 +1682,74 @@ struct zt_transcoder_channel {
void *pvt;
struct zt_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 zt_transcode_header *tch;
+ __u32 built_fmts;
+#define ZT_TC_FLAG_BUSY 1
+#define ZT_TC_FLAG_CHAN_BUILT 2
+#define ZT_TC_FLAG_NONBLOCK 3
+#define ZT_TC_FLAG_DATA_WAITING 4
+ unsigned long flags;
+ u32 dstfmt;
+ u32 srcfmt;
};
-#define ZT_TC_FLAG_BUSY (1 << 0)
-#define ZT_TC_FLAG_TRANSIENT (1 << 1)
-
+static inline int
+zt_tc_is_built(struct zt_transcoder_channel *dtc) {
+ return test_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags);
+}
+static inline void
+zt_tc_set_built(struct zt_transcoder_channel *dtc) {
+ set_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags);
+}
+static inline void
+zt_tc_clear_built(struct zt_transcoder_channel *dtc) {
+ clear_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags);
+}
+static inline int
+zt_tc_is_nonblock(struct zt_transcoder_channel *dtc) {
+ return test_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags);
+}
+static inline void
+zt_tc_set_nonblock(struct zt_transcoder_channel *dtc) {
+ set_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags);
+}
+static inline void
+zt_tc_clear_nonblock(struct zt_transcoder_channel *dtc) {
+ clear_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags);
+}
+static inline int
+zt_tc_is_data_waiting(struct zt_transcoder_channel *dtc) {
+ return test_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags);
+}
+static inline int
+zt_tc_is_busy(struct zt_transcoder_channel *dtc) {
+ return test_bit(ZT_TC_FLAG_BUSY, &dtc->flags);
+}
+static inline void
+zt_tc_set_busy(struct zt_transcoder_channel *dtc) {
+ set_bit(ZT_TC_FLAG_BUSY, &dtc->flags);
+}
+static inline void
+zt_tc_clear_busy(struct zt_transcoder_channel *dtc) {
+ clear_bit(ZT_TC_FLAG_BUSY, &dtc->flags);
+}
+static inline void
+zt_tc_set_data_waiting(struct zt_transcoder_channel *dtc) {
+ set_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags);
+}
+static inline void
+zt_tc_clear_data_waiting(struct zt_transcoder_channel *dtc) {
+ clear_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags);
+}
struct zt_transcoder {
- struct zt_transcoder *next;
+ struct list_head node;
char name[80];
int numchannels;
unsigned int srcfmts;
unsigned int dstfmts;
- int (*operation)(struct zt_transcoder_channel *channel, int op);
+ struct file_operations fops;
+ int (*allocate)(struct zt_transcoder_channel *channel);
+ int (*release)(struct zt_transcoder_channel *channel);
/* Transcoder channels */
struct zt_transcoder_channel channels[0];
};