Commit 9c71e941 authored by rmagueta's avatar rmagueta

Trigger RA after SIB1 reception

parent 951fdfef
......@@ -373,7 +373,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
// TODO: add connEstFailureControl
//si-SchedulingInfo
/*sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo));
sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo));
asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list);
sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s20;
struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo));
......@@ -383,7 +383,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
e_NR_SIB_TypeInfo__type *sib_type = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
*sib_type = NR_SIB_TypeInfo__type_sibType3;
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type);
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);
// servingCellConfigCommon
sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB));
......
......@@ -403,6 +403,15 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
for(nr_ue=0;nr_ue<NB_NR_UE_INST;nr_ue++){
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
NR_UE_rrc_inst[nr_ue].selected_plmn_identity = 1;
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf = CALLOC(1,4);
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[0] = SIB2 | SIB3 | SIB5; // SIB2 - SIB9
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[1] = 0; // SIB10 - SIB17
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[2] = 0; // SIB18 - SIB25
NR_UE_rrc_inst[nr_ue].requested_SI_List.buf[3] = 0; // SIB26 - SIB32
NR_UE_rrc_inst[nr_ue].requested_SI_List.size= 4;
NR_UE_rrc_inst[nr_ue].requested_SI_List.bits_unused= 0;
// init RRC lists
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RLC_Bearer_Config_list, NR_maxLC_ID);
RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SchedulingRequest_list, NR_maxNrofSR_ConfigPerCellGroup);
......@@ -1477,6 +1486,70 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
return rval;
}
int8_t check_requested_SI_List(BIT_STRING_t requested_SI_List, NR_SIB1_t sib1) {
printf("\n\n");
if(sib1.si_SchedulingInfo) {
if(sib1.si_SchedulingInfo->schedulingInfoList.list.array) {
bool SIB_to_request[32] = {};
LOG_I(RRC, "SIBs broadcasting: ");
for(int i = 0; i < sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) {
printf("SIB%li ", sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type + 2);
}
printf("\n");
LOG_I(RRC, "SIBs needed by UE: ");
for(int j = 0; j < 8*requested_SI_List.size; j++) {
if( ((requested_SI_List.buf[j/8]>>(j%8))&1) == 1) {
printf("SIB%i ", j + 2);
SIB_to_request[j] = true;
for(int i = 0; i < sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) {
if(sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type == j) {
SIB_to_request[j] = false;
break;
}
}
}
}
printf("\n");
LOG_I(RRC, "SIBs to request by UE: ");
bool do_ra = false;
for(int j = 0; j < 8*requested_SI_List.size; j++) {
if(SIB_to_request[j]) {
printf("SIB%i ", j + 2);
do_ra = true;
}
}
printf("\n");
if(do_ra) {
if(sib1.si_SchedulingInfo->si_RequestConfig) {
LOG_I(RRC, "Starting contention-free RA procedure\n");
} else {
LOG_I(RRC, "Starting contention-based RA procedure\n");
get_softmodem_params()->do_ra = 1;
}
}
}
}
printf("\n\n");
return 0;
}
/*brief decode SIB1 message*/
int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) {
......@@ -1501,7 +1574,11 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index
sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
if (*(int64_t*)sib1 != 1) {
LOG_D(RRC, "SIB1 address: %lx\n", *(int64_t*)sib1);
if( g_log->log_component[RRC].level >= OAILOG_DEBUG )
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1);
check_requested_SI_List(NR_UE_rrc_inst[module_id].requested_SI_List, *sib1);
}
else
LOG_E(PHY, "sib1 is starting by 8 times 0\n");
......
......@@ -78,6 +78,15 @@ typedef struct OAI_NR_UECapability_s {
NR_UE_NR_Capability_t *UE_NR_Capability;
} OAI_NR_UECapability_t;
typedef enum requested_SI_List_e {
SIB2 = 0x1,
SIB3 = 0x2,
SIB4 = 0x4,
SIB5 = 0x8,
SIB6 = 0x16,
SIB7 = 0x32
} requested_SI_List_t;
typedef struct NR_UE_RRC_INST_s {
NR_MeasConfig_t *meas_config;
......@@ -104,6 +113,8 @@ typedef struct NR_UE_RRC_INST_s {
uint8_t *UECapability;
uint8_t UECapability_size;
BIT_STRING_t requested_SI_List;
NR_SystemInformation_t *si[NB_CNX_UE];
NR_SIB1_t *sib1[NB_CNX_UE];
NR_SIB2_t *sib2[NB_CNX_UE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment