summaryrefslogtreecommitdiff
path: root/wct4xxp.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-01-10 05:35:55 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-01-10 05:35:55 +0000
commit1bb6d221125d9d2e8838d353e9c0163e268b96ed (patch)
treeebcd967ee419d2a940874c92d20a07eb08c0281c /wct4xxp.c
parent5da56359497e98271f18a442d0828fc2677df77b (diff)
FIFO reset placeholder code
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@295 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp.c')
-rwxr-xr-xwct4xxp.c75
1 files changed, 62 insertions, 13 deletions
diff --git a/wct4xxp.c b/wct4xxp.c
index af35bef..1dc21b0 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -3,7 +3,6 @@
*
* Written by Mark Spencer <markster@linux-support.net>
* Based on previous works, designs, and archetectures conceived and
- * written by Jim Dixon <jim@lambdatel.com>.
*
* Copyright (C) 2001 Jim Dixon / Zapata Telephony.
* Copyright (C) 2001, Linux Support Services, Inc.
@@ -76,8 +75,6 @@ static int altab[] = {
#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 @@ static int t4_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data);
#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 @@ static void t4_receiveprep(struct t4 *wc, int irq)
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 @@ static inline void __handle_leds(struct t4 *wc)
#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 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
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 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
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 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
}
#endif
- spin_lock_irqsave(&wc->reglock, flags);
+ /* spin_lock_irqsave(&wc->reglock, flags); */
__handle_leds(wc);
@@ -1402,11 +1437,25 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
__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)