diff options
-rw-r--r-- | include/osmo-bts/bts.h | 2 | ||||
-rw-r--r-- | src/common/bts.c | 22 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.c | 17 |
3 files changed, 28 insertions, 13 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index e2020350..49ef617c 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -26,6 +26,8 @@ void bts_setup_slot(struct gsm_bts_trx_ts *slot, uint8_t comb); int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg); struct msgb *bts_agch_dequeue(struct gsm_bts *bts); +int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, + int is_ag_res); uint8_t *bts_sysinfo_get(struct gsm_bts *bts, struct gsm_time *g_time); uint8_t *lchan_sacch_get(struct gsm_lchan *lchan, struct gsm_time *g_time); diff --git a/src/common/bts.c b/src/common/bts.c index 35fc3024..7bbf5870 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -231,6 +231,28 @@ struct msgb *bts_agch_dequeue(struct gsm_bts *bts) return msg; } +int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt, + int is_ag_res) +{ + struct msgb *msg; + struct gsm_bts_role_bts *btsb = bts->role; + int rc; + + if (!is_ag_res) + return paging_gen_msg(btsb->paging_state, out_buf, gt); + + /* special queue of messages from IMM ASS CMD */ + msg = bts_agch_dequeue(bts); + if (!msg) + return 0; + + memcpy(out_buf, msgb_l3(msg), msgb_l3len(msg)); + rc = msgb_l3len(msg); + msgb_free(msg); + + return rc; +} + int bts_supports_cipher(struct gsm_bts_role_bts *bts, int rsl_cipher) { int sup; diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 2a14dd05..fbc259bb 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -373,7 +373,6 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, { struct gsm_bts_trx *trx = fl1->priv; struct gsm_bts *bts = trx->bts; - struct gsm_bts_role_bts *btsb = bts->role; struct msgb *resp_msg; GsmL1_PhDataReq_t *data_req; GsmL1_MsgUnitParam_t *msu_param; @@ -511,19 +510,11 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, } break; case GsmL1_Sapi_Agch: - /* special queue of messages from IMM ASS CMD */ - { - struct msgb *msg = bts_agch_dequeue(bts); - if (!msg) - memcpy(msu_param->u8Buffer, fill_frame, GSM_MACBLOCK_LEN); - else { - memcpy(msu_param->u8Buffer, msgb_l3(msg), msgb_l3len(msg)); - msgb_free(msg); - } - } - break; case GsmL1_Sapi_Pch: - rc = paging_gen_msg(btsb->paging_state, msu_param->u8Buffer, &g_time); + rc = bts_ccch_copy_msg(bts, msu_param->u8Buffer, &g_time, + rts_ind->sapi == GsmL1_Sapi_Agch); + if (rc <= 0) + memcpy(msu_param->u8Buffer, fill_frame, GSM_MACBLOCK_LEN); break; case GsmL1_Sapi_TchF: case GsmL1_Sapi_TchH: |