[Asterisk-cvs] zaptel wct4xxp.c,1.18,1.19

markster at lists.digium.com markster at lists.digium.com
Thu Mar 18 12:45:57 CST 2004


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

Modified Files:
	wct4xxp.c 
Log Message:
Pull timing from other spans if appropriate...


Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- wct4xxp.c	10 Jan 2004 22:14:50 -0000	1.18
+++ wct4xxp.c	18 Mar 2004 17:40:58 -0000	1.19
@@ -481,6 +481,10 @@
 	span->txlevel = lc->lbo;
 	span->rxlevel = 0;
 	span->syncsrc = wc->syncsrc;
+	if (lc->sync < 0)
+		lc->sync = 0;
+	if (lc->sync > 4)
+		lc->sync = 0;
 	
 	/* remove this span number from the current sync sources, if there */
 	for(i = 0; i < 3; i++) {
@@ -634,13 +638,31 @@
 	}
 	for (x=0;x<4;x++)
 		t4_framer_out(wc, x, 0x44, timing);
-	if ((unit > -1) && (unit < 4))
+	if ((unit > -1) && (unit < 4)) {
 		t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
-	else
+		/* 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);
 	printk("TE410P: Timing from source %d\n", unit);
 }
 
+static void t4_set_timing_source_auto(struct t4 *wc)
+{
+	int qual, x;
+	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)) {
+					/* Valid timing sourc e*/
+					t4_set_timing_source(wc, wc->syncs[x] - 1);
+					return;
+			}
+		}
+	}
+	t4_set_timing_souce(wc, 4);
+}
+
 static void __t4_configure_t1(struct t4 *wc, int unit, int lineconfig, int txlevel)
 {
 	unsigned int fmr4, fmr2, fmr1, fmr0, lim2;
@@ -1508,7 +1530,7 @@
 	}
 	if (debug)
 		printk("Setting timing source\n");
-	t4_set_timing_source(wc, 0);
+	t4_set_timing_source_auto(wc);
 	if (debug)
 		printk("Timing source selected\n");
 #ifdef ENABLE_TASKLETS




More information about the svn-commits mailing list