Cleanup RA procedure
- removed irrelevant prach_config_enabled parameter - cleanup of commented out code - minor fixes - enhancement of logging
This commit is contained in:
@@ -712,7 +712,6 @@ typedef struct {
|
|||||||
int16_t *prachF;
|
int16_t *prachF;
|
||||||
int16_t *prach;
|
int16_t *prach;
|
||||||
fapi_nr_ul_config_prach_pdu prach_pdu;
|
fapi_nr_ul_config_prach_pdu prach_pdu;
|
||||||
uint8_t prach_Config_enabled;
|
|
||||||
} NR_UE_PRACH;
|
} NR_UE_PRACH;
|
||||||
|
|
||||||
// structure used for multiple SSB detection
|
// structure used for multiple SSB detection
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
// prach config pdu
|
// prach config pdu
|
||||||
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
|
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
|
||||||
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
|
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
|
||||||
PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_Config_enabled = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (get_softmodem_params()->do_ra==1) {
|
if (get_softmodem_params()->do_ra==1) {
|
||||||
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1) && ue->mac_enabled) {
|
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && ue->mac_enabled) {
|
||||||
nr_ue_prach_procedures(ue, proc, gNB_id);
|
nr_ue_prach_procedures(ue, proc, gNB_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2118,14 +2118,13 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WIP
|
|
||||||
// todo:
|
// todo:
|
||||||
// - set tx_total_RE
|
// - set tx_total_RE
|
||||||
// - power control as per 38.213 ch 7.4
|
// - power control as per 38.213 ch 7.4
|
||||||
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) {
|
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) {
|
||||||
|
|
||||||
int frame_tx = proc->frame_tx, nr_slot_tx = proc->nr_slot_tx, prach_power; // tx_amp
|
int frame_tx = proc->frame_tx, nr_slot_tx = proc->nr_slot_tx, prach_power; // tx_amp
|
||||||
uint16_t /*preamble_tx = 50,*/ pathloss;
|
uint16_t pathloss;
|
||||||
uint8_t mod_id = ue->Mod_id;
|
uint8_t mod_id = ue->Mod_id;
|
||||||
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
|
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
|
||||||
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
|
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
|
||||||
@@ -2133,13 +2132,12 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
|||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
|
// Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side
|
||||||
if (!prach_resources->init_msg1 && ((MAX_FRAME_NUMBER+frame_tx-ue->prach_resources[gNB_id]->sync_frame)% MAX_FRAME_NUMBER)>150){
|
if (!prach_resources->init_msg1 && ((MAX_FRAME_NUMBER+frame_tx-ue->prach_resources[gNB_id]->sync_frame)% MAX_FRAME_NUMBER)>150){
|
||||||
ue->prach_cnt = 0;
|
ue->prach_cnt = 0;
|
||||||
prach_resources->init_msg1 = 1;
|
prach_resources->init_msg1 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ask L2 for RACH transport
|
|
||||||
LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_slot_tx);
|
|
||||||
// flush Msg3 Buffer
|
// flush Msg3 Buffer
|
||||||
if (prach_resources->Msg3 == NULL){
|
if (prach_resources->Msg3 == NULL){
|
||||||
for(int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
for(int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||||
|
|||||||
@@ -32,19 +32,6 @@
|
|||||||
|
|
||||||
#include "mac.h"
|
#include "mac.h"
|
||||||
|
|
||||||
/*
|
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
|
||||||
#include "PHY_INTERFACE/phy_interface_extern.h"
|
|
||||||
#include "SCHED_UE/sched_UE.h"
|
|
||||||
#include "COMMON/mac_rrc_primitives.h"
|
|
||||||
#include "RRC/LTE/rrc_extern.h"
|
|
||||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
|
||||||
#include "common/utils/LOG/log.h"
|
|
||||||
#include "UTIL/OPT/opt.h"
|
|
||||||
#include "OCG.h"
|
|
||||||
#include "OCG_extern.h"
|
|
||||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"*/
|
|
||||||
|
|
||||||
/* Tools */
|
/* Tools */
|
||||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||||
|
|
||||||
@@ -65,10 +52,10 @@
|
|||||||
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
|
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
|
||||||
|
|
||||||
//extern uint8_t nfapi_mode;
|
//extern uint8_t nfapi_mode;
|
||||||
|
static uint8_t first_Msg3 = 0;
|
||||||
|
|
||||||
void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
|
void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
|
||||||
|
|
||||||
// WIP
|
|
||||||
// This routine implements Section 5.1.2 (UE Random Access Resource Selection)
|
// This routine implements Section 5.1.2 (UE Random Access Resource Selection)
|
||||||
// and Section 5.1.3 (Random Access Preamble Transmission) from 3GPP TS 38.321
|
// and Section 5.1.3 (Random Access Preamble Transmission) from 3GPP TS 38.321
|
||||||
void nr_get_prach_resources(module_id_t mod_id,
|
void nr_get_prach_resources(module_id_t mod_id,
|
||||||
@@ -93,13 +80,14 @@ void nr_get_prach_resources(module_id_t mod_id,
|
|||||||
nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||||
rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric;
|
rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric;
|
||||||
|
|
||||||
|
LOG_D(PHY, "Getting PRACH resources frame (first_Msg3 %d)\n", __FUNCTION__, first_Msg3);
|
||||||
|
|
||||||
// NR_RSRP_Range_t rsrp_ThresholdSSB; // todo
|
// NR_RSRP_Range_t rsrp_ThresholdSSB; // todo
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
//////////* UE Random Access Resource Selection *//////////
|
//////////* UE Random Access Resource Selection *//////////
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// todo:
|
// todo:
|
||||||
// - switch initialisation cases
|
// - switch initialisation cases
|
||||||
// -- RA initiated by beam failure recovery operation (subclause 5.17 TS 38.321)
|
// -- RA initiated by beam failure recovery operation (subclause 5.17 TS 38.321)
|
||||||
@@ -208,7 +196,8 @@ void nr_get_prach_resources(module_id_t mod_id,
|
|||||||
noGroupB = 1;
|
noGroupB = 1;
|
||||||
} else {
|
} else {
|
||||||
// RA preambles group B is configured
|
// RA preambles group B is configured
|
||||||
// - Defining the number of RA preambles in RA Preamble Group A for each SSB */
|
// - Random Access Preambles group B is configured for 4-step RA type
|
||||||
|
// - Defining the number of RA preambles in RA Preamble Group A for each SSB
|
||||||
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
||||||
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
||||||
/* - Threshold to determine the groups of RA preambles */
|
/* - Threshold to determine the groups of RA preambles */
|
||||||
@@ -380,7 +369,6 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
|||||||
/// the RA procedure on a SCell shall only be initiated by PDCCH order
|
/// the RA procedure on a SCell shall only be initiated by PDCCH order
|
||||||
/// in the current implementation, RA is contention free only
|
/// in the current implementation, RA is contention free only
|
||||||
|
|
||||||
// WIP
|
|
||||||
// todo TS 38.321:
|
// todo TS 38.321:
|
||||||
// - check if carrier to use is explicitly signalled then do (1) RA CARRIER SELECTION (SUL, NUL) (2) set PCMAX
|
// - check if carrier to use is explicitly signalled then do (1) RA CARRIER SELECTION (SUL, NUL) (2) set PCMAX
|
||||||
// - BWP operation (subclause 5.15 TS 38.321)
|
// - BWP operation (subclause 5.15 TS 38.321)
|
||||||
@@ -415,8 +403,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
//NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
//NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = mac->rach_ConfigDedicated;
|
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = mac->rach_ConfigDedicated;
|
||||||
|
|
||||||
// int32_t frame_diff = 0;
|
|
||||||
|
|
||||||
uint8_t sdu_lcids[NB_RB_MAX] = {0};
|
uint8_t sdu_lcids[NB_RB_MAX] = {0};
|
||||||
uint16_t sdu_lengths[NB_RB_MAX] = {0};
|
uint16_t sdu_lengths[NB_RB_MAX] = {0};
|
||||||
int TBS_bytes = 848, header_length_total=0, num_sdus, offset, preambleTransMax, mac_ce_len;
|
int TBS_bytes = 848, header_length_total=0, num_sdus, offset, preambleTransMax, mac_ce_len;
|
||||||
@@ -425,8 +411,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
if (prach_resources->init_msg1) {
|
if (prach_resources->init_msg1) {
|
||||||
|
|
||||||
LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active);
|
|
||||||
|
|
||||||
AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id);
|
AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id);
|
||||||
|
|
||||||
if (mac->RA_active == 0) {
|
if (mac->RA_active == 0) {
|
||||||
@@ -434,6 +418,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
LOG_I(MAC, "RA not active. Starting RA preamble initialization.\n");
|
LOG_I(MAC, "RA not active. Starting RA preamble initialization.\n");
|
||||||
|
|
||||||
|
first_Msg3 = 0;
|
||||||
mac->RA_RAPID_found = 0;
|
mac->RA_RAPID_found = 0;
|
||||||
|
|
||||||
/* Set RA_PREAMBLE_POWER_RAMPING_STEP */
|
/* Set RA_PREAMBLE_POWER_RAMPING_STEP */
|
||||||
@@ -509,7 +494,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
// Fill in preamble and PRACH resources
|
// Fill in preamble and PRACH resources
|
||||||
if (mac->generate_nr_prach == 1)
|
if (mac->generate_nr_prach == 1)
|
||||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
nr_get_prach_resources(mod_id, CC_id, gNB_id, first_Msg3, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||||
|
|
||||||
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
||||||
(uint8_t *) payload, // UL MAC pdu pointer
|
(uint8_t *) payload, // UL MAC pdu pointer
|
||||||
@@ -542,8 +527,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
// - handle DL assignment on PDCCH for RA-RNTI
|
// - handle DL assignment on PDCCH for RA-RNTI
|
||||||
// - handle backoff and raResponseWindow params
|
// - handle backoff and raResponseWindow params
|
||||||
|
|
||||||
// LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
|
LOG_D(MAC, "In %s [%d.%d] RA is active: RA window count %d (RA_tx_frame %d, RA_tx_subframe %d)\n", __FUNCTION__, frame, nr_slot_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
|
||||||
// mod_id, frame, nr_slot_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
|
|
||||||
|
|
||||||
if (mac->RA_BI_found){
|
if (mac->RA_BI_found){
|
||||||
prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator;
|
prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator;
|
||||||
@@ -636,7 +620,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
// Fill in preamble and PRACH resources
|
// Fill in preamble and PRACH resources
|
||||||
if (mac->generate_nr_prach == 1)
|
if (mac->generate_nr_prach == 1)
|
||||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
nr_get_prach_resources(mod_id, CC_id, gNB_id, first_Msg3, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -650,7 +634,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
// Fill in preamble and PRACH resources
|
// Fill in preamble and PRACH resources
|
||||||
if (mac->generate_nr_prach == 1)
|
if (mac->generate_nr_prach == 1)
|
||||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_slot_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
|
nr_get_prach_resources(mod_id, CC_id, gNB_id, first_Msg3, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user