[svn-commits] sruffell: branch sruffell/zaptel-1.4-transcoder r4243 - in /team/sruffell/zap...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu May 8 11:18:55 CDT 2008
Author: sruffell
Date: Thu May 8 11:18:54 2008
New Revision: 4243
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4243
Log:
Added a debug network interface. Currently it is receive only and is only for
taking packet traces.
Added:
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.c (with props)
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.h (with props)
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wctc4xxp.h (with props)
Modified:
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/Kbuild
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test.h
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test_threaded.c
team/sruffell/zaptel-1.4-transcoder/kernel/zttranscode.c
Modified: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/Kbuild
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/Kbuild?view=diff&rev=4243&r1=4242&r2=4243
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/Kbuild (original)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/Kbuild Thu May 8 11:18:54 2008
@@ -8,7 +8,7 @@
EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
endif
-wctc4xxp-objs := base.o
+wctc4xxp-objs := base.o wcdte_net.o
ifneq ($(HOTPLUG_FIRMWARE),yes)
wctc4xxp-objs += $(FIRM_DIR)/zaptel-fw-tc400m.o
Modified: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c?view=diff&rev=4243&r1=4242&r2=4243
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c (original)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c Thu May 8 11:18:54 2008
@@ -32,7 +32,6 @@
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/sched.h>
@@ -40,9 +39,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <asm/io.h>
-#include <asm/semaphore.h>
#include <linux/jiffies.h>
-#include <linux/workqueue.h>
#include <linux/moduleparam.h>
#include <linux/firmware.h>
#include <linux/if_ether.h>
@@ -52,6 +49,8 @@
#endif
#include "zaptel.h"
+#include "wctc4xxp.h"
+#include "wcdte_net.h"
/* \todo Need to check these functions with more linux versions... */
#undef CONFIG_DEBUG_FS
@@ -62,21 +61,6 @@
#ifndef DEFERRED_PROCESSING
# define DEFERRED_PROCESSING INTERRUPT
#endif
-
-#define WARN() WARN_ON(1)
-#define DTE_PRINTK(_wc, _lvl, _fmt, _args...) \
- printk(KERN_##_lvl "%s: " _fmt, (_wc)->board_name, ## _args)
-
-#define DTE_DEBUG_GENERAL (1 << 0)
-#define DTE_DEBUG_CHANNEL_SETUP (1 << 1)
-#define DTE_DEBUG_RTP_TX (1 << 2)
-#define DTE_DEBUG_RTP_RX (1 << 3)
-#define DTE_DEBUG_RX_TIMEOUT (1 << 4)
-
-#define DTE_DEBUG(_wc, _dbgmask, _fmt, _args...) \
- if ((debug & _dbgmask) == (_dbgmask)) { \
- printk(KERN_DEBUG "%s: " _fmt, (_wc)->board_name, ## _args);\
- } \
#define INVALID 999 /* Used to mark invalid channels, commands, etc.. */
#define MAX_CHANNEL_PACKETS 5 /* Never let more than 5 outstanding packets exist for any channel. */
@@ -104,7 +88,7 @@
#define DTE_FORMAT_UNDEF 0xFF
#define G729_LENGTH 20
-#define G723_LENGTH 30
+#define G723_LENGTH 20
#define G729_SAMPLES 160 /* G.729 */
#define G723_SAMPLES 240 /* G.723.1 */
@@ -113,8 +97,6 @@
#define G723_6K_BYTES 24 /* G.723.1 at 6.3kb/s */
#define G723_5K_BYTES 20 /* G.723.1 at 5.3kb/s */
#define G723_SID_BYTES 4 /* G.723.1 SID frame */
-
-#define SFRAME_SIZE 1518
#define MDIO_SHIFT_CLK 0x10000
#define MDIO_DATA_WRITE1 0x20000
@@ -295,6 +277,12 @@
0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x09,0x04, 0x00,0x00, \
0x24,0x00, 0x00,0x00 }
+int debug;
+static int debug_des; /* Set the number of descriptor packet bytes to output on errors, 0 disables output */
+static int debug_des_cnt; /* Set the number of times descriptor packets are displayed before the output is disabled */
+static char *mode;
+static int debug_packets;
+
#define ETH_P_CSM_ENCAPS 0x889B
/* Ehernet packet type for communication control information to the DTE. */
struct csm_encaps_hdr {
@@ -313,20 +301,6 @@
__le16 params[0]; /* Must be last (AND SWITCHES TO LITTLE ENDIAN) */
} __attribute__((packed));
-
-struct dte_cmd {
- u8 cmd[SFRAME_SIZE];
- unsigned int debug;
- unsigned int cmdlen;
- struct list_head node;
-/*! If set, this command will be freed automatically after completing
- * transmission.
- */
-#define NO_AUTO_FREE_CMD (1 << 0)
-#define TX_COMPLETE (1 << 1)
- unsigned long flags;
- struct completion complete;
-};
/*! In-memory structure shared by the host and the adapter. */
struct dte_descriptor {
@@ -431,6 +405,8 @@
#define OWNED(_d_) (((_d_)->des0)&OWN_BIT)
#define SET_OWNED(_d_) do { wmb(); (_d_)->des0 |= OWN_BIT; wmb();} while (0)
+const unsigned int BUFFER1_SIZE_MASK = 0x7ff;
+
/*! Submit a command to the descriptor list for processing by the DTE. */
static int
dte_submit(struct dte_descriptor_ring* dr, struct dte_cmd *c)
@@ -439,7 +415,6 @@
unsigned int tail = dr->tail;
unsigned long flags;
unsigned int len;
- const unsigned int BUFFER1_SIZE_MASK = 0x7ff;
WARN_ON(!c);
WARN_ON(c->cmdlen > SFRAME_SIZE);
@@ -492,6 +467,7 @@
d->buffer1 = 0;
--dr->count;
WARN_ON(!c);
+ c->cmdlen = (d->des0 >> 16) & BUFFER1_SIZE_MASK;
} else {
c = NULL;
}
@@ -507,56 +483,6 @@
struct kmem_cache *cmd_cache;
#endif
-struct wcdte {
- char board_name[40];
- struct pci_dev *pdev;
- const char *variety;
- unsigned int intmask;
- int pos;
- int cards;
- spinlock_t reglock;
- wait_queue_head_t regq;
- int rcvflags;
-
- struct semaphore chansem;
- spinlock_t cmd_list_lock;
- struct list_head cmd_list;
- /* This is a list to hold those commands which were flagged to not
- * auto delete, but which we stopped waiting for because of a signal.
- * Use the cmd_list_lock to protect this list. */
- struct list_head lost_cmd_list;
-
- unsigned int last_seqno;
- unsigned int last_rseqno;
- unsigned int last_command_sent;
- unsigned int last_rcommand;
- unsigned int last_rparm1;
- unsigned int seq_num;
-
- unsigned char numchannels;
- unsigned char complexname[40];
-
- unsigned long iobase;
-
-#if DEFERRED_PROCESSING == WORKQUEUE
- struct workqueue_struct *dte_wq;
- struct work_struct dte_work;
-#endif
-
- struct dte_descriptor_ring txd;
- struct dte_descriptor_ring rxd;
-
- struct zt_transcoder *uencode;
- struct zt_transcoder *udecode;
- struct channel_pvt *encoders;
- struct channel_pvt *decoders;
-#ifdef CONFIG_DEBUG_FS
- struct dentry *debugfs_file;
-#endif
- /* In order to add this to the list of cards checked by the watchdog
- * timer. */
- struct list_head watchdog_node;
-};
static inline void __wcdte_setctl(struct wcdte *wc, unsigned int addr, unsigned int val)
{
@@ -598,6 +524,14 @@
spin_unlock_irqrestore(&wc->reglock, flags);
}
+static void initialize_cmd(struct dte_cmd *cmd, unsigned long cmd_flags)
+{
+ memset(cmd, 0, sizeof(*cmd));
+ INIT_LIST_HEAD(&cmd->node);
+ init_completion(&cmd->complete);
+ cmd->flags = cmd_flags;
+}
+
static inline struct dte_cmd *
__alloc_cmd(unsigned alloc_flags, unsigned long cmd_flags)
{
@@ -605,11 +539,7 @@
cmd = kmem_cache_alloc(cmd_cache, alloc_flags);
if (likely(cmd)) {
- memset(cmd, 0, sizeof(*cmd));
- INIT_LIST_HEAD(&cmd->node);
- cmd->debug = 0xdeadbeef;
- init_completion(&cmd->complete);
- cmd->flags = cmd_flags;
+ initialize_cmd(cmd, cmd_flags);
}
return cmd;
}
@@ -622,7 +552,6 @@
static inline void
free_cmd(struct dte_cmd *cmd)
{
- WARN_ON(0xdeadbeef != cmd->debug);
kmem_cache_free(cmd_cache, cmd);
return;
}
@@ -651,7 +580,8 @@
dr->tail = 0;
dr->count = 0;
spin_unlock_irqrestore(&dr->lock, flags);
- pci_free_consistent(dr->pdev, (sizeof(*d)+dr->padding) * DRING_SIZE, dr->desc, dr->desc_dma);
+ pci_free_consistent(dr->pdev, (sizeof(*d)+dr->padding) * DRING_SIZE,
+ dr->desc, dr->desc_dma);
}
static void
@@ -690,6 +620,58 @@
spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
}
+static void wcdte_capture_packet(struct wcdte *wc, const struct dte_cmd *cmd)
+{
+
+#if 0
+ struct dte_cmd *new;
+ unsigned long flags;
+ unsigned long alloc_flags;
+
+ if (0 == debug_packets) {
+ /* We're not capturing packets */
+ return;
+ }
+
+ alloc_flags = (in_interrupt()) ? GFP_ATOMIC : GFP_KERNEL;
+ if (!(new = __alloc_cmd(alloc_flags, 0))) {
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "Cannot capture packet.\n");
+ return;
+ }
+ memcpy(new->cmd, cmd->cmd, sizeof(cmd->cmd));
+ spin_lock_irqsave(&wc->captured_list_lock, flags);
+ if (++wc->captured_list_length > debug_packets) {
+ /* Remove the oldest item from the captured list to limit the
+ * amount of memory consumed by packet capture.
+ */
+ struct dte_cmd *old;
+ old = list_entry(wc->captured_packets.next, struct dte_cmd, node);
+ list_del(&old->node);
+ free_cmd(old);
+ --wc->captured_list_length;
+ }
+ list_add_tail(&new->node, &wc->captured_packets);
+ spin_unlock_irqrestore(&wc->captured_list_lock, flags);
+#else
+
+ wcdte_net_capture_cmd(wc, cmd);
+#endif
+}
+
+static void wcdte_cleanup_captured_packets(struct wcdte *wc)
+{
+ unsigned long flags;
+ struct dte_cmd *cmd;
+ struct dte_cmd *temp;
+ spin_lock_irqsave(&wc->captured_list_lock, flags);
+ list_for_each_entry_safe(cmd, temp, &wc->captured_packets, node) {
+ list_del(&cmd->node);
+ free_cmd(cmd);
+ }
+ WARN_ON(!list_empty(&wc->cmd_list));
+ spin_unlock_irqrestore(&wc->captured_list_lock, flags);
+}
+
/**
* The command list is used to store commands that couldn't fit in the tx
* descriptor list when they were requested.
@@ -710,8 +692,10 @@
if (cmd->cmdlen < MIN_PACKET_LEN) {
memset(&cmd->cmd[cmd->cmdlen],0,MIN_PACKET_LEN-cmd->cmdlen);
- }
- if (unlikely((res=dte_submit(&wc->txd, cmd)))) {
+ cmd->cmdlen = MIN_PACKET_LEN;
+ }
+ wcdte_capture_packet(wc, cmd);
+ if (unlikely((res=dte_submit(wc->txd, cmd)))) {
if (-EBUSY == res) {
dte_add_to_command_list(wc, cmd);
} else {
@@ -786,32 +770,12 @@
};
-static int debug = 0;
-static int debug_des = 0; /* Set the number of descriptor packet bytes to output on errors, 0 disables output */
-static int debug_des_cnt = 0; /* Set the number of times descriptor packets are displayed before the output is disabled */
-static char *mode;
-static int debug_packets = 0;
/* Forward Declarations \todo Review: are these are really necessary? */
static int wcdte_create_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt, u8 simple, u8 complicated);
static int wcdte_destroy_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt);
static int __wcdte_setup_channels(struct wcdte *wc);
-static int wcdte_waitfor_csmencaps(struct wcdte *wc, unsigned int mask, unsigned int wait_mode);
-
- /* \todo This macro is a candidate for removal. It's still here because of
- * how the commands are passed to this zt_send_cmd */
-#define zt_send_cmd(wc, command) ({ \
- int __res; \
- u8 _cmd[] = command; \
- struct dte_cmd *cmd; \
- if (!(cmd=__alloc_cmd(GFP_KERNEL, NO_AUTO_FREE_CMD))) \
- return -ENOMEM; \
- BUG_ON(sizeof(_cmd) > SFRAME_SIZE); \
- memcpy(cmd->cmd, _cmd, sizeof(_cmd)); \
- cmd->cmdlen = sizeof(_cmd); \
- __res = __zt_send_cmd(wc, cmd); \
- __res; \
-})
+static int wcdte_waitfor_dte(struct wcdte *wc, unsigned int mask, unsigned int wait_mode);
static int __zt_send_cmd(struct wcdte *wc, struct dte_cmd *cmd)
{
@@ -833,7 +797,7 @@
dte_transmit_cmd(wc, cmd);
#if 0 /* This is debug code when investigating the source of the timeouts... */
if (wait_for_completion_killable(&cmd->complete)) {
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"Failed to complete transmit.\n");
/* Save this command on the lost list in order to be
@@ -844,13 +808,13 @@
return -EINTR;
}
#else
- wait_for_completion(&cmd->complete);
+ /* wait_for_completion(&cmd->complete); */
#endif
/* \todo why is this command treated differently? */
if (0x0000 == command) {
- ret = wcdte_waitfor_csmencaps(wc, RCV_CSMENCAPS_ACK, 2);
+ ret = wcdte_waitfor_dte(wc, RCV_CSMENCAPS_ACK, 2);
} else {
- ret = wcdte_waitfor_csmencaps(wc, RCV_CSMENCAPS, 0);
+ ret = wcdte_waitfor_dte(wc, RCV_CSMENCAPS, 0);
}
if (unlikely(-EIO == ret)) {
continue;
@@ -1001,10 +965,10 @@
}
WARN_ON(compl_ztc->chan_built); /* It shouldn't already have been built... */
compl_ztc->chan_built = 1;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Marking (%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Marking (%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
compl_ztc->built_fmts = ztc->dstfmt | ztc->srcfmt;
compl_cpvt = compl_ztc->pvt;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "ztc: %p is the complement to %p\n", compl_ztc, ztc);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "ztc: %p is the complement to %p\n", compl_ztc, ztc);
compl_cpvt->chan_in_num = cpvt->chan_out_num;
compl_cpvt->chan_out_num = cpvt->chan_in_num;
wcdte_cleanup_channel_private(wc, compl_cpvt);
@@ -1027,17 +991,17 @@
BUG_ON(!wc);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Entering %s for channel %p.\n", __FUNCTION__, ztc);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Entering %s for channel %p.\n", __FUNCTION__, ztc);
if (down_interruptible(&wc->chansem)) {
HERE();
return -EINTR;
}
/* If the channel is already built then we're done. */
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
if (ztc->chan_built) {
up(&wc->chansem);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating channel %p which is already built.\n", ztc);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Allocating channel %p which is already built.\n", ztc);
LEAVING();
return 0;
}
@@ -1045,7 +1009,7 @@
/* Anything on the rx queue now is old news... */
wcdte_cleanup_channel_private(wc, cpvt);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating a new channel: %p.\n", ztc);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Allocating a new channel: %p.\n", ztc);
dte_srcfmt = wcdte_zapfmt_to_dtefmt(ztc->srcfmt);
dte_dstfmt = wcdte_zapfmt_to_dtefmt(ztc->dstfmt);
@@ -1121,17 +1085,17 @@
return res;
}
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Releasing channel: %p\n", ztc);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Releasing channel: %p\n", ztc);
/* Mark this channel as not built */
ztc->chan_built = 0;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
ztc->built_fmts = 0;
cpvt->chan_in_num = INVALID;
cpvt->chan_out_num = INVALID;
/* Mark the channel complement as not built */
compl_ztc->chan_built = 0;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
compl_ztc->built_fmts = 0;
compl_cpvt = compl_ztc->pvt;
compl_cpvt->chan_in_num = INVALID;
@@ -1188,8 +1152,8 @@
* transcode.
*/
ret = wait_event_interruptible_timeout(cpvt->waitq,
- (!list_empty(&cpvt->rx_queue)), HZ/32);
- if (-ERESTARTSYS == ret) {
+ (!list_empty(&cpvt->rx_queue)), HZ/326);
+ if (-ERESTARTSYS == ret) {
/* Signal interrupted the wait */
return -EINTR;
} else if (ret) {
@@ -1197,7 +1161,7 @@
cmd = get_ready_cmd(cpvt);
} else {
/* Timeout... */
- DTE_DEBUG(wc, DTE_DEBUG_RX_TIMEOUT,
+ DTE_DEBUG(DTE_DEBUG_RX_TIMEOUT,
"Timeout while waiting for transcoded packet.\n");
WARN_ON(!list_empty(&cpvt->rx_queue));
return -ENODATA;
@@ -1219,7 +1183,7 @@
rcodec = packet[43];
if (count < rlen) {
- DTE_PRINTK(wc, ERR, "Insufficient room to copy read data. Dropping packet.\n");
+ DTE_PRINTK(ERR, "Insufficient room to copy read data. Dropping packet.\n");
free_cmd(cmd);
return -EFBIG;
}
@@ -1232,7 +1196,7 @@
} else {
rtp_eseq = (cpvt->last_dte_seqno + 1) & 0xFFFF;
if ( rtp_rseq != rtp_eseq )
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"Bad seqno from DTE! [%04X][%d][%d][%d]\n",
(packet[37] | (packet[36] << 8)), rchannel, rtp_rseq,
cpvt->last_dte_seqno);
@@ -1242,7 +1206,7 @@
if (unlikely(copy_to_user(frame, packet+54, rlen))) {
- DTE_PRINTK(wc, ERR, "Failed to copy data in %s\n", __FUNCTION__);
+ DTE_PRINTK(ERR, "Failed to copy data in %s\n", __FUNCTION__);
free_cmd(cmd);
return -EFAULT;
}
@@ -1267,14 +1231,14 @@
BUG_ON(!wc);
if (count < 2) {
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"Cannot request to transcode a packet that is less than 2 bytes.\n");
LEAVING();
return -EINVAL;
}
if (unlikely(count > SFRAME_SIZE - CMD_MSG_IP_UDP_RTP_LEN)) {
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"Cannot transcode packet of %Zu bytes. This exceeds the " \
"maximum size of %d bytes.\n", count,
SFRAME_SIZE - CMD_MSG_IP_UDP_RTP_LEN);
@@ -1283,7 +1247,7 @@
if (ZT_FORMAT_G723_1 == ztc->srcfmt) {
if (G723_LENGTH != count) {
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"Trying to transcode packet into G723 format " \
"that is %Zu bytes instead of the expected " \
"%d bytes.\n", count, G723_LENGTH);
@@ -1303,7 +1267,7 @@
/* Copy the data directly from user space into the command buffer. */
if (copy_from_user(&cmd->cmd[CMD_MSG_IP_UDP_RTP_LEN], frame, count)) {
- DTE_PRINTK(wc, ERR, "Failed to copy packet from userspace.\n");
+ DTE_PRINTK(ERR, "Failed to copy packet from userspace.\n");
free_cmd(cmd);
LEAVING();
return -EFAULT;
@@ -1313,7 +1277,7 @@
cpvt->timestamp += count;
cmd->cmdlen = CMD_MSG_IP_UDP_RTP_LEN + count;
- DTE_DEBUG(wc, DTE_DEBUG_RTP_TX,
+ DTE_DEBUG(DTE_DEBUG_RTP_TX,
"Sending packet of %Zu byte on channel (%p).\n", count, ztc);
dte_transmit_cmd(wc, cmd);
atomic_inc(&cpvt->stats.packets_sent);
@@ -1332,6 +1296,9 @@
res = dte_operation_release(ztc);
break;
case ZT_TCOP_TRANSCODE:
+ /* This operation is deprecated. Callers should call read /
+ * write directly in order to transcode packets.
+ */
res = -EINVAL;
break;
default:
@@ -1363,12 +1330,6 @@
static void receive_csm_encaps_packet(struct wcdte *wc, const struct csm_encaps_hdr *hdr)
{
- /* \todo There are some potential race conditions here. Inbound
- * packets overwrite certain state variables in struct wcdte that
- * other threads are waiting on. What prevents two packets arriving
- * back to back from causing another waiting thread from missing a
- * particular response?
- */
const int MESSAGE_PACKET = 0x80;
const int SUPPRESS_ACK = 0x40;
@@ -1385,7 +1346,7 @@
wake_up(&wc->regq);
} else {
if (0x0000 != function) {
- DTE_PRINTK(wc,WARNING,
+ DTE_PRINTK(WARNING,
"Unexpected command response received " \
"(sent: %04X, received: %04X)\n",
wc->last_command_sent, function);
@@ -1402,7 +1363,7 @@
if ( 0x75 == hdr->class && 0xc1 == hdr->type) {
/* \todo Are there any alert types that we should do more to
* handle here? */
- DTE_PRINTK(wc,WARNING,"Received alert (0x%04x) from dsp\n", le16_to_cpu(hdr->params[0]));
+ DTE_PRINTK(WARNING,"Received alert (0x%04x) from dsp\n", le16_to_cpu(hdr->params[0]));
}
}
@@ -1418,7 +1379,7 @@
index = (u16)((cmd->cmd[37] | (cmd->cmd[36] << 8)) - 0x5000) / 2;
if (unlikely(index >= wc->numchannels)) {
- DTE_PRINTK(wc, ERR, "Invalid channel number in response from DTE.\n");
+ DTE_PRINTK(ERR, "Invalid channel number in response from DTE.\n");
free_cmd(cmd);
return;
}
@@ -1437,7 +1398,7 @@
cpvt = ztc->pvt;
break;
default:
- DTE_PRINTK(wc, ERR, "Unknown codec in received packet (0x%02x).\n", rcodec);
+ DTE_PRINTK(ERR, "Unknown codec in received packet (0x%02x).\n", rcodec);
free_cmd(cmd);
return;
}
@@ -1446,8 +1407,8 @@
/* Just for debugging purposes. */
rlen = (cmd->cmd[39] | (cmd->cmd[38] << 8)) - 20;
- DTE_DEBUG(wc, DTE_DEBUG_RTP_RX, "Adding RTP packet of length %d to channel: %p\n",
- rlen, ztc);
+ DTE_DEBUG(DTE_DEBUG_RTP_RX, "Adding RTP packet of length %d to channel: %p\n",
+ rlen, ztc);
spin_lock_irqsave(&cpvt->lock, flags);
list_add_tail(&cmd->node, &cpvt->rx_queue);
spin_unlock_irqrestore(&cpvt->lock, flags);
@@ -1472,9 +1433,9 @@
break;
default:
- DTE_PRINTK(wc,
- WARNING, "Unknown packet protocol recieved: %04x.\n",
- be16_to_cpu(ethhdr->h_proto));
+ DTE_PRINTK(WARNING,
+ "Unknown packet protocol recieved: %04x.\n",
+ be16_to_cpu(ethhdr->h_proto));
break;
}
}
@@ -1488,13 +1449,16 @@
* Process the received packets
*
*/
- while((cmd = dte_retrieve(&wc->rxd))) {
+ while((cmd = dte_retrieve(wc->rxd))) {
struct dte_cmd *newcmd;
+
+ wcdte_capture_packet(wc, cmd);
+
if(!(newcmd = __alloc_cmd(GFP_ATOMIC, 0))) {
- DTE_PRINTK(wc, ERR, "Out of memory in %s.\n", __FUNCTION__);
+ DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
} else {
newcmd->cmdlen = SFRAME_SIZE;
- dte_submit(&wc->rxd, newcmd);
+ dte_submit(wc->rxd, newcmd);
}
wcdte_receiveprep(wc, cmd);
}
@@ -1504,7 +1468,7 @@
* Process the transmit packets
*
*/
- while((cmd = dte_retrieve(&wc->txd))) {
+ while((cmd = dte_retrieve(wc->txd))) {
if (NO_AUTO_FREE_CMD & cmd->flags) {
/* If NO_AUTO_FREE_CMD is set, then some other thread
* is waiting for this packet to complete transmit and
@@ -1578,16 +1542,16 @@
wcdte_setctl(wc, 0x0028, reg);
} else {
if ((ints & 0x00008000) && debug)
- DTE_PRINTK(wc, INFO, "Abnormal Interrupt.\n");
+ DTE_PRINTK(INFO, "Abnormal Interrupt.\n");
if ((ints & 0x00002000) && debug)
- DTE_PRINTK(wc, INFO, "Fatal Bus Error INT\n");
+ DTE_PRINTK(INFO, "Fatal Bus Error INT\n");
if ((ints & 0x00000100) && debug)
- DTE_PRINTK(wc, INFO, "Receive Stopped INT\n");
+ DTE_PRINTK(INFO, "Receive Stopped INT\n");
if ((ints & 0x00000080) && debug) {
- DTE_PRINTK(wc, INFO, "Receive Desciptor Unavailable INT\n");
+ DTE_PRINTK(INFO, "Receive Desciptor Unavailable INT\n");
# if DEFERRED_PROCESSING == WORKQUEUE
queue_work(wc->dte_wq, &wc->dte_work);
# else
@@ -1596,16 +1560,16 @@
}
if ((ints & 0x00000020) && debug)
- DTE_PRINTK(wc, INFO, "Transmit Under-flow INT\n");
+ DTE_PRINTK(INFO, "Transmit Under-flow INT\n");
if ((ints & 0x00000008) && debug)
- DTE_PRINTK(wc, INFO, "Jabber Timer Time-out INT\n");
+ DTE_PRINTK(INFO, "Jabber Timer Time-out INT\n");
if ((ints & 0x00000004) && debug)
; // printk("wcdte: Transmit Descriptor Unavailable INT\n");
if ((ints & 0x00000002) && debug)
- DTE_PRINTK(wc, INFO, "Transmit Processor Stopped INT\n");
+ DTE_PRINTK(INFO, "Transmit Processor Stopped INT\n");
/* Clear all the pending interrupts. */
wcdte_setctl(wc, 0x0028, ints);
@@ -1647,7 +1611,7 @@
break;
}
- reg |= ((wc->txd.padding / sizeof(u32)) << 2) & 0x7c;
+ reg |= ((wc->txd->padding / sizeof(u32)) << 2) & 0x7c;
/* Reset the DTE... */
wcdte_setctl(wc, 0x0000, reg | 1);
@@ -1696,7 +1660,7 @@
return;
}
cmd->cmdlen = SFRAME_SIZE;
- if ((res=dte_submit(&wc->rxd, cmd))) {
+ if ((res=dte_submit(wc->rxd, cmd))) {
/* When we're starting the DMA, we should always be
* able to fill the ring....so something is wrong
* here. */
@@ -1706,8 +1670,8 @@
}
}
wmb();
- wcdte_setctl(wc, 0x0020, wc->txd.desc_dma);
- wcdte_setctl(wc, 0x0018, wc->rxd.desc_dma);
+ wcdte_setctl(wc, 0x0020, wc->txd->desc_dma);
+ wcdte_setctl(wc, 0x0018, wc->rxd->desc_dma);
/* Start receiver/transmitter */
reg = wcdte_getctl(wc, 0x0030);
@@ -1746,21 +1710,20 @@
wcdte_setctl(wc, 0x0084, 0x00000000);
}
-/* \todo what does csmencaps mean? */
-static int wcdte_waitfor_csmencaps(struct wcdte *wc, unsigned int mask, unsigned int wait_mode)
+static int wcdte_waitfor_dte(struct wcdte *wc, unsigned int mask, unsigned int wait_mode)
{
int ret;
if (wait_mode == 1) {
- ret = wait_event_timeout(wc->regq, (wc->rcvflags == mask), HZ*2);
+ ret = wait_event_timeout(wc->regq, (wc->rcvflags == mask), HZ/4);
} else if (wait_mode == 2) {
- ret = wait_event_timeout(wc->regq, (wc->rcvflags == mask), HZ*2);
+ ret = wait_event_timeout(wc->regq, (wc->rcvflags == mask), HZ/4);
} else {
ret = wait_event_timeout(wc->regq,
((wc->last_rcommand == wc->last_command_sent) &&
(wc->last_seqno == wc->last_rseqno) &&
- (wc->rcvflags == mask)), HZ*2);
+ (wc->rcvflags == mask)), HZ/4);
}
wc->rcvflags = 0;
wc->last_rcommand = 0;
@@ -1768,14 +1731,14 @@
if (ret < 0) {
if (debug) {
- DTE_PRINTK(wc, DEBUG,
+ DTE_PRINTK(DEBUG,
"Wait interrupted, need to stop boot " \
"(ret = %d)\n", ret);
}
return -ERESTARTSYS;
} else if (ret == 0) {
if (debug) {
- DTE_PRINTK(wc, DEBUG,
+ DTE_PRINTK(DEBUG,
"Waitfor CSMENCAPS response timed " \
"out (ret = %d) (cmd_snt = %04X)\n", ret,
wc->last_command_sent);
@@ -1868,7 +1831,7 @@
delay_count++;
if (delay_count >= 5000) {
- DTE_PRINTK(wc, ERR, "Failed to link to DTE processor!\n");
+ DTE_PRINTK(ERR, "Failed to link to DTE processor!\n");
return -EIO;
}
} while ((reg & 0xE0000000) != 0xE0000000);
@@ -1905,7 +1868,7 @@
dte_transmit_cmd(wc, cmd);
- if ((ret = wcdte_waitfor_csmencaps(wc, RCV_CSMENCAPS_ACK, 1))) {
+ if ((ret = wcdte_waitfor_dte(wc, RCV_CSMENCAPS_ACK, 1))) {
if (-EAGAIN == ret) {
/* Retransmit if DTE processor times out */
byteloc = last_byteloc;
@@ -1921,7 +1884,7 @@
ret = wait_event_interruptible_timeout(wc->regq, (wc->rcvflags == RCV_CSMENCAPS), 10*HZ);
switch (ret) {
case 0:
- DTE_PRINTK(wc,ERR,"ERROR: Timeout waiting for transcoding engine to start.\n");
+ DTE_PRINTK(ERR, "ERROR: Timeout waiting for transcoding engine to start.\n");
return -EIO;
case -ERESTARTSYS:
/* Interrupted by signal */
@@ -1944,7 +1907,7 @@
ENTERING();
/* Turn off auto negotiation */
wcdte_write_phy(wc, 0, 0x2100);
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL, "PHY register 0 = %X\n",
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "PHY register 0 = %X\n",
wcdte_read_phy(wc, 0));
/* Set reset */
@@ -1968,7 +1931,7 @@
#endif
reg = wcdte_getctl(wc, 0x00fc);
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL, "LINK STATUS: reg(0xfc) = %X\n", reg);
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "LINK STATUS: reg(0xfc) = %X\n", reg);
reg = wcdte_getctl(wc, 0x00A0);
@@ -1980,7 +1943,7 @@
/* Turn on booted LED */
wcdte_setctl(wc, 0x00A0, 0x04080000);
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL, "Successfully booted DTE processor.\n");
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "Successfully booted DTE processor.\n");
LEAVING();
return 0;
@@ -2074,7 +2037,7 @@
}
chan2 = wc->last_rparm1;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP,
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP,
"DTE is using the following channels chan1: %d chan2: %d\n", chan1, chan2);
BUG_ON(part1_id/2 >= wc->numchannels);
@@ -2146,7 +2109,7 @@
return res;
}
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP,
+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP,
"DTE has completed setup and connected the two channels together.\n");
@@ -2182,7 +2145,7 @@
if (chan1/2 >= wc->numchannels || chan2/2 >= wc->numchannels) {
#if 0
- DTE_PRINTK(wc, WARNING,
+ DTE_PRINTK(WARNING,
"Invalid channel numbers in %s. chan1:%d chan2: %d\n",
__FUNCTION__, chan1/2, chan2/2);
#endif
@@ -2425,7 +2388,9 @@
#endif /* CONFIG_DEBUG_FS */
-static int initialize_channel_pvt(struct wcdte *wc, encode_t type, struct channel_pvt **cpvt)
+static int
+initialize_channel_pvt(struct wcdte *wc, encode_t type,
+ struct channel_pvt **cpvt)
{
int chan;
*cpvt = kmalloc(sizeof(struct channel_pvt) * wc->numchannels, GFP_KERNEL);
@@ -2495,13 +2460,14 @@
return res;
}
-static int __devinit wcdte_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
-{
- int res, reg;
+static int __devinit
+wcdte_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ int res, reg, x;
struct wcdte *wc = NULL;
struct wcdte_desc *d = (struct wcdte_desc *)ent->driver_data;
- int x;
- unsigned char g729_numchannels, g723_numchannels, min_numchannels, dte_firmware_ver, dte_firmware_ver_minor;
+ unsigned char g729_numchannels, g723_numchannels, min_numchannels;
+ unsigned char dte_firmware_ver, dte_firmware_ver_minor;
unsigned int complexfmts;
struct firmware embedded_firmware;
@@ -2548,15 +2514,17 @@
init_MUTEX(&wc->chansem);
spin_lock_init(&wc->reglock);
spin_lock_init(&wc->cmd_list_lock);
+ spin_lock_init(&wc->captured_list_lock);
INIT_LIST_HEAD(&wc->cmd_list);
INIT_LIST_HEAD(&wc->lost_cmd_list);
-
- DTE_PRINTK(wc, INFO, "Attached to device at %s.\n", pci_name(wc->pdev));
+ INIT_LIST_HEAD(&wc->captured_packets);
+
+ DTE_PRINTK(INFO, "Attached to device at %s.\n", pci_name(wc->pdev));
/* Keep track of whether we need to free the region */
if (!request_region(wc->iobase, 0xff, wc->board_name)) {
/* \todo put in error message. */
- DTE_PRINTK(wc, WARNING,
+ DTE_PRINTK(WARNING,
"Failed to reserve the I/O ports for this device.\n");
return -EIO;
}
@@ -2565,16 +2533,27 @@
if (pci_set_dma_mask(wc->pdev, DMA_32BIT_MASK)) {
release_region(wc->iobase, 0xff);
- DTE_PRINTK(wc, WARNING, "No suitable DMA available.\n");
+ DTE_PRINTK(WARNING, "No suitable DMA available.\n");
return -EIO;
}
- if ((res = dte_initialize_descriptor_ring(wc->pdev, &wc->txd,
+ if (!(wc->txd = kmalloc(sizeof(*wc->txd), GFP_KERNEL))) {
+ res = -ENOMEM;
+ goto error_exit_swinit;
+ }
+
+ if ((res = dte_initialize_descriptor_ring(wc->pdev, wc->txd,
0xe0800000,
DMA_TO_DEVICE))) {
goto error_exit_swinit;
}
- if ((res = dte_initialize_descriptor_ring(wc->pdev, &wc->rxd, 0,
+
+ if (!(wc->rxd = kmalloc(sizeof(*wc->rxd), GFP_KERNEL))) {
+ res = -ENOMEM;
+ goto error_exit_swinit;
+ }
+
+ if ((res = dte_initialize_descriptor_ring(wc->pdev, wc->rxd, 0,
DMA_FROM_DEVICE))) {
goto error_exit_swinit;
}
@@ -2593,7 +2572,7 @@
#if defined(HOTPLUG_FIRMWARE)
if ((res = request_firmware(&firmware, tc400m_firmware, &wc->pdev->dev)) ||
!firmware) {
- DTE_PRINTK(wc, ERR, "Firmware %s not available from userspace.\n", tc400m_firmware);
+ DTE_PRINTK(ERR, "Firmware %s not available from userspace.\n", tc400m_firmware);
goto error_exit_swinit;
}
#else
@@ -2608,7 +2587,7 @@
min_numchannels = min(g723_numchannels, g729_numchannels);
-#if 0 /* Still working on G.723 with new interface. Limit to G.729 for now. */
+#if 1 /* Still working on G.723 with new interface. Limit to G.729 for now. */
if (!mode || strlen(mode) < 4) {
sprintf(wc->complexname, "G.729a / G.723.1");
complexfmts = ZT_FORMAT_G729A | ZT_FORMAT_G723_1;
@@ -2645,13 +2624,13 @@
*/
if ((res = pci_enable_device(pdev))) {
- DTE_PRINTK(wc, ERR, "Failed to enable device.\n");
+ DTE_PRINTK(ERR, "Failed to enable device.\n");
goto error_exit_swinit;;
}
pci_set_master(pdev);
pci_set_drvdata(pdev, wc);
if ((res = request_irq(pdev->irq, wcdte_interrupt, ZAP_IRQ_SHARED, wc->board_name, wc))) {
- DTE_PRINTK(wc, ERR, "Unable to request IRQ %d\n", pdev->irq);
+ DTE_PRINTK(ERR, "Unable to request IRQ %d\n", pdev->irq);
if (firmware != &embedded_firmware) {
release_firmware(firmware);
}
@@ -2676,27 +2655,29 @@
goto error_exit_hwinit;
}
- DTE_PRINTK(wc, INFO, "(%s) Transcoder support LOADED " \
+ /* \todo Read firmware version directly from tc400b.*/
+ DTE_PRINTK(INFO, "(%s) Transcoder support LOADED " \
"(firm ver = %d.%d)\n", wc->complexname, dte_firmware_ver,
dte_firmware_ver_minor);
reg = wcdte_getctl(wc, 0x00fc);
- if (debug)
- DTE_PRINTK(wc, DEBUG, "debug: (post-boot) Reg fc is %08x\n", reg);
+
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
+ "debug: (post-boot) Reg fc is %08x\n", reg);
- DTE_PRINTK(wc, INFO, "Installed a Wildcard TC: %s \n", wc->variety);
- if (debug) {
- DTE_PRINTK(wc, DEBUG, "Operating in DEBUG mode.\n");
- DTE_PRINTK(wc, DEBUG, "debug_des = %d, debug_des_cnt = %d\n " \
- "debug_packets = %d\n",
- debug_des, debug_des_cnt, debug_packets);
- }
- res = 0;
+ DTE_PRINTK(INFO, "Installed a Wildcard TC: %s \n", wc->variety);
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "Operating in DEBUG mode.\n");
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
+ "debug_des = %d, debug_des_cnt = %d\n debug_packets = %d\n",
+ debug_des, debug_des_cnt, debug_packets);
wcdte_debugfs_create_board_entry(wc);
zt_transcoder_register(wc->uencode);
zt_transcoder_register(wc->udecode);
+ if (DTE_DEBUG_NETWORK_IF & debug) {
+ wcdte_net_register(wc);
+ }
LEAVING();
- return res;
+ return 0;
error_exit_hwinit:
wcdte_stop_dma(wc);
@@ -2705,23 +2686,17 @@
pci_set_drvdata(pdev, NULL);
release_region(wc->iobase, 0xff);
error_exit_swinit:
- if (wc->encoders) {
- kfree(wc->encoders);
- }
- if (wc->decoders) {
- kfree(wc->decoders);
- }
- if (wc->uencode) {
- zt_transcoder_free(wc->uencode);
- }
- if (wc->udecode) {
- zt_transcoder_free(wc->udecode);
- }
- if (wc->txd.desc) {
- wcdte_cleanup_descriptor_ring(&wc->txd);
- }
- if (wc->rxd.desc) {
- wcdte_cleanup_descriptor_ring(&wc->rxd);
+ if (wc->encoders) kfree(wc->encoders);
+ if (wc->decoders) kfree(wc->decoders);
+ if (wc->uencode) zt_transcoder_free(wc->uencode);
+ if (wc->udecode) zt_transcoder_free(wc->udecode);
+ if (wc->txd) {
+ if (wc->txd->desc) wcdte_cleanup_descriptor_ring(wc->txd);
+ kfree(wc->txd);
+ }
+ if (wc->rxd) {
+ if (wc->rxd && wc->rxd->desc) wcdte_cleanup_descriptor_ring(wc->rxd);
+ kfree(wc->rxd);
}
kfree(wc);
LEAVING();
@@ -2757,13 +2732,17 @@
return;
}
+ wcdte_net_unregister(wc);
+
+ wcdte_cleanup_captured_packets(wc);
+
wcdte_debugfs_remove_board_entry(wc);
if (debug) {
for(i = 0; i < wc->numchannels; i++) {
ztc_en = &(wc->uencode->channels[i]);
cpvt = ztc_en->pvt;
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"encoder[%d] snt = %d, rcv = %d [%d]\n", i,
atomic_read(&cpvt->stats.packets_sent),
atomic_read(&cpvt->stats.packets_received),
@@ -2771,7 +2750,7 @@
ztc_de = &(wc->udecode->channels[i]);
cpvt = ztc_de->pvt;
- DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
+ DTE_DEBUG(DTE_DEBUG_GENERAL,
"decoder[%d] snt = %d, rcv = %d [%d]\n", i,
atomic_read(&cpvt->stats.packets_sent),
atomic_read(&cpvt->stats.packets_received),
@@ -2800,8 +2779,14 @@
/* Free Resources */
release_region(wc->iobase, 0xff);
- wcdte_cleanup_descriptor_ring(&wc->txd);
- wcdte_cleanup_descriptor_ring(&wc->rxd);
+ if (wc->txd) {
+ if (wc->txd->desc) wcdte_cleanup_descriptor_ring(wc->txd);
+ kfree(wc->txd);
+ }
+ if (wc->rxd) {
+ if (wc->rxd && wc->rxd->desc) wcdte_cleanup_descriptor_ring(wc->rxd);
+ kfree(wc->rxd);
+ }
wcdte_cleanup_command_list(wc);
wcdte_cleanup_channels(wc);
@@ -2863,6 +2848,8 @@
kmem_cache_destroy(cmd_cache);
}
+module_param(debug_packets, int, S_IRUGO);
+MODULE_PARM_DESC(debug_packets, "The maximum number of packets to save.");
module_param(debug, int, S_IRUGO | S_IWUSR);
module_param(debug_des, int, S_IRUGO | S_IWUSR);
module_param(debug_des_cnt, int, S_IRUGO | S_IWUSR);
Modified: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test.h
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test.h?view=diff&rev=4243&r1=4242&r2=4243
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test.h (original)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test.h Thu May 8 11:18:54 2008
@@ -35,7 +35,7 @@
#define FORMAT_G729A (1 << 8)
#define G729_SIZE 20
-#define G723_SIZE 30
+#define G723_SIZE 20
#define LAW_30MS_SIZE 240
#define LAW_20MS_SIZE 160
Modified: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test_threaded.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test_threaded.c?view=diff&rev=4243&r1=4242&r2=4243
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test_threaded.c (original)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/codec_test_threaded.c Thu May 8 11:18:54 2008
@@ -199,11 +199,9 @@
{
int fd;
struct zt_transcoder_formats fmt;
- int flags;
if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0)
return -1;
- flags = fcntl(fd, F_GETFL);
fmt.srcfmt = tst_data.srcfmt;
fmt.dstfmt = tst_data.dstfmt;
Added: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.c?view=auto&rev=4243
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.c (added)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/wcdte_net.c Thu May 8 11:18:54 2008
@@ -1,0 +1,130 @@
+/*
+ * Wildcard TC400B Driver Network Interface
+ *
+ * This module creates a network device that can be used to monitor the RTP
+ * packet stream between the Digium Transcoding Engine (DTE) and the host.
+ *
+ * Written by Shaun Ruffell <sruffell at digium.com>
+ *
+ * Copyright (C) 2008, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/etherdevice.h>
+
+#include "wctc4xxp.h"
+
+extern int debug;
+
+static void wcdte_net_set_multi(struct net_device *netdev)
+{
+ struct wcdte *wc = netdev->priv;
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
+}
+
+static int wcdte_net_open(struct net_device *netdev)
+{
+ struct wcdte *wc = netdev->priv;
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
+ module_put(THIS_MODULE);
+ return 0;
+}
+
+static int wcdte_net_stop(struct net_device *netdev)
+{
+ struct wcdte *wc = netdev->priv;
+ DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
+ __module_get(THIS_MODULE);
+ return 0;
+}
+
[... 318 lines stripped ...]
More information about the svn-commits
mailing list