Commit 1447d0fa authored by Guy De Souza's avatar Guy De Souza

Synchronization signals scheduling update

parent b61e8007
...@@ -895,7 +895,7 @@ function main() { ...@@ -895,7 +895,7 @@ function main() {
# build RF device and transport protocol libraries # build RF device and transport protocol libraries
##################################### #####################################
if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" - o "$HWLAT" = "1" ] ; then if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
build_dir=$build_dir build_dir=$build_dir
......
...@@ -80,7 +80,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -80,7 +80,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
// shortcuts // shortcuts
NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms; NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms;
nfapi_config_request_t* cfg = &gNB->gNB_config; nfapi_config_request_t* cfg = gNB->gNB_config;
NR_gNB_COMMON* const common_vars = &gNB->common_vars; NR_gNB_COMMON* const common_vars = &gNB->common_vars;
LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = gNB->srs_vars; LTE_eNB_SRS* const srs_vars = gNB->srs_vars;
...@@ -469,7 +469,7 @@ void phy_config_request(PHY_Config_t *phy_config) { ...@@ -469,7 +469,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
void phy_free_nr_gNB(PHY_VARS_gNB *gNB) void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
{ {
// NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms; // NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms;
nfapi_config_request_t *cfg = &gNB->gNB_config; nfapi_config_request_t *cfg = gNB->gNB_config;
NR_gNB_COMMON* const common_vars = &gNB->common_vars; NR_gNB_COMMON* const common_vars = &gNB->common_vars;
LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = gNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = gNB->srs_vars; LTE_eNB_SRS* const srs_vars = gNB->srs_vars;
......
...@@ -28,9 +28,8 @@ ...@@ -28,9 +28,8 @@
int nr_generate_pss( int16_t *d_pss, int nr_generate_pss( int16_t *d_pss,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
int16_t ssb_start_subcarrier,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_config_request_t config, nfapi_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int i,m,k,l; int i,m,k,l;
...@@ -38,7 +37,7 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -38,7 +37,7 @@ int nr_generate_pss( int16_t *d_pss,
int16_t x[NR_PSS_LENGTH]; int16_t x[NR_PSS_LENGTH];
const int x_initial[7] = {0, 1, 1 , 0, 1, 1, 1}; const int x_initial[7] = {0, 1, 1 , 0, 1, 1, 1};
uint8_t Nid2 = config.sch_config.physical_cell_id.value % 3; uint8_t Nid2 = config->sch_config.physical_cell_id.value % 3;
/// Sequence generation /// Sequence generation
for (i=0; i < 7; i++) for (i=0; i < 7; i++)
...@@ -50,22 +49,21 @@ int nr_generate_pss( int16_t *d_pss, ...@@ -50,22 +49,21 @@ int nr_generate_pss( int16_t *d_pss,
for (i=0; i < NR_PSS_LENGTH; i++) { for (i=0; i < NR_PSS_LENGTH; i++) {
m = (i + 43*Nid2)%(NR_PSS_LENGTH); m = (i + 43*Nid2)%(NR_PSS_LENGTH);
d_pss[i] = (1 - 2*x[m]) * 32767; d_pss[i] = (1 - 2*x[m]) * 768;
} }
/// Resource mapping /// Resource mapping
a = (config.rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (aa = 0; aa < config.rf_config.tx_antenna_ports.value; aa++) for (aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{ {
// PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from // PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from
k = frame_parms->first_carrier_offset + ssb_start_subcarrier + 56; //and k = frame_parms->first_carrier_offset + config->sch_config.ssb_subcarrier_offset.value + 56; //and
l = ssb_start_symbol; l = ssb_start_symbol;
for (m = 0; m < NR_PSS_LENGTH; m++) { for (m = 0; m < NR_PSS_LENGTH; m++) {
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_pss[m]) >> 15; ((short*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_pss[m]) >> 15;
//((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * pss_mod[2*m + 1]) >> 15;
k+=1; k+=1;
if (k >= frame_parms->ofdm_symbol_size) { if (k >= frame_parms->ofdm_symbol_size) {
......
...@@ -28,9 +28,8 @@ extern short nr_mod_table[MOD_TABLE_SIZE_SHORT]; ...@@ -28,9 +28,8 @@ extern short nr_mod_table[MOD_TABLE_SIZE_SHORT];
int nr_generate_sss( int16_t *d_sss, int nr_generate_sss( int16_t *d_sss,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
int16_t ssb_start_subcarrier,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
nfapi_config_request_t config, nfapi_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int i,m,k,l; int i,m,k,l;
...@@ -42,7 +41,7 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -42,7 +41,7 @@ int nr_generate_sss( int16_t *d_sss,
const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 };
/// Sequence generation /// Sequence generation
Nid = config.sch_config.physical_cell_id.value; Nid = config->sch_config.physical_cell_id.value;
Nid2 = Nid % 3; Nid2 = Nid % 3;
Nid1 = (Nid - Nid2)/3; Nid1 = (Nid - Nid2)/3;
...@@ -60,22 +59,21 @@ int nr_generate_sss( int16_t *d_sss, ...@@ -60,22 +59,21 @@ int nr_generate_sss( int16_t *d_sss,
m1 = Nid1 % 112; m1 = Nid1 % 112;
for (i = 0; i < NR_SSS_LENGTH ; i++) { for (i = 0; i < NR_SSS_LENGTH ; i++) {
d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 32767; d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 768;
} }
/// Resource mapping /// Resource mapping
a = (config.rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; a = (config->rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15;
for (aa = 0; aa < config.rf_config.tx_antenna_ports.value; aa++) for (aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{ {
// SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from // SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from
k = frame_parms->first_carrier_offset + ssb_start_subcarrier + 56; //and k = frame_parms->first_carrier_offset + config->sch_config.ssb_subcarrier_offset.value + 56; //and
l = ssb_start_symbol + 2; l = ssb_start_symbol + 2;
for (m = 0; m < NR_SSS_LENGTH; m++) { for (m = 0; m < NR_SSS_LENGTH; m++) {
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_sss[2*m]) >> 15; ((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_sss[m]) >> 15;
//((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * sss_mod[2*m + 1]) >> 15;
k+=1; k+=1;
if (k >= frame_parms->ofdm_symbol_size) { if (k >= frame_parms->ofdm_symbol_size) {
......
...@@ -1972,6 +1972,10 @@ typedef struct PHY_VARS_gNB_s { ...@@ -1972,6 +1972,10 @@ typedef struct PHY_VARS_gNB_s {
uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
char gNB_generate_rar; char gNB_generate_rar;
/// NR synchronization sequences
int16_t d_pss[NR_PSS_LENGTH];
int16_t d_sss[NR_SSS_LENGTH];
/// Indicator set to 0 after first SR /// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_UE_MAX]; uint8_t first_sr[NUMBER_OF_UE_MAX];
......
...@@ -40,3 +40,42 @@ nr_subframe_t nr_subframe_select(nfapi_config_request_t *cfg,unsigned char subfr ...@@ -40,3 +40,42 @@ nr_subframe_t nr_subframe_select(nfapi_config_request_t *cfg,unsigned char subfr
if (cfg->subframe_config.duplex_mode.value == FDD) if (cfg->subframe_config.duplex_mode.value == FDD)
return(SF_DL); return(SF_DL);
} }
// First possible symbol is used with n=0
int nr_get_ssb_start_symbol(nfapi_config_request_t *cfg, NR_DL_FRAME_PARMS *fp)
{
int mu = cfg->subframe_config.numerology_index_mu.value;
int symbol = 0;
switch(mu) {
case NR_MU_0:
symbol = 2;
break;
case NR_MU_1: // case B
symbol = 4;
break;
case NR_MU_3:
symbol = 4;
break;
case NR_MU_4:
symbol = 8;
break;
default:
AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
}
if (cfg->sch_config.half_frame_index)
symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe);
return symbol;
}
void nr_set_ssb_first_subcarrier(nfapi_config_request_t *cfg)
{
cfg->sch_config.ssb_subcarrier_offset.value = 0;
}
...@@ -47,7 +47,16 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -47,7 +47,16 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
int **txdataF = gNB->common_vars.txdataF; int **txdataF = gNB->common_vars.txdataF;
uint8_t *pbch_pdu=&gNB->pbch_pdu[0]; uint8_t *pbch_pdu=&gNB->pbch_pdu[0];
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe); LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe);
int ssb_start_symbol = nr_get_ssb_start_symbol(cfg, fp);
nr_set_ssb_first_subcarrier(cfg);
if (subframe == (cfg->sch_config.half_frame_index)? 0:5)
{
nr_generate_pss(gNB->d_pss, txdataF, AMP, ssb_start_symbol, cfg, fp);
nr_generate_sss(gNB->d_sss, txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp);
}
} }
...@@ -66,8 +75,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -66,8 +75,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
if ((cfg->subframe_config.duplex_mode.value == TDD) && (nr_subframe_select(cfg,subframe)==SF_UL)) return; if ((cfg->subframe_config.duplex_mode.value == TDD) && (nr_subframe_select(cfg,subframe)==SF_UL)) return;
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,1);
//if (do_meas==1) start_meas(&gNB->phy_proc_tx); if (do_meas==1) start_meas(&gNB->phy_proc_tx);
// clear the transmit data array for the current subframe // clear the transmit data array for the current subframe
for (aa=0; aa<cfg->rf_config.tx_antenna_ports.value; aa++) { for (aa=0; aa<cfg->rf_config.tx_antenna_ports.value; aa++) {
......
...@@ -1373,11 +1373,12 @@ static void* ru_thread( void* param ) { ...@@ -1373,11 +1373,12 @@ static void* ru_thread( void* param ) {
AssertFatal(ret==0,"Cannot connect to radio\n"); AssertFatal(ret==0,"Cannot connect to radio\n");
} }
if (ru->if_south == LOCAL_RF) { // configure RF parameters only if (ru->if_south == LOCAL_RF) { // configure RF parameters only
fill_rf_config(ru,ru->rf_config_file); fill_rf_config(ru,ru->rf_config_file);
nr_init_frame_parms(ru->gNB_list[0]->gNB_config, fp); nr_init_frame_parms(ru->gNB_list[0]->gNB_config, fp);
phy_init_RU(ru); nr_dump_frame_parms(fp);
phy_init_RU(ru);
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
} }
if (setup_RU_buffers(ru)!=0) { if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n"); printf("Exiting, cannot initialize RU Buffers\n");
...@@ -1391,9 +1392,6 @@ static void* ru_thread( void* param ) { ...@@ -1391,9 +1392,6 @@ static void* ru_thread( void* param ) {
pthread_mutex_unlock(&RC.ru_mutex); pthread_mutex_unlock(&RC.ru_mutex);
wait_sync("ru_thread"); wait_sync("ru_thread");
// Start RF device if any // Start RF device if any
if (ru->start_rf) { if (ru->start_rf) {
......
...@@ -760,7 +760,7 @@ void wait_gNBs(void) { ...@@ -760,7 +760,7 @@ void wait_gNBs(void) {
for (j=0;j<RC.nb_L1_CC[i];j++) { for (j=0;j<RC.nb_L1_CC[i];j++) {
if (RC.gNB[i][j]->configured==0) { if (RC.gNB[i][j]->configured==0) {
waiting=1; waiting=0; //skip gNB configuration check
break; break;
} }
} }
...@@ -839,7 +839,7 @@ int restart_L1L2(module_id_t gnb_id) ...@@ -839,7 +839,7 @@ int restart_L1L2(module_id_t gnb_id)
int cc_id; int cc_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
LOG_W(ENB_APP, "restarting lte-softmodem\n"); LOG_W(ENB_APP, "restarting nr-softmodem\n");
/* block threads */ /* block threads */
sync_var = -1; sync_var = -1;
...@@ -859,7 +859,7 @@ int restart_L1L2(module_id_t gnb_id) ...@@ -859,7 +859,7 @@ int restart_L1L2(module_id_t gnb_id)
LOG_E(RRC, "Create task for RRC eNB failed\n"); LOG_E(RRC, "Create task for RRC eNB failed\n");
return -1; return -1;
} else { } else {
LOG_I(RRC, "Re-created task for RRC eNB successfully\n"); LOG_I(RRC, "Re-created task for RRC gNB successfully\n");
} }
if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
LOG_E(PDCP, "Create task for L2L1 failed\n"); LOG_E(PDCP, "Create task for L2L1 failed\n");
......
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