From 99837b49c97ca251df8b792d4a66095f8daf1b7a Mon Sep 17 00:00:00 2001 From: markster Date: Sat, 10 Apr 2004 03:01:57 +0000 Subject: Implement manual yellow alarm on things we should (like RECOVER and NOTOPEN) for bug 1091 git-svn-id: http://svn.digium.com/svn/zaptel/trunk@358 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'wct4xxp.c') diff --git a/wct4xxp.c b/wct4xxp.c index 9969b72..9e2b128 100755 --- a/wct4xxp.c +++ b/wct4xxp.c @@ -1184,6 +1184,14 @@ static void __t4_do_counters(struct t4 *wc) for (span=0;span<4;span++) { if (wc->alarmtimer[span]) { if (!--wc->alarmtimer[span]) { + unsigned char fmr4; +#if 1 + printk("wct4xxp: Clearing yellow alarm on span %d\n", span + 1); +#endif + + /* We manually do yellow alarm to handle RECOVER */ + fmr4 = __t4_framer_in(wc, span, 0x20); + __t4_framer_out(wc, span, 0x20, fmr4 & ~0x20); wc->spans[span].alarms &= ~(ZT_ALARM_RECOVER); wc->checktiming = 1; zt_alarm_notify(&wc->spans[span]); @@ -1271,20 +1279,20 @@ static void __t4_check_alarms(struct t4 *wc, int span) /* Keep track of recovering */ if ((!alarms) && wc->spans[span].alarms) wc->alarmtimer[span] = ZT_ALARMSETTLE_TIME; + if (wc->alarmtimer[span]) + alarms |= ZT_ALARM_RECOVER; /* If receiving alarms, go into Yellow alarm state */ if (alarms && (!wc->spans[span].alarms)) { -#if 0 - printk("Going into yellow alarm\n"); + unsigned char fmr4; +#if 1 + printk("wct4xxp: Setting yellow alarm on span %d\n", span + 1); #endif -#if 0 - /* The quadfalc automatically generates yellow alarm */ - if (wc->spantype[span] == TYPE_E1) - __t1_set_reg(wc, 0x21, 0x7f); - else - __t1_set_reg(wc, 0x35, 0x11); -#endif + + /* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */ + fmr4 = __t4_framer_in(wc, span, 0x20); + __t4_framer_out(wc, span, 0x20, fmr4 | 0x20); } #if 0 @@ -1303,8 +1311,6 @@ static void __t4_check_alarms(struct t4 *wc, int span) __control_set_reg(wc, WC_CLOCK, d); } #endif - if (wc->alarmtimer[span]) - alarms |= ZT_ALARM_RECOVER; if (c & 0x10) alarms |= ZT_ALARM_YELLOW; @@ -1468,10 +1474,12 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs) __t4_check_alarms(wc, x - 4); break; } - + +#if 0 /* periodically check timing */ if (!(wc->intcount % (8000/ZT_CHUNKSIZE))) wc->checktiming = 1; +#endif if (wc->checktiming > 0) __t4_set_timing_source_auto(wc); -- cgit v1.2.3