[dahdi-commits] mspiceland: linux/trunk r7445 - /linux/trunk/drivers/dahdi/wct4xxp/base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Oct 29 16:37:48 CDT 2009


Author: mspiceland
Date: Thu Oct 29 16:37:45 2009
New Revision: 7445

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7445
Log:
Debounce alarms by default for wct4xxp per AT&T 54016.  Also, the
various alarm conditions can be debounced separately.

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/base.c

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=7445&r1=7444&r2=7445
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Thu Oct 29 16:37:45 2009
@@ -167,7 +167,9 @@
 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 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*/
 #ifdef VPM_SUPPORT
 static int vpmsupport = 1;
 /* If set to auto, vpmdtmfsupport is enabled for VPM400M and disabled for VPM450M */
@@ -250,6 +252,8 @@
 	int redalarms;
 	int notclear;
 	int alarmcount;
+	int losalarmcount;
+	int aisalarmcount;
 	int spanflags;
 	int syncpos;
 #ifdef SUPPORT_GEN1
@@ -1910,7 +1914,7 @@
 	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 */
@@ -2552,15 +2556,41 @@
 			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 (!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 (!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 (!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))) 
@@ -2612,7 +2642,8 @@
 		int docheck=0;
 
 		spin_lock(&wc->reglock);
-		if (ts->loopupcnt || ts->loopdowncnt || ts->alarmcount)
+		if (ts->loopupcnt || ts->loopdowncnt || ts->alarmcount 
+			|| ts->losalarmcount || ts->aisalarmcount)
 			docheck++;
 
 		if (ts->alarmtimer) {
@@ -2637,7 +2668,7 @@
 	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);
@@ -3936,6 +3967,8 @@
 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(j1mode, int, 0600);
 module_param(sigmode, int, 0600);
 #ifdef VPM_SUPPORT




More information about the dahdi-commits mailing list