Merge remote-tracking branch 'origin/develop' into nr_vcd
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.61 (w)1999-2014 BSI
|
||||
[*] Tue Oct 15 11:26:28 2019
|
||||
[*] Wed Mar 4 14:05:43 2020
|
||||
[*]
|
||||
[dumpfile] "/home/caracal/rakesh/openair_dump_gNB_nr_vcd.vcd"
|
||||
[dumpfile_mtime] "Mon Oct 14 19:40:52 2019"
|
||||
[dumpfile_size] 45402472
|
||||
[savefile] "/home/caracal/rakesh/nr_fapi_for_push/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw"
|
||||
[timestart] 31585150000
|
||||
[size] 1920 960
|
||||
[pos] -1 -1
|
||||
*-21.745718 31593090000 -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] "/tmp/gNB_trx_thread.vcd"
|
||||
[dumpfile_mtime] "Wed Mar 4 14:05:10 2020"
|
||||
[dumpfile_size] 10750468
|
||||
[savefile] "/home/wangts/openairinterface5g/targets/RT/USER/gNB_usrp.gtkw"
|
||||
[timestart] 31148700000
|
||||
[size] 1916 1002
|
||||
[pos] -1 -25
|
||||
*-23.852516 -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 -1
|
||||
[sst_width] 386
|
||||
[signals_width] 344
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 197
|
||||
[sst_vpaned_height] 262
|
||||
@28
|
||||
functions.trx_read
|
||||
functions.trx_write_thread
|
||||
@25
|
||||
variables.trx_write_flags[63:0]
|
||||
@28
|
||||
functions.trx_write
|
||||
@420
|
||||
variables.frame_number_TX0_UE[63:0]
|
||||
@@ -68,8 +72,10 @@ functions.gNB_pdsch_codeword_scrambling
|
||||
functions.gNB_pdsch_modulation
|
||||
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_eNB_dlsch_encoding_w
|
||||
functions.phy_procedures_ru_feptx_prec2
|
||||
variables.ru_tx_ofdm_mask[63:0]
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
|
||||
+13
-17
@@ -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"
|
||||
@@ -118,9 +117,9 @@ extern int oaisim_flag;
|
||||
|
||||
//uint16_t sf_ahead=4;
|
||||
extern uint16_t sf_ahead;
|
||||
|
||||
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
#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;
|
||||
|
||||
@@ -236,10 +235,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
|
||||
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
|
||||
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
|
||||
// L2-emulator can work only one eNB.
|
||||
// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
// 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);
|
||||
// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_info.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_info.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
|
||||
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_info.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_info.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++;
|
||||
|
||||
@@ -262,7 +261,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
|
||||
eNB->UL_INFO.subframe = proc->subframe_rx;
|
||||
eNB->UL_INFO.module_id = eNB->Mod_id;
|
||||
eNB->UL_INFO.CC_id = eNB->CC_id;
|
||||
eNB->if_inst->UL_indication(&eNB->UL_INFO);
|
||||
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 */
|
||||
@@ -513,17 +512,16 @@ int wakeup_txfh(PHY_VARS_eNB *eNB,
|
||||
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
|
||||
}
|
||||
|
||||
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->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);
|
||||
AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_eNBs ))==0,"mutex_unlock return %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);
|
||||
|
||||
ru_proc->instance_cnt_eNBs = 0;
|
||||
ru_proc->timestamp_tx = timestamp_tx;
|
||||
ru_proc->tti_tx = subframe_tx;
|
||||
@@ -853,9 +851,7 @@ void init_eNB_proc(int inst) {
|
||||
|
||||
for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
|
||||
eNB = RC.eNB[inst][CC_id];
|
||||
#ifndef OCP_FRAMEWORK
|
||||
LOG_I(PHY,"Initializing eNB processes instance:%d CC_id %d \n",inst,CC_id);
|
||||
#endif
|
||||
proc = &eNB->proc;
|
||||
L1_proc = &proc->L1_proc;
|
||||
L1_proc_tx = &proc->L1_proc_tx;
|
||||
@@ -1249,13 +1245,13 @@ void init_eNB(int single_thread_flag,
|
||||
eNB->abstraction_flag = 0;
|
||||
eNB->single_thread_flag = single_thread_flag;
|
||||
LOG_I(PHY,"Initializing eNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag);
|
||||
#ifndef OCP_FRAMEWORK
|
||||
LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id);
|
||||
#endif
|
||||
LOG_I(PHY,"Registering with MAC interface module\n");
|
||||
AssertFatal((eNB->if_inst = IF_Module_init(inst))!=NULL,"Cannot register interface");
|
||||
eNB->if_inst->schedule_response = schedule_response;
|
||||
eNB->if_inst->PHY_config_req = phy_config_request;
|
||||
eNB->if_inst->PHY_config_update_sib2_req = phy_config_update_sib2_request;
|
||||
eNB->if_inst->PHY_config_update_sib13_req = phy_config_update_sib13_request;
|
||||
memset((void *)&eNB->UL_INFO,0,sizeof(eNB->UL_INFO));
|
||||
memset((void *)&eNB->Sched_INFO,0,sizeof(eNB->Sched_INFO));
|
||||
LOG_I(PHY,"Setting indication lists\n");
|
||||
|
||||
@@ -187,7 +187,7 @@ int32_t **txdata;
|
||||
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
|
||||
static inline void saif_meas(int frame_rx, int subframe_rx) {
|
||||
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;
|
||||
@@ -238,7 +238,7 @@ static inline void saif_meas(int frame_rx, int subframe_rx) {
|
||||
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=%d) - %s",
|
||||
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,
|
||||
@@ -246,7 +246,7 @@ static inline void saif_meas(int frame_rx, int subframe_rx) {
|
||||
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=%d) - %s",
|
||||
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,
|
||||
@@ -254,7 +254,7 @@ static inline void saif_meas(int frame_rx, int subframe_rx) {
|
||||
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=%d) - %s",
|
||||
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,
|
||||
@@ -326,7 +326,7 @@ int main(void)
|
||||
openair0_device rf_device;
|
||||
openair0_timestamp timestamp = 0;
|
||||
|
||||
int sub_frame = 0;
|
||||
unsigned int sub_frame = 0;
|
||||
unsigned int frame_rx = 0;
|
||||
|
||||
unsigned int nb_antennas_tx = 1;
|
||||
@@ -922,7 +922,7 @@ int main(void)
|
||||
|
||||
rxp[0] = (void*)&rxdata[0][sub_frame*nb_sample_per_tti];
|
||||
|
||||
readBlockSize = rf_device.trx_read_func( &rf_device,
|
||||
readBlockSize = rf_device.trx_read_func(&rf_device,
|
||||
×tamp,
|
||||
rxp,
|
||||
nb_sample_per_tti,
|
||||
|
||||
@@ -670,7 +670,7 @@ void *UE_thread(void *arg) {
|
||||
{
|
||||
proc = rxtx_proc[i];
|
||||
pthread_getname_np(proc->pthread_rxtx,threadname,128 );
|
||||
printf("RxTX Thread unlock latency on thread %s (it. %ld) (us) : max=%8.3f - mean=%8.3f - min=%8.3f\n",
|
||||
printf("RxTX Thread unlock latency on thread %s (it. %lu) (us) : max=%8.3f - mean=%8.3f - min=%8.3f\n",
|
||||
threadname,
|
||||
proc->syr_rdtsc_rxtx_th_unlock_iteration,
|
||||
proc->syr_rdtsc_rxtx_th_unlock_max,
|
||||
@@ -1192,12 +1192,12 @@ void histogram_save_in_csv( histo_time_t *histo , char *file_sufix)
|
||||
|
||||
for ( i = 0; i < HISTOGRAM_SIZE; i++ ) {
|
||||
if ( i + 1 == HISTOGRAM_SIZE )
|
||||
fprintf( fp, "%u+;%u\n", min_val, histo[i].count );
|
||||
fprintf( fp, "%d+;%u\n", min_val, histo[i].count );
|
||||
else
|
||||
fprintf( fp, "%u-%.0f;%u\n", min_val, histo[i].max, histo[i].count );
|
||||
fprintf( fp, "%d-%.0f;%u\n", min_val, histo[i].max, histo[i].count );
|
||||
min_val = histo[i].max;
|
||||
}
|
||||
|
||||
free(csv_filename);
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
|
||||
+154
-146
@@ -25,7 +25,7 @@
|
||||
* \date 2019
|
||||
* \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
|
||||
*/
|
||||
@@ -50,10 +50,6 @@
|
||||
|
||||
#include "assertions.h"
|
||||
#include "msc.h"
|
||||
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
#include "../../ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/types.h"
|
||||
@@ -64,7 +60,6 @@
|
||||
#include "PHY/LTE_TRANSPORT/if5_tools.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
@@ -78,12 +73,15 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "enb_config.h"
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
//#include "PHY/TOOLS/time_meas.h"
|
||||
|
||||
/* these variables have to be defined before including ENB_APP/enb_paramdef.h */
|
||||
static int DEFBANDS[] = {7};
|
||||
static int DEFENBS[] = {0};
|
||||
static int DEFBFW[] = {0x00007fff};
|
||||
|
||||
#include "ENB_APP/enb_paramdef.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
@@ -95,18 +93,19 @@ static int DEFENBS[] = {0};
|
||||
#include "s1ap_eNB.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#include "pdcp.h"
|
||||
|
||||
#define MBMS_EXPERIMENTAL
|
||||
|
||||
extern volatile int oai_exit;
|
||||
extern int emulate_rf;
|
||||
extern int numerology;
|
||||
extern clock_source_t clock_source;
|
||||
|
||||
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
#include "executables/thread-common.h"
|
||||
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
//extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
extern void phy_init_RU(RU_t *);
|
||||
|
||||
void stop_RU(int nb_ru);
|
||||
@@ -163,8 +162,8 @@ static inline void fh_if4p5_south_out(RU_t *ru,
|
||||
|
||||
LOG_D(PHY,"ENTERED fh_if4p5_south_out Sending IF4p5 for frame %d subframe %d ru %d\n",ru->proc.frame_tx,ru->proc.tti_tx,ru->idx);
|
||||
|
||||
if (subframe_select(ru->frame_parms,subframe)!=SF_UL) {
|
||||
send_IF4p5(ru,frame, subframe, IF4p5_PDLFFT);
|
||||
if (subframe_select(ru->frame_parms, subframe)!=SF_UL) {
|
||||
send_IF4p5(ru, frame, subframe, IF4p5_PDLFFT);
|
||||
ru->south_out_cnt++;
|
||||
LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt);
|
||||
}
|
||||
@@ -260,22 +259,21 @@ void fh_if4p5_south_in(RU_t *ru,
|
||||
}
|
||||
|
||||
//calculate timestamp_rx, timestamp_tx based on frame and subframe
|
||||
proc->tti_rx = sf;
|
||||
proc->frame_rx= f;
|
||||
proc->tti_rx = sf;
|
||||
proc->frame_rx = f;
|
||||
proc->timestamp_rx = ((proc->frame_rx * 10) + proc->tti_rx ) * fp->samples_per_tti ;
|
||||
|
||||
// proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
|
||||
if (get_nprocs()<=4) {
|
||||
proc->tti_tx = (sf+sf_ahead)%10;
|
||||
proc->frame_tx= (sf>(9-sf_ahead)) ? (f+1)&1023 : f;
|
||||
proc->tti_tx = (sf+sf_ahead)%10;
|
||||
proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f;
|
||||
}
|
||||
|
||||
LOG_D(PHY,"Setting proc for (%d,%d)\n",sf,f);
|
||||
|
||||
if (proc->first_rx == 0) {
|
||||
if (proc->tti_rx != *subframe) {
|
||||
LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->tti_rx %d, subframe %d, symbol_mask %x)\n",
|
||||
proc->tti_rx,*subframe,proc->symbol_mask[*subframe]);
|
||||
LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->tti_rx %d, subframe %d, symbol_mask %x)\n", proc->tti_rx, *subframe, proc->symbol_mask[*subframe]);
|
||||
*subframe=sf;
|
||||
//exit_fun("Exiting");
|
||||
}
|
||||
@@ -302,7 +300,7 @@ void fh_if4p5_south_in(RU_t *ru,
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx );
|
||||
}*/
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN_RU +ru->idx,f );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,f);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,sf);
|
||||
proc->symbol_mask[sf] = 0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff);
|
||||
@@ -483,11 +481,9 @@ void fh_if4p5_north_asynch_in(RU_t *ru,
|
||||
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
uint16_t packet_type;
|
||||
uint32_t symbol_number,symbol_mask,symbol_mask_full;
|
||||
int tti_tx,frame_tx, ret;
|
||||
uint32_t symbol_number = 0, symbol_mask = 0, symbol_mask_full;
|
||||
int tti_tx, frame_tx, ret;
|
||||
LOG_D(PHY, "%s(ru:%p frame, subframe)\n", __FUNCTION__, ru);
|
||||
symbol_number = 0;
|
||||
symbol_mask = 0;
|
||||
symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
|
||||
LOG_D(PHY,"fh_if4p5_north_asynch_in: RU %d, frame %d, subframe %d\n", ru->idx, *frame, *subframe);
|
||||
|
||||
@@ -506,7 +502,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,
|
||||
|
||||
if ((subframe_select(fp,tti_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul);
|
||||
|
||||
LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", *subframe,subframe_select(fp,*subframe),frame_tx,tti_tx,symbol_number);
|
||||
LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", *subframe, subframe_select(fp,*subframe), frame_tx, tti_tx, symbol_number);
|
||||
|
||||
if (proc->first_tx != 0) {
|
||||
*frame = frame_tx;
|
||||
@@ -529,8 +525,8 @@ void fh_if4p5_north_asynch_in(RU_t *ru,
|
||||
if (subframe_select(fp,tti_tx) == SF_DL) stop_meas(&ru->rx_fhaul);
|
||||
|
||||
ru->north_in_cnt++;
|
||||
proc->tti_tx = tti_tx;
|
||||
proc->frame_tx= frame_tx;
|
||||
proc->tti_tx = tti_tx;
|
||||
proc->frame_tx = frame_tx;
|
||||
|
||||
if ((frame_tx == 0)&&(tti_tx == 0)) proc->frame_tx_unwrap += 1024;
|
||||
|
||||
@@ -545,9 +541,9 @@ void fh_if4p5_north_asynch_in(RU_t *ru,
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, tti_tx);
|
||||
}
|
||||
|
||||
if (ru->feptx_ofdm) ru->feptx_ofdm(ru,frame_tx,tti_tx);
|
||||
if (ru->feptx_ofdm) ru->feptx_ofdm(ru, frame_tx, tti_tx);
|
||||
|
||||
if (ru->fh_south_out) ru->fh_south_out(ru,frame_tx,tti_tx,proc->timestamp_tx);
|
||||
if (ru->fh_south_out) ru->fh_south_out(ru, frame_tx, tti_tx, proc->timestamp_tx);
|
||||
}
|
||||
|
||||
|
||||
@@ -563,7 +559,7 @@ void fh_if5_north_out(RU_t *ru) {
|
||||
|
||||
// RRU IF4p5 northbound interface (RX)
|
||||
void fh_if4p5_north_out(RU_t *ru) {
|
||||
RU_proc_t *proc=&ru->proc;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
|
||||
const int subframe = proc->tti_rx;
|
||||
|
||||
@@ -573,7 +569,7 @@ void fh_if4p5_north_out(RU_t *ru) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT, proc->frame_rx );
|
||||
}
|
||||
|
||||
LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n",proc->frame_rx,proc->tti_rx);
|
||||
LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n", proc->frame_rx, proc->tti_rx);
|
||||
|
||||
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) {
|
||||
/// **** in TDD during DL send_IF4 of ULTICK to RCC **** ///
|
||||
@@ -590,11 +586,11 @@ void fh_if4p5_north_out(RU_t *ru) {
|
||||
|
||||
/* add fail safe for late command */
|
||||
typedef enum {
|
||||
STATE_BURST_NORMAL = 0,
|
||||
STATE_BURST_NORMAL = 0,
|
||||
STATE_BURST_TERMINATE = 1,
|
||||
STATE_BURST_STOP_1 = 2,
|
||||
STATE_BURST_STOP_2 = 3,
|
||||
STATE_BURST_RESTART = 4,
|
||||
STATE_BURST_STOP_1 = 2,
|
||||
STATE_BURST_STOP_2 = 3,
|
||||
STATE_BURST_RESTART = 4,
|
||||
} late_control_e;
|
||||
|
||||
volatile late_control_e late_control=STATE_BURST_NORMAL;
|
||||
@@ -683,7 +679,11 @@ void rx_rf(RU_t *ru,
|
||||
resynch=1;
|
||||
}
|
||||
|
||||
proc->timestamp_rx = ts-ru->ts_offset;
|
||||
if(get_softmodem_params()->emulate_rf) {
|
||||
proc->timestamp_rx = old_ts + fp->samples_per_tti;
|
||||
} else {
|
||||
proc->timestamp_rx = ts-ru->ts_offset;
|
||||
}
|
||||
|
||||
// AssertFatal(rxs == fp->samples_per_tti,
|
||||
// "rx_rf: Asked for %d samples, got %d from SDR\n",fp->samples_per_tti,rxs);
|
||||
@@ -740,7 +740,7 @@ void rx_rf(RU_t *ru,
|
||||
|
||||
if (ru->fh_north_asynch_in == NULL) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_rx );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -931,11 +931,12 @@ static void *ru_thread_asynch_rxtx( void *param ) {
|
||||
|
||||
// asynchronous receive from south (Mobipass)
|
||||
if (ru->fh_south_asynch_in) {
|
||||
ru->fh_south_asynch_in(ru,&frame,&subframe);
|
||||
ru->fh_south_asynch_in(ru, &frame, &subframe);
|
||||
}
|
||||
// asynchronous receive from north (RRU IF4/IF5)
|
||||
else if (ru->fh_north_asynch_in) {
|
||||
if (subframe_select(ru->frame_parms,subframe)!=SF_UL) ru->fh_north_asynch_in(ru,&frame,&subframe);
|
||||
if (subframe_select(ru->frame_parms,subframe)!=SF_UL)
|
||||
ru->fh_north_asynch_in(ru, &frame, &subframe);
|
||||
} else
|
||||
AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
|
||||
}
|
||||
@@ -1170,9 +1171,7 @@ void do_ru_synch(RU_t *ru) {
|
||||
}
|
||||
|
||||
|
||||
int check_sync(RU_t *ru,
|
||||
RU_t *ru_master,
|
||||
int subframe) {
|
||||
int check_sync(RU_t *ru, RU_t *ru_master, int subframe) {
|
||||
if (fabs(ru_master->proc.t[subframe].tv_nsec - ru->proc.t[subframe].tv_nsec) > 500000)
|
||||
return 0;
|
||||
|
||||
@@ -1182,23 +1181,22 @@ int check_sync(RU_t *ru,
|
||||
|
||||
void wakeup_L1s(RU_t *ru) {
|
||||
PHY_VARS_eNB **eNB_list = ru->eNB_list;
|
||||
LOG_D(PHY,"wakeup_L1s (num %d) for RU %d (%d.%d)\n", ru->num_eNB, ru->idx, ru->proc.frame_rx,ru->proc.tti_rx);
|
||||
PHY_VARS_eNB *eNB = eNB_list[0];
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
PHY_VARS_eNB *eNB = eNB_list[0];
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
struct timespec t;
|
||||
LOG_D(PHY,"wakeup_L1s (num %d) for RU %d ru->eNB_top:%p\n", ru->num_eNB, ru->idx, ru->eNB_top);
|
||||
LOG_D(PHY, "wakeup_L1s (num %d) for RU %d (%d.%d) ru->eNB_top:%p\n", ru->num_eNB, ru->idx, ru->proc.frame_rx, ru->proc.tti_rx, ru->eNB_top);
|
||||
// call eNB function directly
|
||||
char string[20];
|
||||
sprintf(string,"Incoming RU %d",ru->idx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU +ru->idx, ru->proc.frame_rx);
|
||||
sprintf(string, "Incoming RU %d", ru->idx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.tti_rx);
|
||||
AssertFatal(0==pthread_mutex_lock(&proc->mutex_RU),"");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 1);
|
||||
//printf("wakeup_L1s: Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n",
|
||||
// ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,ru->wait_cnt,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx]);
|
||||
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
|
||||
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
|
||||
clock_gettime(CLOCK_MONOTONIC,&ru->proc.t[ru->proc.tti_rx]);
|
||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
|
||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
|
||||
clock_gettime(CLOCK_MONOTONIC, &ru->proc.t[ru->proc.tti_rx]);
|
||||
|
||||
if (proc->RU_mask[ru->proc.tti_rx] == 0) {
|
||||
//clock_gettime(CLOCK_MONOTONIC,&proc->t[ru->proc.subframe_rx]);
|
||||
@@ -1214,21 +1212,21 @@ void wakeup_L1s(RU_t *ru) {
|
||||
eNB->RU_list[i]->idx, eNB->RU_list[i]->proc.frame_rx, eNB->RU_list[i]->proc.tti_rx, ru_states[eNB->RU_list[i]->state]);
|
||||
|
||||
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) {
|
||||
// AssertFatal((proc->RU_mask&(1<<i)) == 0, "eNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n",eNB->Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask);
|
||||
//AssertFatal((proc->RU_mask&(1<<i)) == 0, "eNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n", eNB->Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask);
|
||||
proc->RU_mask[ru->proc.tti_rx] |= (1<<i);
|
||||
} else if (/*eNB->RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0)) {
|
||||
} else if (/*eNB->RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0) ) {
|
||||
proc->RU_mask[ru->proc.tti_rx] |= (1<<i);
|
||||
}
|
||||
|
||||
//printf("RU %d, RU_mask[%d] %d, i %d, frame %d, slave %d, ru->cnt %d, i->cnt %d\n",ru->idx,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx],i,ru->proc.frame_rx,ru->is_slave,ru->wait_cnt,eNB->RU_list[i]->wait_cnt);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.tti_rx]);
|
||||
|
||||
if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.tti_rx]&(1<<i)) == 1) && eNB->RU_list[i]->state == RU_RUN) { // This is master & the RRU has already been received
|
||||
if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.tti_rx) == 0)
|
||||
if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.tti_rx]&(1<<i)) == 1 ) && eNB->RU_list[i]->state == RU_RUN) { //This is master & the RRU has already been received
|
||||
if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.tti_rx) == 0)
|
||||
LOG_E(PHY,"RU %d is not SYNC, subframe %d, time %f this is master\n",
|
||||
eNB->RU_list[i]->idx, ru->proc.tti_rx, fabs(eNB->RU_list[i]->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec));
|
||||
} else if (ru->is_slave == 1 && ru->state == RU_RUN && ( (proc->RU_mask[ru->proc.tti_rx]&(1<<0)) == 1)) { // master already received. TODO: we assume that RU0 is master.
|
||||
if (check_sync(ru,eNB->RU_list[0],ru->proc.tti_rx) == 0)
|
||||
if (check_sync(ru,eNB->RU_list[0],ru->proc.tti_rx) == 0)
|
||||
LOG_E(PHY,"RU %d is not SYNC time, subframe %d, time %f\n",
|
||||
ru->idx, ru->proc.tti_rx, fabs(ru->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec));
|
||||
}
|
||||
@@ -1241,16 +1239,14 @@ void wakeup_L1s(RU_t *ru) {
|
||||
LOG_D(PHY,"ru_mask is %d \n ", proc->RU_mask[ru->proc.tti_rx]);
|
||||
LOG_D(PHY,"the number of RU is %d, the current ru is RU %d \n ", (1<<eNB->num_RU)-1, ru->idx);
|
||||
LOG_D(PHY,"ru->proc.subframe_rx is %d \n", ru->proc.tti_rx);
|
||||
LOG_D(PHY,"Reseting mask frame %d, subframe %d, this is RU %d\n",ru->proc.frame_rx, ru->proc.tti_rx, ru->idx);
|
||||
LOG_D(PHY,"Resetting mask frame %d, subframe %d, this is RU %d\n", ru->proc.frame_rx, ru->proc.tti_rx, ru->idx);
|
||||
proc->RU_mask[ru->proc.tti_rx] = 0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.tti_rx]);
|
||||
clock_gettime(CLOCK_MONOTONIC,&t);
|
||||
//stop_meas(&proc->ru_arrival_time);
|
||||
/* AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000,
|
||||
"Time difference for subframe %d (Frame %d) => %lu > 5ms, this is RU %d\n",
|
||||
ru->proc.subframe_rx, ru->proc.frame_rx, t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec, ru->idx);
|
||||
*/
|
||||
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
|
||||
/*AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000, "Time difference for subframe %d (Frame %d) => %lu > 5ms, this is RU %d\n",
|
||||
ru->proc.subframe_rx, ru->proc.frame_rx, t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec, ru->idx);*/
|
||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
|
||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
|
||||
AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 0 );
|
||||
@@ -1290,7 +1286,7 @@ void wakeup_L1s(RU_t *ru) {
|
||||
}
|
||||
|
||||
|
||||
static inline int wakeup_prach_ru(RU_t *ru) {
|
||||
void wakeup_prach_ru(RU_t *ru) {
|
||||
struct timespec wait;
|
||||
int time_ns = 5000000L, ret;
|
||||
clock_gettime(CLOCK_REALTIME,&wait);
|
||||
@@ -1320,14 +1316,12 @@ static inline int wakeup_prach_ru(RU_t *ru) {
|
||||
} else LOG_W(PHY,"RU prach thread busy, skipping\n");
|
||||
|
||||
AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach ))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
inline int wakeup_prach_ru_br(RU_t *ru) {
|
||||
int ret;
|
||||
void wakeup_prach_ru_br(RU_t *ru) {
|
||||
struct timespec wait;
|
||||
int time_ns = 5000000L;
|
||||
int time_ns = 5000000L, ret;
|
||||
clock_gettime(CLOCK_REALTIME,&wait);
|
||||
wait.tv_nsec += time_ns;
|
||||
|
||||
@@ -1348,15 +1342,12 @@ inline int wakeup_prach_ru_br(RU_t *ru) {
|
||||
} else LOG_W(PHY,"RU prach thread busy, skipping\n");
|
||||
|
||||
AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach_br ))==0,"mutex_unlock returns %d\n",ret);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this is for RU with local RF unit
|
||||
void fill_rf_config(RU_t *ru,
|
||||
char *rf_config_file) {
|
||||
int i;
|
||||
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
|
||||
openair0_config_t *cfg = &ru->openair0_cfg;
|
||||
//printf("////////////////numerology in config = %d\n",numerology);
|
||||
@@ -1418,9 +1409,8 @@ void fill_rf_config(RU_t *ru,
|
||||
cfg->num_rb_dl=fp->N_RB_DL;
|
||||
cfg->tx_num_channels=ru->nb_tx;
|
||||
cfg->rx_num_channels=ru->nb_rx;
|
||||
cfg->clock_source=get_softmodem_params()->clock_source;
|
||||
|
||||
for (i=0; i<ru->nb_tx; i++) {
|
||||
for (int i=0; i<ru->nb_tx; i++) {
|
||||
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
|
||||
cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
|
||||
cfg->tx_gain[i] = (double)ru->att_tx;
|
||||
@@ -1609,7 +1599,7 @@ static void *ru_thread_tx( void *param ) {
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n",proc->frame_tx,proc->tti_tx);
|
||||
LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", proc->frame_tx, proc->tti_tx);
|
||||
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
|
||||
|
||||
for(int i = 0; i<ru->num_eNB; i++) {
|
||||
@@ -1641,7 +1631,7 @@ static void *ru_thread_tx( void *param ) {
|
||||
AssertFatal((ret=pthread_mutex_unlock(&eNB_proc->mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
|
||||
AssertFatal((ret=pthread_mutex_lock( &L1_proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret);
|
||||
L1_proc->instance_cnt_RUs = 0;
|
||||
LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n",proc->frame_tx,proc->tti_tx);
|
||||
LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", proc->frame_tx, proc->tti_tx);
|
||||
// the thread can now be woken up
|
||||
LOG_D(PHY,"ru_thread_tx: clearing mask and Waking up L1 thread\n");
|
||||
|
||||
@@ -1664,8 +1654,8 @@ static void *ru_thread_tx( void *param ) {
|
||||
|
||||
|
||||
static void *ru_thread( void *param ) {
|
||||
RU_t *ru = (RU_t *)param;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
RU_t *ru = (RU_t *)param;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
int subframe = 9;
|
||||
int frame = 1023;
|
||||
int resynch_done = 0;
|
||||
@@ -1683,7 +1673,7 @@ static void *ru_thread( void *param ) {
|
||||
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
pthread_setname_np( pthread_self(),"ru thread");
|
||||
LOG_I(PHY,"thread ru created id=%ld\n", syscall(__NR_gettid));
|
||||
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]);
|
||||
LOG_I(PHY,"Starting RU %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]);
|
||||
|
||||
if(get_softmodem_params()->emulate_rf) {
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
@@ -1868,7 +1858,7 @@ static void *ru_thread( void *param ) {
|
||||
wakeup_slaves(proc);
|
||||
|
||||
// do RX front-end processing (frequency-shift, dft) if needed
|
||||
if (ru->feprx) ru->feprx(ru,proc->tti_rx);
|
||||
if (ru->feprx) ru->feprx(ru, proc->tti_rx);
|
||||
|
||||
// wakeup all eNB processes waiting for this RU
|
||||
AssertFatal((ret=pthread_mutex_lock(&proc->mutex_eNBs))==0,"mutex_lock returns %d\n",ret);
|
||||
@@ -1879,8 +1869,8 @@ static void *ru_thread( void *param ) {
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
|
||||
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
|
||||
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
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[ru->eNB_list[0]->Mod_id]->UE_info.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
|
||||
memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_info.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\n");
|
||||
ru->proc.instance_pre_scd++;
|
||||
|
||||
@@ -1896,10 +1886,19 @@ static void *ru_thread( void *param ) {
|
||||
|
||||
AssertFatal((ret=pthread_mutex_unlock(&ru->proc.mutex_pre_scd))==0,"[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n");
|
||||
#endif
|
||||
// wakeup all eNB processes waiting for this RU
|
||||
if (ru->num_eNB>0) wakeup_L1s(ru);
|
||||
|
||||
// wakeup all eNB processes waiting for this RU
|
||||
if (ru->num_eNB>0) wakeup_L1s(ru);
|
||||
|
||||
#ifdef MBMS_EXPERIMENTAL
|
||||
//Workaround ... this must be properly handled
|
||||
if(ru->if_south==LOCAL_RF && ru->function==eNodeB_3GPP && RC.eNB[0][0]!=NULL){
|
||||
if(ru->frame_parms->num_MBSFN_config!=RC.eNB[0][0]->frame_parms.num_MBSFN_config){
|
||||
ru->frame_parms = &RC.eNB[0][0]->frame_parms;//->frame_parms;
|
||||
LOG_W(PHY,"RU MBSFN SF PARAMS Updated\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PHY_TX_THREAD
|
||||
|
||||
if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_eNB==0) {
|
||||
@@ -1911,7 +1910,7 @@ static void *ru_thread( void *param ) {
|
||||
|
||||
if(!(get_softmodem_params()->emulate_rf)) { //if(!emulate_rf){
|
||||
// do outgoing fronthaul (south) if needed
|
||||
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx);
|
||||
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru, proc->frame_tx, proc->tti_tx, proc->timestamp_tx);
|
||||
|
||||
if ((ru->fh_north_out) && (ru->state!=RU_CHECK_SYNC)) ru->fh_north_out(ru);
|
||||
} else {
|
||||
@@ -1959,6 +1958,7 @@ static void *ru_thread( void *param ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// This thread run the initial synchronization like a UE
|
||||
void *ru_thread_synch(void *arg) {
|
||||
RU_t *ru = (RU_t *)arg;
|
||||
@@ -2111,14 +2111,14 @@ static void *eNB_thread_phy_tx( void *param ) {
|
||||
phy_tx_txdataF_end = 1;
|
||||
|
||||
if(pthread_mutex_lock(&ru->proc.mutex_rf_tx) != 0) {
|
||||
LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx);
|
||||
exit_fun( "error locking mutex_rf_tx" );
|
||||
LOG_E(PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx);
|
||||
exit_fun("error locking mutex_rf_tx");
|
||||
}
|
||||
|
||||
if (ru->proc.instance_cnt_rf_tx==-1) {
|
||||
++ru->proc.instance_cnt_rf_tx;
|
||||
ru->proc.frame_tx = proc->frame_phy_tx;
|
||||
ru->proc.tti_tx = proc->subframe_phy_tx;
|
||||
ru->proc.frame_tx = proc->frame_phy_tx;
|
||||
ru->proc.tti_tx = proc->subframe_phy_tx;
|
||||
ru->proc.timestamp_tx = proc->timestamp_phy_tx;
|
||||
// the thread can now be woken up
|
||||
AssertFatal(pthread_cond_signal(&ru->proc.cond_rf_tx) == 0, "ERROR pthread_cond_signal for rf_tx thread\n");
|
||||
@@ -2197,21 +2197,24 @@ int start_rf(RU_t *ru) {
|
||||
}
|
||||
|
||||
int stop_rf(RU_t *ru) {
|
||||
ru->rfdevice.trx_end_func(&ru->rfdevice);
|
||||
if(ru->rfdevice.trx_end_func != NULL) {
|
||||
ru->rfdevice.trx_end_func(&ru->rfdevice);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern void configure_ru(int idx, void *arg);
|
||||
extern void fep_full(RU_t *ru,int subframe);
|
||||
extern void feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
|
||||
extern void feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx);
|
||||
extern void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
|
||||
extern void fep_full(RU_t *ru, int subframe);
|
||||
extern void feptx_ofdm(RU_t *ru, int frame_tx, int tti_tx);
|
||||
extern void feptx_ofdm_2thread(RU_t *ru, int frame_tx, int tti_tx);
|
||||
extern void feptx_prec(RU_t *ru, int frame_tx, int tti_tx);
|
||||
extern void init_fep_thread(RU_t *ru, pthread_attr_t *attr_fep);
|
||||
extern void init_feptx_thread(RU_t *ru, pthread_attr_t *attr_feptx);
|
||||
extern void kill_fep_thread(RU_t *ru);
|
||||
extern void kill_feptx_thread(RU_t *ru);
|
||||
extern void ru_fep_full_2thread(RU_t *ru,int subframe);
|
||||
extern void ru_fep_full_2thread(RU_t *ru, int subframe);
|
||||
extern void *ru_thread_control( void *param );
|
||||
|
||||
|
||||
void reset_proc(RU_t *ru) {
|
||||
@@ -2229,18 +2232,12 @@ void reset_proc(RU_t *ru) {
|
||||
}
|
||||
|
||||
|
||||
extern void *ru_thread_control( void *param );
|
||||
|
||||
|
||||
void init_RU_proc(RU_t *ru) {
|
||||
int i=0,ret;
|
||||
int i=0, ret;
|
||||
RU_proc_t *proc;
|
||||
pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL, *attr_prach=NULL, *attr_asynch=NULL, *attr_synch=NULL, *attr_emulateRF=NULL, *attr_ctrl=NULL;
|
||||
pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL, *attr_prach=NULL, *attr_asynch=NULL, *attr_synch=NULL, *attr_emulateRF=NULL, *attr_ctrl=NULL, *attr_prach_br=NULL;
|
||||
//pthread_attr_t *attr_fep=NULL;
|
||||
pthread_attr_t *attr_prach_br=NULL;
|
||||
#ifndef OCP_FRAMEWORK
|
||||
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
|
||||
#endif
|
||||
proc = &ru->proc;
|
||||
memset((void *)proc,0,sizeof(RU_proc_t));
|
||||
proc->ru = ru;
|
||||
@@ -2344,15 +2341,22 @@ void init_RU_proc(RU_t *ru) {
|
||||
LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__);
|
||||
pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void *)ru );
|
||||
ru->state=RU_RUN;
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
ru->frame_parms->nb_antennas_rx = ru->nb_rx;
|
||||
phy_init_RU(ru);
|
||||
openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
|
||||
if(!get_softmodem_params()->emulate_rf)
|
||||
{
|
||||
fill_rf_config(ru,ru->rf_config_file);
|
||||
init_frame_parms(ru->frame_parms,1);
|
||||
ru->frame_parms->nb_antennas_rx = ru->nb_rx;
|
||||
phy_init_RU(ru);
|
||||
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
|
||||
if (ret < 0) {
|
||||
LOG_I(PHY,"Exiting, cannot load device. Make sure that your SDR board is connected!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (setup_RU_buffers(ru)!=0) {
|
||||
printf("Exiting, cannot initialize RU Buffers\n");
|
||||
exit(-1);
|
||||
if (setup_RU_buffers(ru)!=0) {
|
||||
LOG_I(PHY,"Exiting, cannot initialize RU Buffers\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2617,9 +2621,9 @@ void set_function_spec_param(RU_t *ru) {
|
||||
|
||||
case REMOTE_IF5: // the remote unit is IF5 RRU
|
||||
ru->do_prach = 0;
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_DISABLE) ? fep_full : fep_full; // this is frequency-shift + DFTs
|
||||
ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs
|
||||
ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_DISABLE) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_DISABLE) ? fep_full : fep_full; // this is frequency-shift + DFTs
|
||||
ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs
|
||||
ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_DISABLE) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs
|
||||
|
||||
if (ru->if_timing == synch_to_other) {
|
||||
ru->fh_south_in = fh_slave_south_in; // synchronize to master
|
||||
@@ -2682,24 +2686,16 @@ void set_function_spec_param(RU_t *ru) {
|
||||
|
||||
//extern void RCconfig_RU(void);
|
||||
|
||||
void init_RU(char *rf_config_file,
|
||||
clock_source_t clock_source,
|
||||
clock_source_t time_source,
|
||||
int send_dmrssync) {
|
||||
int ru_id;
|
||||
|
||||
void init_RU(char *rf_config_file, int send_dmrssync) {
|
||||
int ru_id, i, CC_id;
|
||||
RU_t *ru;
|
||||
PHY_VARS_eNB *eNB0 = (PHY_VARS_eNB *)NULL;
|
||||
LTE_DL_FRAME_PARMS *fp = (LTE_DL_FRAME_PARMS *)NULL;
|
||||
int i;
|
||||
int CC_id;
|
||||
// create status mask
|
||||
RC.ru_mask = 0;
|
||||
RC.ru_mask= (1 << RC.nb_RU) - 1;
|
||||
pthread_mutex_init(&RC.ru_mutex,NULL);
|
||||
pthread_cond_init(&RC.ru_cond,NULL);
|
||||
// read in configuration file)
|
||||
printf("configuring RU from file\n");
|
||||
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_CC != 0)
|
||||
for (i=0; i<RC.nb_L1_inst; i++)
|
||||
@@ -2709,25 +2705,23 @@ void init_RU(char *rf_config_file,
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
LOG_D(PHY,"Process RC.ru[%d]\n",ru_id);
|
||||
ru = RC.ru[ru_id];
|
||||
ru = RC.ru[ru_id];
|
||||
ru->rf_config_file = rf_config_file;
|
||||
ru->idx = ru_id;
|
||||
ru->ts_offset = 0;
|
||||
ru->idx = ru_id;
|
||||
ru->ts_offset = 0;
|
||||
|
||||
if (ru->is_slave == 1) {
|
||||
ru->in_synch = 0;
|
||||
ru->in_synch = 0;
|
||||
ru->generate_dmrs_sync = 0;
|
||||
} else {
|
||||
ru->in_synch = 1;
|
||||
ru->generate_dmrs_sync=send_dmrssync;
|
||||
ru->in_synch = 1;
|
||||
ru->generate_dmrs_sync = send_dmrssync;
|
||||
}
|
||||
|
||||
ru->cmd = EMPTY;
|
||||
ru->south_out_cnt= 0;
|
||||
ru->cmd = EMPTY;
|
||||
ru->south_out_cnt = 0;
|
||||
// use eNB_list[0] as a reference for RU frame parameters
|
||||
// NOTE: multiple CC_id are not handled here yet!
|
||||
ru->openair0_cfg.clock_source = clock_source;
|
||||
ru->openair0_cfg.time_source = time_source;
|
||||
|
||||
//ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0;
|
||||
if ((ru->is_slave == 0) && (ru->ota_sync_enable == 1))
|
||||
@@ -2735,11 +2729,6 @@ void init_RU(char *rf_config_file,
|
||||
else
|
||||
ru->generate_dmrs_sync = 0;
|
||||
|
||||
if (ru->generate_dmrs_sync == 1) {
|
||||
generate_ul_ref_sigs();
|
||||
ru->dmrssync = (int16_t *)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t));
|
||||
}
|
||||
|
||||
ru->wakeup_L1_sleeptime = 2000;
|
||||
ru->wakeup_L1_sleep_cnt_max = 3;
|
||||
|
||||
@@ -2758,8 +2747,8 @@ void init_RU(char *rf_config_file,
|
||||
}
|
||||
}
|
||||
|
||||
eNB0 = ru->eNB_list[0];
|
||||
fp = ru->frame_parms;
|
||||
eNB0 = ru->eNB_list[0];
|
||||
fp = ru->frame_parms;
|
||||
LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
|
||||
LOG_D(PHY, "eNB0:%p fp:%p\n", eNB0, fp);
|
||||
|
||||
@@ -2780,14 +2769,14 @@ void init_RU(char *rf_config_file,
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],NB_timing[ru->if_timing],ru->function);
|
||||
LOG_I(PHY, "Initializing RRU descriptor %d : (%s,%s,%d)\n", ru_id, ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function);
|
||||
set_function_spec_param(ru);
|
||||
LOG_I(PHY,"Starting ru_thread %d, is_slave %d, send_dmrs %d\n",ru_id,ru->is_slave,ru->generate_dmrs_sync);
|
||||
LOG_I(PHY, "Starting ru_thread %d, is_slave %d, send_dmrs %d\n", ru_id, ru->is_slave, ru->generate_dmrs_sync);
|
||||
init_RU_proc(ru);
|
||||
} // for ru_id
|
||||
|
||||
// sleep(1);
|
||||
LOG_D(HW,"[lte-softmodem.c] RU threads created\n");
|
||||
LOG_D(HW, "[lte-softmodem.c] RU threads created\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -2934,8 +2923,6 @@ void RCconfig_RU(void) {
|
||||
|
||||
if ( RUParamList.numelt > 0) {
|
||||
RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *));
|
||||
RC.ru_mask=(1<<RC.nb_RU) - 1;
|
||||
printf("Set RU mask to %lx\n",RC.ru_mask);
|
||||
|
||||
for (int j = 0; j < RC.nb_RU; j++) {
|
||||
RC.ru[j] = (RU_t *)malloc(sizeof(RU_t));
|
||||
@@ -2971,6 +2958,27 @@ void RCconfig_RU(void) {
|
||||
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
RC.ru[j]->openair0_cfg.clock_source = unset;
|
||||
}
|
||||
|
||||
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
|
||||
RC.ru[j]->openair0_cfg.time_source = internal;
|
||||
LOG_D(PHY, "RU time source set as internal\n");
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
|
||||
RC.ru[j]->openair0_cfg.time_source = external;
|
||||
LOG_D(PHY, "RU time source set as external\n");
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
|
||||
RC.ru[j]->openair0_cfg.time_source = gpsdo;
|
||||
LOG_D(PHY, "RU time source set as gpsdo\n");
|
||||
} else {
|
||||
LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
RC.ru[j]->openair0_cfg.time_source = unset;
|
||||
}
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
||||
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*! \file lte-softmodem-common.c
|
||||
* \brief Top-level threads for eNodeB
|
||||
* \author Nokia BellLabs France, francois Taburet
|
||||
* \date 2012
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "lte-softmodem.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include <dlfcn.h>
|
||||
static softmodem_params_t softmodem_params;
|
||||
char *parallel_config=NULL;
|
||||
char *worker_config=NULL;
|
||||
double snr_dB=25;
|
||||
|
||||
uint64_t get_softmodem_optmask(void) {
|
||||
return softmodem_params.optmask;
|
||||
}
|
||||
|
||||
uint64_t set_softmodem_optmask(uint64_t bitmask) {
|
||||
softmodem_params.optmask = softmodem_params.optmask | bitmask;
|
||||
return softmodem_params.optmask;
|
||||
}
|
||||
|
||||
softmodem_params_t *get_softmodem_params(void) {
|
||||
return &softmodem_params;
|
||||
}
|
||||
|
||||
void get_common_options(void) {
|
||||
uint32_t online_log_messages;
|
||||
uint32_t glog_level ;
|
||||
uint32_t start_telnetsrv;
|
||||
uint32_t noS1;
|
||||
uint32_t nokrnmod;
|
||||
uint32_t nonbiot;
|
||||
uint32_t rfsim;
|
||||
uint32_t basicsim;
|
||||
char *logmem_filename = NULL;
|
||||
uint32_t do_forms;
|
||||
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
|
||||
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
|
||||
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
|
||||
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
|
||||
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
|
||||
sizeof(cmdline_logparams)/sizeof(paramdef_t));
|
||||
config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
|
||||
set_glog_onlinelog(online_log_messages);
|
||||
}
|
||||
|
||||
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
|
||||
set_glog(glog_level);
|
||||
}
|
||||
|
||||
if (start_telnetsrv) {
|
||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||
}
|
||||
|
||||
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
|
||||
log_mem_filename = &logmem_filename[0];
|
||||
log_mem_flag = 1;
|
||||
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
|
||||
logInit_log_mem();
|
||||
}
|
||||
|
||||
if (noS1) {
|
||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||
}
|
||||
|
||||
if (nokrnmod) {
|
||||
set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
|
||||
}
|
||||
|
||||
if (nonbiot) {
|
||||
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
|
||||
}
|
||||
|
||||
if (rfsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_RFSIM_BIT);
|
||||
}
|
||||
|
||||
if (basicsim) {
|
||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||
}
|
||||
|
||||
if (do_forms) {
|
||||
set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
|
||||
}
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
|
||||
#endif
|
||||
|
||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||
|
||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||
}
|
||||
|
||||
unsigned int is_nos1exec(char *exepath) {
|
||||
if ( strcmp( basename(exepath), "lte-softmodem-nos1") == 0)
|
||||
return 1;
|
||||
|
||||
if ( strcmp( basename(exepath), "lte-uesoftmodem-nos1") == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
//#include "PHY/TOOLS/time_meas.h"
|
||||
|
||||
#ifndef OPENAIR2
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
|
||||
#include "lte-softmodem.h"
|
||||
#include "NB_IoT_interface.h"
|
||||
#include <executables/split_headers.h>
|
||||
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
@@ -113,7 +114,7 @@ uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
|
||||
|
||||
volatile int oai_exit = 0;
|
||||
|
||||
uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
int UE_scan = 1;
|
||||
@@ -150,9 +151,15 @@ char channels[128] = "0";
|
||||
int rx_input_level_dBm;
|
||||
int otg_enabled;
|
||||
|
||||
uint8_t exit_missed_slots=1;
|
||||
uint64_t num_missed_slots=0; // counter for the number of missed slots
|
||||
|
||||
int split73=0;
|
||||
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
|
||||
AssertFatal(false, "Must not be called in this context\n");
|
||||
}
|
||||
void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) {
|
||||
AssertFatal(false, "Must not be called in this context\n");
|
||||
}
|
||||
|
||||
extern void reset_opp_meas(void);
|
||||
extern void print_opp_meas(void);
|
||||
@@ -163,6 +170,7 @@ extern void init_eNB_afterRU(void);
|
||||
int transmission_mode=1;
|
||||
int emulate_rf = 0;
|
||||
int numerology = 0;
|
||||
int usrp_tx_thread = 0;
|
||||
|
||||
THREAD_STRUCT thread_struct;
|
||||
/* struct for ethernet specific parameters given in eNB conf file */
|
||||
@@ -171,7 +179,7 @@ eth_params_t *eth_params;
|
||||
double cpuf;
|
||||
|
||||
int oaisim_flag=0;
|
||||
//threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
@@ -235,24 +243,6 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) {
|
||||
}
|
||||
|
||||
|
||||
void signal_handler(int sig) {
|
||||
void *array[10];
|
||||
size_t size;
|
||||
|
||||
if (sig==SIGSEGV) {
|
||||
// get void*'s for all entries on the stack
|
||||
size = backtrace(array, 10);
|
||||
// print out all the frames to stderr
|
||||
fprintf(stderr, "Error: signal %d:\n", sig);
|
||||
backtrace_symbols_fd(array, size, 2);
|
||||
exit(-1);
|
||||
} else {
|
||||
printf("Linux signal %s...\n",strsignal(sig));
|
||||
exit_function(__FILE__, __FUNCTION__, __LINE__,"softmodem starting exit procedure\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
||||
int ru_id;
|
||||
|
||||
@@ -284,7 +274,7 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
|
||||
static void get_options(void) {
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
get_common_options();
|
||||
get_common_options(SOFTMODEM_ENB_BIT );
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
|
||||
@@ -454,7 +444,7 @@ int restart_L1L2(module_id_t enb_id) {
|
||||
set_function_spec_param(RC.ru[enb_id]);
|
||||
/* reset the list of connected UEs in the MAC, since in this process with
|
||||
* loose all UEs (have to reconnect) */
|
||||
init_UE_list(&RC.mac[enb_id]->UE_list);
|
||||
init_UE_info(&RC.mac[enb_id]->UE_info);
|
||||
LOG_I(ENB_APP, "attempting to create ITTI tasks\n");
|
||||
|
||||
if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
|
||||
@@ -494,6 +484,8 @@ void init_pdcp(void) {
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
|
||||
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_W_MBMS_BIT;
|
||||
|
||||
pdcp_module_init(pdcp_initmask);
|
||||
|
||||
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
|
||||
@@ -535,9 +527,6 @@ int main ( int argc, char **argv )
|
||||
printf("Reading in command-line options\n");
|
||||
get_options ();
|
||||
|
||||
if (is_nos1exec(argv[0]) )
|
||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||
|
||||
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
@@ -559,7 +548,7 @@ int main ( int argc, char **argv )
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
printf("ITTI init, useMME: %i\n",EPC_MODE_ENABLED);
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
|
||||
// allows to forward in wireshark L2 protocol for decoding
|
||||
// initialize mscgen log after ITTI
|
||||
if (get_softmodem_params()->start_msc) {
|
||||
load_module_shlib("msc",NULL,0,&msc_interface);
|
||||
@@ -567,11 +556,6 @@ int main ( int argc, char **argv )
|
||||
|
||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||
init_opt();
|
||||
// to make a graceful exit when ctrl-c is pressed
|
||||
signal(SIGSEGV, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
check_clock();
|
||||
#ifndef PACKAGE_VERSION
|
||||
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
|
||||
@@ -583,17 +567,30 @@ int main ( int argc, char **argv )
|
||||
/* Read configuration */
|
||||
if (RC.nb_inst > 0) {
|
||||
read_config_and_init();
|
||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||
RCconfig_flexran();
|
||||
} 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 */
|
||||
for (i = 0; i < RC.nb_inst; i++) {
|
||||
flexran_agent_start(i);
|
||||
}
|
||||
|
||||
|
||||
/* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks
|
||||
* for monolithic/F1 modes */
|
||||
init_pdcp();
|
||||
|
||||
init_pdcp();
|
||||
|
||||
if (create_tasks(1) < 0) {
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1);
|
||||
@@ -605,9 +602,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)) {
|
||||
@@ -620,7 +614,7 @@ int main ( int argc, char **argv )
|
||||
ctxt.subframe = 0;
|
||||
pdcp_run(&ctxt);
|
||||
}
|
||||
|
||||
|
||||
/* start threads if only L1 or not a CU */
|
||||
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type) || NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) {
|
||||
// init UE_PF_PO and mutex lock
|
||||
@@ -631,31 +625,45 @@ int main ( int argc, char **argv )
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
|
||||
rt_sleep_ns(10*100000000ULL);
|
||||
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
|
||||
LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (NFAPI_MODE==NFAPI_MODE_VNF) {// VNF
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
init_ru_vnf(); // ru pointer is necessary for pre_scd.
|
||||
#endif
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
|
||||
LOG_I(ENB_APP,"START MAIN THREADS\n");
|
||||
// start the main threads
|
||||
number_of_cards = 1;
|
||||
printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
|
||||
|
||||
|
||||
if (RC.nb_L1_inst > 0) {
|
||||
printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
|
||||
init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
|
||||
// for (inst=0;inst<RC.nb_L1_inst;inst++)
|
||||
// for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) phy_init_lte_eNB(RC.eNB[inst][CC_id],0,0);
|
||||
}
|
||||
for (int x=0; x < RC.nb_L1_inst; x++)
|
||||
for (int CC_id=0; CC_id<RC.nb_L1_CC[x]; CC_id++) {
|
||||
L1_rxtx_proc_t *L1proc= &RC.eNB[x][CC_id]->proc.L1_proc;
|
||||
L1proc->threadPool=(tpool_t*)malloc(sizeof(tpool_t));
|
||||
L1proc->respEncode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
L1proc->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
if ( strlen(get_softmodem_params()->threadPoolConfig) > 0 )
|
||||
initTpool(get_softmodem_params()->threadPoolConfig, L1proc->threadPool, true);
|
||||
else
|
||||
initTpool("n", L1proc->threadPool, true);
|
||||
initNotifiedFIFO(L1proc->respEncode);
|
||||
initNotifiedFIFO(L1proc->respDecode);
|
||||
RC.eNB[x][CC_id]->proc.L1_proc_tx.threadPool = L1proc->threadPool;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
printf("wait_eNBs()\n");
|
||||
@@ -667,29 +675,29 @@ int main ( int argc, char **argv )
|
||||
// some initialization is necessary and init_ru_vnf do this.
|
||||
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
printf("Initializing RU threads\n");
|
||||
init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->clock_source,get_softmodem_params()->timing_source,get_softmodem_params()->send_dmrs_sync);
|
||||
init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync);
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
RC.ru[ru_id]->rf_map.card=0;
|
||||
RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
||||
}
|
||||
|
||||
|
||||
config_sync_var=0;
|
||||
|
||||
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) { // PNF
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
|
||||
printf("wait RUs\n");
|
||||
// CI -- Flushing the std outputs for the previous marker to show on the eNB / RRU log file
|
||||
// end of CI modifications
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
// end of CI modifications
|
||||
// wait_RUs() is wrong and over complex!
|
||||
wait_RUs();
|
||||
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
|
||||
// once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
|
||||
printf("ALL RUs ready - init eNBs\n");
|
||||
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_MODE_PNF && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||
init_eNB_afterRU();
|
||||
@@ -707,6 +715,8 @@ int main ( int argc, char **argv )
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
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
|
||||
@@ -734,7 +744,7 @@ int main ( int argc, char **argv )
|
||||
for (int inst = 0; inst < NB_eNB_INST; inst++) {
|
||||
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
|
||||
free_transport(RC.eNB[inst][cc_id]);
|
||||
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
|
||||
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -752,17 +762,17 @@ int main ( int argc, char **argv )
|
||||
|
||||
for(ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
if (RC.ru[ru_id]->rfdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
||||
}
|
||||
|
||||
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
terminate_opt();
|
||||
logClean();
|
||||
printf("Bye.\n");
|
||||
|
||||
+40
-246
@@ -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,71 +29,13 @@
|
||||
#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"
|
||||
#define CONFIG_HLP_ULMAXE "set the eNodeB max ULSCH erros\n"
|
||||
#define CONFIG_HLP_CALUER "set UE RX calibration\n"
|
||||
#define CONFIG_HLP_CALUERM ""
|
||||
#define CONFIG_HLP_CALUERB ""
|
||||
#define CONFIG_HLP_DBGUEPR "UE run normal prach power ramping, but don't continue random-access\n"
|
||||
#define CONFIG_HLP_CALPRACH "UE run normal prach with maximum power, but don't continue random-access\n"
|
||||
#define CONFIG_HLP_NOL2CN "bypass L2 and upper layers\n"
|
||||
#define CONFIG_HLP_SIML1 "activate RF simulator instead of HW\n"
|
||||
#define CONFIG_HLP_NUMUE "number of UE instances\n"
|
||||
#define CONFIG_HLP_UERXG "set UE RX gain\n"
|
||||
#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n"
|
||||
#define CONFIG_HLP_UETXG "set UE TX gain\n"
|
||||
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
|
||||
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
|
||||
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
|
||||
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
|
||||
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
|
||||
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
|
||||
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
|
||||
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
|
||||
#define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n"
|
||||
#define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0"
|
||||
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
|
||||
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
|
||||
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
|
||||
#define CONFIG_HLP_TADV "Set timing_advance\n"
|
||||
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
|
||||
#define CONFIG_HLP_CHOFF "Channel id offset\n"
|
||||
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
|
||||
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
|
||||
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
|
||||
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
|
||||
#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_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"
|
||||
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
|
||||
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
||||
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
||||
#define CONFIG_HLP_TPORT "tracer port\n"
|
||||
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
|
||||
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
|
||||
|
||||
#define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n"
|
||||
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
|
||||
#define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
|
||||
#define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
|
||||
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
|
||||
#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n"
|
||||
#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"
|
||||
|
||||
/***************************************************************************************************************************************/
|
||||
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
|
||||
@@ -124,6 +65,30 @@
|
||||
#define CMDLINE_MEMLOOP_IDX 6
|
||||
#define CMDLINE_DUMPMEMORY_IDX 7
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
|
||||
|
||||
|
||||
#define CONFIG_HLP_SIML1 "activate RF simulator instead of HW\n"
|
||||
#define CONFIG_HLP_NUMUE "number of UE instances\n"
|
||||
#define CONFIG_HLP_UERXG "set UE RX gain\n"
|
||||
#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n"
|
||||
#define CONFIG_HLP_UETXG "set UE TX gain\n"
|
||||
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
|
||||
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
|
||||
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\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_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
|
||||
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
|
||||
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
|
||||
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
|
||||
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
|
||||
#define CONFIG_HLP_TADV "Set timing_advance\n"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
@@ -149,7 +114,6 @@
|
||||
{"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", 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} \
|
||||
}
|
||||
@@ -169,177 +133,20 @@
|
||||
|
||||
#define DEFAULT_DLF 2680000000
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* 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 PHY_TEST softmodem_params.phy_test
|
||||
#define WAIT_FOR_SYNC softmodem_params.wait_for_sync
|
||||
#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag
|
||||
#define CHAIN_OFFSET softmodem_params.chain_offset
|
||||
#define NUMEROLOGY softmodem_params.numerology
|
||||
#define EMULATE_RF softmodem_params.emulate_rf
|
||||
#define CLOCK_SOURCE softmodem_params.clock_source
|
||||
#define TIMING_SOURCE softmodem_params.timing_source
|
||||
#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)},\
|
||||
{"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}, \
|
||||
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 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, 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
|
||||
#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}, \
|
||||
}
|
||||
|
||||
#define CMDLINE_ONLINELOG_IDX 0
|
||||
#define CMDLINE_GLOGLEVEL_IDX 1
|
||||
#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} } , \
|
||||
}
|
||||
|
||||
/***************************************************************************************************************************************/
|
||||
/* */
|
||||
#include "threads_t.h"
|
||||
//extern threads_t threads;
|
||||
|
||||
//extern THREAD_STRUCT thread_struct;
|
||||
THREAD_STRUCT thread_struct;
|
||||
|
||||
static inline void set_parallel_conf(char *parallel_conf) {
|
||||
mapping config[]= {
|
||||
FOREACH_PARALLEL(GENERATE_ENUMTXT)
|
||||
{NULL,-1}
|
||||
};
|
||||
thread_struct.parallel_conf = (PARALLEL_CONF_t)map_str_to_int(config, parallel_conf);
|
||||
if (thread_struct.parallel_conf == -1 ) {
|
||||
LOG_E(ENB_APP,"Impossible value: %s\n", parallel_conf);
|
||||
thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void set_worker_conf(char *worker_conf) {
|
||||
mapping config[]={
|
||||
FOREACH_WORKER(GENERATE_ENUMTXT)
|
||||
{NULL, -1}
|
||||
};
|
||||
thread_struct.worker_conf = (WORKER_CONF_t)map_str_to_int(config, worker_conf);
|
||||
if (thread_struct.worker_conf == -1 ) {
|
||||
LOG_E(ENB_APP,"Impossible value: %s\n", worker_conf);
|
||||
thread_struct.worker_conf = WORKER_DISABLE ;
|
||||
}
|
||||
}
|
||||
|
||||
static inline PARALLEL_CONF_t get_thread_parallel_conf(void) {
|
||||
return thread_struct.parallel_conf;
|
||||
}
|
||||
|
||||
static inline WORKER_CONF_t get_thread_worker_conf(void) {
|
||||
return thread_struct.worker_conf;
|
||||
}
|
||||
|
||||
/*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);
|
||||
*/
|
||||
|
||||
|
||||
#define SOFTMODEM_NOS1_BIT (1<<0)
|
||||
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
|
||||
#define SOFTMODEM_NONBIOT_BIT (1<<2)
|
||||
#define SOFTMODEM_RFSIM_BIT (1<<10)
|
||||
#define SOFTMODEM_BASICSIM_BIT (1<<11)
|
||||
#define SOFTMODEM_SIML1_BIT (1<<12)
|
||||
#define SOFTMODEM_DOFORMS_BIT (1<<15)
|
||||
typedef struct {
|
||||
uint64_t optmask;
|
||||
THREAD_STRUCT thread_struct;
|
||||
char rf_config_file[1024];
|
||||
int phy_test;
|
||||
uint8_t usim_test;
|
||||
int emulate_rf;
|
||||
int wait_for_sync; //eNodeB only
|
||||
int single_thread_flag; //eNodeB only
|
||||
int chain_offset;
|
||||
int numerology;
|
||||
unsigned int start_msc;
|
||||
uint32_t clock_source;
|
||||
uint32_t timing_source;
|
||||
int hw_timing_advance;
|
||||
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)
|
||||
#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
|
||||
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
|
||||
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
|
||||
#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
|
||||
extern uint64_t get_softmodem_optmask(void);
|
||||
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
||||
extern void get_common_options(void);
|
||||
extern softmodem_params_t *get_softmodem_params(void);
|
||||
extern unsigned int is_nos1exec(char *exepath) ;
|
||||
uint64_t get_pdcp_optmask(void);
|
||||
extern pthread_cond_t sync_cond;
|
||||
extern pthread_mutex_t sync_mutex;
|
||||
extern int sync_var;
|
||||
extern double snr_dB;
|
||||
|
||||
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
extern uint64_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;
|
||||
@@ -348,11 +155,14 @@ extern int sync_var;
|
||||
extern int transmission_mode;
|
||||
extern double cpuf;
|
||||
|
||||
extern int emulate_rf;
|
||||
extern int numerology;
|
||||
extern int usrp_tx_thread;
|
||||
|
||||
// In lte-enb.c
|
||||
extern void stop_eNB(int);
|
||||
extern void kill_eNB_proc(int inst);
|
||||
extern void init_eNB(int single_thread_flag,
|
||||
int wait_for_sync);
|
||||
extern void init_eNB(int single_thread_flag, int wait_for_sync);
|
||||
|
||||
// In lte-ru.c
|
||||
extern void stop_ru(RU_t *ru);
|
||||
@@ -361,15 +171,10 @@ 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);
|
||||
extern void init_RU(char *, int send_dmrssync);
|
||||
|
||||
// In lte-ue.c
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
|
||||
openair0_config_t *openair0_cfg);
|
||||
|
||||
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,
|
||||
@@ -384,11 +189,7 @@ extern void init_UE(int nb_inst,
|
||||
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 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);
|
||||
@@ -399,24 +200,17 @@ extern void kill_td_thread(PHY_VARS_eNB *);
|
||||
extern void kill_te_thread(PHY_VARS_eNB *);
|
||||
|
||||
extern void RCConfig_sim(void);
|
||||
extern void init_ocm(double,double);
|
||||
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);
|
||||
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
|
||||
|
||||
+180
-99
@@ -59,6 +59,7 @@
|
||||
#include "UTIL/MATH/oml.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "lte-softmodem.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "T.h"
|
||||
|
||||
@@ -87,7 +88,7 @@ extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||
extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
|
||||
unsigned char _multicast_group, char *multicast_ifname);
|
||||
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
|
||||
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
|
||||
extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind);
|
||||
extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
|
||||
extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
|
||||
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
|
||||
@@ -208,10 +209,10 @@ char uecap_xer[1024];
|
||||
|
||||
|
||||
void init_thread(int sched_runtime,
|
||||
int sched_deadline,
|
||||
int sched_fifo,
|
||||
cpu_set_t *cpuset,
|
||||
char *name)
|
||||
int sched_deadline,
|
||||
int sched_fifo,
|
||||
cpu_set_t *cpuset,
|
||||
char *name)
|
||||
{
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
|
||||
@@ -255,16 +256,16 @@ void init_thread(int sched_runtime,
|
||||
}
|
||||
|
||||
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)
|
||||
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;
|
||||
@@ -397,9 +398,9 @@ void init_UE(int nb_inst,
|
||||
// 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)
|
||||
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);
|
||||
@@ -423,9 +424,9 @@ void init_UE_stub_single_thread(int nb_inst,
|
||||
|
||||
|
||||
void init_UE_stub(int nb_inst,
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
char *emul_iface)
|
||||
int eMBMS_active,
|
||||
int uecap_xer_in,
|
||||
char *emul_iface)
|
||||
{
|
||||
int inst;
|
||||
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
|
||||
@@ -588,7 +589,7 @@ static void *UE_thread_synch(void *arg)
|
||||
LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||
|
||||
if (initial_sync( UE, UE->mode ) == 0) {
|
||||
LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
|
||||
LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %lu, UL %lu), UE_scan_carrier %d\n",
|
||||
(UE->rx_offset<<1) / UE->frame_parms.samples_per_tti,
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
@@ -713,7 +714,7 @@ static void *UE_thread_synch(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
|
||||
LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %lu, UL %lu)\n",
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
@@ -899,7 +900,7 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
unsigned int emulator_absSF;
|
||||
|
||||
void ue_stub_rx_handler(unsigned int num_bytes,
|
||||
char *rx_buffer)
|
||||
char *rx_buffer)
|
||||
{
|
||||
PHY_VARS_UE *UE;
|
||||
UE = PHY_vars_UE_g[0][0];
|
||||
@@ -991,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
|
||||
UE = rtd->UE;
|
||||
|
||||
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_crc_indication_pdu_t));
|
||||
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_harq_indication_pdu_t));
|
||||
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_sr_indication_pdu_t));
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
|
||||
if(ue_thread_id == 0) {
|
||||
phy_stub_ticking->ticking_var = -1;
|
||||
proc->subframe_rx=proc->sub_frame_start;
|
||||
@@ -1063,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
initRefTimes(t3);
|
||||
pickTime(current);
|
||||
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
|
||||
// Not sure whether we should put the memory allocation here and not sure how much memory
|
||||
//we should allocate for each subframe cycle.
|
||||
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t));
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t));
|
||||
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t));
|
||||
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = (nfapi_cqi_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
|
||||
if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
|
||||
LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
|
||||
@@ -1108,6 +1108,50 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (dl_config_req && tx_request_pdu_list) {
|
||||
nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body;
|
||||
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
|
||||
nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i];
|
||||
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
|
||||
i += 1;
|
||||
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
|
||||
"Need PDU following DCI at index %d, but not found\n",
|
||||
i);
|
||||
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
|
||||
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
|
||||
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
|
||||
continue;
|
||||
}
|
||||
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
|
||||
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
|
||||
pdu,
|
||||
dlsch,
|
||||
ue_num);
|
||||
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
|
||||
dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
|
||||
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
|
||||
pdu,
|
||||
ue_num);
|
||||
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE) {
|
||||
dl_config_req_UE_MAC_mch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
|
||||
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
|
||||
pdu,
|
||||
ue_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hi_dci0_req) {
|
||||
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
|
||||
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
|
||||
nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
|
||||
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
|
||||
NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf),
|
||||
pdu,
|
||||
ue_num);
|
||||
}
|
||||
}
|
||||
|
||||
//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
|
||||
for (ue_index=0; ue_index < ue_num; ue_index++) {
|
||||
ue_Mod_id = ue_thread_id + NB_THREAD_INST*ue_index;
|
||||
@@ -1136,15 +1180,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
|
||||
phy_procedures_UE_SL_RX(UE,proc);
|
||||
|
||||
if (dl_config_req!=NULL && tx_request_pdu_list!=NULL) {
|
||||
//if(dl_config_req!= NULL) {
|
||||
dl_config_req_UE_MAC(dl_config_req, ue_Mod_id);
|
||||
}
|
||||
|
||||
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
|
||||
hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id);
|
||||
}
|
||||
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
phy_procedures_UE_SL_TX(UE,proc);
|
||||
}
|
||||
@@ -1183,7 +1218,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
|
||||
next_ra_frame++;
|
||||
|
||||
if(next_ra_frame > 200) {
|
||||
if(next_ra_frame > 500) {
|
||||
// check if we have PRACH opportunity
|
||||
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
|
||||
// The one working strangely...
|
||||
@@ -1252,6 +1287,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
|
||||
}
|
||||
|
||||
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
|
||||
oai_nfapi_cqi_indication(&UL_INFO->cqi_ind);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
|
||||
}
|
||||
|
||||
if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0) {
|
||||
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
|
||||
oai_nfapi_harq_indication(&UL_INFO->harq_ind);
|
||||
@@ -1266,30 +1306,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
|
||||
}
|
||||
|
||||
// Free UL_INFO messages
|
||||
//if(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list != NULL){
|
||||
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list != NULL){
|
||||
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list !=NULL){
|
||||
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
|
||||
//}
|
||||
//if(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list!=NULL){
|
||||
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
|
||||
//}
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
|
||||
free(UL_INFO);
|
||||
UL_INFO = NULL;
|
||||
|
||||
// De-allocate memory of nfapi requests copies before next subframe round
|
||||
if(dl_config_req!=NULL) {
|
||||
if(dl_config_req->vendor_extension!=NULL) {
|
||||
@@ -1307,6 +1323,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
}
|
||||
|
||||
if(tx_request_pdu_list!=NULL) {
|
||||
for (int i = 0; i < tx_req_num_elems; i++) {
|
||||
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) {
|
||||
free(tx_request_pdu_list[i].segments[j].segment_data);
|
||||
tx_request_pdu_list[i].segments[j].segment_data = NULL;
|
||||
}
|
||||
}
|
||||
tx_req_num_elems = 0;
|
||||
free(tx_request_pdu_list);
|
||||
tx_request_pdu_list = NULL;
|
||||
}
|
||||
@@ -1333,6 +1356,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
// Free UL_INFO messages
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
|
||||
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
|
||||
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
|
||||
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
|
||||
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
|
||||
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
|
||||
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
|
||||
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
|
||||
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
|
||||
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
|
||||
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
|
||||
free(UL_INFO);
|
||||
UL_INFO = NULL;
|
||||
|
||||
// thread finished
|
||||
free(arg);
|
||||
return &UE_thread_rxtx_retval;
|
||||
@@ -1409,12 +1448,14 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
|
||||
oai_subframe_ind(timer_frame, timer_subframe);
|
||||
|
||||
if(dl_config_req!= NULL) {
|
||||
dl_config_req_UE_MAC(dl_config_req, Mod_id);
|
||||
AssertFatal(0, "dl_config_req_UE_MAC() not handled\n");
|
||||
//dl_config_req_UE_MAC(dl_config_req, Mod_id);
|
||||
}
|
||||
|
||||
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
|
||||
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
|
||||
hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
|
||||
AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n");
|
||||
//hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
|
||||
//if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
|
||||
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
|
||||
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
|
||||
@@ -1511,6 +1552,23 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
|
||||
* \param arg unused
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) {
|
||||
// we have to write to tell explicitly to the eNB, else it will wait for us forever
|
||||
// we write the next subframe (always write in future of what we received)
|
||||
//
|
||||
struct complex16 v= {0};
|
||||
void *samplesVoid[UE->frame_parms.nb_antennas_tx];
|
||||
|
||||
for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++)
|
||||
samplesVoid[i]=(void *)&v;
|
||||
|
||||
AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice,
|
||||
timestamp+2*UE->frame_parms.samples_per_tti,
|
||||
samplesVoid,
|
||||
1,
|
||||
UE->frame_parms.nb_antennas_tx,
|
||||
1),"");
|
||||
}
|
||||
|
||||
void *UE_thread(void *arg)
|
||||
{
|
||||
@@ -1560,20 +1618,36 @@ void *UE_thread(void *arg)
|
||||
int instance_cnt_synch = UE->proc.instance_cnt_synch;
|
||||
int is_synchronized = UE->is_synchronized;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
|
||||
if (is_synchronized == 0) {
|
||||
if (instance_cnt_synch < 0) { // we can invoke the synch
|
||||
// grab 10 ms of signal and wakeup synch thread
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
|
||||
|
||||
if (UE->mode != loop_through_memory)
|
||||
AssertFatal( UE->frame_parms.samples_per_tti*10 ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti*10,
|
||||
UE->frame_parms.nb_antennas_rx), "");
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (IS_SOFTMODEM_RFSIM ) {
|
||||
for(int sf=0; sf<10; sf++) {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
|
||||
|
||||
AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx), "");
|
||||
write_dummy(UE, timestamp);
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
|
||||
|
||||
AssertFatal( UE->frame_parms.samples_per_tti*10 ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti*10,
|
||||
UE->frame_parms.nb_antennas_rx), "");
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
instance_cnt_synch = ++UE->proc.instance_cnt_synch;
|
||||
@@ -1591,21 +1665,22 @@ 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++)
|
||||
rxp[i] = (void *)&dummy_rx[i][0];
|
||||
|
||||
for (int sf=0; sf<10; sf++)
|
||||
for (int sf=0; sf<10; sf++) {
|
||||
// printf("Reading dummy sf %d\n",sf);
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
|
||||
if (IS_SOFTMODEM_RFSIM )
|
||||
write_dummy(UE, timestamp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // UE->is_synchronized==0
|
||||
@@ -1616,12 +1691,17 @@ void *UE_thread(void *arg)
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (UE->no_timing_correction==0) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
|
||||
AssertFatal(UE->rx_offset ==
|
||||
UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void **)UE->common_vars.rxdata,
|
||||
UE->rx_offset,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
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,
|
||||
×tamp,
|
||||
(void **)UE->common_vars.rxdata,
|
||||
s,
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
if (IS_SOFTMODEM_RFSIM )
|
||||
write_dummy(UE, timestamp);
|
||||
UE->rx_offset-=s;
|
||||
}
|
||||
}
|
||||
|
||||
UE->rx_offset=0;
|
||||
@@ -1662,6 +1742,7 @@ void *UE_thread(void *arg)
|
||||
|
||||
pthread_mutex_unlock(&proc->mutex_rxtx);
|
||||
}
|
||||
usleep(300);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]);
|
||||
@@ -2014,7 +2095,7 @@ void fill_ue_band_info(void)
|
||||
#endif
|
||||
|
||||
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
|
||||
openair0_config_t *openair0_cfg)
|
||||
openair0_config_t *openair0_cfg)
|
||||
{
|
||||
int i, CC_id;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
@@ -2027,7 +2108,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
|
||||
txdata = (int32_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_rx; i++) {
|
||||
LOG_I(PHY, "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",
|
||||
LOG_I(PHY, "Mapping UE CC_id %d, rx_ant %d, freq %lu on card %d, chain %d\n",
|
||||
CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
|
||||
rxdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
@@ -2035,7 +2116,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
|
||||
}
|
||||
|
||||
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
|
||||
LOG_I(PHY, "Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",
|
||||
LOG_I(PHY, "Mapping UE CC_id %d, tx_ant %d, freq %lu on card %d, chain %d\n",
|
||||
CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i );
|
||||
free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
|
||||
txdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) );
|
||||
@@ -2206,8 +2287,8 @@ int init_timer_thread(void)
|
||||
* fix it somehow
|
||||
*/
|
||||
int8_t find_dlsch(uint16_t rnti,
|
||||
PHY_VARS_eNB *eNB,
|
||||
find_type_t type)
|
||||
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
|
||||
*/
|
||||
@@ -79,17 +79,13 @@
|
||||
#include "UTIL/OTG/otg_vars.h"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "create_tasks.h"
|
||||
#endif
|
||||
|
||||
#include "create_tasks.h"
|
||||
#include "system.h"
|
||||
|
||||
|
||||
#include "lte-softmodem.h"
|
||||
|
||||
|
||||
|
||||
/* temporary compilation wokaround (UE/eNB split */
|
||||
uint16_t sf_ahead;
|
||||
|
||||
@@ -117,14 +113,10 @@ uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
|
||||
|
||||
volatile int oai_exit = 0;
|
||||
|
||||
|
||||
clock_source_t clock_source = internal,time_source=internal;
|
||||
|
||||
|
||||
unsigned int mmapped_dma=0;
|
||||
|
||||
|
||||
uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
|
||||
@@ -170,21 +162,17 @@ int rx_input_level_dBm;
|
||||
|
||||
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;
|
||||
|
||||
int usrp_tx_thread = 0;
|
||||
|
||||
|
||||
char *usrp_args=NULL;
|
||||
char *usrp_clksrc=NULL;
|
||||
@@ -270,26 +258,6 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void signal_handler(int sig) {
|
||||
void *array[10];
|
||||
size_t size;
|
||||
|
||||
if (sig==SIGSEGV) {
|
||||
// get void*'s for all entries on the stack
|
||||
size = backtrace(array, 10);
|
||||
// print out all the frames to stderr
|
||||
fprintf(stderr, "Error: signal %d:\n", sig);
|
||||
backtrace_symbols_fd(array, size, 2);
|
||||
exit(-1);
|
||||
} else {
|
||||
char msg[64];
|
||||
sprintf(msg,"Received linux signal %s...\n",strsignal(sig));
|
||||
exit_function(__FILE__, __FUNCTION__, __LINE__,msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
||||
int CC_id;
|
||||
logClean();
|
||||
@@ -315,20 +283,19 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
extern int16_t dlsch_demod_shift;
|
||||
|
||||
static void get_options(void) {
|
||||
int CC_id;
|
||||
int tddflag = 0;
|
||||
char *loopfile = NULL;
|
||||
|
||||
int dumpframe = 0;
|
||||
int timingadv = 0;
|
||||
int CC_id=0;
|
||||
int tddflag=0;
|
||||
char *loopfile=NULL;
|
||||
int dumpframe=0;
|
||||
int timingadv=0;
|
||||
uint8_t nfapi_mode = NFAPI_MONOLITHIC;
|
||||
int simL1flag = 0;
|
||||
int simL1flag =0;
|
||||
|
||||
set_default_frame_parms(frame_parms);
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
/* unknown parameters on command line will be checked in main
|
||||
after all init have been performed */
|
||||
get_common_options();
|
||||
get_common_options(SOFTMODEM_4GUE_BIT );
|
||||
get_uethreads_params();
|
||||
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
|
||||
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
|
||||
@@ -498,7 +465,8 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
|
||||
|
||||
openair0_cfg[card].Mod_id = 0;
|
||||
openair0_cfg[card].num_rb_dl=frame_parms->N_RB_DL;
|
||||
openair0_cfg[card].clock_source = clock_source;
|
||||
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
|
||||
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
|
||||
openair0_cfg[card].tx_num_channels=min(2,frame_parms->nb_antennas_tx);
|
||||
openair0_cfg[card].rx_num_channels=min(2,frame_parms->nb_antennas_rx);
|
||||
|
||||
@@ -592,7 +560,7 @@ int main( int argc, char **argv ) {
|
||||
if (config_mod == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
}
|
||||
|
||||
|
||||
mode = normal_txrx;
|
||||
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
|
||||
set_latency_target();
|
||||
@@ -603,9 +571,6 @@ int main( int argc, char **argv ) {
|
||||
|
||||
get_options ();
|
||||
|
||||
if (is_nos1exec(argv[0]) )
|
||||
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
|
||||
|
||||
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
printf("Running with %d UE instances\n",NB_UE_INST);
|
||||
|
||||
@@ -652,10 +617,7 @@ int main( int argc, char **argv ) {
|
||||
printf ("PDCP PC5S socket\n");
|
||||
pdcp_pc5_socket_init();
|
||||
// to make a graceful exit when ctrl-c is pressed
|
||||
signal(SIGSEGV, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGABRT, signal_handler);
|
||||
set_softmodem_sighandler();
|
||||
check_clock();
|
||||
#ifndef PACKAGE_VERSION
|
||||
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
|
||||
@@ -792,7 +754,7 @@ int main( int argc, char **argv ) {
|
||||
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
|
||||
|
||||
if (IS_SOFTMODEM_SIML1 ) {
|
||||
init_ocm(snr_dB,0);
|
||||
init_ocm();
|
||||
PHY_vars_UE_g[0][0]->no_timing_correction = 1;
|
||||
}
|
||||
|
||||
@@ -814,19 +776,11 @@ int main( int argc, char **argv ) {
|
||||
// wait for end of program
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
//getchar();
|
||||
#if defined(ENABLE_ITTI)
|
||||
printf("Entering ITTI signals handler\n");
|
||||
itti_wait_tasks_end();
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
#else
|
||||
|
||||
while (oai_exit==0)
|
||||
rt_sleep_ns(100000000ULL);
|
||||
|
||||
printf("Terminating application - oai_exit=%d\n",oai_exit);
|
||||
#endif
|
||||
|
||||
// stop threads
|
||||
if(IS_SOFTMODEM_DOFORMS)
|
||||
|
||||
+173
-225
@@ -64,65 +64,52 @@ sim_t sim;
|
||||
|
||||
void init_ru_devices(void);
|
||||
|
||||
void init_RU(char*,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync);
|
||||
void init_RU(char *,int send_dmrssync);
|
||||
|
||||
void *rfsim_top(void *n_frames);
|
||||
|
||||
void wait_RUs(void)
|
||||
{
|
||||
void wait_RUs(void) {
|
||||
int i;
|
||||
|
||||
// wait for all RUs to be configured over fronthaul
|
||||
pthread_mutex_lock(&RC.ru_mutex);
|
||||
|
||||
|
||||
while (RC.ru_mask>0) {
|
||||
pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
|
||||
}
|
||||
|
||||
|
||||
pthread_mutex_unlock(&RC.ru_mutex);
|
||||
|
||||
// copy frame parameters from RU to UEs
|
||||
for (i=0;i<NB_UE_INST;i++) {
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
void wait_eNBs(void)
|
||||
{
|
||||
void wait_eNBs(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void RCConfig_sim(void) {
|
||||
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
|
||||
// Get num RU instances
|
||||
config_getlist( &RUParamList,NULL,0, NULL);
|
||||
RC.nb_RU = RUParamList.numelt;
|
||||
|
||||
AssertFatal(RC.nb_RU>0,"we need at least 1 RU for simulation\n");
|
||||
printf("returned with %d rus\n",RC.nb_RU);
|
||||
|
||||
init_RU(NULL,internal,internal,0);
|
||||
|
||||
printf("Waiting for RUs to get set up\n");
|
||||
init_RU(NULL,0);
|
||||
printf("Waiting for RUs to get set up\n");
|
||||
wait_RUs();
|
||||
|
||||
init_ru_devices();
|
||||
|
||||
static int nframes = 100000;
|
||||
|
||||
AssertFatal(0 == pthread_create(&sim.rfsim_thread,
|
||||
NULL,
|
||||
rfsim_top,
|
||||
(void*)&nframes), "");
|
||||
|
||||
(void *)&nframes), "");
|
||||
}
|
||||
|
||||
|
||||
@@ -165,75 +152,65 @@ extern int subframe_ru_mask,subframe_UE_mask;
|
||||
|
||||
|
||||
int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int ru_id = device->Mod_id;
|
||||
int CC_id = device->CC_id;
|
||||
|
||||
int subframe;
|
||||
int sample_count=0;
|
||||
|
||||
*ptimestamp = sim.last_ru_rx_timestamp[ru_id][CC_id];
|
||||
|
||||
|
||||
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) {
|
||||
while (sim.current_ru_rx_timestamp[ru_id][CC_id]<
|
||||
(nsamps+sim.last_ru_rx_timestamp[ru_id][CC_id])) {
|
||||
(nsamps+sim.last_ru_rx_timestamp[ru_id][CC_id])) {
|
||||
LOG_D(SIM,"RU: current TS %"PRIi64", last TS %"PRIi64", sleeping\n",sim.current_ru_rx_timestamp[ru_id][CC_id],sim.last_ru_rx_timestamp[ru_id][CC_id]);
|
||||
usleep(500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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) {
|
||||
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]);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,1);
|
||||
subframe,(unsigned long long)*ptimestamp,
|
||||
(unsigned long long)sim.current_ru_rx_timestamp[ru_id][CC_id]);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,1);
|
||||
do_UL_sig(&sim,
|
||||
subframe,
|
||||
0, // abstraction_flag
|
||||
RC.ru[ru_id]->frame_parms,
|
||||
0, // frame is only used for abstraction
|
||||
ru_id,
|
||||
CC_id);
|
||||
subframe,
|
||||
0, // abstraction_flag
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
return(nsamps);
|
||||
}
|
||||
|
||||
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_UE_TRX_READ,1);
|
||||
int UE_id = device->Mod_id;
|
||||
int CC_id = device->CC_id;
|
||||
|
||||
int subframe;
|
||||
int sample_count=0;
|
||||
int read_size;
|
||||
int sptti = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti;
|
||||
|
||||
*ptimestamp = sim.last_UE_rx_timestamp[UE_id][CC_id];
|
||||
|
||||
LOG_D(PHY,"UE %d DL simulation 0: UE_trx_read nsamps %d TS %llu (%llu, offset %d) antenna %d\n",
|
||||
UE_id,
|
||||
nsamps,
|
||||
(unsigned long long)sim.current_UE_rx_timestamp[UE_id][CC_id],
|
||||
(unsigned long long)sim.last_UE_rx_timestamp[UE_id][CC_id],
|
||||
(int)(sim.last_UE_rx_timestamp[UE_id][CC_id]%sptti),
|
||||
cc);
|
||||
|
||||
cc);
|
||||
|
||||
if (nsamps < sptti)
|
||||
read_size = nsamps;
|
||||
@@ -242,49 +219,43 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
|
||||
|
||||
while (sample_count<nsamps) {
|
||||
LOG_D(SIM,"UE %d: DL simulation 1: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
|
||||
while (sim.current_UE_rx_timestamp[UE_id][CC_id] <
|
||||
(sim.last_UE_rx_timestamp[UE_id][CC_id]+read_size)) {
|
||||
|
||||
while (sim.current_UE_rx_timestamp[UE_id][CC_id] <
|
||||
(sim.last_UE_rx_timestamp[UE_id][CC_id]+read_size)) {
|
||||
LOG_D(SIM,"UE %d: DL simulation 2: UE_trx_read : current TS %"PRIi64", last TS %"PRIi64", sleeping\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
|
||||
usleep(500);
|
||||
}
|
||||
LOG_D(SIM,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
|
||||
|
||||
LOG_D(SIM,"UE %d: DL simulation 3: UE_trx_read : current TS now %"PRIi64", last TS %"PRIi64"\n",UE_id,sim.current_UE_rx_timestamp[UE_id][CC_id],sim.last_UE_rx_timestamp[UE_id][CC_id]);
|
||||
// if we cross a subframe-boundary
|
||||
subframe = (sim.last_UE_rx_timestamp[UE_id][CC_id]/sptti)%10;
|
||||
|
||||
// tell top-level we are busy
|
||||
// tell top-level we are busy
|
||||
pthread_mutex_lock(&sim.subframe_mutex);
|
||||
sim.subframe_UE_mask|=(1<<UE_id);
|
||||
LOG_D(SIM,"Setting UE_id %d mask to busy (%d)\n",UE_id,sim.subframe_UE_mask);
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
|
||||
|
||||
|
||||
LOG_D(PHY,"UE %d: DL simulation 4: UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu,nsamps %d)\n",
|
||||
UE_id,subframe,(unsigned long long)*ptimestamp,
|
||||
(unsigned long long)sim.current_UE_rx_timestamp[UE_id][CC_id],
|
||||
nsamps);
|
||||
|
||||
UE_id,subframe,(unsigned long long)*ptimestamp,
|
||||
(unsigned long long)sim.current_UE_rx_timestamp[UE_id][CC_id],
|
||||
nsamps);
|
||||
LOG_D(SIM,"UE %d: DL simulation 5: Doing DL simulation for %d samples starting in subframe %d at offset %d\n",
|
||||
UE_id,nsamps,subframe,
|
||||
(int)(sim.last_UE_rx_timestamp[UE_id][CC_id]%sptti));
|
||||
|
||||
UE_id,nsamps,subframe,
|
||||
(int)(sim.last_UE_rx_timestamp[UE_id][CC_id]%sptti));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL,1);
|
||||
do_DL_sig(&sim,
|
||||
subframe,
|
||||
sim.last_UE_rx_timestamp[UE_id][CC_id]%sptti,
|
||||
sptti,
|
||||
0, //abstraction_flag,
|
||||
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
|
||||
UE_id,
|
||||
CC_id);
|
||||
subframe,
|
||||
sim.last_UE_rx_timestamp[UE_id][CC_id]%sptti,
|
||||
sptti,
|
||||
0, //abstraction_flag,
|
||||
&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,
|
||||
UE_id,
|
||||
CC_id);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL,0);
|
||||
LOG_D(PHY,"UE %d: DL simulation 6: UE_trx_read @ TS %"PRIi64" (%"PRIi64")=> frame %d, subframe %d\n",
|
||||
UE_id, sim.current_UE_rx_timestamp[UE_id][CC_id],
|
||||
sim.last_UE_rx_timestamp[UE_id][CC_id],
|
||||
(int)((sim.last_UE_rx_timestamp[UE_id][CC_id]/(sptti*10))&1023),
|
||||
subframe);
|
||||
|
||||
UE_id, sim.current_UE_rx_timestamp[UE_id][CC_id],
|
||||
sim.last_UE_rx_timestamp[UE_id][CC_id],
|
||||
(int)((sim.last_UE_rx_timestamp[UE_id][CC_id]/(sptti*10))&1023),
|
||||
subframe);
|
||||
sim.last_UE_rx_timestamp[UE_id][CC_id] += read_size;
|
||||
sample_count += read_size;
|
||||
}
|
||||
@@ -295,245 +266,222 @@ 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;
|
||||
|
||||
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);
|
||||
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
// compute amplitude of TX signal from first symbol in subframe
|
||||
// note: assumes that the packet is an entire subframe
|
||||
|
||||
// note: assumes that the packet is an entire subframe
|
||||
sim.ru_amp[ru_id] = 0;
|
||||
for (int aa=0; aa<RC.ru[ru_id]->nb_tx; aa++) {
|
||||
sim.ru_amp[ru_id] += (double)signal_energy((int32_t*)buff[aa],frame_parms->ofdm_symbol_size)/(12*frame_parms->N_RB_DL);
|
||||
}
|
||||
sim.ru_amp[ru_id] = sqrt(sim.ru_amp[ru_id]);
|
||||
|
||||
LOG_D(PHY,"Setting amp for RU %d to %f (%d)\n",ru_id,sim.ru_amp[ru_id], dB_fixed((double)signal_energy((int32_t*)buff[0],frame_parms->ofdm_symbol_size)));
|
||||
for (int aa=0; aa<RC.ru[ru_id]->nb_tx; aa++) {
|
||||
sim.ru_amp[ru_id] += (double)signal_energy((int32_t *)buff[aa],frame_parms->ofdm_symbol_size)/(12*frame_parms->N_RB_DL);
|
||||
}
|
||||
|
||||
sim.ru_amp[ru_id] = sqrt(sim.ru_amp[ru_id]);
|
||||
LOG_D(PHY,"Setting amp for RU %d to %f (%d)\n",ru_id,sim.ru_amp[ru_id], dB_fixed((double)signal_energy((int32_t *)buff[0],frame_parms->ofdm_symbol_size)));
|
||||
// tell top-level we are done
|
||||
pthread_mutex_lock(&sim.subframe_mutex);
|
||||
sim.subframe_ru_mask|=(1<<ru_id);
|
||||
LOG_D(SIM,"Setting RU %d to busy\n",ru_id);
|
||||
pthread_mutex_unlock(&sim.subframe_mutex);
|
||||
|
||||
return(nsamps);
|
||||
}
|
||||
|
||||
int UE_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
return(nsamps);
|
||||
}
|
||||
|
||||
void init_ru_devices(){
|
||||
|
||||
|
||||
void init_ru_devices() {
|
||||
module_id_t ru_id;
|
||||
RU_t *ru;
|
||||
|
||||
// allocate memory for RU if not already done
|
||||
if (RC.ru==NULL) RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
|
||||
if (RC.ru==NULL) RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *));
|
||||
|
||||
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
LOG_D(SIM,"Initiaizing rfdevice for RU %d\n",ru_id);
|
||||
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;
|
||||
sim.last_ru_rx_timestamp[ru_id][0] = 0;
|
||||
|
||||
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;
|
||||
sim.last_ru_rx_timestamp[ru_id][0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void init_ue_devices(PHY_VARS_UE *UE) {
|
||||
|
||||
AssertFatal(UE!=NULL,"UE context is not allocated\n");
|
||||
printf("Initializing UE %d.%d\n",UE->Mod_id,UE->CC_id);
|
||||
UE->rfdevice.Mod_id = UE->Mod_id;
|
||||
UE->rfdevice.CC_id = UE->CC_id;
|
||||
UE->rfdevice.trx_start_func = UE_trx_start;
|
||||
UE->rfdevice.trx_read_func = UE_trx_read;
|
||||
UE->rfdevice.trx_write_func = UE_trx_write;
|
||||
UE->rfdevice.trx_end_func = UE_trx_end;
|
||||
UE->rfdevice.trx_stop_func = UE_trx_stop;
|
||||
UE->rfdevice.trx_set_freq_func = UE_trx_set_freq;
|
||||
UE->rfdevice.trx_set_gains_func = UE_trx_set_gains;
|
||||
sim.last_UE_rx_timestamp[UE->Mod_id][UE->CC_id] = 0;
|
||||
AssertFatal(UE!=NULL,"UE context is not allocated\n");
|
||||
printf("Initializing UE %d.%d\n",UE->Mod_id,UE->CC_id);
|
||||
UE->rfdevice.Mod_id = UE->Mod_id;
|
||||
UE->rfdevice.CC_id = UE->CC_id;
|
||||
UE->rfdevice.trx_start_func = UE_trx_start;
|
||||
UE->rfdevice.trx_read_func = UE_trx_read;
|
||||
UE->rfdevice.trx_write_func = UE_trx_write;
|
||||
UE->rfdevice.trx_end_func = UE_trx_end;
|
||||
UE->rfdevice.trx_stop_func = UE_trx_stop;
|
||||
UE->rfdevice.trx_set_freq_func = UE_trx_set_freq;
|
||||
UE->rfdevice.trx_set_gains_func = UE_trx_set_gains;
|
||||
sim.last_UE_rx_timestamp[UE->Mod_id][UE->CC_id] = 0;
|
||||
}
|
||||
|
||||
void init_ocm(double snr_dB,double sinr_dB)
|
||||
{
|
||||
void init_ocm(void) {
|
||||
module_id_t UE_id, ru_id;
|
||||
int CC_id;
|
||||
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
|
||||
init_channelmod();
|
||||
double snr_dB = channelmod_get_snr_dB();
|
||||
double sinr_dB = channelmod_get_sinr_dB();
|
||||
init_channel_vars ();//fp, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
|
||||
|
||||
// initialize channel descriptors
|
||||
LOG_I(PHY,"Initializing channel descriptors (nb_RU %d, nb_UE %d)\n",RC.nb_RU,NB_UE_INST);
|
||||
|
||||
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
|
||||
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);
|
||||
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] =
|
||||
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),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
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),
|
||||
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);
|
||||
|
||||
|
||||
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),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
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),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0);
|
||||
|
||||
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
|
||||
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
|
||||
AssertFatal(sim.RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
|
||||
AssertFatal(sim.UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
|
||||
|
||||
AssertFatal(sim.RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
|
||||
AssertFatal(sim.UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
|
||||
//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;
|
||||
} 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//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;
|
||||
} 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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void update_ocm(double snr_dB,double sinr_dB)
|
||||
{
|
||||
void update_ocm(double snr_dB,double sinr_dB) {
|
||||
module_id_t UE_id, ru_id;
|
||||
int CC_id;
|
||||
|
||||
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
|
||||
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
AssertFatal(sim.RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
|
||||
AssertFatal(sim.UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
|
||||
|
||||
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
|
||||
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
AssertFatal(sim.RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
|
||||
AssertFatal(sim.UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id);
|
||||
//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;
|
||||
} 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;
|
||||
}
|
||||
//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;
|
||||
} 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_channel_vars(void)
|
||||
{
|
||||
|
||||
void init_channel_vars(void) {
|
||||
int i;
|
||||
|
||||
memset(sim.RU_output_mask,0,sizeof(int)*NUMBER_OF_UE_MAX);
|
||||
for (i=0;i<NB_UE_INST;i++)
|
||||
|
||||
for (i=0; i<NB_UE_INST; i++)
|
||||
pthread_mutex_init(&sim.RU_output_mutex[i],NULL);
|
||||
|
||||
memset(sim.UE_output_mask,0,sizeof(int)*NUMBER_OF_RU_MAX);
|
||||
for (i=0;i<RC.nb_RU;i++)
|
||||
pthread_mutex_init(&sim.UE_output_mutex[i],NULL);
|
||||
|
||||
for (i=0; i<RC.nb_RU; i++)
|
||||
pthread_mutex_init(&sim.UE_output_mutex[i],NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *rfsim_top(void *n_frames) {
|
||||
|
||||
|
||||
wait_sync("rfsim_top");
|
||||
printf("Running rfsim with %d frames\n",*(int *)n_frames);
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
if ((subframe_ru_mask_local == ((1<<RC.nb_RU)-1)) &&
|
||||
(subframe_UE_mask_local == ((1<<NB_UE_INST)-1))) all_done=1;
|
||||
else usleep(1500);
|
||||
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);
|
||||
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);
|
||||
|
||||
if ((subframe_ru_mask_local == ((1<<RC.nb_RU)-1)) &&
|
||||
(subframe_UE_mask_local == ((1<<NB_UE_INST)-1))) all_done=1;
|
||||
else usleep(1500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//clear subframe masks for next round
|
||||
pthread_mutex_lock(&sim.subframe_mutex);
|
||||
sim.subframe_ru_mask=0;
|
||||
sim.subframe_UE_mask=0;
|
||||
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;
|
||||
LOG_D(SIM,"RU %d/%d: TS %"PRIi64"\n",ru_id,CC_id,sim.current_ru_rx_timestamp[ru_id][CC_id]);
|
||||
|
||||
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;
|
||||
LOG_D(SIM,"RU %d/%d: TS %"PRIi64"\n",ru_id,CC_id,sim.current_ru_rx_timestamp[ru_id][CC_id]);
|
||||
}
|
||||
for (int UE_inst = 0; UE_inst<NB_UE_INST;UE_inst++) {
|
||||
sim.current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
|
||||
LOG_D(SIM,"UE %d/%d: TS %"PRIi64"\n",UE_inst,CC_id,sim.current_UE_rx_timestamp[UE_inst][CC_id]);
|
||||
|
||||
for (int UE_inst = 0; UE_inst<NB_UE_INST; UE_inst++) {
|
||||
sim.current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
|
||||
LOG_D(SIM,"UE %d/%d: TS %"PRIi64"\n",UE_inst,CC_id,sim.current_UE_rx_timestamp[UE_inst][CC_id]);
|
||||
}
|
||||
if (oai_exit == 1) return((void*)NULL);
|
||||
|
||||
if (oai_exit == 1) return((void *)NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return((void*)NULL);
|
||||
return((void *)NULL);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
|
||||
void init_ocm(double snr_dB,double sinr_dB);
|
||||
void init_ocm(void);
|
||||
|
||||
void update_ocm(double snr_dB,double sinr_dB);
|
||||
|
||||
@@ -37,4 +37,4 @@ void update_ocm(double snr_dB,double sinr_dB);
|
||||
|
||||
void init_channel_vars(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -483,6 +483,27 @@ void configure_rru(int idx,
|
||||
phy_init_RU(ru);
|
||||
}
|
||||
|
||||
static int send_update_rru(RU_t * ru, LTE_DL_FRAME_PARMS * fp){
|
||||
//ssize_t msg_len/*,len*/;
|
||||
int i;
|
||||
//LTE_DL_FRAME_PARMS *fp = &RC.eNB[0][0]->frame_parms;
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
memset((void *)&rru_config_msg,0,sizeof(rru_config_msg));
|
||||
rru_config_msg.type = RRU_config_update;
|
||||
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t);
|
||||
LOG_I(PHY,"Sending RAU tick to RRU %d %lu bytes\n",ru->idx,rru_config_msg.len);
|
||||
|
||||
RRU_config_t *config = (RRU_config_t *)&rru_config_msg.msg[0];
|
||||
config->num_MBSFN_config=fp->num_MBSFN_config;
|
||||
for(i=0; i < fp->num_MBSFN_config; i++){
|
||||
config->MBSFN_config[i] = fp->MBSFN_config[i];
|
||||
LOG_W(PHY,"Configuration send to RAU (num MBSFN %d, MBSFN_SubframeConfig[%d] pattern is %x )\n",config->num_MBSFN_config,i,config->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
|
||||
}
|
||||
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),
|
||||
"RU %d cannot access remote radio\n",ru->idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* ru_thread_control( void* param )
|
||||
{
|
||||
@@ -491,6 +512,7 @@ void* ru_thread_control( void* param )
|
||||
RRU_CONFIG_msg_t rru_config_msg;
|
||||
ssize_t msg_len;
|
||||
int len;
|
||||
int ru_sf_update=0; // SF config update flag (MBSFN)
|
||||
|
||||
// Start IF device if any
|
||||
if (ru->start_if) {
|
||||
@@ -512,6 +534,16 @@ void* ru_thread_control( void* param )
|
||||
if (ru->state == RU_IDLE && ru->if_south != LOCAL_RF)
|
||||
send_tick(ru);
|
||||
|
||||
if (ru->state == RU_RUN && ru->if_south != LOCAL_RF){
|
||||
LTE_DL_FRAME_PARMS *fp = &RC.eNB[0][0]->frame_parms;
|
||||
LOG_D(PHY,"Check MBSFN SF changes\n");
|
||||
if(fp->num_MBSFN_config != ru_sf_update){
|
||||
ru_sf_update = fp->num_MBSFN_config;
|
||||
LOG_W(PHY,"RU SF should be updated ... calling send_update_rru(ru)\n");
|
||||
send_update_rru(ru,fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice,
|
||||
&rru_config_msg,
|
||||
@@ -646,6 +678,30 @@ void* ru_thread_control( void* param )
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RRU_config_update: //RRU
|
||||
if (ru->if_south == LOCAL_RF){
|
||||
LOG_W(PHY,"Configuration update received from RAU \n");
|
||||
|
||||
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;
|
||||
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;
|
||||
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,
|
||||
((RRU_config_t *)&rru_config_msg.msg[0])->MBSFN_config[i].mbsfn_SubframeConfig
|
||||
);
|
||||
}
|
||||
} else LOG_E(PHY,"Received RRU_config msg...Ignoring\n");
|
||||
break;
|
||||
case RRU_config_update_ok: //RAU
|
||||
if (ru->if_south == LOCAL_RF) LOG_E(PHY,"Received RRU_config_update_ok msg...Ignoring\n");
|
||||
else{
|
||||
LOG_W(PHY,"Received RRU_config_update_ok msg...\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case RRU_start: // RRU
|
||||
if (ru->if_south == LOCAL_RF){
|
||||
|
||||
Reference in New Issue
Block a user