diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c index 103cf1cd94..5ba54f1536 100644 --- a/common/utils/LOG/vcd_signal_dumper.c +++ b/common/utils/LOG/vcd_signal_dumper.c @@ -248,7 +248,8 @@ const char* eurecomVariablesNames[] = { "slot_number_TX1_gNB", "slot_number_RX0_gNB", "slot_number_RX1_gNB", - "ru_tx_ofdm_mask" + "ru_tx_ofdm_mask", + "usrp_send_return" }; const char* eurecomFunctionsNames[] = { @@ -282,6 +283,8 @@ const char* eurecomFunctionsNames[] = { "lock_mutex_ru", "lock_mutex_ru1", "lock_mutex_ru2", + /* uhd signals */ + "trx_write_thread", /* simulation signals */ "do_DL_sig", "do_UL_sig", diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h index 9383b39b1e..d2efdda098 100644 --- a/common/utils/LOG/vcd_signal_dumper.h +++ b/common/utils/LOG/vcd_signal_dumper.h @@ -226,6 +226,7 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB, VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX1_GNB, VCD_SIGNAL_DUMPER_VARIABLES_RU_TX_OFDM_MASK, + VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, VCD_SIGNAL_DUMPER_VARIABLES_END @@ -262,6 +263,8 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU, VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU1, VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU2, + /* uhd signals */ + VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, /* SIMULATION signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL, VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL, diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index b59fae2a0c..ad21819c7d 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -73,10 +73,10 @@ typedef struct { } T_cache_t; /* number of VCD functions (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_FUNCTIONS (247) +#define VCD_NUM_FUNCTIONS (248) /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_VARIABLES (186) +#define VCD_NUM_VARIABLES (187) /* first VCD function (to be kept up to date! see in T_messages.txt) */ #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 387257d145..5374c09712 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -2138,6 +2138,11 @@ ID = VCD_VARIABLE_RU_TX_OFDM_MASK GROUP = ALL:VCD:ENB:VCD_VARIABLE FORMAT = ulong,value VCD_NAME = ru_tx_ofdm_mask +ID = VCD_VARIABLE_USRP_SEND_RETURN + DESC = VCD variable USRP_SEND_RETURN + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value + VCD_NAME = usrp_send_return #functions @@ -2286,6 +2291,11 @@ ID = VCD_FUNCTION_LOCK_MUTEX_RU2 GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value VCD_NAME = lock_mutex_ru2 +ID = VCD_FUNCTION_TRX_WRITE_THREAD + DESC = VCD function TRX_WRITE_THREAD + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value + VCD_NAME = trx_write_thread ID = VCD_FUNCTION_SIM_DO_DL_SIGNAL DESC = VCD function SIM_DO_DL_SIGNAL GROUP = ALL:VCD:ENB:VCD_FUNCTION diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f7d63a94ad..2355c78534 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -735,6 +735,8 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { else flags=4; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags ); + /* if (SF_type == SF_S) { siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0); diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 78f76b6a21..d48755266c 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -49,6 +49,8 @@ #include "common_lib.h" #include "assertions.h" +#include "common/utils/LOG/vcd_signal_dumper.h" + #include #include "usrp_lib.h" @@ -443,7 +445,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, pthread_mutex_lock(&write_thread->mutex_write); if(write_thread->count_write >= MAX_WRITE_THREAD_PACKAGE){ - LOG_W(HW,"Buffer overflow, resetting write package\n"); + LOG_W("Buffer overflow, count_write = %d, start = %d end = %d, resetting write package\n", write_thread->count_write, write_thread->start, write_thread->end); write_thread->end = write_thread->start; write_thread->count_write = 0; } @@ -495,6 +497,7 @@ void *trx_usrp_write_thread(void * arg){ while (write_thread->count_write == 0) { pthread_cond_wait(&write_thread->cond_write,&write_thread->mutex_write); // this unlocks mutex_rxtx while waiting and then locks it again } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 1 ); s = (usrp_state_t *)device->priv; start = write_thread->start; timestamp = write_package[start].timestamp; @@ -506,6 +509,9 @@ void *trx_usrp_write_thread(void * arg){ write_thread->start = (write_thread->start + 1)% MAX_WRITE_THREAD_PACKAGE; write_thread->count_write--; pthread_mutex_unlock(&write_thread->mutex_write); + if(write_thread->count_write != 0){ + LOG_W(HW,"count write = %d, start = %d, end = %d\n", write_thread->count_write, write_thread->start, write_thread->end); + } #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ @@ -552,6 +558,8 @@ void *trx_usrp_write_thread(void * arg){ ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md); } else ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, ret ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 0 ); if(0) break; } @@ -567,7 +575,7 @@ int trx_write_init(openair0_device *device){ write_thread->start = 0; write_thread->end = 0; - write_thread->count_write = 0; + write_thread->count_write = 0; printf("end of tx write thread\n"); pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); diff --git a/targets/RT/USER/gNB_usrp.gtkw b/targets/RT/USER/gNB_usrp.gtkw index e6726e7d9f..6ece894bb6 100644 --- a/targets/RT/USER/gNB_usrp.gtkw +++ b/targets/RT/USER/gNB_usrp.gtkw @@ -1,21 +1,25 @@ [*] [*] GTKWave Analyzer v3.3.61 (w)1999-2014 BSI -[*] Tue Dec 17 15:31:51 2019 +[*] Wed Mar 4 14:05:43 2020 [*] -[dumpfile] "/tmp/gNB.vcd" -[dumpfile_mtime] "Tue Dec 17 15:25:49 2019" -[dumpfile_size] 6343431 +[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] 1517712000 -[size] 1920 1018 -[pos] -9 -33 -*-19.276148 1518358451 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[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] 267 +[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]