Commit a70fa82a authored by cig's avatar cig

Removed phy vars members from ue mac inst struct

parent 156defcd
...@@ -4520,7 +4520,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4520,7 +4520,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
// ask L2 for RACH transport // ask L2 for RACH transport
if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) { if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) {
LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_tti_tx); LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_tti_tx);
ue->prach_resources[gNB_id] = nr_ue_get_rach(mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx); nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx);
} }
} }
......
...@@ -136,8 +136,6 @@ typedef struct { ...@@ -136,8 +136,6 @@ typedef struct {
uint8_t RA_prachMaskIndex; uint8_t RA_prachMaskIndex;
/// Flag indicating Preamble set (A,B) used for first Msg3 transmission /// Flag indicating Preamble set (A,B) used for first Msg3 transmission
uint8_t RA_usedGroupA; uint8_t RA_usedGroupA;
/// Random-access Resources
NR_PRACH_RESOURCES_t RA_prach_resources;
/// BeamfailurerecoveryConfig /// BeamfailurerecoveryConfig
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig; NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
/// Preamble Tx Counter /// Preamble Tx Counter
...@@ -169,10 +167,6 @@ typedef struct { ...@@ -169,10 +167,6 @@ typedef struct {
uint8_t RA_RAPID_found; uint8_t RA_RAPID_found;
/// Flag to monitor if BI was received in RAR /// Flag to monitor if BI was received in RAR
uint8_t RA_BI_found; uint8_t RA_BI_found;
/// UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE
/// where the UE_mode originally is for the full stack operation mode. The transitions between the states of the UE_Mode
/// will be triggered within phy_stub_ue.c in this case
UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_gNB_MAX];
//// FAPI-like interface message //// FAPI-like interface message
fapi_nr_tx_request_t tx_request; fapi_nr_tx_request_t tx_request;
......
...@@ -185,7 +185,7 @@ int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu, ...@@ -185,7 +185,7 @@ int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu,
@param Mod_id Module id of UE @param Mod_id Module id of UE
@returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE
*/ */
int8_t nr_get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id); int8_t nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t module_idP, uint8_t CC_id);
/** \brief Function to compute DELTA_PREAMBLE from 38.321 subclause 7.3 /** \brief Function to compute DELTA_PREAMBLE from 38.321 subclause 7.3
(for RA power ramping procedure and Msg3 PUSCH power control policy) (for RA power ramping procedure and Msg3 PUSCH power control policy)
......
...@@ -133,11 +133,10 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){ ...@@ -133,11 +133,10 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){
} }
/* TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration */ /* TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration */
int8_t nr_get_Po_NOMINAL_PUSCH(module_id_t mod_id, uint8_t CC_id){ int8_t nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id){
NR_UE_MAC_INST_t *nr_UE_mac_inst = get_mac_inst(mod_id); NR_UE_MAC_INST_t *nr_UE_mac_inst = get_mac_inst(mod_id);
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = nr_UE_mac_inst->nr_rach_ConfigCommon; NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = nr_UE_mac_inst->nr_rach_ConfigCommon;
NR_PRACH_RESOURCES_t *prach_resources = &nr_UE_mac_inst->RA_prach_resources;
AssertFatal(nr_rach_ConfigCommon != NULL, "[UE %d] CCid %d FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id, CC_id); AssertFatal(nr_rach_ConfigCommon != NULL, "[UE %d] CCid %d FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id, CC_id);
......
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
#include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_COMMON/nr_mac.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h" #include "LAYER2/NR_MAC_UE/mac_proto.h"
extern UE_MODE_t get_nrUE_mode(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id);
extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9]; extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9]; extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
...@@ -76,10 +74,10 @@ void nr_get_prach_resources(module_id_t mod_id, ...@@ -76,10 +74,10 @@ void nr_get_prach_resources(module_id_t mod_id,
uint8_t gNB_id, uint8_t gNB_id,
uint8_t t_id, uint8_t t_id,
uint8_t first_Msg3, uint8_t first_Msg3,
NR_PRACH_RESOURCES_t *prach_resources,
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){ NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
NR_PRACH_RESOURCES_t *prach_resources = &mac->RA_prach_resources;
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->nr_rach_ConfigCommon; NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->nr_rach_ConfigCommon;
// NR_BeamFailureRecoveryConfig_t *beam_failure_recovery_config = &mac->RA_BeamFailureRecoveryConfig; // todo // NR_BeamFailureRecoveryConfig_t *beam_failure_recovery_config = &mac->RA_BeamFailureRecoveryConfig; // todo
...@@ -244,7 +242,7 @@ void nr_get_prach_resources(module_id_t mod_id, ...@@ -244,7 +242,7 @@ void nr_get_prach_resources(module_id_t mod_id,
if (mac->RA_PREAMBLE_TRANSMISSION_COUNTER > 1) if (mac->RA_PREAMBLE_TRANSMISSION_COUNTER > 1)
mac->RA_PREAMBLE_TRANSMISSION_COUNTER++; mac->RA_PREAMBLE_TRANSMISSION_COUNTER++;
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(mod_id, CC_id); prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id);
/* RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted) /* RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted)
// 1) this does not apply to contention-free RA Preamble for beam failure recovery request // 1) this does not apply to contention-free RA Preamble for beam failure recovery request
...@@ -324,7 +322,8 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint ...@@ -324,7 +322,8 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
/// the RA procedure on a SCell shall only be initiated by PDCCH order /// the RA procedure on a SCell shall only be initiated by PDCCH order
// WIP // WIP
NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
module_id_t mod_id,
int CC_id, int CC_id,
UE_MODE_t UE_mode, UE_MODE_t UE_mode,
frame_t frame, frame_t frame,
...@@ -336,7 +335,6 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -336,7 +335,6 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
uint16_t size_sdu = 0; uint16_t size_sdu = 0;
unsigned short post_padding; unsigned short post_padding;
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (struct NR_RACH_ConfigCommon_t *) NULL; NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (struct NR_RACH_ConfigCommon_t *) NULL;
NR_PRACH_RESOURCES_t *prach_resources = &mac->RA_prach_resources;
int32_t frame_diff = 0; int32_t frame_diff = 0;
uint8_t sdu_lcids[NB_RB_MAX] = {0}; // TBR uint8_t sdu_lcids[NB_RB_MAX] = {0}; // TBR
...@@ -353,7 +351,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -353,7 +351,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
if (mac->nr_rach_ConfigCommon) { // TBR check the condition if (mac->nr_rach_ConfigCommon) { // TBR check the condition
nr_rach_ConfigCommon = mac->nr_rach_ConfigCommon; nr_rach_ConfigCommon = mac->nr_rach_ConfigCommon;
} else return NULL; } else prach_resources = NULL;
if (mac->RA_active == 0) { if (mac->RA_active == 0) {
/* RA not active - checking if RRC is ready to initiate the RA procedure */ /* RA not active - checking if RRC is ready to initiate the RA procedure */
...@@ -474,7 +472,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -474,7 +472,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
} }
// Fill in preamble and PRACH resources // Fill in preamble and PRACH resources
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, NULL); nr_get_prach_resources(prach_resources, mod_id, CC_id, gNB_id, nr_tti_tx, 1, NULL);
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
(uint8_t *) payload, // logical channel payload (uint8_t *) payload, // logical channel payload
...@@ -494,7 +492,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -494,7 +492,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
payload[offset + j] = 0; // mac_pdu[offset + j] = 0; payload[offset + j] = 0; // mac_pdu[offset + j] = 0;
} }
return (prach_resources); return;
} }
} else { // RACH is active } else { // RACH is active
...@@ -570,7 +568,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -570,7 +568,7 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
mac->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1); mac->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP << 1; // 2 dB increment prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP << 1; // 2 dB increment
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(mod_id, CC_id); prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id);
} }
// compute backoff parameters // compute backoff parameters
...@@ -591,13 +589,13 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -591,13 +589,13 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
mac->RA_tx_frame = frame; mac->RA_tx_frame = frame;
mac->RA_tx_subframe = nr_tti_tx; mac->RA_tx_subframe = nr_tti_tx;
// Fill in preamble and PRACH resources // Fill in preamble and PRACH resources
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, NULL); nr_get_prach_resources(prach_resources, mod_id, CC_id, gNB_id, nr_tti_tx, 0, NULL);
return (&mac->RA_prach_resources); return;
} }
} }
} else if (UE_mode == PUSCH) { } else if (UE_mode == PUSCH) {
LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id); LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id);
AssertFatal(1 == 0, ""); AssertFatal(1 == 0, "");
} }
return NULL; return prach_resources = NULL;
} }
\ No newline at end of file
...@@ -271,8 +271,9 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 ...@@ -271,8 +271,9 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4
@param frame @param frame
@param gNB_id gNB index @param gNB_id gNB index
@param nr_tti_tx slot for PRACH transmission @param nr_tti_tx slot for PRACH transmission
@returns A pointer to a PRACH_RESOURCES_t */ @returns void */
NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
module_id_t mod_id,
int CC_id, int CC_id,
UE_MODE_t UE_mode, UE_MODE_t UE_mode,
frame_t frame, frame_t frame,
...@@ -285,12 +286,13 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id, ...@@ -285,12 +286,13 @@ NR_PRACH_RESOURCES_t *nr_ue_get_rach(module_id_t mod_id,
@param gNB_index gNB index @param gNB_index gNB index
@param t_id @param t_id
@param rach_ConfigDedicated @param rach_ConfigDedicated
@returns A pointer to a PRACH_RESOURCES_t */ @returns void */
void nr_get_prach_resources(module_id_t mod_id, void nr_get_prach_resources(module_id_t mod_id,
int CC_id, int CC_id,
uint8_t gNB_id, uint8_t gNB_id,
uint8_t t_id, uint8_t t_id,
uint8_t first_Msg3, uint8_t first_Msg3,
NR_PRACH_RESOURCES_t *prach_resources,
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated); NR_RACH_ConfigDedicated_t * rach_ConfigDedicated);
void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id); void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id);
......
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