[zaptel-commits] trunk r980 - /trunk/wcte11xp.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Sun Mar 12 18:03:11 MST 2006


Author: markster
Date: Sun Mar 12 19:03:10 2006
New Revision: 980

URL: http://svn.digium.com/view/zaptel?rev=980&view=rev
Log:
Add support for unchannelized mode

Modified:
    trunk/wcte11xp.c

Modified: trunk/wcte11xp.c
URL: http://svn.digium.com/view/zaptel/trunk/wcte11xp.c?rev=980&r1=979&r2=980&view=diff
==============================================================================
--- trunk/wcte11xp.c (original)
+++ trunk/wcte11xp.c Sun Mar 12 19:03:10 2006
@@ -125,6 +125,17 @@
   27,26,25,24,
   31,30,29,28 };
 
+static int chanmap_e1uc[] =
+{ 3,2,1,0,
+  7,6,5,4,
+  11,10,9,8,
+  15,14,13,12,
+  19,18,17,16,
+  23,22,21,20,
+  27,26,25,24,
+  31,30,29,28 };
+
+
 #ifdef FANCY_ALARM
 static int altab[] = {
 0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24, 25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22, 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, 
@@ -168,11 +179,11 @@
 	dma_addr_t	writedma;
 	volatile unsigned char *writechunk;					/* Double-word aligned write memory */
 	volatile unsigned char *readchunk;					/* Double-word aligned read memory */
-	unsigned char ec_chunk1[31][ZT_CHUNKSIZE];
-	unsigned char ec_chunk2[31][ZT_CHUNKSIZE];
-	unsigned char tempo[32];
+	unsigned char ec_chunk1[32][ZT_CHUNKSIZE];
+	unsigned char ec_chunk2[32][ZT_CHUNKSIZE];
+	unsigned char tempo[33];
 	struct zt_span span;						/* Span */
-	struct zt_chan chans[31];					/* Channels */
+	struct zt_chan chans[32];					/* Channels */
 };
 
 #define CANARY 0xca1e
@@ -183,6 +194,7 @@
 static int loopback = 0;
 static int clockextra = 0;
 static int t1e1override = -1;
+static int unchannelized = 0;
 
 static struct t1 *cards[WC_MAX_CARDS];
 
@@ -614,7 +626,7 @@
 static void t4_serial_setup(struct t1 *wc)
 {
 	printk("TE110P: Setting up global serial parameters for %s %s\n", 
-	       wc->spantype == TYPE_E1 ? "E1" : "T1", 
+	       wc->spantype == TYPE_E1 ? (unchannelized ? "Unchannelized E1" : "E1") : "T1", 
 		   wc->spanflags & FLAG_FALC12 ? "FALC V1.2" : "FALC V2.1");
 	t1_framer_out(wc, 0x85, 0xe0);	/* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */
 	t1_framer_out(wc, 0x08, 0x05);	/* IPC: Interrupt push/pull active low */
@@ -780,6 +792,8 @@
 	char *framing, *line;
 	fmr1 = 0x44; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */
 	fmr2 = 0x03; /* FMR2: Auto transmit remote alarm, auto loss of multiframe recovery, no payload loopback */
+	if (unchannelized)
+		fmr2 |= 0x30;
 	if (loopback)
 		fmr2 |= 0x4;
 	if (lineconfig & ZT_CONFIG_CRC4) {
@@ -805,6 +819,9 @@
 		cas = 0x40;
 	}
 	__t1_framer_out(wc, 0x1c, fmr0);
+
+	if (unchannelized)
+		__t1_framer_out(wc, 0x1f, 0x40);
 
 	__t1_framer_out(wc, 0x37, 0xf0 /*| 0x6 */ );	/* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */
 	__t1_framer_out(wc, 0x36, 0x08);	/* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */
@@ -831,7 +848,10 @@
 	__t1_framer_out(wc, 0x39, 0x15);	/* PCR: 22 "ones" clear LOS */
 	
 	__t1_framer_out(wc, 0x20, 0x9f);	/* XSW: Spare bits all to 1 */
-	__t1_framer_out(wc, 0x21, 0x1c|cas);	/* XSP: E-bit set when async. AXS auto, XSIF to 1 */
+	if (unchannelized)
+		__t1_framer_out(wc, 0x21, 0x3c);
+	else
+		__t1_framer_out(wc, 0x21, 0x1c|cas);	/* XSP: E-bit set when async. AXS auto, XSIF to 1 */
 	
 	
 	/* Generate pulse mask for E1 */
@@ -958,9 +978,12 @@
 	wc->span.maint = t1xxp_maint;
 	wc->span.open = t1xxp_open;
 	wc->span.close = t1xxp_close;
-	if (wc->spantype == TYPE_E1)
-		wc->span.channels = 31;
-	else
+	if (wc->spantype == TYPE_E1) {
+		if (unchannelized)
+			wc->span.channels = 32;
+		else
+			wc->span.channels = 31;
+	} else
 		wc->span.channels = 24;
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
@@ -1113,7 +1136,7 @@
 					}
 				}
 			}
-		} else {
+		} else if (!unchannelized) {
 			if (!wc->clocktimeout && !wc->span.alarms) {
 				if ((rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)] & 0x7f) != 0x1b) {
 					if (wc->miss) {
@@ -1218,9 +1241,10 @@
 	}
 
 	if (c & 0xa0) {
-		if (wc->alarmcount >= alarmdebounce) 
-			alarms |= ZT_ALARM_RED;
-		else
+		if (wc->alarmcount >= alarmdebounce) {
+			if (!unchannelized)
+				alarms |= ZT_ALARM_RED;
+		} else
 			wc->alarmcount++;
 	} else
 		wc->alarmcount = 0;
@@ -1260,7 +1284,7 @@
 
 	/* Re-check the timing source when we enter/leave alarm, not withstanding
 	   yellow alarm */
-	if (c & 0x10)
+	if ((c & 0x10) && !unchannelized)
 		alarms |= ZT_ALARM_YELLOW;
 	if (wc->span.mainttimer || wc->span.maintstat) 
 		alarms |= ZT_ALARM_LOOPBACK;
@@ -1408,9 +1432,12 @@
 
 	control_set_reg(wc, WC_LEDTEST, 0x00);
 
-	if (wc->spantype == TYPE_E1)
-		wc->chanmap = chanmap_e1;
-	else
+	if (wc->spantype == TYPE_E1) {
+		if (unchannelized)
+			wc->chanmap = chanmap_e1uc;
+		else
+			wc->chanmap = chanmap_e1;
+	} else
 		wc->chanmap = chanmap_t1;
 	/* Setup clock appropriately */
 	control_set_reg(wc, WC_CLOCK, 0x06 | wc->sync | clockextra);
@@ -1580,6 +1607,7 @@
 module_param(alarmdebounce, int, 0600);
 module_param(loopback, int, 0600);
 module_param(t1e1override, int, 0600);
+module_param(unchannelized, int, 0600);
 module_param(clockextra, int, 0600);
 module_param(debug, int, 0600);
 module_param(j1mode, int, 0600);
@@ -1587,6 +1615,7 @@
 MODULE_PARM(alarmdebounce, "i");
 MODULE_PARM(loopback, "i");
 MODULE_PARM(t1e1override, "i");
+MODULE_PARM(unchannelized, "i");
 MODULE_PARM(clockextra, "i");
 MODULE_PARM(debug, "i");
 MODULE_PARM(j1mode, "i");



More information about the zaptel-commits mailing list