summaryrefslogtreecommitdiff
path: root/wct4xxp.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-02 16:58:23 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-02 16:58:23 +0000
commitc88e65b25113ec3ceea2ffea1c6cb482c3977b07 (patch)
tree4bd7434e5eb7b8ee13b7b59710070e58e281f98e /wct4xxp.c
parent590d28250541c43750e08e398805eb1641c2fe12 (diff)
Various timing fixes...
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@339 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp.c')
-rwxr-xr-xwct4xxp.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/wct4xxp.c b/wct4xxp.c
index 43190a0..c2d0fc7 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -637,28 +637,32 @@ static void t4_set_timing_source(struct t4 *wc, int unit)
int x;
timing = 0x34; /* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */
spin_lock_irqsave(&synclock, flags);
- if ((unit > -1) && (unit < 4)) {
- timing |= (unit << 6);
- } else {
- timing |= 0x1; /* Use TCLK timing */
- }
- for (x=0;x<4;x++)
- t4_framer_out(wc, x, 0x44, timing);
- if ((unit > -1) && (unit < 4)) {
- t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
- /* 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);
if (unit != wc->syncsrc) {
+ if ((unit > -1) && (unit < 4)) {
+ timing |= (unit << 6);
+ } else {
+ timing |= 0x1; /* Use TCLK timing */
+ }
+ for (x=0;x<4;x++)
+ t4_framer_out(wc, x, 0x44, timing);
+ if ((unit > -1) && (unit < 4)) {
+ t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+ /* 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);
if ((unit > -1) && (unit < 4))
printk("TE410P: Timing from source %d\n", unit);
else
printk("TE410P: Timing from internal timer\n");
- }
- wc->syncsrc = unit;
- for (x=0;x<4;x++)
- wc->spans[x].syncsrc = unit;
+ wc->syncsrc = unit;
+ if ((unit < 0) || (unit > 3))
+ unit = 0;
+ else
+ unit++;
+ for (x=0;x<4;x++)
+ wc->spans[x].syncsrc = unit;
+ }
spin_unlock_irqrestore(&synclock, flags);
}
@@ -873,6 +877,7 @@ static int t4_startup(struct zt_span *span)
if (wc->syncs[1] == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno);
if (wc->syncs[2] == span->spanno) printk("SPAN %d: Tertiary Sync Source\n",span->spanno);
if (wc->syncs[3] == span->spanno) printk("SPAN %d: Quaternary Sync Source\n",span->spanno);
+ t4_set_timing_source_auto(wc);
return 0;
}
@@ -1187,6 +1192,8 @@ static void __t4_check_alarms(struct t4 *wc, int span)
/* Assume no alarms */
alarms = 0;
+
+ oldalarms = wc->spans[span].alarms;
/* And consider only carrier alarms */
wc->spans[span].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN);
@@ -1291,7 +1298,6 @@ static void __t4_check_alarms(struct t4 *wc, int span)
if (wc->spans[span].mainttimer || wc->spans[span].maintstat)
alarms |= ZT_ALARM_LOOPBACK;
- oldalarms = wc->spans[span].alarms;
wc->spans[span].alarms = alarms;
/* Re-check the timing source when we enter alarm */
if (!oldalarms && alarms)