[Asterisk-cvs] zaptel wct4xxp.c,1.42,1.43

citats at lists.digium.com citats at lists.digium.com
Sun Apr 25 19:53:36 CDT 2004


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

Modified Files:
	wct4xxp.c 
Log Message:
Set timing source so zttool sees it correctly.  Allow a span to be used for timing if in NOTOPEN state.  Remove some now out of place comments


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- wct4xxp.c	24 Apr 2004 18:59:30 -0000	1.42
+++ wct4xxp.c	25 Apr 2004 23:59:25 -0000	1.43
@@ -637,16 +637,28 @@
 {
 	unsigned int timing;
 	int x;
-	timing = 0x34;		/* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */
-	if ((unit > -1) && (unit < 4)) {
-		timing |= (unit << 6);
-		for (x=0;x<4;x++)  /* set all 4 receive reference clocks to unit */
-			__t4_framer_out(wc, x, 0x44, timing);
-		__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+	if (unit != wc->syncsrc) {
+		timing = 0x34;		/* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */
+		if ((unit > -1) && (unit < 4)) {
+			timing |= (unit << 6);
+			for (x=0;x<4;x++)  /* set all 4 receive reference clocks to unit */
+				__t4_framer_out(wc, x, 0x44, timing);
+			__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+		} else {
+			for (x=0;x<4;x++) /* set each receive reference clock to itself */
+				__t4_framer_out(wc, x, 0x44, timing | (x << 6));
+			__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+		}
+		wc->syncsrc = unit;
+		if ((unit < 0) || (unit > 3))
+			unit = 0;
+		else
+			unit++;
+		for (x=0;x<4;x++)
+			wc->spans[x].syncsrc = unit;
 	} else {
-		for (x=0;x<4;x++) /* set each receive reference clock to itself */
-			__t4_framer_out(wc, x, 0x44, timing | (x << 6));
-		__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+		if (debug)
+			printk("TE410P: Timing source already set to %d\n", unit);
 	}
 #if	0
 	printk("wct4xxp: Timing source set to %d\n",unit);
@@ -660,7 +672,7 @@
 	for (x=0;x<4;x++) {
 		if (wc->syncs[x]) {
 			if ((wc->spans[wc->syncs[x] - 1].flags & ZT_FLAG_RUNNING) && 
-				!(wc->spans[wc->syncs[x] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN) )) {
+				!(wc->spans[wc->syncs[x] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE) )) {
 					/* Valid timing sourc e*/
 					__t4_set_timing_source(wc, wc->syncs[x] - 1);
 					return;
@@ -1455,10 +1467,6 @@
 		zt_unregister(&wc->spans[2]);
 		return -1;
 	}
-	if (debug)
-		printk("Setting timing source\n");
-	if (debug)
-		printk("Timing source selected\n");
 	wc->checktiming = 1;
 	spin_lock_irqsave(&wc->reglock, flags);
 	__t4_set_timing_source(wc,4);




More information about the svn-commits mailing list