Commit c4fd4dca authored by Guy De Souza's avatar Guy De Souza

nfapi extension/ test nr-softmodem

parent e88abf27
...@@ -1236,10 +1236,7 @@ set(PHY_SRC_UE ...@@ -1236,10 +1236,7 @@ set(PHY_SRC_UE
# depend on code generation from asn1c # depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h ${RRC_FULL_DIR}/asn1_constants.h
# actual source # actual source
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c ${OPENAIR1_DIR}/PHY/INIT/nr_init.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c ${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
...@@ -2142,20 +2139,12 @@ target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB}) ...@@ -2142,20 +2139,12 @@ target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
add_executable(nr-softmodem add_executable(nr-softmodem
#${rrc_h} #${rrc_h}
#${s1ap_h} #${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/nr-softmodem.c ${OPENAIR_TARGETS}/RT/USER/nr-softmodem.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
#${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/system.c
${GTPU_need_ITTI} #${GTPU_need_ITTI}
${XFORMS_SOURCE} #${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM} #${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE} ${T_SOURCE}
${CONFIG_SOURCES} ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES} ${SHLIB_LOADER_SOURCES}
......
/*
* Copyright 2017 Cisco Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#ifndef _NFAPI_INTERFACE_NR_EXTENSION_H_
#define _NFAPI_INTERFACE_H_
#define _NFAPI_INTERFACE_NR_EXTENSION_H_
#include "stddef.h"
#define NFAPI_MAX_PNF_PHY 5
typedef struct {
uint16_t tag;
uint16_t length;
} nfapi_tl_t;
typedef struct {
nfapi_tl_t tl;
uint16_t value;
} nfapi_uint16_tlv_t;
typedef struct {
nfapi_tl_t tl;
int16_t value;
} nfapi_int16_tlv_t;
typedef struct {
nfapi_tl_t tl;
uint8_t value;
} nfapi_uint8_tlv_t;
typedef enum {
NFAPI_3GPP_REL_SUPPORTED_9 = 1,
NFAPI_3GPP_REL_SUPPORTED_10 = 2,
NFAPI_3GPP_REL_SUPPORTED_11 = 4,
NFAPI_3GPP_REL_SUPPORTED_12 = 8,
NFAPI_3GPP_REL_SUPPORTED_15 = 64
} nfapi_3gpp_release_supported_e;
typedef enum {
NFAPI_RAT_TYPE_LTE = 0,
NFAPI_RAT_TYPE_UTRAN = 1,
NFAPI_RAT_TYPE_GERAN = 2,
NFAPI_RAT_TYPE_NB_IOT = 3,
NFAPI_RAT_TYPE_NR = 4
} nfapi_rat_type_e;
typedef struct {
nfapi_uint16_tlv_t duplex_mode;
nfapi_uint16_tlv_t pcfich_power_offset;
nfapi_uint16_tlv_t pb;
nfapi_uint16_tlv_t dl_cyclic_prefix_type;
nfapi_uint16_tlv_t ul_cyclic_prefix_type;
} nfapi_subframe_config_t;
#define NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG 0x0001
#define NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG 0x0002
#define NFAPI_SUBFRAME_CONFIG_PB_TAG 0x0003
#define NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG 0x0004
#define NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG 0x0005
typedef struct {
nfapi_uint16_tlv_t dl_channel_bandwidth;
nfapi_uint16_tlv_t ul_channel_bandwidth;
nfapi_uint16_tlv_t reference_signal_power;
nfapi_uint16_tlv_t tx_antenna_ports;
nfapi_uint16_tlv_t rx_antenna_ports;
} nfapi_rf_config_t;
#define NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG 0x000A
#define NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG 0x000B
#define NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG 0x000C
#define NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG 0x000D
#define NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG 0x000E
typedef struct {
uint16_t phy_config_index;
uint8_t mu;
} nfapi_pnf_phy_rel15_info_t;
typedef struct {
nfapi_tl_t tl;
uint16_t number_of_phys;
nfapi_pnf_phy_rel15_info_t phy[NFAPI_MAX_PNF_PHY];
} nfapi_pnf_phy_rel15_t;
#define NFAPI_PNF_PHY_REL15_TAG 0x100H
typedef enum {
NFAPI_HALF_FRAME_INDEX_FIRST_HALF = 0,
NFAPI_HALF_FRAME_INDEX_SECOND_HALF = 1
} nfapi_half_frame_index_e;
typedef struct {
nfapi_uint16_tlv_t primary_synchronization_signal_epre_eprers;
nfapi_uint16_tlv_t secondary_synchronization_signal_epre_eprers;
nfapi_uint16_tlv_t physical_cell_id;
nfapi_half_frame_index_e half_frame_index;
nfapi_uint16_tlv_t ssb_subcarrier_offset;
nfapi_uint16_tlv_t ssb_position_in_burst;
nfapi_uint16_tlv_t ssb_periodicity;
nfapi_uint16_tlv_t ss_pbch_block_power;
} nfapi_sch_config_t;
#define NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG 0x001E
#define NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG 0x001F
#define NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG 0x0020
#define NFAPI_SCH_CONFIG_HALF_FRAME_INDEX_TAG 0x0021
#define NFAPI_SCH_CONFIG_SSB_SUBCARRIER_OFFSET_TAG 0x0022
#define NFAPI_SCH_CONFIG_SSB_POSITION_IN_BURST 0x0023
#define NFAPI_SCH_CONFIG_SSB_PERIODICITY 0x0024
#define NFAPI_SCH_CONFIG_SS_PBCH_BLOCK_POWER 0x0025
//temporary
typedef struct {
nfapi_subframe_config_t subframe_config;
nfapi_rf_config_t rf_config;
nfapi_sch_config_t sch_config;
nfapi_pnf_phy_rel15_t pnf_phy_rel15;
} nfapi_param_t;
#endif
/*
* 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__
#include "PHY/defs.h"
typedef enum {
NR_MU_0=0,
NR_MU_1,
NR_MU_2,
NR_MU_3,
NR_MU_4,
} nr_numerology_index_e;
/// Subcarrier spacings in Hz indexed by numerology index
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
#endif
...@@ -19,7 +19,17 @@ ...@@ -19,7 +19,17 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "defs.h" #include "../defs_NR.h"
#include "defs_NR.h"
#include "assertions.h" int phy_init_nr_gNB(nfapi_param_t* nfapi_params)
#include <math.h> {
nfapi_params->pnf_phy_rel15.number_of_phys = 1;
nfapi_params->pnf_phy_rel15.phy[0].mu =1;
nfapi_params->subframe_config.duplex_mode.value = 1; //FDD
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;
return 0;
}
...@@ -19,33 +19,39 @@ ...@@ -19,33 +19,39 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "defs.h" #include "../defs_NR.h"
#include "defs_NR.h"
#include "log.h" #include "log.h"
/// Subcarrier spacings in Hz indexed by numerology index
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
int nr_init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) int nr_init_frame_parms(nfapi_param_t nfapi_params,
NR_DL_FRAME_PARMS *frame_parms)
{ {
int N_RB = nfapi_params.rf_config.dl_channel_bandwidth.value;
int Ncp = nfapi_params.subframe_config.dl_cyclic_prefix_type.value;
int mu = nfapi_params.pnf_phy_rel15.phy[0].mu;
#if DISABLE_LOG_X #if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp);
#else #else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB, Ncp);
#endif #endif
if (frame_parms->Ncp == EXTENDED) if (Ncp == 1) //EXTENDED, to be modified after lte defs are properly linked
AssertFatal(frame_parms->mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", frame_parms->Ncp, frame_parms->mu); AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
switch(frame_parms->mu) { switch(mu) {
case NR_MU_0: //15kHz scs case NR_MU_0: //15kHz scs
frame_parms->scs = nr_subcarrier_spacing[NR_MU_0]; frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_0];
break; break;
case NR_MU_1: //30kHz scs case NR_MU_1: //30kHz scs
frame_parms->scs = nr_subcarrier_spacing[NR_MU_1]; frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_1];
switch(frame_parms->N_RB_DL){ switch(N_RB){
case 11: case 11:
case 24: case 24:
case 38: case 38:
...@@ -85,14 +91,14 @@ int nr_init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) ...@@ -85,14 +91,14 @@ int nr_init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
case 245: case 245:
case 273: case 273:
default: default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", frame_parms->N_RB_DL, frame_parms->mu, frame_parms); AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB, mu, frame_parms);
} }
break; break;
case NR_MU_2: //60kHz scs case NR_MU_2: //60kHz scs
frame_parms->scs = nr_subcarrier_spacing[NR_MU_2]; frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2];
switch(frame_parms->N_RB_DL){ //FR1 bands only switch(N_RB){ //FR1 bands only
case 11: case 11:
case 18: case 18:
case 38: case 38:
...@@ -106,30 +112,28 @@ int nr_init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) ...@@ -106,30 +112,28 @@ int nr_init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
case 121: case 121:
case 135: case 135:
default: default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", frame_parms->N_RB_DL, frame_parms->mu, frame_parms); AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB, mu, frame_parms);
} }
break; break;
case NR_MU_3: case NR_MU_3:
frame_parms->scs = nr_subcarrier_spacing[NR_MU_3]; frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3];
break; break;
case NR_MU_4: case NR_MU_4:
frame_parms->scs = nr_subcarrier_spacing[NR_MU_4]; frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_4];
break; break;
default: default:
AssertFatal(1==0,"Invalid numerology index %d", frame_parms->mu); AssertFatal(1==0,"Invalid numerology index %d", mu);
} }
return 0; return 0;
} }
void nr_dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms)
{ {
LOG_I(PHY,"frame_parms->mu=%d\n",frame_parms->mu); LOG_I(PHY,"frame_parms->scs=%d\n",frame_parms->subcarrier_spacing);
LOG_I(PHY,"frame_parms->scs=%d\n",frame_parms->scs);
LOG_I(PHY,"frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
LOG_I(PHY,"frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size); 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->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_samples0=%d\n",frame_parms->nb_prefix_samples0);
......
...@@ -19,4 +19,44 @@ ...@@ -19,4 +19,44 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "nr-softmodem.h" #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
void exit_fun(const char* s)
{
int ru_id;
if (s != NULL) {
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
}
/*oai_exit = 1;
if (RC.ru == NULL)
exit(-1); // likely init not completed, prevent crash or hang, exit now...
for (ru_id=0; ru_id<RC.nb_RU;ru_id++) {
if (RC.ru[ru_id] && RC.ru[ru_id]->rfdevice.trx_end_func)
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func)
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
}*/
}
int main( int argc, char **argv )
{
nfapi_param_t nfapi_params;
NR_DL_FRAME_PARMS frame_parms;
phy_init_nr_gNB(&nfapi_params);
nr_init_frame_parms(nfapi_params, &frame_parms);
nr_dump_frame_parms(&frame_parms);
return 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