Memory bug fixes

Several places where memory ownership was changed
and the original owner was not set to NULL. Also,
the transaction_identifier is now based on the
received dl_dcch_msg in the LTE UE. Still need to
fix the t_id for the NR UE. Also added comments for
RACH procedure in NR UE.
This commit is contained in:
Melissa Elkadi
2021-05-24 18:55:42 -07:00
parent da2873d63c
commit b2b8d297a0
2 changed files with 101 additions and 15 deletions
+69
View File
@@ -138,6 +138,75 @@ void init_nrUE_standalone_thread(int ue_idx)
pthread_setname_np(thread, "oai:nrue-stand");
}
#if 0
static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
{
int current_sfn_slot;
sem_t sfn_slot_semaphore;
int last_sfn_slot = -1;
while (!oai_exit)
{
if (sem_wait(&sfn_slot_semaphore) != 0)
{
LOG_E(NR_MAC, "sem_wait() error\n");
abort();
}
int sfn_slot = current_sfn_slot;
if (sfn_slot == last_sfn_slot)
{
LOG_W(NR_MAC, "repeated sfn_sf = %d.%d\n",
sfn_slot >> 4, sfn_slot & 15);
continue;
}
last_sfn_slot = sfn_slot;
struct rx_tx_thread_data *rtd = arg;
if (rtd == NULL) {
LOG_E(MAC, "[SCHED][UE] rx_tx_thread_data *rtd: NULL pointer\n");
exit_fun("nothing to add");
}
UE_nr_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_NR_UE *UE = NULL;
proc = &PHY_vars_UE_g[0][0]->proc;
int frame_tx = proc->frame_tx;
int nr_slot_tx = proc->nr_slot_tx;
uint8_t mod_id = UE->Mod_id;
NR_PRACH_RESOURCES_t *prach_resources = UE->prach_resources[0];
AssertFatal(prach_resources != NULL, "UE->prach_resources[%u] == NULL\n", 0);
uint8_t nr_prach = 0;
if (UE->mac_enabled == 0)
{
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, "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, 0, nr_slot_tx);
if (nr_prach == 1)
{
nr_Msg1_transmitted(mod_id, UE->CC_id, frame_tx, 0); //Once rach is = 1, then call this
}
else if (nr_prach == 2)
{
LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
UE->UE_mode[0] = PUSCH;
}
else if(nr_prach == 3)
{
LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id);
UE->UE_mode[0] = PRACH;
}
}
}
}
#endif
/*!
* It performs band scanning and synchonization.