summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile2
-rwxr-xr-xwcfxs.c19
-rwxr-xr-xwctdm.c19
-rwxr-xr-xzaptel.c17
4 files changed, 39 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 28af362..ea90acf 100755
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ KFLAGS+=-DCONFIG_ZAPATA_PPP
# Uncomment to enable "watchdog" to monitor if interfaces
# stop taking interrupts or otherwise misbehave
#
-#KFLAGS+=-DCONFIG_ZAPTEL_WATCHDOG
+KFLAGS+=-DCONFIG_ZAPTEL_WATCHDOG
#
# ISA Defaults can be set here.
#
diff --git a/wcfxs.c b/wcfxs.c
index 6ecf724..56d91b7 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -880,6 +880,13 @@ static int wcfxs_open(struct zt_chan *chan)
return 0;
}
+static int wcfxs_watchdog(struct zt_span *span, int event)
+{
+ printk("FXS: Restarting DMA\n");
+ wcfxs_restart_dma(span->pvt);
+ return 0;
+}
+
static int wcfxs_close(struct zt_chan *chan)
{
struct wcfxs *wc = chan->pvt;
@@ -949,6 +956,7 @@ static int wcfxs_initialize(struct wcfxs *wc)
wc->span.close = wcfxs_close;
wc->span.flags = ZT_FLAG_RBS;
wc->span.ioctl = wcfxs_ioctl;
+ wc->span.watchdog = wcfxs_watchdog;
init_waitqueue_head(&wc->span.maintq);
wc->span.pvt = wc;
@@ -1058,20 +1066,19 @@ static void wcfxs_enable_interrupts(struct wcfxs *wc)
outb(0x00, wc->ioaddr + WC_MASK1);
}
-static void wcfxs_start_dma(struct wcfxs *wc)
+static void wcfxs_restart_dma(struct wcfxs *wc)
{
/* Reset Master and TDM */
- outb(0x0f, wc->ioaddr + WC_CNTL);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
outb(0x01, wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_OPER);
}
-static void wcfxs_restart_dma(struct wcfxs *wc)
+static void wcfxs_start_dma(struct wcfxs *wc)
{
- int x;
/* Reset Master and TDM */
+ outb(0x0f, wc->ioaddr + WC_CNTL);
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
outb(0x01, wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_OPER);
}
diff --git a/wctdm.c b/wctdm.c
index 6ecf724..56d91b7 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -880,6 +880,13 @@ static int wcfxs_open(struct zt_chan *chan)
return 0;
}
+static int wcfxs_watchdog(struct zt_span *span, int event)
+{
+ printk("FXS: Restarting DMA\n");
+ wcfxs_restart_dma(span->pvt);
+ return 0;
+}
+
static int wcfxs_close(struct zt_chan *chan)
{
struct wcfxs *wc = chan->pvt;
@@ -949,6 +956,7 @@ static int wcfxs_initialize(struct wcfxs *wc)
wc->span.close = wcfxs_close;
wc->span.flags = ZT_FLAG_RBS;
wc->span.ioctl = wcfxs_ioctl;
+ wc->span.watchdog = wcfxs_watchdog;
init_waitqueue_head(&wc->span.maintq);
wc->span.pvt = wc;
@@ -1058,20 +1066,19 @@ static void wcfxs_enable_interrupts(struct wcfxs *wc)
outb(0x00, wc->ioaddr + WC_MASK1);
}
-static void wcfxs_start_dma(struct wcfxs *wc)
+static void wcfxs_restart_dma(struct wcfxs *wc)
{
/* Reset Master and TDM */
- outb(0x0f, wc->ioaddr + WC_CNTL);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
outb(0x01, wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_OPER);
}
-static void wcfxs_restart_dma(struct wcfxs *wc)
+static void wcfxs_start_dma(struct wcfxs *wc)
{
- int x;
/* Reset Master and TDM */
+ outb(0x0f, wc->ioaddr + WC_CNTL);
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
outb(0x01, wc->ioaddr + WC_CNTL);
outb(0x01, wc->ioaddr + WC_OPER);
}
diff --git a/zaptel.c b/zaptel.c
index c2a073a..d6dbfe3 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -5563,9 +5563,11 @@ static void watchdog_check(unsigned long ignored)
{
int x;
long flags;
+ static int wdcheck=0;
+
local_irq_save(flags);
for (x=0;x<maxspans;x++) {
- if (spans[x]) {
+ if (spans[x] && (spans[x]->flags & ZT_FLAG_RUNNING)) {
if (spans[x]->watchcounter == ZT_WATCHDOG_INIT) {
/* Whoops, dead card */
if ((spans[x]->watchstate == ZT_WATCHSTATE_OK) ||
@@ -5580,7 +5582,8 @@ static void watchdog_check(unsigned long ignored)
}
}
} else {
- if (spans[x]->watchstate != ZT_WATCHSTATE_OK)
+ if ((spans[x]->watchstate != ZT_WATCHSTATE_OK) &&
+ (spans[x]->watchstate != ZT_WATCHSTATE_UNKNOWN))
printk("Span %s is alive!\n", spans[x]->name);
spans[x]->watchstate = ZT_WATCHSTATE_OK;
}
@@ -5588,7 +5591,11 @@ static void watchdog_check(unsigned long ignored)
}
}
local_irq_restore(flags);
- mod_timer(&watchdogtimer, jiffies + 1);
+ if (!wdcheck) {
+ printk("Zaptel watchdog on duty!\n");
+ wdcheck=1;
+ }
+ mod_timer(&watchdogtimer, jiffies + 2);
}
static int __init watchdog_init(void)
@@ -5598,11 +5605,11 @@ static int __init watchdog_init(void)
watchdogtimer.data =0;
watchdogtimer.function = watchdog_check;
/* Run every couple of jiffy or so */
- mod_timer(&watchdogtimer, jiffies + 1);
+ mod_timer(&watchdogtimer, jiffies + 2);
return 0;
}
-static void watchdog_cleanup(void)
+static void __exit watchdog_cleanup(void)
{
del_timer(&watchdogtimer);
}