Commit 3f12410e authored by Chenyu's avatar Chenyu

added msg4

parent 96a8c90e
...@@ -341,6 +341,11 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ...@@ -341,6 +341,11 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
ue->UE_mode[gNB_id] = PRACH; ue->UE_mode[gNB_id] = PRACH;
ue->prach_resources[gNB_id]->sync_frame = frame_rx; ue->prach_resources[gNB_id]->sync_frame = frame_rx;
ue->prach_resources[gNB_id]->init_msg1 = 0; ue->prach_resources[gNB_id]->init_msg1 = 0;
LOG_I(PHY,"[UE %d] frame %d, nr_tti_rx %d, outofsync, return to PRACH\n",
ue->Mod_id,
frame_rx,
nr_tti_rx
);
} }
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
...@@ -782,8 +787,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ ...@@ -782,8 +787,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
return -1; return -1;
} }
else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS)
if (pdsch == RA_PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; if (dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups == 2) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1];
else if (pdsch == PDSCH) { else if (dlsch0->harq_processes[harq_pid]->n_dmrs_cdm_groups == 1) {
if (nr_rx_pdsch(ue, if (nr_rx_pdsch(ue,
pdsch, pdsch,
eNB_id, eNB_id,
...@@ -814,6 +819,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ ...@@ -814,6 +819,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
proc->first_symbol_available = 1; proc->first_symbol_available = 1;
} }
} // CRNTI active } // CRNTI active
} }
return 0; return 0;
} }
......
...@@ -561,7 +561,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -561,7 +561,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// TbD Msg3 Retransmissions to be scheduled by DCI 0_0 // TbD Msg3 Retransmissions to be scheduled by DCI 0_0
//mac->RA_active = 0; //mac->RA_active = 0;
mac->RA_window_cnt = -1; mac->RA_window_cnt = -1;
mac->ra_state = RA_SUCCEEDED; mac->ra_state = WAIT_CONTENTION_RESOLUTION;
mac->generate_nr_prach = 2; mac->generate_nr_prach = 2;
LOG_I(MAC, "[MAC][UE %d][RAPROC]: RAR successfully received \n", mod_id); LOG_I(MAC, "[MAC][UE %d][RAPROC]: RAR successfully received \n", mod_id);
......
...@@ -141,6 +141,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -141,6 +141,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
case NR_RNTI_CS: case NR_RNTI_CS:
break; break;
case NR_RNTI_TC: case NR_RNTI_TC:
// we use the initial DL BWP
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->t_crnti;
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id);
break; break;
case NR_RNTI_SP_CSI: case NR_RNTI_SP_CSI:
break; break;
...@@ -223,6 +231,10 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl ...@@ -223,6 +231,10 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
break; break;
case WAIT_CONTENTION_RESOLUTION: case WAIT_CONTENTION_RESOLUTION:
rel15->rnti = mac->t_crnti; rel15->rnti = mac->t_crnti;
rel15->num_dci_options = 1;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, ss_id);
fill_dci_search_candidates(ss, rel15);
break; break;
default: default:
break; break;
......
...@@ -366,7 +366,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -366,7 +366,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
if (add_ue == 1 && get_softmodem_params()->phy_test) { if (add_ue == 1 && get_softmodem_params()->phy_test) {
const int UE_id = add_new_nr_ue(Mod_idP,rnti); const int UE_id = add_new_nr_ue(Mod_idP,rnti,1);
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
compute_csi_bitlen (secondaryCellGroup, UE_info, UE_id); compute_csi_bitlen (secondaryCellGroup, UE_info, UE_id);
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList =
......
...@@ -506,7 +506,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -506,7 +506,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Otherwise already consider 5G already connected // Otherwise already consider 5G already connected
RC.nrmac[module_idP]->current_slot=slot; RC.nrmac[module_idP]->current_slot=slot;
if (get_softmodem_params()->phy_test == 0) { if (get_softmodem_params()->phy_test == 0) {
nr_schedule_RA(module_idP, frame, slot); nr_schedule_RA(module_idP, frame, slot, num_slots_per_tdd);
nr_schedule_reception_msg3(module_idP, 0, frame, slot); nr_schedule_reception_msg3(module_idP, 0, frame, slot);
} }
...@@ -525,7 +525,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -525,7 +525,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (UE_info->active[UE_id] if (UE_info->active[UE_id]
&& (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd)) && (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd))
&& slot < 10 && slot == 2) { && slot < 10 && slot == 1) {
ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd; ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd;
nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd); nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd);
......
...@@ -549,7 +549,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, ...@@ -549,7 +549,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
slot, slot,
num_slots_per_tdd, num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx, &sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx); &sched_ctrl->pucch_occ_idx,
1);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n"); AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
...@@ -620,6 +621,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, ...@@ -620,6 +621,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
>> 3; >> 3;
} while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes); } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes);
sched_ctrl->rbSize = rbSize; sched_ctrl->rbSize = rbSize;
sched_ctrl->rbStart = rbStart; sched_ctrl->rbStart = rbStart;
} }
......
...@@ -337,7 +337,8 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -337,7 +337,8 @@ void nr_preprocessor_phytest(module_id_t module_id,
slot, slot,
num_slots_per_tdd, num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx, &sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx); &sched_ctrl->pucch_occ_idx,
1);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n"); AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
sched_ctrl->rbStart = rbStart; sched_ctrl->rbStart = rbStart;
......
...@@ -387,7 +387,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -387,7 +387,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
current_rnti); current_rnti);
continue; continue;
} }
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti); const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, 0);
UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup; UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup;
compute_csi_bitlen(ra->secondaryCellGroup, UE_info, UE_id); compute_csi_bitlen(ra->secondaryCellGroup, UE_info, UE_id);
UE_info->UE_beam_index[UE_id] = ra->beam_id; UE_info->UE_beam_index[UE_id] = ra->beam_id;
...@@ -408,11 +408,16 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -408,11 +408,16 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
free(ra->preambles.preamble_list); free(ra->preambles.preamble_list);
ra->state = RA_IDLE; //ra->state = RA_IDLE;
LOG_I(MAC, // LOG_I(MAC,
"reset RA state information for RA-RNTI %04x/index %d\n", // "reset RA state information for RA-RNTI %04x/index %d\n",
ra->rnti, // ra->rnti,
i); // i);
//ra->state = RA_IDLE;
ra->state = Msg4;
ra->Msg4_frame = ( frameP +2 ) % 1024;
ra->Msg4_slot = 1;
LOG_I(MAC, "set RA state to Msg4 for RA-RNTI %04x, msg4 frame %d %d\n", ra->rnti, ra->Msg4_frame, ra->Msg4_slot);
return; return;
} }
} }
......
...@@ -90,7 +90,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -90,7 +90,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
/////// Random Access MAC-PHY interface functions and primitives /////// /////// Random Access MAC-PHY interface functions and primitives ///////
void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int num_slots_per_tdds);
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure. /* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
@param module_idP Instance ID of gNB @param module_idP Instance ID of gNB
...@@ -141,6 +141,33 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -141,6 +141,33 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP); sub_frame_t subframeP);
void nr_fill_nfapi_dl_pdu_common(int Mod_idP,
int UE_id,
int bwp_id,
NR_SearchSpace_t *ss,
NR_ControlResourceSet_t *coreset,
nfapi_nr_dl_tti_request_body_t *dl_req,
NR_sched_pucch *pucch_sched,
int nrOfLayers,
uint8_t mcs,
uint16_t rbSize,
uint16_t rbStart,
uint8_t numDmrsCdmGrpsNoData,
nfapi_nr_dmrs_type_e dmrsConfigType,
uint8_t table_idx,
uint16_t R,
uint8_t Qm,
uint32_t TBS,
int time_domain_assignment,
int StartSymbolIndex,
int NrOfSymbols,
uint8_t aggregation_level,
int CCEIndex,
int harq_pid,
int ndi,
int round);
void nr_fill_nfapi_dl_pdu(int Mod_id, void nr_fill_nfapi_dl_pdu(int Mod_id,
nfapi_nr_dl_tti_request_body_t *dl_req, nfapi_nr_dl_tti_request_body_t *dl_req,
rnti_t rnti, rnti_t rnti,
...@@ -197,7 +224,8 @@ void nr_acknack_scheduling(int Mod_idP, ...@@ -197,7 +224,8 @@ void nr_acknack_scheduling(int Mod_idP,
sub_frame_t slotP, sub_frame_t slotP,
int slots_per_tdd, int slots_per_tdd,
int *pucch_id, int *pucch_id,
int *pucch_occ); int *pucch_occ,
int isUEspec);
int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l); int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l);
...@@ -303,9 +331,11 @@ void add_nr_ue_list(NR_UE_list_t *listP, int UE_id); ...@@ -303,9 +331,11 @@ void add_nr_ue_list(NR_UE_list_t *listP, int UE_id);
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP); int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP);
int find_nr_UE_id_msg4(module_id_t mod_idP, rnti_t rntiP);
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP); int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP); int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, int isActive);
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti); void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
......
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