Commit 5ed3d040 authored by Marwan Hammouda's avatar Marwan Hammouda

ta update forced to happen every 100 frames.

parent 35620cf4
......@@ -233,9 +233,15 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
// - Application of timing adjustment according to TS 38.213 p4.2
// todo:
// - handle RAR TA application as per ch 4.2 TS 38.213
static uint64_t idx = 0;
static int lastFrame;
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx)
{
if (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot) {
if ( (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot && idx == 0) ||
(frame_tx == ue->ta_frame && slot_tx == ue->ta_slot && (frame_tx - lastFrame) == 100) ) {
lastFrame = frame_tx;
idx = 1;
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
......
......@@ -3726,6 +3726,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
ul_time_alignment->ta_command = ta;
ul_time_alignment->frame = frameP;
ul_time_alignment->slot = slot;
LOG_D(NR_MAC, "ul_time_alignment->frame: %d, ul_time_alignment->slot: %d\n", ul_time_alignment->frame, ul_time_alignment->slot);
ul_time_alignment->ta_apply = true;
/*
#ifdef DEBUG_HEADER_PARSING
......
......@@ -3181,6 +3181,7 @@ void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIG
ta->ta_frame = ul_time_alignment->frame;
ta->ta_slot = ul_time_alignment->slot;
ta->ta_command = ul_time_alignment->ta_command;
LOG_D(NR_MAC, "ta_frame: %d, ta_slot: %d, ta_command: %d\n", ta->ta_frame, ta->ta_slot, ta->ta_command);
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_CONFIG_TA_COMMAND;
dl_config->number_pdus += 1;
ul_time_alignment->ta_apply = false;
......
......@@ -911,6 +911,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
* If such UE is not scheduled now, it will be by the preprocessor later.
* If we add the CE, ta_apply will be reset */
if (frame == (sched_ctrl->ta_frame + 100) % 1024) {
LOG_D(NR_MAC, "frame: %d, sched_ctrl->ta_frame: %d\n", frame, sched_ctrl->ta_frame);
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
LOG_D(NR_MAC, "[UE %04x][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE->rnti, frame, slot);
}
......
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