[Asterisk-cvs] zaptel wct4xxp.c,1.6,1.7

markster at lists.digium.com markster at lists.digium.com
Thu Sep 25 01:06:18 CDT 2003


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv28542

Modified Files:
	wct4xxp.c 
Log Message:
Work around slightly buggy framer when dealing with LMFA while FA is good


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- wct4xxp.c	2 Sep 2003 22:23:37 -0000	1.6
+++ wct4xxp.c	25 Sep 2003 06:07:28 -0000	1.7
@@ -68,6 +68,7 @@
 #define MAX_SPANS 16
 
 #define FLAG_STARTED (1 << 0)
+#define FLAG_NMF (1 << 1)
 
 #define	TYPE_T1	1		/* is a T1 card */
 #define	TYPE_E1	2		/* is an E1 card */
@@ -94,6 +95,7 @@
 	int irq;			/* IRQ used by device */
 	int order;			/* Order */
 	int flags;			/* Device flags */
+	int spanflags[4];		/* Span flags */
 	int syncpos[4];			/* span-relative sync sources */
 	int master;				/* Are we master */
 	int ledreg;				/* LED Register */
@@ -687,11 +689,11 @@
 	unsigned int fmr2, fmr1, fmr0;
 	char *crc4 = "";
 	char *framing, *line;
-	fmr1 = 0x4c; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */
+	fmr1 = 0x44; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */
 	fmr2 = 0x03 /* | 0x4 */; /* FMR2: Auto transmit remote alarm, auto loss of multiframe recovery, no payload loopback */
 	if (lineconfig & ZT_CONFIG_CRC4) {
 		fmr1 |= 0x08;	/* CRC4 transmit */
-		fmr2 |= 0x80;	/* CRC4 receive */
+		fmr2 |= 0xc0;	/* CRC4 receive */
 		crc4 = "/CRC4";
 	}
 	__t4_framer_out(wc, unit, 0x1d, fmr1);
@@ -741,8 +743,8 @@
 	
 	
 	/* Generate pulse mask for E1 */
-	__t4_framer_out(wc, unit, 0x26, 0x9c);	/* XPM0 */
-	__t4_framer_out(wc, unit, 0x27, 0x03);	/* XPM1 */
+	__t4_framer_out(wc, unit, 0x26, 0x54);	/* XPM0 */
+	__t4_framer_out(wc, unit, 0x27, 0x02);	/* XPM1 */
 	__t4_framer_out(wc, unit, 0x28, 0x00);	/* XPM2 */
 	printk("TE410P: Span %d configured for %s/%s%s\n", unit + 1, framing, line, crc4);
 }
@@ -1083,7 +1085,25 @@
 	wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN);
 
 	if (wc->spantype[span] == TYPE_E1) {
-		/* XXX Implement me XXX */
+		if (c & 0x04) {
+			/* No multiframe found, force RAI high after 400ms only if
+			   we haven't found a multiframe since last loss
+			   of frame */
+			if (!(wc->spanflags[span] & FLAG_NMF)) {
+				__t4_framer_out(wc, span, 0x20, 0x9f | 0x20);	/* LIM0: Force RAI High */
+				wc->spanflags[span] |= FLAG_NMF;
+				printk("NMF workaround on!\n");
+			}
+			__t4_framer_out(wc, span, 0x1e, 0xc3);	/* Reset to CRC4 mode */
+			__t4_framer_out(wc, span, 0x1c, 0xf2);	/* Force Resync */
+			__t4_framer_out(wc, span, 0x1c, 0xf0);	/* Force Resync */
+		} else if (!(c & 0x02)) {
+			if ((wc->spanflags[span] & FLAG_NMF)) {
+				__t4_framer_out(wc, span, 0x20, 0x9f);	/* LIM0: Clear forced RAI */
+				wc->spanflags[span] &= ~FLAG_NMF;
+				printk("NMF workaround off!\n");
+			}
+		}
 	} else {
 		/* Detect loopup code if we're not sending one */
 		if ((!wc->spans[span].mainttimer) && (d & 0x08)) {




More information about the svn-commits mailing list