agch/pch: Put CCCH message generation into common

This patch adds a common function bts_ccch_copy_msg() that provides
and schedules AGCH and PCH messages. It is basically a frontend to
paging_gen_msg() and bts_agch_dequeue() and contains refactored code
from l1_if.c.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2014-02-21 15:09:15 +01:00 committed by Holger Hans Peter Freyther
parent d242ec2ed9
commit d290ee029a
3 changed files with 28 additions and 13 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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: