diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-16 21:47:45 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-30 21:20:44 +0100 |
commit | 173a240a7ed064b61bebd69567159bd5669db0c8 (patch) | |
tree | 71984bb049c4a03c4e15e43cd496bced62819f23 | |
parent | 45396a99d9d564cda350c6f88367dec7cf1fce7b (diff) |
bts: Remove global state and the usage of the gprs_rlcmac_bts
Global state makes mocking/writing tests more difficult. Continue
by removing direct usage of the bts and adding it as pointer to
the function calls (showing the true dependencies of the functions)
-rw-r--r-- | src/gprs_rlcmac.cpp | 4 | ||||
-rw-r--r-- | src/gprs_rlcmac.h | 2 | ||||
-rw-r--r-- | src/gprs_rlcmac_data.cpp | 2 | ||||
-rw-r--r-- | src/tbf.cpp | 5 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp index 6dea7c81..f0d58d92 100644 --- a/src/gprs_rlcmac.cpp +++ b/src/gprs_rlcmac.cpp @@ -188,10 +188,10 @@ int tfi_find_free(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction di LLIST_HEAD(gprs_rlcmac_sbas); -int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta) +int sba_alloc(struct gprs_rlcmac_bts *bts, + uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta) { - struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; struct gprs_rlcmac_pdch *pdch; struct gprs_rlcmac_sba *sba; uint8_t trx, ts; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 8863af47..b8afdcd0 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -146,7 +146,7 @@ int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf); int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets); -int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta); +int sba_alloc(struct gprs_rlcmac_bts *bts, uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta); struct gprs_rlcmac_sba *sba_find(uint8_t trx, uint8_t ts, uint32_t fn); diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp index 079af564..c2ed9e6a 100644 --- a/src/gprs_rlcmac_data.cpp +++ b/src/gprs_rlcmac_data.cpp @@ -1060,7 +1060,7 @@ int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta) if (qta > 252) qta = 252; if (sb) { - rc = sba_alloc(&trx, &ts, &sb_fn, qta >> 2); + rc = sba_alloc(bts, &trx, &ts, &sb_fn, qta >> 2); if (rc < 0) return rc; LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] RACH qbit-ta=%d " diff --git a/src/tbf.cpp b/src/tbf.cpp index 9afa85d1..6ba117e6 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -243,12 +243,11 @@ struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, static void tbf_unlink_pdch(struct gprs_rlcmac_tbf *tbf) { - struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; struct gprs_rlcmac_pdch *pdch; int ts; if (tbf->direction == GPRS_RLCMAC_UL_TBF) { - bts->trx[tbf->trx_no].ul_tbf[tbf->tfi] = NULL; + tbf->trx->ul_tbf[tbf->tfi] = NULL; for (ts = 0; ts < 8; ts++) { pdch = tbf->pdch[ts]; if (pdch) @@ -256,7 +255,7 @@ static void tbf_unlink_pdch(struct gprs_rlcmac_tbf *tbf) tbf->pdch[ts] = NULL; } } else { - bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = NULL; + tbf->trx->dl_tbf[tbf->tfi] = NULL; for (ts = 0; ts < 8; ts++) { pdch = tbf->pdch[ts]; if (pdch) |