Commit df7acb2a authored by Calvin HSU's avatar Calvin HSU

silence asn1c warnings. UE: update rx_ind and fix type0-pdcch

parent 94d14b43
Pipeline #10228 failed with stage
in 0 seconds
...@@ -361,11 +361,14 @@ message( FATAL_ERROR "The script ${asn1c_call} must be present" ) ...@@ -361,11 +361,14 @@ message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call}) 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}") 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} execute_process(COMMAND ${asn1c_call}
${NR_RRC_FULL_DIR} ${NR_RRC_FULL_DIR}
${NR_RRC_GRAMMAR} ${NR_RRC_GRAMMAR}
NR_RRC NR_RRC
RESULT_VARIABLE ret) RESULT_VARIABLE ret
OUTPUT_QUIET
ERROR_QUIET )
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error") message(FATAL_ERROR "${asn1c_call}: error")
...@@ -374,7 +377,6 @@ endif (NOT ${ret} STREQUAL 0) ...@@ -374,7 +377,6 @@ endif (NOT ${ret} STREQUAL 0)
if(NOT EXISTS ${fix_asn1c_call}) if(NOT EXISTS ${fix_asn1c_call})
message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
endif(NOT EXISTS ${fix_asn1c_call}) endif(NOT EXISTS ${fix_asn1c_call})
execute_process(COMMAND ${fix_asn1c_call} execute_process(COMMAND ${fix_asn1c_call}
${NR_RRC_FULL_DIR} ${NR_RRC_FULL_DIR}
NR_RRC NR_RRC
...@@ -398,6 +400,7 @@ include_directories ("${NR_RRC_FULL_DIR}") ...@@ -398,6 +400,7 @@ include_directories ("${NR_RRC_FULL_DIR}")
# add the command to generate the source code # 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 # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
add_custom_command ( add_custom_command (
OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h
COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} RRC 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 ...@@ -434,7 +437,11 @@ message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -ge
execute_process(COMMAND mkdir -p ${S1AP_C_DIR} 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} 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) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error") message(FATAL_ERROR "${ret}: error")
...@@ -499,7 +506,9 @@ message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER - ...@@ -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} 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} 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} #execute_process(COMMAND ${asn1c_call}
# ${X2AP_C_DIR} # ${X2AP_C_DIR}
...@@ -1458,6 +1467,7 @@ set(NR_L2_SRC_UE ...@@ -1458,6 +1467,7 @@ set(NR_L2_SRC_UE
${NR_UE_RRC_DIR}/main_ue.c ${NR_UE_RRC_DIR}/main_ue.c
${NR_UE_RRC_DIR}/rrc_UE.c ${NR_UE_RRC_DIR}/rrc_UE.c
# ${NR_UE_RRC_DIR}/mac_vars.c # ${NR_UE_RRC_DIR}/mac_vars.c
#${RRC_DIR}/rrc_UE.c
) )
set (MAC_SRC set (MAC_SRC
......
...@@ -186,7 +186,7 @@ typedef struct { ...@@ -186,7 +186,7 @@ typedef struct {
uint8_t dci_type; uint8_t dci_type;
uint8_t dci_size; uint8_t dci_size;
fapi_nr_dci_pdu_rel15_t dci; fapi_nr_dci_pdu_rel15_t dci;
}fapi_nr_dci_indication_pdu_t; } fapi_nr_dci_indication_pdu_t;
typedef struct { typedef struct {
fapi_nr_tl_t tl; fapi_nr_tl_t tl;
...@@ -201,20 +201,41 @@ typedef struct { ...@@ -201,20 +201,41 @@ typedef struct {
fapi_nr_dci_indication_body_t dci_indication_body; fapi_nr_dci_indication_body_t dci_indication_body;
} fapi_nr_dci_indication_t; } 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 { typedef struct {
fapi_nr_tl_t tl; fapi_nr_tl_t tl;
uint32_t pdu_index; uint8_t pdu_type;
uint32_t pdu_length; union {
uint8_t* pdu; 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; } fapi_nr_rx_request_body_t;
#define FAPI_NR_TX_REQUEST_BODY_TAG 0x2022
/// ///
typedef struct { typedef struct {
fapi_nr_p7_message_header_t header; fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot; 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; } fapi_nr_rx_indication_t;
typedef struct { typedef struct {
...@@ -225,21 +246,18 @@ typedef struct { ...@@ -225,21 +246,18 @@ typedef struct {
} fapi_nr_tx_config_t; } fapi_nr_tx_config_t;
#define FAPI_NR_TX_MAX_SEGMENTS 32
typedef struct { typedef struct {
uint16_t pdu_length; uint16_t pdu_length;
uint16_t pdu_index; uint16_t pdu_index;
uint8_t* pdu; uint8_t* pdu;
} fapi_nr_tx_request_pdu_t; } fapi_nr_tx_request_pdu_t;
#define FAPI_NR_RX_IND_MAX_PDU 100
typedef struct { typedef struct {
fapi_nr_tl_t tl; fapi_nr_tl_t tl;
fapi_nr_tx_config_t tx_config; fapi_nr_tx_config_t tx_config;
uint16_t number_of_pdus; uint16_t number_of_pdus;
fapi_nr_tx_request_pdu_t* tx_pdu_list; fapi_nr_tx_request_pdu_t* tx_pdu_list;
} fapi_nr_tx_request_body_t; } fapi_nr_tx_request_body_t;
#define FAPI_NR_RX_INDICATION_BODY_TAG 0x2023
/// ///
typedef struct { typedef struct {
......
...@@ -701,9 +701,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -701,9 +701,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
} }
//#endif //#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_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_length = 3;
ue->dl_indication.rx_ind.rx_request_body.pdu = &decoded_output[0]; //ue->dl_indication.rx_ind.rx_request_body.pdu = &decoded_output[0];
ue->if_inst->dl_indication(&ue->dl_indication); //ue->if_inst->dl_indication(&ue->dl_indication);
} }
...@@ -59,6 +59,13 @@ ...@@ -59,6 +59,13 @@
#define NB_NR_UE_MAC_INST 1 #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 */ /*!\brief Top level UE MAC structure */
typedef struct { typedef struct {
...@@ -72,12 +79,16 @@ typedef struct { ...@@ -72,12 +79,16 @@ typedef struct {
NR_MIB_t *mib; NR_MIB_t *mib;
/// Type0-PDCCH seach space coreset /// 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; 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; 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; 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 /// Type0-PDCCH seach space
......
...@@ -49,9 +49,9 @@ int8_t nr_ue_decode_mib( ...@@ -49,9 +49,9 @@ int8_t nr_ue_decode_mib(
int cc_id, int cc_id,
uint8_t gNB_index, uint8_t gNB_index,
uint8_t extra_bits, uint8_t extra_bits,
uint32_t l_ssb_equal_64, uint32_t ssb_length,
void *pduP, uint32_t ssb_index,
uint16_t pdu_len); 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) /**\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( ...@@ -94,12 +94,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(
const int cc_id, const int cc_id,
const frame_t rx_frame, const frame_t rx_frame,
const slot_t rx_slot, const slot_t rx_slot,
const int32_t ssb_index,
const frame_t tx_frame, const frame_t tx_frame,
const slot_t tx_slot); const slot_t tx_slot);
#endif
/* \brief Get SR payload (0,1) from UE MAC /* \brief Get SR payload (0,1) from UE MAC
@param Mod_id Instance id of UE in machine @param Mod_id Instance id of UE in machine
...@@ -112,4 +110,5 @@ NR_UE_L2_STATE_t nr_ue_scheduler( ...@@ -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, 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); uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe);
/** @}*/ #endif
/** @}*/
\ No newline at end of file
...@@ -79,12 +79,12 @@ const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserv ...@@ -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_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 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 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 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 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
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "assertions.h" #include "assertions.h"
#include <stdio.h> #include <stdio.h>
#include <math.h>
typedef enum subcarrier_spacing_e { typedef enum subcarrier_spacing_e {
scs_15kHz = 0x1, scs_15kHz = 0x1,
...@@ -59,23 +60,29 @@ typedef enum frequency_range_e { ...@@ -59,23 +60,29 @@ typedef enum frequency_range_e {
FR2 FR2
} frequency_range_t; } 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( int8_t nr_ue_decode_mib(
module_id_t module_id, module_id_t module_id,
int cc_id, int cc_id,
uint8_t gNB_index, uint8_t gNB_index,
uint8_t extra_bits, // 8bits 38.212 c7.1.1 uint8_t extra_bits, // 8bits 38.212 c7.1.1
uint32_t l_ssb_equal_64, uint32_t ssb_length,
//uint32_t *ssb_index, // from decoded MIB uint32_t ssb_index,
//uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1) void *pduP ){
void *pduP, // encoded MIB
uint16_t pdu_len){
printf("[L2][MAC] decode mib\n"); printf("[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);
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 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){ if(mac->mib != NULL){
...@@ -86,13 +93,13 @@ int8_t nr_ue_decode_mib( ...@@ -86,13 +93,13 @@ int8_t nr_ue_decode_mib(
uint32_t ssb_subcarrier_offset = mac->mib->ssb_SubcarrierOffset; 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 << 4;
frame = frame | frame_number_4lsb; frame = frame | frame_number_4lsb;
if(l_ssb_equal_64){ if(ssb_length == 64){
ssb_index = (( extra_bits >> 5 ) & 0x7 ); // extra bits[5:7] ssb_index = ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] }
}else{ }else{
if(ssb_subcarrier_offset_msb){ if(ssb_subcarrier_offset_msb){
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
...@@ -120,7 +127,6 @@ int8_t nr_ue_decode_mib( ...@@ -120,7 +127,6 @@ int8_t nr_ue_decode_mib(
frequency_range_t frequency_range = FR1; frequency_range_t frequency_range = FR1;
uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1 >> 4) & 0xf; uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1 >> 4) & 0xf;
uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1 & 0xf); uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1 & 0xf);
int32_t num_rbs = -1; int32_t num_rbs = -1;
int32_t num_symbols = -1; int32_t num_symbols = -1;
int32_t rb_offset = -1; int32_t rb_offset = -1;
...@@ -243,30 +249,44 @@ int8_t nr_ue_decode_mib( ...@@ -243,30 +249,44 @@ int8_t nr_ue_decode_mib(
AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined");
uint32_t cell_id = 0; // obtain from L1 later uint32_t cell_id = 0; // obtain from L1 later
mac->type0_pdcch_ss.coreset.rb_start = rb_offset; mac->type0_pdcch_coreset.rb_start = rb_offset;
mac->type0_pdcch_ss.coreset.rb_end = rb_offset + num_rbs - 1; mac->type0_pdcch_coreset.rb_end = rb_offset + num_rbs - 1;
mac->type0_pdcch_ss.coreset.duration = num_symbols; mac->type0_pdcch_coreset.duration = num_symbols;
mac->type0_pdcch_ss.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; mac->type0_pdcch_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_coreset.cce_reg_interleaved_reg_bundle_size = 6; // L
mac->type0_pdcch_ss.coreset.cce_reg_interleaved_interleaver_size = 2; // R mac->type0_pdcch_coreset.cce_reg_interleaved_interleaver_size = 2; // R
mac->type0_pdcch_ss.coreset.cce_reg_interleaved_shift_index = cell_id; mac->type0_pdcch_coreset.cce_reg_interleaved_shift_index = cell_id;
mac->type0_pdcch_ss.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; mac->type0_pdcch_coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
mac->type0_pdcch_ss.coreset.pdcch_dmrs_scrambling_id = cell_id; mac->type0_pdcch_coreset.pdcch_dmrs_scrambling_id = cell_id;
// type0-pdcch search space // type0-pdcch search space
float big_o; float big_o;
uint32_t number_of_search_space_per_slot;
float big_m; 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; uint32_t first_symbol_index;
const uint32_t scs_index = 0;
const uint32_t num_slot_per_frame = 10;
/// MUX PATTERN 1 /// MUX PATTERN 1
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
big_o = table_38213_13_11_c1[index_4lsb]; big_o = table_38213_13_11_c1[index_4lsb];
number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
big_m = table_38213_13_11_c3[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)){ if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){
first_symbol_index = num_symbols; first_symbol_index = num_symbols;
}else{ }else{
...@@ -291,12 +311,13 @@ int8_t nr_ue_decode_mib( ...@@ -291,12 +311,13 @@ int8_t nr_ue_decode_mib(
/// MUX PATTERN 2 /// MUX PATTERN 2
if(mac->type0_pdcch_ss_mux_pattern == 2){ if(mac->type0_pdcch_ss_mux_pattern == 2){
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){
// 38.213 Table 13-13 // 38.213 Table 13-13
AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); 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 // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
// TODO Type0SS_frame = SSB_frame sfn_c = SFN_C_EQ_SFN_SSB;
// TODO Type0SS_slot = SSB_slot n_c = get_ssb_slot(ssb_index);
switch(ssb_index & 0x3){ // ssb_index(i) mod 4 switch(ssb_index & 0x3){ // ssb_index(i) mod 4
case 0: case 0:
first_symbol_index = 0; first_symbol_index = 0;
...@@ -317,7 +338,8 @@ int8_t nr_ue_decode_mib( ...@@ -317,7 +338,8 @@ int8_t nr_ue_decode_mib(
// 38.213 Table 13-14 // 38.213 Table 13-14
AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); 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 // 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 switch(ssb_index & 0x7){ // ssb_index(i) mod 8
case 0: case 0:
first_symbol_index = 0; first_symbol_index = 0;
...@@ -333,11 +355,11 @@ int8_t nr_ue_decode_mib( ...@@ -333,11 +355,11 @@ int8_t nr_ue_decode_mib(
break; break;
case 4: case 4:
first_symbol_index = 12; first_symbol_index = 12;
// TODO Type0SS_slot = SSB_slot - 1 n_c = get_ssb_slot(ssb_index) - 1;
break; break;
case 5: case 5:
first_symbol_index = 13; first_symbol_index = 13;
// TODO Type0SS_slot = SSB_slot - 1 n_c = get_ssb_slot(ssb_index) - 1;
break; break;
case 6: case 6:
first_symbol_index = 0; first_symbol_index = 0;
...@@ -356,8 +378,8 @@ int8_t nr_ue_decode_mib( ...@@ -356,8 +378,8 @@ int8_t nr_ue_decode_mib(
// 38.213 Table 13-15 // 38.213 Table 13-15
AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); 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 // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
// TODO Type0SS_frame = SSB_frame sfn_c = SFN_C_EQ_SFN_SSB;
// TODO Type0SS_slot = SSB_slot n_c = get_ssb_slot(ssb_index);
switch(ssb_index & 0x3){ // ssb_index(i) mod 4 switch(ssb_index & 0x3){ // ssb_index(i) mod 4
case 0: case 0:
first_symbol_index = 4; first_symbol_index = 4;
...@@ -376,9 +398,11 @@ int8_t nr_ue_decode_mib( ...@@ -376,9 +398,11 @@ int8_t nr_ue_decode_mib(
}else{ ; } }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_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; mac->type0_pdcch_ss_first_symbol_index = first_symbol_index;
// fill in the elements in config request inside P5 message // fill in the elements in config request inside P5 message
...@@ -400,19 +424,53 @@ int8_t nr_ue_decode_mib( ...@@ -400,19 +424,53 @@ int8_t nr_ue_decode_mib(
return 0; 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 : // Performs :
// 1. TODO: Call RRC for link status return to PHY // 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback // 2. TODO: Perform SR/BSR procedures for scheduling feedback
// 3. TODO: Perform PHR procedures // 3. TODO: Perform PHR procedures
NR_UE_L2_STATE_t nr_ue_scheduler( NR_UE_L2_STATE_t nr_ue_scheduler(
const module_id_t module_id, const module_id_t module_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const int cc_id, const int cc_id,
const frame_t rx_frame, const frame_t rx_frame,
const slot_t rx_slot, const slot_t rx_slot,
const int32_t ssb_index,
const frame_t tx_frame, 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; return CONNECTION_OK;
......
...@@ -40,17 +40,17 @@ ...@@ -40,17 +40,17 @@
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES]; 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 // pdu_len = 4, 32bits
uint8_t extra_bits = pduP[0]; //uint8_t extra_bits = pduP[0];
nr_ue_decode_mib( (module_id_t)0, nr_ue_decode_mib( (module_id_t)0,
0, 0,
0, 0,
extra_bits, additional_bits,
0, // Lssb = 64 is not support l_ssb, // Lssb = 64 is not support
&pduP[1], ssb_index,
pdu_len ); &pduP[1] );
...@@ -72,6 +72,7 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -72,6 +72,7 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
ul_info->cc_id, ul_info->cc_id,
ul_info->frame, ul_info->frame,
ul_info->slot, ul_info->slot,
ul_info->ssb_index,
0, 0); // TODO check tx/rx frame/slot is need for NR version 0, 0); // TODO check tx/rx frame/slot is need for NR version
switch(ret){ switch(ret){
...@@ -92,29 +93,33 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -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){ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
int32_t i;