summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Spiceland <mspiceland@digium.com>2009-11-04 23:25:32 +0000
committerMike Spiceland <mspiceland@digium.com>2009-11-04 23:25:32 +0000
commitda85eeb01eba990ebb0fea4b761da3e27d4eb1f8 (patch)
tree70ad66aaab7fe3563f1367c7a377667b84c3d95d
parent98ab9f241cac15656747f9b39b228b38ca0068dd (diff)
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. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7486 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wct4xxp/base.c47
-rw-r--r--drivers/dahdi/wcte12xp/base.c70
-rw-r--r--drivers/dahdi/wcte12xp/wcte12xp.h3
3 files changed, 102 insertions, 18 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index 82c5d96..8bfc03f 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -167,9 +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 = 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 @@ struct t4_span {
int alarmcount;
int losalarmcount;
int aisalarmcount;
+ int yelalarmcount;
int spanflags;
int syncpos;
#ifdef SUPPORT_GEN1
@@ -2561,7 +2563,8 @@ static void t4_check_alarms(struct t4 *wc, int span)
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 @@ static void t4_check_alarms(struct t4 *wc, int span)
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,13 +2589,15 @@ static void t4_check_alarms(struct t4 *wc, int span)
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)))
set_bit(T4_CHECK_TIMING, &wc->checkflag);
@@ -2606,7 +2612,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);
@@ -2615,7 +2622,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);
@@ -2625,8 +2633,21 @@ 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 (!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 @@ static void t4_do_counters(struct t4 *wc)
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(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
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 0cd45ff..97345a2 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -53,7 +53,10 @@ struct pci_driver te12xp_driver;
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 @@ static void t1_configure_t1(struct t1 *wc, int lineconfig, int txlevel)
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 @@ static inline void t1_check_alarms(struct t1 *wc)
if (!j)
alarms |= DAHDI_ALARM_NOTOPEN;
}
-
+#if 0
if (c & 0xa0) {
if (wc->alarmcount >= alarmdebounce) {
if (!unchannelized)
@@ -1480,6 +1483,43 @@ static inline void t1_check_alarms(struct t1 *wc)
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 @@ static inline void t1_check_alarms(struct t1 *wc)
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 @@ static void timer_work_func(struct work_struct *work)
{
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(loopback, int, S_IRUGO | S_IWUSR);
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);
diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h
index 2679e8b..83f8268 100644
--- a/drivers/dahdi/wcte12xp/wcte12xp.h
+++ b/drivers/dahdi/wcte12xp/wcte12xp.h
@@ -105,6 +105,9 @@ struct t1 {
} 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;