summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-05 15:22:56 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-05 15:22:56 +0000
commitb4b9c88ccd625d7840111159f42b72bcda883227 (patch)
treeb86563b3ac2db83ab6e3ac7c76269a5b2e846430
parentb8150324c0d96533bccf25cdc02fa43a5fb887d2 (diff)
Enhance watchdog support
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@190 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwcfxo.c25
-rwxr-xr-xwcfxs.c6
-rwxr-xr-xwctdm.c6
3 files changed, 29 insertions, 8 deletions
diff --git a/wcfxo.c b/wcfxo.c
index 17c3621..fb12d73 100755
--- a/wcfxo.c
+++ b/wcfxo.c
@@ -403,10 +403,9 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
if (ints & 0x10) {
- printk("PCI Master abort\n");
- /* Stop DMA and start it again */
+ printk("FXO PCI Master abort\n");
+ /* Stop DMA andlet the watchdog start it again */
wcfxo_stop_dma(wc);
- wcfxo_restart_dma(wc);
return;
}
@@ -513,6 +512,13 @@ static int wcfxo_open(struct zt_chan *chan)
return 0;
}
+static int wcfxo_watchdog(struct zt_span *span, int event)
+{
+ printk("FXO: Restarting DMA\n");
+ wcfxo_restart_dma(span->pvt);
+ return 0;
+}
+
static int wcfxo_close(struct zt_chan *chan)
{
struct wcfxo *wc = chan->pvt;
@@ -582,6 +588,7 @@ static int wcfxo_initialize(struct wcfxo *wc)
wc->span.close = wcfxo_close;
wc->span.flags = ZT_FLAG_RBS;
wc->span.deflaw = ZT_LAW_MULAW;
+ wc->span.watchdog = wcfxo_watchdog;
#ifdef ENABLE_TASKLETS
tasklet_init(&wc->wcfxo_tlet, wcfxo_tasklet, (unsigned long)wc);
#endif
@@ -666,12 +673,7 @@ static void wcfxo_start_dma(struct wcfxo *wc)
static void wcfxo_restart_dma(struct wcfxo *wc)
{
- int x;
/* Reset Master and TDM */
- outb(0x0f, wc->ioaddr + WC_CNTL);
- /* Can't really wait, so simulate a wait */
- for (x=0;x<100;x++)
- inb( wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_OPER);
}
@@ -682,6 +684,12 @@ static void wcfxo_stop_dma(struct wcfxo *wc)
outb(0x00, wc->ioaddr + WC_OPER);
}
+static void wcfxo_reset_tdm(struct wcfxo *wc)
+{
+ /* Reset TDM */
+ outb(0x0f, wc->ioaddr + WC_CNTL);
+}
+
static void wcfxo_disable_interrupts(struct wcfxo *wc)
{
outb(0x00, wc->ioaddr + WC_MASK0);
@@ -872,6 +880,7 @@ static void __devexit wcfxo_remove_one(struct pci_dev *pdev)
/* Stop any DMA */
wcfxo_stop_dma(wc);
+ wcfxo_reset_tdm(wc);
/* In case hardware is still there */
wcfxo_disable_interrupts(wc);
diff --git a/wcfxs.c b/wcfxs.c
index 56d91b7..2e81dd9 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -241,6 +241,7 @@ static inline void wcfxs_receiveprep(struct wcfxs *wc, unsigned char ints)
static inline void wcfxs_check_hook(struct wcfxs *wc, int card);
static void wcfxs_stop_dma(struct wcfxs *wc);
+static void wcfxs_reset_tdm(struct wcfxs *wc);
static void wcfxs_restart_dma(struct wcfxs *wc);
static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -1086,6 +1087,10 @@ static void wcfxs_start_dma(struct wcfxs *wc)
static void wcfxs_stop_dma(struct wcfxs *wc)
{
outb(0x00, wc->ioaddr + WC_OPER);
+}
+
+static void wcfxs_reset_tdm(struct wcfxs *wc)
+{
/* Reset TDM */
outb(0x0f, wc->ioaddr + WC_CNTL);
}
@@ -1215,6 +1220,7 @@ static void __devexit wcfxs_remove_one(struct pci_dev *pdev)
/* Stop any DMA */
wcfxs_stop_dma(wc);
+ wcfxs_reset_tdm(wc);
/* In case hardware is still there */
wcfxs_disable_interrupts(wc);
diff --git a/wctdm.c b/wctdm.c
index 56d91b7..2e81dd9 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -241,6 +241,7 @@ static inline void wcfxs_receiveprep(struct wcfxs *wc, unsigned char ints)
static inline void wcfxs_check_hook(struct wcfxs *wc, int card);
static void wcfxs_stop_dma(struct wcfxs *wc);
+static void wcfxs_reset_tdm(struct wcfxs *wc);
static void wcfxs_restart_dma(struct wcfxs *wc);
static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -1086,6 +1087,10 @@ static void wcfxs_start_dma(struct wcfxs *wc)
static void wcfxs_stop_dma(struct wcfxs *wc)
{
outb(0x00, wc->ioaddr + WC_OPER);
+}
+
+static void wcfxs_reset_tdm(struct wcfxs *wc)
+{
/* Reset TDM */
outb(0x0f, wc->ioaddr + WC_CNTL);
}
@@ -1215,6 +1220,7 @@ static void __devexit wcfxs_remove_one(struct pci_dev *pdev)
/* Stop any DMA */
wcfxs_stop_dma(wc);
+ wcfxs_reset_tdm(wc);
/* In case hardware is still there */
wcfxs_disable_interrupts(wc);