handle BCH indication
This commit is contained in:
@@ -515,6 +515,7 @@ int main( int argc, char **argv ) {
|
|||||||
if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid
|
if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid
|
||||||
uint16_t nr_band = get_softmodem_params()->band;
|
uint16_t nr_band = get_softmodem_params()->band;
|
||||||
mac->nr_band = nr_band;
|
mac->nr_band = nr_band;
|
||||||
|
mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier;
|
||||||
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
||||||
downlink_frequency[CC_id][0],
|
downlink_frequency[CC_id][0],
|
||||||
uplink_frequency_offset[CC_id][0],
|
uplink_frequency_offset[CC_id][0],
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ typedef struct NRRrcMacBcchDataInd_s {
|
|||||||
uint32_t sdu_size;
|
uint32_t sdu_size;
|
||||||
uint8_t sdu[BCCH_SDU_SIZE];
|
uint8_t sdu[BCCH_SDU_SIZE];
|
||||||
uint8_t gnb_index;
|
uint8_t gnb_index;
|
||||||
|
bool is_bch;
|
||||||
uint8_t rsrq;
|
uint8_t rsrq;
|
||||||
uint8_t rsrp;
|
uint8_t rsrp;
|
||||||
} NRRrcMacBcchDataInd;
|
} NRRrcMacBcchDataInd;
|
||||||
|
|||||||
@@ -713,6 +713,9 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
|
|||||||
mac->get_sib1 = true;
|
mac->get_sib1 = true;
|
||||||
else if (sched_sib == 2)
|
else if (sched_sib == 2)
|
||||||
mac->get_otherSI = true;
|
mac->get_otherSI = true;
|
||||||
|
nr_ue_decode_mib(module_id,
|
||||||
|
cc_idP,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||||
|
|||||||
@@ -477,6 +477,7 @@ typedef struct {
|
|||||||
RA_config_t ra;
|
RA_config_t ra;
|
||||||
/// SSB index from MIB decoding
|
/// SSB index from MIB decoding
|
||||||
uint8_t mib_ssb;
|
uint8_t mib_ssb;
|
||||||
|
uint32_t mib_additional_bits;
|
||||||
|
|
||||||
nr_csi_report_t csi_report_template[MAX_CSI_REPORTCONFIG];
|
nr_csi_report_t csi_report_template[MAX_CSI_REPORTCONFIG];
|
||||||
|
|
||||||
@@ -510,6 +511,7 @@ typedef struct {
|
|||||||
frequency_range_t frequency_range;
|
frequency_range_t frequency_range;
|
||||||
uint16_t nr_band;
|
uint16_t nr_band;
|
||||||
uint8_t ssb_subcarrier_offset;
|
uint8_t ssb_subcarrier_offset;
|
||||||
|
int ssb_start_subcarrier;
|
||||||
|
|
||||||
NR_SSB_meas_t ssb_measurements;
|
NR_SSB_meas_t ssb_measurements;
|
||||||
|
|
||||||
|
|||||||
@@ -57,17 +57,7 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac);
|
|||||||
\param pduP pointer to pdu
|
\param pduP pointer to pdu
|
||||||
\param pdu_length length of pdu
|
\param pdu_length length of pdu
|
||||||
\param cell_id cell id */
|
\param cell_id cell id */
|
||||||
int8_t nr_ue_decode_mib(
|
int8_t nr_ue_decode_mib(module_id_t module_id, int cc_id, void *phy_data);
|
||||||
module_id_t module_id,
|
|
||||||
int cc_id,
|
|
||||||
uint8_t gNB_index,
|
|
||||||
void *phy_data,
|
|
||||||
uint8_t extra_bits,
|
|
||||||
uint32_t ssb_length,
|
|
||||||
uint32_t ssb_index,
|
|
||||||
void *pduP,
|
|
||||||
uint16_t ssb_start_subcarrier,
|
|
||||||
uint16_t cell_id );
|
|
||||||
|
|
||||||
/**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind
|
/**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind
|
||||||
\param module_id module id
|
\param module_id module id
|
||||||
|
|||||||
@@ -247,48 +247,34 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti)
|
|||||||
|
|
||||||
int8_t nr_ue_decode_mib(module_id_t module_id,
|
int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||||
int cc_id,
|
int cc_id,
|
||||||
uint8_t gNB_index,
|
void *phy_data)
|
||||||
void *phy_data,
|
|
||||||
uint8_t extra_bits, // 8bits 38.212 c7.1.1
|
|
||||||
uint32_t ssb_length,
|
|
||||||
uint32_t ssb_index,
|
|
||||||
void *pduP,
|
|
||||||
uint16_t ssb_start_subcarrier,
|
|
||||||
uint16_t cell_id)
|
|
||||||
{
|
{
|
||||||
LOG_D(MAC,"[L2][MAC] decode mib\n");
|
LOG_D(MAC,"[L2][MAC] decode mib\n");
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
mac->physCellId = cell_id;
|
|
||||||
|
|
||||||
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3); // fixed 3 bytes MIB PDU
|
|
||||||
|
|
||||||
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
|
|
||||||
|
|
||||||
uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused);
|
uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused);
|
||||||
uint16_t frame_number_4lsb = 0;
|
uint16_t frame_number_4lsb = 0;
|
||||||
|
|
||||||
for (int i=0; i<4; i++)
|
int extra_bits = mac->mib_additional_bits;
|
||||||
frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i);
|
for (int i = 0; i < 4; i++)
|
||||||
|
frame_number_4lsb |= ((extra_bits >> i) & 1) << (3 - i);
|
||||||
|
|
||||||
uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5]
|
uint8_t ssb_subcarrier_offset_msb = (extra_bits >> 5) & 0x1; // extra bits[5]
|
||||||
uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset;
|
uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset;
|
||||||
|
|
||||||
frame = frame << 4;
|
frame = frame << 4;
|
||||||
frame = frame | frame_number_4lsb;
|
frame = frame | frame_number_4lsb;
|
||||||
if(ssb_length == 64){
|
if (mac->frequency_range == FR2) {
|
||||||
mac->frequency_range = FR2;
|
for (int i = 0; i < 3; i++)
|
||||||
for (int i=0; i<3; i++)
|
mac->mib_ssb += (((extra_bits >> (7 - i)) & 0x01) << (3 + i));
|
||||||
ssb_index += (((extra_bits>>(7-i))&0x01)<<(3+i));
|
} else{
|
||||||
}else{
|
if(ssb_subcarrier_offset_msb)
|
||||||
mac->frequency_range = FR1;
|
|
||||||
if(ssb_subcarrier_offset_msb){
|
|
||||||
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
|
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MIB
|
#ifdef DEBUG_MIB
|
||||||
uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4]
|
uint8_t half_frame_bit = (extra_bits >> 4) & 0x1; // extra bits[4]
|
||||||
LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
|
LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
|
||||||
LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame);
|
LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame);
|
||||||
LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
|
LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
|
||||||
@@ -299,11 +285,9 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
|
LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
|
||||||
LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
|
LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
|
||||||
LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
|
LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
|
||||||
LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index);
|
LOG_I(MAC,"ssb index(extra bits): %d\n", (int)mac->mib_ssb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//storing ssb index in the mac structure
|
|
||||||
mac->mib_ssb = ssb_index;
|
|
||||||
mac->ssb_subcarrier_offset = ssb_subcarrier_offset;
|
mac->ssb_subcarrier_offset = ssb_subcarrier_offset;
|
||||||
|
|
||||||
uint8_t scs_ssb;
|
uint8_t scs_ssb;
|
||||||
@@ -314,10 +298,10 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
|
|
||||||
scs_ssb = get_softmodem_params()->numerology;
|
scs_ssb = get_softmodem_params()->numerology;
|
||||||
band = mac->nr_band;
|
band = mac->nr_band;
|
||||||
ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
|
ssb_start_symbol = get_ssb_start_symbol(band, scs_ssb, mac->mib_ssb);
|
||||||
int ssb_sc_offset_norm;
|
int ssb_sc_offset_norm;
|
||||||
if (ssb_subcarrier_offset<24 && mac->frequency_range == FR1)
|
if (ssb_subcarrier_offset < 24 && mac->frequency_range == FR1)
|
||||||
ssb_sc_offset_norm = ssb_subcarrier_offset>>scs_ssb;
|
ssb_sc_offset_norm = ssb_subcarrier_offset >> scs_ssb;
|
||||||
else
|
else
|
||||||
ssb_sc_offset_norm = ssb_subcarrier_offset;
|
ssb_sc_offset_norm = ssb_subcarrier_offset;
|
||||||
|
|
||||||
@@ -327,8 +311,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
ssb_start_symbol,
|
ssb_start_symbol,
|
||||||
frame,
|
frame,
|
||||||
ssb_sc_offset_norm,
|
ssb_sc_offset_norm,
|
||||||
ssb_index,
|
mac->mib_ssb,
|
||||||
ssb_start_subcarrier,
|
mac->ssb_start_subcarrier,
|
||||||
mac->frequency_range,
|
mac->frequency_range,
|
||||||
phy_data);
|
phy_data);
|
||||||
mac->first_sync_frame = frame;
|
mac->first_sync_frame = frame;
|
||||||
@@ -338,7 +322,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
scs_ssb = *scc->ssbSubcarrierSpacing;
|
scs_ssb = *scc->ssbSubcarrierSpacing;
|
||||||
band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||||
ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
|
ssb_start_symbol = get_ssb_start_symbol(band, scs_ssb, mac->mib_ssb);
|
||||||
if (mac->first_sync_frame == -1)
|
if (mac->first_sync_frame == -1)
|
||||||
mac->first_sync_frame = frame;
|
mac->first_sync_frame = frame;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1037,19 +1037,18 @@ int handle_bcch_bch(module_id_t module_id, int cc_id,
|
|||||||
unsigned int gNB_index, void *phy_data, uint8_t *pduP,
|
unsigned int gNB_index, void *phy_data, uint8_t *pduP,
|
||||||
unsigned int additional_bits,
|
unsigned int additional_bits,
|
||||||
uint32_t ssb_index, uint32_t ssb_length,
|
uint32_t ssb_index, uint32_t ssb_length,
|
||||||
uint16_t ssb_start_subcarrier, uint16_t cell_id){
|
uint16_t ssb_start_subcarrier, uint16_t cell_id)
|
||||||
|
{
|
||||||
return nr_ue_decode_mib(module_id,
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
cc_id,
|
mac->mib_ssb = ssb_index;
|
||||||
gNB_index,
|
mac->physCellId = cell_id;
|
||||||
phy_data,
|
mac->mib_additional_bits = additional_bits;
|
||||||
additional_bits,
|
if(ssb_length == 64)
|
||||||
ssb_length, // Lssb = 64 is not support
|
mac->frequency_range = FR2;
|
||||||
ssb_index,
|
else
|
||||||
pduP,
|
mac->frequency_range = FR1;
|
||||||
ssb_start_subcarrier,
|
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3); // fixed 3 bytes MIB PDU
|
||||||
cell_id);
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// L2 Abstraction Layer
|
// L2 Abstraction Layer
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
|||||||
|
|
||||||
switch(channel){
|
switch(channel){
|
||||||
case NR_BCCH_BCH:
|
case NR_BCCH_BCH:
|
||||||
AssertFatal(nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NR_BCCH_DL_SCH:
|
case NR_BCCH_DL_SCH:
|
||||||
if (pdu_len>0) {
|
if (pdu_len>0) {
|
||||||
LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET,
|
LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET,
|
||||||
@@ -88,6 +85,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
|||||||
NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot;
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot;
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).is_bch = (channel == NR_BCCH_BCH);
|
||||||
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
|
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1961,15 +1961,21 @@ void *rrc_nrue_task(void *args_p)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RRC_MAC_BCCH_DATA_IND:
|
case NR_RRC_MAC_BCCH_DATA_IND:
|
||||||
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
|
LOG_I(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
||||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
||||||
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id,
|
if (NR_RRC_MAC_BCCH_DATA_IND (msg_p).is_bch)
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
|
nr_rrc_ue_decode_NR_BCCH_BCH_Message(ue_mod_id,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size);
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
|
else
|
||||||
|
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(ctxt.module_id,
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RRC_MAC_CCCH_DATA_IND:
|
case NR_RRC_MAC_CCCH_DATA_IND:
|
||||||
|
|||||||
Reference in New Issue
Block a user