summaryrefslogtreecommitdiff
path: root/wct4xxp.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-03-18 17:40:58 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-03-18 17:40:58 +0000
commitff716f29298df0a0e69c44402fb1f3b57a3eaede (patch)
tree2efa2a5a2da100b237d41d4f93431c16c2653c4e /wct4xxp.c
parent7d139bdee1cc6cac40ca9fe0601a8368b5c32b8c (diff)
Pull timing from other spans if appropriate...
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@325 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp.c')
-rwxr-xr-xwct4xxp.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/wct4xxp.c b/wct4xxp.c
index af35bef..62d3304 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -481,6 +481,10 @@ static int t4_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
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 @@ static void t4_set_timing_source(struct t4 *wc, int unit)
}
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 @@ static int __devinit t4_launch(struct t4 *wc)
}
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