diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b09415bf8e..e6cb105ccd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -361,11 +361,14 @@ message( FATAL_ERROR "The script ${asn1c_call} must be present" ) endif(NOT EXISTS ${asn1c_call}) message("calling ASN1C_PREFIX=NR_ asn1c -findirect-choice -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") + execute_process(COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} NR_RRC - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET ) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") @@ -374,7 +377,6 @@ endif (NOT ${ret} STREQUAL 0) if(NOT EXISTS ${fix_asn1c_call}) message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) endif(NOT EXISTS ${fix_asn1c_call}) - execute_process(COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} NR_RRC @@ -398,6 +400,7 @@ include_directories ("${NR_RRC_FULL_DIR}") # add the command to generate the source code # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make + add_custom_command ( OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} RRC @@ -434,7 +437,11 @@ message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -ge execute_process(COMMAND mkdir -p ${S1AP_C_DIR} COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET +) + if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") @@ -499,7 +506,9 @@ message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER - execute_process(COMMAND mkdir -p ${X2AP_C_DIR} COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} - RESULT_VARIABLE ret) + RESULT_VARIABLE ret + OUTPUT_QUIET + ERROR_QUIET ) #execute_process(COMMAND ${asn1c_call} # ${X2AP_C_DIR} @@ -1458,6 +1467,7 @@ set(NR_L2_SRC_UE ${NR_UE_RRC_DIR}/main_ue.c ${NR_UE_RRC_DIR}/rrc_UE.c # ${NR_UE_RRC_DIR}/mac_vars.c +#${RRC_DIR}/rrc_UE.c ) set (MAC_SRC diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 63bfa9a335..8a5fb67002 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -186,7 +186,7 @@ typedef struct { uint8_t dci_type; uint8_t dci_size; fapi_nr_dci_pdu_rel15_t dci; - }fapi_nr_dci_indication_pdu_t; + } fapi_nr_dci_indication_pdu_t; typedef struct { fapi_nr_tl_t tl; @@ -201,20 +201,41 @@ typedef struct { fapi_nr_dci_indication_body_t dci_indication_body; } fapi_nr_dci_indication_t; - #define FAPI_NR_TX_MAX_PDU 100 + + typedef struct { + uint32_t pdu_length; + uint8_t* pdu; + } fapi_nr_pdsch_pdu_t; + + typedef struct { + uint8_t* pdu; // 3bytes + uint8_t additional_bits; + uint8_t ssb_index; + uint8_t l_ssb; + } fapi_nr_mib_pdu_t; + + typedef struct { + uint32_t pdu_length; + uint8_t* pdu; + } fapi_nr_sib_pdu_t; + typedef struct { fapi_nr_tl_t tl; - uint32_t pdu_index; - uint32_t pdu_length; - uint8_t* pdu; + uint8_t pdu_type; + union { + fapi_nr_pdsch_pdu_t pdsch_pdu; + fapi_nr_mib_pdu_t mib_pdu; + fapi_nr_sib_pdu_t sib_pdu; + }; + } fapi_nr_rx_request_body_t; - #define FAPI_NR_TX_REQUEST_BODY_TAG 0x2022 /// typedef struct { fapi_nr_p7_message_header_t header; uint16_t sfn_sf_slot; - fapi_nr_rx_request_body_t rx_request_body; + uint16_t number_pdus; + fapi_nr_rx_request_body_t *rx_request_body; } fapi_nr_rx_indication_t; typedef struct { @@ -225,21 +246,18 @@ typedef struct { } fapi_nr_tx_config_t; - #define FAPI_NR_TX_MAX_SEGMENTS 32 typedef struct { uint16_t pdu_length; uint16_t pdu_index; uint8_t* pdu; } fapi_nr_tx_request_pdu_t; - #define FAPI_NR_RX_IND_MAX_PDU 100 typedef struct { fapi_nr_tl_t tl; fapi_nr_tx_config_t tx_config; uint16_t number_of_pdus; fapi_nr_tx_request_pdu_t* tx_pdu_list; } fapi_nr_tx_request_body_t; - #define FAPI_NR_RX_INDICATION_BODY_TAG 0x2023 /// typedef struct { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index c20546aff9..9a956456e5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -701,9 +701,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, } //#endif - ue->dl_indication.rx_ind.rx_request_body.pdu_index = FAPI_NR_RX_PDU_BCCH_BCH_TYPE; - ue->dl_indication.rx_ind.rx_request_body.pdu_length = 3; - ue->dl_indication.rx_ind.rx_request_body.pdu = &decoded_output[0]; - ue->if_inst->dl_indication(&ue->dl_indication); + //ue->dl_indication.rx_ind.rx_request_body.pdu_index = FAPI_NR_RX_PDU_BCCH_BCH_TYPE; + //ue->dl_indication.rx_ind.rx_request_body.pdu_length = 3; + //ue->dl_indication.rx_ind.rx_request_body.pdu = &decoded_output[0]; + //ue->if_inst->dl_indication(&ue->dl_indication); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 57f3213dd0..c10137cb92 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -59,6 +59,13 @@ #define NB_NR_UE_MAC_INST 1 +typedef enum { + SFN_C_MOD_2_EQ_0, + SFN_C_MOD_2_EQ_1, + SFN_C_EQ_SFN_SSB +} SFN_C_TYPE; + + /*!\brief Top level UE MAC structure */ typedef struct { @@ -72,12 +79,16 @@ typedef struct { NR_MIB_t *mib; /// Type0-PDCCH seach space coreset - fapi_nr_search_space_t type0_pdcch_ss; + fapi_nr_coreset_t type0_pdcch_coreset; uint32_t type0_pdcch_ss_mux_pattern; - float type0_pdcch_ss_big_o; +// float type0_pdcch_ss_big_o; uint32_t type0_pdcch_ss_number_of_search_space_per_slot; - float type0_pdcch_ss_big_m; +// float type0_pdcch_ss_big_m; uint32_t type0_pdcch_ss_first_symbol_index; + + SFN_C_TYPE type0_pdcch_ss_sfn_c; + uint32_t type0_pdcch_ss_n_c; + /// Type0-PDCCH seach space diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 0fa9fbd190..0e361e7d4b 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -49,9 +49,9 @@ int8_t nr_ue_decode_mib( int cc_id, uint8_t gNB_index, uint8_t extra_bits, - uint32_t l_ssb_equal_64, - void *pduP, - uint16_t pdu_len); + uint32_t ssb_length, + uint32_t ssb_index, + void *pduP ); /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) @@ -94,12 +94,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler( const int cc_id, const frame_t rx_frame, const slot_t rx_slot, + const int32_t ssb_index, const frame_t tx_frame, const slot_t tx_slot); -#endif - - /* \brief Get SR payload (0,1) from UE MAC @param Mod_id Instance id of UE in machine @@ -112,4 +110,5 @@ NR_UE_L2_STATE_t nr_ue_scheduler( uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe); -/** @}*/ +#endif +/** @}*/ \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_UE/mac_vars.c b/openair2/LAYER2/NR_MAC_UE/mac_vars.c index 228a599b56..2afeea0982 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_vars.c +++ b/openair2/LAYER2/NR_MAC_UE/mac_vars.c @@ -79,12 +79,12 @@ const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserv const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default -const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; +const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; -const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; +const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default -const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // index 14-15 reserved +const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved -const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // index 14-15 reserved +const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 75025fa95d..00db3ce4b5 100755 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -36,6 +36,7 @@ #include "assertions.h" #include +#include typedef enum subcarrier_spacing_e { scs_15kHz = 0x1, @@ -59,23 +60,29 @@ typedef enum frequency_range_e { FR2 } frequency_range_t; +uint32_t get_ssb_slot(uint32_t ssb_index){ + // this function now only support f <= 3GHz + return ssb_index & 0x3 ; + + // return first_symbol(case, freq, ssb_index) / 14 + +} + int8_t nr_ue_decode_mib( module_id_t module_id, int cc_id, uint8_t gNB_index, uint8_t extra_bits, // 8bits 38.212 c7.1.1 - uint32_t l_ssb_equal_64, - //uint32_t *ssb_index, // from decoded MIB - //uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1) - void *pduP, // encoded MIB - uint16_t pdu_len){ + uint32_t ssb_length, + uint32_t ssb_index, + void *pduP ){ printf("[L2][MAC] decode mib\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, - NR_BCCH_BCH, (uint8_t *) pduP, pdu_len ); + NR_BCCH_BCH, (uint8_t *) pduP, 3 ); if(mac->mib != NULL){ @@ -86,13 +93,13 @@ int8_t nr_ue_decode_mib( uint32_t ssb_subcarrier_offset = mac->mib->ssb_SubcarrierOffset; - uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64 + //uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64 frame = frame << 4; frame = frame | frame_number_4lsb; - if(l_ssb_equal_64){ - ssb_index = (( extra_bits >> 5 ) & 0x7 ); // extra bits[5:7] + if(ssb_length == 64){ + ssb_index = ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } }else{ if(ssb_subcarrier_offset_msb){ ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; @@ -120,7 +127,6 @@ int8_t nr_ue_decode_mib( frequency_range_t frequency_range = FR1; uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1 >> 4) & 0xf; uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1 & 0xf); - int32_t num_rbs = -1; int32_t num_symbols = -1; int32_t rb_offset = -1; @@ -243,30 +249,44 @@ int8_t nr_ue_decode_mib( AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); uint32_t cell_id = 0; // obtain from L1 later - mac->type0_pdcch_ss.coreset.rb_start = rb_offset; - mac->type0_pdcch_ss.coreset.rb_end = rb_offset + num_rbs - 1; - mac->type0_pdcch_ss.coreset.duration = num_symbols; - mac->type0_pdcch_ss.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; - mac->type0_pdcch_ss.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L - mac->type0_pdcch_ss.coreset.cce_reg_interleaved_interleaver_size = 2; // R - mac->type0_pdcch_ss.coreset.cce_reg_interleaved_shift_index = cell_id; - mac->type0_pdcch_ss.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; - mac->type0_pdcch_ss.coreset.pdcch_dmrs_scrambling_id = cell_id; + mac->type0_pdcch_coreset.rb_start = rb_offset; + mac->type0_pdcch_coreset.rb_end = rb_offset + num_rbs - 1; + mac->type0_pdcch_coreset.duration = num_symbols; + mac->type0_pdcch_coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; + mac->type0_pdcch_coreset.cce_reg_interleaved_reg_bundle_size = 6; // L + mac->type0_pdcch_coreset.cce_reg_interleaved_interleaver_size = 2; // R + mac->type0_pdcch_coreset.cce_reg_interleaved_shift_index = cell_id; + mac->type0_pdcch_coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; + mac->type0_pdcch_coreset.pdcch_dmrs_scrambling_id = cell_id; // type0-pdcch search space float big_o; - uint32_t number_of_search_space_per_slot; float big_m; + uint32_t temp; + SFN_C_TYPE sfn_c; + uint32_t n_c; + uint32_t number_of_search_space_per_slot; uint32_t first_symbol_index; +const uint32_t scs_index = 0; +const uint32_t num_slot_per_frame = 10; + /// MUX PATTERN 1 if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ big_o = table_38213_13_11_c1[index_4lsb]; number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; big_m = table_38213_13_11_c3[index_4lsb]; + temp = (uint32_t)(big_o*pow(2, scs_index)) + (uint32_t)(ssb_index*big_m); + n_c = temp / num_slot_per_frame; + if((temp/num_slot_per_frame) & 0x1){ + sfn_c = SFN_C_MOD_2_EQ_1; + }else{ + sfn_c = SFN_C_MOD_2_EQ_0; + } + if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){ first_symbol_index = num_symbols; }else{ @@ -291,12 +311,13 @@ int8_t nr_ue_decode_mib( /// MUX PATTERN 2 if(mac->type0_pdcch_ss_mux_pattern == 2){ + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ // 38.213 Table 13-13 AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // TODO Type0SS_frame = SSB_frame - // TODO Type0SS_slot = SSB_slot + sfn_c = SFN_C_EQ_SFN_SSB; + n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: first_symbol_index = 0; @@ -317,7 +338,8 @@ int8_t nr_ue_decode_mib( // 38.213 Table 13-14 AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // TODO Type0SS_frame = SSB_frame + sfn_c = SFN_C_EQ_SFN_SSB; + n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x7){ // ssb_index(i) mod 8 case 0: first_symbol_index = 0; @@ -333,11 +355,11 @@ int8_t nr_ue_decode_mib( break; case 4: first_symbol_index = 12; - // TODO Type0SS_slot = SSB_slot - 1 + n_c = get_ssb_slot(ssb_index) - 1; break; case 5: first_symbol_index = 13; - // TODO Type0SS_slot = SSB_slot - 1 + n_c = get_ssb_slot(ssb_index) - 1; break; case 6: first_symbol_index = 0; @@ -356,8 +378,8 @@ int8_t nr_ue_decode_mib( // 38.213 Table 13-15 AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // TODO Type0SS_frame = SSB_frame - // TODO Type0SS_slot = SSB_slot + sfn_c = SFN_C_EQ_SFN_SSB; + n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: first_symbol_index = 4; @@ -376,9 +398,11 @@ int8_t nr_ue_decode_mib( }else{ ; } } - mac->type0_pdcch_ss_big_o = big_o; + //mac->type0_pdcch_ss_big_o = big_o; + mac->type0_pdcch_ss_sfn_c = sfn_c; + mac->type0_pdcch_ss_n_c = n_c; mac->type0_pdcch_ss_number_of_search_space_per_slot = number_of_search_space_per_slot; - mac->type0_pdcch_ss_big_m = big_m; + //mac->type0_pdcch_ss_big_m = big_m; mac->type0_pdcch_ss_first_symbol_index = first_symbol_index; // fill in the elements in config request inside P5 message @@ -400,19 +424,53 @@ int8_t nr_ue_decode_mib( return 0; } +typedef enum seach_space_mask_e { + type0_pdcch = 0x1, + type0a_pdcch = 0x2, + type1_pdcch = 0x4, + type2_pdcch = 0x8 +} search_space_mask_t; + +// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms +#define NUM_SLOT_FRAME 10 + // Performs : // 1. TODO: Call RRC for link status return to PHY // 2. TODO: Perform SR/BSR procedures for scheduling feedback // 3. TODO: Perform PHR procedures - NR_UE_L2_STATE_t nr_ue_scheduler( const module_id_t module_id, const uint8_t gNB_index, const int cc_id, const frame_t rx_frame, const slot_t rx_slot, + const int32_t ssb_index, const frame_t tx_frame, - const slot_t tx_slot){ + const slot_t tx_slot ){ + + uint32_t search_space_mask = 0; + + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + + // check type0 from 38.213 13 + if(ssb_index != -1){ + + if(mac->type0_pdcch_ss_mux_pattern == 1){ + // now bigO and bigM use floating point implementation, after can optimize to use fixed point implementation by change mac_vars table and operation 'multiple' + + + } + if(mac->type0_pdcch_ss_mux_pattern == 2){ + if(ssb_index != -1){ + search_space_mask = search_space_mask & type0_pdcch; + } + } + if(mac->type0_pdcch_ss_mux_pattern == 3){ + if(ssb_index != -1){ + search_space_mask = search_space_mask & type0_pdcch; + } + } + } return CONNECTION_OK; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c3298a8482..b282d95876 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -40,17 +40,17 @@ static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES]; -int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP){ +int8_t handle_bcch_bch(uint8_t *pduP, uint8_t additional_bits, uint32_t ssb_index, uint32_t l_ssb){ // pdu_len = 4, 32bits - uint8_t extra_bits = pduP[0]; + //uint8_t extra_bits = pduP[0]; nr_ue_decode_mib( (module_id_t)0, 0, 0, - extra_bits, - 0, // Lssb = 64 is not support - &pduP[1], - pdu_len ); + additional_bits, + l_ssb, // Lssb = 64 is not support + ssb_index, + &pduP[1] ); @@ -72,6 +72,7 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ul_info->cc_id, ul_info->frame, ul_info->slot, + ul_info->ssb_index, 0, 0); // TODO check tx/rx frame/slot is need for NR version switch(ret){ @@ -92,29 +93,33 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ + int32_t i; module_id_t module_id = dl_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); // clean up scheduled_response structure - //if(dl_info->rx_ind != NULL){ + if(dl_info->rx_ind != NULL){ printf("[L2][IF MODULE][DL INDICATION][RX_IND]\n"); - switch(dl_info->rx_ind.rx_request_body.pdu_index){ - case FAPI_NR_RX_PDU_BCCH_BCH_TYPE: - handle_bcch_bch(dl_info->rx_ind.rx_request_body.pdu_length, dl_info->rx_ind.rx_request_body.pdu); - break; - case FAPI_NR_RX_PDU_BCCH_DLSCH_TYPE: - handle_bcch_dlsch(dl_info->rx_ind.rx_request_body.pdu_length, dl_info->rx_ind.rx_request_body.pdu); - break; - default: - break; + for(i=0; irx_ind->number_pdus; ++i){ + switch(dl_info->rx_ind->rx_request_body[i].pdu_type){ + case FAPI_NR_RX_PDU_BCCH_BCH_TYPE: + handle_bcch_bch(dl_info->rx_ind->rx_request_body[i].mib_pdu.pdu, dl_info->rx_ind->rx_request_body[i].mib_pdu.additional_bits, dl_info->rx_ind->rx_request_body[i].mib_pdu.ssb_index, dl_info->rx_ind->rx_request_body[i].mib_pdu.l_ssb); + break; + case FAPI_NR_RX_PDU_BCCH_DLSCH_TYPE: + + break; + default: + break; + } } - //} + + } - //if(dl_info->dci_ind != NULL){ + if(dl_info->dci_ind != NULL){ - //} + } if(nr_ue_if_module_inst[module_id] != NULL){ nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response); diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 677e494ce6..f1cbb2e1d4 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -48,10 +48,10 @@ typedef struct { /// NR UE FAPI-like P7 message, direction: L1 to L2 /// data reception indication structure - fapi_nr_rx_indication_t rx_ind; + fapi_nr_rx_indication_t *rx_ind; /// dci reception indication structure - fapi_nr_dci_indication_t dci_ind; + fapi_nr_dci_indication_t *dci_ind; } nr_downlink_indication_t; @@ -67,6 +67,8 @@ typedef struct { frame_t frame; /// slot uint32_t slot; + /// ssb_index, if ssb is not present in current TTI, thie value set to -1 + int8_t ssb_index; } nr_uplink_indication_t; // Downlink subframe P7 @@ -177,9 +179,11 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info); /**\brief handle BCCH-BCH message from dl_indication - \param pdu_len length(bytes) of pdu - \param pduP pointer to pdu*/ -int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP); + \param + \param + \param + \param */ +int8_t handle_bcch_bch(uint8_t *pduP, uint8_t additional_bits, uint32_t ssb_index, uint32_t l_ssb); /**\brief handle BCCH-DL-SCH message from dl_indication diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 0ee1b32a4d..f14819778c 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -1807,9 +1807,10 @@ rrc_ue_process_rrcConnectionReconfiguration( LOG_I(RRC,"Radio Resource Configuration is present\n"); rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated); } - - -/* void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8; + +// LTE Rel 15 not yet here +#if Rel15 + void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8; RCCConnectionReconfiguration_v1510_IEs_t *rrc_connection_reconfiguration_v1510_IEs = (RRCConnectionReconfiguration_v1510_IEs_t *)0; // fetch EN-DC for NR_RRC here // r8 @@ -1851,8 +1852,8 @@ rrc_ue_process_rrcConnectionReconfiguration( case nr_Config_r15_PR_setup: // process NR sCell config if(rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15 != (OCTET_STRING_t *)0){ - nr_rrc_ue_decode_rrcReconfiguration( rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15->buffer, - rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15.size); + nr_rrc_ue_decode_secondary_cellgroup_config( rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15->buffer, + rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15.size); } break; @@ -1862,7 +1863,8 @@ rrc_ue_process_rrcConnectionReconfiguration( break; } } - }*/ + } +#endif #if defined(ENABLE_ITTI) diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index dea5301a44..cb8ded1971 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -32,6 +32,7 @@ #include "rrc_defs.h" #include "rrc_proto.h" +#include "assertions.h" typedef uint32_t channel_t; @@ -46,7 +47,7 @@ nr_mac_rrc_data_ind_ue( switch(channel){ case NR_BCCH_BCH: - nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len); + 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; default: break; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 63f8e92845..79ad539d92 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -50,22 +50,34 @@ // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) int8_t nr_rrc_ue_decode_secondary_cellgroup_config( const uint8_t *buffer, - const uint32_t size -){ - NR_CellGroupConfig_t *cellGroupConfig = NULL; + const uint32_t size ){ + + NR_CellGroupConfig_t *cell_group_config = NULL; + uint32_t i; - uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, //might be added prefix later - (void **)&cellGroupConfig, - (uint8_t *)buffer, - size, 0, 0); + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_CellGroupConfig, + (void **)&cell_group_config, + (uint8_t *)buffer, + size ); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + printf("NR_CellGroupConfig decode error\n"); + for (i=0; icell_group_config == NULL){ - NR_UE_rrc_inst->cell_group_config = cellGroupConfig; - nr_rrc_ue_process_scg_config(cellGroupConfig); + NR_UE_rrc_inst->cell_group_config = cell_group_config; + nr_rrc_ue_process_scg_config(cell_group_config); }else{ - nr_rrc_ue_process_scg_config(cellGroupConfig); - SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cellGroupConfig, 0); + nr_rrc_ue_process_scg_config(cell_group_config); + SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 0); } //nr_rrc_mac_config_req_ue( module_id_t module_id, int CC_id, uint8_t gNB_index, NR_MIB_t *mibP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, NR_SpCellConfig_t *spcell_configP ); @@ -263,34 +275,34 @@ int8_t openair_rrc_top_init_ue_nr(void){ int8_t nr_ue_process_rlc_bearer_list(NR_CellGroupConfig_t *cell_group_config){ return 0; -}; +} int8_t nr_ue_process_secondary_cell_list(NR_CellGroupConfig_t *cell_group_config){ return 0; -}; +} int8_t nr_ue_process_mac_cell_group_config(NR_MAC_CellGroupConfig_t *mac_cell_group_config){ return 0; -}; +} int8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *phy_cell_group_config){ return 0; -}; +} int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){ return 0; -}; +} /*brief decode BCCH-BCH (MIB) message*/ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, - const uint8_t buffer_len){ + const uint8_t buffer_len ){ int i; NR_BCCH_BCH_Message_t *bcch_message = NULL; NR_MIB_t *mib = NR_UE_rrc_inst->mib; @@ -305,22 +317,21 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( } asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_NR_BCCH_BCH_Message, - (void **)&bcch_message, - (const void *)bufferP, - buffer_len - ); + &asn_DEF_NR_BCCH_BCH_Message, + (void **)&bcch_message, + (const void *)bufferP, + buffer_len ); if(bcch_message->message.choice.mib->systemFrameNumber.buf != 0){ - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - - for (i=0; i