definition of config request fapi structures in UE and acquisition from rrc of config data (work in progress)
This commit is contained in:
+13
-6
@@ -812,15 +812,23 @@ if (slot_nr==18)
|
||||
void init_NR_UE(int nb_inst, char* rrc_config_path) {
|
||||
int inst;
|
||||
NR_UE_MAC_INST_t *mac_inst;
|
||||
|
||||
for (inst=0; inst < nb_inst; inst++) {
|
||||
nr_l3_init_ue(rrc_config_path);
|
||||
nr_l2_init_ue();
|
||||
mac_inst = get_mac_inst(inst);
|
||||
AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initial IF module\n");
|
||||
}
|
||||
}
|
||||
|
||||
void init_NR_UE_threads(int nb_inst) {
|
||||
int inst;
|
||||
|
||||
pthread_t threads[nb_inst];
|
||||
|
||||
for (inst=0; inst < nb_inst; inst++) {
|
||||
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
|
||||
AssertFatal((UE->if_inst = nr_ue_if_module_init(inst)) != NULL, "can not initial IF module\n");
|
||||
nr_l3_init_ue(rrc_config_path);
|
||||
nr_l2_init_ue();
|
||||
mac_inst = get_mac_inst(inst);
|
||||
mac_inst->if_module = UE->if_inst;
|
||||
|
||||
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
|
||||
threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX);
|
||||
|
||||
@@ -833,4 +841,3 @@ void init_NR_UE(int nb_inst, char* rrc_config_path) {
|
||||
|
||||
printf("UE threads created by %ld\n", gettid());
|
||||
}
|
||||
|
||||
|
||||
@@ -680,13 +680,19 @@ int main( int argc, char **argv ) {
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
|
||||
init_opt() ;
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
init_pdcp();
|
||||
|
||||
if (ouput_vcd) {
|
||||
vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd");
|
||||
}
|
||||
|
||||
#ifndef PACKAGE_VERSION
|
||||
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
|
||||
#endif
|
||||
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
init_NR_UE(1,rrc_config_path);
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
init_pdcp();
|
||||
/*
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
netlink_init();
|
||||
@@ -695,10 +701,6 @@ int main( int argc, char **argv ) {
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
#ifndef PACKAGE_VERSION
|
||||
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
|
||||
#endif
|
||||
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
// init the parameters
|
||||
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
@@ -722,7 +724,7 @@ int main( int argc, char **argv ) {
|
||||
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
||||
|
||||
UE[CC_id]->mac_enabled = 1;
|
||||
|
||||
UE[CC_id]->if_inst = nr_ue_if_module_init(0);
|
||||
UE[CC_id]->UE_scan = UE_scan;
|
||||
UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
|
||||
UE[CC_id]->UE_fo_compensation = UE_fo_compensation;
|
||||
@@ -768,7 +770,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
// wait for end of program
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
init_NR_UE(1,rrc_config_path);
|
||||
init_NR_UE_threads(1);
|
||||
|
||||
while(true)
|
||||
sleep(3600);
|
||||
|
||||
@@ -99,6 +99,7 @@ extern int T_dont_fork;
|
||||
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
extern void fill_ue_band_info(void);
|
||||
extern void init_NR_UE(int, char*);
|
||||
extern void init_NR_UE_threads(int);
|
||||
extern void reset_opp_meas(void);
|
||||
extern void print_opp_meas(void);
|
||||
void *UE_thread(void *arg);
|
||||
|
||||
@@ -840,9 +840,116 @@ typedef struct {
|
||||
#define FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_DEDICATED 0x08
|
||||
#define FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_DEDICATED 0x10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t dl_bandwidth;//Carrier bandwidth for DL in MHz [38.104, sec 5.3.2] Values: 5, 10, 15, 20, 25, 30, 40,50, 60, 70, 80,90,100,200,400
|
||||
uint32_t dl_frequency; //Absolute frequency of DL point A in KHz [38.104, sec5.2 and 38.211 sec 4.4.4.2] Value: 450000 -> 52600000
|
||||
uint16_t dl_k0[5];//𝑘_{0}^{𝜇} for each of the numerologies [38.211, sec 5.3.1] Value: 0 ->23699
|
||||
uint16_t dl_grid_size[5];//Grid size 𝑁_{𝑔𝑟𝑖𝑑}^{𝑠𝑖𝑧𝑒,𝜇} for each of the numerologies [38.211, sec 4.4.2] Value: 0->275 0 = this numerology not used
|
||||
uint16_t num_tx_ant;//Number of Tx antennas
|
||||
uint16_t uplink_bandwidth;//Carrier bandwidth for UL in MHz. [38.104, sec 5.3.2] Values: 5, 10, 15, 20, 25, 30, 40,50, 60, 70, 80,90,100,200,400
|
||||
uint32_t uplink_frequency;//Absolute frequency of UL point A in KHz [38.104, sec5.2 and 38.211 sec 4.4.4.2] Value: 450000 -> 52600000
|
||||
uint16_t ul_k0[5];//𝑘0 𝜇 for each of the numerologies [38.211, sec 5.3.1] Value: : 0 ->23699
|
||||
uint16_t ul_grid_size[5];//Grid size 𝑁𝑔𝑟𝑖𝑑 𝑠𝑖𝑧𝑒,𝜇 for each of the numerologies [38.211, sec 4.4.2]. Value: 0->275 0 = this numerology not used
|
||||
uint16_t num_rx_ant;//
|
||||
uint8_t frequency_shift_7p5khz;//Indicates presence of 7.5KHz frequency shift. Value: 0 = false 1 = true
|
||||
|
||||
} fapi_nr_ue_carrier_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t phy_cell_id;//Physical Cell ID, 𝑁_{𝐼𝐷}^{𝑐𝑒𝑙𝑙} [38.211, sec 7.4.2.1] Value: 0 ->1007
|
||||
uint8_t frame_duplex_type;//Frame duplex type Value: 0 = FDD 1 = TDD
|
||||
|
||||
} fapi_nr_cell_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
|
||||
uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
|
||||
uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
|
||||
|
||||
} fapi_nr_ssb_config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ssb_mask;//Bitmap for actually transmitted SSB. MSB->LSB of first 32 bit number corresponds to SSB 0 to SSB 31 MSB->LSB of second 32 bit number corresponds to SSB 32 to SSB 63 Value for each bit: 0: not transmitted 1: transmitted
|
||||
|
||||
} fapi_nr_ssb_mask_size_2_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int8_t beam_id[64];//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63
|
||||
|
||||
} fapi_nr_ssb_mask_size_64_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t ssb_offset_point_a;//Offset of lowest subcarrier of lowest resource block used for SS/PBCH block. Given in PRB [38.211, section 4.4.4.2] Value: 0->2199
|
||||
uint8_t beta_pss;//PSS EPRE to SSS EPRE in a SS/PBCH block [38.213, sec 4.1] Values: 0 = 0dB
|
||||
uint8_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160
|
||||
uint8_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31
|
||||
uint32_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1]
|
||||
fapi_nr_ssb_mask_size_2_t ssb_mask_list[2];
|
||||
fapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64
|
||||
uint8_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled
|
||||
uint8_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled
|
||||
|
||||
} fapi_nr_ssb_table_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t slot_config;//For each symbol in each slot a uint8_t value is provided indicating: 0: DL slot 1: UL slot 2: Guard slot
|
||||
|
||||
} fapi_nr_max_num_of_symbol_per_slot_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fapi_nr_max_num_of_symbol_per_slot_t* max_num_of_symbol_per_slot_list;
|
||||
|
||||
} fapi_nr_max_tdd_periodicity_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t tdd_period;//DL UL Transmission Periodicity. Value:0: ms0p5 1: ms0p625 2: ms1 3: ms1p25 4: ms2 5: ms2p5 6: ms5 7: ms10 8: ms3 9: ms4
|
||||
fapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list;
|
||||
|
||||
} fapi_nr_tdd_table_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t num_prach_fd_occasions;
|
||||
uint16_t prach_root_sequence_index;//Starting logical root sequence index, 𝑖, equivalent to higher layer parameter prach-RootSequenceIndex [38.211, sec 6.3.3.1] Value: 0 -> 837
|
||||
uint8_t num_root_sequences;//Number of root sequences for a particular FD occasion that are required to generate the necessary number of preambles
|
||||
uint16_t k1;//Frequency offset (from UL bandwidth part) for each FD. [38.211, sec 6.3.3.2] Value: from 0 to 272
|
||||
uint8_t prach_zero_corr_conf;//PRACH Zero CorrelationZone Config which is used to dervive 𝑁𝑐𝑠 [38.211, sec 6.3.3.1] Value: from 0 to 15
|
||||
uint8_t num_unused_root_sequences;//Number of unused sequences available for noise estimation per FD occasion. At least one unused root sequence is required per FD occasion.
|
||||
uint8_t* unused_root_sequences_list;//Unused root sequence or sequences per FD occasion. Required for noise estimation.
|
||||
|
||||
} fapi_nr_num_prach_fd_occasions_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t prach_sequence_length;//RACH sequence length. Only short sequence length is supported for FR2. [38.211, sec 6.3.3.1] Value: 0 = Long sequence 1 = Short sequence
|
||||
uint8_t prach_sub_c_spacing;//Subcarrier spacing of PRACH. [38.211 sec 4.2] Value:0->4
|
||||
uint8_t restricted_set_config;//PRACH restricted set config Value: 0: unrestricted 1: restricted set type A 2: restricted set type B
|
||||
uint8_t num_prach_fd_occasions;//Corresponds to the parameter 𝑀 in [38.211, sec 6.3.3.2] which equals the higher layer parameter msg1FDM Value: 1,2,4,8
|
||||
fapi_nr_num_prach_fd_occasions_t* num_prach_fd_occasions_list;
|
||||
uint8_t ssb_per_rach;//SSB-per-RACH-occasion Value: 0: 1/8 1:1/4, 2:1/2 3:1 4:2 5:4, 6:8 7:16
|
||||
uint8_t prach_multiple_carriers_in_a_band;//0 = disabled 1 = enabled
|
||||
|
||||
} fapi_nr_prach_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t config_mask;
|
||||
|
||||
fapi_nr_ue_carrier_config_t carrier_config;
|
||||
fapi_nr_cell_config_t cell_config;
|
||||
fapi_nr_ssb_config_t ssb_config;
|
||||
fapi_nr_ssb_table_t ssb_table;
|
||||
fapi_nr_tdd_table_t tdd_table;
|
||||
fapi_nr_prach_config_t prach_config;
|
||||
|
||||
fapi_nr_pbch_config_t pbch_config; // MIB
|
||||
|
||||
fapi_nr_dl_bwp_common_config_t dl_bwp_common;
|
||||
|
||||
@@ -932,7 +932,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
// enable MIB/SIB decoding by default
|
||||
ue->decode_MIB = 1;
|
||||
ue->decode_SIB = 1;
|
||||
ue->ssb_periodicity = 5; // initialization of ssb periodicity to 5ms according to TS38.213 section 4.1
|
||||
init_prach_tables(839);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -870,7 +870,6 @@ typedef struct {
|
||||
|
||||
nr_ue_if_module_t *if_inst;
|
||||
|
||||
//nfapi_nr_config_request_t nrUE_config; <-- don't use config type for gNB!!!
|
||||
fapi_nr_config_request_t nrUE_config;
|
||||
|
||||
// the following structures are not part of PHY_vars_UE anymore as it is not thread safe. They are now on the stack of the functions that actually need them
|
||||
@@ -1001,7 +1000,6 @@ typedef struct {
|
||||
// uint8_t prach_timer;
|
||||
uint8_t decode_SIB;
|
||||
uint8_t decode_MIB;
|
||||
uint8_t ssb_periodicity;
|
||||
/// temporary offset during cell search prior to MIB decoding
|
||||
int ssb_offset;
|
||||
uint16_t symbol_offset; // offset in terms of symbols for detected ssb in sync
|
||||
|
||||
@@ -195,43 +195,9 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
|
||||
|
||||
fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config;
|
||||
|
||||
if(phy_config != NULL){
|
||||
if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_PBCH){
|
||||
LOG_I(MAC,"[L1][IF module][PHY CONFIG]\n");
|
||||
LOG_I(MAC,"subcarrier spacing: %d\n", phy_config->config_req.pbch_config.subcarrier_spacing_common);
|
||||
LOG_I(MAC,"ssb carrier offset: %d\n", phy_config->config_req.pbch_config.ssb_subcarrier_offset);
|
||||
LOG_I(MAC,"dmrs type A position: %d\n", phy_config->config_req.pbch_config.dmrs_type_a_position);
|
||||
LOG_I(MAC,"pdcch config sib1: %d\n", phy_config->config_req.pbch_config.pdcch_config_sib1);
|
||||
LOG_I(MAC,"cell barred: %d\n", phy_config->config_req.pbch_config.cell_barred);
|
||||
LOG_I(MAC,"intra frequency reselection: %d\n", phy_config->config_req.pbch_config.intra_frequency_reselection);
|
||||
LOG_I(MAC,"system frame number: %d\n", phy_config->config_req.pbch_config.system_frame_number);
|
||||
LOG_I(MAC,"ssb index: %d\n", phy_config->config_req.pbch_config.ssb_index);
|
||||
LOG_I(MAC,"half frame bit: %d\n", phy_config->config_req.pbch_config.half_frame_bit);
|
||||
LOG_I(MAC,"-------------------------------\n");
|
||||
|
||||
memcpy(&nrUE_config->pbch_config,&phy_config->config_req.pbch_config,sizeof(fapi_nr_pbch_config_t));
|
||||
|
||||
}
|
||||
|
||||
if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_COMMON){
|
||||
|
||||
}
|
||||
|
||||
if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_COMMON){
|
||||
|
||||
}
|
||||
|
||||
if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_DEDICATED){
|
||||
|
||||
}
|
||||
|
||||
if(phy_config->config_req.config_mask & FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_DEDICATED){
|
||||
|
||||
}
|
||||
}
|
||||
if(phy_config != NULL)
|
||||
memcpy(&nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t *));
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,18 +36,6 @@
|
||||
|
||||
/*************** FUNCTIONS *****************************************/
|
||||
|
||||
/** \brief This function processes tdd dedicated configuration for nr
|
||||
* @param frame_parms NR DL Frame parameters
|
||||
* @param dl_UL_TransmissionPeriodicity periodicity
|
||||
* @param nrofDownlinkSlots number of downlink slots
|
||||
* @param nrofDownlinkSymbols number of downlink symbols
|
||||
* @param nrofUplinkSlots number of uplink slots
|
||||
* @param nrofUplinkSymbols number of uplink symbols
|
||||
@returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */
|
||||
|
||||
int set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, int mu,
|
||||
int nrofDownlinkSlots, int nrofDownlinkSymbols,
|
||||
int nrofUplinkSlots, int nrofUplinkSymbols);
|
||||
|
||||
/** \brief This function adds a slot configuration to current dedicated configuration for nr
|
||||
* @param frame_parms NR DL Frame parameters
|
||||
|
||||
@@ -2683,9 +2683,9 @@ void restart_phy(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc, uint8_t eNB_id,uint
|
||||
#endif //(0)
|
||||
|
||||
void nr_ue_pbch_procedures(uint8_t eNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t abstraction_flag)
|
||||
PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t abstraction_flag)
|
||||
{
|
||||
// int i;
|
||||
//int pbch_tx_ant=0;
|
||||
@@ -4057,12 +4057,13 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
int slot_pbch;
|
||||
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
|
||||
NR_UE_DLSCH_t **dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id];
|
||||
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||
uint8_t harq_pid = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->current_harq_pid;
|
||||
NR_DL_UE_HARQ_t *dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
|
||||
uint16_t nb_symb_sch = dlsch0_harq->nb_symbols;
|
||||
uint16_t start_symb_sch = dlsch0_harq->start_symbol;
|
||||
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
|
||||
uint8_t ssb_periodicity = 10;// ue->ssb_periodicity; // initialized to 5ms in nr_init_ue for scenarios where UE is not configured (otherwise acquired by cell configuration from gNB or LTE)
|
||||
uint8_t ssb_periodicity = cfg->ssb_table.ssb_period;
|
||||
uint8_t dci_cnt = 0;
|
||||
fapi_nr_pbch_config_t *pbch_config = &ue->nrUE_config.pbch_config;
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
#else
|
||||
#define MAX_MOBILES_PER_ENB 16
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 16
|
||||
#define MAX_MOBILES_PER_ENB 4
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 4
|
||||
#define MAX_MOBILES_PER_GNB 2//16
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
|
||||
@@ -35,98 +35,232 @@
|
||||
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
|
||||
#include "../NR_MAC_gNB/nr_mac_common.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
|
||||
int mu,
|
||||
int nrofDownlinkSlots, int nrofDownlinkSymbols,
|
||||
int nrofUplinkSlots, int nrofUplinkSymbols) {
|
||||
|
||||
int slot_number = 0;
|
||||
int nb_periods_per_frame;
|
||||
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
|
||||
|
||||
switch(cfg->tdd_table.tdd_period) {
|
||||
case 0:
|
||||
nb_periods_per_frame = 20; // 10ms/0p5ms
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nb_periods_per_frame = 16; // 10ms/0p625ms
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nb_periods_per_frame = 10; // 10ms/1ms
|
||||
break;
|
||||
|
||||
case 3:
|
||||
nb_periods_per_frame = 8; // 10ms/1p25ms
|
||||
break;
|
||||
|
||||
case 4:
|
||||
nb_periods_per_frame = 5; // 10ms/2ms
|
||||
break;
|
||||
|
||||
case 5:
|
||||
nb_periods_per_frame = 4; // 10ms/2p5ms
|
||||
break;
|
||||
|
||||
case 6:
|
||||
nb_periods_per_frame = 2; // 10ms/5ms
|
||||
break;
|
||||
|
||||
case 7:
|
||||
nb_periods_per_frame = 1; // 10ms/10ms
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period);
|
||||
}
|
||||
|
||||
int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
|
||||
|
||||
if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 )
|
||||
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots),
|
||||
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n",
|
||||
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
|
||||
else {
|
||||
AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols);
|
||||
AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1),
|
||||
"set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nrofMixed slots 1, nb_slots_per_period %d \n",
|
||||
nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
|
||||
}
|
||||
|
||||
cfg->tdd_table.max_tdd_periodicity_list = (fapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(fapi_nr_max_tdd_periodicity_t));
|
||||
|
||||
for(int memory_alloc =0 ; memory_alloc<nb_slots_to_set; memory_alloc++)
|
||||
cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = (fapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(
|
||||
fapi_nr_max_num_of_symbol_per_slot_t));
|
||||
|
||||
while(slot_number != nb_slots_to_set) {
|
||||
if(nrofDownlinkSlots != 0) {
|
||||
for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config= 0;
|
||||
|
||||
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
||||
slot_number++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
|
||||
for(int number_of_symbol =0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 0;
|
||||
}
|
||||
|
||||
for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 2;
|
||||
}
|
||||
|
||||
for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config= 1;
|
||||
}
|
||||
|
||||
slot_number++;
|
||||
}
|
||||
|
||||
if(nrofUplinkSlots != 0) {
|
||||
for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
|
||||
cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config= 1;
|
||||
|
||||
if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
|
||||
slot_number++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void config_common_ue(NR_UE_MAC_INST_t *mac) {
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
/*
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
cfg->sch_config.physical_cell_id = *scc->physCellId;
|
||||
cfg->sch_config.ssb_scg_position_in_burst = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0];
|
||||
int i;
|
||||
|
||||
cfg->subframe_config.duplex_mode = 1;
|
||||
// carrier config
|
||||
|
||||
cfg->fapi_config.rf_bands.number_rf_bands = 1;
|
||||
cfg->fapi_config.rf_bands.rf_band[0] = *(long*)scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
|
||||
|
||||
cfg->fapi_config.nrarfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
||||
|
||||
// cfg->subframe_config.numerology_index_mu = 1;
|
||||
|
||||
cfg->rf_config.dl_carrier_bandwidth = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
LOG_I(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->rf_config.dl_carrier_bandwidth);
|
||||
|
||||
cfg->rf_config.ul_carrier_bandwidth = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
|
||||
cfg->rf_config.dl_subcarrierspacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
cfg->rf_config.ul_subcarrierspacing = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
||||
|
||||
|
||||
cfg->rf_config.dl_offsettocarrier = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
|
||||
cfg->rf_config.ul_offsettocarrier = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
|
||||
// InitialBWP configuration
|
||||
|
||||
cfg->initialBWP_config.dl_bandwidth = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
|
||||
cfg->initialBWP_config.dl_offset = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
|
||||
cfg->initialBWP_config.dl_subcarrierSpacing = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
|
||||
LOG_I(PHY,"%s() initialBWP_dl_Bandwidth.RBstart.SCS :%d.%d.%d\n", __FUNCTION__, cfg->initialBWP_config.dl_bandwidth,cfg->initialBWP_config.dl_offset,cfg->initialBWP_config.dl_subcarrierSpacing);
|
||||
|
||||
cfg->initialBWP_config.ul_bandwidth = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
|
||||
cfg->initialBWP_config.ul_offset = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
|
||||
cfg->initialBWP_config.ul_subcarrierSpacing = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
|
||||
LOG_I(PHY,"%s() initialBWP_ul_Bandwidth.RBstart.SCS :%d.%d.%d\n", __FUNCTION__, cfg->initialBWP_config.ul_bandwidth,cfg->initialBWP_config.ul_offset,cfg->initialBWP_config.ul_subcarrierSpacing);
|
||||
|
||||
|
||||
cfg->rach_config.prach_RootSequenceIndex = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
|
||||
cfg->rach_config.prach_msg1_SubcarrierSpacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
|
||||
else cfg->rach_config.prach_msg1_SubcarrierSpacing=cfg->rf_config.dl_subcarrierspacing;
|
||||
|
||||
cfg->rach_config.restrictedSetConfig = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig;
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder)
|
||||
cfg->rach_config.msg3_transformPrecoding = 1;
|
||||
else cfg->rach_config.msg3_transformPrecoding = 0;
|
||||
|
||||
cfg->rach_config.prach_ConfigurationIndex = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex;
|
||||
cfg->rach_config.prach_msg1_FDM = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM;
|
||||
cfg->rach_config.prach_msg1_FrequencyStart = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart;
|
||||
cfg->rach_config.zeroCorrelationZoneConfig = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||
cfg->rach_config.preambleReceivedTargetPower = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower;
|
||||
|
||||
// PDCCH-ConfigCommon
|
||||
cfg->pdcch_config.controlResourceSetZero = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
||||
cfg->pdcch_config.searchSpaceZero = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
||||
|
||||
// PDSCH-ConfigCommon
|
||||
cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;
|
||||
cfg->pdsch_config.dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
|
||||
AssertFatal(cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations<=NFAPI_NR_PDSCH_CONFIG_MAXALLOCATIONS,"illegal TimeDomainAllocation count %d\n",cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations);
|
||||
for (int i=0;i<cfg->pdsch_config.num_PDSCHTimeDomainResourceAllocations;i++) {
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_k0[i]=*scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_mappingType[i]=scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
|
||||
cfg->pdsch_config.PDSCHTimeDomainResourceAllocation_startSymbolAndLength[i]=scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.dl_grid_size[i] = 0;
|
||||
cfg->carrier_config.dl_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// PUSCH-ConfigCommon
|
||||
cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count;
|
||||
cfg->pusch_config.dmrs_TypeA_Position = scc->dmrs_TypeA_Position+2;
|
||||
AssertFatal(cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations<=NFAPI_NR_PUSCH_CONFIG_MAXALLOCATIONS,"illegal TimeDomainAllocation count %d\n",cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations);
|
||||
for (int i=0;i<cfg->pusch_config.num_PUSCHTimeDomainResourceAllocations;i++) {
|
||||
cfg->pusch_config.PUSCHTimeDomainResourceAllocation_k2[i]=*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2;
|
||||
cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]);
|
||||
|
||||
int UL_pointA;
|
||||
if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
||||
UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
|
||||
else
|
||||
UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA;
|
||||
|
||||
cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0],
|
||||
UL_pointA)/1000; // freq in kHz
|
||||
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
|
||||
cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
|
||||
cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||
}
|
||||
else {
|
||||
cfg->carrier_config.ul_grid_size[i] = 0;
|
||||
cfg->carrier_config.ul_k0[i] = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// cell config
|
||||
|
||||
cfg->cell_config.phy_cell_id = *scc->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = 1;
|
||||
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
|
||||
|
||||
// SSB Table config
|
||||
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
||||
scs_scaling = scs_scaling*3;
|
||||
if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
||||
scs_scaling = scs_scaling>>2;
|
||||
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
|
||||
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling);
|
||||
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
|
||||
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0];
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
break;
|
||||
case 2 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0];
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
break;
|
||||
case 3 :
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0;
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0;
|
||||
for (i=0; i<4; i++) {
|
||||
cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]<<i*8);
|
||||
cfg->ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[i+4]<<i*8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present);
|
||||
}
|
||||
|
||||
// TDD Table Configuration
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
|
||||
cfg->tdd_table.tdd_period = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
else {
|
||||
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
|
||||
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
|
||||
cfg->tdd_table.tdd_period = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
|
||||
}
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period);
|
||||
if(cfg->cell_config.frame_duplex_type == TDD){
|
||||
int return_tdd = set_tdd_config_nr_ue(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols
|
||||
);
|
||||
|
||||
if (return_tdd !=0)
|
||||
LOG_E(PHY,"TDD configuration can not be done\n");
|
||||
else
|
||||
LOG_I(PHY,"TDD has been properly configurated\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
int nr_rrc_mac_config_req_ue(
|
||||
|
||||
@@ -145,7 +145,9 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
nr_dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
|
||||
|
||||
|
||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu,
|
||||
int nrofDownlinkSlots, int nrofDownlinkSymbols,
|
||||
int nrofUplinkSlots, int nrofUplinkSymbols);
|
||||
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
@@ -221,8 +221,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t nr_ue_decode_mib(
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int8_t nr_ue_decode_mib(UE_nr_rxtx_proc_t *proc,
|
||||
module_id_t module_id,
|
||||
int cc_id,
|
||||
uint8_t gNB_index,
|
||||
|
||||
@@ -44,181 +44,12 @@
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
#include "NR_MIB.h"
|
||||
#include "nr_mac_common.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
//extern int l2_init_gNB(void);
|
||||
extern void mac_top_init_gNB(void);
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||
{
|
||||
uint16_t bandwidth;
|
||||
|
||||
if (nr_band < 100) { //FR1
|
||||
switch(mu) {
|
||||
case 0 :
|
||||
switch(nb_rb) {
|
||||
case 25 :
|
||||
bandwidth = 5;
|
||||
break;
|
||||
case 52 :
|
||||
bandwidth = 10;
|
||||
break;
|
||||
case 79 :
|
||||
bandwidth = 15;
|
||||
break;
|
||||
case 106 :
|
||||
bandwidth = 20;
|
||||
break;
|
||||
case 133 :
|
||||
bandwidth = 25;
|
||||
break;
|
||||
case 160 :
|
||||
bandwidth = 30;
|
||||
break;
|
||||
case 216 :
|
||||
bandwidth = 40;
|
||||
break;
|
||||
case 270 :
|
||||
bandwidth = 50;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d\n", nb_rb, mu);
|
||||
}
|
||||
break;
|
||||
case 1 :
|
||||
switch(nb_rb) {
|
||||
case 11 :
|
||||
bandwidth = 5;
|
||||
break;
|
||||
case 24 :
|
||||
bandwidth = 10;
|
||||
break;
|
||||
case 38 :
|
||||
bandwidth = 15;
|
||||
break;
|
||||
case 51 :
|
||||
bandwidth = 20;
|
||||
break;
|
||||
case 65 :
|
||||
bandwidth = 25;
|
||||
break;
|
||||
case 78 :
|
||||
bandwidth = 30;
|
||||
break;
|
||||
case 106 :
|
||||
bandwidth = 40;
|
||||
break;
|
||||
case 133 :
|
||||
bandwidth = 50;
|
||||
break;
|
||||
case 162 :
|
||||
bandwidth = 60;
|
||||
break;
|
||||
case 189 :
|
||||
bandwidth = 70;
|
||||
break;
|
||||
case 217 :
|
||||
bandwidth = 80;
|
||||
break;
|
||||
case 245 :
|
||||
bandwidth = 90;
|
||||
break;
|
||||
case 273 :
|
||||
bandwidth = 100;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d\n", nb_rb, mu);
|
||||
}
|
||||
break;
|
||||
case 2 :
|
||||
switch(nb_rb) {
|
||||
case 11 :
|
||||
bandwidth = 10;
|
||||
break;
|
||||
case 18 :
|
||||
bandwidth = 15;
|
||||
break;
|
||||
case 24 :
|
||||
bandwidth = 20;
|
||||
break;
|
||||
case 31 :
|
||||
bandwidth = 25;
|
||||
break;
|
||||
case 38 :
|
||||
bandwidth = 30;
|
||||
break;
|
||||
case 51 :
|
||||
bandwidth = 40;
|
||||
break;
|
||||
case 65 :
|
||||
bandwidth = 50;
|
||||
break;
|
||||
case 79 :
|
||||
bandwidth = 60;
|
||||
break;
|
||||
case 93 :
|
||||
bandwidth = 70;
|
||||
break;
|
||||
case 107 :
|
||||
bandwidth = 80;
|
||||
break;
|
||||
case 121 :
|
||||
bandwidth = 90;
|
||||
break;
|
||||
case 135 :
|
||||
bandwidth = 100;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d\n", nb_rb, mu);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(mu) {
|
||||
case 2 :
|
||||
switch(nb_rb) {
|
||||
case 66 :
|
||||
bandwidth = 50;
|
||||
break;
|
||||
case 132 :
|
||||
bandwidth = 100;
|
||||
break;
|
||||
case 264 :
|
||||
bandwidth = 200;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d\n", nb_rb, mu);
|
||||
}
|
||||
break;
|
||||
case 3 :
|
||||
switch(nb_rb) {
|
||||
case 32 :
|
||||
bandwidth = 50;
|
||||
break;
|
||||
case 66 :
|
||||
bandwidth = 100;
|
||||
break;
|
||||
case 132 :
|
||||
bandwidth = 200;
|
||||
break;
|
||||
case 264 :
|
||||
bandwidth = 400;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d\n", nb_rb, mu);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
|
||||
return (bandwidth);
|
||||
}
|
||||
|
||||
|
||||
void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
@@ -419,6 +250,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
||||
AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value );
|
||||
cfg->num_tlv++;
|
||||
cfg->num_tlv++;
|
||||
|
||||
// TDD Table Configuration
|
||||
//cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
|
||||
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
|
||||
@@ -432,7 +264,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
||||
}
|
||||
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
|
||||
if(cfg->cell_config.frame_duplex_type.value == TDD){
|
||||
int return_tdd = set_tdd_config_nr(cfg,
|
||||
int return_tdd = set_tdd_config_nr(cfg,
|
||||
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots,
|
||||
scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols,
|
||||
|
||||
@@ -118,11 +118,6 @@ int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot);
|
||||
|
||||
void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
|
||||
|
||||
|
||||
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
int x_overhead);
|
||||
/** \brief Computes Q based on I_MCS PDSCH and table_idx for downlink. Implements MCS Tables from 38.214. */
|
||||
|
||||
@@ -111,6 +111,119 @@ void get_band(uint64_t downlink_frequency,
|
||||
"Can't find EUTRA band for frequency %lu\n", downlink_frequency);
|
||||
}
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||
{
|
||||
|
||||
if (nr_band < 100) { //FR1
|
||||
switch(mu) {
|
||||
case 0 :
|
||||
if (nb_rb<=25)
|
||||
return 5;
|
||||
if (nb_rb<=52)
|
||||
return 10;
|
||||
if (nb_rb<=79)
|
||||
return 15;
|
||||
if (nb_rb<=106)
|
||||
return 20;
|
||||
if (nb_rb<=133)
|
||||
return 25;
|
||||
if (nb_rb<=160)
|
||||
return 30;
|
||||
if (nb_rb<=216)
|
||||
return 40;
|
||||
if (nb_rb<=270)
|
||||
return 50;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 1 :
|
||||
if (nb_rb<=11)
|
||||
return 5;
|
||||
if (nb_rb<=24)
|
||||
return 10;
|
||||
if (nb_rb<=38)
|
||||
return 15;
|
||||
if (nb_rb<=51)
|
||||
return 20;
|
||||
if (nb_rb<=65)
|
||||
return 25;
|
||||
if (nb_rb<=78)
|
||||
return 30;
|
||||
if (nb_rb<=106)
|
||||
return 40;
|
||||
if (nb_rb<=133)
|
||||
return 50;
|
||||
if (nb_rb<=162)
|
||||
return 60;
|
||||
if (nb_rb<=189)
|
||||
return 70;
|
||||
if (nb_rb<=217)
|
||||
return 80;
|
||||
if (nb_rb<=245)
|
||||
return 90;
|
||||
if (nb_rb<=273)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 2 :
|
||||
if (nb_rb<=11)
|
||||
return 10;
|
||||
if (nb_rb<=18)
|
||||
return 15;
|
||||
if (nb_rb<=24)
|
||||
return 20;
|
||||
if (nb_rb<=31)
|
||||
return 25;
|
||||
if (nb_rb<=38)
|
||||
return 30;
|
||||
if (nb_rb<=51)
|
||||
return 40;
|
||||
if (nb_rb<=65)
|
||||
return 50;
|
||||
if (nb_rb<=79)
|
||||
return 60;
|
||||
if (nb_rb<=93)
|
||||
return 70;
|
||||
if (nb_rb<=107)
|
||||
return 80;
|
||||
if (nb_rb<=121)
|
||||
return 90;
|
||||
if (nb_rb<=135)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(mu) {
|
||||
case 2 :
|
||||
if (nb_rb<=66)
|
||||
return 50;
|
||||
if (nb_rb<=132)
|
||||
return 100;
|
||||
if (nb_rb<=264)
|
||||
return 200;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 3 :
|
||||
if (nb_rb<=32)
|
||||
return 50;
|
||||
if (nb_rb<=66)
|
||||
return 100;
|
||||
if (nb_rb<=132)
|
||||
return 200;
|
||||
if (nb_rb<=264)
|
||||
return 400;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP,
|
||||
uint64_t dl_CarrierFreq,
|
||||
uint32_t bw)
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
#ifndef __LAYER2_NR_MAC_COMMON_H__
|
||||
#define __LAYER2_NR_MAC_COMMON_H__
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
|
||||
|
||||
typedef enum {
|
||||
NR_DL_DCI_FORMAT_1_0 = 0,
|
||||
NR_DL_DCI_FORMAT_1_1,
|
||||
|
||||
Reference in New Issue
Block a user