diff options
Diffstat (limited to 'drivers/dahdi/wct4xxp/base.c')
-rw-r--r-- | drivers/dahdi/wct4xxp/base.c | 100 |
1 files changed, 86 insertions, 14 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 63a3bfc..acbdd73 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -167,7 +167,10 @@ static int t1e1override = -1; //0xFF; // -1 = jumper; 0xFF = E1 static int j1mode = 0; static int sigmode = FRMR_MODE_NO_ADDR_CMP; static int loopback = 0; -static int alarmdebounce = 0; +static int alarmdebounce = 2500; /* LOF/LFA def to 2.5s AT&T TR54016*/ +static int losalarmdebounce = 2500;/* LOS def to 2.5s AT&T TR54016*/ +static int aisalarmdebounce = 2500;/* AIS(blue) def to 2.5s AT&T TR54016*/ +static int yelalarmdebounce = 500;/* RAI(yellow) def to 0.5s AT&T devguide */ #ifdef VPM_SUPPORT static int vpmsupport = 1; /* If set to auto, vpmdtmfsupport is enabled for VPM400M and disabled for VPM450M */ @@ -250,6 +253,9 @@ struct t4_span { int redalarms; int notclear; int alarmcount; + int losalarmcount; + int aisalarmcount; + int yelalarmcount; int spanflags; int syncpos; #ifdef SUPPORT_GEN1 @@ -1913,7 +1919,7 @@ static void __t4_configure_t1(struct t4 *wc, int unit, int lineconfig, int txlev else mytxlevel = txlevel - 4; fmr1 = 0x9c; /* FMR1: Mode 1, T1 mode, CRC on for ESF, 8.192 Mhz system data rate, no XAIS */ - fmr2 = 0x22; /* FMR2: no payload loopback, auto send yellow alarm */ + fmr2 = 0x20; /* FMR2: no payload loopback, don't auto yellow */ if (loopback) fmr2 |= 0x4; fmr4 = 0x0c; /* FMR4: Lose sync on 2 out of 5 framing bits, auto resync */ @@ -2555,15 +2561,51 @@ static void t4_check_alarms(struct t4 *wc, int span) alarms |= DAHDI_ALARM_NOTOPEN; } - if (c & 0xa0) { - if (ts->alarmcount >= alarmdebounce) + if (c & 0x20) { /* LOF/LFA */ + if (ts->alarmcount >= alarmdebounce) alarms |= DAHDI_ALARM_RED; - else + else { + if (unlikely(debug && !ts->alarmcount)) { + /* starting to debounce LOF/LFA */ + printk(KERN_INFO "wct%dxxp: LOF/LFA detected " + "on span %d but debouncing for %d ms\n", + wc->numspans, span + 1, alarmdebounce); + } ts->alarmcount++; + } } else ts->alarmcount = 0; - if (c & 0x4) - alarms |= DAHDI_ALARM_BLUE; + + if (c & 0x80) { /* LOS */ + if (ts->losalarmcount >= losalarmdebounce) + alarms |= DAHDI_ALARM_RED; + else { + if (unlikely(debug && !ts->losalarmcount)) { + /* starting to debounce LOS */ + printk(KERN_INFO "wct%dxxp: LOS detected on " + "span %d but debouncing for %d ms\n", + wc->numspans, span + 1, losalarmdebounce); + } + ts->losalarmcount++; + } + } else + ts->losalarmcount = 0; + + if (c & 0x40) { /* AIS */ + if (ts->aisalarmcount >= aisalarmdebounce) + alarms |= DAHDI_ALARM_BLUE; + else { + if (unlikely(debug && !ts->aisalarmcount)) { + /* starting to debounce AIS */ + printk(KERN_INFO "wct%dxxp: AIS detected on " + "span %d but debouncing for %d ms\n", + wc->numspans, span + 1, aisalarmdebounce); + } + ts->aisalarmcount++; + } + } else + ts->aisalarmcount = 0; + if (((!ts->span.alarms) && alarms) || (ts->span.alarms && (!alarms))) @@ -2579,7 +2621,8 @@ static void t4_check_alarms(struct t4 *wc, int span) if (alarms && !(ts->spanflags & FLAG_SENDINGYELLOW)) { unsigned char fmr4; #if 1 - printk(KERN_INFO "wct%dxxp: Setting yellow alarm on span %d\n", wc->numspans, span + 1); + printk(KERN_INFO "wct%dxxp: Setting yellow alarm on span %d\n", + wc->numspans, span + 1); #endif /* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */ fmr4 = __t4_framer_in(wc, span, 0x20); @@ -2588,7 +2631,8 @@ static void t4_check_alarms(struct t4 *wc, int span) } else if ((!alarms) && (ts->spanflags & FLAG_SENDINGYELLOW)) { unsigned char fmr4; #if 1 - printk(KERN_INFO "wct%dxxp: Clearing yellow alarm on span %d\n", wc->numspans, span + 1); + printk(KERN_INFO "wct%dxxp: Clearing yellow alarm on span %d\n", + wc->numspans, span + 1); #endif /* We manually do yellow alarm to handle RECOVER */ fmr4 = __t4_framer_in(wc, span, 0x20); @@ -2598,8 +2642,23 @@ static void t4_check_alarms(struct t4 *wc, int span) /* Re-check the timing source when we enter/leave alarm, not withstanding yellow alarm */ - if (c & 0x10) - alarms |= DAHDI_ALARM_YELLOW; + if (c & 0x10) { /* receiving yellow (RAI) */ + if (ts->yelalarmcount >= yelalarmdebounce) + alarms |= DAHDI_ALARM_YELLOW; + else { + if (unlikely(debug && !ts->yelalarmcount)) { + /* starting to debounce AIS */ + printk(KERN_INFO "wct%dxxp: yelllow (RAI) " + "detected on span %d but debouncing " + "for %d ms\n", + wc->numspans, span + 1, + yelalarmdebounce); + } + ts->yelalarmcount++; + } + } else + ts->yelalarmcount = 0; + if (ts->span.mainttimer || ts->span.maintstat) alarms |= DAHDI_ALARM_LOOPBACK; ts->span.alarms = alarms; @@ -2615,8 +2674,11 @@ static void t4_do_counters(struct t4 *wc) int docheck=0; spin_lock(&wc->reglock); - if (ts->loopupcnt || ts->loopdowncnt) + if (ts->loopupcnt || ts->loopdowncnt || ts->alarmcount + || ts->losalarmcount || ts->aisalarmcount + || ts->yelalarmcount) docheck++; + if (ts->alarmtimer) { if (!--ts->alarmtimer) { docheck++; @@ -2639,7 +2701,7 @@ static inline void __handle_leds(struct t4 *wc) for (x=0;x<wc->numspans;x++) { struct t4_span *ts = wc->tspans[x]; if (ts->span.flags & DAHDI_FLAG_RUNNING) { - if (ts->span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE)) { + if ((ts->span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE)) || ts->losalarmcount) { #ifdef FANCY_ALARM if (wc->blinktimer == (altab[wc->alarmpos] >> 1)) { __t4_set_led(wc, x, WC_RED); @@ -3814,6 +3876,7 @@ static void __devexit t4_remove_one(struct pci_dev *pdev) { struct t4 *wc = pci_get_drvdata(pdev); struct dahdi_span *span; + int basesize; int i; if (!wc) { @@ -3829,6 +3892,10 @@ static void __devexit t4_remove_one(struct pci_dev *pdev) wc->vpm450m = NULL; /* Unregister spans */ + basesize = DAHDI_MAX_CHUNKSIZE * 32 * 4; + if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN)) + basesize = basesize * 2; + for (i = 0; i < wc->numspans; ++i) { span = &wc->tspans[i]->span; if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) @@ -3849,7 +3916,9 @@ static void __devexit t4_remove_one(struct pci_dev *pdev) pci_release_regions(pdev); /* Immediately free resources */ - pci_free_consistent(pdev, DAHDI_MAX_CHUNKSIZE * 2 * 2 * 32 * 4, (void *)wc->writechunk, wc->writedma); + + pci_free_consistent(pdev, basesize * 2, + (void *)wc->writechunk, wc->writedma); order_index[wc->order]--; @@ -3931,6 +4000,9 @@ module_param(noburst, int, 0600); module_param(timingcable, int, 0600); module_param(t1e1override, int, 0600); module_param(alarmdebounce, int, 0600); +module_param(losalarmdebounce, int, 0600); +module_param(aisalarmdebounce, int, 0600); +module_param(yelalarmdebounce, int, 0600); module_param(j1mode, int, 0600); module_param(sigmode, int, 0600); #ifdef VPM_SUPPORT |