Notes for Sync changes and format cleanup

This commit is contained in:
Andrew Burger
2020-06-09 10:09:32 -07:00
parent de33309935
commit e7eabf3f0f
+19 -16
View File
@@ -966,7 +966,7 @@ void ue_stub_rx_handler(unsigned int num_bytes,
} }
} }
uint64_t clock_usec() { static uint64_t clock_usec() {
struct timespec t; struct timespec t;
if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) { if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) {
abort(); abort();
@@ -1078,15 +1078,18 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
exit_fun("nothing to add"); exit_fun("nothing to add");
} }
} }
proc->subframe_rx=timer_subframe; proc->subframe_rx = timer_subframe; // set this to sf from proxy **Get from Queue - Andrew
proc->frame_rx = timer_frame; proc->frame_rx = timer_frame; // set this to sfn from proxy **Get from Queue - Andrew
// variable to say that there has been a change in sf and sfn - Andrew
// FDD and TDD tx timing settings. // FDD and TDD tx timing settings.
// XXX:It is the result of timing adjustment in debug. // XXX:It is the result of timing adjustment in debug.
// It is necessary to investigate why this will work in the future. // It is necessary to investigate why this will work in the future.
proc->subframe_tx = (timer_subframe + sf_ahead) % 10; proc->subframe_tx = (timer_subframe + sf_ahead) % 10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx > (9 - sf_ahead) ? 1 : 0); proc->frame_tx = proc->frame_rx + (proc->subframe_rx > (9 - sf_ahead) ? 1 : 0);
//oai_subframe_ind(proc->frame_rx, proc->subframe_rx); //oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
if (NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF) {
if (UE != NULL) { if (UE != NULL) {
if (UE->frame_parms.frame_type == FDD) { if (UE->frame_parms.frame_type == FDD) {
oai_subframe_ind(proc->frame_rx, proc->subframe_rx); oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
@@ -1097,6 +1100,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
// Default will be FDD // Default will be FDD
oai_subframe_ind(proc->frame_rx, proc->subframe_rx); oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
} }
}
//Guessing that the next 4 lines are not needed for the phy_stub mode. //Guessing that the next 4 lines are not needed for the phy_stub mode.
/*initRefTimes(t2); /*initRefTimes(t2);
@@ -1222,6 +1226,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) { //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
// if sfn_sf change variable is true
for (ue_index = 0; ue_index < ue_num; ue_index++) { for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index;
UE = PHY_vars_UE_g[ue_Mod_id][0]; UE = PHY_vars_UE_g[ue_Mod_id][0];
@@ -1235,21 +1240,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if (UE->frame_parms.frame_type == TDD) { if (UE->frame_parms.frame_type == TDD) {
LOG_D(PHY, "TDD%d,%s: calling UE_RX\n", LOG_D(PHY, "TDD%d,%s: calling UE_RX\n",
UE->frame_parms.tdd_config, UE->frame_parms.tdd_config,
(sf_type==SF_DL? "SF_DL" : (sf_type == SF_DL ? "SF_DL" : (sf_type == SF_UL ? "SF_UL" : (sf_type == SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
} else { } else {
LOG_D(PHY, "%s,%s: calling UE_RX\n", LOG_D(PHY, "%s,%s: calling UE_RX\n",
(UE->frame_parms.frame_type==FDD? "FDD": (UE->frame_parms.frame_type == FDD ? "FDD" : (UE->frame_parms.frame_type == TDD ? "TDD" : "UNKNOWN_DUPLEX_MODE")),
(UE->frame_parms.frame_type==TDD? "TDD":"UNKNOWN_DUPLEX_MODE")), (sf_type == SF_DL ? "SF_DL" : (sf_type == SF_UL ? "SF_UL" : (sf_type == SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
(sf_type==SF_DL? "SF_DL" :
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
} }
phy_procedures_UE_SL_RX(UE, proc); phy_procedures_UE_SL_RX(UE, proc);
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) if (NFAPI_MODE != NFAPI_UE_STUB_PNF && NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF)
phy_procedures_UE_SL_TX(UE, proc); phy_procedures_UE_SL_TX(UE, proc);
} }
@@ -1286,17 +1286,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
next_ra_frame++; next_ra_frame++;
if (next_ra_frame > 500) { if (next_ra_frame > 500) {
// check if we have PRACH opportunity // check if we have PRACH opportunity
LOG_I(MAC, "is_prach_subframe: %d UE_mac_inst[ue_MOD_id].SI_Decoded: %u\n",
is_prach_subframe(&UE->frame_parms, proc->frame_tx, proc->subframe_tx),
UE_mac_inst[ue_Mod_id].SI_Decoded);
if (is_prach_subframe(&UE->frame_parms, proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { if (is_prach_subframe(&UE->frame_parms, proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
// The one working strangely... // The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
LOG_I(MAC, "Celtics prach_resources %p\n", prach_resources);
if (prach_resources != NULL) { if (prach_resources != NULL) {
UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx;
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx); LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, proc->frame_tx, proc->subframe_tx);
fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx, proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx, proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0);
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
@@ -1320,6 +1322,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
phy_procedures_UE_SL_RX(UE, proc); phy_procedures_UE_SL_RX(UE, proc);
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) } //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
// end of if - Andrew Burger
if (phy_stub_ticking != NULL) { if (phy_stub_ticking != NULL) {
phy_stub_ticking->num_single_thread[ue_thread_id] = -1; phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
} }