summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fredrickson <creslin@digium.com>2011-01-27 21:09:15 +0000
committerMatthew Fredrickson <creslin@digium.com>2011-01-27 21:09:15 +0000
commit209cb0aec86c440cf5681e0d286e78ae40e2336b (patch)
treeb53b51f607093aa88fc91888b8c56d3de9a3b163
parent986658442796ad92c678c5fcb282fee8c74068d1 (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/branches/2.4@9702 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wcb4xxp/base.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c
index bc7e09d..7f46337 100644
--- a/drivers/dahdi/wcb4xxp/base.c
+++ b/drivers/dahdi/wcb4xxp/base.c
@@ -1149,8 +1149,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->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->dev, "chosen\n");
src = psrc;
break;
}
@@ -1322,12 +1326,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->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->dev,
+ "span %d: alarm %d "
+ "debounced\n",
+ i + 1, s->newalarm);
}
}
}
@@ -1422,7 +1430,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->dev, "new card sync source: port %d\n", newsync + 1);
b4->syncspan = newsync;
}
@@ -2235,7 +2243,7 @@ static int b4xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc
struct b4xxp *b4 = bspan->parent;
if (DBG)
- dev_info(b4->dev, "Configuring span %d\n", span->spanno);
+ dev_info(b4->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) {
@@ -2251,7 +2259,7 @@ 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;
}
}
@@ -2259,7 +2267,7 @@ static int b4xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc
/* if a sync src, put it in proper place */
b4->spans[span->offset].syncpos = lc->sync;
if (lc->sync) {
- b4->spans[lc->sync - 1].sync = span->spanno;
+ b4->spans[lc->sync - 1].sync = (span->offset + 1);
}
b4xxp_reset_span(bspan);