Looks good to me from the code structure perspective.
On Thu, Sep 19, 2013 at 2:11 PM, Andreas Eversberg <jolly(a)eversberg.eu> wrote:
This part moves PCH and AGCH message primitives from
osmo-bts-sysmo to
common part.
---
src/common/l1sap.c | 17 +++++++++++++++++
src/osmo-bts-sysmo/l1_if.c | 28 ++++++++++++----------------
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 996a589..16e1af8 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -108,6 +108,23 @@ static int l1sap_ph_rts_ind(struct gsm_bts_trx *trx,
memcpy(p, si, GSM_MACBLOCK_LEN);
else
memcpy(p, fill_frame, GSM_MACBLOCK_LEN);
+ } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
+ p = msgb_put(msg, GSM_MACBLOCK_LEN);
+ if (L1SAP_FN2CCCHBLOCK(fn) >= 1) {
+ /* PCH */
+ struct gsm_bts_role_bts *btsb = trx->bts->role;
+ paging_gen_msg(btsb->paging_state, p, &g_time);
+ } else {
+ /* AGCH */
+ /* special queue of messages from IMM ASS CMD */
+ struct msgb *amsg = bts_agch_dequeue(trx->bts);
+ if (!amsg)
+ memcpy(p, fill_frame, GSM_MACBLOCK_LEN);
+ else {
+ memcpy(p, amsg->data, amsg->len);
+ msgb_free(amsg);
+ }
+ }
}
DEBUGP(DL1P, "Tx PH-DATA.req %02u/%02u/%02u chan_nr=%d link_id=%d\n",
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 874ec15..511b466 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -389,6 +389,14 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg,
subCh = 0x1f;
if (L1SAP_IS_CHAN_BCCH(chan_nr)) {
sapi = GsmL1_Sapi_Bcch;
+ } else if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr)) {
+ /* The sapi depends on DSP configuration, not
+ * on the actual SYSTEM INFORMATION 3. */
+ u8BlockNbr = L1SAP_FN2CCCHBLOCK(u32Fn);
+ if (u8BlockNbr >= 1)
+ sapi = GsmL1_Sapi_Pch;
+ else
+ sapi = GsmL1_Sapi_Agch;
} else {
LOGP(DL1C, LOGL_NOTICE, "unknown prim %d op %d "
"chan_nr %d link_id %d\n", l1sap->oph.primitive,
@@ -486,6 +494,10 @@ static uint8_t chan_nr_by_sapi(enum gsm_phys_chan_config pchan,
case GsmL1_Sapi_Bcch:
cbits = 0x10;
break;
+ case GsmL1_Sapi_Agch:
+ case GsmL1_Sapi_Pch:
+ cbits = 0x12;
+ break;
default:
return 0;
}
@@ -499,7 +511,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;
@@ -647,21 +658,6 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1,
msgb_free(pp.oph.msg);
}
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, msg->data,
msg->len);
- msgb_free(msg);
- }
- }
- break;
- case GsmL1_Sapi_Pch:
- rc = paging_gen_msg(btsb->paging_state, msu_param->u8Buffer,
&g_time);
- break;
case GsmL1_Sapi_TchF:
case GsmL1_Sapi_TchH:
/* only hit in case we have a RTP underflow, as real TCH
--
1.8.1.5
--
Regards,
Alexander Chemeris.
CEO, Fairwaves LLC / ООО УмРадио
http://fairwaves.ru