Allow multiple bts objects in PCU

This patch doesn't really tests whether osmo-pcu can work on a multi-bts
environment, but it prepares the data structures to be able to do so at
any later point in time.

Change-Id: I6b10913f46c19d438c4e250a436a7446694b725a
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c
index bf2ecec..8f64863 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -148,6 +148,7 @@
 				     GsmL1_PhReadyToSendInd_t *rts_ind)
 {
 	struct gsm_time g_time;
+	struct gprs_rlcmac_bts *bts;
 	int rc = 0;
 
 	gsm_fn2gsmtime(&g_time, rts_ind->u32Fn);
@@ -156,14 +157,17 @@
 		g_time.t1, g_time.t2, g_time.t3,
 		get_value_string(lc15bts_l1sapi_names, rts_ind->sapi));
 
+	bts = llist_first_entry_or_null(&the_pcu->bts_list, struct gprs_rlcmac_bts, list);
+
+
 	switch (rts_ind->sapi) {
 	case GsmL1_Sapi_Pdtch:
 	case GsmL1_Sapi_Pacch:
-		rc = pcu_rx_rts_req_pdtch(fl1h->trx_no, rts_ind->u8Tn,
+		rc = pcu_rx_rts_req_pdtch(bts, fl1h->trx_no, rts_ind->u8Tn,
 			rts_ind->u32Fn, rts_ind->u8BlockNbr);
 		break;
 	case GsmL1_Sapi_Ptcch:
-		rc = pcu_rx_rts_req_ptcch(fl1h->trx_no, rts_ind->u8Tn,
+		rc = pcu_rx_rts_req_ptcch(bts, fl1h->trx_no, rts_ind->u8Tn,
 			rts_ind->u32Fn, rts_ind->u8BlockNbr);
 		break;
 	default:
@@ -189,6 +193,7 @@
 	GsmL1_PhDataInd_t *data_ind, struct msgb *l1p_msg)
 {
 	int rc = 0;
+	struct gprs_rlcmac_bts *bts;
 	struct pcu_l1_meas meas = {0};
 
 	DEBUGP(DL1IF, "Rx PH-DATA.ind %s (hL2 %08x): %s\n",
@@ -205,8 +210,10 @@
 	if (data_ind->msgUnitParam.u8Size == 0)
 		return -1;
 
+	bts = llist_first_entry_or_null(&the_pcu->bts_list, struct gprs_rlcmac_bts, list);
+
 	get_meas(&meas, &data_ind->measParam);
-	bts_update_tbf_ta("PH-DATA", data_ind->u32Fn, fl1h->trx_no,
+	bts_update_tbf_ta(bts, "PH-DATA", data_ind->u32Fn, fl1h->trx_no,
 			  data_ind->u8Tn, sign_qta2ta(meas.bto), false);
 
 	switch (data_ind->sapi) {
@@ -217,7 +224,7 @@
 			!= GsmL1_PdtchPlType_Full)
 			break;
 		/* PDTCH / PACCH frame handling */
-		rc = pcu_rx_data_ind_pdtch(fl1h->trx_no, data_ind->u8Tn,
+		rc = pcu_rx_data_ind_pdtch(bts, fl1h->trx_no, data_ind->u8Tn,
 			data_ind->msgUnitParam.u8Buffer + 1,
 			data_ind->msgUnitParam.u8Size - 1,
 			data_ind->u32Fn,
@@ -243,19 +250,22 @@
 
 static int handle_ph_ra_ind(struct lc15l1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
 {
+	struct gprs_rlcmac_bts *bts;
 	if (ra_ind->measParam.fLinkQuality < MIN_QUAL_RACH)
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
 
+	bts = llist_first_entry_or_null(&the_pcu->bts_list, struct gprs_rlcmac_bts, list);
+
 	switch (ra_ind->sapi) {
 	case GsmL1_Sapi_Pdtch:
 	case GsmL1_Sapi_Prach:
-		bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+		bts_update_tbf_ta(bts, "PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
 				  qta2ta(ra_ind->measParam.i16BurstTiming), true);
 		break;
 	case GsmL1_Sapi_Ptcch:
-		pcu_rx_rach_ind_ptcch(fl1h->trx_no, ra_ind->u8Tn, ra_ind->u32Fn,
+		pcu_rx_rach_ind_ptcch(bts, fl1h->trx_no, ra_ind->u8Tn, ra_ind->u32Fn,
 				      ra_ind->measParam.i16BurstTiming);
 		break;
 	default:
@@ -387,4 +397,3 @@
 	talloc_free(fl1h);
 	return 0;
 }
-