[Asterisk-cvs] zaptel wct4xxp.c,1.37,1.38

citats at lists.digium.com citats at lists.digium.com
Sat Apr 10 02:59:02 CDT 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/home/citats/cvs/zaptel

Modified Files:
	wct4xxp.c 
Log Message:
Hopefully get Yellow alarm working properly on wct4xxp


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- wct4xxp.c	10 Apr 2004 03:35:16 -0000	1.37
+++ wct4xxp.c	10 Apr 2004 07:00:25 -0000	1.38
@@ -70,6 +70,7 @@
 
 #define FLAG_STARTED (1 << 0)
 #define FLAG_NMF (1 << 1)
+#define FLAG_SENDINGYELLOW (1 << 2)
 
 #define	TYPE_T1	1		/* is a T1 card */
 #define	TYPE_E1	2		/* is an E1 card */
@@ -1184,14 +1185,6 @@
 	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]);
@@ -1218,7 +1211,7 @@
 	oldalarms = wc->spans[span].alarms;
 
 	/* And consider only carrier alarms */
-	wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_RECOVER | ZT_ALARM_NOTOPEN);
+	wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN);
 
 	if (wc->spantype[span] == TYPE_E1) {
 		if (c & 0x04) {
@@ -1281,18 +1274,26 @@
 		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 (alarms && !(wc->spanflags[span] & FLAG_SENDINGYELLOW)) {
 		unsigned char fmr4;
 #if 1
 		printk("wct4xxp: Setting yellow alarm on span %d\n", 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);
 		__t4_framer_out(wc, span, 0x20, fmr4 | 0x20);
+		wc->spanflags[span] |= FLAG_SENDINGYELLOW;
+	} else if (!alarms && wc->spanflags[span] & FLAG_SENDINGYELLOW) {
+		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->spanflags[span] &= ~FLAG_SENDINGYELLOW;
 	}
 
 #if 0




More information about the svn-commits mailing list