Commit eb7f3193 authored by cig's avatar cig

Enabled compute_nr_prach_seq to be used at both gNB and UE side:

- now the function gets more input arguments but can be used from both UE and gNB
- this change was needed because the prach fapi of UE differs from the gNB one
parent 4e38ea23
...@@ -418,6 +418,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, ...@@ -418,6 +418,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
void nr_phy_config_request(NR_PHY_Config_t *phy_config) { void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint8_t Mod_id = phy_config->Mod_id; uint8_t Mod_id = phy_config->Mod_id;
uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion;
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
...@@ -481,7 +482,13 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -481,7 +482,13 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
return; return;
} }
compute_nr_prach_seq(gNB_config,0,RC.gNB[Mod_id]->X_u); fd_occasion = 0;
nfapi_nr_prach_config_t *prach_config = &gNB_config->prach_config;
short_sequence = prach_config->prach_sequence_length.value;
num_sequences = prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value;
rootSequenceIndex = prach_config->num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index.value;
compute_nr_prach_seq(short_sequence, num_sequences, rootSequenceIndex, RC.gNB[Mod_id]->X_u);
RC.gNB[Mod_id]->configured = 1; RC.gNB[Mod_id]->configured = 1;
LOG_I(PHY,"gNB %d configured\n",Mod_id); LOG_I(PHY,"gNB %d configured\n",Mod_id);
......
...@@ -97,28 +97,21 @@ void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map) ...@@ -97,28 +97,21 @@ void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map)
} }
void compute_nr_prach_seq(uint8_t short_sequence,
uint8_t num_sequences,
uint8_t rootSequenceIndex,
uint32_t X_u[64][839]){
void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
uint8_t fd_occasion,
uint32_t X_u[64][839])
{
// Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
nfapi_nr_prach_config_t prach_config = config->prach_config;
unsigned int k,inv_u,i; unsigned int k,inv_u,i;
int N_ZC; int N_ZC;
uint16_t *prach_root_sequence_map; uint16_t *prach_root_sequence_map;
uint16_t u; uint16_t u;
uint8_t short_sequence = prach_config.prach_sequence_length.value;
uint8_t num_sequences = prach_config.num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value;
uint8_t rootSequenceIndex = prach_config.num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index.value;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN);
LOG_D(PHY,"compute_prach_seq: prach short sequence %x, num_sequences %d, rootSequenceIndex %d\n", short_sequence, num_sequences, rootSequenceIndex);
LOG_D(PHY,"compute_prach_seq: NCS_config %d, prach short sequence %x, num_Seqeuences %d, rootSequenceIndex %d\n",prach_config.num_prach_fd_occasions_list[fd_occasion].prach_zero_corr_conf.value, short_sequence, num_sequences, rootSequenceIndex);
N_ZC = (short_sequence) ? 139 : 839; N_ZC = (short_sequence) ? 139 : 839;
//init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time //init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time
...@@ -132,11 +125,8 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, ...@@ -132,11 +125,8 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
prach_root_sequence_map = prach_root_sequence_map_0_3; prach_root_sequence_map = prach_root_sequence_map_0_3;
} }
LOG_D( PHY, "compute_prach_seq: done init prach_tables\n" ); LOG_D( PHY, "compute_prach_seq: done init prach_tables\n" );
for (i=0; i<num_sequences; i++) { for (i=0; i<num_sequences; i++) {
int index = (rootSequenceIndex+i) % (N_ZC-1); int index = (rootSequenceIndex+i) % (N_ZC-1);
......
...@@ -1671,10 +1671,10 @@ void compute_prach_seq(uint16_t rootSequenceIndex, ...@@ -1671,10 +1671,10 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
lte_frame_type_t frame_type, lte_frame_type_t frame_type,
uint32_t X_u[64][839]); uint32_t X_u[64][839]);
void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, void compute_nr_prach_seq(uint8_t short_sequence,
uint8_t fd_occasion, uint8_t num_sequences,
uint32_t X_u[64][839]); uint8_t rootSequenceIndex,
uint32_t X_u[64][839]);
void init_prach_tables(int N_ZC); void init_prach_tables(int N_ZC);
void init_nr_prach_tables(int N_ZC); void init_nr_prach_tables(int N_ZC);
......
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