[svn-commits] mspiceland: linux/trunk r7486 - in /linux/trunk/drivers/dahdi: wct4xxp/ wcte1...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 4 17:25:36 CST 2009
Author: mspiceland
Date: Wed Nov 4 17:25:32 2009
New Revision: 7486
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7486
Log:
Adding alarm debounce to single span driver (wcte12xp).
Debounce yellow alarm also.
In wcte12xp, change check alarm frequency to 100ms for better debounce
granularity.
Fix lines over 80 cols from last alarm debounce commit.
Modified:
linux/trunk/drivers/dahdi/wct4xxp/base.c
linux/trunk/drivers/dahdi/wcte12xp/base.c
linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h
Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7486&r1=7485&r2=7486
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Wed Nov 4 17:25:32 2009
@@ -167,9 +167,10 @@
static int j1mode = 0;
static int sigmode = FRMR_MODE_NO_ADDR_CMP;
static int loopback = 0;
-static int alarmdebounce = 2500; /* LOF/LFA defaults to 2.5s AT&T TR54016*/
-static int losalarmdebounce = 2500;/* LOS defaults to 2.5s AT&T TR54016*/
-static int aisalarmdebounce = 2500;/* AIS(blue) defaults to 2.5s AT&T TR54016*/
+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 */
@@ -254,6 +255,7 @@
int alarmcount;
int losalarmcount;
int aisalarmcount;
+ int yelalarmcount;
int spanflags;
int syncpos;
#ifdef SUPPORT_GEN1
@@ -2561,7 +2563,8 @@
alarms |= DAHDI_ALARM_RED;
else {
if (!ts->alarmcount) /* starting to debounce LOF/LFA */
- printk(KERN_INFO "wct%dxxp: LOF/LFA detected on span %d but debouncing for %d ms\n",
+ printk(KERN_INFO "wct%dxxp: LOF/LFA detected \
+ on span %d but debouncing for %d ms\n",
wc->numspans, span + 1, alarmdebounce);
ts->alarmcount++;
}
@@ -2573,7 +2576,8 @@
alarms |= DAHDI_ALARM_RED;
else {
if (!ts->losalarmcount) /* starting to debounce LOS */
- printk(KERN_INFO "wct%dxxp: LOS detected on span %d but debouncing for %d ms\n",
+ printk(KERN_INFO "wct%dxxp: LOS detected on \
+ span %d but debouncing for %d ms\n",
wc->numspans, span + 1, losalarmdebounce);
ts->losalarmcount++;
}
@@ -2585,12 +2589,14 @@
alarms |= DAHDI_ALARM_BLUE;
else {
if (!ts->aisalarmcount) /* starting to debounce AIS */
- printk(KERN_INFO "wct%dxxp: AIS detected on span %d but debouncing for %d ms\n",
+ 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)))
@@ -2606,7 +2612,8 @@
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);
@@ -2615,7 +2622,8 @@
} 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);
@@ -2625,8 +2633,21 @@
/* 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 (!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;
@@ -2642,8 +2663,9 @@
int docheck=0;
spin_lock(&wc->reglock);
- if (ts->loopupcnt || ts->loopdowncnt || ts->alarmcount
- || ts->losalarmcount || ts->aisalarmcount)
+ if (ts->loopupcnt || ts->loopdowncnt || ts->alarmcount
+ || ts->losalarmcount || ts->aisalarmcount
+ || ts->yelalarmcount)
docheck++;
if (ts->alarmtimer) {
@@ -3969,6 +3991,7 @@
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
Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7486&r1=7485&r2=7486
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Wed Nov 4 17:25:32 2009
@@ -53,7 +53,10 @@
int debug = 0;
static int j1mode = 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 */
static int loopback = 0;
static int t1e1override = -1;
static int unchannelized = 0;
@@ -712,7 +715,7 @@
else
mytxlevel = txlevel - 4;
fmr1 = 0x9e; /* FMR1: Mode 0, T1 mode, CRC on for ESF, 2.048 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 alarm */
if (loopback)
fmr2 |= 0x4;
@@ -1469,7 +1472,7 @@
if (!j)
alarms |= DAHDI_ALARM_NOTOPEN;
}
-
+#if 0
if (c & 0xa0) {
if (wc->alarmcount >= alarmdebounce) {
if (!unchannelized)
@@ -1480,6 +1483,43 @@
wc->alarmcount = 0;
if (c & 0x4)
alarms |= DAHDI_ALARM_BLUE;
+#endif
+
+ if (c & 0x20) { /* LOF/LFA */
+ if (wc->alarmcount >= (alarmdebounce/100))
+ alarms |= DAHDI_ALARM_RED;
+ else {
+ if (!wc->alarmcount) /* starting to debounce LOF/LFA */
+ module_printk("LOF/LFA detected but \
+ debouncing for %d ms\n", alarmdebounce);
+ wc->alarmcount++;
+ }
+ } else
+ wc->alarmcount = 0;
+
+ if (c & 0x80) { /* LOS */
+ if (wc->losalarmcount >= (losalarmdebounce/100))
+ alarms |= DAHDI_ALARM_RED;
+ else {
+ if (!wc->losalarmcount) /* starting to debounce LOS */
+ module_printk("LOS detected but debouncing \
+ for %d ms\n", losalarmdebounce);
+ wc->losalarmcount++;
+ }
+ } else
+ wc->losalarmcount = 0;
+
+ if (c & 0x40) { /* AIS */
+ if (wc->aisalarmcount >= (aisalarmdebounce/100))
+ alarms |= DAHDI_ALARM_BLUE;
+ else {
+ if (!wc->aisalarmcount) /* starting to debounce AIS */
+ module_printk("AIS detected but debouncing \
+ for %d ms\n", aisalarmdebounce);
+ wc->aisalarmcount++;
+ }
+ } else
+ wc->aisalarmcount = 0;
/* Keep track of recovering */
if ((!alarms) && wc->span.alarms)
@@ -1500,9 +1540,24 @@
t1_setreg(wc, 0x20, fmr4 & ~0x20);
wc->flags.sendingyellow = 0;
}
-
+ /*
if ((c & 0x10) && !unchannelized)
alarms |= DAHDI_ALARM_YELLOW;
+ */
+
+ if ((c & 0x10) && !unchannelized) { /* receiving yellow (RAI) */
+ if (wc->yelalarmcount >= (yelalarmdebounce/100))
+ alarms |= DAHDI_ALARM_YELLOW;
+ else {
+ if (!wc->yelalarmcount) /* starting to debounce AIS */
+ module_printk("yelllow (RAI) detected but \
+ debouncing for %d ms\n",
+ yelalarmdebounce);
+ wc->yelalarmcount++;
+ }
+ } else
+ wc->yelalarmcount = 0;
+
if (wc->span.mainttimer || wc->span.maintstat)
alarms |= DAHDI_ALARM_LOOPBACK;
wc->span.alarms = alarms;
@@ -1668,13 +1723,13 @@
{
struct t1 *wc = container_of(work, struct t1, timer_work);
#endif
- /* Called once every 200 ms */
+ /* Called once every 100 ms */
if (unlikely(!test_bit(INITIALIZED, &wc->bit_flags)))
return;
t1_do_counters(wc);
t1_check_alarms(wc);
t1_check_sigbits(wc);
- mod_timer(&wc->timer, jiffies + HZ/5);
+ mod_timer(&wc->timer, jiffies + HZ/10);
}
static void
@@ -1885,6 +1940,9 @@
module_param(t1e1override, int, S_IRUGO | S_IWUSR);
module_param(j1mode, int, S_IRUGO | S_IWUSR);
module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
+module_param(losalarmdebounce, int, S_IRUGO | S_IWUSR);
+module_param(aisalarmdebounce, int, S_IRUGO | S_IWUSR);
+module_param(yelalarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(latency, int, S_IRUGO | S_IWUSR);
#ifdef VPM_SUPPORT
module_param(vpmsupport, int, S_IRUGO | S_IWUSR);
Modified: linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=7486&r1=7485&r2=7486
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/wcte12xp.h Wed Nov 4 17:25:32 2009
@@ -105,6 +105,9 @@
} flags;
unsigned char txsigs[16]; /* Copy of tx sig registers */
int alarmcount; /* How much red alarm we've seen */
+ int losalarmcount;
+ int aisalarmcount;
+ int yelalarmcount;
char *variety;
char name[80];
unsigned long blinktimer;
More information about the svn-commits
mailing list