[Asterisk-cvs] zaptel wct4xxp.c,1.16,1.17
markster at lists.digium.com
markster at lists.digium.com
Fri Jan 9 23:44:11 CST 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv21600
Modified Files:
wct4xxp.c
Log Message:
FIFO reset placeholder code
Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- wct4xxp.c 6 Jan 2004 13:26:44 -0000 1.16
+++ wct4xxp.c 10 Jan 2004 05:35:55 -0000 1.17
@@ -3,7 +3,6 @@
*
* Written by Mark Spencer <markster at linux-support.net>
* Based on previous works, designs, and archetectures conceived and
- * written by Jim Dixon <jim at lambdatel.com>.
*
* Copyright (C) 2001 Jim Dixon / Zapata Telephony.
* Copyright (C) 2001, Linux Support Services, Inc.
@@ -76,8 +75,6 @@
#define CANARY 0xc0de
-static int inirq = 0;
-
struct t4 {
/* This structure exists one per card */
struct pci_dev *dev; /* Pointer to PCI device */
@@ -156,6 +153,7 @@
#define WC_GPIO 9
#define WC_LADDR 10
#define WC_LDATA 11
+#define WC_POSITION 12
#define WC_LREAD (1 << 15)
#define WC_LWRITE (1 << 16)
@@ -970,6 +968,14 @@
wc->spans[1].chans[z].readchunk[x] = (tmp & 0xff0000) >> 16;
wc->spans[0].chans[z].readchunk[x] = tmp >> 24;
}
+#if 0
+ if (wc->spans[0].chans[0].readchunk[x] == 0xff) {
+ static int printed = 0;
+ if (!(printed++ % 100)) {
+ printk("Read 255 at position %d/%d\n", wc->last0, x);
+ }
+ }
+#endif
if (wc->t1e1) {
if (wc->e1recover > 0)
wc->e1recover--;
@@ -1318,6 +1324,9 @@
#endif
}
+static int __t4_reset_dma2(struct t4 *wc);
+static int __t4_reset_dma3(struct t4 *wc);
+
#ifdef LINUX26
static irqreturn_t t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
#else
@@ -1327,6 +1336,8 @@
struct t4 *wc = dev_id;
unsigned long flags;
int x;
+ static int irqcount;
+ static int irqdisp;
unsigned int status;
#if 0
@@ -1337,22 +1348,46 @@
if (wc->intcount < 20)
printk("Pre-interrupt\n");
#endif
-
- inirq = 1;
+ spin_lock_irqsave(&wc->reglock, flags);
/* Make sure it's really for us */
- status = t4_pci_in(wc, WC_INTR);
- t4_pci_out(wc, WC_INTR, 0);
+ status = __t4_pci_in(wc, WC_INTR);
/* Ignore if it's not for us */
- if (!status)
+ if (!status) {
+ spin_unlock_irqrestore(&wc->lock, flags);
#ifdef LINUX26
return IRQ_NONE;
#else
return;
#endif
+ }
+ if ((status & 3) == 3)
+ printk("Got both at the same time? (%08x)\n", status);
+
+ irqcount++;
+ irqdisp++;
+ if (!(irqcount % 1000)) {
+ /* printk("Position: %08x\n", __t4_pci_in(wc, WC_POSITION)); */
+ }
+ if (irqcount == 4000) {
+ __t4_reset_dma3(wc);
+ }
+ if (irqcount == 5000) {
+ __t4_reset_dma2(wc);
+ }
+ if (irqcount == 6000) {
+ __t4_reset_dma3(wc);
+ }
+#if 0
+ if (irqdisp < 8) {
+ printk("IRQ Status %d: %08x\n", irqdisp, status);
+ }
+#endif
if (!wc->spansstarted) {
printk("Not prepped yet!\n");
+ __t4_pci_out(wc, WC_INTR, 0);
+ spin_unlock_irqrestore(&wc->reglock, flags);
#ifdef LINUX26
return IRQ_NONE;
#else
@@ -1381,7 +1416,7 @@
}
}
#endif
- spin_lock_irqsave(&wc->reglock, flags);
+ /* spin_lock_irqsave(&wc->reglock, flags); */
__handle_leds(wc);
@@ -1402,11 +1437,25 @@
__t4_check_alarms(wc, x - 4);
break;
}
-
+ __t4_pci_out(wc, WC_INTR, 0);
spin_unlock_irqrestore(&wc->reglock, flags);
-#ifdef LINUX26
- return IRQ_RETVAL(1);
-#endif
+
+}
+
+static int __t4_reset_dma2(struct t4 *wc)
+{
+ printk("DMA Reset part 2\n");
+ wc->dmactrl |= (1 << 27);
+ __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+ return 0;
+}
+
+static int __t4_reset_dma3(struct t4 *wc)
+{
+ printk("DMA Reset part 3\n");
+ wc->dmactrl &= ~(1 << 27);
+ __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+ return 0;
}
static int t4_reset_dma(struct t4 *wc)
More information about the svn-commits
mailing list