Commit 95971514 authored by francescomani's avatar francescomani

Random Access Resource selection for 4- and 2-step RA

parent 60920ed1
...@@ -333,6 +333,8 @@ typedef struct { ...@@ -333,6 +333,8 @@ typedef struct {
uint8_t ssb_nb_in_ro; uint8_t ssb_nb_in_ro;
int zeroCorrelationZoneConfig; int zeroCorrelationZoneConfig;
int restricted_set_config; int restricted_set_config;
// selected SSB for RACH
int ra_ssb;
/// Random-access window counter /// Random-access window counter
int16_t RA_window_cnt; int16_t RA_window_cnt;
/// Flag to monitor if matching RAPID was received in RAR /// Flag to monitor if matching RAPID was received in RAR
...@@ -341,25 +343,21 @@ typedef struct { ...@@ -341,25 +343,21 @@ typedef struct {
uint8_t RA_BI_found; uint8_t RA_BI_found;
/// Random-access backoff counter /// Random-access backoff counter
int16_t RA_backoff_indicator; int16_t RA_backoff_indicator;
/// Flag to indicate whether preambles Group A was used /// Flag to indicate whether preambles Group A is selected
uint8_t RA_usedGroupA; bool RA_GroupA;
/// RA backoff counter /// RA backoff counter
int16_t RA_backoff_cnt; int16_t RA_backoff_cnt;
/// RA max number of preamble transmissions /// RA max number of preamble transmissions
int preambleTransMax; int preambleTransMax;
/// Nb of preambles per SSB
long cb_preambles_per_ssb;
int starting_preamble_nb;
/// Received TPC command (in dB) from RAR /// Received TPC command (in dB) from RAR
int8_t Msg3_TPC; int8_t Msg3_TPC;
/// Flag to indicate whether it is the first Msg3 to be transmitted
bool first_Msg3;
/// RA Msg3 size in bytes /// RA Msg3 size in bytes
uint8_t Msg3_size; uint8_t Msg3_size;
/// Msg3 buffer /// Msg3 buffer
uint8_t *Msg3_buffer; uint8_t *Msg3_buffer;
// initial Random Access Preamble power
int preambleRxTargetPower;
int deltaPreamble;
bool msg3_C_RNTI; bool msg3_C_RNTI;
/// Random-access Contention Resolution Timer /// Random-access Contention Resolution Timer
......
...@@ -321,18 +321,6 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac); ...@@ -321,18 +321,6 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
@returns indication to generate PRACH to phy */ @returns indication to generate PRACH to phy */
void nr_ue_manage_ra_procedure(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB_id, int nr_slot_tx); void nr_ue_manage_ra_procedure(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB_id, int nr_slot_tx);
/* \brief Function implementing the routine for the selection of Random Access resources (5.1.2 TS 38.321).
@param mac pointer to MAC instance
@param CC_id Component Carrier Index
@param gNB_index gNB index
@param rach_ConfigDedicated
@returns void */
void nr_get_prach_resources(NR_UE_MAC_INST_t *mac,
int CC_id,
uint8_t gNB_id,
NR_PRACH_RESOURCES_t *prach_resources,
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated);
void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack); void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack);
void configure_initial_pucch(PUCCH_sched_t *pucch, int res_ind); void configure_initial_pucch(PUCCH_sched_t *pucch, int res_ind);
void release_PUCCH_SRS(NR_UE_MAC_INST_t *mac); void release_PUCCH_SRS(NR_UE_MAC_INST_t *mac);
......
...@@ -2706,7 +2706,6 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t ...@@ -2706,7 +2706,6 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t
} }
} // if format1 } // if format1
nr_get_prach_resources(mac, 0, 0, &ra->prach_resources, ra->rach_ConfigDedicated);
pdu->prach_config_pdu.ra_PreambleIndex = ra->ra_PreambleIndex; pdu->prach_config_pdu.ra_PreambleIndex = ra->ra_PreambleIndex;
pdu->prach_config_pdu.prach_tx_power = get_prach_tx_power(mac); pdu->prach_config_pdu.prach_tx_power = get_prach_tx_power(mac);
unsigned int slot_RA; unsigned int slot_RA;
......
...@@ -88,6 +88,7 @@ TEST(test_init_ra, four_step_cbra) ...@@ -88,6 +88,7 @@ TEST(test_init_ra, four_step_cbra)
NR_UE_DL_BWP_t dl_bwp; NR_UE_DL_BWP_t dl_bwp;
mac.current_UL_BWP = &current_bwp; mac.current_UL_BWP = &current_bwp;
mac.current_DL_BWP = &dl_bwp; mac.current_DL_BWP = &dl_bwp;
mac.mib_ssb = 0;
long scs = 1; long scs = 1;
current_bwp.scs = scs; current_bwp.scs = scs;
current_bwp.bwp_id = 0; current_bwp.bwp_id = 0;
...@@ -122,6 +123,7 @@ TEST(test_init_ra, four_step_cfra) ...@@ -122,6 +123,7 @@ TEST(test_init_ra, four_step_cfra)
NR_UE_DL_BWP_t dl_bwp; NR_UE_DL_BWP_t dl_bwp;
mac.current_UL_BWP = &current_bwp; mac.current_UL_BWP = &current_bwp;
mac.current_DL_BWP = &dl_bwp; mac.current_DL_BWP = &dl_bwp;
mac.mib_ssb = 0;
long scs = 1; long scs = 1;
current_bwp.scs = scs; current_bwp.scs = scs;
current_bwp.bwp_id = 0; current_bwp.bwp_id = 0;
...@@ -138,7 +140,7 @@ TEST(test_init_ra, four_step_cfra) ...@@ -138,7 +140,7 @@ TEST(test_init_ra, four_step_cfra)
int frame = 151; int frame = 151;
NR_RACH_ConfigDedicated_t rach_ConfigDedicated = {0}; NR_RACH_ConfigDedicated_t rach_ConfigDedicated = {0};
struct NR_CFRA cfra; NR_CFRA_t cfra;
rach_ConfigDedicated.cfra = &cfra; rach_ConfigDedicated.cfra = &cfra;
ra->rach_ConfigDedicated = &rach_ConfigDedicated; ra->rach_ConfigDedicated = &rach_ConfigDedicated;
......
...@@ -3819,11 +3819,7 @@ NR_ReconfigurationWithSync_t *get_reconfiguration_with_sync(rnti_t rnti, uid_t u ...@@ -3819,11 +3819,7 @@ NR_ReconfigurationWithSync_t *get_reconfiguration_with_sync(rnti_t rnti, uid_t u
uplink->ra_Prioritization = NULL; uplink->ra_Prioritization = NULL;
uplink->cfra = calloc(1, sizeof(struct NR_CFRA)); uplink->cfra = calloc(1, sizeof(struct NR_CFRA));
uplink->cfra->ext1 = NULL; uplink->cfra->ext1 = NULL;
uplink->cfra->occasions = calloc(1, sizeof(struct NR_CFRA__occasions)); uplink->cfra->occasions = NULL;
memcpy(&uplink->cfra->occasions->rach_ConfigGeneric,
&scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric,
sizeof(NR_RACH_ConfigGeneric_t));
asn1cCallocOne(uplink->cfra->occasions->ssb_perRACH_Occasion, NR_CFRA__occasions__ssb_perRACH_Occasion_one);
uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb;
uplink->cfra->resources.choice.ssb = calloc(1, sizeof(struct NR_CFRA__resources__ssb)); uplink->cfra->resources.choice.ssb = calloc(1, sizeof(struct NR_CFRA__resources__ssb));
uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
......
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