diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-29 11:24:04 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-06-08 08:29:28 +0200 |
commit | d7a41145a8b60b7a3739244614245ec6373b661e (patch) | |
tree | 384373c2fdd77009bd5b982ea727d5f18af8f2d3 | |
parent | ead6f08f42b34b283866e23b08a8fe869667cc64 (diff) |
clean-up: Remove trx/ts/arfcn from two more places
Continue with the clean-up and remove trx/ts integers from the
API. Introduce the first template in pcu_l1_if.cpp to have a
generic "extract ts,trx,arfcn" function.
-rw-r--r-- | src/pcu_l1_if.cpp | 18 | ||||
-rw-r--r-- | src/pcu_l1_if.h | 2 | ||||
-rw-r--r-- | src/sysmo_l1_if.c | 3 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index cb5c5d95..0f0e42b9 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -50,7 +50,8 @@ int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn, extern void *tall_pcu_ctx; -static gprs_rlcmac_pdch *find_pdch(struct gsm_pcu_if_rts_req *req) +template<typename T> +static gprs_rlcmac_pdch *find_pdch(T *req) { return bts_find_pdch(req->trx_nr, req->ts_nr, req->arfcn); } @@ -182,17 +183,15 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi) pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3); } -extern "C" int pcu_rx_data_ind_pdtch(uint8_t trx_no, uint8_t ts_no, uint8_t *data, +extern "C" int pcu_rx_data_ind_pdtch(struct gprs_rlcmac_pdch *pdch, uint8_t *data, uint8_t len, uint32_t fn, int8_t rssi) { - struct gprs_rlcmac_pdch *pdch; - - pdch = &bts_main_data()->trx[trx_no].pdch[ts_no]; return pdch->rcv_block(data, len, fn, rssi); } static int pcu_rx_data_ind(struct gsm_pcu_if_data *data_ind) { + gprs_rlcmac_pdch *pdch; int rc = 0; LOGP(DL1IF, LOGL_DEBUG, "Data indication received: sapi=%d arfcn=%d " @@ -200,11 +199,14 @@ static int pcu_rx_data_ind(struct gsm_pcu_if_data *data_ind) data_ind->arfcn, data_ind->block_nr, osmo_hexdump(data_ind->data, data_ind->len)); + pdch = find_pdch(data_ind); + if (!pdch) + return -EINVAL; + switch (data_ind->sapi) { case PCU_IF_SAPI_PDTCH: - rc = pcu_rx_data_ind_pdtch(data_ind->trx_nr, data_ind->ts_nr, - data_ind->data, data_ind->len, data_ind->fn, - data_ind->rssi); + rc = pcu_rx_data_ind_pdtch(pdch, data_ind->data, data_ind->len, + data_ind->fn, data_ind->rssi); break; default: LOGP(DL1IF, LOGL_ERROR, "Received PCU data indication with " diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index 208aabd6..bfb1d498 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -58,7 +58,7 @@ int pcu_rx_rts_req_pdtch(struct gprs_rlcmac_pdch *pdch, #ifdef __cplusplus extern "C" #endif -int pcu_rx_data_ind_pdtch(uint8_t trx, uint8_t ts, uint8_t *data, +int pcu_rx_data_ind_pdtch(struct gprs_rlcmac_pdch *pdch, uint8_t *data, uint8_t len, uint32_t fn, int8_t rssi); #endif // PCU_L1_IF_H diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c index 57b95b4f..cc2f7950 100644 --- a/src/sysmo_l1_if.c +++ b/src/sysmo_l1_if.c @@ -188,7 +188,8 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1h, != GsmL1_PdtchPlType_Full) break; /* PDTCH / PACCH frame handling */ - pcu_rx_data_ind_pdtch((long)fl1h->priv, data_ind->u8Tn, + pcu_rx_data_ind_pdtch(bts_find_pdch((long)fl1h->priv, + data_ind->u8Tn, data_ind->u16Arfcn), data_ind->msgUnitParam.u8Buffer + 1, data_ind->msgUnitParam.u8Size - 1, data_ind->u32Fn, |