From 86f4c093d1ead974ab0b8d67eaa5ca8946379616 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 8 Jun 2021 18:53:40 +0200 Subject: [PATCH] pcuif: Support receiving System Information 2 OsmoPCU will need this SI2 in order to gain knowledge of the BCCH Frequency List being broadcasted, in order to build a per-MS specific Neighbour List using NC_FREQUENCY_LIST bits in Packet Measurement Order. Related: SYS#5303 Change-Id: I4a9c4f70beac6805322a19835a0d30f7247780b4 --- src/bts.h | 3 +++ src/pcu_l1_if.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/bts.h b/src/bts.h index 2a7d8837..a2f4598e 100644 --- a/src/bts.h +++ b/src/bts.h @@ -231,6 +231,9 @@ struct gprs_rlcmac_bts { uint8_t si1[GSM_MACBLOCK_LEN]; bool si1_is_set; + uint8_t si2[GSM_MACBLOCK_LEN]; + bool si2_is_set; + struct gsm_sysinfo_freq si2_bcch_cell_list[1024]; uint8_t si3[GSM_MACBLOCK_LEN]; bool si3_is_set; uint8_t si13[GSM_MACBLOCK_LEN]; diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 0453b92c..818cb1aa 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -286,9 +286,28 @@ int pcu_rx_data_ind_pdtch(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_pdch * return rc; } +static int list_arfcn(const struct gprs_rlcmac_bts *bts, const struct gsm_sysinfo_freq *freq, const char *text) +{ + int n = 0, i; + for (i = 0; i < 1024; i++) { + if (freq[i].mask) { + if (!n) + LOGP(DL1IF, LOGL_INFO, "BTS%d: %s", bts->nr, text); + LOGPC(DL1IF, LOGL_INFO, " %d", i); + n++; + } + } + if (n) + LOGPC(DL1IF, LOGL_INFO, "\n"); + + return n; +} + static int pcu_rx_data_ind_bcch(struct gprs_rlcmac_bts *bts, uint8_t *data, uint8_t len) { + struct gsm48_system_information_type_2 *si2; const uint8_t *si_ro; + switch (len) { case 0: /* Due to historical reasons also accept a completely empty message as @@ -305,6 +324,9 @@ static int pcu_rx_data_ind_bcch(struct gprs_rlcmac_bts *bts, uint8_t *data, uint case SYSINFO_TYPE_1: bts->si1_is_set = false; break; + case SYSINFO_TYPE_2: + bts->si2_is_set = false; + break; case SYSINFO_TYPE_3: bts->si3_is_set = false; break; @@ -328,6 +350,14 @@ static int pcu_rx_data_ind_bcch(struct gprs_rlcmac_bts *bts, uint8_t *data, uint memcpy(bts->si1, data, GSM_MACBLOCK_LEN); bts->si1_is_set = true; break; + case GSM48_MT_RR_SYSINFO_2: + memcpy(bts->si2, data, GSM_MACBLOCK_LEN); + bts->si2_is_set = true; + si2 = (struct gsm48_system_information_type_2 *)bts->si2; + gsm48_decode_freq_list(bts->si2_bcch_cell_list, si2->bcch_frequency_list, + sizeof(si2->bcch_frequency_list), 0xce, 1); + list_arfcn(bts, bts->si2_bcch_cell_list, "SI2 Neighbour cells in same band:"); + break; case GSM48_MT_RR_SYSINFO_3: memcpy(bts->si3, data, GSM_MACBLOCK_LEN); bts->si3_is_set = true;