Commit 5f98c7c5 authored by Melissa Elkadi's avatar Melissa Elkadi

Fixing MR comments

parent 0a0b6533
...@@ -99,10 +99,10 @@ ...@@ -99,10 +99,10 @@
#define TX_JOB_ID 100 #define TX_JOB_ID 100
typedef enum { typedef enum {
pss = 0, PSS = 0,
pbch = 1, PBCH = 1,
si = 2, SI = 2,
psbch = 3, PSBCH = 3,
} sync_mode_t; } sync_mode_t;
static void *NRUE_phy_stub_standalone_pnf_task(void *arg); static void *NRUE_phy_stub_standalone_pnf_task(void *arg);
...@@ -376,14 +376,14 @@ static void UE_synch(void *arg) { ...@@ -376,14 +376,14 @@ static void UE_synch(void *arg) {
syncData_t *syncD=(syncData_t *) arg; syncData_t *syncD=(syncData_t *) arg;
int i, hw_slot_offset; int i, hw_slot_offset;
PHY_VARS_NR_UE *UE = syncD->UE; PHY_VARS_NR_UE *UE = syncD->UE;
sync_mode_t sync_mode = pbch; sync_mode_t sync_mode = PBCH;
//int CC_id = UE->CC_id; //int CC_id = UE->CC_id;
static int freq_offset=0; static int freq_offset=0;
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
UE->is_synchronized_sl = 0; UE->is_synchronized_sl = false;
sync_mode = psbch; sync_mode = PSBCH;
} else { } else {
UE->is_synchronized = 0; UE->is_synchronized = false;
} }
if (UE->UE_scan == 0) { if (UE->UE_scan == 0) {
...@@ -452,7 +452,7 @@ static void UE_synch(void *arg) { ...@@ -452,7 +452,7 @@ static void UE_synch(void *arg) {
break; break;
*/ */
case pbch: case PBCH:
LOG_I(PHY, "[UE thread Synch] Running Initial Synch \n"); LOG_I(PHY, "[UE thread Synch] Running Initial Synch \n");
uint64_t dl_carrier, ul_carrier; uint64_t dl_carrier, ul_carrier;
...@@ -498,10 +498,10 @@ static void UE_synch(void *arg) { ...@@ -498,10 +498,10 @@ static void UE_synch(void *arg) {
} }
break; break;
case si: case SI:
break; break;
case psbch: { case PSBCH: {
int initial_synch_sl = nr_sl_initial_sync(&syncD->proc, UE, 2); int initial_synch_sl = nr_sl_initial_sync(&syncD->proc, UE, 2);
if (initial_synch_sl >= 0) { // gNB will work as SyncRef UE in simulation. if (initial_synch_sl >= 0) { // gNB will work as SyncRef UE in simulation.
...@@ -523,7 +523,7 @@ static void UE_synch(void *arg) { ...@@ -523,7 +523,7 @@ static void UE_synch(void *arg) {
UE->UE_scan_carrier = 0; UE->UE_scan_carrier = 0;
} else { } else {
if (initial_synch_sl == 0) { if (initial_synch_sl == 0) {
UE->is_synchronized_sl = 1; UE->is_synchronized_sl = true;
LOG_I(NR_PHY, "SyncRef UE found with Nid1 %d and Nid2 %d SSS-RSRP %d dBm/RE\n", LOG_I(NR_PHY, "SyncRef UE found with Nid1 %d and Nid2 %d SSS-RSRP %d dBm/RE\n",
GET_NID1_SL(UE->frame_parms.Nid_SL), GET_NID2_SL(UE->frame_parms.Nid_SL), GET_NID1_SL(UE->frame_parms.Nid_SL), GET_NID2_SL(UE->frame_parms.Nid_SL),
UE->measurements.ssb_rsrp_dBm[0]); UE->measurements.ssb_rsrp_dBm[0]);
......
...@@ -331,7 +331,7 @@ void init_openair0(void) { ...@@ -331,7 +331,7 @@ void init_openair0(void) {
openair0_cfg[card].duplex_mode = duplex_mode_FDD; openair0_cfg[card].duplex_mode = duplex_mode_FDD;
openair0_cfg[card].Mod_id = 0; openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl = (get_softmodem_params()->sl_mode == 2) ? frame_parms->N_RB_SL : frame_parms->N_RB_DL; openair0_cfg[card].num_rb_dl = (get_softmodem_params()->sl_mode == MODE_2) ? frame_parms->N_RB_SL : frame_parms->N_RB_DL;
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source; openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
openair0_cfg[card].time_source = get_softmodem_params()->timing_source; openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
openair0_cfg[card].tune_offset = get_softmodem_params()->tune_offset; openair0_cfg[card].tune_offset = get_softmodem_params()->tune_offset;
...@@ -349,7 +349,7 @@ void init_openair0(void) { ...@@ -349,7 +349,7 @@ void init_openair0(void) {
nr_rf_card_config_freq(&openair0_cfg[card], ul_carrier, dl_carrier, freq_off); nr_rf_card_config_freq(&openair0_cfg[card], ul_carrier, dl_carrier, freq_off);
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
nr_get_carrier_frequencies_sl(PHY_vars_UE_g[0][0], &sl_carrier); nr_get_carrier_frequencies_sl(PHY_vars_UE_g[0][0], &sl_carrier);
nr_rf_card_config_freq(&openair0_cfg[card], sl_carrier, sl_carrier, freq_off); nr_rf_card_config_freq(&openair0_cfg[card], sl_carrier, sl_carrier, freq_off);
} }
......
...@@ -2,13 +2,7 @@ ...@@ -2,13 +2,7 @@
#include "SIMULATION/TOOLS/sim.h" #include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h" #include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
#include "coding_unitary_defs.h" #include "coding_unitary_defs.h"
#include "executables/softmodem-common.h"
uint64_t get_softmodem_optmask(void) {return 0;}
static softmodem_params_t softmodem_params;
softmodem_params_t *get_softmodem_params(void) {
return &softmodem_params;
}
//#define DEBUG_SMALLBLOCKTEST //#define DEBUG_SMALLBLOCKTEST
......
...@@ -56,6 +56,27 @@ ...@@ -56,6 +56,27 @@
#define NR_POLAR_PSBCH_E 1792 //uint16_t #define NR_POLAR_PSBCH_E 1792 //uint16_t
#define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32 #define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32
#define NR_POLAR_PSBCH_AGGREGATION_LEVEL 0 //uint8_t
#define NR_POLAR_PSBCH_MESSAGE_TYPE 3 //int8_t
#define NR_POLAR_PSBCH_PAYLOAD_BITS 32 //uint16_t
#define NR_POLAR_PSBCH_CRC_PARITY_BITS 24
#define NR_POLAR_PSBCH_CRC_ERROR_CORRECTION_BITS 3
//Assumed 3 by 3GPP when NR_POLAR_PSBCH_L>8 to meet false alarm rate requirements.
//Sec. 7.1.4: Channel Coding
#define NR_POLAR_PSBCH_N_MAX 9 //uint8_t
#define NR_POLAR_PSBCH_I_IL 1 //uint8_t
#define NR_POLAR_PSBCH_I_SEG 0 //uint8_t
#define NR_POLAR_PSBCH_N_PC 0 //uint8_t
#define NR_POLAR_PSBCH_N_PC_WM 0 //uint8_t
//#define NR_POLAR_PSBCH_N 512 //uint16_t
//Sec. 7.1.5: Rate Matching
#define NR_POLAR_PSBCH_I_BIL 0 //uint8_t
#define NR_POLAR_PSBCH_E 1792 //uint16_t
#define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32
/* /*
* TEST CODE * TEST CODE
*/ */
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!\file PHY/CODING/nrPolar_tools/nr_polar_psbch_defs.h
* \brief Defines the constant variables for polar coding of the PSBCH from 38-212, V15.1.1 2018-04.
* \author Turker Yilmaz
* \date 2018
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \note
* \warning
*/
#ifndef __NR_POLAR_PSBCH_DEFS__H__
#define __NR_POLAR_PSBCH_DEFS__H__
#define NR_POLAR_PSBCH_AGGREGATION_LEVEL 0 //uint8_t
#define NR_POLAR_PSBCH_MESSAGE_TYPE 3 //int8_t
#define NR_POLAR_PSBCH_PAYLOAD_BITS 32 //uint16_t
#define NR_POLAR_PSBCH_CRC_PARITY_BITS 24
#define NR_POLAR_PSBCH_CRC_ERROR_CORRECTION_BITS 3
//Assumed 3 by 3GPP when NR_POLAR_PSBCH_L>8 to meet false alarm rate requirements.
//Sec. 7.1.4: Channel Coding
#define NR_POLAR_PSBCH_N_MAX 9 //uint8_t
#define NR_POLAR_PSBCH_I_IL 1 //uint8_t
#define NR_POLAR_PSBCH_I_SEG 0 //uint8_t
#define NR_POLAR_PSBCH_N_PC 0 //uint8_t
#define NR_POLAR_PSBCH_N_PC_WM 0 //uint8_t
//#define NR_POLAR_PSBCH_N 512 //uint16_t
//Sec. 7.1.5: Rate Matching
#define NR_POLAR_PSBCH_I_BIL 0 //uint8_t
#define NR_POLAR_PSBCH_E 1792 //uint16_t
#define NR_POLAR_PSBCH_E_DWORD 56 // NR_POLAR_PSBCH_E/32
/*
* TEST CODE
*/
//#define DEBUG_POLAR
// Usage in code:
//#ifdef DEBUG_POLAR
//...
//#endif
//unsigned int testPayload0=0x00000000, testPayload1=0xffffffff; //payload1=~payload0;
//unsigned int testPayload2=0xa5a5a5a5; //testPayload3=0xb3f02c82;
//double testReceivedPayload3[NR_POLAR_PSBCH_E] = {-1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1};
#endif
...@@ -311,7 +311,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -311,7 +311,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
} }
int N_RB = (get_softmodem_params()->sl_mode == 2) ? fp->N_RB_SL : fp->N_RB_DL; int N_RB = (get_softmodem_params()->sl_mode == MODE_2) ? fp->N_RB_SL : fp->N_RB_DL;
// ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK)
int pdcch_dmrs_init_length = (((N_RB<<1)*3)>>5)+1; int pdcch_dmrs_init_length = (((N_RB<<1)*3)>>5)+1;
...@@ -358,7 +358,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -358,7 +358,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
csiim_vars[gNB_id] = (NR_UE_CSI_IM *)malloc16_clear(sizeof(NR_UE_CSI_IM)); csiim_vars[gNB_id] = (NR_UE_CSI_IM *)malloc16_clear(sizeof(NR_UE_CSI_IM));
csirs_vars[gNB_id] = (NR_UE_CSI_RS *)malloc16_clear(sizeof(NR_UE_CSI_RS)); csirs_vars[gNB_id] = (NR_UE_CSI_RS *)malloc16_clear(sizeof(NR_UE_CSI_RS));
srs_vars[gNB_id] = (NR_UE_SRS *)malloc16_clear(sizeof(NR_UE_SRS)); srs_vars[gNB_id] = (NR_UE_SRS *)malloc16_clear(sizeof(NR_UE_SRS));
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
psbch_vars[gNB_id] = (NR_UE_PSBCH *)malloc16_clear(sizeof(NR_UE_PSBCH)); psbch_vars[gNB_id] = (NR_UE_PSBCH *)malloc16_clear(sizeof(NR_UE_PSBCH));
} }
...@@ -476,7 +476,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -476,7 +476,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
free_and_zero(ue->csirs_vars[gNB_id]); free_and_zero(ue->csirs_vars[gNB_id]);
free_and_zero(ue->srs_vars[gNB_id]); free_and_zero(ue->srs_vars[gNB_id]);
if (get_softmodem_params()->sl_mode != 0) { if (get_softmodem_params()->sl_mode != NOT_SL_MODE) {
free_and_zero(ue->psbch_vars[gNB_id]); free_and_zero(ue->psbch_vars[gNB_id]);
} }
free_and_zero(ue->prach_vars[gNB_id]); free_and_zero(ue->prach_vars[gNB_id]);
......
...@@ -42,7 +42,7 @@ static const int nr_ssb_table[48][3] = { ...@@ -42,7 +42,7 @@ static const int nr_ssb_table[48][3] = {
{93, 15, nr_ssb_type_A}, {94, 15, nr_ssb_type_A}, {96, 30, nr_ssb_type_C}}; {93, 15, nr_ssb_type_A}, {94, 15, nr_ssb_type_A}, {96, 30, nr_ssb_type_C}};
void set_Lmax(NR_DL_FRAME_PARMS *fp) { void set_Lmax(NR_DL_FRAME_PARMS *fp) {
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
int sl_NumSSB_WithinPeriod = 1; //TODO: Needs to be updated from RRC parameters int sl_NumSSB_WithinPeriod = 1; //TODO: Needs to be updated from RRC parameters
int sl_TimeOffsetSSB = 1; //TODO: Needs to be updated from RRC parameters int sl_TimeOffsetSSB = 1; //TODO: Needs to be updated from RRC parameters
int sl_TimeInterval = 1; //TODO: Needs to be updated from RRC parameters int sl_TimeInterval = 1; //TODO: Needs to be updated from RRC parameters
...@@ -165,7 +165,7 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) ...@@ -165,7 +165,7 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL)
fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2); fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2);
// TODO: Temporarily setting fp->first_carrier_offset = 0 for SL until MAC is developed // TODO: Temporarily setting fp->first_carrier_offset = 0 for SL until MAC is developed
if (get_softmodem_params()->sl_mode == 2) if (get_softmodem_params()->sl_mode == MODE_2)
fp->first_carrier_offset = 0; fp->first_carrier_offset = 0;
fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9; fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9;
fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu)); fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu));
...@@ -236,7 +236,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, ...@@ -236,7 +236,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->numerology_index = mu; fp->numerology_index = mu;
set_scs_parameters(fp, mu, fp->N_RB_DL); set_scs_parameters(fp, mu, fp->N_RB_DL);
if (get_softmodem_params()->sl_mode != 0) { if (get_softmodem_params()->sl_mode != NOT_SL_MODE) {
set_scs_parameters(fp, mu, fp->N_RB_SL); set_scs_parameters(fp, mu, fp->N_RB_SL);
} }
...@@ -302,7 +302,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -302,7 +302,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
LOG_D(PHY,"dl_bw_kHz %lu\n",dl_bw_khz); LOG_D(PHY,"dl_bw_kHz %lu\n",dl_bw_khz);
LOG_D(PHY,"dl_CarrierFreq %lu\n",fp->dl_CarrierFreq); LOG_D(PHY,"dl_CarrierFreq %lu\n",fp->dl_CarrierFreq);
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
uint64_t sl_bw_khz = (12 * config->carrier_config.sl_grid_size[config->ssb_config.scs_common]) * (15 << config->ssb_config.scs_common); uint64_t sl_bw_khz = (12 * config->carrier_config.sl_grid_size[config->ssb_config.scs_common]) * (15 << config->ssb_config.scs_common);
fp->sl_CarrierFreq = ((sl_bw_khz >> 1) + config->carrier_config.sl_frequency) * 1000; fp->sl_CarrierFreq = ((sl_bw_khz >> 1) + config->carrier_config.sl_frequency) * 1000;
} }
...@@ -332,7 +332,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -332,7 +332,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index); AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index);
fp->Ncp = Ncp; fp->Ncp = Ncp;
int N_RB = (get_softmodem_params()->sl_mode == 2) ? fp->N_RB_SL : fp->N_RB_DL; int N_RB = (get_softmodem_params()->sl_mode == MODE_2) ? fp->N_RB_SL : fp->N_RB_DL;
set_scs_parameters(fp, fp->numerology_index, N_RB); set_scs_parameters(fp, fp->numerology_index, N_RB);
fp->slots_per_frame = 10* fp->slots_per_subframe; fp->slots_per_frame = 10* fp->slots_per_subframe;
...@@ -358,7 +358,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -358,7 +358,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco); fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco);
// TODO: Temporarily setting fp->ssb_start_subcarrier = 0 for SL until MAC is developed // TODO: Temporarily setting fp->ssb_start_subcarrier = 0 for SL until MAC is developed
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
fp->ssb_start_subcarrier = 0; fp->ssb_start_subcarrier = 0;
} }
set_Lmax(fp); set_Lmax(fp);
......
...@@ -614,7 +614,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { ...@@ -614,7 +614,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
double f0 = f[ll]; double f0 = f[ll];
LOG_D(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); LOG_D(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
c16_t *symbol_rotation = fp->symbol_rotation[ll]; c16_t *symbol_rotation = fp->symbol_rotation[ll];
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
f0 = (double)sl_CarrierFreq; f0 = (double)sl_CarrierFreq;
symbol_rotation = fp->symbol_rotation[link_type_sl]; symbol_rotation = fp->symbol_rotation[link_type_sl];
} }
......
...@@ -51,7 +51,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -51,7 +51,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned int nb_prefix_samples; unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0; unsigned int nb_prefix_samples0;
if ((get_softmodem_params()->sl_mode == 2 && ue->is_synchronized_sl) || if ((get_softmodem_params()->sl_mode == MODE_2 && ue->is_synchronized_sl) ||
(get_softmodem_params()->sl_mode != 2 && ue->is_synchronized)) { (get_softmodem_params()->sl_mode != 2 && ue->is_synchronized)) {
nb_prefix_samples = frame_parms->nb_prefix_samples; nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples0; nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
...@@ -135,7 +135,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, ...@@ -135,7 +135,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
unsigned int nb_prefix_samples; unsigned int nb_prefix_samples;
unsigned int nb_prefix_samples0; unsigned int nb_prefix_samples0;
if (pbch_decoded || (get_softmodem_params()->sl_mode == 2 && ue->is_synchronized_sl)) { if (pbch_decoded || (get_softmodem_params()->sl_mode == MODE_2 && ue->is_synchronized_sl)) {
nb_prefix_samples = frame_parms->nb_prefix_samples; nb_prefix_samples = frame_parms->nb_prefix_samples;
nb_prefix_samples0 = frame_parms->nb_prefix_samples0; nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
} }
......
...@@ -91,12 +91,12 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, ...@@ -91,12 +91,12 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
sync_offset = 0; sync_offset = 0;
if ( abs(diff) < (SYNCH_HYST+sync_offset) ) { if ( abs(diff) < (SYNCH_HYST+sync_offset) ) {
if (get_softmodem_params()->sl_mode == 0) if (get_softmodem_params()->sl_mode == NOT_SL_MODE)
ue->rx_offset = 0; ue->rx_offset = 0;
else else
ue->rx_offset_sl = 0; ue->rx_offset_sl = 0;
} else { } else {
if (get_softmodem_params()->sl_mode == 0) if (get_softmodem_params()->sl_mode == NOT_SL_MODE)
ue->rx_offset = diff; ue->rx_offset = diff;
else else
ue->rx_offset_sl = diff; ue->rx_offset_sl = diff;
......
...@@ -135,7 +135,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp, int N_ID_2) ...@@ -135,7 +135,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp, int N_ID_2)
* sample 0 is for continuous frequency which is used here * sample 0 is for continuous frequency which is used here
*/ */
unsigned int subcarrier_start = get_softmodem_params()->sl_mode == 0 ? PSS_SSS_SUB_CARRIER_START : PSS_SSS_SUB_CARRIER_START_SL; unsigned int subcarrier_start = get_softmodem_params()->sl_mode == NOT_SL_MODE ? PSS_SSS_SUB_CARRIER_START : PSS_SSS_SUB_CARRIER_START_SL;
unsigned int k = fp->first_carrier_offset + fp->ssb_start_subcarrier + subcarrier_start; unsigned int k = fp->first_carrier_offset + fp->ssb_start_subcarrier + subcarrier_start;
if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size; if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size;
...@@ -172,7 +172,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp, int N_ID_2) ...@@ -172,7 +172,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp, int N_ID_2)
static void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) static void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
{ {
AssertFatal(frame_parms_ue->ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n", frame_parms_ue->ofdm_symbol_size); AssertFatal(frame_parms_ue->ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n", frame_parms_ue->ofdm_symbol_size);
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
for (int i = 0; i < pss_sequence; i++) { for (int i = 0; i < pss_sequence; i++) {
primary_synchro_nr2[i] = malloc16_clear(LENGTH_PSS_NR * sizeof(int16_t)); primary_synchro_nr2[i] = malloc16_clear(LENGTH_PSS_NR * sizeof(int16_t));
AssertFatal(primary_synchro_nr2[i], "Fatal memory allocation problem \n"); AssertFatal(primary_synchro_nr2[i], "Fatal memory allocation problem \n");
...@@ -498,7 +498,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i ...@@ -498,7 +498,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i
{ {
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int *nid2 = (int *)&ue->common_vars.nid2; int *nid2 = (int *)&ue->common_vars.nid2;
if (get_softmodem_params()->sl_mode == 2) { if (get_softmodem_params()->sl_mode == MODE_2) {
nid2 = (int *)&ue->common_vars.N2_id; nid2 = (int *)&ue->common_vars.N2_id;
} }
int *f_off = (int *)&ue->common_vars.freq_offset; int *f_off = (int *)&ue->common_vars.freq_offset;
...@@ -522,7 +522,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i ...@@ -522,7 +522,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i
pss_source = 0; pss_source = 0;
int maxval=0; int maxval=0;
int max_size = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int max_size = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
for (int j = 0; j < max_size; j++) for (int j = 0; j < max_size; j++)
for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) { for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
maxval = max(maxval, abs(primary_synchro_time_nr[j][i].r)); maxval = max(maxval, abs(primary_synchro_time_nr[j][i].r));
...@@ -535,7 +535,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i ...@@ -535,7 +535,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i
/* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */ /* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */
uint16_t pss_index_start = 0; uint16_t pss_index_start = 0;
uint16_t pss_index_end = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; uint16_t pss_index_end = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
if (ue->target_Nid_cell != -1) { if (ue->target_Nid_cell != -1) {
pss_index_start = GET_NID2(ue->target_Nid_cell); pss_index_start = GET_NID2(ue->target_Nid_cell);
pss_index_end = pss_index_start + 1; pss_index_end = pss_index_start + 1;
...@@ -555,7 +555,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i ...@@ -555,7 +555,7 @@ static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, i
shift); shift);
const c64_t r64 = {.r = result.r, .i = result.i}; const c64_t r64 = {.r = result.r, .i = result.i};
pss_corr_ue += squaredMod(r64); pss_corr_ue += squaredMod(r64);
if (get_softmodem_params()->sl_mode > 0) { if (get_softmodem_params()->sl_mode > NOT_SL_MODE) {
//non-coherentely combine repeition of PSS //non-coherentely combine repeition of PSS
const c32_t result = dot_product(primary_synchro_time_nr[pss_index], const c32_t result = dot_product(primary_synchro_time_nr[pss_index],
&(rxdata[ar][n + is * frame_parms->samples_per_frame + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples]), &(rxdata[ar][n + is * frame_parms->samples_per_frame + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples]),
......
...@@ -67,7 +67,7 @@ void init_context_sss_nr(int amp) ...@@ -67,7 +67,7 @@ void init_context_sss_nr(int amp)
int16_t x1[LENGTH_SSS_NR]; int16_t x1[LENGTH_SSS_NR];
int16_t dss_current; int16_t dss_current;
int m0, m1; int m0, m1;
int nid_2_num = get_softmodem_params()->sl_mode == 0 ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL; int nid_2_num = get_softmodem_params()->sl_mode == NOT_SL_MODE ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL;
const int x0_initial[INITIAL_SSS_NR] = { 1, 0, 0, 0, 0, 0, 0 }; const int x0_initial[INITIAL_SSS_NR] = { 1, 0, 0, 0, 0, 0, 0 };
const int x1_initial[INITIAL_SSS_NR] = { 1, 0, 0, 0, 0, 0, 0 }; const int x1_initial[INITIAL_SSS_NR] = { 1, 0, 0, 0, 0, 0, 0 };
...@@ -260,7 +260,7 @@ static int do_pss_sss_extract_nr( ...@@ -260,7 +260,7 @@ static int do_pss_sss_extract_nr(
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
int pss_symbol = 0; int pss_symbol = 0;
int sss_symbol = get_softmodem_params()->sl_mode == 0 ? int sss_symbol = get_softmodem_params()->sl_mode == NOT_SL_MODE ?
(SSS_SYMBOL_NB - PSS_SYMBOL_NB) : (SSS_SYMBOL_NB - PSS_SYMBOL_NB) :
(SSS0_SL_SYMBOL_NB - PSS0_SL_SYMBOL_NB) ; (SSS0_SL_SYMBOL_NB - PSS0_SL_SYMBOL_NB) ;
unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size; unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
...@@ -273,7 +273,7 @@ static int do_pss_sss_extract_nr( ...@@ -273,7 +273,7 @@ static int do_pss_sss_extract_nr(
unsigned int k = frame_parms->first_carrier_offset + unsigned int k = frame_parms->first_carrier_offset +
frame_parms->ssb_start_subcarrier + frame_parms->ssb_start_subcarrier +
((get_softmodem_params()->sl_mode == 0) ? ((get_softmodem_params()->sl_mode == NOT_SL_MODE) ?
PSS_SSS_SUB_CARRIER_START : PSS_SSS_SUB_CARRIER_START :
PSS_SSS_SUB_CARRIER_START_SL); PSS_SSS_SUB_CARRIER_START_SL);
...@@ -364,7 +364,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, ...@@ -364,7 +364,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue,
uint8_t i; uint8_t i;
c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR]; c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]; c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR];
uint8_t Nid2 = get_softmodem_params()->sl_mode == 0 ? GET_NID2(ue->common_vars.nid2) : ue->common_vars.N2_id; uint8_t Nid2 = get_softmodem_params()->sl_mode == NOT_SL_MODE ? GET_NID2(ue->common_vars.nid2) : ue->common_vars.N2_id;
uint16_t Nid1; uint16_t Nid1;
uint8_t phase; uint8_t phase;
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
......
...@@ -190,7 +190,7 @@ int pss_sl_ch_est_nr(PHY_VARS_NR_UE *ue, ...@@ -190,7 +190,7 @@ int pss_sl_ch_est_nr(PHY_VARS_NR_UE *ue,
c16_t pss1_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR], c16_t pss1_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
c16_t sss1_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]) c16_t sss1_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR])
{ {
int id = get_softmodem_params()->sl_mode == 0 ? ue->common_vars.eNb_id : ue->common_vars.N2_id; int id = get_softmodem_params()->sl_mode == NOT_SL_MODE ? ue->common_vars.eNb_id : ue->common_vars.N2_id;
int16_t *pss = primary_synchro_nr2[id]; int16_t *pss = primary_synchro_nr2[id];
c16_t tmp, tmp2; c16_t tmp, tmp2;
c16_t *sss0_ext3 = &sss0_ext[0][0]; c16_t *sss0_ext3 = &sss0_ext[0][0];
......
...@@ -124,6 +124,12 @@ typedef enum { ...@@ -124,6 +124,12 @@ typedef enum {
NR_SSS_EST, NR_SSS_EST,
} NR_CHANNEL_EST_t; } NR_CHANNEL_EST_t;
typedef enum {
NOT_SL_MODE=0,
MODE_1,
MODE_2
} NR_SL_MODE_t;
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg #define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
typedef struct { typedef struct {
...@@ -441,7 +447,7 @@ typedef struct { ...@@ -441,7 +447,7 @@ typedef struct {
/// \brief Indicator that UE is synchronized to a gNB /// \brief Indicator that UE is synchronized to a gNB
int is_synchronized; int is_synchronized;
/// \brief Indicator that UE is synchronized to a SyncRef UE on Sidelink /// \brief Indicator that UE is synchronized to a SyncRef UE on Sidelink
int is_synchronized_sl; bool is_synchronized_sl;
/// \brief Target gNB Nid_cell when UE is resynchronizing /// \brief Target gNB Nid_cell when UE is resynchronizing
int target_Nid_cell; int target_Nid_cell;
/// \brief Indicator that UE is an SynchRef UE /// \brief Indicator that UE is an SynchRef UE
......
...@@ -141,7 +141,7 @@ int NB_UE_INST = 1; ...@@ -141,7 +141,7 @@ int NB_UE_INST = 1;
int main(int argc, char **argv){ int main(int argc, char **argv){
char c; char c;
get_softmodem_params()->sl_mode = 0; get_softmodem_params()->sl_mode = NOT_SL_MODE;
double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0;
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs=-1, bw; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs=-1, bw;
int i, l, aa, aarx, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; int i, l, aa, aarx, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
......
...@@ -361,7 +361,7 @@ static void get_sim_cl_opts(int argc, char **argv) ...@@ -361,7 +361,7 @@ static void get_sim_cl_opts(int argc, char **argv)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
get_softmodem_params()->sa = 1; get_softmodem_params()->sa = 1;
get_softmodem_params()->sl_mode = 2; get_softmodem_params()->sl_mode = MODE_2;
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) { if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) {
exit_fun("[NR_PSBCHSIM] Error, configuration module init failed\n"); exit_fun("[NR_PSBCHSIM] Error, configuration module init failed\n");
} }
...@@ -440,7 +440,7 @@ int main(int argc, char **argv) ...@@ -440,7 +440,7 @@ int main(int argc, char **argv)
UE->slss->sl_timeoffsetssb_r16 = 0; UE->slss->sl_timeoffsetssb_r16 = 0;
UE->slss->slss_id = Nid_SL; UE->slss->slss_id = Nid_SL;
UE->is_synchronized_sl = run_initial_sync ? 0 : 1; UE->is_synchronized_sl = run_initial_sync ? false : true;
UE->UE_fo_compensation = (cfo / scs) != 0.0 ? 1 : 0; // if a frequency offset is set then perform fo estimation and compensation UE->UE_fo_compensation = (cfo / scs) != 0.0 ? 1 : 0; // if a frequency offset is set then perform fo estimation and compensation
if (init_nr_ue_signal(UE, 1) != 0) { if (init_nr_ue_signal(UE, 1) != 0) {
......
...@@ -119,7 +119,7 @@ void test_synchro_pss_nr(PHY_VARS_NR_UE *PHY_VARS_NR_UE, int position_symbol, in ...@@ -119,7 +119,7 @@ void test_synchro_pss_nr(PHY_VARS_NR_UE *PHY_VARS_NR_UE, int position_symbol, in
/* search pss */ /* search pss */
synchro_position = pss_synchro_nr(PHY_VARS_NR_UE, rate_change); synchro_position = pss_synchro_nr(PHY_VARS_NR_UE, rate_change);
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
if (pss_sequence_number < pss_sequence) { if (pss_sequence_number < pss_sequence) {
NID2_value = pss_sequence_number; NID2_value = pss_sequence_number;
...@@ -214,7 +214,7 @@ int main(int argc, char *argv[]) ...@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
test_synchro_pss_nr(PHY_vars_UE, 0, INVALID_PSS_SEQUENCE, &test); test_synchro_pss_nr(PHY_vars_UE, 0, INVALID_PSS_SEQUENCE, &test);
#endif #endif
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
for (int index_position = 0; index_position < size_test_position; index_position++) { for (int index_position = 0; index_position < size_test_position; index_position++) {
for (int number_pss_sequence = 0; number_pss_sequence < pss_sequence; number_pss_sequence++) { for (int number_pss_sequence = 0; number_pss_sequence < pss_sequence; number_pss_sequence++) {
......
...@@ -111,11 +111,11 @@ void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, i ...@@ -111,11 +111,11 @@ void phase_shift_samples(int16_t *samples, int length, int16_t phase_shift_re, i
void display_data(int pss_sequence_number, int16_t *rxdata, int position) { void display_data(int pss_sequence_number, int16_t *rxdata, int position) {
#ifdef DEBUG_TEST_PSS #ifdef DEBUG_TEST_PSS
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
int16_t *pss_sequence[pss_sequence] = {primary_synch0_time, primary_synch1_time, primary_synch2_time}; int16_t *pss_sequence[pss_sequence] = {primary_synch0_time, primary_synch1_time, primary_synch2_time};
int16_t *pss_sequence_sl[pss_sequence] = {primary_synch0_time, primary_synch1_time}; int16_t *pss_sequence_sl[pss_sequence] = {primary_synch0_time, primary_synch1_time};
int16_t *pss_sequence_time = pss_sequence[pss_sequence_number];; int16_t *pss_sequence_time = pss_sequence[pss_sequence_number];;
if (get_softmodem_params()->sl_mode != 0) { if (get_softmodem_params()->sl_mode != NOT_SL_MODE) {
pss_sequence_time = pss_sequence_sl[pss_sequence_number]; pss_sequence_time = pss_sequence_sl[pss_sequence_number];
printf(" pss %6d data \n", pss_sequence_number); printf(" pss %6d data \n", pss_sequence_number);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
...@@ -245,7 +245,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission ...@@ -245,7 +245,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
int n_ssb_crb = 0; int n_ssb_crb = 0;
int ssb_subcarrier_offset = 0; int ssb_subcarrier_offset = 0;
nr_init_frame_parms_ue(frame_parms, mu, extended_prefix_flag, N_RB_DL, n_ssb_crb, ssb_subcarrier_offset); nr_init_frame_parms_ue(frame_parms, mu, extended_prefix_flag, N_RB_DL, n_ssb_crb, ssb_subcarrier_offset);
int nid_2_num = get_softmodem_params()->sl_mode == 0 ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL; int nid_2_num = get_softmodem_params()->sl_mode == NOT_SL_MODE ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL;
PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + nid_2_num; /* set to unvalid value */ PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + nid_2_num; /* set to unvalid value */
//phy_init_nr_top(frame_parms); //phy_init_nr_top(frame_parms);
...@@ -451,7 +451,7 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p ...@@ -451,7 +451,7 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p
printf("This pss sequence can not be fully written in the received window \n"); printf("This pss sequence can not be fully written in the received window \n");
return (-1); return (-1);
} }
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
if ((pss_sequence_number >= pss_sequence) && (pss_sequence_number < 0)) { if ((pss_sequence_number >= pss_sequence) && (pss_sequence_number < 0)) {
printf("Unknow pss sequence %d \n", pss_sequence_number); printf("Unknow pss sequence %d \n", pss_sequence_number);
return (-1); return (-1);
...@@ -508,7 +508,7 @@ void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_ ...@@ -508,7 +508,7 @@ void set_sequence_pss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int pss_
if (position_symbol < 0) { if (position_symbol < 0) {
set_pss_in_rx_buffer_from_external_buffer(PHY_vars_UE, input_buffer); set_pss_in_rx_buffer_from_external_buffer(PHY_vars_UE, input_buffer);
} }
int pss_sequence = get_softmodem_params()->sl_mode == 0 ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL; int pss_sequence = get_softmodem_params()->sl_mode == NOT_SL_MODE ? NUMBER_PSS_SEQUENCE : NUMBER_PSS_SEQUENCE_SL;
/* write pss sequence in received ue buffer */ /* write pss sequence in received ue buffer */
else if (pss_sequence_number < pss_sequence) { else if (pss_sequence_number < pss_sequence) {
if (position_symbol > (samples_for_frame - frame_parms->ofdm_symbol_size)) { if (position_symbol > (samples_for_frame - frame_parms->ofdm_symbol_size)) {
......
...@@ -227,7 +227,7 @@ int main(int argc, char *argv[]) ...@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
Nid2 = GET_NID2(Nid_cell[index]); Nid2 = GET_NID2(Nid_cell[index]);
Nid1 = GET_NID1(Nid_cell[index]); Nid1 = GET_NID1(Nid_cell[index]);
int nid_2_num = get_softmodem_params()->sl_mode == 0 ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL; int nid_2_num = get_softmodem_params()->sl_mode == NOT_SL_MODE ? N_ID_2_NUMBER : N_ID_2_NUMBER_SL;
for (int position = 0; position < size_test_position; position++) { for (int position = 0; position < size_test_position; position++) {
PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + nid_2_num; /* set to invalid value */ PHY_vars_UE->frame_parms.Nid_cell = (3 * N_ID_1_NUMBER) + nid_2_num; /* set to invalid value */
......
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