Commit 9d84ba7f authored by ndomingues's avatar ndomingues

Refactor enum nr_ra_type_t and make it common for both gNB and UE

parent abb7439b
...@@ -560,6 +560,7 @@ typedef struct NR_UE_UL_BWP { ...@@ -560,6 +560,7 @@ typedef struct NR_UE_UL_BWP {
uint16_t BWPSize; uint16_t BWPSize;
uint16_t BWPStart; uint16_t BWPStart;
NR_RACH_ConfigCommon_t *rach_ConfigCommon; NR_RACH_ConfigCommon_t *rach_ConfigCommon;
NR_MsgA_ConfigCommon_r16_t *msgA_ConfigCommon_r16;
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList_Common; NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList_Common;
NR_ConfiguredGrantConfig_t *configuredGrantConfig; NR_ConfiguredGrantConfig_t *configuredGrantConfig;
NR_PUSCH_Config_t *pusch_Config; NR_PUSCH_Config_t *pusch_Config;
...@@ -630,5 +631,10 @@ typedef struct NR_tda_info { ...@@ -630,5 +631,10 @@ typedef struct NR_tda_info {
bool valid_tda; bool valid_tda;
} NR_tda_info_t; } NR_tda_info_t;
typedef enum {
RA_4_STEP = 0,
RA_2_STEP = 1,
} nr_ra_type_t;
#endif /*__LAYER2_MAC_H__ */ #endif /*__LAYER2_MAC_H__ */
...@@ -191,11 +191,6 @@ typedef enum { ...@@ -191,11 +191,6 @@ typedef enum {
RE_ESTABLISHMENT RE_ESTABLISHMENT
} NR_UE_MAC_reset_cause_t; } NR_UE_MAC_reset_cause_t;
typedef enum {
RA_2STEP = 0,
RA_4STEP
} nr_ra_type_e;
typedef struct { typedef struct {
// after multiplexing buffer remain for each lcid // after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain; int32_t LCID_buffer_remain;
...@@ -299,7 +294,7 @@ typedef struct { ...@@ -299,7 +294,7 @@ typedef struct {
/// ///
uint8_t RA_SCALING_FACTOR_BI; uint8_t RA_SCALING_FACTOR_BI;
/// Indicating whether it is 2-step or 4-step RA /// Indicating whether it is 2-step or 4-step RA
nr_ra_type_e RA_TYPE; nr_ra_type_t RA_TYPE;
/// UE configured maximum output power /// UE configured maximum output power
int RA_PCMAX; int RA_PCMAX;
} NR_PRACH_RESOURCES_t; } NR_PRACH_RESOURCES_t;
...@@ -312,6 +307,8 @@ typedef struct { ...@@ -312,6 +307,8 @@ typedef struct {
nrRA_UE_state_t ra_state; nrRA_UE_state_t ra_state;
/// RA contention type /// RA contention type
uint8_t cfra; uint8_t cfra;
/// RA type
nr_ra_type_t ra_type;
/// RA rx frame offset: compensate RA rx offset introduced by OAI gNB. /// RA rx frame offset: compensate RA rx offset introduced by OAI gNB.
uint8_t RA_offset; uint8_t RA_offset;
/// RA-rnti /// RA-rnti
......
...@@ -104,15 +104,19 @@ void init_RA(NR_UE_MAC_INST_t *mac, ...@@ -104,15 +104,19 @@ void init_RA(NR_UE_MAC_INST_t *mac,
prach_resources->POWER_OFFSET_2STEP_RA = 0; prach_resources->POWER_OFFSET_2STEP_RA = 0;
prach_resources->RA_SCALING_FACTOR_BI = 1; prach_resources->RA_SCALING_FACTOR_BI = 1;
// Contention Free
if (rach_ConfigDedicated) { if (rach_ConfigDedicated) {
if (rach_ConfigDedicated->cfra){ if (rach_ConfigDedicated->cfra){
LOG_I(NR_MAC, "Initialization of 2-step contention-free random access procedure\n"); LOG_I(MAC, "Initialization of 4-Step CFRA procedure\n");
prach_resources->RA_TYPE = RA_2STEP; prach_resources->RA_TYPE = RA_4_STEP;
ra->ra_type = RA_4_STEP;
ra->cfra = 1; ra->cfra = 1;
} else if (rach_ConfigDedicated->ext1){ } else if (rach_ConfigDedicated->ext1){
if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16){ if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16) {
LOG_I(NR_MAC, "Setting RA type to 2-step...\n"); LOG_I(MAC, "Initialization of 2-Step CFRA procedure\n");
prach_resources->RA_TYPE = RA_2STEP; prach_resources->RA_TYPE = RA_2_STEP;
ra->ra_type = RA_2_STEP;
ra->cfra = 1; ra->cfra = 1;
} else { } else {
LOG_E(NR_MAC, "Config not handled\n"); LOG_E(NR_MAC, "Config not handled\n");
...@@ -120,10 +124,20 @@ void init_RA(NR_UE_MAC_INST_t *mac, ...@@ -120,10 +124,20 @@ void init_RA(NR_UE_MAC_INST_t *mac,
} else { } else {
LOG_E(NR_MAC, "Config not handled\n"); LOG_E(NR_MAC, "Config not handled\n");
} }
} else { // Contention Based
LOG_I(NR_MAC, "Initialization of 4-step contention-based random access procedure\n"); } else if (mac->current_UL_BWP->msgA_ConfigCommon_r16) {
prach_resources->RA_TYPE = RA_4STEP; LOG_I(MAC, "Initialization of 2-Step CBRA procedure\n");
prach_resources->RA_TYPE = RA_2_STEP;
ra->ra_type = RA_2_STEP;
ra->cfra = 0; ra->cfra = 0;
} else if (nr_rach_ConfigCommon) {
LOG_I(MAC, "Initialization of 4-Step CBRA procedure\n");
prach_resources->RA_TYPE = RA_4_STEP;
ra->ra_type = RA_4_STEP;
ra->cfra = 0;
} else {
LOG_E(MAC, "Config not handled\n");
AssertFatal(false, "In %s: config not handled\n", __FUNCTION__);
} }
switch (rach_ConfigGeneric->powerRampingStep){ // in dB switch (rach_ConfigGeneric->powerRampingStep){ // in dB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment