summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcb4xxp
diff options
context:
space:
mode:
authorMatthew Fredrickson <creslin@digium.com>2011-01-27 20:58:40 +0000
committerMatthew Fredrickson <creslin@digium.com>2011-01-27 20:58:40 +0000
commitcb9ca13edc842637833463569d37a13c22a931d4 (patch)
tree13cad85d83e406fbbbbf4f3f3d1ca5216b179995 /drivers/dahdi/wcb4xxp
parent43210053704cffff896da806072010d902d02c48 (diff)
Fix for bugs in timing selection when B410P card is not the first configured card in system.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9701 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcb4xxp')
-rw-r--r--drivers/dahdi/wcb4xxp/base.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c
index 70ea418..ebe93b2 100644
--- a/drivers/dahdi/wcb4xxp/base.c
+++ b/drivers/dahdi/wcb4xxp/base.c
@@ -1185,8 +1185,12 @@ static int b4xxp_find_sync(struct b4xxp *b4)
src = -1; /* default to automatic */
for (i=0; i < b4->numspans; i++) {
+ if (DBG)
+ dev_info(&b4->pdev->dev, "Checking sync pos %d, have span %d\n", i, b4->spans[i].sync);
psrc = b4->spans[i].sync;
if (psrc > 0 && !b4->spans[psrc - 1].span.alarms) {
+ if (DBG)
+ dev_info(&b4->pdev->dev, "chosen\n");
src = psrc;
break;
}
@@ -1368,16 +1372,16 @@ static void hfc_update_st_timers(struct b4xxp *b4)
}
if (s->newalarm != s->span.alarms && time_after_eq(b4->ticks, s->alarmtimer)) {
- if (!s->te_mode || !teignorered) {
- s->span.alarms = s->newalarm;
+ s->span.alarms = s->newalarm;
+ if ((!s->newalarm && teignorered) || (!teignorered)) {
dahdi_alarm_notify(&s->span);
- if (DBG_ALARM) {
- dev_info(&b4->pdev->dev,
- "span %d: alarm %d "
- "debounced\n",
- i + 1, s->newalarm);
- }
- b4xxp_set_sync_src(b4, b4xxp_find_sync(b4));
+ }
+ b4xxp_set_sync_src(b4, b4xxp_find_sync(b4));
+ if (DBG_ALARM) {
+ dev_info(&b4->pdev->dev,
+ "span %d: alarm %d "
+ "debounced\n",
+ i + 1, s->newalarm);
}
}
}
@@ -1476,7 +1480,7 @@ static void hfc_handle_state(struct b4xxp_span *s)
/* read in R_BERT_STA to determine where our current sync source is */
newsync = b4xxp_getreg8(b4, R_BERT_STA) & 0x07;
if (newsync != b4->syncspan) {
- if (printk_ratelimit()) {
+ if (printk_ratelimit() || DBG) {
dev_info(&b4->pdev->dev,
"new card sync source: port %d\n",
newsync + 1);
@@ -2315,7 +2319,7 @@ static int b4xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc
struct b4xxp *b4 = bspan->parent;
if (DBG)
- dev_info(&b4->pdev->dev, "Configuring span %d\n", span->spanno);
+ dev_info(&b4->pdev->dev, "Configuring span %d offset %d to be sync %d\n", span->spanno, span->offset, lc->sync);
#if 0
if (lc->sync > 0 && !bspan->te_mode) {
@@ -2334,13 +2338,13 @@ static int b4xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc
/* remove this span number from the current sync sources, if there */
for (i = 0; i < b4->numspans; i++) {
- if (b4->spans[i].sync == span->spanno) {
+ if (b4->spans[i].sync == (span->offset + 1)) {
b4->spans[i].sync = 0;
}
}
if (lc->sync)
- b4->spans[lc->sync - 1].sync = span->spanno;
+ b4->spans[lc->sync - 1].sync = (span->offset + 1);
b4xxp_reset_span(bspan);