Commit 3a55e0de authored by Thomas Schlichter's avatar Thomas Schlichter Committed by Marwan Hammouda

some changes o fix errors with 15Khz spacing

parent 38e4e66b
......@@ -87,9 +87,8 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
/* advance last round's future UL_tti_req to be ahead of current frame/slot */
const int size = gNB->UL_tti_req_ahead_size;
const int prev_slot = frameP * num_slots + slotP + size - 1;
const int last_slot = (slotP + num_slots - 1) % num_slots;
frame_t LastFrame = slotP==0 ? ((frameP + MAX_FRAME_NUMBER - 1) % MAX_FRAME_NUMBER) : frameP;
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &gNB->UL_tti_req_ahead[CC_idP][LastFrame%MAX_NUM_UL_SCHED_FRAME][last_slot];
frame_t LastFrame = slotP==0 ? ((frameP + MAX_FRAME_NUMBER - 1) % MAX_FRAME_NUMBER) : frameP;
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &gNB->UL_tti_req_ahead[CC_idP][LastFrame%MAX_NUM_UL_SCHED_FRAME][prev_slot % size];
future_ul_tti_req->SFN = (LastFrame + MAX_NUM_UL_SCHED_FRAME) % MAX_FRAME_NUMBER;
LOG_D(NR_MAC, "%d.%d UL_tti_req_ahead SFN.slot = %d.%d for index %d \n", frameP, slotP, future_ul_tti_req->SFN, future_ul_tti_req->Slot, prev_slot % size);
/* future_ul_tti_req->Slot is fixed! */
......@@ -189,9 +188,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const int size = gNB->vrb_map_UL_size;
const int prev_slot = frame * num_slots + slot + size - 1;
const int last_slot = (slot + num_slots - 1) % num_slots;
frame_t LastFrame = slot==0 ? ((frame + MAX_FRAME_NUMBER - 1) % MAX_FRAME_NUMBER) : frame;
uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL[LastFrame%MAX_NUM_UL_SCHED_FRAME][last_slot];
uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL[LastFrame%MAX_NUM_UL_SCHED_FRAME][prev_slot % size];
memcpy(vrb_map_UL, &RC.nrmac[module_idP]->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE);
//uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL;
......
......@@ -2842,8 +2842,8 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
return;
int size = n;
if (scs == 0)
size <<= 1; // to have enough room for feedback possibly beyond the frame we need a larger array at 15kHz SCS
//if (scs == 0)
//size <<= 1; // to have enough room for feedback possibly beyond the frame we need a larger array at 15kHz SCS
gNB->UL_tti_req_ahead_size = size;
gNB->UL_tti_req_ahead[CCid] = calloc(MAX_NUM_UL_SCHED_FRAME, sizeof(nfapi_nr_ul_tti_request_t *));
......@@ -2856,7 +2856,7 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
* consider that scheduler runs sl_ahead: the first sl_ahead slots are
* already "in the past" and thus we put frame 1 instead of 0! */
for (int i = 0; i < MAX_NUM_UL_SCHED_FRAME; ++i) {
for (int j = 0; j < n; ++j) {
for (int j = 0; j < size; ++j) {
nfapi_nr_ul_tti_request_t *req = &gNB->UL_tti_req_ahead[CCid][i][j];
if (i == 0)
req->SFN = j < (gNB->if_inst->sl_ahead-1) ? MAX_NUM_UL_SCHED_FRAME : 0;
......
......@@ -148,7 +148,8 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
NR_UE_info_t *UE,
NR_SRS_ResourceSet_t *srs_resource_set,
NR_SRS_Resource_t *srs_resource,
int buffer_index)
int buffer_index,
int frame)
{
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
......@@ -201,7 +202,7 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
srs_pdu->beamforming.prg_size = 1;
}
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
uint16_t *vrb_map_UL = RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[frame % MAX_NUM_UL_SCHED_FRAME][buffer_index];
uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols);
for (int i = 0; i < srs_pdu->bwp_size; ++i)
vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
......@@ -227,7 +228,7 @@ static void nr_fill_nfapi_srs(int module_id,
memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t));
future_ul_tti_req->n_pdus += 1;
index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->vrb_map_UL_size);
nr_configure_srs(srs_pdu, slot, module_id, CC_id, UE, srs_resource_set, srs_resource, index);
nr_configure_srs(srs_pdu, slot, module_id, CC_id, UE, srs_resource_set, srs_resource, index, frame);
}
/*******************************************************************
......
......@@ -48,15 +48,17 @@ static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac,
{
const int index = ul_buffer_index(pucch->frame, pucch->ul_slot, UE->current_UL_BWP.scs, nrmac->UL_tti_req_ahead_size);
LOG_D(MAC, "index:%d, %d:%d,size:%d\n", index, pucch->frame, pucch->ul_slot,nrmac->UL_tti_req_ahead_size);
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &nrmac->UL_tti_req_ahead[0][pucch->frame%MAX_NUM_UL_SCHED_FRAME][index];
if (future_ul_tti_req->SFN != pucch->frame || future_ul_tti_req->Slot != pucch->ul_slot)
LOG_W(MAC,
"Current %d.%d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n",
"Current %d.%d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d, mod: %d, index: %d\n",
frame,slot,
future_ul_tti_req->SFN,
future_ul_tti_req->Slot,
pucch->frame,
pucch->ul_slot);
pucch->ul_slot,
pucch->frame%MAX_NUM_UL_SCHED_FRAME, index);
// n_pdus is number of pdus, so, in the array, it is the index of the next free element
if (future_ul_tti_req->n_pdus >= sizeofArray(future_ul_tti_req->pdus_list) ) {
......
......@@ -2198,8 +2198,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
/* PUSCH in a later slot, but corresponding DCI now! */
const int index = ul_buffer_index(sched_pusch->frame, sched_pusch->slot, current_BWP->scs, nr_mac->UL_tti_req_ahead_size);
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &nr_mac->UL_tti_req_ahead[0][sched_pusch->frame%MAX_NUM_UL_SCHED_FRAME][index];
if (future_ul_tti_req->SFN != sched_pusch->frame || future_ul_tti_req->Slot != sched_pusch->slot)
LOG_W(MAC,
//if (future_ul_tti_req->SFN != sched_pusch->frame || future_ul_tti_req->Slot != sched_pusch->slot)
LOG_D(MAC,
"%d.%d future UL_tti_req's frame.slot %d.%d does not match PUSCH %d.%d\n",
frame, slot,
future_ul_tti_req->SFN,
......
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