diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 4ce9b1b140..bb3d4e4b36 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -126,151 +126,225 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; // for PDSCH from TS 38.214 subclause 5.1.2.1.1 -const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]={ - {0,2,12}, // row index 1 - {0,2,10}, // row index 2 - {0,2,9}, // row index 3 - {0,2,7}, // row index 4 - {0,2,5}, // row index 5 - {0,9,4}, // row index 6 - {0,4,4}, // row index 7 - {0,5,7}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,12,2}, // row index 11 - {0,1,13}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,7}, // row index 15 - {0,8,4} // row index 16 +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][4]={ + {1,0,2,12}, // row index 1 + {1,0,2,10}, // row index 2 + {1,0,2,9}, // row index 3 + {1,0,2,7}, // row index 4 + {1,0,2,5}, // row index 5 + {0,0,9,4}, // row index 6 + {0,0,4,4}, // row index 7 + {0,0,5,7}, // row index 8 + {0,0,5,2}, // row index 9 + {0,0,9,2}, // row index 10 + {0,0,12,2}, // row index 11 + {1,0,1,13}, // row index 12 + {1,0,1,6}, // row index 13 + {1,0,2,4}, // row index 14 + {0,0,4,7}, // row index 15 + {0,0,8,4} // row index 16 }; -const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]={ - {0,3,11}, // row index 1 - {0,3,9}, // row index 2 - {0,3,8}, // row index 3 - {0,3,6}, // row index 4 - {0,3,4}, // row index 5 - {0,10,4}, // row index 6 - {0,6,4}, // row index 7 - {0,5,7}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,12,2}, // row index 11 - {0,1,13}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,7}, // row index 15 - {0,8,4} // row index 16 +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][4]={ + {1,0,3,11}, // row index 1 + {1,0,3,9}, // row index 2 + {1,0,3,8}, // row index 3 + {1,0,3,6}, // row index 4 + {1,0,3,4}, // row index 5 + {0,0,10,4}, // row index 6 + {0,0,6,4}, // row index 7 + {0,0,5,7}, // row index 8 + {0,0,5,2}, // row index 9 + {0,0,9,2}, // row index 10 + {0,0,12,2}, // row index 11 + {1,0,1,13}, // row index 12 + {1,0,1,6}, // row index 13 + {1,0,2,4}, // row index 14 + {0,0,4,7}, // row index 15 + {0,0,8,4} // row index 16 }; -const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]={ - {0,2,6}, // row index 1 - {0,2,10}, // row index 2 - {0,2,9}, // row index 3 - {0,2,7}, // row index 4 - {0,2,5}, // row index 5 - {0,6,4}, // row index 6 - {0,4,4}, // row index 7 - {0,5,6}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,10,2}, // row index 11 - {0,1,11}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,6}, // row index 15 - {0,8,4} // row index 16 +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][4]={ + {1,0,2,6}, // row index 1 + {1,0,2,10}, // row index 2 + {1,0,2,9}, // row index 3 + {1,0,2,7}, // row index 4 + {1,0,2,5}, // row index 5 + {0,0,6,4}, // row index 6 + {0,0,4,4}, // row index 7 + {0,0,5,6}, // row index 8 + {0,0,5,2}, // row index 9 + {0,0,9,2}, // row index 10 + {0,0,10,2}, // row index 11 + {1,0,1,11}, // row index 12 + {1,0,1,6}, // row index 13 + {1,0,2,4}, // row index 14 + {0,0,4,6}, // row index 15 + {0,0,8,4} // row index 16 }; -const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]={ - {0,3,5}, // row index 1 - {0,3,9}, // row index 2 - {0,3,8}, // row index 3 - {0,3,6}, // row index 4 - {0,3,4}, // row index 5 - {0,8,2}, // row index 6 - {0,6,4}, // row index 7 - {0,5,6}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,10,2}, // row index 11 - {0,1,11}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,6}, // row index 15 - {0,8,4} // row index 16 +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][4]={ + {1,0,3,5}, // row index 1 + {1,0,3,9}, // row index 2 + {1,0,3,8}, // row index 3 + {1,0,3,6}, // row index 4 + {1,0,3,4}, // row index 5 + {0,0,8,2}, // row index 6 + {0,0,6,4}, // row index 7 + {0,0,5,6}, // row index 8 + {0,0,5,2}, // row index 9 + {0,0,9,2}, // row index 10 + {0,0,10,2}, // row index 11 + {1,0,1,11}, // row index 12 + {1,0,1,6}, // row index 13 + {1,0,2,4}, // row index 14 + {0,0,4,6}, // row index 15 + {0,0,8,4} // row index 16 }; -const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]={ - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {1,2,2}, // row index 6 - {1,4,2}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,2,12}, // row index 14 - {1,2,4}, // row index 15 - {0,0,0} // row index 16 +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][4]={ + {0,0,2,2}, // row index 1 + {0,0,4,2}, // row index 2 + {0,0,6,2}, // row index 3 + {0,0,8,2}, // row index 4 + {0,0,10,2}, // row index 5 + {0,1,2,2}, // row index 6 + {0,1,4,2}, // row index 7 + {0,0,2,4}, // row index 8 + {0,0,4,4}, // row index 9 + {0,0,6,4}, // row index 10 + {0,0,8,4}, // row index 11 + {0,0,10,4}, // row index 12 + {0,0,2,7}, // row index 13 + {1,0,2,12}, // row index 14 + {0,1,2,4}, // row index 15 + {0,0,0,0} // row index 16 }; -const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]={ - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {1,2,2}, // row index 6 - {1,4,2}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,3,11}, // row index 14 - {1,2,4}, // row index 15 - {0,0,0} // row index 16 +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][4]={ + {0,0,2,2}, // row index 1 + {0,0,4,2}, // row index 2 + {0,0,6,2}, // row index 3 + {0,0,8,2}, // row index 4 + {0,0,10,2}, // row index 5 + {0,1,2,2}, // row index 6 + {0,1,4,2}, // row index 7 + {0,0,2,4}, // row index 8 + {0,0,4,4}, // row index 9 + {0,0,6,4}, // row index 10 + {0,0,8,4}, // row index 11 + {0,0,10,4}, // row index 12 + {0,0,2,7}, // row index 13 + {1,0,3,11}, // row index 14 + {0,1,2,4}, // row index 15 + {0,0,0,0} // row index 16 }; -const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]={ - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {0,0,0}, // row index 6 - {0,0,0}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,2,12}, // row index 14 - {0,0,6}, // row index 15 - {0,2,6} // row index 16 +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][4]={ + {0,0,2,2}, // row index 1 + {0,0,4,2}, // row index 2 + {0,0,6,2}, // row index 3 + {0,0,8,2}, // row index 4 + {0,0,10,2}, // row index 5 + {0,0,0,0}, // row index 6 + {0,0,0,0}, // row index 7 + {0,0,2,4}, // row index 8 + {0,0,4,4}, // row index 9 + {0,0,6,4}, // row index 10 + {0,0,8,4}, // row index 11 + {0,0,10,4}, // row index 12 + {0,0,2,7}, // row index 13 + {1,0,2,12}, // row index 14 + {1,0,0,6}, // row index 15 + {1,0,2,6} // row index 16 }; -const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]={ - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {0,0,0}, // row index 6 - {0,0,0}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,3,11}, // row index 14 - {0,0,6}, // row index 15 - {0,2,6} // row index 16 +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][4]={ + {0,0,2,2}, // row index 1 + {0,0,4,2}, // row index 2 + {0,0,6,2}, // row index 3 + {0,0,8,2}, // row index 4 + {0,0,10,2}, // row index 5 + {0,0,0,0}, // row index 6 + {0,0,0,0}, // row index 7 + {0,0,2,4}, // row index 8 + {0,0,4,4}, // row index 9 + {0,0,6,4}, // row index 10 + {0,0,8,4}, // row index 11 + {0,0,10,4}, // row index 12 + {0,0,2,7}, // row index 13 + {1,0,3,11}, // row index 14 + {1,0,0,6}, // row index 15 + {1,0,2,6} // row index 16 }; +void get_info_from_tda_tables(int default_abc, + int tda, + int dmrs_TypeA_Position, + int normal_CP, + int *startSymbolIndex, + int *nrOfSymbols) { + int k0 = 0; + int is_mapping_typeA = 1; + switch(default_abc){ + case 1: + if (normal_CP){ + if (dmrs_TypeA_Position){ + is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][0]; + k0 = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][3]; + } + else{ + is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][0]; + k0 = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][3]; + } + } + else{ + if (dmrs_TypeA_Position){ + is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][0]; + k0 = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][3]; + } + else{ + is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][0]; + k0 = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][3]; + } + } + break; + case 2: + if (dmrs_TypeA_Position){ + is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][0]; + k0 = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][3]; + } + else{ + is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][0]; + k0 = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][3]; + } + break; + case 3: + if (dmrs_TypeA_Position){ + is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][0]; + k0 = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][3]; + } + else{ + is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][0]; + k0 = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][1]; + *startSymbolIndex = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][2]; + *nrOfSymbols = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][3]; + } + break; + default: + AssertFatal(1==0,"Invalid default time domaing allocation type\n"); + } + AssertFatal(k0==0,"Only k0 = 0 is supported\n"); + AssertFatal(is_mapping_typeA==1,"Only mapping type A is currently supported\n"); +} + const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; const char *duplex_mode[]={"FDD","TDD"}; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 0470abe355..b83dd70260 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -140,6 +140,13 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb); +void get_info_from_tda_tables(int default_abc, + int tda, + int dmrs_TypeA_Position, + int normal_CP, + int *startSymbolIndex, + int *nrOfSymbols); + void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config); uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int L); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 1e0ab98d4c..8f7a726bb8 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -139,13 +139,4 @@ extern const float table_38213_13_12_c3[16]; extern const int32_t table_38213_10_1_1_c2[5]; -extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]; -extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]; -extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]; -extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]; -extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]; -extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]; -extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]; -extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]; - #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 0f0e787c2e..0e0bc66cce 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -182,6 +182,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint8_t time_domain_ind, + int default_abc, bool use_default); uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8fbb94d45c..c292f97746 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -268,13 +268,14 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, uint8_t time_domain_ind, + int default_abc, bool use_default){ int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; // uint8_t k_offset=0; - uint8_t sliv_S=0; - uint8_t sliv_L=0; + int sliv_S=0; + int sliv_L=0; uint8_t mu_pusch = 1; // definition table j Table 6.1.2.1.1-4 @@ -349,25 +350,14 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, } else {// Default configuration from tables -// k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; - if(dmrs_typeA_pos == 0) { - sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][1]; - sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][2]; - } else { - sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][1]; - sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][2]; - } + get_info_from_tda_tables(default_abc, + time_domain_ind, + dmrs_typeA_pos, + 1, // normal CP + &sliv_S, + &sliv_L); - // k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; - // sliv_S = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; - // sliv_L = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - // k_offset = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][0]; - // sliv_S = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][1]; - // sliv_L = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][2]; - // k_offset = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][0]; - // sliv_S = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][1]; - // sliv_L = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][2]; dlsch_config_pdu->number_symbols = sliv_L; dlsch_config_pdu->start_symbol = sliv_S; } @@ -449,6 +439,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr RA_config_t *ra = &mac->ra; fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; uint8_t is_Msg3 = 0; + int default_abc = 1; uint16_t n_RB_DLBWP; if (mac->DLbwp[0]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -624,6 +615,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr uint16_t BWPSize = 0; if(rnti == SI_RNTI) { + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config; + default_abc = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; @@ -673,7 +666,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,rnti==SI_RNTI) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,default_abc,rnti==SI_RNTI) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } @@ -864,7 +857,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,false) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,0,false) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index dcc88b5e29..c30e7dae81 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -709,7 +709,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val,false) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val,0,false) < 0) { return -1; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a932551557..0a4f053817 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -309,14 +309,14 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart } -void schedule_control_sib1(module_id_t module_id, - int CC_id, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - int time_domain_allocation, - uint8_t mcsTableIdx, - uint8_t mcs, - uint8_t candidate_idx, - int num_total_bytes) { +uint32_t schedule_control_sib1(module_id_t module_id, + int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + int time_domain_allocation, + int startSymbolIndex, + int nrOfSymbols, + uint8_t candidate_idx, + int num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; @@ -336,8 +336,8 @@ void schedule_control_sib1(module_id_t module_id, } gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; - gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; - gNB_mac->sched_ctrlCommon->mcs = mcs; + gNB_mac->sched_ctrlCommon->mcsTableIdx = 0; + gNB_mac->sched_ctrlCommon->mcs = 0; // starting from mcs 0 gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; uint8_t nr_of_candidates; @@ -356,16 +356,6 @@ void schedule_control_sib1(module_id_t module_id, const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; int rbStart = type0_PDCCH_CSS_config->cset_start_rb; - int startSymbolIndex = 0; - int nrOfSymbols = 0; - if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { - startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; - nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; - } else { - startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; - nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; - } - if (nrOfSymbols == 2) { gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; } else { @@ -383,25 +373,37 @@ void schedule_control_sib1(module_id_t module_id, int rbSize = 0; uint32_t TBS = 0; do { - rbSize++; + if(rbSize < bwpSize && !vrb_map[rbStart + rbSize]) + rbSize++; + else{ + if (gNB_mac->sched_ctrlCommon->mcs<10) + gNB_mac->sched_ctrlCommon->mcs++; + else + break; + } TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; - } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + } while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + + AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes,"Couldn't allocate enough resources for %d bytes in SIB1 PDSCH\n", + gNB_mac->sched_ctrlCommon->num_total_bytes); gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; - LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); - LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); - LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); - LOG_D(MAC,"TBS = %i\n", TBS); - LOG_D(MAC,"dmrs_length %d\n",dmrs_length); - LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); + LOG_I(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->mcs); + LOG_I(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_I(MAC,"nrOfSymbols = %i\n", nrOfSymbols); + LOG_I(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + LOG_I(MAC,"TBS = %i\n", TBS); + LOG_I(MAC,"dmrs_length %d\n",dmrs_length); + LOG_I(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + rbStart] = 1; } + return TBS; } void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, @@ -547,8 +549,6 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // TODO: Get these values from RRC const int CC_id = 0; int time_domain_allocation = 0; - uint8_t mcsTableIdx = 0; - uint8_t mcs = 6; uint8_t candidate_idx = 0; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; @@ -588,27 +588,22 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) LOG_D(NR_MAC,"SIB1: \n"); for (int k=0;kcommon_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { - startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; - nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; - } else { - startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1]; - nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2]; - } - - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex); - uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); - const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; - + + get_info_from_tda_tables(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern, + time_domain_allocation, + gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, + 1, &startSymbolIndex, &nrOfSymbols); + + // Configure sched_ctrlCommon for SIB1 + uint32_t TBS = schedule_control_sib1(module_idP, CC_id, + type0_PDCCH_CSS_config, + time_domain_allocation, + startSymbolIndex, + nrOfSymbols, + candidate_idx, sib1_sdu_length); + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 9ea9806048..ee35768584 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -69,14 +69,14 @@ void nr_schedule_ue_spec(module_id_t module_id, frame_t frame, sub_frame_t slot); -void schedule_control_sib1(module_id_t module_id, - int CC_id, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - int time_domain_allocation, - uint8_t mcsTableIdx, - uint8_t mcs, - uint8_t candidate_idx, - int num_total_bytes); +uint32_t schedule_control_sib1(module_id_t module_id, + int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + int time_domain_allocation, + int startSymbolIndex, + int nrOfSymbols, + uint8_t candidate_idx, + int num_total_bytes); void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);