very big merge with merged develop, basic test done
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
|
||||
[*] Thu Feb 22 14:46:40 2018
|
||||
[*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
|
||||
[*] Sun May 19 21:39:57 2019
|
||||
[*]
|
||||
[dumpfile] "/tmp/openair_dump_eNB.vcd"
|
||||
[dumpfile_mtime] "Thu Feb 22 14:44:26 2018"
|
||||
[dumpfile_size] 3482761
|
||||
[savefile] "/homes/wangts/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
|
||||
[timestart] 4525000000
|
||||
[size] 1920 1018
|
||||
[pos] 0 22
|
||||
*-21.506693 4530514310 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[dumpfile_mtime] "Sun May 19 21:30:25 2019"
|
||||
[dumpfile_size] 11590554
|
||||
[savefile] "/home/sphex/raymond/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
|
||||
[timestart] 7629910000
|
||||
[size] 1840 795
|
||||
[pos] -1 -1
|
||||
*-21.832302 7639830000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[sst_width] 386
|
||||
[signals_width] 344
|
||||
[sst_expanded] 1
|
||||
@@ -24,9 +24,11 @@ variables.trx_tst[63:0]
|
||||
functions.eNB_thread_rxtx0
|
||||
@24
|
||||
variables.frame_number_RX0_RU[63:0]
|
||||
variables.subframe_number_RX0_RU[63:0]
|
||||
@25
|
||||
variables.tti_number_RX0_RU[63:0]
|
||||
@24
|
||||
variables.frame_number_TX0_RU[63:0]
|
||||
variables.subframe_number_TX0_RU[63:0]
|
||||
variables.tti_number_TX0_RU[63:0]
|
||||
@28
|
||||
functions.mac_schedule_dlsch
|
||||
functions.macxface_eNB_dlsch_ulsch_scheduler
|
||||
@@ -34,9 +36,7 @@ functions.macxface_ue_scheduler
|
||||
functions.phy_eNB_ofdm_mod_l
|
||||
@24
|
||||
variables.frame_number_RX0_eNB[63:0]
|
||||
@25
|
||||
variables.subframe_number_RX0_eNB[63:0]
|
||||
@24
|
||||
variables.frame_number_TX0_eNB[63:0]
|
||||
variables.subframe_number_TX0_eNB[63:0]
|
||||
variables.frame_number_RX1_eNB[63:0]
|
||||
@@ -56,11 +56,13 @@ functions.phy_procedures_eNb_rx_uespec1
|
||||
functions.phy_enb_sfgen
|
||||
functions.phy_procedures_eNb_tx0
|
||||
functions.phy_procedures_eNb_tx1
|
||||
functions.phy_procedures_ru_feprx0
|
||||
functions.phy_procedures_ru_feprx1
|
||||
functions.phy_procedures_ru_feptx_ofdm0
|
||||
functions.phy_procedures_ru_feptx_ofdm1
|
||||
functions.phy_procedures_ru_feptx_prec0
|
||||
functions.phy_procedures_ru_feptx_prec1
|
||||
functions.eNB_thread_rxtx0
|
||||
functions.eNB_thread_rxtx1
|
||||
functions.phy_enb_sfgen
|
||||
functions.phy_enb_prach_rx
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.61 (w)1999-2014 BSI
|
||||
[*] Tue Dec 17 15:31:51 2019
|
||||
[*]
|
||||
[dumpfile] "/tmp/gNB.vcd"
|
||||
[dumpfile_mtime] "Tue Dec 17 15:25:49 2019"
|
||||
[dumpfile_size] 6343431
|
||||
[savefile] "/home/wangts/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw"
|
||||
[timestart] 1517712000
|
||||
[size] 1920 1018
|
||||
[pos] -9 -33
|
||||
*-19.276148 1518358451 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[sst_width] 386
|
||||
[signals_width] 344
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 267
|
||||
@28
|
||||
functions.trx_read
|
||||
functions.trx_write
|
||||
@420
|
||||
variables.frame_number_TX0_UE[63:0]
|
||||
variables.frame_number_TX1_UE[63:0]
|
||||
@28
|
||||
functions.ue_gain_control
|
||||
@420
|
||||
variables.frame_number_RX1_UE[63:0]
|
||||
@24
|
||||
variables.trx_ts_ue[63:0]
|
||||
variables.trx_ts[63:0]
|
||||
variables.trx_tst[63:0]
|
||||
variables.frame_number_RX0_RU[63:0]
|
||||
variables.tti_number_RX0_RU[63:0]
|
||||
variables.frame_number_TX0_RU[63:0]
|
||||
variables.tti_number_TX0_RU[63:0]
|
||||
@28
|
||||
functions.mac_schedule_dlsch
|
||||
functions.macxface_eNB_dlsch_ulsch_scheduler
|
||||
@24
|
||||
variables.frame_number_RX0_gNB[63:0]
|
||||
variables.slot_number_RX0_gNB[63:0]
|
||||
variables.frame_number_TX0_gNB[63:0]
|
||||
variables.slot_number_TX0_gNB[63:0]
|
||||
@28
|
||||
functions.gNB_thread_rxtx0
|
||||
@24
|
||||
variables.frame_number_RX1_gNB[63:0]
|
||||
variables.slot_number_RX1_gNB[63:0]
|
||||
variables.frame_number_TX1_gNB[63:0]
|
||||
variables.slot_number_TX1_gNB[63:0]
|
||||
@28
|
||||
functions.gNB_thread_rxtx1
|
||||
functions.phy_enb_pdcch_tx
|
||||
functions.phy_eNB_dlsch_encoding
|
||||
functions.phy_eNB_dlsch_encoding_w
|
||||
functions.generate_dlsch
|
||||
@420
|
||||
variables.frame_number_RX0_UE[63:0]
|
||||
@28
|
||||
functions.phy_procedures_ru_feprx0
|
||||
functions.phy_procedures_ru_feprx1
|
||||
functions.phy_procedures_ru_feptx_ofdm0
|
||||
functions.phy_procedures_ru_feptx_ofdm1
|
||||
functions.phy_procedures_ru_feptx_ofdm2
|
||||
functions.phy_procedures_ru_feptx_prec0
|
||||
functions.phy_procedures_ru_feptx_prec1
|
||||
functions.phy_procedures_ru_feptx_prec2
|
||||
@22
|
||||
variables.ru_tx_ofdm_mask[63:0]
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
+167
-192
@@ -29,7 +29,7 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
|
||||
/*! \function wakeup_txfh
|
||||
* \brief Implementation of creating multiple RU threads for beamforming emulation
|
||||
* \author TH Wang(Judy), TY Hsu, SY Yeh(fdragon)
|
||||
@@ -64,7 +64,7 @@
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
@@ -86,7 +85,7 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "enb_config.h"
|
||||
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
|
||||
#ifndef OPENAIR2
|
||||
#include "UTIL/OTG/otg_extern.h"
|
||||
@@ -110,7 +109,7 @@ struct timing_info_t {
|
||||
// Fix per CC openair rf/if device update
|
||||
// extern openair0_device openair0;
|
||||
|
||||
extern volatile int oai_exit;
|
||||
extern volatile int oai_exit;
|
||||
|
||||
extern int transmission_mode;
|
||||
|
||||
@@ -118,7 +117,9 @@ extern int oaisim_flag;
|
||||
|
||||
//uint16_t sf_ahead=4;
|
||||
extern uint16_t sf_ahead;
|
||||
|
||||
#include "executables/thread-common.h"
|
||||
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
//extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
|
||||
//pthread_t main_eNB_thread;
|
||||
|
||||
@@ -144,12 +145,10 @@ extern double cpuf;
|
||||
void init_eNB(int,int);
|
||||
void stop_eNB(int nb_inst);
|
||||
|
||||
int wakeup_tx(PHY_VARS_eNB *eNB ,int frame_rx,int subframe_rx,int frame_tx,int subframe_tx,uint64_t timestamp_tx);
|
||||
int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,int frame_tx,int subframe_tx,uint64_t timestamp_tx);
|
||||
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
#endif
|
||||
int wakeup_tx(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, int frame_tx, int subframe_tx, uint64_t timestamp_tx);
|
||||
int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int frame_tx, int subframe_tx, uint64_t timestamp_tx);
|
||||
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru, int frame, int subframe);
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru, int frame, int subframe);
|
||||
|
||||
|
||||
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||
@@ -159,10 +158,11 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
|
||||
#define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
|
||||
|
||||
|
||||
static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name) {
|
||||
static inline int rxtx(PHY_VARS_eNB *eNB,
|
||||
L1_rxtx_proc_t *proc,
|
||||
char *thread_name) {
|
||||
int ret;
|
||||
start_meas(&softmodem_stats_rxtx_sf);
|
||||
|
||||
//L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx;
|
||||
// *******************************************************************
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
@@ -196,7 +196,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
NFAPI_SFNSF2DEC(eNB->UL_INFO.harq_ind.sfn_sf), eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs,
|
||||
NFAPI_SFNSF2DEC(eNB->UL_INFO.crc_ind.sfn_sf), eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
|
||||
NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf), eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles,
|
||||
eNB->UL_INFO.cqi_ind.cqi_indication_body.number_of_cqis,
|
||||
eNB->UL_INFO.cqi_ind.cqi_indication_body.number_of_cqis,
|
||||
proc->frame_rx, proc->subframe_rx,
|
||||
proc->frame_tx, proc->subframe_tx, eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols);
|
||||
}
|
||||
@@ -214,15 +214,15 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
// if this is IF5 or 3GPP_eNB
|
||||
if (eNB->RU_list && eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) {
|
||||
wakeup_prach_eNB(eNB,NULL,proc->frame_rx,proc->subframe_rx);
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MODE_PNF) {
|
||||
release_UE_in_freeList(eNB->Mod_id);
|
||||
} else {
|
||||
release_rnti_of_phy(eNB->Mod_id);
|
||||
}
|
||||
|
||||
// UE-specific RX processing for subframe n
|
||||
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||
phy_procedures_eNB_uespec_RX(eNB, proc);
|
||||
@@ -239,9 +239,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
|
||||
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
|
||||
|
||||
AssertFatal((ret= pthread_mutex_lock(&ru->proc.mutex_pre_scd))==0,"[eNB] error locking proc mutex for eNB pre scd, return %d\n",ret);
|
||||
|
||||
ru->proc.instance_pre_scd++;
|
||||
|
||||
if (ru->proc.instance_pre_scd == 0) {
|
||||
@@ -255,7 +253,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
}
|
||||
|
||||
AssertFatal((ret= pthread_mutex_unlock(&ru->proc.mutex_pre_scd))==0,"[eNB] error unlocking proc mutex for eNB pre scd, return %d\n",ret);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -266,10 +263,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
eNB->UL_INFO.CC_id = eNB->CC_id;
|
||||
eNB->if_inst->UL_indication(&eNB->UL_INFO, proc);
|
||||
AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret);
|
||||
|
||||
/* this conflict resolution may be totally wrong, to be tested */
|
||||
/* CONFLICT RESOLUTION: BEGIN */
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 0 );
|
||||
|
||||
if(oai_exit) return(-1);
|
||||
@@ -284,7 +279,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
//if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
|
||||
/* CONFLICT RESOLUTION: END */
|
||||
stop_meas( &softmodem_stats_rxtx_sf );
|
||||
|
||||
LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->subframe_rx, proc->frame_tx, proc->subframe_tx);
|
||||
LOG_D(PHY, "rxtx:%lld nfapi:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ",
|
||||
softmodem_stats_rxtx_sf.p_time, nfapi_meas.p_time,
|
||||
@@ -293,7 +287,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
TICK_TO_US(eNB->rx_prach),
|
||||
TICK_TO_US(eNB->ofdm_mod_stats)
|
||||
);
|
||||
|
||||
LOG_D(PHY,
|
||||
"dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ",
|
||||
TICK_TO_US(eNB->dlsch_encoding_stats),
|
||||
@@ -340,6 +333,7 @@ static void *L1_thread_tx(void *param) {
|
||||
|
||||
while (!oai_exit) {
|
||||
LOG_D(PHY,"Waiting for TX (IC %d)\n",proc->instance_cnt);
|
||||
|
||||
if (wait_on_condition(&proc->mutex,&proc->cond,&proc->instance_cnt,thread_name)<0) break;
|
||||
|
||||
if (oai_exit) break;
|
||||
@@ -358,16 +352,14 @@ static void *L1_thread_tx(void *param) {
|
||||
phy_procedures_eNB_TX(eNB, proc, 1);
|
||||
AssertFatal((ret= pthread_mutex_lock( &proc->mutex ))==0,"error locking L1_proc_tx mutex, return %d\n",ret);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,proc->instance_cnt);
|
||||
|
||||
int subframe_tx = proc->subframe_tx;
|
||||
int frame_tx = proc->frame_tx;
|
||||
uint64_t timestamp_tx = proc->timestamp_tx;
|
||||
|
||||
proc->instance_cnt = -1;
|
||||
|
||||
LOG_D(PHY,"L1 TX signaling done for %d.%d\n",proc->frame_tx,proc->subframe_tx);
|
||||
// the thread can now be woken up
|
||||
LOG_D(PHY,"L1_thread_tx: signaling completion in %d.%d\n",proc->frame_tx,proc->subframe_tx);
|
||||
|
||||
if (pthread_cond_signal(&proc->cond) != 0) {
|
||||
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
@@ -380,15 +372,16 @@ static void *L1_thread_tx(void *param) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief The RX UE-specific and TX thread of eNB.
|
||||
* \param param is a \ref L1_proc_t structure which contains the info what to process.
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
|
||||
static void *L1_thread( void *param ) {
|
||||
static int eNB_thread_rxtx_status;
|
||||
L1_rxtx_proc_t *proc;
|
||||
|
||||
// Working
|
||||
if(NFAPI_MODE==NFAPI_MODE_VNF) {
|
||||
proc = (L1_rxtx_proc_t *)param;
|
||||
@@ -411,8 +404,8 @@ static void *L1_thread( void *param ) {
|
||||
while (!oai_exit) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
|
||||
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
|
||||
|
||||
LOG_D(PHY,"L1RX waiting for RU RX\n");
|
||||
|
||||
if (wait_on_condition(&proc->mutex,&proc->cond,&proc->instance_cnt,thread_name)<0) break;
|
||||
|
||||
LOG_D(PHY,"L1RX starting in %d.%d\n",proc->frame_rx,proc->subframe_rx);
|
||||
@@ -423,7 +416,6 @@ static void *L1_thread( void *param ) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx);
|
||||
|
||||
|
||||
if (oai_exit) break;
|
||||
|
||||
if (eNB->CC_id==0) {
|
||||
@@ -431,8 +423,9 @@ static void *L1_thread( void *param ) {
|
||||
}
|
||||
|
||||
LOG_D(PHY,"L1 RX %d.%d done\n",proc->frame_rx,proc->subframe_rx);
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB,proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx,proc->timestamp_tx);
|
||||
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB,proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx,proc->timestamp_tx);
|
||||
else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) {
|
||||
phy_procedures_eNB_TX(eNB, proc, 1);
|
||||
wakeup_txfh(eNB,proc,proc->frame_tx,proc->subframe_tx,proc->timestamp_tx);
|
||||
@@ -440,8 +433,6 @@ static void *L1_thread( void *param ) {
|
||||
}
|
||||
|
||||
if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break;
|
||||
|
||||
|
||||
} // while !oai_exit
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
|
||||
@@ -450,107 +441,113 @@ static void *L1_thread( void *param ) {
|
||||
return &eNB_thread_rxtx_status;
|
||||
}
|
||||
|
||||
void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t *ru) {
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
|
||||
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
|
||||
RU_proc_t *ru_proc=&ru->proc;
|
||||
proc->frame_rx = frame_rx;
|
||||
proc->subframe_rx = subframe_rx;
|
||||
|
||||
void eNB_top(PHY_VARS_eNB *eNB,
|
||||
int frame_rx,
|
||||
int subframe_rx,
|
||||
char *string,
|
||||
RU_t *ru) {
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
L1_rxtx_proc_t *L1_proc= &proc->L1_proc;
|
||||
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
|
||||
RU_proc_t *ru_proc = &ru->proc;
|
||||
proc->frame_rx = frame_rx;
|
||||
proc->subframe_rx = subframe_rx;
|
||||
|
||||
if (!oai_exit) {
|
||||
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(ru_proc->frame_rx), T_INT(ru_proc->subframe_rx));
|
||||
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(ru_proc->frame_rx), T_INT(ru_proc->tti_rx));
|
||||
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
|
||||
L1_proc->frame_rx = ru_proc->frame_rx;
|
||||
L1_proc->subframe_rx = ru_proc->subframe_rx;
|
||||
L1_proc->subframe_rx = ru_proc->tti_rx;
|
||||
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
|
||||
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
|
||||
|
||||
if (rxtx(eNB,L1_proc,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
|
||||
if (rxtx(eNB,L1_proc,string) < 0)
|
||||
LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
|
||||
|
||||
ru_proc->timestamp_tx = L1_proc->timestamp_tx;
|
||||
ru_proc->subframe_tx = L1_proc->subframe_tx;
|
||||
ru_proc->tti_tx = L1_proc->subframe_tx;
|
||||
ru_proc->frame_tx = L1_proc->frame_tx;
|
||||
}
|
||||
}
|
||||
|
||||
int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,int frame_tx,int subframe_tx,uint64_t timestamp_tx) {
|
||||
|
||||
int wakeup_txfh(PHY_VARS_eNB *eNB,
|
||||
L1_rxtx_proc_t *proc,
|
||||
int frame_tx,
|
||||
int subframe_tx,
|
||||
uint64_t timestamp_tx) {
|
||||
RU_t *ru;
|
||||
RU_proc_t *ru_proc;
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
int waitret,ret;
|
||||
|
||||
LOG_D(PHY,"L1 TX Waking up TX FH %d.%d (IC RU TX %d)\n",frame_tx,subframe_tx,proc->instance_cnt_RUs);
|
||||
|
||||
// grab the information for the RU due to the following wait
|
||||
|
||||
// grab the information for the RU due to the following wait
|
||||
waitret=timedwait_on_condition(&proc->mutex_RUs,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh",1000000);
|
||||
|
||||
AssertFatal(release_thread(&proc->mutex_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing eNB lock on RUs\n");
|
||||
AssertFatal(release_thread(&proc->mutex_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing eNB lock on RUs\n");
|
||||
|
||||
if (waitret == ETIMEDOUT) {
|
||||
LOG_W(PHY,"Dropping TX slot (%d.%d) because FH is blocked more than 1 subframe times (1ms)\n",frame_tx,subframe_tx);
|
||||
LOG_W(PHY,"Dropping TX slot (%d.%d) because FH is blocked more than 1 subframe times (1ms)\n",frame_tx,subframe_tx);
|
||||
AssertFatal((ret=pthread_mutex_lock(&eNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
|
||||
eNB->proc.RU_mask_tx = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&eNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret);
|
||||
proc->instance_cnt_RUs = 0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs);
|
||||
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
AssertFatal((ret=pthread_mutex_lock(&eNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
|
||||
eNB->proc.RU_mask_tx = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&eNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret);
|
||||
proc->instance_cnt_RUs = 0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs);
|
||||
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){
|
||||
for(int ru_id=0; ru_id<eNB->num_RU; ru_id++) {
|
||||
ru = eNB->RU_list[ru_id];
|
||||
ru_proc = &ru->proc;
|
||||
fp = &ru->frame_parms;
|
||||
fp = ru->frame_parms;
|
||||
|
||||
if (((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL))||
|
||||
(eNB->RU_list[ru_id]->state == RU_SYNC)||
|
||||
(eNB->RU_list[ru_id]->wait_cnt>0)){
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret);
|
||||
proc->instance_cnt_RUs = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret);
|
||||
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
|
||||
(eNB->RU_list[ru_id]->wait_cnt>0)) {
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret);
|
||||
proc->instance_cnt_RUs = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret);
|
||||
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
|
||||
}
|
||||
|
||||
if (ru_proc->instance_cnt_eNBs == 0) {
|
||||
LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->tti_tx, proc->frame_rx, proc->subframe_rx);
|
||||
AssertFatal((ret=pthread_mutex_lock(&eNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
|
||||
eNB->proc.RU_mask_tx = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&eNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_eNBs))==0,"ERROR pthread_mutex_lock failed on mutex_eNBs L1_thread_tx with ret=%d\n",ret);
|
||||
|
||||
if (ru_proc->instance_cnt_eNBs == 0) {
|
||||
LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx);
|
||||
AssertFatal((ret=pthread_mutex_lock(&eNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
|
||||
eNB->proc.RU_mask_tx = 0;
|
||||
AssertFatal((ret=pthread_mutex_unlock(&eNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
|
||||
AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_eNBs ))==0,"mutex_unlock return %d\n",ret);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ru_proc->instance_cnt_eNBs = 0;
|
||||
ru_proc->timestamp_tx = timestamp_tx;
|
||||
ru_proc->subframe_tx = subframe_tx;
|
||||
ru_proc->tti_tx = subframe_tx;
|
||||
ru_proc->frame_tx = frame_tx;
|
||||
|
||||
LOG_D(PHY,"L1 TX Waking up TX FH (2) %d.%d\n",frame_tx,subframe_tx);
|
||||
// the thread can now be woken up
|
||||
AssertFatal(pthread_cond_signal(&ru_proc->cond_eNBs) == 0,
|
||||
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
|
||||
"[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
|
||||
AssertFatal((ret=pthread_mutex_unlock(&ru_proc->mutex_eNBs))==0,"mutex_unlock returned %d\n",ret);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int wakeup_tx(PHY_VARS_eNB *eNB, int frame_rx,int subframe_rx,int frame_tx,int subframe_tx,uint64_t timestamp_tx) {
|
||||
|
||||
int wakeup_tx(PHY_VARS_eNB *eNB,
|
||||
int frame_rx,
|
||||
int subframe_rx,
|
||||
int frame_tx,
|
||||
int subframe_tx,
|
||||
uint64_t timestamp_tx) {
|
||||
L1_rxtx_proc_t *L1_proc = &eNB->proc.L1_proc;
|
||||
L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx;
|
||||
|
||||
int ret;
|
||||
|
||||
LOG_D(PHY,"ENTERED wakeup_tx (IC %d)\n",L1_proc_tx->instance_cnt);
|
||||
|
||||
AssertFatal((ret = pthread_mutex_lock(&L1_proc_tx->mutex))==0,"mutex_lock returns %d\n",ret);
|
||||
|
||||
LOG_D(PHY,"L1 RX %d.%d Waiting to wake up L1 TX %d.%d (IC L1TX %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->frame_tx,L1_proc->subframe_tx,L1_proc_tx->instance_cnt);
|
||||
|
||||
while(L1_proc_tx->instance_cnt == 0) {
|
||||
@@ -566,34 +563,31 @@ int wakeup_tx(PHY_VARS_eNB *eNB, int frame_rx,int subframe_rx,int frame_tx,int s
|
||||
L1_proc_tx->subframe_tx = subframe_tx;
|
||||
L1_proc_tx->frame_tx = frame_tx;
|
||||
L1_proc_tx->timestamp_tx = timestamp_tx;
|
||||
|
||||
// the thread can now be woken up
|
||||
LOG_D(PHY,"L1 RX Waking up L1 TX %d.%d\n",L1_proc->frame_tx,L1_proc->subframe_tx);
|
||||
AssertFatal(pthread_cond_signal(&L1_proc_tx->cond) == 0, "ERROR pthread_cond_signal for eNB L1 thread tx\n");
|
||||
|
||||
AssertFatal((ret=pthread_mutex_unlock(&L1_proc_tx->mutex))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
|
||||
L1_proc_t *proc=&eNB->proc;
|
||||
|
||||
int wakeup_rxtx(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru) {
|
||||
L1_proc_t *proc =&eNB->proc;
|
||||
RU_proc_t *ru_proc=&ru->proc;
|
||||
L1_rxtx_proc_t *L1_proc=&proc->L1_proc;
|
||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
||||
int ret;
|
||||
|
||||
LOG_D(PHY,"ENTERED wakeup_rxtx, %d.%d\n",ru_proc->frame_rx,ru_proc->subframe_rx);
|
||||
|
||||
LOG_D(PHY,"ENTERED wakeup_rxtx, %d.%d\n",ru_proc->frame_rx,ru_proc->tti_rx);
|
||||
// wake up TX for subframe n+sl_ahead
|
||||
// lock the TX mutex and make sure the thread is ready
|
||||
AssertFatal((ret=pthread_mutex_lock(&L1_proc->mutex)) == 0,"mutex_lock returns %d\n", ret);
|
||||
|
||||
if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe
|
||||
AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret);
|
||||
LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->subframe_rx);
|
||||
return(0);
|
||||
AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret);
|
||||
LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
++L1_proc->instance_cnt;
|
||||
// We have just received and processed the common part of a subframe, say n.
|
||||
@@ -604,12 +598,10 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
|
||||
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
|
||||
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
|
||||
L1_proc->frame_rx = ru_proc->frame_rx;
|
||||
L1_proc->subframe_rx = ru_proc->subframe_rx;
|
||||
L1_proc->subframe_rx = ru_proc->tti_rx;
|
||||
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
|
||||
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
|
||||
|
||||
LOG_D(PHY,"wakeup_rxtx: L1_proc->subframe_rx %d, L1_proc->subframe_tx %d, RU %d\n",L1_proc->subframe_rx,L1_proc->subframe_tx,ru->idx);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->frame_rx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->subframe_rx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->frame_tx);
|
||||
@@ -623,25 +615,28 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
|
||||
}
|
||||
|
||||
AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
|
||||
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru,
|
||||
int frame,
|
||||
int subframe) {
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
int i,ret;
|
||||
|
||||
if (ru!=NULL) {
|
||||
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RU_PRACH))==0,"mutex_lock return %d\n",ret);
|
||||
|
||||
for (i=0; i<eNB->num_RU; i++) {
|
||||
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) {
|
||||
LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach,eNB->num_RU);
|
||||
proc->RU_mask_prach |= (1<<i);
|
||||
} else if (eNB->RU_list[i]->state == RU_SYNC || eNB->RU_list[i]->wait_cnt > 0) {
|
||||
proc->RU_mask_prach |= (1<<i);
|
||||
}
|
||||
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) {
|
||||
LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach,eNB->num_RU);
|
||||
proc->RU_mask_prach |= (1<<i);
|
||||
} else if (eNB->RU_list[i]->state == RU_SYNC || eNB->RU_list[i]->wait_cnt > 0) {
|
||||
proc->RU_mask_prach |= (1<<i);
|
||||
}
|
||||
}
|
||||
|
||||
if (proc->RU_mask_prach != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return
|
||||
@@ -664,7 +659,6 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
|
||||
// wake up thread for PRACH RX
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_prach))==0,"[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach);
|
||||
|
||||
++proc->instance_cnt_prach;
|
||||
// set timing for prach thread
|
||||
proc->frame_prach = frame;
|
||||
@@ -681,8 +675,12 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
}
|
||||
}
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
|
||||
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru,
|
||||
int frame,
|
||||
int subframe) {
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
int i,ret;
|
||||
@@ -722,7 +720,6 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
|
||||
// wake up thread for PRACH RX
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_prach_br))==0,"[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach_br);
|
||||
|
||||
++proc->instance_cnt_prach_br;
|
||||
// set timing for prach thread
|
||||
proc->frame_prach_br = frame;
|
||||
@@ -738,7 +735,6 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
|
||||
AssertFatal((ret=pthread_mutex_unlock( &proc->mutex_prach_br))==0,"mutex_unlock return %d\n",ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
@@ -762,11 +758,7 @@ static void *eNB_thread_prach( void *param ) {
|
||||
if (oai_exit) break;
|
||||
|
||||
LOG_D(PHY,"Running eNB prach procedures\n");
|
||||
prach_procedures(eNB, &eNB->proc.L1_proc
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,0
|
||||
#endif
|
||||
);
|
||||
prach_procedures(eNB,0 );
|
||||
|
||||
if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
|
||||
}
|
||||
@@ -776,7 +768,8 @@ static void *eNB_thread_prach( void *param ) {
|
||||
return &eNB_thread_prach_status;
|
||||
}
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
|
||||
/*!
|
||||
* \brief The prach receive thread of eNB for BL/CE UEs.
|
||||
* \param param is a \ref L1_proc_t structure which contains the info what to process.
|
||||
@@ -796,7 +789,7 @@ static void *eNB_thread_prach_br( void *param ) {
|
||||
if (oai_exit) break;
|
||||
|
||||
LOG_D(PHY,"Running eNB prach procedures for BL/CE UEs\n");
|
||||
prach_procedures(eNB, &eNB->proc.L1_proc,1);
|
||||
prach_procedures(eNB,1);
|
||||
|
||||
if (release_thread(&proc->mutex_prach_br,&proc->instance_cnt_prach_br,"eNB_prach_thread_br") < 0) break;
|
||||
}
|
||||
@@ -806,8 +799,11 @@ static void *eNB_thread_prach_br( void *param ) {
|
||||
return &eNB_thread_prach_status;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern void init_td_thread(PHY_VARS_eNB *);
|
||||
extern void init_te_thread(PHY_VARS_eNB *);
|
||||
extern void kill_td_thread(PHY_VARS_eNB *);
|
||||
extern void kill_te_thread(PHY_VARS_eNB *);
|
||||
|
||||
|
||||
static void *process_stats_thread(void *param) {
|
||||
@@ -850,9 +846,7 @@ void init_eNB_proc(int inst) {
|
||||
L1_proc_t *proc;
|
||||
L1_rxtx_proc_t *L1_proc, *L1_proc_tx;
|
||||
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL;
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
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]);
|
||||
|
||||
for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
|
||||
@@ -874,7 +868,7 @@ void init_eNB_proc(int inst) {
|
||||
proc->first_rx =1;
|
||||
proc->first_tx =1;
|
||||
proc->RU_mask_tx = (1<<eNB->num_RU)-1;
|
||||
memset((void*)proc->RU_mask,0,10*sizeof(proc->RU_mask[0]));
|
||||
memset((void *)proc->RU_mask,0,10*sizeof(proc->RU_mask[0]));
|
||||
proc->RU_mask_prach =0;
|
||||
pthread_mutex_init( &eNB->UL_INFO_mutex, NULL);
|
||||
pthread_mutex_init( &L1_proc->mutex, NULL);
|
||||
@@ -896,30 +890,26 @@ void init_eNB_proc(int inst) {
|
||||
pthread_attr_init( &proc->attr_asynch_rxtx);
|
||||
pthread_attr_init( &L1_proc->attr);
|
||||
pthread_attr_init( &L1_proc_tx->attr);
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
proc->instance_cnt_prach_br = -1;
|
||||
proc->RU_mask_prach_br=0;
|
||||
pthread_mutex_init( &proc->mutex_prach_br, NULL);
|
||||
pthread_mutex_init( &proc->mutex_RU_PRACH_br,NULL);
|
||||
pthread_cond_init( &proc->cond_prach_br, NULL);
|
||||
pthread_attr_init( &proc->attr_prach_br);
|
||||
#endif
|
||||
#ifndef DEADLINE_SCHEDULER
|
||||
attr0 = &L1_proc->attr;
|
||||
attr1 = &L1_proc_tx->attr;
|
||||
attr_prach = &proc->attr_prach;
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
attr_prach_br = &proc->attr_prach_br;
|
||||
#endif
|
||||
// attr_td = &proc->attr_td;
|
||||
// attr_te = &proc->attr_te;
|
||||
#endif
|
||||
/*
|
||||
|
||||
if(get_thread_worker_conf() == WORKER_ENABLE) {
|
||||
init_te_thread(eNB);
|
||||
init_td_thread(eNB);
|
||||
}
|
||||
*/
|
||||
|
||||
LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag);
|
||||
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
@@ -937,10 +927,9 @@ void init_eNB_proc(int inst) {
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB );
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNB );
|
||||
#endif
|
||||
}
|
||||
|
||||
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
|
||||
|
||||
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
|
||||
@@ -969,7 +958,6 @@ void init_eNB_proc(int inst) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Terminate eNB TX and RX threads.
|
||||
*/
|
||||
@@ -985,12 +973,12 @@ void kill_eNB_proc(int inst) {
|
||||
proc = &eNB->proc;
|
||||
L1_proc = &proc->L1_proc;
|
||||
L1_proc_tx = &proc->L1_proc_tx;
|
||||
/*
|
||||
|
||||
if(get_thread_worker_conf() == WORKER_ENABLE) {
|
||||
kill_td_thread(eNB);
|
||||
kill_te_thread(eNB);
|
||||
}
|
||||
*/
|
||||
|
||||
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
|
||||
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
@@ -1015,13 +1003,11 @@ void kill_eNB_proc(int inst) {
|
||||
LOG_I(PHY, "Destroying prach mutex/cond\n");
|
||||
pthread_mutex_destroy( &proc->mutex_prach);
|
||||
pthread_cond_destroy( &proc->cond_prach );
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
proc->instance_cnt_prach_br = 0;
|
||||
pthread_cond_signal( &proc->cond_prach_br );
|
||||
pthread_join( proc->pthread_prach_br, (void **)&status );
|
||||
pthread_mutex_destroy( &proc->mutex_prach_br);
|
||||
pthread_cond_destroy( &proc->cond_prach_br );
|
||||
#endif
|
||||
LOG_I(PHY, "Destroying UL_INFO mutex\n");
|
||||
pthread_mutex_destroy(&eNB->UL_INFO_mutex);
|
||||
|
||||
@@ -1046,16 +1032,12 @@ void kill_eNB_proc(int inst) {
|
||||
pthread_attr_destroy(&proc->attr_asynch_rxtx);
|
||||
pthread_attr_destroy(&L1_proc->attr);
|
||||
pthread_attr_destroy(&L1_proc_tx->attr);
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
pthread_mutex_destroy(&proc->mutex_RU_PRACH_br);
|
||||
pthread_attr_destroy(&proc->attr_prach_br);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void reset_opp_meas(void) {
|
||||
int sfn;
|
||||
reset_meas(&softmodem_stats_mt);
|
||||
@@ -1079,14 +1061,12 @@ void print_opp_meas(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void free_transport(PHY_VARS_eNB *eNB) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
void free_transport(PHY_VARS_eNB *eNB) {
|
||||
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
LOG_D(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
|
||||
|
||||
for (j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
|
||||
for (int j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
|
||||
|
||||
LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
free_eNB_ulsch(eNB->ulsch[1+i]);
|
||||
@@ -1095,56 +1075,58 @@ void free_transport(PHY_VARS_eNB *eNB) {
|
||||
free_eNB_ulsch(eNB->ulsch[0]);
|
||||
}
|
||||
|
||||
|
||||
void init_transport(PHY_VARS_eNB *eNB) {
|
||||
int i;
|
||||
int j;
|
||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
||||
LOG_I(PHY, "Initialise transport\n");
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
LOG_D(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
|
||||
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
LOG_D(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp);
|
||||
for (j=0; j<2; j++) {
|
||||
eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp);
|
||||
|
||||
if (!eNB->dlsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
|
||||
exit(-1);
|
||||
} else {
|
||||
eNB->dlsch[i][j]->rnti=0;
|
||||
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
|
||||
if (!eNB->dlsch[i][j]) {
|
||||
LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
|
||||
exit(-1);
|
||||
} else {
|
||||
eNB->dlsch[i][j]->rnti=0;
|
||||
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
|
||||
|
||||
if (!eNB->ulsch[1+i]) {
|
||||
LOG_E(PHY,"Can't get eNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// this is the transmission mode for the signalling channels
|
||||
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
|
||||
eNB->transmission_mode[i] = fp->nb_antenna_ports_eNB==1 ? 1 : 2;
|
||||
}
|
||||
|
||||
LOG_D(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
|
||||
// ULSCH for RA
|
||||
eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
if (!eNB->ulsch[1+i]) {
|
||||
if (!eNB->ulsch[0]) {
|
||||
LOG_E(PHY,"Can't get eNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// this is the transmission mode for the signalling channels
|
||||
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
|
||||
eNB->transmission_mode[i] = fp->nb_antenna_ports_eNB==1 ? 1 : 2;
|
||||
eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : SI %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_SI);
|
||||
eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : RA %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_ra);
|
||||
eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : MCH %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_MCH);
|
||||
}
|
||||
|
||||
// ULSCH for RA
|
||||
eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
if (!eNB->ulsch[0]) {
|
||||
LOG_E(PHY,"Can't get eNB ulsch structures\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : SI %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_SI);
|
||||
eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : RA %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_ra);
|
||||
eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
|
||||
LOG_D(PHY,"eNB %d.%d : MCH %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_MCH);
|
||||
}
|
||||
eNB->rx_total_gain_dB=130;
|
||||
|
||||
for(i=0; i<NUMBER_OF_UE_MAX; i++)
|
||||
@@ -1157,6 +1139,7 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
fp->pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
}
|
||||
|
||||
|
||||
void init_eNB_afterRU(void) {
|
||||
int inst,CC_id,ru_id,i,aa;
|
||||
PHY_VARS_eNB *eNB;
|
||||
@@ -1167,7 +1150,7 @@ void init_eNB_afterRU(void) {
|
||||
|
||||
for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
|
||||
LOG_I(PHY,"RC.nb_CC[inst:%d][CC_id:%d]:%p\n", inst, CC_id, RC.eNB[inst][CC_id]);
|
||||
eNB = RC.eNB[inst][CC_id];
|
||||
eNB = RC.eNB[inst][CC_id];
|
||||
phy_init_lte_eNB(eNB,0,0);
|
||||
|
||||
// map antennas and PRACH signals to eNB RX
|
||||
@@ -1177,14 +1160,12 @@ void init_eNB_afterRU(void) {
|
||||
eNB->frame_parms.nb_antennas_rx = 0;
|
||||
LOG_I(PHY,"Overwriting eNB->prach_vars.rxsigF[0]:%p\n", eNB->prach_vars.rxsigF[0]);
|
||||
eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *));
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
for (int ce_level=0; ce_level<4; ce_level++) {
|
||||
LOG_I(PHY,"Overwriting eNB->prach_vars_br.rxsigF.rxsigF[0]:%p\n", eNB->prach_vars_br.rxsigF[ce_level]);
|
||||
eNB->prach_vars_br.rxsigF[ce_level] = (int16_t **)malloc16(64*sizeof(int16_t *));
|
||||
}
|
||||
|
||||
#endif
|
||||
LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU);
|
||||
|
||||
for (ru_id=0,aa=0; ru_id<eNB->num_RU; ru_id++) {
|
||||
@@ -1199,12 +1180,10 @@ void init_eNB_afterRU(void) {
|
||||
for (i=0; i<eNB->RU_list[ru_id]->nb_rx; aa++,i++) {
|
||||
LOG_I(PHY,"Attaching RU %d antenna %d to eNB antenna %d\n",eNB->RU_list[ru_id]->idx,i,aa);
|
||||
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[ru_id]->prach_rxsigF[i];
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
for (int ce_level=0; ce_level<4; ce_level++)
|
||||
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
|
||||
|
||||
#endif
|
||||
eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
|
||||
}
|
||||
}
|
||||
@@ -1241,14 +1220,14 @@ void init_eNB_afterRU(void) {
|
||||
AssertFatal(RC.ru[ru_id]!=NULL,"ru_id %d is null\n",ru_id);
|
||||
RC.ru[ru_id]->wakeup_rxtx = wakeup_rxtx;
|
||||
RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB;
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
RC.ru[ru_id]->wakeup_prach_eNB_br = wakeup_prach_eNB_br;
|
||||
#endif
|
||||
RC.ru[ru_id]->eNB_top = eNB_top;
|
||||
}
|
||||
}
|
||||
|
||||
void init_eNB(int single_thread_flag,int wait_for_sync) {
|
||||
|
||||
void init_eNB(int single_thread_flag,
|
||||
int wait_for_sync) {
|
||||
int CC_id;
|
||||
int inst;
|
||||
PHY_VARS_eNB *eNB;
|
||||
@@ -1290,11 +1269,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOG_I(PHY,"[lte-softmodem.c] eNB structure allocated\n");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Executable
+944
@@ -0,0 +1,944 @@
|
||||
/*
|
||||
* 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 _GNU_SOURCE
|
||||
#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 <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <linux/sched.h>
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include <getopt.h>
|
||||
#include <syscall.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include "assertions.h"
|
||||
#include "PHY/types.h"
|
||||
|
||||
#include "PHY/defs.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#define GET_TIME_INIT(num) struct timeval _timers[num]
|
||||
#define GET_TIME_VAL(num) gettimeofday(&_timers[num], NULL)
|
||||
#define TIME_VAL_TO_MS(num) (((double)_timers[num].tv_sec*1000.0) + ((double)_timers[num].tv_usec/1000.0))
|
||||
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/extern.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "LAYER2/MAC/proto.h"
|
||||
|
||||
#define SYRIQ_CHANNEL_TESTER 0
|
||||
#define SYRIQ_CHANNEL_TESTER2 0
|
||||
#define SYRIQ_CHANNEL_DATA1 1
|
||||
|
||||
volatile int oai_exit = 0;
|
||||
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
#if 0
|
||||
#define NB_ANTENNAS_RX 4
|
||||
|
||||
#define DevAssert(cOND) _Assert_(cOND, _Assert_Exit_, "")
|
||||
#define malloc16(x) memalign(16,x)
|
||||
|
||||
#ifdef 0
|
||||
static inline void* malloc16_clear( size_t size )
|
||||
{
|
||||
#ifdef __AVX2__
|
||||
void* ptr = memalign(32, size);
|
||||
#else
|
||||
void* ptr = memalign(16, size);
|
||||
#endif
|
||||
if(ptr)
|
||||
memset( ptr, 0, size );
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct latency_stat {
|
||||
uint64_t counter;
|
||||
|
||||
uint64_t stat250;
|
||||
uint64_t stat500;
|
||||
uint64_t stat600;
|
||||
uint64_t stat700;
|
||||
uint64_t stat800;
|
||||
|
||||
uint64_t stat1300;
|
||||
uint64_t stat1500;
|
||||
uint64_t stat2000;
|
||||
uint64_t stat2500;
|
||||
uint64_t stat3000;
|
||||
|
||||
uint64_t stat880;
|
||||
uint64_t stat960;
|
||||
uint64_t stat1040;
|
||||
uint64_t stat1120;
|
||||
uint64_t stat1200;
|
||||
} latency_stat_t;
|
||||
|
||||
|
||||
typedef struct timing_stats {
|
||||
char *name;
|
||||
double min;
|
||||
double max;
|
||||
double total;
|
||||
unsigned int count;
|
||||
} timing_stats_t;
|
||||
|
||||
|
||||
//static struct timespec get_timespec_diff(
|
||||
// struct timespec *start,
|
||||
// struct timespec *stop )
|
||||
//{
|
||||
// struct timespec result;
|
||||
//
|
||||
// if ( ( stop->tv_nsec - start->tv_nsec ) < 0 ) {
|
||||
// result.tv_sec = stop->tv_sec - start->tv_sec - 1;
|
||||
// result.tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
|
||||
// }
|
||||
// else {
|
||||
// result.tv_sec = stop->tv_sec - start->tv_sec;
|
||||
// result.tv_nsec = stop->tv_nsec - start->tv_nsec;
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//}
|
||||
|
||||
|
||||
//static void measure_time (
|
||||
// openair0_device *rf_device,
|
||||
// struct timespec *start,
|
||||
// struct timespec *stop,
|
||||
// timing_stats_t *stats,
|
||||
// boolean_t START,
|
||||
// uint8_t PRINT_INTERVAL )
|
||||
//{
|
||||
// if ( START ) {
|
||||
// clock_gettime( CLOCK_MONOTONIC, start );
|
||||
// }
|
||||
// else {
|
||||
// clock_gettime( CLOCK_MONOTONIC, stop );
|
||||
//
|
||||
// struct timespec diff;
|
||||
// double current = 0;
|
||||
//// boolean_t show_stats = false;
|
||||
//
|
||||
// diff = get_timespec_diff( start, stop );
|
||||
// current = (double)diff.tv_sec * 1000000 + (double)diff.tv_nsec / 1000;
|
||||
//
|
||||
// if ( current > stats->max ) {
|
||||
// stats->max = current;
|
||||
//// show_stats = true;
|
||||
// }
|
||||
// if ( stats->min == 0 || current < stats->min ) {
|
||||
// stats->min = current;
|
||||
//// show_stats = true;
|
||||
// }
|
||||
// stats->total += current;
|
||||
//
|
||||
//// if ( show_stats ) {
|
||||
//// rf_device.trx_get_stats_func( &rf_device );
|
||||
//// }
|
||||
//
|
||||
//// if ( stats->count % PRINT_INTERVAL == 0 ) {
|
||||
//// double avg = stats->total / ( stats->count + 1 );
|
||||
//// printf( "[%s][%d] Current : %.2lf µs, Min : %.2lf µs, Max : %.2lf µs, Avg : %.2lf µs\n",
|
||||
//// stats->count, stats->name, current, stats->min, stats->max, avg );
|
||||
//// }
|
||||
//
|
||||
// stats->count++;
|
||||
// }
|
||||
//}
|
||||
int32_t **rxdata;
|
||||
int32_t **txdata;
|
||||
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
|
||||
static inline void saif_meas(unsigned int frame_rx, unsigned int subframe_rx) {
|
||||
static latency_stat_t __thread latency_stat;
|
||||
static struct timespec __thread last= {0};
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
if ( last.tv_sec ) {
|
||||
uint64_t diffTime = ((uint64_t)now.tv_sec *1000 *1000 *1000 + now.tv_nsec) -
|
||||
((uint64_t)last.tv_sec *1000 *1000 *1000 + last.tv_nsec);
|
||||
diffTime/=1000;
|
||||
latency_stat.counter++;
|
||||
|
||||
if ( diffTime <= 800 ) {
|
||||
if (diffTime < 250 )
|
||||
latency_stat.stat250++;
|
||||
else if (diffTime < 500 )
|
||||
latency_stat.stat500++;
|
||||
else if (diffTime < 600 )
|
||||
latency_stat.stat600++;
|
||||
else if (diffTime < 700 )
|
||||
latency_stat.stat700++;
|
||||
else
|
||||
latency_stat.stat800++;
|
||||
}
|
||||
else if ( diffTime > 1200 ) {
|
||||
if (diffTime < 1500 )
|
||||
latency_stat.stat1300++;
|
||||
else if ( diffTime < 2000 )
|
||||
latency_stat.stat1500++;
|
||||
else if ( diffTime < 2500 )
|
||||
latency_stat.stat2000++;
|
||||
else if ( diffTime < 3000 )
|
||||
latency_stat.stat2500++;
|
||||
else
|
||||
latency_stat.stat3000++;
|
||||
}
|
||||
else
|
||||
if (diffTime <= 880 )
|
||||
latency_stat.stat880++;
|
||||
else if (diffTime <= 960 )
|
||||
latency_stat.stat960++;
|
||||
else if (diffTime <= 1040 )
|
||||
latency_stat.stat1040++;
|
||||
else if (diffTime < 1120 )
|
||||
latency_stat.stat1120++;
|
||||
else
|
||||
latency_stat.stat1200++;
|
||||
|
||||
|
||||
if ( (diffTime>=1500) || ( !(frame_rx%1024) && subframe_rx == 0 ) ) {
|
||||
time_t current=time(NULL);
|
||||
printf("\n");
|
||||
printf("%.2f Period stats cnt=%7.7ld 0.. 250=%7.7ld 250.. 500=%7.7ld 500.. 600=%7.7ld 600.. 700=%7.7ld 700.. 800=%7.7ld - (frame_rx=%u) - %s",
|
||||
now.tv_sec+(double)now.tv_nsec/1e9,
|
||||
latency_stat.counter,
|
||||
latency_stat.stat250, latency_stat.stat500,
|
||||
latency_stat.stat600, latency_stat.stat700,
|
||||
latency_stat.stat800,
|
||||
frame_rx,
|
||||
ctime(¤t));
|
||||
printf("%.2f Period stats cnt=%7.7ld 800.. 880=%7.7ld 880.. 960=%7.7ld 960..1040=%7.7ld 1040..1120=%7.7ld 1120..1200=%7.7ld - (frame_rx=%u) - %s",
|
||||
now.tv_sec+(double)now.tv_nsec/1e9,
|
||||
latency_stat.counter,
|
||||
latency_stat.stat880, latency_stat.stat960,
|
||||
latency_stat.stat1040, latency_stat.stat1120,
|
||||
latency_stat.stat1200,
|
||||
frame_rx,
|
||||
ctime(¤t));
|
||||
printf("%.2f Period stats cnt=%7.7ld 1200..1300=%7.7ld 1300..1500=%7.7ld 1500..2000=%7.7ld 2000..2500=%7.7ld >3000=%7.7ld - (frame_rx=%u) - %s",
|
||||
now.tv_sec+(double)now.tv_nsec/1e9,
|
||||
latency_stat.counter,
|
||||
latency_stat.stat1300, latency_stat.stat1500,
|
||||
latency_stat.stat2000, latency_stat.stat2500,
|
||||
latency_stat.stat3000,
|
||||
frame_rx,
|
||||
ctime(¤t));
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
last=now;
|
||||
}
|
||||
/* End of Changed by SYRTEM */
|
||||
|
||||
void exit_fun(const char* s)
|
||||
{
|
||||
|
||||
if (s != NULL) {
|
||||
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
|
||||
}
|
||||
|
||||
oai_exit = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, char * name) {
|
||||
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
if (sched_runtime!=0) {
|
||||
struct sched_attr attr= {0};
|
||||
attr.size = sizeof(attr);
|
||||
// This creates a .5 ms fpga_recv_cnt reservation
|
||||
attr.sched_policy = SCHED_DEADLINE;
|
||||
attr.sched_runtime = sched_runtime;
|
||||
attr.sched_deadline = sched_deadline;
|
||||
attr.sched_period = 0;
|
||||
AssertFatal(sched_setattr(0, &attr, 0) == 0,
|
||||
"[SCHED] main eNB thread: sched_setattr failed %s \n",perror(errno));
|
||||
LOG_I(HW,"[SCHED][eNB] eNB main deadline thread %lu started on CPU %d\n",
|
||||
(unsigned long)gettid(), sched_getcpu());
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef CPU_AFFINITY
|
||||
if (get_nprocs() >2) {
|
||||
for (j = 1; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
}
|
||||
AssertFatal( 0 == pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset)==0,"");
|
||||
#endif
|
||||
struct sched_param sp;
|
||||
sp.sched_priority = sched_fifo;
|
||||
AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp)==0,
|
||||
"Can't set thread priority, Are you root?\n");
|
||||
#endif
|
||||
|
||||
// Lock memory from swapping. This is a process wide call (not constraint to this thread).
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
pthread_setname_np( pthread_self(), name );
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
uint64_t i;
|
||||
openair0_device rf_device;
|
||||
openair0_timestamp timestamp = 0;
|
||||
|
||||
unsigned int sub_frame = 0;
|
||||
unsigned int frame_rx = 0;
|
||||
|
||||
unsigned int nb_antennas_tx = 1;
|
||||
unsigned int nb_antennas_rx = 1;
|
||||
|
||||
|
||||
openair0_cfg[0].mmapped_dma = 0;
|
||||
openair0_cfg[0].configFilename = NULL;
|
||||
openair0_cfg[0].duplex_mode = duplex_mode_FDD;
|
||||
|
||||
uint32_t **sendbuff = NULL;
|
||||
uint32_t **recvbuff = NULL;
|
||||
uint32_t expected_value = 0;
|
||||
uint32_t received_value = 0;
|
||||
int nsamp = 0; // 1 ms
|
||||
int antenna_id = 1;
|
||||
int c = 0;
|
||||
int numIter = 0;
|
||||
int fpga_loop = 0;
|
||||
#if SYRIQ_CHANNEL_DATA1
|
||||
uint64_t first_ts = 0;
|
||||
uint8_t is_first_ts = 0;
|
||||
uint64_t trx_read_cnt = 0;
|
||||
uint32_t j = 0;
|
||||
uint32_t err_cnt = 0;
|
||||
#else
|
||||
int failure = 0;
|
||||
#endif
|
||||
#if 0 // 5MHz BW
|
||||
unsigned int nb_sample_per_tti = 7680;
|
||||
openair0_cfg[0].sample_rate = 7.68e6;
|
||||
openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10;
|
||||
openair0_cfg[0].rx_bw = 2.5e6;
|
||||
openair0_cfg[0].tx_bw = 2.5e6;
|
||||
openair0_cfg[0].num_rb_dl = 25;
|
||||
#endif
|
||||
|
||||
#if 0 // 10MHz BW
|
||||
unsigned int nb_sample_per_tti = 15360;
|
||||
openair0_cfg[0].sample_rate = 15.36e6;
|
||||
openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10;
|
||||
openair0_cfg[0].rx_bw = 5.0e6;
|
||||
openair0_cfg[0].tx_bw = 5.0e6;
|
||||
openair0_cfg[0].num_rb_dl = 50;
|
||||
#endif
|
||||
|
||||
#if 1 // 20MHz BW
|
||||
unsigned int nb_sample_per_tti = 30720;
|
||||
openair0_cfg[0].sample_rate = 30.72e6;
|
||||
openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10;
|
||||
openair0_cfg[0].rx_bw = 10.0e6;
|
||||
openair0_cfg[0].tx_bw = 10.0e6;
|
||||
openair0_cfg[0].num_rb_dl = 100;
|
||||
#endif
|
||||
|
||||
const char *openair_dir = getenv("OPENAIR_DIR");
|
||||
const char *ini_file = "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR20.dat";
|
||||
|
||||
int readBlockSize;
|
||||
void* rxp[nb_antennas_rx];
|
||||
void* txp[nb_antennas_tx];
|
||||
|
||||
// int32_t rxdata[1][nb_sample_per_tti*10+2048];
|
||||
#if 0
|
||||
int32_t **rxdata;
|
||||
#endif
|
||||
// init_thread(100000, 500000, sched_get_priority_max(SCHED_FIFO),"main UE");
|
||||
|
||||
printf("LTE HARDWARE Latency debug utility \n");
|
||||
printf("INIT data buffers \n");
|
||||
|
||||
#if 0
|
||||
rxdata = (int32_t**)memalign(32, nb_antennas_rx*sizeof(int32_t*) );
|
||||
rxdata[0] = (int32_t*)memalign(32,(nb_sample_per_tti*10+2048)*sizeof(int32_t));
|
||||
#else
|
||||
rxdata = (int32_t**)malloc16( nb_antennas_rx*sizeof(int32_t*) );
|
||||
txdata = (int32_t**)malloc16( nb_antennas_tx*sizeof(int32_t*) );
|
||||
rxdata[0] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
txdata[0] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
#endif
|
||||
|
||||
printf("INIT done\n");
|
||||
|
||||
memset(&rf_device, 0, sizeof(openair0_device));
|
||||
|
||||
rf_device.host_type = BBU_HOST;
|
||||
openair0_cfg[0].duplex_mode = duplex_mode_FDD;
|
||||
openair0_cfg[0].rx_num_channels = 1;
|
||||
openair0_cfg[0].tx_num_channels = 1;
|
||||
|
||||
// configure channel 0
|
||||
for (i=0; i<openair0_cfg[0].rx_num_channels; i++)
|
||||
{
|
||||
printf("configure channel %d \n",i);
|
||||
openair0_cfg[0].autocal[i] = 1;
|
||||
openair0_cfg[0].rx_freq[i] = 2680000000;
|
||||
openair0_cfg[0].tx_freq[i] = 2560000000;
|
||||
openair0_cfg[0].rx_gain[i] = 61;
|
||||
openair0_cfg[0].tx_gain[i] = 90;
|
||||
}
|
||||
|
||||
if (openair_dir)
|
||||
{
|
||||
openair0_cfg[0].configFilename = malloc(strlen(openair_dir) + strlen(ini_file) + 2);
|
||||
sprintf(openair0_cfg[0].configFilename, "%s/%s", openair_dir, ini_file);
|
||||
}
|
||||
// printf("openair0_cfg[0].configFilename:%s\n", openair0_cfg[0].configFilename);
|
||||
|
||||
ret = openair0_device_load( &rf_device, &openair0_cfg[0] );
|
||||
if (ret != 0){
|
||||
exit_fun("Error loading device library");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Runtime test
|
||||
* 30 720 000 samples (4 bytes) for 1 sec (30 720 for 1 ms)
|
||||
*/
|
||||
puts( "* Starting the device" );
|
||||
|
||||
// TIMING
|
||||
// struct timespec start, stop; // tx_start, tx_stop;
|
||||
// timing_stats_t rx_stats, tx_stats;
|
||||
|
||||
// rx_stats.name = strdup( "RX" );
|
||||
// tx_stats.name = strdup( "TX" );
|
||||
// TIMING
|
||||
|
||||
nsamp = 307200; // 1 ms
|
||||
sendbuff = memalign( 128, nb_antennas_rx * sizeof( uint32_t * ) );
|
||||
sendbuff[0] = memalign( 128, nsamp * sizeof( uint32_t ) );
|
||||
recvbuff = memalign( 128, nb_antennas_rx * sizeof( uint32_t * ) );
|
||||
recvbuff[0] = memalign( 128, nsamp * sizeof( uint32_t ) );
|
||||
|
||||
// Create dummy buffer
|
||||
for ( c = 0; c < nsamp; c++ ) {
|
||||
// sendbuff[0][c] = (c+1);
|
||||
sendbuff[0][c] = (c+1)*16;
|
||||
// sendbuff[0][c] = (nsamp-c);
|
||||
recvbuff[0][c] = 0;
|
||||
}
|
||||
|
||||
GET_TIME_INIT(3);
|
||||
|
||||
if ( rf_device.trx_start_func( &rf_device ) < 0 ) {
|
||||
printf( " device could not be started !\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// read 30720
|
||||
|
||||
// write 30720 ts+2*30720
|
||||
|
||||
// if tsread >= 2-307200 -> check expected value + status (RxoVer TxUnder)
|
||||
|
||||
rxp[0] = (void*)&rxdata[0][0];
|
||||
txp[0] = (void*)&txdata[0][0];
|
||||
timestamp = 0;
|
||||
nsamp = 30720; // 30720 => 1ms buffer
|
||||
trx_read_cnt = 100000; // 1 loop => 1ms (10sec=10000; 15min = 900000)
|
||||
antenna_id = 1;
|
||||
int diff = 0;
|
||||
int compare_start = 0;
|
||||
|
||||
uint32_t looploop=0;
|
||||
uint64_t error_cnt = 0;
|
||||
uint64_t error_ts_start;
|
||||
|
||||
for (i = 0; i < trx_read_cnt; i++)
|
||||
{
|
||||
|
||||
// printf("\n\n");
|
||||
|
||||
|
||||
// ret = rf_device.trx_read_func( &rf_device, ×tamp, &(rxp[0][(i*30720)%307200]), nsamp, antenna_id );
|
||||
// ret = rf_device.trx_read_func( &rf_device, ×tamp, recvbuff[0][(i*30720)%307200], nsamp, antenna_id );
|
||||
rxp[0] = (void*)&rxdata[0][(i*30720)%307200];
|
||||
GET_TIME_VAL(0);
|
||||
ret = rf_device.trx_read_func( &rf_device, ×tamp, rxp, nsamp, antenna_id );
|
||||
GET_TIME_VAL(1);
|
||||
|
||||
if (ret != nsamp)
|
||||
{
|
||||
printf("Error: nsamp received (%d) != nsamp required (%d)\n", ret, nsamp);
|
||||
fflush(stdout);
|
||||
return (-1);
|
||||
}
|
||||
if (!is_first_ts)
|
||||
{
|
||||
first_ts = timestamp;
|
||||
is_first_ts = 1;
|
||||
}
|
||||
|
||||
// printf("%d - trx_read_func ret=%d - ts = %d - @=0x%08lx\n", i, ret, timestamp, rxp[0] );
|
||||
|
||||
txp[0] = (void*)&(txdata[0][ ((i*30720)%307200+2*30720)%307200 ]);
|
||||
// printf(" i=%d @txp[0][0] = 0x%016lx\n", i, &(((uint32_t *)txp[0])[0]) );
|
||||
// printf(" i=%d @txp[0][1] = 0x%016lx\n", i, &(((uint32_t *)txp[0])[1]) );
|
||||
|
||||
for ( c = 0; c < nsamp; c++ )
|
||||
{
|
||||
(((uint32_t *)txp[0])[c]) = ( (((timestamp+c+2*30720)<<4)&0x0000FFF0) + (((timestamp+c+2*30720)<<8)&0xFFF00000) );
|
||||
}
|
||||
|
||||
// printf(" txp[0][%d] = 0x%x\n",0,((uint32_t *)(txp[0]))[0]);
|
||||
// printf(" txp[0][%d] = 0x%x\n",1,((uint32_t *)(txp[0]))[1]);
|
||||
// printf(" ...\n");
|
||||
// printf(" txp[0][%d] = 0x%x\n",nsamp-2,((uint32_t *)(txp[0]))[nsamp-2]);
|
||||
// printf(" txp[0][%d] = 0x%x\n",nsamp-1,((uint32_t *)(txp[0]))[nsamp-1]);
|
||||
|
||||
|
||||
ret = rf_device.trx_write_func( &rf_device, (timestamp+2*30720), txp, nsamp, antenna_id, false );
|
||||
if (ret != nsamp)
|
||||
{
|
||||
printf("Error: nsamp sent (%d) != nsamp required (%d)\n", ret, nsamp);
|
||||
fflush(stdout);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
// printf("%d - trx_write_func ret=%d - ts = %d - @=0x%08lx\n", i, ret, (timestamp+2*30720), txp[0] );
|
||||
|
||||
|
||||
if (timestamp >= (first_ts + 2 * 307200))
|
||||
{
|
||||
|
||||
// check Rx Overflow
|
||||
|
||||
// check Tx Underflow
|
||||
|
||||
// check Expected Value
|
||||
for ( c = 0; c < nsamp; c++ )
|
||||
{
|
||||
|
||||
// LOOPBACK
|
||||
#if 1
|
||||
expected_value = ((timestamp + c)&0xFFFFFF);
|
||||
received_value = ((uint32_t *)(rxp[0]))[c];
|
||||
received_value = ((received_value)&0xFFF) + ((received_value>>4)&0xFFF000);
|
||||
|
||||
if (compare_start == 0)
|
||||
{
|
||||
compare_start = 1;
|
||||
diff = expected_value - received_value;
|
||||
}
|
||||
received_value = (received_value + diff)&0xFFFFFF;
|
||||
|
||||
#if 1
|
||||
|
||||
if (expected_value != received_value)
|
||||
{
|
||||
if(!error_cnt)
|
||||
error_ts_start = (timestamp + c);
|
||||
else
|
||||
{
|
||||
if (looploop < 32)
|
||||
printf("%d - %d != %d - ts %d - raw 0x%x - diff %d\n",
|
||||
looploop,
|
||||
expected_value, received_value,
|
||||
(timestamp + c), ((uint32_t *)(rxp[0]))[c],
|
||||
diff);
|
||||
looploop++;
|
||||
}
|
||||
|
||||
error_cnt++;
|
||||
|
||||
if(!(error_cnt%102400))
|
||||
printf(" -> error detected : cnt=%d - start=%ld - stop=... diff=%d\n",
|
||||
error_cnt,
|
||||
error_ts_start,
|
||||
diff);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(error_cnt)
|
||||
{
|
||||
printf(" -> error detected : cnt=%d - start=%ld - stop=%ld\n\n",
|
||||
error_cnt,
|
||||
error_ts_start,
|
||||
(timestamp + c) );
|
||||
looploop=0;
|
||||
}
|
||||
error_cnt=0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// DEBUG mode 0
|
||||
#if 0
|
||||
received_value = ((uint32_t *)(rxp[0]))[c];
|
||||
received_value = ((received_value)&0xFFF) + ((received_value>>4)&0xFFF000);
|
||||
received_value = (received_value&0xFFFFFF);
|
||||
if (compare_start == 0)
|
||||
{
|
||||
compare_start = 1;
|
||||
expected_value = received_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
expected_value++;
|
||||
expected_value = (expected_value&0xFFFFFF);
|
||||
}
|
||||
|
||||
if (expected_value != received_value)
|
||||
{
|
||||
if(!error_cnt)
|
||||
error_ts_start = (timestamp + c);
|
||||
error_cnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(error_cnt)
|
||||
{
|
||||
printf(" -> error detected : cnt=%d - start=%ld - stop=%ld\n\n",
|
||||
error_cnt,
|
||||
error_ts_start,
|
||||
(timestamp + c) );
|
||||
}
|
||||
error_cnt=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (expected_value != received_value)
|
||||
// {
|
||||
// printf("%d -> %d != %d (ts+c=%ld)(raw=0x%08x)\n",
|
||||
// looploop,
|
||||
// expected_value, received_value,
|
||||
// (timestamp + c),
|
||||
// ((uint32_t *)(rxp[0]))[c] );
|
||||
//
|
||||
// if (received_value)
|
||||
// expected_value = received_value;
|
||||
// }
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("HwLat Application returns !!!\n");
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
rf_device.trx_end_func( &rf_device );
|
||||
|
||||
sleep(1);
|
||||
free(sendbuff[0]);
|
||||
free(sendbuff);
|
||||
free(recvbuff[0]);
|
||||
free(recvbuff);
|
||||
|
||||
exit(0);
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
|
||||
// puts( "* Frequency modification test" );
|
||||
// rf_device.trx_set_freq_func( &rf_device, &openair0_cfg[0], 0 );
|
||||
|
||||
// puts( "* Gain modification test" );
|
||||
// rf_device.trx_set_gains_func( &rf_device, &openair0_cfg[0] ); // NOT working (cf. initialization)
|
||||
|
||||
//#if LTE_UE
|
||||
// sleep(1);
|
||||
GET_TIME_VAL(0);
|
||||
for (i = 0; i < trx_read_cnt; i++)
|
||||
{
|
||||
printf("\n");
|
||||
ret = rf_device.trx_read_func( &rf_device, ×tamp, rxp, nsamp, antenna_id );
|
||||
printf("* timestamp=%ld\n", timestamp);
|
||||
#if 1
|
||||
for (j = 0; j < nsamp; j++)
|
||||
{
|
||||
if ( ((uint32_t *)rxp[0])[j] != ((expected_value + j + timestamp)%307200) )
|
||||
{
|
||||
err_cnt++;
|
||||
printf("rxp[%06d]=0x%08x (expected 0x%08lx)\n", j, ((uint32_t *)rxp[0])[j], ((expected_value + j + timestamp)%307200) );
|
||||
}
|
||||
if (err_cnt >= 128)
|
||||
{
|
||||
printf("Error: more than 128 expected value failed !\n");
|
||||
i = (trx_read_cnt - 1);
|
||||
j = nsamp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//expected_value = (expected_value + nsamp)%307200;
|
||||
expected_value = (expected_value)%307200;
|
||||
#endif
|
||||
}
|
||||
GET_TIME_VAL(1);
|
||||
//#endif
|
||||
|
||||
/* ********** ********** */
|
||||
/* SYRIQ_CHANNEL_DATA1 */
|
||||
/* ********** ********** */
|
||||
#if SYRIQ_CHANNEL_DATA1
|
||||
|
||||
// rf_device.trx_get_stats_func( &rf_device );
|
||||
|
||||
rf_device.trx_end_func( &rf_device );
|
||||
|
||||
printf("\n* rf_device.trx_read_func(%d) x %d: %.6lf s\n\n", nsamp, i, ((TIME_VAL_TO_MS(1) - TIME_VAL_TO_MS(0)))/1000.0 );
|
||||
|
||||
// rf_device.trx_get_stats_func( &rf_device );
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < nsamp; i++)
|
||||
{
|
||||
// if ( ((uint32_t *)rxp[0])[i] != i)
|
||||
// {
|
||||
err_cnt++;
|
||||
printf("rxp[%06d]=0x%08x (expected 0x%08x)\n", i, ((uint32_t *)rxp[0])[i], i);
|
||||
// }
|
||||
// if (err_cnt > 256)
|
||||
// {
|
||||
// i = 307200;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
// for (i = 1024-32; i < 1024+32; i++)
|
||||
// {
|
||||
//// if ( ((uint32_t *)rxp[0])[i] != i)
|
||||
//// {
|
||||
// err_cnt++;
|
||||
// printf("rxp[%06d]=0x%08x (expected 0x%08x)\n", i, ((uint32_t *)rxp[0])[i], i);
|
||||
//// }
|
||||
// if (err_cnt > 256)
|
||||
// {
|
||||
// i = 307200;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
printf("SYRIQ CHANNEL DATA1 done !!!\n");
|
||||
sleep(1);
|
||||
return(0);
|
||||
#endif
|
||||
/* ********** ********** */
|
||||
/* SYRIQ_CHANNEL_DATA1 */
|
||||
/* ********** ********** */
|
||||
|
||||
|
||||
|
||||
timestamp = 0;
|
||||
ret = rf_device.trx_write_func( &rf_device, timestamp, (void**)sendbuff, nsamp, antenna_id, false );
|
||||
printf("* rf_device.trx_write_func returns %d\n", ret);
|
||||
|
||||
sleep(1);
|
||||
|
||||
nsamp = 30720;
|
||||
numIter = 100000;
|
||||
for ( c = 0; c < numIter; c++ )
|
||||
{
|
||||
fpga_loop ++;
|
||||
if ( !(fpga_loop % 1000) )
|
||||
{
|
||||
printf("\rtest loop %d / %d", fpga_loop, numIter);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// printf("* TEST : %08d\n", (c+1));
|
||||
// measure_time( &rf_device, &start, &stop, &tx_stats, true, 10 );
|
||||
// ret = rf_device.trx_write_func( &rf_device, timestamp, (void**)sendbuff, nsamp, antenna_id, false );
|
||||
// printf("* rf_device.trx_write_func returns %d\n", ret);
|
||||
// measure_time( &rf_device, &start, &stop, &tx_stats, false, 10 );
|
||||
|
||||
// sleep(1);
|
||||
|
||||
// measure_time( &rf_device, &start, &stop, &tx_stats, true, 10 );
|
||||
ret = rf_device.trx_read_func( &rf_device, ×tamp, (void**)recvbuff, nsamp, antenna_id );
|
||||
// measure_time( &rf_device, &start, &stop, &tx_stats, false, 10 );
|
||||
|
||||
// Check the data
|
||||
if (ret > 0)
|
||||
{
|
||||
/* ********** ********** */
|
||||
/* SYRIQ_CHANNEL_TESTER */
|
||||
/* ********** ********** */
|
||||
#if SYRIQ_CHANNEL_TESTER
|
||||
failure = 0;
|
||||
for (i = 0; i < ret; i++)
|
||||
{
|
||||
if ( ((i%1024) == 0) || ((i%1024) == 1) || ((i%1024) == 2) || ((i%1024) == 3) )
|
||||
{
|
||||
if ( (recvbuff[0])[i] != (1020 + ((i%1024)+1)) )
|
||||
{
|
||||
printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) );
|
||||
failure = 1;
|
||||
}
|
||||
}
|
||||
else if ( (recvbuff[0])[i] != ((i%1024)+1) )
|
||||
{
|
||||
printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) );
|
||||
failure = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("* DONE (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) );
|
||||
}
|
||||
if(failure)
|
||||
break;
|
||||
}
|
||||
if (failure)
|
||||
printf("* ERROR recv %08d checked FAILURE ret=%d\n", (c+1), ret);
|
||||
else
|
||||
{
|
||||
// printf("* DONE recv %08d checked SUCCESSFULLY ret=%d\n", (c+1), ret);
|
||||
}
|
||||
#endif
|
||||
/* ********** ********** */
|
||||
/* SYRIQ_CHANNEL_TESTER2*/
|
||||
/* ********** ********** */
|
||||
#if SYRIQ_CHANNEL_TESTER2
|
||||
// printf("* ret=%d timestamp=%ld (%ld)\n", ret, timestamp, (timestamp%307200));
|
||||
failure = 0;
|
||||
for (i = 0; i < ret; i++)
|
||||
{
|
||||
// printf("* (recvbuff[0])[%d]: %d\n", i, (uint32_t)(recvbuff[0])[i]);
|
||||
// printf("* timestamp+(i/1024+1)*1024 - 3 + i%1024: %d\n", (timestamp-nsamp+(i/1024+1)*1024 - 3 + i%1024)%307200 );
|
||||
expected_value = ((((i%1024)+1)/*>>4*/)&0x00000FFF);
|
||||
if ( ((i%1024) == 0) || ((i%1024) == 1) || ((i%1024) == 2) || ((i%1024) == 3) )
|
||||
{
|
||||
expected_value = ((((timestamp-nsamp+(i/1024+1)*1024 - 3 + i%1024))%307200));
|
||||
if ( (recvbuff[0])[i] != expected_value)
|
||||
{
|
||||
if ( (expected_value == 0) && ((recvbuff[0])[i] != 4915200) )
|
||||
{
|
||||
printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], expected_value );
|
||||
failure = 1;
|
||||
}
|
||||
if ( (expected_value == 0) && ((recvbuff[0])[i] == 4915200) )
|
||||
{
|
||||
// printf("* DONE loop in circular buffer\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( (recvbuff[0])[i] != expected_value )
|
||||
{
|
||||
printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) );
|
||||
failure = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("* DONE (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) );
|
||||
}
|
||||
// if(failure)
|
||||
// break;
|
||||
}
|
||||
if (failure)
|
||||
printf("* ERROR recv %08d checked FAILURE ret=%d\n", (c+1), ret);
|
||||
else
|
||||
{
|
||||
// printf("* DONE recv %08d checked SUCCESSFULLY ret=%d\n", (c+1), ret);
|
||||
}
|
||||
#endif
|
||||
#if LOOPBACK
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("* ERROR rf_device.trx_read_func returns %d\n", ret);
|
||||
}
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
rf_device.trx_end_func( &rf_device );
|
||||
|
||||
sleep(1);
|
||||
free(sendbuff[0]);
|
||||
free(sendbuff);
|
||||
free(recvbuff[0]);
|
||||
free(recvbuff);
|
||||
|
||||
exit(0);
|
||||
|
||||
// END IS HERE !
|
||||
|
||||
rf_device.trx_set_freq_func(&rf_device,&openair0_cfg[0],0);
|
||||
|
||||
if (rf_device.trx_start_func(&rf_device) != 0 ) {
|
||||
printf("Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}
|
||||
|
||||
while(!oai_exit){
|
||||
|
||||
rxp[0] = (void*)&rxdata[0][sub_frame*nb_sample_per_tti];
|
||||
|
||||
readBlockSize = rf_device.trx_read_func(&rf_device,
|
||||
×tamp,
|
||||
rxp,
|
||||
nb_sample_per_tti,
|
||||
0);
|
||||
|
||||
if ( readBlockSize != nb_sample_per_tti )
|
||||
oai_exit = 1;
|
||||
|
||||
sub_frame++;
|
||||
sub_frame%=10;
|
||||
|
||||
if( sub_frame == 0)
|
||||
frame_rx++;
|
||||
|
||||
saif_meas(frame_rx, sub_frame);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+504
-417
File diff suppressed because it is too large
Load Diff
@@ -34,12 +34,12 @@
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "executables/thread-common.h"
|
||||
#include <dlfcn.h>
|
||||
static softmodem_params_t softmodem_params;
|
||||
char *parallel_config=NULL;
|
||||
char *worker_config=NULL;
|
||||
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {
|
||||
return softmodem_params.optmask;
|
||||
}
|
||||
@@ -57,13 +57,9 @@ void get_common_options(void) {
|
||||
uint32_t online_log_messages=0;
|
||||
uint32_t glog_level =0;
|
||||
uint32_t start_telnetsrv=0;
|
||||
uint32_t noS1=0;
|
||||
uint32_t nokrnmod=0;
|
||||
uint32_t nonbiot=0;
|
||||
uint32_t rfsim=0;
|
||||
uint32_t basicsim=0;
|
||||
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
|
||||
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
|
||||
char *logmem_filename = NULL;
|
||||
uint32_t do_forms=0;
|
||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||
@@ -96,6 +92,7 @@ void get_common_options(void) {
|
||||
}
|
||||
|
||||
if (nokrnmod) {
|
||||
printf("nokrnmod bit enabled \n");
|
||||
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ FILE *input_fd=NULL;
|
||||
|
||||
|
||||
#if MAX_NUM_CCs == 1
|
||||
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
|
||||
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
|
||||
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
|
||||
double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0}};
|
||||
#else
|
||||
@@ -138,7 +138,6 @@ double rx_gain_off = 0.0;
|
||||
double sample_rate=30.72e6;
|
||||
double bw = 10.0e6;
|
||||
|
||||
|
||||
uint8_t dci_Format = 0;
|
||||
uint8_t agregation_Level =0xFF;
|
||||
|
||||
@@ -149,9 +148,7 @@ char ref[128] = "internal";
|
||||
char channels[128] = "0";
|
||||
|
||||
int rx_input_level_dBm;
|
||||
|
||||
int otg_enabled;
|
||||
|
||||
int otg_enabled;
|
||||
|
||||
uint8_t exit_missed_slots=1;
|
||||
uint64_t num_missed_slots=0; // counter for the number of missed slots
|
||||
@@ -173,7 +170,8 @@ eth_params_t *eth_params;
|
||||
|
||||
double cpuf;
|
||||
|
||||
/* forward declarations */
|
||||
int oaisim_flag=0;
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
@@ -522,7 +520,8 @@ static void wait_nfapi_init(char *thread_name) {
|
||||
printf( "NFAPI: got sync (%s)\n", thread_name);
|
||||
}
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
int i;
|
||||
int CC_id = 0;
|
||||
int ru_id;
|
||||
@@ -586,9 +585,22 @@ int main( int argc, char **argv ) {
|
||||
/* Read configuration */
|
||||
if (RC.nb_inst > 0) {
|
||||
read_config_and_init();
|
||||
} else {
|
||||
printf("RC.nb_inst = 0, Initializing L1\n");
|
||||
RCconfig_L1();
|
||||
}
|
||||
|
||||
/* We need to read RU configuration before FlexRAN starts so it knows what
|
||||
* splits to report. Actual RU start comes later. */
|
||||
if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) {
|
||||
RCconfig_RU();
|
||||
LOG_I(PHY,
|
||||
"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",
|
||||
RC.nb_L1_inst, RC.nb_RU, get_nprocs());
|
||||
}
|
||||
|
||||
if (RC.nb_inst > 0) {
|
||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||
RCconfig_flexran();
|
||||
|
||||
for (i = 0; i < RC.nb_inst; i++) {
|
||||
flexran_agent_start(i);
|
||||
}
|
||||
@@ -608,9 +620,6 @@ int main( int argc, char **argv ) {
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
||||
}
|
||||
node_type = RC.rrc[0]->node_type;
|
||||
} else {
|
||||
printf("RC.nb_inst = 0, Initializing L1\n");
|
||||
RCconfig_L1();
|
||||
}
|
||||
|
||||
if (RC.nb_inst > 0 && NODE_IS_CU(node_type)) {
|
||||
@@ -711,6 +720,8 @@ int main( int argc, char **argv ) {
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
}
|
||||
create_tasks_mbms(1);
|
||||
|
||||
// wait for end of program
|
||||
LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");
|
||||
// CI -- Flushing the std outputs for the previous marker to show on the eNB / DU / CU log file
|
||||
fflush(stdout);
|
||||
|
||||
+111
-114
@@ -20,8 +20,7 @@
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/sysinfo.h>
|
||||
#include "threads_t.h"
|
||||
#include "rt_wrapper.h"
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
//#undef MALLOC
|
||||
@@ -30,12 +29,11 @@
|
||||
#include "PHY/types.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||
|
||||
#include "flexran_agent.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||
#include "proto_agent.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
|
||||
#define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n"
|
||||
@@ -74,7 +72,7 @@
|
||||
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
|
||||
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
|
||||
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
|
||||
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
|
||||
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
|
||||
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
|
||||
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
|
||||
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
|
||||
@@ -93,8 +91,7 @@
|
||||
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
|
||||
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
|
||||
|
||||
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
|
||||
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
|
||||
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
|
||||
|
||||
/***************************************************************************************************************************************/
|
||||
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
||||
@@ -103,17 +100,17 @@
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters defining UE running mode */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define CMDLINE_UEMODEPARAMS_DESC { \
|
||||
{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
|
||||
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
||||
{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
|
||||
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
|
||||
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
|
||||
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
|
||||
}
|
||||
#define CMDLINE_CALIBUERX_IDX 0
|
||||
#define CMDLINE_CALIBUERXMED_IDX 1
|
||||
@@ -125,55 +122,54 @@
|
||||
#define CMDLINE_DUMPMEMORY_IDX 7
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
#define START_MSC softmodem_params.start_msc
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters specific to UE */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
#define CMDLINE_UEPARAMS_DESC { \
|
||||
{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
|
||||
{"U", CONFIG_HLP_NUMUE, 0, u16ptr:&NB_UE_INST, defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
|
||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
|
||||
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
|
||||
{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
|
||||
{"num-ues", NULL, 0, u16ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
|
||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
||||
{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \
|
||||
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
|
||||
{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
|
||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
|
||||
{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
|
||||
{"U", CONFIG_HLP_NUMUE, 0, u16ptr:&NB_UE_INST, defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
|
||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
|
||||
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
|
||||
{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
|
||||
{"num-ues", NULL, 0, u16ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
|
||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
||||
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
|
||||
{"clock-source", CONFIG_HLP_CLK, 0, iptr:&clock_source, defintval:0, TYPE_INT, 0}, \
|
||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters specific to UE threads */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters specific to UE threads */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define CMDLINE_UETHREADSPARAMS_DESC { \
|
||||
{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
|
||||
}
|
||||
// {"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0},
|
||||
|
||||
#define DEFAULT_DLF 2680000000
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters common to eNodeB and UE */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters common to eNodeB and UE */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define RF_CONFIG_FILE softmodem_params.rf_config_file
|
||||
#define TP_CONFIG softmodem_params.threadPoolConfig
|
||||
#define PHY_TEST softmodem_params.phy_test
|
||||
@@ -187,62 +183,62 @@
|
||||
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
|
||||
#define USIM_TEST softmodem_params.usim_test
|
||||
#define CMDLINE_PARAMS_DESC { \
|
||||
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \
|
||||
{"turbo-thread-pool", NULL, 0, strptr:(char **)&TP_CONFIG, defstrval:NULL, TYPE_STRING, sizeof(TP_CONFIG)}, \
|
||||
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
|
||||
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
||||
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
||||
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
|
||||
{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
||||
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
||||
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
||||
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
|
||||
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
|
||||
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
|
||||
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
||||
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
|
||||
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
|
||||
{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
|
||||
{"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \
|
||||
{"basicsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&basicsim, defintval:0, TYPE_INT, 0}, \
|
||||
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
|
||||
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
|
||||
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\
|
||||
{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
|
||||
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
|
||||
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
|
||||
{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
|
||||
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
|
||||
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
|
||||
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
|
||||
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
|
||||
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
|
||||
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
|
||||
{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
|
||||
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
|
||||
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
|
||||
{"parallel-config", CONFIG_HLP_PARALLEL_CMD, 0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
|
||||
{"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \
|
||||
{"basicsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&basicsim, defintval:0, TYPE_INT, 0}, \
|
||||
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
|
||||
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
|
||||
}
|
||||
|
||||
#define CONFIG_HLP_FLOG "Enable online log \n"
|
||||
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
|
||||
#define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
|
||||
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
|
||||
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
|
||||
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for LOG utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define START_MSC softmodem_params.start_msc
|
||||
/*----------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for LOG utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*----------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define START_MSC softmodem_params.start_msc
|
||||
#define CMDLINE_LOGPARAMS_DESC { \
|
||||
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
|
||||
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
|
||||
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
|
||||
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
|
||||
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
|
||||
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
|
||||
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
|
||||
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
|
||||
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
|
||||
}
|
||||
|
||||
#define CMDLINE_ONLINELOG_IDX 0
|
||||
#define CMDLINE_GLOGLEVEL_IDX 1
|
||||
#define CMDLINE_STARTTELN_IDX 2
|
||||
#define CMDLINE_GLOGVERBO_IDX 2
|
||||
#define CMDLINE_STARTTELN_IDX 3
|
||||
|
||||
/* check function for global log level */
|
||||
#define CMDLINE_LOGPARAMS_CHECK_DESC { \
|
||||
{ .s5= {NULL }} , \
|
||||
{ .s2= { config_check_intrange, {0,4}}}, \
|
||||
{ .s5= {NULL }} , \
|
||||
{ .s5= {NULL }} , \
|
||||
{ .s5= {NULL }} , \
|
||||
{ .s5= {NULL} } , \
|
||||
{ .s2= {config_check_intrange, {0,4}}}, \
|
||||
{ .s5= {NULL} } , \
|
||||
{ .s5= {NULL} } , \
|
||||
{ .s5= {NULL} } , \
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************/
|
||||
/* */
|
||||
#include "threads_t.h"
|
||||
|
||||
#define SOFTMODEM_NOS1_BIT (1<<0)
|
||||
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
|
||||
@@ -270,6 +266,7 @@ typedef struct {
|
||||
uint32_t send_dmrs_sync;
|
||||
} softmodem_params_t;
|
||||
|
||||
|
||||
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
|
||||
#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
|
||||
#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
|
||||
@@ -287,15 +284,15 @@ extern pthread_cond_t sync_cond;
|
||||
extern pthread_mutex_t sync_mutex;
|
||||
extern int sync_var;
|
||||
|
||||
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
extern int rx_input_level_dBm;
|
||||
extern uint8_t exit_missed_slots;
|
||||
extern uint64_t num_missed_slots; // counter for the number of missed slots
|
||||
|
||||
extern int oaisim_flag;
|
||||
extern volatile int oai_exit;
|
||||
extern volatile int oai_exit;
|
||||
|
||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
extern pthread_cond_t sync_cond;
|
||||
@@ -305,31 +302,40 @@ extern int transmission_mode;
|
||||
extern double cpuf;
|
||||
|
||||
// In lte-enb.c
|
||||
extern void init_eNB(int single_thread_flag,int wait_for_sync);
|
||||
extern void stop_eNB(int);
|
||||
extern void kill_eNB_proc(int inst);
|
||||
extern void init_eNB(int single_thread_flag, int wait_for_sync);
|
||||
|
||||
// In lte-ru.c
|
||||
extern void init_RU(char *,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync);
|
||||
extern void stop_ru(RU_t *ru);
|
||||
extern void init_ru_vnf(void);
|
||||
extern void init_RU_proc(RU_t *ru);
|
||||
extern void stop_RU(int nb_ru);
|
||||
extern void kill_RU_proc(RU_t *ru);
|
||||
extern void set_function_spec_param(RU_t *ru);
|
||||
extern void init_RU(char *, clock_source_t clock_source, clock_source_t time_source, int send_dmrssync);
|
||||
|
||||
// In lte-ue.c
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
extern void fill_ue_band_info(void);
|
||||
|
||||
extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,
|
||||
extern void init_UE(int nb_inst,
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
int timing_correction,
|
||||
int phy_test,
|
||||
int UE_scan,
|
||||
int UE_scan_carrier,
|
||||
runmode_t mode,
|
||||
int rxgain,
|
||||
int txpowermax,
|
||||
LTE_DL_FRAME_PARMS *fp);
|
||||
|
||||
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char *name);
|
||||
|
||||
extern void reset_opp_meas(void);
|
||||
extern void print_opp_meas(void);
|
||||
|
||||
|
||||
extern void init_td_thread(PHY_VARS_eNB *);
|
||||
extern void init_te_thread(PHY_VARS_eNB *);
|
||||
extern void kill_td_thread(PHY_VARS_eNB *);
|
||||
@@ -339,23 +345,14 @@ extern void RCConfig_sim(void);
|
||||
extern void init_ocm(void);
|
||||
extern void init_ue_devices(PHY_VARS_UE *);
|
||||
|
||||
PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t UE_id,
|
||||
uint8_t abstraction_flag);
|
||||
void init_eNB_afterRU(void);
|
||||
PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
WORKER_CONF_t get_thread_worker_conf(void);
|
||||
void set_parallel_conf(char *parallel_conf);
|
||||
void set_worker_conf(char *worker_conf);
|
||||
PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
|
||||
|
||||
void init_eNB_afterRU(void);
|
||||
extern int stop_L1L2(module_id_t enb_id);
|
||||
extern int restart_L1L2(module_id_t enb_id);
|
||||
|
||||
extern void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, char *emul_iface);
|
||||
|
||||
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
|
||||
|
||||
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t UE_id,
|
||||
uint8_t abstraction_flag);
|
||||
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
|
||||
|
||||
#endif
|
||||
|
||||
+73
-55
@@ -161,7 +161,7 @@ static const eutra_band_t eutra_bands[] = {
|
||||
};
|
||||
|
||||
|
||||
threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
|
||||
threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
pthread_t main_ue_thread;
|
||||
pthread_attr_t attr_UE_thread;
|
||||
@@ -208,7 +208,12 @@ char uecap_xer[1024];
|
||||
|
||||
|
||||
|
||||
void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char *name) {
|
||||
void init_thread(int sched_runtime,
|
||||
int sched_deadline,
|
||||
int sched_fifo,
|
||||
cpu_set_t *cpuset,
|
||||
char *name)
|
||||
{
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
|
||||
if (sched_runtime!=0) {
|
||||
@@ -250,7 +255,18 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,LTE_DL_FRAME_PARMS *fp0) {
|
||||
void init_UE(int nb_inst,
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
int timing_correction,
|
||||
int phy_test,
|
||||
int UE_scan,
|
||||
int UE_scan_carrier,
|
||||
runmode_t mode,
|
||||
int rxgain,
|
||||
int txpowermax,
|
||||
LTE_DL_FRAME_PARMS *fp0)
|
||||
{
|
||||
PHY_VARS_UE *UE;
|
||||
int inst;
|
||||
int ret;
|
||||
@@ -270,9 +286,9 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
|
||||
if ( !IS_SOFTMODEM_SIML1 ) PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0);
|
||||
else {
|
||||
// needed for memcopy below. these are not used in the RU, but needed for UE
|
||||
RC.ru[0]->frame_parms.nb_antennas_rx = fp0->nb_antennas_rx;
|
||||
RC.ru[0]->frame_parms.nb_antennas_tx = fp0->nb_antennas_tx;
|
||||
PHY_vars_UE_g[inst][0] = init_ue_vars(&RC.ru[0]->frame_parms,inst,0);
|
||||
RC.ru[0]->frame_parms->nb_antennas_rx = fp0->nb_antennas_rx;
|
||||
RC.ru[0]->frame_parms->nb_antennas_tx = fp0->nb_antennas_tx;
|
||||
PHY_vars_UE_g[inst][0] = init_ue_vars(RC.ru[0]->frame_parms,inst,0);
|
||||
}
|
||||
|
||||
// turn off timing control loop in UE
|
||||
@@ -381,7 +397,11 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
|
||||
|
||||
// Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple
|
||||
// set of threads for multiple UEs.
|
||||
void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface) {
|
||||
void init_UE_stub_single_thread(int nb_inst,
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
char *emul_iface)
|
||||
{
|
||||
int inst;
|
||||
LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst);
|
||||
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
|
||||
@@ -403,10 +423,11 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface) {
|
||||
void init_UE_stub(int nb_inst,
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
char *emul_iface)
|
||||
{
|
||||
int inst;
|
||||
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
|
||||
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
|
||||
@@ -433,8 +454,6 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This is the UE synchronize thread.
|
||||
* It performs band scanning and synchonization.
|
||||
@@ -442,7 +461,8 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
|
||||
static void *UE_thread_synch(void *arg) {
|
||||
static void *UE_thread_synch(void *arg)
|
||||
{
|
||||
static int UE_thread_synch_retval;
|
||||
int i ;
|
||||
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
|
||||
@@ -457,9 +477,8 @@ static void *UE_thread_synch(void *arg) {
|
||||
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
if ( threads.iq != -1 )
|
||||
CPU_SET(threads.iq, &cpuset);
|
||||
if ( threads.sync != -1 )
|
||||
CPU_SET(threads.sync, &cpuset);
|
||||
|
||||
// this thread priority must be lower that the main acquisition thread
|
||||
sprintf(threadname, "sync UE %d\n", UE->Mod_id);
|
||||
@@ -737,7 +756,8 @@ static void *UE_thread_synch(void *arg) {
|
||||
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
const char *get_connectionloss_errstr(int errcode) {
|
||||
const char *get_connectionloss_errstr(int errcode)
|
||||
{
|
||||
switch (errcode) {
|
||||
case CONNECTION_LOST:
|
||||
return "RRC Connection lost, returning to PRACH";
|
||||
@@ -752,7 +772,8 @@ const char *get_connectionloss_errstr(int errcode) {
|
||||
return "UNKNOWN RETURN CODE";
|
||||
}
|
||||
|
||||
static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
static void *UE_thread_rxn_txnp4(void *arg)
|
||||
{
|
||||
static __thread int UE_thread_rxtx_retval;
|
||||
struct rx_tx_thread_data *rtd = arg;
|
||||
UE_rxtx_proc_t *proc = rtd->proc;
|
||||
@@ -876,11 +897,11 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int emulator_absSF;
|
||||
|
||||
void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
|
||||
void ue_stub_rx_handler(unsigned int num_bytes,
|
||||
char *rx_buffer)
|
||||
{
|
||||
PHY_VARS_UE *UE;
|
||||
UE = PHY_vars_UE_g[0][0];
|
||||
UE_tport_t *pdu = (UE_tport_t *)rx_buffer;
|
||||
@@ -944,7 +965,8 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
|
||||
static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
|
||||
static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
{
|
||||
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
|
||||
// for multipule UE's L2-emulator
|
||||
//module_id_t Mod_id = 0;
|
||||
@@ -1318,8 +1340,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
|
||||
* This thread performs the phy_procedures_UE_RX() on every received slot.
|
||||
@@ -1328,7 +1348,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
|
||||
static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
|
||||
static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
|
||||
{
|
||||
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
|
||||
module_id_t Mod_id = 0;
|
||||
static __thread int UE_thread_rxtx_retval;
|
||||
@@ -1482,7 +1503,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This is the main UE thread.
|
||||
* This thread controls the other three UE threads:
|
||||
@@ -1510,7 +1530,8 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) {
|
||||
1),"");
|
||||
}
|
||||
|
||||
void *UE_thread(void *arg) {
|
||||
void *UE_thread(void *arg)
|
||||
{
|
||||
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
|
||||
// int tx_enabled = 0;
|
||||
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32)));
|
||||
@@ -1523,12 +1544,10 @@ void *UE_thread(void *arg) {
|
||||
int ret;
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
if ( threads.main != -1 )
|
||||
CPU_SET(threads.main, &cpuset);
|
||||
init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads");
|
||||
|
||||
if ( threads.iq != -1 )
|
||||
CPU_SET(threads.iq, &cpuset);
|
||||
|
||||
init_thread(100000, 500000, FIFO_PRIORITY, &cpuset,
|
||||
"UHD Threads");
|
||||
/*
|
||||
while (sync_var<0)
|
||||
pthread_cond_wait(&sync_cond, &sync_mutex);
|
||||
@@ -1594,7 +1613,6 @@ void *UE_thread(void *arg) {
|
||||
(void)dummy_rx; /* avoid gcc warnings */
|
||||
usleep(500);
|
||||
#else
|
||||
|
||||
// grab 10 ms of signal into dummy buffer
|
||||
if (UE->mode != loop_through_memory) {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
@@ -1610,8 +1628,7 @@ void *UE_thread(void *arg) {
|
||||
if (IS_SOFTMODEM_RFSIM )
|
||||
write_dummy(UE, timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // UE->is_synchronized==0
|
||||
@@ -1624,8 +1641,7 @@ void *UE_thread(void *arg) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
|
||||
while ( UE->rx_offset ) {
|
||||
size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti);
|
||||
AssertFatal(s ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void **)UE->common_vars.rxdata,
|
||||
s,
|
||||
@@ -1839,7 +1855,8 @@ void *UE_thread(void *arg) {
|
||||
* - UE_thread_dlsch_proc_slot1
|
||||
* and the locking between them.
|
||||
*/
|
||||
void init_UE_threads(int inst) {
|
||||
void init_UE_threads(int inst)
|
||||
{
|
||||
struct rx_tx_thread_data *rtd;
|
||||
PHY_VARS_UE *UE;
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
|
||||
@@ -1883,7 +1900,6 @@ void init_UE_threads(int inst) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Initialize the UE theads.
|
||||
* Creates the UE threads:
|
||||
@@ -1895,7 +1911,8 @@ void init_UE_threads(int inst) {
|
||||
* - UE_thread_dlsch_proc_slot1
|
||||
* and the locking between them.
|
||||
*/
|
||||
void init_UE_single_thread_stub(int nb_inst) {
|
||||
void init_UE_single_thread_stub(int nb_inst)
|
||||
{
|
||||
struct rx_tx_thread_data *rtd;
|
||||
PHY_VARS_UE *UE;
|
||||
|
||||
@@ -1949,8 +1966,6 @@ void init_UE_single_thread_stub(int nb_inst) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Initialize the UE theads.
|
||||
* Creates the UE threads:
|
||||
@@ -1962,7 +1977,8 @@ void init_UE_single_thread_stub(int nb_inst) {
|
||||
* - UE_thread_dlsch_proc_slot1
|
||||
* and the locking between them.
|
||||
*/
|
||||
void init_UE_threads_stub(int inst) {
|
||||
void init_UE_threads_stub(int inst)
|
||||
{
|
||||
struct rx_tx_thread_data *rtd;
|
||||
PHY_VARS_UE *UE;
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
|
||||
@@ -1999,10 +2015,9 @@ void init_UE_threads_stub(int inst) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef OPENAIR2
|
||||
void fill_ue_band_info(void) {
|
||||
void fill_ue_band_info(void)
|
||||
{
|
||||
LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability;
|
||||
int i,j;
|
||||
bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count;
|
||||
@@ -2027,7 +2042,9 @@ void fill_ue_band_info(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg) {
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
|
||||
openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int i, CC_id;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
@@ -2064,15 +2081,13 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Panos: This timer thread is used only in the phy_stub mode as an independent timer
|
||||
// which will be ticking and provide the SFN/SF values that will be used from the UE threads
|
||||
// playing the role of nfapi-pnf.
|
||||
|
||||
//02/02/2018
|
||||
static void *timer_thread( void *param ) {
|
||||
static void *timer_thread( void *param )
|
||||
{
|
||||
thread_top_init("timer_thread",1,870000L,1000000L,1000000L);
|
||||
timer_subframe =9;
|
||||
timer_frame =1023;
|
||||
@@ -2198,8 +2213,8 @@ static void *timer_thread( void *param ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
int init_timer_thread(void) {
|
||||
int init_timer_thread(void)
|
||||
{
|
||||
//PHY_VARS_UE *UE=PHY_vars_UE_g[0];
|
||||
PHY_VARS_UE *UE=PHY_vars_UE_g[0][0];
|
||||
phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking));
|
||||
@@ -2219,7 +2234,10 @@ int init_timer_thread(void) {
|
||||
/* HACK: this function is needed to compile the UE
|
||||
* fix it somehow
|
||||
*/
|
||||
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
|
||||
int8_t find_dlsch(uint16_t rnti,
|
||||
PHY_VARS_eNB *eNB,
|
||||
find_type_t type)
|
||||
{
|
||||
printf("you cannot read this\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* \date 2012
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
|
||||
* \email: {knopp, florian.kaltenberger, navid.nikaein}@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
@@ -89,7 +89,6 @@
|
||||
#include "lte-softmodem.h"
|
||||
|
||||
|
||||
|
||||
/* temporary compilation wokaround (UE/eNB split */
|
||||
uint16_t sf_ahead;
|
||||
|
||||
@@ -173,14 +172,9 @@ static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
|
||||
uint8_t exit_missed_slots=1;
|
||||
uint64_t num_missed_slots=0; // counter for the number of missed slots
|
||||
|
||||
/* prototypes from function implemented in lte-ue.c, probably should be elsewhere in a include
|
||||
file */
|
||||
// prototypes from function implemented in lte-ue.c, probably should be elsewhere in a include file.
|
||||
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
|
||||
|
||||
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t UE_id,
|
||||
uint8_t abstraction_flag);
|
||||
|
||||
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
|
||||
extern void get_uethreads_params(void);
|
||||
|
||||
int transmission_mode=1;
|
||||
@@ -201,7 +195,7 @@ extern char uecap_xer[1024];
|
||||
char uecap_xer_in=0;
|
||||
|
||||
int oaisim_flag=0;
|
||||
|
||||
//threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
||||
* this is very hackish - find a proper solution
|
||||
@@ -312,11 +306,6 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int16_t dlsch_demod_shift;
|
||||
|
||||
static void get_options(void) {
|
||||
@@ -325,8 +314,9 @@ static void get_options(void) {
|
||||
char *loopfile=NULL;
|
||||
int dumpframe=0;
|
||||
int timingadv=0;
|
||||
uint8_t nfapi_mode=0;
|
||||
uint8_t nfapi_mode = NFAPI_MONOLITHIC;
|
||||
int simL1flag =0;
|
||||
|
||||
set_default_frame_parms(frame_parms);
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
/* unknown parameters on command line will be checked in main
|
||||
@@ -422,7 +412,7 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
int CC_id;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
frame_parms[CC_id] = (LTE_DL_FRAME_PARMS *) malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms[CC_id] = (LTE_DL_FRAME_PARMS *) calloc(1, sizeof(LTE_DL_FRAME_PARMS));
|
||||
/* Set some default values that may be overwritten while reading options */
|
||||
frame_parms[CC_id]->frame_type = FDD;
|
||||
frame_parms[CC_id]->tdd_config = 3;
|
||||
@@ -528,25 +518,6 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
|
||||
}
|
||||
|
||||
if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args;
|
||||
|
||||
if (usrp_clksrc) {
|
||||
if (strcmp(usrp_clksrc, "internal") == 0) {
|
||||
openair0_cfg[card].clock_source = internal;
|
||||
LOG_D(PHY, "USRP clock source set as internal\n");
|
||||
} else if (strcmp(usrp_clksrc, "external") == 0) {
|
||||
openair0_cfg[card].clock_source = external;
|
||||
LOG_D(PHY, "USRP clock source set as external\n");
|
||||
} else if (strcmp(usrp_clksrc, "gpsdo") == 0) {
|
||||
openair0_cfg[card].clock_source = gpsdo;
|
||||
LOG_D(PHY, "USRP clock source set as gpsdo\n");
|
||||
} else {
|
||||
openair0_cfg[card].clock_source = internal;
|
||||
LOG_I(PHY, "USRP clock source unknown ('%s'). defaulting to internal\n", usrp_clksrc);
|
||||
}
|
||||
} else {
|
||||
openair0_cfg[card].clock_source = internal;
|
||||
LOG_I(PHY, "USRP clock source not specified. defaulting to internal\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,6 +632,7 @@ int main( int argc, char **argv ) {
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
|
||||
printf("ITTI init\n");
|
||||
#define UE
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
@@ -719,7 +691,10 @@ int main( int argc, char **argv ) {
|
||||
}
|
||||
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
#ifndef DEADLINE_SCHEDULER
|
||||
|
||||
|
||||
#if 0 // #ifndef DEADLINE_SCHEDULER
|
||||
|
||||
printf("NO deadline scheduler\n");
|
||||
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
|
||||
cpu_set_t cpuset;
|
||||
@@ -727,17 +702,18 @@ int main( int argc, char **argv ) {
|
||||
char cpu_affinity[1024];
|
||||
CPU_ZERO(&cpuset);
|
||||
#ifdef CPU_AFFINITY
|
||||
|
||||
int j;
|
||||
if (get_nprocs() > 2) {
|
||||
CPU_SET(0, &cpuset);
|
||||
for (j = 2; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
|
||||
if (s != 0) {
|
||||
perror( "pthread_setaffinity_np");
|
||||
exit_fun("Error setting processor affinity");
|
||||
}
|
||||
|
||||
LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
|
||||
LOG_I(HW, "Setting the affinity of main function to all CPUs, for device library to use CPU 0 only!\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+47
-44
@@ -51,6 +51,7 @@
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_RU.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
RAN_CONTEXT_t RC;
|
||||
@@ -80,10 +81,10 @@ void wait_RUs(void) {
|
||||
|
||||
// copy frame parameters from RU to UEs
|
||||
for (i=0; i<NB_UE_INST; i++) {
|
||||
sim.current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms.samples_per_tti + RC.ru[0]->frame_parms.ofdm_symbol_size + RC.ru[0]->frame_parms.nb_prefix_samples0;
|
||||
sim.current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms->samples_per_tti + RC.ru[0]->frame_parms->ofdm_symbol_size + RC.ru[0]->frame_parms->nb_prefix_samples0;
|
||||
}
|
||||
|
||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) sim.current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms.samples_per_tti;
|
||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) sim.current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms->samples_per_tti;
|
||||
|
||||
printf("RUs are ready, let's go\n");
|
||||
}
|
||||
@@ -159,7 +160,8 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
|
||||
LOG_D(SIM,"RU_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps,
|
||||
(unsigned long long)sim.current_ru_rx_timestamp[ru_id][CC_id],
|
||||
(unsigned long long)sim.last_ru_rx_timestamp[ru_id][CC_id],
|
||||
(int)((*ptimestamp/RC.ru[ru_id]->frame_parms.samples_per_tti)%10));
|
||||
(int)((*ptimestamp/RC.ru[ru_id]->frame_parms->samples_per_tti)%10));
|
||||
|
||||
// if we're at a subframe boundary generate UL signals for this ru
|
||||
|
||||
while (sample_count<nsamps) {
|
||||
@@ -169,9 +171,9 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
|
||||
usleep(500);
|
||||
}
|
||||
|
||||
subframe = (sim.last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10;
|
||||
subframe = (sim.last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms->samples_per_tti)%10;
|
||||
|
||||
if (subframe_select(&RC.ru[ru_id]->frame_parms,subframe) != SF_DL || RC.ru[ru_id]->frame_parms.frame_type == FDD) {
|
||||
if (subframe_select(RC.ru[ru_id]->frame_parms,subframe) != SF_DL || RC.ru[ru_id]->frame_parms->frame_type == FDD) {
|
||||
LOG_D(SIM,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n",
|
||||
subframe,(unsigned long long)*ptimestamp,
|
||||
(unsigned long long)sim.current_ru_rx_timestamp[ru_id][CC_id]);
|
||||
@@ -179,15 +181,15 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
|
||||
do_UL_sig(&sim,
|
||||
subframe,
|
||||
0, // abstraction_flag
|
||||
&RC.ru[ru_id]->frame_parms,
|
||||
RC.ru[ru_id]->frame_parms,
|
||||
0, // frame is only used for abstraction
|
||||
ru_id,
|
||||
CC_id);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,0);
|
||||
}
|
||||
|
||||
sim.last_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
|
||||
sample_count += RC.ru[ru_id]->frame_parms.samples_per_tti;
|
||||
sim.last_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms->samples_per_tti;
|
||||
sample_count += RC.ru[ru_id]->frame_parms->samples_per_tti;
|
||||
}
|
||||
|
||||
return(nsamps);
|
||||
@@ -265,7 +267,7 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
|
||||
|
||||
int ru_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
int ru_id = device->Mod_id;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &RC.ru[ru_id]->frame_parms;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = RC.ru[ru_id]->frame_parms;
|
||||
pthread_mutex_lock(&sim.subframe_mutex);
|
||||
LOG_D(SIM,"[TXPATH] ru_trx_write: RU %d mask %d\n",ru_id,sim.subframe_ru_mask);
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
@@ -303,16 +305,16 @@ void init_ru_devices() {
|
||||
|
||||
if (RC.ru[ru_id]==NULL) RC.ru[ru_id] = (RU_t *)malloc(sizeof(RU_t));
|
||||
|
||||
ru = RC.ru[ru_id];
|
||||
ru->rfdevice.Mod_id = ru_id;
|
||||
ru->rfdevice.CC_id = 0;
|
||||
ru->rfdevice.trx_start_func = ru_trx_start;
|
||||
ru->rfdevice.trx_read_func = ru_trx_read;
|
||||
ru->rfdevice.trx_write_func = ru_trx_write;
|
||||
ru->rfdevice.trx_end_func = ru_trx_end;
|
||||
ru->rfdevice.trx_stop_func = ru_trx_stop;
|
||||
ru->rfdevice.trx_set_freq_func = ru_trx_set_freq;
|
||||
ru->rfdevice.trx_set_gains_func = ru_trx_set_gains;
|
||||
ru = RC.ru[ru_id];
|
||||
ru->rfdevice.Mod_id = ru_id;
|
||||
ru->rfdevice.CC_id = 0;
|
||||
ru->rfdevice.trx_start_func = ru_trx_start;
|
||||
ru->rfdevice.trx_read_func = ru_trx_read;
|
||||
ru->rfdevice.trx_write_func = ru_trx_write;
|
||||
ru->rfdevice.trx_end_func = ru_trx_end;
|
||||
ru->rfdevice.trx_stop_func = ru_trx_stop;
|
||||
ru->rfdevice.trx_set_freq_func = ru_trx_set_freq;
|
||||
ru->rfdevice.trx_set_gains_func = ru_trx_set_gains;
|
||||
sim.last_ru_rx_timestamp[ru_id][0] = 0;
|
||||
}
|
||||
}
|
||||
@@ -348,24 +350,25 @@ void init_ocm(void) {
|
||||
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
LOG_I(PHY,"Initializing channel descriptors (RU %d, UE %d) for N_RB_DL %d\n",ru_id,UE_id,
|
||||
RC.ru[ru_id]->frame_parms.N_RB_DL);
|
||||
sim.RU2UE[ru_id][UE_id][CC_id] =
|
||||
RC.ru[ru_id]->frame_parms->N_RB_DL);
|
||||
sim.RU2UE[ru_id][UE_id][CC_id] =
|
||||
new_channel_desc_scm(RC.ru[ru_id]->nb_tx,
|
||||
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx,
|
||||
AWGN,
|
||||
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_DL),
|
||||
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_DL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0);
|
||||
LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN",UE_id, ru_id);
|
||||
LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id);
|
||||
|
||||
sim.UE2RU[UE_id][ru_id][CC_id] =
|
||||
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_tx,
|
||||
RC.ru[ru_id]->nb_rx,
|
||||
AWGN,
|
||||
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_UL),
|
||||
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms->N_RB_UL),
|
||||
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms->N_RB_UL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
@@ -377,16 +380,17 @@ void init_ocm(void) {
|
||||
|
||||
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
|
||||
if (ru_id == (UE_id % RC.nb_RU)) {
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
} else {
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
}
|
||||
|
||||
LOG_I(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id,
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB,
|
||||
RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
|
||||
RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower,
|
||||
snr_dB);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,16 +409,17 @@ void update_ocm(double snr_dB,double sinr_dB) {
|
||||
|
||||
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
|
||||
if (ru_id == (UE_id % RC.nb_RU)) {
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
} else {
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
sim.UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower;
|
||||
}
|
||||
|
||||
|
||||
LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id,
|
||||
sim.RU2UE[ru_id][UE_id][CC_id]->path_loss_dB,
|
||||
RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
|
||||
RC.ru[ru_id]->frame_parms->pdsch_config_common.referenceSignalPower,
|
||||
snr_dB);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,22 +440,19 @@ void init_channel_vars(void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *rfsim_top(void *n_frames) {
|
||||
wait_sync("rfsim_top");
|
||||
printf("Running rfsim with %d frames\n",*(int *)n_frames);
|
||||
|
||||
for (int frame = 0;
|
||||
frame < *(int *)n_frames;
|
||||
frame++) {
|
||||
for (int frame = 0; frame < *(int *)n_frames; frame++) {
|
||||
for (int sf = 0; sf < 10; sf++) {
|
||||
int CC_id=0;
|
||||
int all_done=0;
|
||||
|
||||
while (all_done==0) {
|
||||
pthread_mutex_lock(&sim.subframe_mutex);
|
||||
int subframe_ru_mask_local = (subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_UL) ? sim.subframe_ru_mask : ((1<<RC.nb_RU)-1);
|
||||
int subframe_UE_mask_local = (RC.ru[0]->frame_parms.frame_type == FDD || subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_DL) ? sim.subframe_UE_mask : ((1<<NB_UE_INST)-1);
|
||||
int subframe_ru_mask_local = (subframe_select(RC.ru[0]->frame_parms,(sf+4)%10)!=SF_UL) ? sim.subframe_ru_mask : ((1<<RC.nb_RU)-1);
|
||||
int subframe_UE_mask_local = (RC.ru[0]->frame_parms->frame_type == FDD || subframe_select(RC.ru[0]->frame_parms,(sf+4)%10)!=SF_DL) ? sim.subframe_UE_mask : ((1<<NB_UE_INST)-1);
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
LOG_D(SIM,"Frame %d, Subframe %d, NB_RU %d, NB_UE %d: Checking masks %x,%x\n",frame,sf,RC.nb_RU,NB_UE_INST,subframe_ru_mask_local,subframe_UE_mask_local);
|
||||
|
||||
@@ -466,8 +468,9 @@ void *rfsim_top(void *n_frames) {
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
|
||||
// increment timestamps
|
||||
|
||||
for (int ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
sim.current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
|
||||
sim.current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms->samples_per_tti;
|
||||
LOG_D(SIM,"RU %d/%d: TS %"PRIi64"\n",ru_id,CC_id,sim.current_ru_rx_timestamp[ru_id][CC_id]);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,20 +294,20 @@ void thread_top_init(char *thread_name,
|
||||
char cpu_affinity[1024];
|
||||
cpu_set_t cpuset;
|
||||
|
||||
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
|
||||
/* Set affinity mask to include CPUs 2 to MAX_CPUS */
|
||||
/* CPU 0 is reserved for UHD threads */
|
||||
/* CPU 1 is reserved for all RX_TX threads */
|
||||
/* Enable CPU Affinity only if number of CPUs >2 */
|
||||
/* Enable CPU Affinity only if number of CPUs > 2 */
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
#ifdef CPU_AFFINITY
|
||||
if (get_nprocs() > 2)
|
||||
if (affinity == 0) {
|
||||
LOG_W(HW,"thread_top_init() called with affinity==0, but overruled by #ifdef CPU_AFFINITY\n");
|
||||
}
|
||||
else if (get_nprocs() > 2)
|
||||
{
|
||||
if (affinity == 0)
|
||||
CPU_SET(0,&cpuset);
|
||||
else
|
||||
for (j = 1; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
for (j = 2; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
@@ -315,21 +315,29 @@ void thread_top_init(char *thread_name,
|
||||
exit_fun("Error setting processor affinity");
|
||||
}
|
||||
}
|
||||
#else //CPU_AFFINITY
|
||||
if (affinity) {
|
||||
LOG_W(HW,"thread_top_init() called with affinity>0, but overruled by #ifndef CPU_AFFINITY.\n");
|
||||
}
|
||||
#endif //CPU_AFFINITY
|
||||
|
||||
/* Check the actual affinity mask assigned to the thread */
|
||||
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0) {
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_getaffinity_np");
|
||||
exit_fun("Error getting processor affinity ");
|
||||
}
|
||||
memset(cpu_affinity,0,sizeof(cpu_affinity));
|
||||
for (j = 0; j < 1024; j++)
|
||||
if (CPU_ISSET(j, &cpuset)) {
|
||||
{
|
||||
if (CPU_ISSET(j, &cpuset))
|
||||
{
|
||||
char temp[1024];
|
||||
sprintf (temp, " CPU_%d", j);
|
||||
strcat(cpu_affinity, temp);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&sparam, 0, sizeof(sparam));
|
||||
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
|
||||
@@ -74,28 +74,22 @@
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "UTIL/OTG/otg_tx.h"
|
||||
#include "UTIL/OTG/otg_externs.h"
|
||||
#include "UTIL/MATH/oml.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "enb_config.h"
|
||||
|
||||
void configure_ru(int idx,
|
||||
void *arg);
|
||||
|
||||
void configure_rru(int idx,
|
||||
void *arg);
|
||||
|
||||
int attach_rru(RU_t *ru);
|
||||
|
||||
void configure_ru(int idx, void *arg);
|
||||
void configure_rru(int idx, void *arg);
|
||||
void fill_rf_config(RU_t *ru, char *rf_config_file);
|
||||
|
||||
void* ru_thread_control( void* param );
|
||||
|
||||
extern void reset_proc(RU_t *ru);
|
||||
extern int setup_RU_buffers(RU_t *ru);
|
||||
|
||||
|
||||
extern void reset_proc(RU_t *ru);
|
||||
extern void phy_init_RU(RU_t*);
|
||||
|
||||
extern const char ru_states[6][9];
|
||||
@@ -106,8 +100,8 @@ const char ru_if_formats[4][20] = {"LOCAL_RF","REMOTE_OAI_IF5","REMOTE_MBP_IF5",
|
||||
extern int oai_exit;
|
||||
extern void wait_eNBs(void);
|
||||
|
||||
int send_tick(RU_t *ru){
|
||||
|
||||
int send_tick(RU_t *ru)
|
||||
{
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
|
||||
rru_config_msg.type = RAU_tick;
|
||||
@@ -120,13 +114,15 @@ int send_tick(RU_t *ru){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int send_config(RU_t *ru, RRU_CONFIG_msg_t rru_config_msg){
|
||||
|
||||
|
||||
int send_config(RU_t *ru,
|
||||
RRU_CONFIG_msg_t rru_config_msg)
|
||||
{
|
||||
rru_config_msg.type = RRU_config;
|
||||
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t);
|
||||
|
||||
LOG_I(PHY,"Sending Configuration to RRU %d (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL %d,3/4FS %d, prach_FO %d, prach_CI %d\n",ru->idx,
|
||||
LOG_I(PHY,"Sending Configuration to RRU %d (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL %d,3/4FS %d, prach_FO %d, prach_CI %d\n",
|
||||
ru->idx,
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->num_bands,
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->band_list[0],
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->tx_freq[0],
|
||||
@@ -139,16 +135,15 @@ int send_config(RU_t *ru, RRU_CONFIG_msg_t rru_config_msg){
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0],
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
|
||||
|
||||
|
||||
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),
|
||||
"RU %d failed send configuration to remote radio\n",ru->idx);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int send_capab(RU_t *ru){
|
||||
|
||||
int send_capab(RU_t *ru)
|
||||
{
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
RRU_capabilities_t *cap;
|
||||
int i=0;
|
||||
@@ -186,11 +181,11 @@ int send_capab(RU_t *ru){
|
||||
"RU %d failed send capabilities to RAU\n",ru->idx);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int attach_rru(RU_t *ru) {
|
||||
|
||||
|
||||
int attach_rru(RU_t *ru)
|
||||
{
|
||||
ssize_t msg_len,len;
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
int received_capabilities=0;
|
||||
@@ -247,15 +242,15 @@ int attach_rru(RU_t *ru) {
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0],
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
|
||||
|
||||
|
||||
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),
|
||||
"RU %d failed send configuration to remote radio\n",ru->idx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int connect_rau(RU_t *ru) {
|
||||
|
||||
int connect_rau(RU_t *ru)
|
||||
{
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
ssize_t msg_len;
|
||||
int tick_received = 0;
|
||||
@@ -348,24 +343,26 @@ int connect_rau(RU_t *ru) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
|
||||
|
||||
int check_capabilities(RU_t *ru,
|
||||
RRU_capabilities_t *cap)
|
||||
{
|
||||
FH_fmt_options_t fmt = cap->FH_fmt;
|
||||
|
||||
int i;
|
||||
int found_band=0;
|
||||
|
||||
LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->frame_parms.eutra_band);
|
||||
LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->frame_parms->eutra_band);
|
||||
for (i=0;i<cap->num_bands;i++) {
|
||||
LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx);
|
||||
if (ru->frame_parms.eutra_band == cap->band_list[i]) {
|
||||
if (ru->frame_parms->eutra_band == cap->band_list[i]) {
|
||||
found_band=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_band == 0) {
|
||||
LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->frame_parms.eutra_band,ru->idx);
|
||||
LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->frame_parms->eutra_band,ru->idx);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -392,8 +389,8 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
|
||||
}
|
||||
|
||||
void configure_ru(int idx,
|
||||
void *arg) {
|
||||
|
||||
void *arg)
|
||||
{
|
||||
RU_t *ru = RC.ru[idx];
|
||||
RRU_config_t *config = (RRU_config_t *)arg;
|
||||
RRU_capabilities_t *capabilities = (RRU_capabilities_t*)arg;
|
||||
@@ -411,86 +408,79 @@ void configure_ru(int idx,
|
||||
ru->nb_rx = capabilities->nb_rx[0];
|
||||
|
||||
// Pass configuration to RRU
|
||||
LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms.eutra_band);
|
||||
LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms->eutra_band);
|
||||
// wait for configuration
|
||||
config->FH_fmt = ru->if_south;
|
||||
config->num_bands = 1;
|
||||
config->band_list[0] = ru->frame_parms.eutra_band;
|
||||
config->tx_freq[0] = ru->frame_parms.dl_CarrierFreq;
|
||||
config->rx_freq[0] = ru->frame_parms.ul_CarrierFreq;
|
||||
config->tdd_config[0] = ru->frame_parms.tdd_config;
|
||||
config->tdd_config_S[0] = ru->frame_parms.tdd_config_S;
|
||||
config->band_list[0] = ru->frame_parms->eutra_band;
|
||||
config->tx_freq[0] = ru->frame_parms->dl_CarrierFreq;
|
||||
config->rx_freq[0] = ru->frame_parms->ul_CarrierFreq;
|
||||
config->tdd_config[0] = ru->frame_parms->tdd_config;
|
||||
config->tdd_config_S[0] = ru->frame_parms->tdd_config_S;
|
||||
config->att_tx[0] = ru->att_tx;
|
||||
config->att_rx[0] = ru->att_rx;
|
||||
config->N_RB_DL[0] = ru->frame_parms.N_RB_DL;
|
||||
config->N_RB_UL[0] = ru->frame_parms.N_RB_UL;
|
||||
config->threequarter_fs[0] = ru->frame_parms.threequarter_fs;
|
||||
config->N_RB_DL[0] = ru->frame_parms->N_RB_DL;
|
||||
config->N_RB_UL[0] = ru->frame_parms->N_RB_UL;
|
||||
config->threequarter_fs[0] = ru->frame_parms->threequarter_fs;
|
||||
if (ru->if_south==REMOTE_IF4p5) {
|
||||
config->prach_FreqOffset[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
|
||||
config->prach_ConfigIndex[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
|
||||
config->prach_FreqOffset[0] = ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset;
|
||||
config->prach_ConfigIndex[0] = ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
|
||||
LOG_I(PHY,"REMOTE_IF4p5: prach_FrequOffset %d, prach_ConfigIndex %d\n",
|
||||
config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int i;
|
||||
for (i=0;i<4;i++) {
|
||||
config->emtc_prach_CElevel_enable[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
|
||||
config->emtc_prach_FreqOffset[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
|
||||
config->emtc_prach_ConfigIndex[0][i] = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i];
|
||||
config->emtc_prach_CElevel_enable[0][i] = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
|
||||
config->emtc_prach_FreqOffset[0][i] = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
|
||||
config->emtc_prach_ConfigIndex[0][i] = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
init_frame_parms(&ru->frame_parms,1);
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
phy_init_RU(ru);
|
||||
}
|
||||
|
||||
void configure_rru(int idx,
|
||||
void *arg) {
|
||||
|
||||
void *arg)
|
||||
{
|
||||
RRU_config_t *config = (RRU_config_t *)arg;
|
||||
RU_t *ru = RC.ru[idx];
|
||||
RU_t *ru = RC.ru[idx];
|
||||
|
||||
ru->frame_parms.eutra_band = config->band_list[0];
|
||||
ru->frame_parms.dl_CarrierFreq = config->tx_freq[0];
|
||||
ru->frame_parms.ul_CarrierFreq = config->rx_freq[0];
|
||||
if (ru->frame_parms.dl_CarrierFreq == ru->frame_parms.ul_CarrierFreq) {
|
||||
ru->frame_parms.frame_type = TDD;
|
||||
ru->frame_parms.tdd_config = config->tdd_config[0];
|
||||
ru->frame_parms.tdd_config_S = config->tdd_config_S[0];
|
||||
ru->frame_parms->eutra_band = config->band_list[0];
|
||||
ru->frame_parms->dl_CarrierFreq = config->tx_freq[0];
|
||||
ru->frame_parms->ul_CarrierFreq = config->rx_freq[0];
|
||||
if (ru->frame_parms->dl_CarrierFreq == ru->frame_parms->ul_CarrierFreq) {
|
||||
LOG_I(PHY,"Setting RRU to TDD frame type\n");
|
||||
ru->frame_parms->frame_type = TDD;
|
||||
ru->frame_parms->tdd_config = config->tdd_config[0];
|
||||
ru->frame_parms->tdd_config_S = config->tdd_config_S[0];
|
||||
}
|
||||
else
|
||||
ru->frame_parms.frame_type = FDD;
|
||||
else ru->frame_parms->frame_type = FDD;
|
||||
|
||||
ru->att_tx = config->att_tx[0];
|
||||
ru->att_rx = config->att_rx[0];
|
||||
ru->frame_parms.N_RB_DL = config->N_RB_DL[0];
|
||||
ru->frame_parms.N_RB_UL = config->N_RB_UL[0];
|
||||
ru->frame_parms.threequarter_fs = config->threequarter_fs[0];
|
||||
ru->frame_parms.pdsch_config_common.referenceSignalPower = ru->max_pdschReferenceSignalPower-config->att_tx[0];
|
||||
if (ru->function==NGFI_RRU_IF4p5) {
|
||||
ru->frame_parms.att_rx = ru->att_rx;
|
||||
ru->frame_parms.att_tx = ru->att_tx;
|
||||
ru->frame_parms->N_RB_DL = config->N_RB_DL[0];
|
||||
ru->frame_parms->N_RB_UL = config->N_RB_UL[0];
|
||||
ru->frame_parms->threequarter_fs = config->threequarter_fs[0];
|
||||
ru->frame_parms->pdsch_config_common.referenceSignalPower = ru->max_pdschReferenceSignalPower-config->att_tx[0];
|
||||
|
||||
if (ru->function==NGFI_RRU_IF4p5) {
|
||||
ru->frame_parms->att_rx = ru->att_rx;
|
||||
ru->frame_parms->att_tx = ru->att_tx;
|
||||
LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n",
|
||||
config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx);
|
||||
ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = config->prach_FreqOffset[0];
|
||||
ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0];
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset = config->prach_FreqOffset[0];
|
||||
ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0];
|
||||
for (int i=0;i<4;i++) {
|
||||
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] = config->emtc_prach_CElevel_enable[0][i];
|
||||
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i] = config->emtc_prach_FreqOffset[0][i];
|
||||
ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i] = config->emtc_prach_ConfigIndex[0][i];
|
||||
ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] = config->emtc_prach_CElevel_enable[0][i];
|
||||
ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i] = config->emtc_prach_FreqOffset[0][i];
|
||||
ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i] = config->emtc_prach_ConfigIndex[0][i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
init_frame_parms(&ru->frame_parms,1);
|
||||
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
|
||||
|
||||
// phy_init_RU(ru);
|
||||
|
||||
phy_init_RU(ru);
|
||||
}
|
||||
|
||||
static int send_update_rru(RU_t * ru, LTE_DL_FRAME_PARMS * fp){
|
||||
@@ -515,13 +505,12 @@ static int send_update_rru(RU_t * ru, LTE_DL_FRAME_PARMS * fp){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ru_thread_control( void* param ) {
|
||||
|
||||
|
||||
void* ru_thread_control( void* param )
|
||||
{
|
||||
RU_t *ru = (RU_t*)param;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
ssize_t msg_len;
|
||||
ssize_t msg_len;
|
||||
int len;
|
||||
int ru_sf_update=0; // SF config update flag (MBSFN)
|
||||
|
||||
@@ -613,12 +602,13 @@ void* ru_thread_control( void* param ) {
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0],
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
|
||||
|
||||
ru->frame_parms = calloc(1, sizeof(*ru->frame_parms));
|
||||
configure_rru(ru->idx, (void*)&rru_config_msg.msg[0]);
|
||||
|
||||
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
init_frame_parms(&ru->frame_parms,1);
|
||||
ru->frame_parms.nb_antennas_rx = ru->nb_rx;
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
ru->frame_parms->nb_antennas_rx = ru->nb_rx;
|
||||
phy_init_RU(ru);
|
||||
|
||||
//if (ru->is_slave == 1) lte_sync_time_init(&ru->frame_parms);
|
||||
@@ -695,9 +685,9 @@ void* ru_thread_control( void* param ) {
|
||||
msg_len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t);
|
||||
|
||||
LOG_W(PHY,"New MBSFN config received from RAU --- num_MBSFN_config %d\n",((RRU_config_t *)&rru_config_msg.msg[0])->num_MBSFN_config);
|
||||
ru->frame_parms.num_MBSFN_config = ((RRU_config_t *)&rru_config_msg.msg[0])->num_MBSFN_config;
|
||||
ru->frame_parms->num_MBSFN_config = ((RRU_config_t *)&rru_config_msg.msg[0])->num_MBSFN_config;
|
||||
for(int i=0; i < ((RRU_config_t *)&rru_config_msg.msg[0])->num_MBSFN_config; i++){
|
||||
ru->frame_parms.MBSFN_config[i].mbsfn_SubframeConfig=((RRU_config_t *)&rru_config_msg.msg[0])->MBSFN_config[i].mbsfn_SubframeConfig;
|
||||
ru->frame_parms->MBSFN_config[i].mbsfn_SubframeConfig=((RRU_config_t *)&rru_config_msg.msg[0])->MBSFN_config[i].mbsfn_SubframeConfig;
|
||||
LOG_W(PHY,"Configuration received from RAU (num MBSFN %d, MBSFN_SubframeConfig[%d] pattern is %x )\n",
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->num_MBSFN_config,
|
||||
i,
|
||||
|
||||
Reference in New Issue
Block a user