summaryrefslogtreecommitdiff
path: root/wcte11xp.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-03-13 01:03:10 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-03-13 01:03:10 +0000
commit3b141dc735eb29edd3734dd1c4cbc97419cdda67 (patch)
treeaf5006ec598ba3d63876d8401f30a2d16363eaff /wcte11xp.c
parent607abfbfbbef40b648320d88539607922f0de628 (diff)
Add support for unchannelized mode
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@980 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcte11xp.c')
-rw-r--r--wcte11xp.c63
1 files changed, 46 insertions, 17 deletions
diff --git a/wcte11xp.c b/wcte11xp.c
index 320a984..d0f4034 100644
--- a/wcte11xp.c
+++ b/wcte11xp.c
@@ -125,6 +125,17 @@ static int chanmap_e1[] =
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 @@ struct t1 {
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 alarmdebounce = 0;
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 __t1_check_sigbits(struct t1 *wc)
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 @@ static void __t1_configure_e1(struct t1 *wc, int lineconfig)
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) {
@@ -806,6 +820,9 @@ static void __t1_configure_e1(struct t1 *wc, int lineconfig)
}
__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 @@ static void __t1_configure_e1(struct t1 *wc, int lineconfig)
__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 @@ static int t1xxp_software_init(struct t1 *wc)
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 @@ static void t1xxp_receiveprep(struct t1 *wc, int ints)
}
}
}
- } 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 @@ static void __t1_check_alarms(struct t1 *wc)
}
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 @@ static void __t1_check_alarms(struct t1 *wc)
/* 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 @@ static int t1xxp_hardware_init(struct t1 *wc)
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 @@ static void __exit t1xxp_cleanup(void)
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_param(j1mode, int, 0600);
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");