Commit 7b524674 authored by Guy De Souza's avatar Guy De Souza
Browse files

Intermediate commit/ Not working(defs issue)

parent a1896982
......@@ -2139,14 +2139,24 @@ target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
###################################################
add_executable(nr-softmodem
#${rrc_h}
#${s1ap_h}
${rrc_h}
${s1ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
${OPENAIR_TARGETS}/RT/USER/nr-ru.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
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
#${GTPU_need_ITTI}
#${XFORMS_SOURCE}
#${XFORMS_SOURCE_SOFTMODEM}
${GTPU_need_ITTI}
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
......@@ -2154,9 +2164,9 @@ add_executable(nr-softmodem
target_link_libraries (nr-softmodem
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_NR LFDS GTPV1U SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_NR PHY LFDS GTPV1U SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB}
#RRC_LIB S1AP_LIB S1AP_ENB L2
RRC_LIB S1AP_LIB S1AP_ENB L2
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
......
......@@ -77,6 +77,8 @@ typedef struct {
flexran_agent_info_t **flexran;
/// eNB context variables
struct PHY_VARS_eNB_s ***eNB;
/// gNB context variables
struct PHY_VARS_gNB_s ***gNB;
/// NB_IoT L1 context variables
struct PHY_VARS_eNB_NB_IoT_s **L1_NB_IoT;
/// RRC context variables
......
/*
* 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.
......@@ -15,7 +15,8 @@
*/
#ifndef _NFAPI_INTERFACE_H_
#ifndef _NFAPI_INTERFACE_NR_EXTENSION_H_
#define _NFAPI_INTERFACE_NR_EXTENSION_H_
#define _NFAPI_INTERFACE_H_
#include "stddef.h"
......@@ -30,7 +31,7 @@
// These may be changed if desired. They are used in the encoder to make sure
// that the user has not specified a 'count' larger than the max array, and also
// used by the decoder when decode an array. If the 'count' received is larger
// than the array it is to be stored in the decode fails.
// than the array it is to be stored in the decode fails.
#define NFAPI_MAX_NUM_ANTENNAS 8
#define NFAPI_MAX_NUM_SUBBANDS 13
#define NFAPI_MAX_BF_VECTORS 8
......@@ -338,7 +339,8 @@ 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_12 = 8,
NFAPI_3GPP_REL_SUPPORTED_15 = 64
} nfapi_3gpp_release_supported_e;
......@@ -357,7 +359,8 @@ 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_NB_IOT = 3,
NFAPI_RAT_TYPE_NR = 4
} nfapi_rat_type_e;
typedef enum {
......@@ -534,6 +537,16 @@ typedef struct {
} nfapi_pnf_phy_rel13_nb_iot_t;
#define NFAPI_PNF_PHY_REL13_NB_IOT_TAG 0x100E
typedef struct {
uint16_t phy_config_index;
} 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 struct {
......@@ -619,6 +632,7 @@ typedef struct {
#define NFAPI_L23_CONFIG_SFNSF_TAG 0x00F1
typedef struct {
nfapi_uint16_tlv_t numerology_index_mu;
nfapi_uint16_tlv_t duplex_mode;
nfapi_uint16_tlv_t pcfich_power_offset;
nfapi_uint16_tlv_t pb;
......@@ -631,6 +645,7 @@ typedef struct {
#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
#define NFAPI_SUBFRAME_CONFIG_NUMEROLOGY_INDEX_MU_TAG 0x0006
typedef struct {
nfapi_uint16_tlv_t dl_channel_bandwidth;
......@@ -656,15 +671,30 @@ typedef struct {
#define NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG 0x0015
#define NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG 0x0016
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
typedef struct {
nfapi_uint16_tlv_t configuration_index;
......@@ -1038,6 +1068,7 @@ typedef struct {
nfapi_pnf_phy_rel12_t pnf_phy_rel12;
nfapi_pnf_phy_rel13_t pnf_phy_rel13;
nfapi_pnf_phy_rel13_nb_iot_t pnf_phy_rel13_nb_iot;
nfapi_pnf_phy_rel15_t pnf_phy_rel15;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_pnf_param_response_t;
......
/*
* 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.
......@@ -15,7 +15,8 @@
*/
#ifndef _NFAPI_INTERFACE_H_
#ifndef _NFAPI_INTERFACE_NR_EXTENSION_H_
#define _NFAPI_INTERFACE_NR_EXTENSION_H_
#define _NFAPI_INTERFACE_H_
#include "stddef.h"
......@@ -30,7 +31,7 @@
// These may be changed if desired. They are used in the encoder to make sure
// that the user has not specified a 'count' larger than the max array, and also
// used by the decoder when decode an array. If the 'count' received is larger
// than the array it is to be stored in the decode fails.
// than the array it is to be stored in the decode fails.
#define NFAPI_MAX_NUM_ANTENNAS 8
#define NFAPI_MAX_NUM_SUBBANDS 13
#define NFAPI_MAX_BF_VECTORS 8
......
This diff is collapsed.
......@@ -24,6 +24,7 @@
/// Subcarrier spacings in Hz indexed by numerology index
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32};
int nr_init_frame_parms(nfapi_config_request_t config,
NR_DL_FRAME_PARMS *frame_parms)
......@@ -36,8 +37,7 @@ int nr_init_frame_parms(nfapi_config_request_t config,
#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);
printf("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);
#endif
if (Ncp == 1) //EXTENDED, to be modified after lte defs are properly linked
......@@ -47,10 +47,12 @@ int nr_init_frame_parms(nfapi_config_request_t config,
case NR_MU_0: //15kHz scs
frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_0];
frame_parms->slots_per_subframe = nr_slots_per_subframe[NR_MU_0];
break;
case NR_MU_1: //30kHz scs
frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_1];
frame_parms->slots_per_subframe = nr_slots_per_subframe[NR_MU_1];
switch(N_RB){
case 11:
......@@ -62,7 +64,7 @@ int nr_init_frame_parms(nfapi_config_request_t config,
case 106: //40 MHz
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
//frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 1412; //2048 - 636
frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144;
......@@ -75,14 +77,14 @@ int nr_init_frame_parms(nfapi_config_request_t config,
case 217: //80 MHz
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 3072;
frame_parms->samples_per_tti = 46080;
//frame_parms->samples_per_tti = 46080;
frame_parms->first_carrier_offset = 1770; //3072 - 1302
frame_parms->nb_prefix_samples0 = 240;
frame_parms->nb_prefix_samples = 216;
}
else {
frame_parms->ofdm_symbol_size = 4096;
frame_parms->samples_per_tti = 61440;
//frame_parms->samples_per_tti = 61440;
frame_parms->first_carrier_offset = 2794; //4096 - 1302
frame_parms->nb_prefix_samples0 = 320;
frame_parms->nb_prefix_samples = 288;
......@@ -98,6 +100,7 @@ int nr_init_frame_parms(nfapi_config_request_t config,
case NR_MU_2: //60kHz scs
frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2];
frame_parms->slots_per_subframe = nr_slots_per_subframe[NR_MU_2];
switch(N_RB){ //FR1 bands only
case 11:
......@@ -119,29 +122,32 @@ int nr_init_frame_parms(nfapi_config_request_t config,
case NR_MU_3:
frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3];
frame_parms->slots_per_subframe = nr_slots_per_subframe[NR_MU_3];
break;
case NR_MU_4:
frame_parms->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_4];
frame_parms->slots_per_subframe = nr_slots_per_subframe[NR_MU_4];
break;
default:
AssertFatal(1==0,"Invalid numerology index %d", mu);
}
frame_parms->samples_per_subframe_wCP = frame_parms->ofdm_symbol_size * ((Ncp == 0)? 14 : 12) * frame_parms->slots_per_subframe;
frame_parms->samples_per_frame_wCP = 10 * frame_parms->samples_per_subframe_wCP;
return 0;
}
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);*/
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);
LOG_I(PHY,"frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
LOG_I(PHY,"frame_parms->slots_per_subframe=%d\n",frame_parms->slots_per_subframe);
LOG_I(PHY,"frame_parms->samples_per_subframe_wCP=%d\n",frame_parms->samples_per_subframe_wCP);
LOG_I(PHY,"frame_parms->samples_per_frame_wCP=%d\n",frame_parms->samples_per_frame_wCP);
}
......@@ -23,26 +23,24 @@
#define NR_PSS_DEBUG
short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,768,768,-768,-768};
//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,
int16_t ssb_start_subcarrier,
uint8_t ssb_start_symbol,
nfapi_config_request_t config,
NR_DL_FRAME_PARMS *frame_parms)
{
int i,n,m,k;
int i,m,k,l;
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 = config.sch_config.physical_cell_id.value % 3;
uint8_t Nsymb = (config.subframe_config.dl_cyclic_prefix_type.value == 0)? 14 : 12;
// Binary sequence generation
/// Sequence generation
for (i=0; i < 7; i++)
x[i] = x_initial[i];
......@@ -50,28 +48,24 @@ int nr_generate_pss( int16_t *d_pss,
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)
for (i=0; i < NR_PSS_LENGTH; i++) {
m = (i + 43*Nid2)%(NR_PSS_LENGTH);
d_pss[i] = (1 - 2*x[m]) * 32767;
}
// BPSK modulation and resource mapping
/// Resource mapping
a = (config.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 < config.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
// 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
l = ssb_start_symbol;
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;
((int16_t*)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;
if (k >= frame_parms->ofdm_symbol_size) {
......
......@@ -28,23 +28,20 @@ extern short nr_mod_table[MOD_TABLE_SIZE_SHORT];
int nr_generate_sss( int16_t *d_sss,
int32_t **txdataF,
int16_t amp,
int16_t ssb_first_subcarrier,
uint8_t slot_offset,
int16_t ssb_start_subcarrier,
uint8_t ssb_start_symbol,
nfapi_config_request_t config,
NR_DL_FRAME_PARMS *frame_parms)
{
int i,m,k;
int i,m,k,l;
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 = (config.subframe_config.dl_cyclic_prefix_type.value == 0)? 14 : 12;
// Binary sequence generation
/// Sequence generation
Nid = config.sch_config.physical_cell_id.value;
Nid2 = Nid % 3;
Nid1 = (Nid - Nid2)/3;
......@@ -63,28 +60,22 @@ int nr_generate_sss( int16_t *d_sss,
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;
d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 32767;
}
// BPSK modulation and resource mapping
/// Resource mapping
a = (config.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 < config.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
// 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
l = ssb_start_symbol + 2;
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;
((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) + 1] = (a * sss_mod[2*m + 1]) >> 15;
k+=1;
if (k >= frame_parms->ofdm_symbol_size) {
......
......@@ -41,12 +41,14 @@
#include <math.h>
#include "types.h"
#include "../nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface_nr_extension.h"
#include "defs.h"
#include "assertions.h"
#include "impl_defs_nr.h"
#define MAX_NUM_SUBCARRIER_SPACING 5
#define NR_SYMBOLS_PER_SLOT 14
#define NR_PSS_LENGTH 127
#define NR_SSS_LENGTH 127
......@@ -76,12 +78,412 @@ typedef struct {
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;
/// Number of samples in a subframe
uint32_t samples_per_subframe;
/// Number of samples in a radio frame
uint32_t samples_per_frame;
/// Number of samples in a subframe without CP
uint32_t samples_per_subframe_wCP;
/// Number of samples in a radio frame without CP
uint32_t samples_per_frame_wCP;
} NR_DL_FRAME_PARMS;
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// Component Carrier index
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
int subframe_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for reception
int frame_rx;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread_rxtx;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr_rxtx;
/// condition variable for tx processing thread
pthread_cond_t cond_rxtx;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} gNB_rxtx_proc_t;
/// Context data structure for eNB subframe processing
typedef struct gNB_proc_t_s {
/// Component Carrier index
uint8_t CC_id;
/// thread index
int thread_index;
/// timestamp received from HW
openair0_timestamp timestamp_rx;
/// timestamp to send to "slave rru"
openair0_timestamp timestamp_tx;
/// subframe to act upon for reception
int subframe_rx;
/// subframe to act upon for PRACH
int subframe_prach;
/// frame to act upon for reception
int frame_rx;
/// frame to act upon for transmission
int frame_tx;
/// frame to act upon for PRACH
int frame_prach;
/// \internal This variable is protected by \ref mutex_td.
int instance_cnt_td;
/// \internal This variable is protected by \ref mutex_te.
int instance_cnt_te;
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
// instance count for over-the-air gNB synchronization
int instance_cnt_synch;
/// \internal This variable is protected by \ref mutex_asynch_rxtx.
int instance_cnt_asynch_rxtx;
/// pthread structure for eNB single processing thread
pthread_t pthread_single;
/// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx;
/// flag to indicate first RX acquisition
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for parallel turbo-decoder thread
pthread_attr_t attr_td;
/// pthread attributes for parallel turbo-encoder thread
pthread_attr_t attr_te;
/// pthread attributes for single eNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
struct sched_param sched_param_te;
/// scheduling parameters for single eNB thread
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
struct sched_param sched_param_prach;
/// scheduling parameters for asynch_rxtx thread
struct sched_param sched_param_asynch_rxtx;
/// pthread structure for parallel turbo-decoder thread
pthread_t pthread_td;
/// pthread structure for parallel turbo-encoder thread
pthread_t pthread_te;
/// pthread structure for PRACH thread
pthread_t pthread_prach;
/// condition variable for parallel turbo-decoder thread
pthread_cond_t cond_td;
/// condition variable for parallel turbo-encoder thread
pthread_cond_t cond_te;
/// condition variable for PRACH processing thread;
pthread_cond_t cond_prach;
/// condition variable for asynch RX/TX thread
pthread_cond_t cond_asynch_rxtx;
/// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread
pthread_mutex_t mutex_te;
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
/// mutex for asynch RX/TX thread
pthread_mutex_t mutex_asynch_rxtx;
/// mutex for RU access to eNB processing (PDSCH/PUSCH)
pthread_mutex_t mutex_RU;
/// mutex for RU access to eNB processing (PRACH)
pthread_mutex_t mutex_RU_PRACH;
/// mutex for RU access to eNB processing (PRACH BR)
pthread_mutex_t mutex_RU_PRACH_br;
/// mask for RUs serving eNB (PDSCH/PUSCH)
int RU_mask;
/// mask for RUs serving eNB (PRACH)
int RU_mask_prach;
/// parameters for turbo-decoding worker thread
td_params tdp;
/// parameters for turbo-encoding worker thread
te_params tep;
/// set of scheduling variables RXn-TXnp4 threads
gNB_rxtx_proc_t proc_rxtx[2];
} gNB_proc_t;