diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5182f597e341a12415ff840b37c0f10435123acc..e18bbad1df9c9b6b283bca02ff5c1cef06f0910f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1238,6 +1238,8 @@ set(PHY_SRC_UE # actual source ${OPENAIR1_DIR}/PHY/INIT/nr_init.c ${OPENAIR1_DIR}/PHY/INIT/nr_parms.c + ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pss.c + ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sss.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 7d85f426df66567bb351be49f83f44ddf8c0eb82..fe853869a63c104ab201b19bb59306b04e46a59b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -30,6 +30,9 @@ int phy_init_nr_gNB(nfapi_param_t* nfapi_params) nfapi_params->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL nfapi_params->rf_config.dl_channel_bandwidth.value = 106; nfapi_params->rf_config.ul_channel_bandwidth.value = 106; + nfapi_params->rf_config.tx_antenna_ports.value = 1; + + nfapi_params->sch_config.physical_cell_id.value = 0; return 0; } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 3a452e47f9b8b578edb49964580617048e0b53f6..9bb27e10a659dad7d7e455ddbaeb783ddf65c3ea 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -36,7 +36,8 @@ int nr_init_frame_parms(nfapi_param_t nfapi_params, #if DISABLE_LOG_X printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp); #else - LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp); + //LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp); + printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp); #endif if (Ncp == 1) //EXTENDED, to be modified after lte defs are properly linked @@ -133,9 +134,14 @@ int nr_init_frame_parms(nfapi_param_t nfapi_params, void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms) { - LOG_I(PHY,"frame_parms->scs=%d\n",frame_parms->subcarrier_spacing); + /*LOG_I(PHY,"frame_parms->scs=%d\n",frame_parms->subcarrier_spacing); LOG_I(PHY,"frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size); LOG_I(PHY,"frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti); LOG_I(PHY,"frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0); - LOG_I(PHY,"frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples); + LOG_I(PHY,"frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);*/ + printf("frame_parms->scs=%d\n",frame_parms->subcarrier_spacing); + printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size); + printf("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti); + printf("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0); + printf("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples); } diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m new file mode 100644 index 0000000000000000000000000000000000000000..9ff21defc2dfb80ed7785abe0b8ab0142f2809e7 --- /dev/null +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m @@ -0,0 +1,32 @@ +% octave script for generating NR specific modulated symbols +% +% 0 .. "0" +% 1,2 .. BPSK(0),BPSK(1) + +% 2^15 /sqrt(2) K = 768; +K = 768*sqrt(2)/2^15; + +% Amplitude for BPSK (\f$ 2^15 \times 1/\sqrt{2}\f$) +BPSK = 23170; + +% BPSK +for b = 0:1 +bpsk_table(b+1) = (1 - 2*b)*BPSK + 1j*(1-2*b)*BPSK; +end + +table = round(K * [ 0; bpsk_table(:) ]); + +save mod_table.mat table + +table2 = zeros(1,length(table)*2); +table2(1:2:end) = real(table); +table2(2:2:end) = imag(table); + +fd = fopen("nr_mod_table.h","w"); +fprintf(fd,"#define MOD_TABLE_SIZE_SHORT %d\n", length(table)*2); +fprintf(fd,"#define MOD_TABLE_BPSK_OFFSET %d\n", 1); +fprintf(fd,"short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {"); +fprintf(fd,"%d,",table2(1:end-1)); +fprintf(fd,"%d};\n",table2(end)); +fclose(fd); + diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h new file mode 100644 index 0000000000000000000000000000000000000000..8bc11c429882fa879193b38551eae2b546b796a3 --- /dev/null +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -0,0 +1,24 @@ +/* + * 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 + */ + +#define MOD_TABLE_SIZE_SHORT 6 +#define MOD_TABLE_BPSK_OFFSET 1 +short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,768,768,-768,-768}; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pss.c b/openair1/PHY/NR_TRANSPORT/nr_pss.c new file mode 100644 index 0000000000000000000000000000000000000000..682b26e2e7c94e9a89120d02890e0871f3ba93e6 --- /dev/null +++ b/openair1/PHY/NR_TRANSPORT/nr_pss.c @@ -0,0 +1,85 @@ +/* + * 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 + */ + +#include "../defs_NR.h" + +#define NR_PSS_DEBUG + +short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,768,768,-768,-768}; + +int nr_generate_pss( int16_t *d_pss, + int32_t **txdataF, + int16_t amp, + int16_t ssb_first_subcarrier, + uint8_t slot_offset, + nfapi_param_t nfapi_params, + NR_DL_FRAME_PARMS *frame_parms) +{ + int i,n,m,k; + int16_t a, aa; + int16_t x[NR_PSS_LENGTH]; + int16_t pss_mod[2* NR_PSS_LENGTH]; + const int x_initial[7] = {0, 1, 1 , 0, 1, 1, 1}; + + uint8_t Nid2 = nfapi_params.sch_config.physical_cell_id.value % 3; + uint8_t Nsymb = (nfapi_params.subframe_config.dl_cyclic_prefix_type.value == 0)? 14 : 12; + + // Binary sequence generation + for (i=0; i < 7; i++) + x[i] = x_initial[i]; + + for (i=0; i < (NR_PSS_LENGTH - 7); i++) { + x[i+7] = (x[i + 4] + x[i]) %2; + } + + for (n=0; n < NR_PSS_LENGTH; n++) { + m = (n + 43*Nid2)%(NR_PSS_LENGTH); + d_pss[n] = x[m]; // 1 - 2*x[m] is taken into account in the mod_table (binary input) + } + + // BPSK modulation and resource mapping + a = (nfapi_params.rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; + for (i = 0; i < NR_PSS_LENGTH; i++) + { + pss_mod[2*i] = nr_mod_table[ 2 * (MOD_TABLE_BPSK_OFFSET + d_pss[i]) ]; + pss_mod[2*i + 1] = nr_mod_table[ 2 * (MOD_TABLE_BPSK_OFFSET + d_pss[i]) + 1]; + } + + for (aa = 0; aa < nfapi_params.rf_config.tx_antenna_ports.value; aa++) + { + + // PSS occupies a predefined position (symbol 0, subcarriers 56-182) within the SSB block starting from + k = frame_parms->first_carrier_offset + ssb_first_subcarrier + 56; // to be retrieved from ssb scheduling function + + for (m = 0; m < NR_PSS_LENGTH; m++) { + ((int16_t*)txdataF[aa])[2*(slot_offset*Nsymb*frame_parms->ofdm_symbol_size + k)] = (a * pss_mod[2*m]) >> 15; + ((int16_t*)txdataF[aa])[2*(slot_offset*Nsymb*frame_parms->ofdm_symbol_size + k) + 1] = (a * pss_mod[2*m + 1]) >> 15; + k+=1; + + if (k >= frame_parms->ofdm_symbol_size) { + k++; //skip DC + k-=frame_parms->ofdm_symbol_size; + } + } + } + + return (0); +} diff --git a/openair1/PHY/NR_TRANSPORT/nr_sss.c b/openair1/PHY/NR_TRANSPORT/nr_sss.c new file mode 100644 index 0000000000000000000000000000000000000000..669dffc5273bbf59f6c1d65868db9b0a0084955f --- /dev/null +++ b/openair1/PHY/NR_TRANSPORT/nr_sss.c @@ -0,0 +1,98 @@ +/* + * 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 + */ + +#include "../defs_NR.h" + +extern short nr_mod_table[MOD_TABLE_SIZE_SHORT]; + +#define NR_SSS_DEBUG + +int nr_generate_sss( int16_t *d_sss, + int32_t **txdataF, + int16_t amp, + int16_t ssb_first_subcarrier, + uint8_t slot_offset, + nfapi_param_t nfapi_params, + NR_DL_FRAME_PARMS *frame_parms) +{ + int i,m,k; + int m0, m1; + int Nid, Nid1, Nid2; + int16_t a, aa; + int16_t x0[NR_SSS_LENGTH], x1[NR_SSS_LENGTH]; + int16_t sss_mod[2* NR_SSS_LENGTH]; + const int x0_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; + const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; + + uint8_t Nsymb = (nfapi_params.subframe_config.dl_cyclic_prefix_type.value == 0)? 14 : 12; + + // Binary sequence generation + Nid = nfapi_params.sch_config.physical_cell_id.value; + Nid2 = Nid % 3; + Nid1 = (Nid - Nid2)/3; + + for ( i=0 ; i < 7 ; i++) { + x0[i] = x0_initial[i]; + x1[i] = x1_initial[i]; + } + + for ( i=0 ; i < NR_SSS_LENGTH - 7 ; i++) { + x0[i+7] = (x0[i + 4] + x0[i]) % 2; + x1[i+7] = (x1[i + 1] + x1[i]) % 2; + } + + m0 = 15*(Nid1/112) + (5*Nid2); + m1 = Nid1 % 112; + + 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] ); + if (d_sss[i] == -1) // This step -1 -> 0 is necessary to use nr_mod_table for the next step + d_sss[i] = 0; + } + + // BPSK modulation and resource mapping + a = (nfapi_params.rf_config.tx_antenna_ports.value == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; + for (i = 0; i < NR_SSS_LENGTH; i++) + { + sss_mod[2*i] = nr_mod_table[ 2 * (MOD_TABLE_BPSK_OFFSET + d_sss[i]) ]; + sss_mod[2*i + 1] = nr_mod_table[ 2 * (MOD_TABLE_BPSK_OFFSET + d_sss[i]) + 1]; + } + + for (aa = 0; aa < nfapi_params.rf_config.tx_antenna_ports.value; aa++) + { + + // SSS occupies a predefined position (symbol 2, subcarriers 56-182) within the SSB block starting from + k = frame_parms->first_carrier_offset + ssb_first_subcarrier + 56; // to be retrieved from ssb scheduling function + + for (m = 0; m < NR_SSS_LENGTH; m++) { + ((int16_t*)txdataF[aa])[2*(slot_offset*Nsymb*frame_parms->ofdm_symbol_size + 2*frame_parms->ofdm_symbol_size + k)] = (a * sss_mod[2*m]) >> 15; + ((int16_t*)txdataF[aa])[2*(slot_offset*Nsymb*frame_parms->ofdm_symbol_size + 2*frame_parms->ofdm_symbol_size + k) + 1] = (a * sss_mod[2*m + 1]) >> 15; + k+=1; + + if (k >= frame_parms->ofdm_symbol_size) { + k++; //skip DC + k-=frame_parms->ofdm_symbol_size; + } + } + } + + return (0); +} diff --git a/openair1/PHY/defs_NR.h b/openair1/PHY/defs_NR.h new file mode 100644 index 0000000000000000000000000000000000000000..2fde50548312c59c9b7ab5472b5eee9c24e63f7f --- /dev/null +++ b/openair1/PHY/defs_NR.h @@ -0,0 +1,87 @@ +/* + * 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 + */ + +#ifndef __INIT_DEFS_NR__H__ +#define __INIT_DEFS_NR__H__ + +#define _GNU_SOURCE +#include <sched.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <linux/sched.h> +#include <signal.h> +#include <execinfo.h> +#include <getopt.h> +#include <sys/sysinfo.h> +#include <malloc.h> +#include <string.h> +#include <math.h> + +#include "types.h" +#include "../nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface_nr_extension.h" +#include "assertions.h" +#include "impl_defs_nr.h" + +#define MAX_NUM_SUBCARRIER_SPACING 5 + +#define NR_PSS_LENGTH 127 +#define NR_SSS_LENGTH 127 + +#define ONE_OVER_SQRT2_Q15 23170 +#define ONE_OVER_TWO_Q15 16384 + +#define MOD_TABLE_SIZE_SHORT 6 +#define MOD_TABLE_BPSK_OFFSET 1 + +typedef enum { + NR_MU_0=0, + NR_MU_1, + NR_MU_2, + NR_MU_3, + NR_MU_4, +} nr_numerology_index_e; + +typedef struct { + uint32_t subcarrier_spacing; + /// 3/4 sampling + uint8_t threequarter_fs; + /// Size of FFT + uint16_t ofdm_symbol_size; + /// Number of prefix samples in all but first symbol of slot + uint16_t nb_prefix_samples; + /// Number of prefix samples in first symbol of slot + uint16_t nb_prefix_samples0; + /// Carrier offset in FFT buffer for first RE in PRB0 + uint16_t first_carrier_offset; + /// Number of samples in a subframe + uint32_t samples_per_tti; + /// Number of OFDM/SC-FDMA symbols in one slot + uint16_t symbols_per_slot; + /// Number of slots per subframe + uint16_t slots_per_subframe; +} NR_DL_FRAME_PARMS; + +#endif diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h new file mode 100644 index 0000000000000000000000000000000000000000..14fce1ae63cc0b6ec8f2a47916cff1a6ca290670 --- /dev/null +++ b/openair1/PHY/impl_defs_nr.h @@ -0,0 +1,51 @@ +/* + * 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 + */ + +#ifndef __PHY_IMPLEMENTATION_DEFS_LTE_H__ +#define __PHY_IMPLEMENTATION_DEFS_LTE_H__ + + +#include "types.h" +//#include "nfapi_interface.h" +//#include "defs.h" +#include "openair2/COMMON/platform_types.h" + + + + +typedef struct { + /// \brief Pointers (dynamic) to the received data in the time domain. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + int32_t **rxdata; + /// \brief Pointers (dynamic) to the received data in the frequency domain. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + int32_t **rxdataF; + /// \brief holds the transmit data in the frequency domain. + /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? + /// - first index: eNB id [0..2] (hard coded) + /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. + /// - third index: sample [0..] + int32_t **txdataF; +} NR_gNB_COMMON; + +#endif diff --git a/openair1/SCHED_NR/defs.h b/openair1/SCHED_NR/defs.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/openair1/SCHED_NR/extern.h b/openair1/SCHED_NR/extern.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c new file mode 100644 index 0000000000000000000000000000000000000000..8d48ecc432798377761bb9b92dcec291dc9f4c8e --- /dev/null +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -0,0 +1,46 @@ +/* + * 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 + */ + +#include "PHY/defs_NR.h" +//#include "PHY/extern.h" +#include "SCHED/defs.h" +#include "SCHED/extern.h" +//#include "nfapi_interface.h" +//#include "fapi_l1.h" +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "T.h" + +#include "assertions.h" +#include "msc.h" + +#include <time.h> + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + + +void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { + + +} diff --git a/openair1/SCHED_NR/vars.h b/openair1/SCHED_NR/vars.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/targets/RT/USER/nr-softmodem.c b/targets/RT/USER/nr-softmodem.c index 7a1c4a4d1b53e1b2bf085580cd7a10458f677297..17e3777783eb134782a52bf439ade0afc7d14659 100644 --- a/targets/RT/USER/nr-softmodem.c +++ b/targets/RT/USER/nr-softmodem.c @@ -21,8 +21,6 @@ #include "nr-softmodem.h" #include "PHY/types.h" -#include "../../nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface_nr_extension.h" -//#include "PHY/defs.h" #include "PHY/defs_NR.h" //Temporary main function @@ -52,11 +50,26 @@ void exit_fun(const char* s) int main( int argc, char **argv ) { nfapi_param_t nfapi_params; - NR_DL_FRAME_PARMS frame_parms; + NR_DL_FRAME_PARMS* frame_parms = malloc(sizeof(NR_DL_FRAME_PARMS)); + int16_t amp; + //malloc to move + int16_t** txdataF = (int16_t **)malloc(2048*2*14*2*2* sizeof(int16_t)); + int16_t* d_pss = malloc(NR_PSS_LENGTH * sizeof(int16_t)); + int16_t *d_sss = malloc(NR_SSS_LENGTH * sizeof(int16_t)); + + //logInit(); phy_init_nr_gNB(&nfapi_params); - nr_init_frame_parms(nfapi_params, &frame_parms); - nr_dump_frame_parms(&frame_parms); + nr_init_frame_parms(nfapi_params, frame_parms); + nr_dump_frame_parms(frame_parms); + + amp = 32767; //1_Q_15 + //nr_generate_pss(d_pss, txdataF, amp, 0, 0, nfapi_params, frame_parms); + nr_generate_sss(d_sss, txdataF, amp, 0, 0, nfapi_params, frame_parms); + + free(txdataF); + free(d_pss); + free(d_sss); return 0; }