fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/41901?usp=email )
Change subject: trxcon/l1sched: add API for reading/updating UL SACCH cache ......................................................................
trxcon/l1sched: add API for reading/updating UL SACCH cache
Change-Id: Ica42dbc28cfdd7af2e1becdcc5d45337b70da8a7 Related: 15877ba05 ("trxcon: allow populating global SACCH cache via L1CTL") --- M src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h M src/host/trxcon/src/sched_prim.c M src/host/trxcon/src/sched_trx.c M src/host/trxcon/src/trxcon_fsm.c 4 files changed, 18 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/01/41901/1
diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h index 39400cf..283f388 100644 --- a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h +++ b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h @@ -337,6 +337,9 @@ void l1sched_reset(struct l1sched_state *sched, bool reset_clock); void l1sched_free(struct l1sched_state *sched);
+void l1sched_sacch_cache_read(struct l1sched_state *sched, uint8_t *out); +void l1sched_sacch_cache_update(struct l1sched_state *sched, const uint8_t *in); + /* Timeslot management functions */ struct l1sched_ts *l1sched_add_ts(struct l1sched_state *sched, int tn); void l1sched_del_ts(struct l1sched_state *sched, int tn); diff --git a/src/host/trxcon/src/sched_prim.c b/src/host/trxcon/src/sched_prim.c index 4974557..fa46d91 100644 --- a/src/host/trxcon/src/sched_prim.c +++ b/src/host/trxcon/src/sched_prim.c @@ -102,11 +102,8 @@ cached = (lchan->sacch.mr_cache[2] != 0x00 && lchan->sacch.mr_cache[3] != 0x00 && lchan->sacch.mr_cache[4] != 0x00); - if (!cached) { - memcpy(&lchan->sacch.mr_cache[0], - &lchan->ts->sched->sacch_cache[0], - sizeof(lchan->sacch.mr_cache)); - } + if (!cached) /* populate from the global UL SACCH cache (if needed) */ + l1sched_sacch_cache_read(lchan->ts->sched, lchan->sacch.mr_cache);
/* Compose a new Measurement Report primitive */ memcpy(msgb_put(msg, GSM_MACBLOCK_LEN), diff --git a/src/host/trxcon/src/sched_trx.c b/src/host/trxcon/src/sched_trx.c index f412400..851d403 100644 --- a/src/host/trxcon/src/sched_trx.c +++ b/src/host/trxcon/src/sched_trx.c @@ -153,7 +153,7 @@ .priv = priv, };
- memcpy(&sched->sacch_cache[0], &meas_rep_dummy[0], sizeof(meas_rep_dummy)); + l1sched_sacch_cache_update(sched, meas_rep_dummy);
if (cfg->log_prefix == NULL) sched->log_prefix = talloc_asprintf(sched, "l1sched[0x%p]: ", sched); @@ -193,7 +193,17 @@ for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++) l1sched_del_ts(sched, tn);
- memcpy(&sched->sacch_cache[0], &meas_rep_dummy[0], sizeof(meas_rep_dummy)); + l1sched_sacch_cache_update(sched, meas_rep_dummy); +} + +void l1sched_sacch_cache_read(struct l1sched_state *sched, uint8_t *out) +{ + memcpy(out, sched->sacch_cache, sizeof(sched->sacch_cache)); +} + +void l1sched_sacch_cache_update(struct l1sched_state *sched, const uint8_t *in) +{ + memcpy(sched->sacch_cache, in, sizeof(sched->sacch_cache)); }
struct l1sched_ts *l1sched_add_ts(struct l1sched_state *sched, int tn) diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 9545883..ce3c0dd 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -108,7 +108,7 @@ break; }
- memcpy(&trxcon->sched->sacch_cache[0], req->data, req->data_len); + l1sched_sacch_cache_update(trxcon->sched, req->data); break; } default: