Commit 6e4b949b authored by Laurent THOMAS's avatar Laurent THOMAS

MR2416 make frame/slot in ul_config dl_config instead of upper structures...

MR2416 make frame/slot in ul_config dl_config instead of upper structures value, fix modulo computation of frame
parent 2184a94d
...@@ -310,16 +310,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -310,16 +310,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
int CC_id = 0; int CC_id = 0;
uint8_t gNB_id = 0; uint8_t gNB_id = 0;
nr_uplink_indication_t ul_info;
int slots_per_frame = 20; //30 kHZ subcarrier spacing int slots_per_frame = 20; //30 kHZ subcarrier spacing
int slot_ahead = 2; // TODO: Make this dynamic int slot_ahead = 2; // TODO: Make this dynamic
ul_info.cc_id = CC_id; nr_uplink_indication_t ul_info = {.cc_id = CC_id,
ul_info.gNB_index = gNB_id; .gNB_index = gNB_id,
ul_info.module_id = mod_id; .module_id = mod_id,
ul_info.frame_rx = frame; .slot = (slot + slot_ahead) % slots_per_frame,
ul_info.slot_rx = slot; .frame = (slot + slot_ahead >= slots_per_frame) ? (frame + 1) % 1024 : frame};
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
...@@ -330,8 +327,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -330,8 +327,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
free_and_zero(ch_info); free_and_zero(ch_info);
} }
if (is_nr_DL_slot(mac->tdd_UL_DL_ConfigurationCommon, if (is_nr_DL_slot(mac->tdd_UL_DL_ConfigurationCommon, slot)) {
ul_info.slot_rx)) {
memset(&mac->dl_info, 0, sizeof(mac->dl_info)); memset(&mac->dl_info, 0, sizeof(mac->dl_info));
mac->dl_info.cc_id = CC_id; mac->dl_info.cc_id = CC_id;
mac->dl_info.gNB_index = gNB_id; mac->dl_info.gNB_index = gNB_id;
...@@ -345,9 +341,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -345,9 +341,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort();
if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info.slot, mac->frame_type)) {
ul_info.slot_tx, mac->frame_type)) { LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot);
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot_tx);
nr_ue_ul_scheduler(&ul_info); nr_ue_ul_scheduler(&ul_info);
} }
process_queued_nr_nfapi_msgs(mac, sfn_slot); process_queued_nr_nfapi_msgs(mac, sfn_slot);
...@@ -587,17 +582,12 @@ void processSlotTX(void *arg) { ...@@ -587,17 +582,12 @@ void processSlotTX(void *arg) {
// [TODO] mapping right after NR initial sync // [TODO] mapping right after NR initial sync
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
start_meas(&UE->ue_ul_indication_stats); start_meas(&UE->ue_ul_indication_stats);
nr_uplink_indication_t ul_indication; nr_uplink_indication_t ul_indication = {.module_id = UE->Mod_id,
memset((void*)&ul_indication, 0, sizeof(ul_indication)); .gNB_index = proc->gNB_id,
.cc_id = UE->CC_id,
ul_indication.module_id = UE->Mod_id; .frame = proc->frame_tx,
ul_indication.gNB_index = proc->gNB_id; .slot = proc->nr_slot_tx,
ul_indication.cc_id = UE->CC_id; .phy_data = &phy_data};
ul_indication.frame_rx = proc->frame_rx;
ul_indication.slot_rx = proc->nr_slot_rx;
ul_indication.frame_tx = proc->frame_tx;
ul_indication.slot_tx = proc->nr_slot_tx;
ul_indication.phy_data = &phy_data;
UE->if_inst->ul_indication(&ul_indication); UE->if_inst->ul_indication(&ul_indication);
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
......
...@@ -401,14 +401,13 @@ typedef struct { ...@@ -401,14 +401,13 @@ typedef struct {
} fapi_nr_ul_config_request_pdu_t; } fapi_nr_ul_config_request_pdu_t;
typedef struct { typedef struct {
uint16_t sfn; int frame;
uint16_t slot; int slot;
uint8_t number_pdus; int number_pdus;
fapi_nr_ul_config_request_pdu_t ul_config_list[FAPI_NR_UL_CONFIG_LIST_NUM]; fapi_nr_ul_config_request_pdu_t ul_config_list[FAPI_NR_UL_CONFIG_LIST_NUM];
pthread_mutex_t mutex_ul_config; pthread_mutex_t mutex_ul_config;
} fapi_nr_ul_config_request_t; } fapi_nr_ul_config_request_t;
typedef struct { typedef struct {
uint16_t rnti; uint16_t rnti;
uint16_t BWPSize; uint16_t BWPSize;
......
...@@ -268,8 +268,6 @@ typedef enum { ...@@ -268,8 +268,6 @@ typedef enum {
#endif #endif
typedef struct { typedef struct {
int nb_search_space; int nb_search_space;
uint16_t sfn;
uint16_t slot;
fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS]; fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS];
} NR_UE_PDCCH_CONFIG; } NR_UE_PDCCH_CONFIG;
...@@ -330,7 +328,7 @@ typedef struct UE_NR_SCAN_INFO_s { ...@@ -330,7 +328,7 @@ typedef struct UE_NR_SCAN_INFO_s {
} UE_NR_SCAN_INFO_t; } UE_NR_SCAN_INFO_t;
/// Top-level PHY Data Structure for UE /// Top-level PHY Data Structure for UE
typedef struct { typedef struct PHY_VARS_NR_UE_s {
/// \brief Module ID indicator for this instance /// \brief Module ID indicator for this instance
uint8_t Mod_id; uint8_t Mod_id;
/// \brief Component carrier ID for this PHY instance /// \brief Component carrier ID for this PHY instance
......
This diff is collapsed.
...@@ -51,6 +51,6 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config); ...@@ -51,6 +51,6 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config);
\param synch_request including target_Nid_cell*/ \param synch_request including target_Nid_cell*/
void nr_ue_synch_request(nr_synch_request_t *synch_request); void nr_ue_synch_request(nr_synch_request_t *synch_request);
void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack); void update_harq_status(NR_UE_MAC_INST_t *mac, uint8_t harq_pid, uint8_t ack_nack);
#endif #endif
...@@ -875,23 +875,9 @@ int main(int argc, char **argv) ...@@ -875,23 +875,9 @@ int main(int argc, char **argv)
UE_mac->ra.ra_state = RA_SUCCEEDED; UE_mac->ra.ra_state = RA_SUCCEEDED;
nr_dcireq_t dcireq; nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
nr_phy_data_t phy_data = {0}; nr_phy_data_t phy_data = {0};
fapi_nr_dl_config_request_t dl_config = {.sfn = frame, .slot = slot};
memset((void*)&dcireq,0,sizeof(dcireq)); nr_scheduled_response_t scheduled_response = {.dl_config = &dl_config, .phy_data = &phy_data, .mac = UE_mac};
memset((void*)&scheduled_response,0,sizeof(scheduled_response));
dcireq.module_id = 0;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
scheduled_response.dl_config = &dcireq.dl_config_req;
scheduled_response.ul_config = &dcireq.ul_config_req;
scheduled_response.tx_request = NULL;
scheduled_response.module_id = 0;
scheduled_response.CC_id = 0;
scheduled_response.frame = frame;
scheduled_response.slot = slot;
scheduled_response.phy_data = &phy_data;
nr_ue_phy_config_request(&UE_mac->phy_config); nr_ue_phy_config_request(&UE_mac->phy_config);
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
......
...@@ -718,7 +718,6 @@ int main(int argc, char *argv[]) ...@@ -718,7 +718,6 @@ int main(int argc, char *argv[])
uint32_t errors_decoding = 0; uint32_t errors_decoding = 0;
nr_scheduled_response_t scheduled_response={0};
fapi_nr_ul_config_request_t ul_config={0}; fapi_nr_ul_config_request_t ul_config={0};
fapi_nr_tx_request_t tx_req={0}; fapi_nr_tx_request_t tx_req={0};
...@@ -1073,15 +1072,9 @@ int main(int argc, char *argv[]) ...@@ -1073,15 +1072,9 @@ int main(int argc, char *argv[])
nr_schedule_response(Sched_INFO); nr_schedule_response(Sched_INFO);
// --------- setting parameters for UE -------- // --------- setting parameters for UE --------
nr_scheduled_response_t scheduled_response = {.ul_config = &ul_config,
scheduled_response.module_id = 0; .tx_request = &tx_req,
scheduled_response.CC_id = 0; .phy_data = (void *)&phy_data};
scheduled_response.frame = frame;
scheduled_response.slot = slot;
scheduled_response.dl_config = NULL;
scheduled_response.ul_config = &ul_config;
scheduled_response.tx_request = &tx_req;
scheduled_response.phy_data = (void *)&phy_data;
// Config UL TX PDU // Config UL TX PDU
tx_req.slot = slot; tx_req.slot = slot;
......
...@@ -450,7 +450,7 @@ typedef struct { ...@@ -450,7 +450,7 @@ typedef struct {
} NR_BWP_PDCCH_t; } NR_BWP_PDCCH_t;
/*!\brief Top level UE MAC structure */ /*!\brief Top level UE MAC structure */
typedef struct { typedef struct NR_UE_MAC_INST_s {
module_id_t ue_id; module_id_t ue_id;
NR_UE_L2_STATE_t state; NR_UE_L2_STATE_t state;
int servCellIndex; int servCellIndex;
......
...@@ -64,10 +64,17 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in ...@@ -64,10 +64,17 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]), AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus); "Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
// clear ul_config for new frame/slot // clear ul_config for new frame/slot
if ((ul_config->slot != slot_tx || ul_config->sfn != frame_tx) && if ((ul_config->slot != slot_tx || ul_config->frame != frame_tx) && ul_config->number_pdus != 0
ul_config->number_pdus != 0 && && !get_softmodem_params()->emulate_l1) {
!get_softmodem_params()->emulate_l1) { LOG_D(MAC,
LOG_D(MAC, "%d.%d %d.%d f clear ul_config %p t %d pdu %d\n", frame_tx, slot_tx, ul_config->sfn, ul_config->slot, ul_config, pdu_type, ul_config->number_pdus); "%d.%d %d.%d f clear ul_config %p t %d pdu %d\n",
frame_tx,
slot_tx,
ul_config->frame,
ul_config->slot,
ul_config,
pdu_type,
ul_config->number_pdus);
ul_config->number_pdus = 0; ul_config->number_pdus = 0;
memset(ul_config->ul_config_list, 0, sizeof(ul_config->ul_config_list)); memset(ul_config->ul_config_list, 0, sizeof(ul_config->ul_config_list));
} }
...@@ -75,11 +82,15 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in ...@@ -75,11 +82,15 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in
//ul_config->slot = slot_tx; //ul_config->slot = slot_tx;
//ul_config->sfn = frame_tx; //ul_config->sfn = frame_tx;
ul_config->slot = slot_tx; ul_config->slot = slot_tx;
ul_config->sfn = frame_tx; ul_config->frame = frame_tx;
ul_config->number_pdus++; ul_config->number_pdus++;
LOG_D(NR_MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus); LOG_D(NR_MAC,
"In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n",
__FUNCTION__,
ul_config->frame,
ul_config->slot,
ul_config->number_pdus);
} }
void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
...@@ -97,8 +108,14 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, ...@@ -97,8 +108,14 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
scheduled_response->tx_request = tx_request; scheduled_response->tx_request = tx_request;
scheduled_response->module_id = mod_id; scheduled_response->module_id = mod_id;
scheduled_response->CC_id = cc_id; scheduled_response->CC_id = cc_id;
scheduled_response->frame = frame; if (dl_config) {
scheduled_response->slot = slot; dl_config->sfn = frame;
dl_config->slot = slot;
}
if (ul_config) {
ul_config->frame = frame;
ul_config->slot = slot;
}
scheduled_response->phy_data = phy_data; scheduled_response->phy_data = phy_data;
} }
...@@ -988,8 +1005,8 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) ...@@ -988,8 +1005,8 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info)
void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
{ {
int cc_id = ul_info->cc_id; int cc_id = ul_info->cc_id;
frame_t frame_tx = ul_info->frame_tx; frame_t frame_tx = ul_info->frame;
slot_t slot_tx = ul_info->slot_tx; slot_t slot_tx = ul_info->slot;
module_id_t mod_id = ul_info->module_id; module_id_t mod_id = ul_info->module_id;
uint32_t gNB_index = ul_info->gNB_index; uint32_t gNB_index = ul_info->gNB_index;
...@@ -1013,9 +1030,14 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) ...@@ -1013,9 +1030,14 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
// AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus) // AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus)
if (ul_config) { if (ul_config) {
pthread_mutex_lock(&ul_config->mutex_ul_config); pthread_mutex_lock(&ul_config->mutex_ul_config);
if ((ul_info->slot_tx == ul_config->slot && ul_info->frame_tx == ul_config->sfn) && ul_config->number_pdus > 0){ if (frame_tx == ul_config->frame && ul_config->number_pdus > 0) {
LOG_D(NR_MAC,
LOG_D(NR_MAC, "[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n", frame_tx, slot_tx, ul_config->number_pdus, ul_config->sfn, ul_config->slot); "[%d.%d]: number of UL PDUs: %d with UL transmission in [%d.%d]\n",
frame_tx,
slot_tx,
ul_config->number_pdus,
ul_config->frame,
ul_config->slot);
uint8_t ulsch_input_buffer_array[NFAPI_MAX_NUM_UL_PDU][MAX_ULSCH_PAYLOAD_BYTES]; uint8_t ulsch_input_buffer_array[NFAPI_MAX_NUM_UL_PDU][MAX_ULSCH_PAYLOAD_BYTES];
nr_scheduled_response_t scheduled_response; nr_scheduled_response_t scheduled_response;
...@@ -1062,11 +1084,11 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) ...@@ -1062,11 +1084,11 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
if (ra->ra_state == WAIT_CONTENTION_RESOLUTION && !ra->cfra){ if (ra->ra_state == WAIT_CONTENTION_RESOLUTION && !ra->cfra){
LOG_I(NR_MAC,"[RAPROC][%d.%d] RA-Msg3 retransmitted\n", frame_tx, slot_tx); LOG_I(NR_MAC,"[RAPROC][%d.%d] RA-Msg3 retransmitted\n", frame_tx, slot_tx);
// 38.321 restart the ra-ContentionResolutionTimer at each HARQ retransmission in the first symbol after the end of the Msg3 transmission // 38.321 restart the ra-ContentionResolutionTimer at each HARQ retransmission in the first symbol after the end of the Msg3 transmission
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->gNB_index); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame, ul_info->slot, ul_info->gNB_index);
} }
if (ra->ra_state == WAIT_RAR && !ra->cfra){ if (ra->ra_state == WAIT_RAR && !ra->cfra){
LOG_A(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 transmitted\n", frame_tx, slot_tx); LOG_A(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 transmitted\n", frame_tx, slot_tx);
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->gNB_index); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, frame_tx, slot_tx, ul_info->gNB_index);
} }
} }
} }
......
...@@ -747,11 +747,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -747,11 +747,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
mac->frame_type) mac->frame_type)
&& mac->ra.ra_state != RA_SUCCEEDED) { && mac->ra.ra_state != RA_SUCCEEDED) {
// If we filled dl_info AFTER we got the slot indication, we want to check if we should fill tx_req: // If we filled dl_info AFTER we got the slot indication, we want to check if we should fill tx_req:
nr_uplink_indication_t ul_info = { nr_uplink_indication_t ul_info = {.slot = (slot + slot_ahead) % slots_per_frame,
.frame_rx = frame, .frame = slot + slot_ahead >= slots_per_frame ? (frame + 1) % 1024 : frame};
.slot_rx = slot,
.slot_tx = (slot + slot_ahead) % slots_per_frame,
.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx};
nr_ue_ul_scheduler(&ul_info); nr_ue_ul_scheduler(&ul_info);
} }
} }
...@@ -1033,11 +1030,16 @@ void *nrue_standalone_pnf_task(void *context) ...@@ -1033,11 +1030,16 @@ void *nrue_standalone_pnf_task(void *context)
} }
// L2 Abstraction Layer // L2 Abstraction Layer
int handle_bcch_bch(module_id_t module_id, int cc_id, static int handle_bcch_bch(module_id_t module_id,
unsigned int gNB_index, void *phy_data, uint8_t *pduP, int cc_id,
unsigned int gNB_index,
void *phy_data,
uint8_t *pduP,
unsigned int additional_bits, unsigned int additional_bits,
uint32_t ssb_index, uint32_t ssb_length, uint32_t ssb_index,
uint16_t ssb_start_subcarrier, uint16_t cell_id) uint32_t ssb_length,
uint16_t ssb_start_subcarrier,
uint16_t cell_id)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->mib_ssb = ssb_index; mac->mib_ssb = ssb_index;
...@@ -1052,19 +1054,28 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, ...@@ -1052,19 +1054,28 @@ int handle_bcch_bch(module_id_t module_id, int cc_id,
} }
// L2 Abstraction Layer // L2 Abstraction Layer
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len) static int handle_bcch_dlsch(module_id_t module_id,
int cc_id,
unsigned int gNB_index,
uint8_t ack_nack,
uint8_t *pduP,
uint32_t pdu_len)
{ {
return nr_ue_decode_BCCH_DL_SCH(module_id, cc_id, gNB_index, ack_nack, pduP, pdu_len); return nr_ue_decode_BCCH_DL_SCH(module_id, cc_id, gNB_index, ack_nack, pduP, pdu_len);
} }
// L2 Abstraction Layer // L2 Abstraction Layer
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){ static int handle_dci(module_id_t module_id,
int cc_id,
unsigned int gNB_index,
frame_t frame,
int slot,
fapi_nr_dci_indication_pdu_t *dci)
{
return nr_ue_process_dci_indication_pdu(module_id, cc_id, gNB_index, frame, slot, dci); return nr_ue_process_dci_indication_pdu(module_id, cc_id, gNB_index, frame, slot, dci);
} }
void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm) static void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm)
{ {
mac->ssb_measurements.ssb_index = ssb_index; mac->ssb_measurements.ssb_index = ssb_index;
mac->ssb_measurements.ssb_rsrp_dBm = rsrp_dbm; mac->ssb_measurements.ssb_rsrp_dBm = rsrp_dbm;
...@@ -1072,7 +1083,7 @@ void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm) ...@@ -1072,7 +1083,7 @@ void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm)
// L2 Abstraction Layer // L2 Abstraction Layer
// Note: sdu should always be processed because data and timing advance updates are transmitted by the UE // Note: sdu should always be processed because data and timing advance updates are transmitted by the UE
static int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id) static int8_t handle_dlsch(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, int pdu_id)
{ {
/* L1 assigns harq_pid, but in emulated L1 mode we need to assign /* L1 assigns harq_pid, but in emulated L1 mode we need to assign
the harq_pid based on the saved global g_harq_pid. Because we are the harq_pid based on the saved global g_harq_pid. Because we are
...@@ -1081,7 +1092,7 @@ static int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -1081,7 +1092,7 @@ static int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id)
if (get_softmodem_params()->emulate_l1) if (get_softmodem_params()->emulate_l1)
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid; dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid;
update_harq_status(dl_info->module_id, update_harq_status(mac,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid, dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack); dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack);
if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack) if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack)
...@@ -1090,7 +1101,7 @@ static int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -1090,7 +1101,7 @@ static int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id)
return 0; return 0;
} }
void handle_rlm(rlm_t rlm_result, int frame, module_id_t module_id) static void handle_rlm(rlm_t rlm_result, int frame, module_id_t module_id)
{ {
if (rlm_result == RLM_no_monitoring) if (rlm_result == RLM_no_monitoring)
return; return;
...@@ -1098,15 +1109,17 @@ void handle_rlm(rlm_t rlm_result, int frame, module_id_t module_id) ...@@ -1098,15 +1109,17 @@ void handle_rlm(rlm_t rlm_result, int frame, module_id_t module_id)
nr_mac_rrc_sync_ind(module_id, frame, is_sync); nr_mac_rrc_sync_ind(module_id, frame, is_sync);
} }
int8_t handle_csirs_measurements(module_id_t module_id, frame_t frame, int slot, fapi_nr_csirs_measurements_t *csirs_measurements) static int8_t handle_csirs_measurements(module_id_t module_id,
frame_t frame,
int slot,
fapi_nr_csirs_measurements_t *csirs_measurements)
{ {
handle_rlm(csirs_measurements->radiolink_monitoring, frame, module_id); handle_rlm(csirs_measurements->radiolink_monitoring, frame, module_id);
return nr_ue_process_csirs_measurements(module_id, frame, slot, csirs_measurements); return nr_ue_process_csirs_measurements(module_id, frame, slot, csirs_measurements);
} }
void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack) void update_harq_status(NR_UE_MAC_INST_t *mac, uint8_t harq_pid, uint8_t ack_nack)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[harq_pid]; NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[harq_pid];
if (current_harq->active) { if (current_harq->active) {
...@@ -1127,8 +1140,9 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac ...@@ -1127,8 +1140,9 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
{ {
int ret = pthread_mutex_lock(&mac_IF_mutex);
pthread_mutex_lock(&mac_IF_mutex); AssertFatal(!ret, "mutex failed %d\n", ret);
LOG_D(PHY, "Locked in ul, slot %d\n", ul_info->slot);
module_id_t module_id = ul_info->module_id; module_id_t module_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
...@@ -1136,9 +1150,8 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) ...@@ -1136,9 +1150,8 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n", LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n",
__FUNCTION__, __LINE__, mac->ra.ra_state); __FUNCTION__, __LINE__, mac->ra.ra_state);
if (mac->phy_config_request_sent && is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) if (mac->phy_config_request_sent && is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info->slot, mac->frame_type))
nr_ue_ul_scheduler(ul_info); nr_ue_ul_scheduler(ul_info);
pthread_mutex_unlock(&mac_IF_mutex); pthread_mutex_unlock(&mac_IF_mutex);
return 0; return 0;
...@@ -1195,7 +1208,9 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) ...@@ -1195,7 +1208,9 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
for (int i = 0; i < dl_info->rx_ind->number_pdus; ++i) { for (int i = 0; i < dl_info->rx_ind->number_pdus; ++i) {
fapi_nr_rx_indication_body_t rx_indication_body = dl_info->rx_ind->rx_indication_body[i]; fapi_nr_rx_indication_body_t rx_indication_body = dl_info->rx_ind->rx_indication_body[i];
LOG_D(NR_MAC, "Sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", LOG_D(NR_MAC,
"slot %d Sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n",
dl_info->slot,
rx_indication_body.pdu_type, rx_indication_body.pdu_type,
dl_info->rx_ind->number_pdus); dl_info->rx_ind->number_pdus);
...@@ -1225,10 +1240,10 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) ...@@ -1225,10 +1240,10 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
rx_indication_body.pdsch_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; rx_indication_body.pdsch_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB;
break; break;
case FAPI_NR_RX_PDU_TYPE_DLSCH: case FAPI_NR_RX_PDU_TYPE_DLSCH:
ret_mask |= (handle_dlsch(dl_info, i)) << FAPI_NR_RX_PDU_TYPE_DLSCH; ret_mask |= (handle_dlsch(mac, dl_info, i)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
break; break;
case FAPI_NR_RX_PDU_TYPE_RAR: case FAPI_NR_RX_PDU_TYPE_RAR:
ret_mask |= (handle_dlsch(dl_info, i)) << FAPI_NR_RX_PDU_TYPE_RAR; ret_mask |= (handle_dlsch(mac, dl_info, i)) << FAPI_NR_RX_PDU_TYPE_RAR;
if (!dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.ack_nack) if (!dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.ack_nack)
LOG_W(PHY, "Received a RAR-Msg2 but LDPC decode failed\n"); LOG_W(PHY, "Received a RAR-Msg2 but LDPC decode failed\n");
else else
......
...@@ -95,14 +95,10 @@ typedef struct { ...@@ -95,14 +95,10 @@ typedef struct {
uint32_t gNB_index; uint32_t gNB_index;
/// component carrier id /// component carrier id
int cc_id; int cc_id;
/// frame
frame_t frame_rx;
/// slot rx
uint32_t slot_rx;
/// frame tx /// frame tx
frame_t frame_tx; frame_t frame;
/// slot tx /// slot tx
uint32_t slot_tx; uint32_t slot;
/// dci reception indication structure /// dci reception indication structure
fapi_nr_dci_indication_t *dci_ind; fapi_nr_dci_indication_t *dci_ind;
...@@ -142,17 +138,13 @@ typedef struct { ...@@ -142,17 +138,13 @@ typedef struct {
// Downlink subframe P7 // Downlink subframe P7
struct PHY_VARS_NR_UE_s;
struct NR_UE_MAC_INST_s;
typedef struct { typedef struct {
/// module id /// module id
module_id_t module_id; module_id_t module_id;
/// component carrier id /// component carrier id
int CC_id; int CC_id;
/// frame
frame_t frame;
/// slot
int slot;
/// NR UE FAPI-like P7 message, direction: L2 to L1 /// NR UE FAPI-like P7 message, direction: L2 to L1
/// downlink transmission configuration request structure /// downlink transmission configuration request structure
fapi_nr_dl_config_request_t *dl_config; fapi_nr_dl_config_request_t *dl_config;
...@@ -172,6 +164,7 @@ typedef struct { ...@@ -172,6 +164,7 @@ typedef struct {
/// PHY data structure initially passed on to L2 via the nr_downlink_indication_t and /// PHY data structure initially passed on to L2 via the nr_downlink_indication_t and
/// returned to L1 via nr_scheduled_response_t /// returned to L1 via nr_scheduled_response_t
void *phy_data; void *phy_data;
struct NR_UE_MAC_INST_s *mac;
} nr_scheduled_response_t; } nr_scheduled_response_t;
typedef struct { typedef struct {
...@@ -335,33 +328,5 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info); ...@@ -335,33 +328,5 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info);
int nr_ue_dcireq(nr_dcireq_t *dcireq); int nr_ue_dcireq(nr_dcireq_t *dcireq);
// TODO check
/**\brief handle BCCH-BCH message from dl_indication
\param phy_data PHY structure to be filled in by the callee in the FAPI call (L1 caller -> indication to L2 -> FAPI call to L1 callee)
\param pduP pointer to bch pdu
\param additional_bits corresponding to 38.212 ch.7
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
\param ssb_length corresponding to L1 parameter L_ssb
\param cell_id cell id */
int handle_bcch_bch(module_id_t module_id,
int cc_id,
unsigned int gNB_index,
void *phy_data,
uint8_t *pduP,
unsigned int additional_bits,
uint32_t ssb_index,
uint32_t ssb_length,
uint16_t ssb_start_subcarrier,
uint16_t cell_id);
// TODO check
/**\brief handle BCCH-DL-SCH message from dl_indication
\param pdu_len length(bytes) of pdu
\param pduP pointer to pdu*/
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len);
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
#endif #endif
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