[zaptel-commits] kpfleming: branch 1.4 r4477 - in /branches/1.4: ./ build_tools/ firmware/ ker...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Tue Aug 12 15:50:02 CDT 2008


Author: kpfleming
Date: Tue Aug 12 15:50:02 2008
New Revision: 4477

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4477
Log:
bring back the transcoder interface... it will be upgraded to the new improved version here too

Added:
    branches/1.4/kernel/wctc4xxp/   (props changed)
      - copied from r4468, branches/1.4/kernel/wctc4xxp/
    branches/1.4/kernel/wctc4xxp/Kbuild
      - copied unchanged from r4468, branches/1.4/kernel/wctc4xxp/Kbuild
    branches/1.4/kernel/wctc4xxp/Makefile
      - copied unchanged from r4468, branches/1.4/kernel/wctc4xxp/Makefile
    branches/1.4/kernel/wctc4xxp/base.c
      - copied unchanged from r4468, branches/1.4/kernel/wctc4xxp/base.c
    branches/1.4/kernel/wctc4xxp/codec_test.c
      - copied unchanged from r4468, branches/1.4/kernel/wctc4xxp/codec_test.c
    branches/1.4/kernel/zttranscode.c
      - copied unchanged from r4468, branches/1.4/kernel/zttranscode.c
Modified:
    branches/1.4/Makefile
    branches/1.4/README
    branches/1.4/build_tools/genudevrules
    branches/1.4/firmware/Makefile
    branches/1.4/firmware/firmware.xml
    branches/1.4/kernel/xpp/utils/zaptel-helper
    branches/1.4/kernel/zaptel-base.c
    branches/1.4/kernel/zaptel.h
    branches/1.4/live_zap
    branches/1.4/zaptel.xml

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Tue Aug 12 15:50:02 2008
@@ -103,7 +103,7 @@
 endif
 
 ifeq ($(BUILDVER),linux24)
-MENUSELECT_MODULES+=xpp wctdm24xxp
+MENUSELECT_MODULES+=xpp wctc4xxp wctdm24xxp zttranscode
 endif
 
 ifeq ($(findstring xpp,$(MENUSELECT_MODULES)),)
@@ -117,8 +117,8 @@
 endif
 #SUBDIRS_UTILS	+= ppp
 
-TOPDIR_MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic
-SUBDIR_MODULES:=wct4xxp xpp wctdm24xxp wcte12xp
+TOPDIR_MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic zttranscode
+SUBDIR_MODULES:=wct4xxp wctc4xxp xpp wctdm24xxp wcte12xp
 TOPDIR_MODULES+=$(MODULES_EXTRA)
 SUBDIR_MODULES+=$(SUBDIRS_EXTRA)
 BUILD_TOPDIR_MODULES:=$(filter-out $(MENUSELECT_MODULES),$(TOPDIR_MODULES))
@@ -452,7 +452,7 @@
 
 # Pushing those two to a separate target that is not used by default:
 install-modconf:
-	build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel ztdummy xpp ztdynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)"
+	build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel ztdummy xpp zttranscode ztdynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)"
 	@if [ -d /etc/modutils ]; then \
 		/sbin/update-modules ; \
 	fi
@@ -498,11 +498,13 @@
 	rm -f $(DESTDIR)/dev/zap/channel
 	rm -f $(DESTDIR)/dev/zap/pseudo
 	rm -f $(DESTDIR)/dev/zap/timer
+	rm -f $(DESTDIR)/dev/zap/transcode
 	rm -f $(DESTDIR)/dev/zap/253
 	rm -f $(DESTDIR)/dev/zap/252
 	rm -f $(DESTDIR)/dev/zap/251
 	rm -f $(DESTDIR)/dev/zap/250
 	mknod $(DESTDIR)/dev/zap/ctl c 196 0
+	mknod $(DESTDIR)/dev/zap/transcode c 196 250
 	mknod $(DESTDIR)/dev/zap/timer c 196 253
 	mknod $(DESTDIR)/dev/zap/channel c 196 254
 	mknod $(DESTDIR)/dev/zap/pseudo c 196 255

Modified: branches/1.4/README
URL: http://svn.digium.com/view/zaptel/branches/1.4/README?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/README (original)
+++ branches/1.4/README Tue Aug 12 15:50:02 2008
@@ -44,6 +44,7 @@
 Other Drivers
 ~~~~~~~~~~~~~
 - pciradio: Zapata Telephony PCI Quad Radio Interface
+- wctc4xxp: Digium hardware transcoder cards (also need zttranscode)
 - ztd-eth: TDM over Ethernet (TDMoE) driver. Requires ztdynamic
 - ztd-loc: Mirror a local span. Requires ztdynamic
 - ztdummy: A dummy driver that only provides a zaptel timing source.
@@ -489,6 +490,8 @@
 * /dev/zap/NNN (196:NNN) - for NNN in the range 1-249. A device file for
   zaptel channel NNN. It can be used to read data from the channel
   and write data to the channel.
+* /dev/zap/transcode (196:250) - Used to connect to a zaptel transcoding
+  device.
 * /dev/zap/timer (196:253) - Allows setting timers. Used anywhere?
 * /dev/zap/channel (196:254) - Can be used to open an arbitrary zaptel
   channel. This is an alternative to /dev/zap/NNN that is not limited to

Modified: branches/1.4/build_tools/genudevrules
URL: http://svn.digium.com/view/zaptel/branches/1.4/build_tools/genudevrules?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/build_tools/genudevrules (original)
+++ branches/1.4/build_tools/genudevrules Tue Aug 12 15:50:02 2008
@@ -24,6 +24,7 @@
 # udev rules to generate the /dev/zap device files (if not yet provided 
 # by your distribution):
 KERNEL${match}"zapctl", NAME="zap/ctl"
+KERNEL${match}"zaptranscode", NAME="zap/transcode"
 KERNEL${match}"zaptimer", NAME="zap/timer"
 KERNEL${match}"zapchannel", NAME="zap/channel"
 KERNEL${match}"zappseudo", NAME="zap/pseudo"

Modified: branches/1.4/firmware/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/firmware/Makefile?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/firmware/Makefile (original)
+++ branches/1.4/firmware/Makefile Tue Aug 12 15:50:02 2008
@@ -19,22 +19,27 @@
 
 OCT6114_064_VERSION:=1.05.01
 OCT6114_128_VERSION:=1.05.01
+TC400M_VERSION:=MR6.12
 VPMADT032_VERSION:=1.07
 
 FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
 
 # Firmware files should use the naming convention: zaptel-fw-<base name>-<sub name>-<version> or zaptel-fw-<base name>-<version>
-# Example: zaptel-fw-oct6114-064-1.05.01
+# First example: zaptel-fw-oct6114-064-1.05.01
 # This means this is version 1.05.01 of the oct6114 64 firmware
+# Second example: zaptel-fw-tc400m-MR5.6
+# This means this is version MR5.6 of the tc400m firmware
 
 # Build a list of firmware package filenames we need
 FIRMWARE:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCT6114-064=zaptel-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=zaptel-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz)
+FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=zaptel-fw-tc400m-$(TC400M_VERSION).tar.gz)
 FIRMWARE:=$(FIRMWARE:FIRMWARE-VPMADT032=zaptel-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz)
 
 # Build a list of object files if hotplug will not be used
 OBJECT_FILES:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCT6114-064=zaptel-fw-oct6114-064.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=zaptel-fw-oct6114-128.o)
+OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=zaptel-fw-tc400m.o)
 OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMADT032=zaptel-fw-vpmadt032.o)
 
 # If "fetch" is used, --continue is not a valid option.
@@ -74,6 +79,14 @@
 	(cat $@ | gzip -d | tar -xf -)
 endif
 
+zaptel-fw-tc400m-%.tar.gz: have_download
+ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes)
+	@echo "Attempting to download $@"
+	@if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi;
+	@if test ! -f $@; then exit 1; fi; \
+	(cat $@ | gzip -d | tar -xf -)
+endif
+
 zaptel-fw-vpmadt032-%.tar.gz: have_download
 ifeq ($(shell if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes)
 	@echo "Attempting to download $@"
@@ -127,6 +140,21 @@
 else
 	@echo "Firmware zaptel-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)"
 endif
+ifeq ($(shell if ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes)
+	@echo "Installing zaptel-fw-tc400m.bin to hotplug firmware directories"
+	if [ -d $(DESTDIR)/usr/lib/hotplug/firmware ]; then \
+		$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware && \
+		(rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-*; \
+		 touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION)); \
+	fi
+	if [ -d $(DESTDIR)/lib/firmware ]; then \
+		$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/lib/firmware && \
+		(rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-*; \
+		 touch $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION)); \
+	fi
+else
+	@echo "Firmware zaptel-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)"
+endif
 ifeq ($(shell if ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "yes"; else echo "no"; fi),yes)
 	@echo "Installing zaptel-fw-vpmadt032.bin to hotplug firmware directories"
 	if [ -d $(DESTDIR)/usr/lib/hotplug/firmware ]; then \
@@ -165,6 +193,11 @@
 	@echo Making firmware object file for zaptel-fw-oct6114-128.bin
 	../build_tools/make_firmware_object zaptel-fw-oct6114-128.bin $@
 
+# Build object file of a TC400M firmware image for linking
+zaptel-fw-tc400m.o: zaptel-fw-tc400m-$(TC400M_VERSION).tar.gz zaptel-fw-tc400m.bin
+	@echo Making firmware object file for zaptel-fw-tc400m.bin
+	../build_tools/make_firmware_object zaptel-fw-tc400m.bin $@
+
 # Build object file of a VPMADT032 firmware image for linking
 zaptel-fw-vpmadt032.o: zaptel-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz zaptel-fw-vpmadt032.bin
 	@echo Making firmware object file for zaptel-fw-vpmadt032.bin

Modified: branches/1.4/firmware/firmware.xml
URL: http://svn.digium.com/view/zaptel/branches/1.4/firmware/firmware.xml?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/firmware/firmware.xml (original)
+++ branches/1.4/firmware/firmware.xml Tue Aug 12 15:50:02 2008
@@ -7,6 +7,10 @@
                         <defaultenabled>yes</defaultenabled>
 			<depend>wct4xxp</depend>
                 </member>
+                <member name="FIRMWARE-TC400M" displayname="Digium TC400M" >
+                        <defaultenabled>yes</defaultenabled>
+			<depend>wctc4xxp</depend>
+                </member>
                 <member name="FIRMWARE-VPMADT032" displayname="Digium VPMADT032" >
                         <defaultenabled>yes</defaultenabled>
 			<depend>wctdm24xxp</depend>

Propchange: branches/1.4/kernel/wctc4xxp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 12 15:50:02 2008
@@ -1,0 +1,4 @@
+*.cmd
+*.mod.c
+*.ko
+codec_test

Modified: branches/1.4/kernel/xpp/utils/zaptel-helper
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/xpp/utils/zaptel-helper?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/kernel/xpp/utils/zaptel-helper (original)
+++ branches/1.4/kernel/xpp/utils/zaptel-helper Tue Aug 12 15:50:02 2008
@@ -336,6 +336,9 @@
 		  check=0
 		  case "$i" in
 			xpp_usb) check=`grep 'STATUS=connected' 2>/dev/null /proc/xpp/xbuses | wc -l` ;;
+			# FIXME: zttranscode will always load, and will never 
+			# add a span. Maybe try to read from /dev/zap/transcode .
+			zttranscode) : ;; 
 			*) if [ $lines_before -lt `count_proc_zap_lines` ]; then check=1; fi ;;
 			esac
 			if [ "$check" != 0 ]

Modified: branches/1.4/kernel/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zaptel-base.c?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/kernel/zaptel-base.c (original)
+++ branches/1.4/kernel/zaptel-base.c Tue Aug 12 15:50:02 2008
@@ -114,6 +114,7 @@
 "-22.5db (CSU)"
 } ;
 
+EXPORT_SYMBOL(zt_transcode_fops);
 EXPORT_SYMBOL(zt_init_tone_state);
 EXPORT_SYMBOL(zt_mf_tone);
 EXPORT_SYMBOL(zt_register);
@@ -267,6 +268,7 @@
 
 static struct zt_span *master;
 static struct file_operations zt_fops;
+struct file_operations *zt_transcode_fops = NULL;
 
 static struct
 {
@@ -2578,11 +2580,33 @@
 static int zt_open(struct inode *inode, struct file *file)
 {
 	int unit = UNIT(file);
+	int ret = -ENXIO;
 	struct zt_chan *chan;
-
 	/* Minor 0: Special "control" descriptor */
 	if (!unit) 
 		return zt_ctl_open(inode, file);
+	if (unit == 250) {
+		if (!zt_transcode_fops)
+			request_module("zttranscode");
+		if (zt_transcode_fops && zt_transcode_fops->open) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+			if (zt_transcode_fops->owner) {
+				__MOD_INC_USE_COUNT (zt_transcode_fops->owner);
+#else
+			if (try_module_get(zt_transcode_fops->owner)) {
+#endif
+				ret = zt_transcode_fops->open(inode, file);
+				if (ret)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+					__MOD_DEC_USE_COUNT (zt_transcode_fops->owner);
+#else
+					module_put(zt_transcode_fops->owner);
+#endif
+			}
+			return ret;
+		}
+		return -ENXIO;
+	}
 	if (unit == 253) {
 		if (maxspans) {
 			return zt_timing_open(inode, file);
@@ -3099,6 +3123,16 @@
 		return zt_ctl_release(inode, file);
 	if (unit == 253) {
 		return zt_timer_release(inode, file);
+	}
+	if (unit == 250) {
+		res = zt_transcode_fops->release(inode, file);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+		if (zt_transcode_fops->owner)
+			__MOD_DEC_USE_COUNT (zt_transcode_fops->owner);
+#else
+		module_put(zt_transcode_fops->owner);
+#endif
+		return res;
 	}
 	if (unit == 254) {
 		chan = file->private_data;
@@ -5114,6 +5148,9 @@
 	if (!unit)
 		return zt_ctl_ioctl(inode, file, cmd, data);
 
+	if (unit == 250)
+		return zt_transcode_fops->ioctl(inode, file, cmd, data);
+
 	if (unit == 253) {
 		timer = file->private_data;
 		if (timer)
@@ -7170,6 +7207,14 @@
 	return(ret);  /* return what we found */
 }
 
+static int zt_mmap(struct file *file, struct vm_area_struct *vm)
+{
+	int unit = UNIT(file);
+	if (unit == 250)
+		return zt_transcode_fops->mmap(file, vm);
+	return -ENOSYS;
+}
+
 static unsigned int zt_poll(struct file *file, struct poll_table_struct *wait_table)
 {
 	int unit = UNIT(file);
@@ -7177,6 +7222,9 @@
 
 	if (!unit)
 		return -EINVAL;
+
+	if (unit == 250)
+		return zt_transcode_fops->poll(file, wait_table);
 
 	if (unit == 253)
 		return zt_timer_poll(file, wait_table);
@@ -7583,7 +7631,7 @@
 	read: zt_read,
 	write: zt_write,
 	poll: zt_poll,
-	mmap: NULL,
+	mmap: zt_mmap,
 	flush: NULL,
 	fsync: NULL,
 	fasync: NULL,

Modified: branches/1.4/kernel/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zaptel.h?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/kernel/zaptel.h (original)
+++ branches/1.4/kernel/zaptel.h Tue Aug 12 15:50:02 2008
@@ -768,6 +768,11 @@
 #define	ZT_SETPOLARITY		_IOW (ZT_CODE, 92, int)
 
 /*
+ * Transcoder operations
+ */
+#define ZT_TRANSCODE_OP		_IOWR(ZT_CODE, 93, int)
+
+/*
  * VoiceMail Waiting Indication (WMWI) -- implemented by low-level driver.
  * Value: number of waiting messages (hence 0: switch messages off).
  */
@@ -887,6 +892,57 @@
 
 #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];
@@ -1644,6 +1700,35 @@
 #endif	
 };
 
+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;
+};
+
+#define ZT_TC_FLAG_BUSY       (1 << 0)
+#define ZT_TC_FLAG_TRANSIENT  (1 << 1)
+
+
+struct zt_transcoder {
+	struct zt_transcoder *next;
+	char name[80];
+	int numchannels;
+	unsigned int srcfmts;
+	unsigned int dstfmts;
+	int (*operation)(struct zt_transcoder_channel *channel, int op);
+	/* Transcoder channels */
+	struct zt_transcoder_channel channels[0];
+};
+
 #define ZT_WATCHDOG_NOINTS		(1 << 0)
 
 #define ZT_WATCHDOG_INIT			1000
@@ -1710,6 +1795,19 @@
 /* Register a span.  Returns 0 on success, -1 on failure.  Pref-master is non-zero if
    we should have preference in being the master device */
 int zt_register(struct zt_span *span, int prefmaster);
+
+/* Allocate / free memory for a transcoder */
+struct zt_transcoder *zt_transcoder_alloc(int numchans);
+void zt_transcoder_free(struct zt_transcoder *ztc);
+
+/* Register a transcoder */
+int zt_transcoder_register(struct zt_transcoder *tc);
+
+/* Unregister a transcoder */
+int zt_transcoder_unregister(struct zt_transcoder *tc);
+
+/* Alert a transcoder */
+int zt_transcoder_alert(struct zt_transcoder_channel *ztc);
 
 /* Unregister a span */
 int zt_unregister(struct zt_span *span);
@@ -1749,6 +1847,8 @@
 
 void zt_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk);
 void zt_ec_span(struct zt_span *span);
+
+extern struct file_operations *zt_transcode_fops;
 
 /* Don't use these directly -- they're not guaranteed to
    be there. */

Modified: branches/1.4/live_zap
URL: http://svn.digium.com/view/zaptel/branches/1.4/live_zap?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/live_zap (original)
+++ branches/1.4/live_zap Tue Aug 12 15:50:02 2008
@@ -50,7 +50,7 @@
 			fi
 			MODULES_LOAD="$MODULES_LOAD xpp/xpp_usb"
 			;;
-		wctdm24xxp | wct4xxp | wcte12xp)
+		wctdm24xxp | wct4xxp | wcte12xp | wctc4xp)
 			MODULES_LOAD="$MODULES_LOAD $mod/$mod"
 			;;
 		wanpipe)

Modified: branches/1.4/zaptel.xml
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.xml?view=diff&rev=4477&r1=4476&r2=4477
==============================================================================
--- branches/1.4/zaptel.xml (original)
+++ branches/1.4/zaptel.xml Tue Aug 12 15:50:02 2008
@@ -10,6 +10,9 @@
 	<member name="wct1xxp" displayname="Digium Wildcard T100P / E100P" remove_on_change="wct1xxp.o wct1xxp.ko">
 	</member>
 	<member name="wct4xxp" displayname="Digium Wildcard TE4XXP / TE2XXP" remove_on_change="wct4xxp/wct4xxp.o wct4xxp/wct4xxp.ko">
+	</member>
+	<member name="wctc4xxp" displayname="Digium Wildcard TC400B" remove_on_change="wctc4xxp/wctc4xxp.o wctc4xxp/wctc4xxp.ko">
+		<depend>zttranscode</depend>
 	</member>
 	<member name="wctdm" displayname="Digium Wildcard TDM400P" remove_on_change="wctdm.o wctdm.ko">
 	</member>
@@ -32,6 +35,8 @@
 	<member name="ztdummy" displayname="Dummy Timing Interface" remove_on_change="ztdummy.o ztdummy.ko">
 	</member>
 	<member name="ztdynamic" displayname="Dynamic Span Support" remove_on_change="ztdynamic.o ztdynamic.ko">
+	</member>
+	<member name="zttranscode" displayname="Transcoder Support" remove_on_change="zttranscode.o zttranscode.ko">
 	</member>
 </category>
 




More information about the zaptel-commits mailing list