[zaptel-commits] kpfleming: branch mogorman/zaptel-1.2-transcoder
r1952 - in /team/mogorman/za...
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Tue Jan 23 21:15:13 MST 2007
Author: kpfleming
Date: Tue Jan 23 22:15:13 2007
New Revision: 1952
URL: http://svn.digium.com/view/zaptel?view=rev&rev=1952
Log:
update to branch base
more minor cleanups, add some comments, etc. to tc4xxp driver
Modified:
team/mogorman/zaptel-1.2-transcoder/ (props changed)
team/mogorman/zaptel-1.2-transcoder/Makefile
team/mogorman/zaptel-1.2-transcoder/wct1xxp.c
team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
team/mogorman/zaptel-1.2-transcoder/wctdm.c
team/mogorman/zaptel-1.2-transcoder/wctdm24xxp.c
team/mogorman/zaptel-1.2-transcoder/wcte11xp.c
Propchange: team/mogorman/zaptel-1.2-transcoder/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 23 22:15:13 2007
@@ -1,1 +1,1 @@
-/branches/1.2:1-1934
+/branches/1.2:1-1951
Modified: team/mogorman/zaptel-1.2-transcoder/Makefile
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/Makefile?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/Makefile (original)
+++ team/mogorman/zaptel-1.2-transcoder/Makefile Tue Jan 23 22:15:13 2007
@@ -315,7 +315,12 @@
tar -zxf mISDNuser.tar.gz
$(MAKE) -C mISDNuser install
-install: all devices firmware
+xpp-install: FORCE
+ifneq (,$(findstring xpp,$(obj-m)))
+ @$(MAKE) -C xpp/utils install
+endif
+
+install: all devices firmware xpp-install
install -D -m 755 ztcfg $(INSTALL_PREFIX)/sbin/ztcfg
if [ -f sethdlc-new ]; then \
install -D -m 755 sethdlc-new $(INSTALL_PREFIX)/sbin/sethdlc; \
Modified: team/mogorman/zaptel-1.2-transcoder/wct1xxp.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wct1xxp.c?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wct1xxp.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wct1xxp.c Tue Jan 23 22:15:13 2007
@@ -1134,14 +1134,14 @@
int x;
ints = inb(wc->ioaddr + WC_INTSTAT);
- outb(ints, wc->ioaddr + WC_INTSTAT);
-
if (!ints)
#ifdef LINUX26
return IRQ_NONE;
#else
return;
#endif
+
+ outb(ints, wc->ioaddr + WC_INTSTAT);
if (!wc->intcount) {
if (debug) printk("Got interrupt: 0x%04x\n", ints);
Modified: team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c Tue Jan 23 22:15:13 2007
@@ -22,7 +22,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
-
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -277,8 +276,8 @@
if ( (((wc->cmdq_wndx + 1) % MAX_COMMANDS) == wc->cmdq_rndx) && debug ) \
module_printk("cmdq is full\n"); \
else { \
- unsigned char fifo[OTHER_CMD_LEN] = command; \
- int i; \
+ u8 fifo[OTHER_CMD_LEN] = command; \
+ u32 i; \
wc->cmdq[wc->cmdq_wndx].cmdlen = length; \
for (i = 0; i < length; i++) \
wc->cmdq[wc->cmdq_wndx].cmd[i] = fifo[i]; \
@@ -499,6 +498,10 @@
o2 = wc->tdbl * 4;
+ /* Yes... this is a busy loop, that is not interruptible. However, it is
+ highly unlikely (and testing proves) that the wait for a descriptor
+ to become available will ever be long enough for this to be an issue.
+ */
do {} while ((le32_to_cpu(wc->descripchunk[o2]) & 0x80000000));
xmt_length = max(wc->cmdq[wc->cmdq_rndx].cmdlen, 64U);
@@ -726,7 +729,7 @@
struct zt_transcoder_channel *ztc = NULL;
struct zt_transcode_header *zth = NULL;
struct dte_state *st = NULL;
- int o2,i;
+ int o2, i;
unsigned char rseq, rcodec;
unsigned int rcommand, rchannel, rlen, rtp_rseq, rtp_eseq;
u8 *chars = NULL;
@@ -896,7 +899,6 @@
}
}
-
static int check_descriptor(struct wcdte *wc)
{
int o2;
@@ -1062,25 +1064,23 @@
setctl(wc, 0x0028, reg);
}
-static void stop_dma(struct wcdte *wc)
-{
- unsigned int reg;
-
+static void disable_interrupts(struct wcdte *wc)
+{
/* Disable interrupts */
setintmask(wc, 0x00000000);
setctl(wc, 0x0084, 0x00000000);
+}
+
+static void stop_dma(struct wcdte *wc)
+{
+ unsigned int reg;
+
+ disable_interrupts(wc);
setctl(wc, 0x0048, 0x00000000);
/* Reset the part to be on the safe side */
reg = getctl(wc, 0x0000);
reg |= 0x00000001;
setctl(wc, 0x0000, reg);
-}
-
-static void disable_interrupts(struct wcdte *wc)
-{
- /* Disable interrupts */
- setintmask(wc, 0x00000000);
- setctl(wc, 0x0084, 0x00000000);
}
static int waitfor_csmencaps(struct wcdte *wc, unsigned int mask, int use_mask)
@@ -1096,14 +1096,12 @@
wc->last_command_sent = 0;
if (ret < 0) {
- if (debug)
- module_printk("wcdte error: Wait interrupted, need to stop boot (ret = %d)\n", ret);
+ debug_printk(1, "Wait interrupted, need to stop boot (ret = %d)\n", ret);
return 1;
}
- if (ret == 0) {
- if (debug)
- module_printk("wcdte error: Waitfor CSMENCAPS response timed out (ret = %d)\n", ret);
+ if (!ret) {
+ debug_printk(1, "Waitfor CSMENCAPS response timed out (ret = %d)\n", ret);
return 2;
}
@@ -1186,39 +1184,41 @@
#if !defined(USE_TEST_HW)
/* Turn off auto negotiation */
write_phy(wc, 0, 0x2100);
- if (debug)
- module_printk("wctc4xxp: PHY register 0 = %X", read_phy(wc, 0));
+
+ debug_printk(1, "PHY register 0 = %X", read_phy(wc, 0));
/* Set reset */
setctl(wc, 0x00A0, 0x04000000);
- /* Wait 1000msec to ensure processor reset */
+ /* Wait 1000ms to ensure processor reset */
mdelay(1000);
/* Clear reset */
setctl(wc, 0x00A0, 0x04080000);
- /* Waitfor ethernet link */
+ /* Wait for Ethernet link */
delay_count = 0;
do {
+ delay_count++;
+ if (delay_count >= 100) {
+ module_printk("Failed to link to DTE processor!\n");
+ return 1;
+ }
+
reg = getctl(wc, 0x00fc);
mdelay(100);
- delay_count++;
-
- if (delay_count >= 100) {
- module_printk("wcdte error: Failed to link to DTE processor!\n");
- return(1);
- }
} while ((reg & 0xE0000000) != 0xE0000000);
/* Turn off booted LED */
setctl(wc, 0x00A0, 0x04084000);
#endif /* !defined(USE_TEST_HW) */
- reg = getctl(wc, 0x00fc);
- if (debug)
- module_printk("wctc4xxp: LINK STATUS: reg(0xfc) = %X\n", reg);
-
+ if (debug) {
+ reg = getctl(wc, 0x00fc);
+ debug_printk(1, "LINK STATUS: reg(0xfc) = %X\n", reg);
+ }
+
+ /* TODO: what is this for? we don't refer to the read value anywhere */
reg = getctl(wc, 0x00A0);
byteloc = 17;
@@ -1231,10 +1231,9 @@
byteloc += 2;
down(&wc->cmdqsem);
- if ( (((wc->cmdq_wndx + 1) % MAX_COMMANDS) == wc->cmdq_rndx) && debug )
- module_printk("wcdte error: cmdq is full.\n");
- else
- {
+ if (((wc->cmdq_wndx + 1) % MAX_COMMANDS) == wc->cmdq_rndx) {
+ debug_printk(1, "wcdte error: cmdq is full.\n");
+ } else {
wc->cmdq[wc->cmdq_wndx].cmdlen = length;
for (i = 0; i < length; i++)
wc->cmdq[wc->cmdq_wndx].cmd[i] = firmware->data[byteloc++];
@@ -1246,7 +1245,7 @@
ret = waitfor_csmencaps(wc, RCV_CSMENCAPS_ACK, 1);
if (ret == 1)
- return(1);
+ return 1;
else if (ret == 2) /* Retransmit if dte processor times out */
byteloc = last_byteloc;
j++;
@@ -1259,10 +1258,9 @@
/* Turn on booted LED */
setctl(wc, 0x00A0, 0x04080000);
- if (debug)
- module_printk("wctc4xxp: Successfully booted DTE processor.\n");
-
- return(0);
+ debug_printk(1, "Successfully booted DTE processor.\n");
+
+ return 0;
}
static int create_channel(struct wcdte *wc, int simple, int complicated, int part1_id,
@@ -1353,7 +1351,8 @@
send_cmd(wc, CMD_MSG_TDM_OPT(wc->seq_num++), CMD_MSG_TDM_OPT_LEN, 0x0435);
#endif
- wc->timeout = HZ/100 + 1; /* 10msec */
+ /* TODO: this may be an invalid assumption... HZ is not always going to be 1000 */
+ wc->timeout = HZ/100 + 1; /* 10ms */
return 0;
}
@@ -1372,8 +1371,8 @@
for (x = 0; x < (sizeof(ifaces) / sizeof(ifaces[0])); x++)
if (!ifaces[x]) break;
- if (x >= WC_MAX_IFACES) {
- module_printk("wctc4xxp: Too many interfaces\n");
+ if (x == (sizeof(ifaces) / sizeof(ifaces[0]))) {
+ module_printk("Too many interfaces\n");
return -EIO;
}
@@ -1403,7 +1402,7 @@
/* Allocate enough memory for all TX buffers, RX buffers, and descriptors */
wc->writechunk = (int *) pci_alloc_consistent(pdev, PCI_WINDOW_SIZE, &wc->writedma);
if (!wc->writechunk) {
- module_printk("wctc4xxp: Unable to allocate DMA-able memory\n");
+ module_printk("Unable to allocate DMA-able memory\n");
if (wc->freeregion)
release_region(wc->iobase, 0xff);
@@ -1429,7 +1428,7 @@
#ifdef HOTPLUG_FIRMWARE
if ((request_firmware(&firmware, tc400m_firmware, &wc->dev->dev) != 0) || !firmware) {
- module_printk("wctc4xxp: firmware %s not available from userspace\n", dte_firmware);
+ module_printk("firmware %s not available from userspace\n", tc400m_firmware);
return -1;
}
#else
@@ -1444,21 +1443,22 @@
min_numchannels = min(g723_numchannels, g729_numchannels);
/* Setup Encoders and Decoders */
+ /* TODO: parse this value properly */
if (!mode || strlen(mode) < 4) {
- sprintf(wc->complexname, "g.729a / g.723.1 5.3kbps");
+ sprintf(wc->complexname, "G.729A / G.723.1 5.3Kbps");
complexfmts = ZT_FORMAT_G729A | ZT_FORMAT_G723_1;
wc->numchannels = min_numchannels;
} else if (mode[3] == '9') { /* "g729" */
- sprintf(wc->complexname, "g.729a");
+ sprintf(wc->complexname, "G.729A");
complexfmts = ZT_FORMAT_G729A;
wc->numchannels = g729_numchannels;
} else if (mode[3] == '3') { /* "g723" */
- sprintf(wc->complexname, "g.723.1 5.3kbps");
+ sprintf(wc->complexname, "G.723.1 5.3Kbps");
complexfmts = ZT_FORMAT_G723_1;
wc->numchannels = g723_numchannels;
} else {
- sprintf(wc->complexname, "g.729a / g.723.1 5.3kbps");
+ sprintf(wc->complexname, "G.729A / G.723.1 5.3Kbps");
complexfmts = ZT_FORMAT_G729A | ZT_FORMAT_G723_1;
wc->numchannels = min_numchannels;
}
@@ -1492,11 +1492,11 @@
udecode->operation = uencode->operation = dte_operation;
for (x = 0;x < wc->numchannels; x++) {
- dte_init_state(encoders + x, 1, x, wc);
+ dte_init_state(&encoders[x], 1, x, wc);
encoders[x].encoder = 1;
- dte_init_state(decoders + x, 0, x, wc);
- uencode->channels[x].pvt = encoders + x;
- udecode->channels[x].pvt = decoders + x;
+ dte_init_state(&decoders[x], 0, x, wc);
+ uencode->channels[x].pvt = &encoders[x];
+ udecode->channels[x].pvt = &decoders[x];
}
wc->uencode = uencode;
@@ -1511,8 +1511,8 @@
/* Keep track of which device we are */
pci_set_drvdata(pdev, wc);
- if (request_irq(pdev->irq, interrupt_handler, SA_SHIRQ, "tc400b", wc)) {
- module_printk("wctc4xxp: Unable to request IRQ %d\n", pdev->irq);
+ if (request_irq(pdev->irq, interrupt_handler, SA_SHIRQ, driver.name, wc)) {
+ module_printk("Unable to request IRQ %d\n", pdev->irq);
if (wc->freeregion)
release_region(wc->iobase, 0xFF);
pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
@@ -1567,11 +1567,12 @@
return -EIO;
}
- reg = getctl(wc, 0x00fc);
- if (debug)
- module_printk("wcdte debug: (post-boot) Reg fc is %08x\n", reg);
-
- module_printk("wctc4xxp: %s supporting '%s' with firmware version '%d'\n", wc->variety, wc->complexname, firmware_ver);
+ if (debug) {
+ reg = getctl(wc, 0x00fc);
+ debug_printk(1, "(post-boot) Reg fc is %08x\n", reg);
+ }
+
+ module_printk("%s supporting '%s' with firmware version '%d'\n", wc->variety, wc->complexname, firmware_ver);
res = 0;
@@ -1596,8 +1597,8 @@
return;
if (debug) {
- module_printk("wctc4xxp debug: wc->ztsnd_rtx = %d\n", wc->ztsnd_rtx);
- module_printk("wctc4xxp debug: wc->ztsnd_0010_rtx = %d\n", wc->ztsnd_0010_rtx);
+ debug_printk(1, "wc->ztsnd_rtx = %d\n", wc->ztsnd_rtx);
+ debug_printk(1, "wc->ztsnd_0010_rtx = %d\n", wc->ztsnd_0010_rtx);
for(i = 0; i < wc->numchannels; i++) {
ztc_en = &(wc->uencode->channels[i]);
@@ -1606,8 +1607,8 @@
ztc_de = &(wc->udecode->channels[i]);
st_de = ztc_de->pvt;
- module_printk("wctc4xxp debug: en[%d] snt = %d, rcv = %d [%d]\n", i, st_en->packets_sent, st_en->packets_received, st_en->packets_sent - st_en->packets_received);
- module_printk("wctc4xxp debug: de[%d] snt = %d, rcv = %d [%d]\n", i, st_de->packets_sent, st_de->packets_received, st_de->packets_sent - st_de->packets_received);
+ debug_printk(1, "en[%d] snt = %d, rcv = %d [%d]\n", i, st_en->packets_sent, st_en->packets_received, st_en->packets_sent - st_en->packets_received);
+ debug_printk(1, "de[%d] snt = %d, rcv = %d [%d]\n", i, st_de->packets_sent, st_de->packets_received, st_de->packets_sent - st_de->packets_received);
}
}
@@ -1634,7 +1635,6 @@
/* Release span, possibly delayed */
release(wc);
}
-
static struct pci_device_id pci_tbl[] = {
#ifndef USE_TEST_HW
Modified: team/mogorman/zaptel-1.2-transcoder/wctdm.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctdm.c?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctdm.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctdm.c Tue Jan 23 22:15:13 2007
@@ -1032,7 +1032,6 @@
int mode;
ints = inb(wc->ioaddr + WC_INTSTAT);
- outb(ints, wc->ioaddr + WC_INTSTAT);
if (!ints)
#ifdef LINUX26
@@ -1040,6 +1039,8 @@
#else
return;
#endif
+
+ outb(ints, wc->ioaddr + WC_INTSTAT);
if (ints & 0x10) {
/* Stop DMA, wait for watchdog */
Modified: team/mogorman/zaptel-1.2-transcoder/wctdm24xxp.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctdm24xxp.c?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctdm24xxp.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctdm24xxp.c Tue Jan 23 22:15:13 2007
@@ -1428,7 +1428,6 @@
/* Read and clear interrupts */
ints = wctdm_getctl(wc, 0x0028);
- wctdm_setctl(wc, 0x0028, ints);
if (!ints)
#ifdef LINUX26
@@ -1436,6 +1435,9 @@
#else
return;
#endif
+
+ wctdm_setctl(wc, 0x0028, ints);
+
ints &= wc->intmask;
if (ints & 0x00000041) {
do {
Modified: team/mogorman/zaptel-1.2-transcoder/wcte11xp.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wcte11xp.c?view=diff&rev=1952&r1=1951&r2=1952
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wcte11xp.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wcte11xp.c Tue Jan 23 22:15:13 2007
@@ -1265,14 +1265,14 @@
int x;
ints = inb(wc->ioaddr + WC_INTSTAT);
- outb(ints, wc->ioaddr + WC_INTSTAT);
-
if (!ints)
#ifdef LINUX26
return IRQ_NONE;
#else
return;
#endif
+
+ outb(ints, wc->ioaddr + WC_INTSTAT);
if (!wc->intcount) {
if (debug) printk("Got interrupt: 0x%04x\n", ints);
More information about the zaptel-commits
mailing list