Commit 5b93cd38 authored by Ting-An Lin's avatar Ting-An Lin

Create NB-IoT PHY struct

parent 302159fc
......@@ -1223,6 +1223,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/dlsch_scrambling_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/lte_mcs_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/ulsch_demodulation_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/ulsch_decoding_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/lte_Isc_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/nprach_NB_IoT.c
${OPENAIR1_DIR}/PHY/NBIoT_TRANSPORT/nsss_NB_IoT.c
......@@ -2116,6 +2117,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/init_lte.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
......
......@@ -36,7 +36,7 @@
#define CRC8 3
#define MAX_TURBO_ITERATIONS_MBSFN 8
#define MAX_TURBO_ITERATIONS max_turbo_iterations
#define MAX_TURBO_ITERATIONS 4
typedef struct {
unsigned short nb_bits;
......
......@@ -31,7 +31,6 @@
*/
#ifndef __TRANSPORT_UE__H__
#define __TRANSPORT_UE__H__
#include "PHY/defs_UE.h"
#include "PHY/impl_defs_lte.h"
#include "../LTE_TRANSPORT/dci.h"
#include "../LTE_TRANSPORT/mdci.h"
......
This diff is collapsed.
......@@ -119,7 +119,6 @@ enum transmission_access_mode {
SCHEDULED_ACCESS,
CBA_ACCESS};
typedef enum {
eNodeB_3GPP=0, // classical eNodeB function
eNodeB_3GPP_BBU, // eNodeB with NGFI IF5
......@@ -129,7 +128,6 @@ typedef enum {
NGFI_RRU_IF4p5 // NGFI_RRU (NGFI remote radio-unit,IF4p5)
} eNB_func_t;
typedef enum {
synch_to_ext_device=0, // synch to RF or Ethernet device
synch_to_other // synch to another source (timer, other CC_id)
......@@ -748,6 +746,11 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
} PHY_VARS_eNB_NB_IoT;
typedef struct{
PHY_VARS_eNB *eNB;
PHY_VARS_eNB_NB_IoT *eNB_NB_IoT;
} eNBs_t;
//#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
/// Top-level PHY Data Structure for UE
......
......@@ -59,12 +59,12 @@
#include "defs_common.h"
#include "impl_defs_top.h"
#include "LTE_UE_TRANSPORT/transport_ue.h"
#include "PHY/TOOLS/time_meas.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h"
#include "platform_types.h"
#include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
#include "LTE_UE_TRANSPORT/transport_ue.h"
#include "PHY/LTE_TRANSPORT/transport_eNB.h" // for SIC
#include <pthread.h>
#include "assertions.h"
......
......@@ -73,7 +73,6 @@
#include "openair2/PHY_INTERFACE/IF_Module.h"
typedef struct RU_proc_t_s {
/// Pointer to associated RU descriptor
struct RU_t_s *ru;
......@@ -764,6 +763,7 @@ typedef struct {
pthread_mutex_t mutex_RUs;
} L1_rxtx_proc_t;
typedef struct {
struct PHY_VARS_eNB_s *eNB;
int UE_id;
......
......@@ -109,7 +109,7 @@
#include "defs_eNB.h"
#include "types.h"
#include "LTE_UE_TRANSPORT/transport_ue.h"
/** @addtogroup _PHY_STRUCTURES_
......@@ -270,6 +270,20 @@ typedef struct {
int *RX_DMA_BUFFER[2];
} TX_RX_VARS;
/// Top-level PHY Data Structure for RN
typedef struct {
/// Module ID indicator for this instance
uint8_t Mod_id;
uint32_t frame;
// phy_vars_eNB
// phy_vars ue
// cuurently only used to store and forward the PMCH
uint8_t mch_avtive[10];
uint8_t sync_area[10]; // num SF
LTE_UE_DLSCH_t *dlsch_rn_MCH[10];
} PHY_VARS_RN;
/// Measurement Variables
//#define NUMBER_OF_SUBBANDS_MAX 13
......
......@@ -48,7 +48,7 @@
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
#include "nfapi_vnf.h"
#include "nfapi_pnf.h"
#include "../../openair1/PHY/defs_L1_NB_IoT.h"
#include "L1_paramdef.h"
#include "MACRLC_paramdef.h"
#include "common/config/config_userapi.h"
......@@ -112,6 +112,7 @@ void RCconfig_L1(void) {
if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ** *)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
RC.L1_NB_IoT = (PHY_VARS_eNB_NB_IoT **)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB_NB_IoT *));//Ann
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
......@@ -120,6 +121,14 @@ void RCconfig_L1(void) {
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
for (j = 0; j < RC.nb_nb_iot_L1_inst; j++) {//Ann
if (RC.L1_NB_IoT[j] == NULL) {
RC.L1_NB_IoT[j] = (PHY_VARS_eNB_NB_IoT *)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB_NB_IoT ));
LOG_I(PHY,"RC.L1_NB_IoT[%d] = %p\n",j,RC.L1_NB_IoT[j]);
memset(RC.L1_NB_IoT[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB_NB_IoT));
}
}
for (j = 0; j < RC.nb_L1_inst; j++) {
RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);
......
This diff is collapsed.
/*
* 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.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.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/types.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
#include "PHY/impl_defs_top.h"
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint16_t Nid_cell,
node_function_t node_function,
uint8_t abstraction_flag);
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag);
PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t RN_id,
uint8_t eMBMS_active_state);
void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
uint8_t frame_type,
uint8_t tdd_config,
uint8_t tdd_config_S,
uint8_t extended_prefix_flag,
uint8_t N_RB_DL,
uint16_t Nid_cell,
uint8_t cooperation_flag,
uint8_t nb_antenna_ports,
uint8_t abstraction_flag,
int nb_antennas_rx,
int nb_antennas_tx,
int nb_antennas_rx_ue,
uint8_t eMBMS_active_state);
// for NB-IoT testing
PHY_VARS_eNB_NB_IoT* init_lte_eNB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_NB_IoT_t node_function,
uint8_t abstraction_flag);
\ No newline at end of file
......@@ -58,6 +58,7 @@
#include "PHY/INIT/phy_init.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "SCHED/sched_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "nfapi/oai_integration/vendor_ext.h"
......@@ -748,8 +749,11 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
*/
static void *eNB_thread_prach( void *param ) {
static int eNB_thread_prach_status;
PHY_VARS_eNB *eNB= (PHY_VARS_eNB *)param;
L1_proc_t *proc = &eNB->proc;
eNBs_t *eNBs= (eNBs_t *)param;
PHY_VARS_eNB *eNB= &eNBs->eNB;
PHY_VARS_eNB_NB_IoT *eNB_NB_IoT= &eNBs->eNB_NB_IoT;//Ann
L1_proc_t *proc = &eNBs->eNB->proc;
// set default return value
eNB_thread_prach_status = 0;
thread_top_init("eNB_thread_prach",1,500000,1000000,20000000);
......@@ -768,7 +772,7 @@ static void *eNB_thread_prach( void *param ) {
#endif
);
prach_procedures_NB_IoT(eNB);
prach_procedures_NB_IoT(eNB_NB_IoT);//Ann
if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
}
......@@ -854,6 +858,8 @@ void init_eNB_proc(int inst) {
/*int i=0;*/
int CC_id;
PHY_VARS_eNB *eNB;
// PHY_VARS_eNB_NB_IoT *eNB_NB_IoT;//Ann
eNBs_t *eNBs;//Ann
L1_proc_t *proc;
L1_rxtx_proc_t *L1_proc, *L1_proc_tx;
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL;
......@@ -861,9 +867,10 @@ void init_eNB_proc(int inst) {
pthread_attr_t *attr_prach_br=NULL;
#endif
LOG_I(PHY,"%s(inst:%d) RC.nb_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_CC[inst]);
eNBs->eNB_NB_IoT = RC.L1_NB_IoT[inst];//[CC_id];//Ann
for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
eNB = RC.eNB[inst][CC_id];
eNBs->eNB = RC.eNB[inst][CC_id];
#ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing eNB processes instance:%d CC_id %d \n",inst,CC_id);
#endif
......@@ -943,7 +950,7 @@ void init_eNB_proc(int inst) {
}
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB );
pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNBs );
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNB );
#endif
......
......@@ -45,6 +45,7 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_common.h"
#include "common/ran_context.h"
#include "common/config/config_userapi.h"
#include "common/utils/load_module_shlib.h"
......@@ -93,7 +94,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "lte-softmodem.h"
#include "NB_IoT_interface.h"
#include "PHY/vars_NB_IoT.h"
pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
......@@ -156,6 +157,25 @@ int otg_enabled;
uint8_t exit_missed_slots=1;
uint64_t num_missed_slots=0; // counter for the number of missed slots
static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
node_function_t node_function[MAX_NUM_CCs];
node_timing_t node_timing[MAX_NUM_CCs];
////////////////////////////////////// NB-IoT //////////////////////////////////////////////
static NB_IoT_DL_FRAME_PARMS *frame_parms_NB_IoT[MAX_NUM_CCs]; // this will be still inside the PHY_VARS of LTE
eNB_func_NB_IoT_t node_function_NB_IoT[MAX_NUM_CCs];
eNB_timing_NB_IoT_t node_timing_NB_IoT[MAX_NUM_CCs];
/////////////////////////////////////////END/////////////////////////////////////////////////
int16_t node_synch_ref[MAX_NUM_CCs];
uint32_t target_dl_mcs = 28; //maximum allowed mcs
uint32_t target_ul_mcs = 20;
uint32_t timing_advance = 0;
int phy_test = 0;
uint8_t abstraction_flag=0;
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
......@@ -521,10 +541,11 @@ static void wait_nfapi_init(char *thread_name) {
}
int main( int argc, char **argv ) {
int i;
int CC_id = 0;
int i,j,k,aa,re;
int CC_id;
int ru_id;
int node_type = ngran_eNB;
uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
if ( load_configmodule(argc,argv,0) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
......@@ -611,6 +632,112 @@ int main( int argc, char **argv ) {
RCconfig_L1();
}
/////////////////////////////////////////////////// this is eNB /////////////////////////////////////////////////////////////
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**)); //global PHY_vars --> is a matrix
PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
///////////////////////// for NB-IoT testing ////////////////////////
PHY_vars_eNB_NB_IoT_g = malloc(sizeof(PHY_VARS_eNB_NB_IoT*)); //global PHY_vars --> is a matrix
PHY_vars_eNB_NB_IoT_g[0] = malloc(sizeof(PHY_VARS_eNB_NB_IoT));
///////////////////////////// END //////////////////////////////////
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//we initialiaze DL/UL buffer and HARQ (inside the LTE_eNB_DLSCH)
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
// for NB-IoT testing
PHY_vars_eNB_NB_IoT_g[0] = init_lte_eNB_NB_IoT(frame_parms_NB_IoT,0,frame_parms_NB_IoT->Nid_cell,node_function_NB_IoT,abstraction_flag);
//this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars
#ifdef NB_IOT
//init_lte_eNB_NB(PHY_vars_eNB_g[0][CC_id],frame_parms_NB_IoT[CC_id], 0, frame_parms_NB_IoT[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
#endif
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
// initialization for phy-test
for (k=0; k<NUMBER_OF_UE_MAX; k++) {
PHY_vars_eNB_g[0][CC_id]->transmission_mode[k] = transmission_mode;
if (transmission_mode==7)
lte_gold_ue_spec_port5(PHY_vars_eNB_g[0][CC_id]->lte_gold_uespec_port5_table[k],frame_parms[CC_id]->Nid_cell,0x1235+k);
}
if ((transmission_mode==1) || (transmission_mode==7)) {
for (j=0; j<frame_parms[CC_id]->nb_antennas_tx; j++)
for (re=0; re<frame_parms[CC_id]->ofdm_symbol_size; re++)
PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff/frame_parms[CC_id]->nb_antennas_tx;
}
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) { //set default parameters for testing mode
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i;
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
}
// for NB-IoT testing
if (phy_test==1) PHY_vars_eNB_NB_IoT_g[0]->mac_enabled = 0;
else PHY_vars_eNB_NB_IoT_g[0]->mac_enabled = 1;
if (PHY_vars_eNB_NB_IoT_g[0]->mac_enabled == 0) { //set default parameters for testing mode
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_NB_IoT_g[0]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i;
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_NB_IoT_g[0]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
}
// No need to do for NB-IoT
compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common,
PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type,
PHY_vars_eNB_g[0][CC_id]->X_u);
PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0];
if (frame_parms[CC_id]->frame_type==FDD) {
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0;
} else {
if (frame_parms[CC_id]->N_RB_DL == 100)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624;
else if (frame_parms[CC_id]->N_RB_DL == 50)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/2;
else if (frame_parms[CC_id]->N_RB_DL == 25)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/4;
}
// for NB-IoT testing
PHY_vars_eNB_NB_IoT_g[0]->rx_total_gain_dB = (int)rx_gain[CC_id][0];
if (frame_parms_NB_IoT[CC_id]->frame_type==FDD) {
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 0;
} else {
if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 100)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624;
else if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 50)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624/2;
else if (frame_parms_NB_IoT[CC_id]->N_RB_DL == 25)
PHY_vars_eNB_NB_IoT_g[0]->N_TA_offset = 624/4;
}
}
if (RC.nb_inst > 0 && NODE_IS_CU(node_type)) {
protocol_ctxt_t ctxt;
ctxt.module_id = 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