diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-02-22 07:52:51 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2015-09-22 16:41:27 +0200 |
commit | 889890da4312916bd617b3c95326a89237078a3b (patch) | |
tree | a767ad6e8d80629f415e74f1ce000dec7956e655 | |
parent | 23a5183767d96a723190634f4a26d018492880bf (diff) |
TRX: Improved handling of clock indications.
If no clock is received, a POWEROFF is sent until clock is detected.
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 3 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler.c | 21 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 5 |
3 files changed, 21 insertions, 8 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 58c2587b..3f297d6a 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -212,6 +212,7 @@ int l1if_provision_tranceiver(struct gsm_bts *bts) { struct gsm_bts_trx *trx; struct trx_l1h *l1h; + uint8_t tn; llist_for_each_entry(trx, &bts->trx_list, list) { l1h = trx_l1h_hdl(trx); @@ -222,6 +223,8 @@ int l1if_provision_tranceiver(struct gsm_bts *bts) l1h->config.rxgain_sent = 0; l1h->config.power_sent = 0; l1h->config.maxdly_sent = 0; + for (tn = 0; tn < 8; tn++) + l1h->config.slottype_sent[tn] = 0; l1if_provision_tranceiver_trx(l1h); } return 0; diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c index b5fe08f2..057d5c2e 100644 --- a/src/osmo-bts-trx/scheduler.c +++ b/src/osmo-bts-trx/scheduler.c @@ -2252,6 +2252,8 @@ no_clock: llist_for_each_entry(trx, &bts->trx_list, list) { trx_if_flush(trx_l1h_hdl(trx)); trx_sched_reset(trx_l1h_hdl(trx)); + if (trx->nr == 0) + trx_if_cmd_poweroff(trx_l1h_hdl(trx)); } /* tell BSC */ @@ -2295,6 +2297,9 @@ int trx_sched_clock(uint32_t fn) int32_t elapsed; int32_t elapsed_fn; + if (quit) + return 0; + /* reset lost counter */ tranceiver_lost = 0; @@ -2304,13 +2309,21 @@ int trx_sched_clock(uint32_t fn) if (!tranceiver_available) { LOGP(DL1C, LOGL_NOTICE, "initial GSM clock received: fn=%u\n", fn); + + tranceiver_available = 1; + + /* start provisioning tranceiver */ + l1if_provision_tranceiver(bts); + + /* tell BSC */ + check_tranceiver_availability(bts, 1); + new_clock: tranceiver_last_fn = fn; trx_sched_fn(tranceiver_last_fn); /* schedule first FN clock */ memcpy(tv_clock, &tv_now, sizeof(struct timeval)); - tranceiver_available = 1; memset(&tranceiver_clock_timer, 0, sizeof(tranceiver_clock_timer)); tranceiver_clock_timer.cb = trx_ctrl_timer_cb; @@ -2318,12 +2331,6 @@ new_clock: osmo_timer_schedule(&tranceiver_clock_timer, 0, FRAME_DURATION_uS); - /* start provisioning tranceiver */ - l1if_provision_tranceiver(bts); - - /* tell BSC */ - check_tranceiver_availability(bts, 1); - return 0; } diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index c03427a0..6420fdb4 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -183,7 +183,7 @@ static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd, va_list ap; int l, pending = 0; - if (!tranceiver_available) { + if (!tranceiver_available && !!strcmp(cmd, "POWEROFF")) { LOGP(DTRX, LOGL_ERROR, "CTRL ignored: No clock from " "tranceiver, please fix!\n"); return -EIO; @@ -474,6 +474,9 @@ int trx_if_open(struct trx_l1h *l1h) /* enable all slots */ l1h->config.slotmask = 0xff; + if (l1h->trx->nr == 0) + trx_if_cmd_poweroff(l1h); + return 0; err: |