[Asterisk-cvs] zaptel wct4xxp.c,1.24,1.25

markster at lists.digium.com markster at lists.digium.com
Fri Apr 2 11:59:08 CST 2004


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

Modified Files:
	wct4xxp.c 
Log Message:
Various timing fixes...


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- wct4xxp.c	2 Apr 2004 07:04:29 -0000	1.24
+++ wct4xxp.c	2 Apr 2004 16:58:23 -0000	1.25
@@ -637,28 +637,32 @@
 	int x;
 	timing = 0x34;		/* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */
 	spin_lock_irqsave(&synclock, flags);
-	if ((unit > -1) && (unit < 4)) {
-		timing |= (unit << 6);
-	} else {
-		timing |= 0x1;	/* Use TCLK timing */
-	}
-	for (x=0;x<4;x++)
-		t4_framer_out(wc, x, 0x44, timing);
-	if ((unit > -1) && (unit < 4)) {
-		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
-		/* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from proper channel,  */
-		t4_framer_out(wc, 0, 0x85, 0xe0 | (unit << 2) | (unit));	
-	} else
-		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
 	if (unit != wc->syncsrc) {
+		if ((unit > -1) && (unit < 4)) {
+			timing |= (unit << 6);
+		} else {
+			timing |= 0x1;	/* Use TCLK timing */
+		}
+		for (x=0;x<4;x++)
+			t4_framer_out(wc, x, 0x44, timing);
+		if ((unit > -1) && (unit < 4)) {
+			t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+			/* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from proper channel,  */
+			t4_framer_out(wc, 0, 0x85, 0xe0 | (unit << 2) | (unit));	
+		} else
+			t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
 		if ((unit > -1) && (unit < 4))
 			printk("TE410P: Timing from source %d\n", unit);
 		else
 			printk("TE410P: Timing from internal timer\n");
-	}
-	wc->syncsrc = unit;
-	for (x=0;x<4;x++)
-		wc->spans[x].syncsrc = unit;
+		wc->syncsrc = unit;
+		if ((unit < 0) || (unit > 3))
+			unit = 0;
+		else
+			unit++;
+		for (x=0;x<4;x++) 
+			wc->spans[x].syncsrc = unit;
+	}		
 	spin_unlock_irqrestore(&synclock, flags);
 }
 
@@ -873,6 +877,7 @@
 	if (wc->syncs[1] == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno);
 	if (wc->syncs[2] == span->spanno) printk("SPAN %d: Tertiary Sync Source\n",span->spanno);
 	if (wc->syncs[3] == span->spanno) printk("SPAN %d: Quaternary Sync Source\n",span->spanno);
+	t4_set_timing_source_auto(wc);
 	return 0;
 }
 
@@ -1187,6 +1192,8 @@
 
 	/* Assume no alarms */
 	alarms = 0;
+	
+	oldalarms = wc->spans[span].alarms;
 
 	/* And consider only carrier alarms */
 	wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN);
@@ -1291,7 +1298,6 @@
 	if (wc->spans[span].mainttimer || wc->spans[span].maintstat) 
 		alarms |= ZT_ALARM_LOOPBACK;
 
-	oldalarms = wc->spans[span].alarms;
 	wc->spans[span].alarms = alarms;
 	/* Re-check the timing source when we enter alarm */
 	if (!oldalarms && alarms)




More information about the svn-commits mailing list