diff options
-rwxr-xr-x | Makefile | 2 | ||||
-rwxr-xr-x | wcfxs.c | 19 | ||||
-rwxr-xr-x | wctdm.c | 19 | ||||
-rwxr-xr-x | zaptel.c | 17 |
4 files changed, 39 insertions, 18 deletions
@@ -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. # @@ -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); } @@ -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); } @@ -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); } |