Commit b8971da0 authored by cig's avatar cig

Review of MR 1025

- bugfix in nr_ue_dci_configuration
- cleanup of irrelevant RA-related data structure members in UE
- moved msg1 init condition to MAC
- minor fixes concerning init_ra function
parent 6c0d2ba8
......@@ -859,8 +859,6 @@ typedef struct {
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_gNB_MAX];
unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_gNB_MAX];
NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX];
int turbo_iterations, turbo_cntl_iterations;
/// \brief ?.
......@@ -896,9 +894,6 @@ typedef struct {
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
int current_dlsch_cqi[NUMBER_OF_CONNECTED_gNB_MAX];
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_gNB_MAX];
uint8_t prach_cnt;
uint8_t prach_PreambleIndex;
// uint8_t prach_timer;
uint8_t decode_SIB;
uint8_t decode_MIB;
uint8_t init_sync_frame;
......
......@@ -2134,7 +2134,6 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
}
// todo:
// - set tx_total_RE
// - 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) {
......@@ -2146,30 +2145,22 @@ 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);
// 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){
ue->prach_cnt = 0;
prach_resources->init_msg1 = 1;
}
if (ue->mac_enabled == 0){
// prach_resources->ra_PreambleIndex = preamble_tx;
prach_resources->ra_TDD_map_index = 0;
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
prach_resources->ra_RNTI = 0x1234;
nr_prach = 1;
prach_resources->init_msg1 = 1;
} else {
LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_slot_tx);
// flush Msg3 Buffer
if (prach_resources->Msg3 == NULL){
for(int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
ue->ulsch_Msg3_active[i] = 0;
}
}
LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources\n", __FUNCTION__, frame_tx, nr_slot_tx);
nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx);
}
if (nr_prach == 1 && prach_resources->init_msg1) {
if (nr_prach == 1) {
if (ue->mac_enabled == 1) {
int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
......@@ -2187,7 +2178,6 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
prach_resources->ra_RNTI);
}
//ue->tx_total_RE[nr_slot_tx] = 96; // todo
ue->prach_vars[gNB_id]->amp = AMP;
/* #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
......@@ -2204,28 +2194,22 @@ 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_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
LOG_D(PHY, "In %s: [UE %d][RAPROC][%d.%d]: Generated PRACH Msg1 (TX power PRACH %d dBm, digital power %d dBW (amp %d) prach_cnt %d)\n",
LOG_D(PHY, "In %s: [UE %d][RAPROC][%d.%d]: Generated PRACH Msg1 (TX power PRACH %d dBm, digital power %d dBW (amp %d)\n",
__FUNCTION__,
mod_id,
frame_tx,
nr_slot_tx,
ue->tx_power_dBm[nr_slot_tx],
dB_fixed(prach_power),
ue->prach_vars[gNB_id]->amp,
ue->prach_cnt);
ue->prach_vars[gNB_id]->amp);
if (ue->mac_enabled == 1)
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
ue->prach_cnt++;
if (ue->prach_cnt == 3)
ue->prach_cnt = 0;
} else if (nr_prach == 2) {
LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
ue->ulsch_Msg3_active[gNB_id] = 0;
ue->UE_mode[gNB_id] = PUSCH;
} else if(nr_prach == 3){
......
......@@ -64,9 +64,10 @@ void init_RA(module_id_t mod_id,
RA_config_t *ra = &mac->ra;
ra->RA_active = 1;
ra->RA_RAPID_found = 0;
ra->preambleTransMax = -1;
ra->first_Msg3 = 0;
ra->preambleTransMax = 0;
ra->first_Msg3 = 1;
ra->starting_preamble_nb = 0;
ra->RA_backoff_cnt = 0;
prach_resources->RA_PREAMBLE_BACKOFF = 0;
prach_resources->RA_PCMAX = nr_get_Pcmax(mod_id);
......@@ -515,6 +516,15 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
uint16_t sdu_lengths[NB_RB_MAX] = {0};
int TBS_bytes = 848, header_length_total=0, num_sdus, offset, mac_ce_len;
// Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side
if (!prach_resources->init_msg1) {
if (((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150){
prach_resources->init_msg1 = 1;
} else {
return 0;
}
}
if (prach_resources->init_msg1) {
if (ra->RA_active == 0) {
......@@ -556,8 +566,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx);
ra->first_Msg3 = 1;
ra->RA_backoff_cnt = 0;
ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
init_RA(mod_id, prach_resources, setup, rach_ConfigGeneric, rach_ConfigDedicated);
......
......@@ -130,7 +130,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
// Scrambling RNTI
if (coreset->pdcch_DMRS_ScramblingID) {
rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID;
rel15->coreset.scrambling_rnti = ra->t_crnti;
rel15->coreset.scrambling_rnti = mac->crnti;
} else {
rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
rel15->coreset.scrambling_rnti = 0;
......@@ -269,7 +269,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
fill_dci_search_candidates(ss, rel15);
break;
case WAIT_CONTENTION_RESOLUTION:
rel15->rnti = ra->t_crnti;
LOG_E(MAC, "In %s: CB-RA not implemented yet. Should not have fallen in this case.\n", __FUNCTION__);
break;
default:
break;
......
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