Commit ae3f0f6b authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'nr-emulate-rf' into 'develop-nr'

Nr emulate rf

See merge request oai/openairinterface5g!417
parents c43b8acb 5a3b657f
......@@ -1039,7 +1039,7 @@ extern "C" {
if(device_adds.size() == 0) {
double usrp_master_clock = 184.32e6;
std::string args = "type=x300, addr=192.168.30.2";
std::string args = "type=x300";
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
......
......@@ -1525,9 +1525,10 @@ volatile int16_t phy_tx_end;
static void* ru_thread_tx( void* param ) {
RU_t *ru = (RU_t*)param;
RU_proc_t *proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
char filename[256];
thread_top_init("ru_thread_tx",1,400000,500000,500000);
......@@ -1561,6 +1562,19 @@ static void* ru_thread_tx( void* param ) {
if (ru->fh_north_out) ru->fh_north_out(ru);
}
else {
for (int i=0; i<ru->nb_tx; i++) {
if(proc->frame_tx == 2) {
sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,proc->frame_tx,proc->subframe_tx);
LOG_M(filename,"txdataF_frame",ru->common.txdataF_BF[i],fp->symbols_per_tti*fp->ofdm_symbol_size, 1, 1);
}
if(proc->frame_tx == 2 && proc->subframe_tx==0){
sprintf(filename,"txdata%d_frame%d.m",i,proc->frame_tx);
LOG_M(filename,"txdata_frame",ru->common.txdata[i],fp->samples_per_tti*10, 1, 1);
}
}
}
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
pthread_mutex_lock( &proc->mutex_eNBs );
......@@ -1588,7 +1602,7 @@ static void* ru_thread( void* param ) {
int frame =1023;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
char filename[256];
// set default return value
ru_thread_status = 0;
......@@ -1794,6 +1808,19 @@ static void* ru_thread( void* param ) {
if (ru->fh_north_out) ru->fh_north_out(ru);
}
else {
for (int i=0; i<ru->nb_tx; i++) {
if(proc->frame_tx == 2) {
sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,proc->frame_tx,proc->subframe_tx);
LOG_M(filename,"txdataF_frame",ru->common.txdataF_BF[i],fp->symbols_per_tti*fp->ofdm_symbol_size, 1, 1);
}
if(proc->frame_tx == 2 && proc->subframe_tx==0){
sprintf(filename,"txdata%d_frame%d.m",i,proc->frame_tx);
LOG_M(filename,"txdata_frame",ru->common.txdata[i],fp->samples_per_tti*10, 1, 1);
}
}
}
proc->emulate_rf_busy = 0;
}
#else
......
......@@ -852,7 +852,6 @@ void tx_rf(RU_t *ru) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
proc->timestamp_tx+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
txp,
......@@ -1388,6 +1387,9 @@ static void* ru_thread( void* param ) {
int ret;
int subframe =9;
int frame =1023;
char filename[40];
int print_frame = 2;
int i = 0;
// set default return value
ru_thread_status = 0;
......@@ -1521,14 +1523,31 @@ static void* ru_thread( void* param ) {
// do OFDM if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru);
if (!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);
}
if (ru->fh_north_out) ru->fh_north_out(ru);
}
else
{
if(proc->frame_tx == print_frame)
{
for (i=0; i<ru->nb_tx; i++)
{
sprintf(filename,"tx%ddataF_frame%d_sf%d.m", i, print_frame, proc->subframe_tx);
LOG_M(filename,"txdataF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1);
if(proc->subframe_tx == 9)
{
sprintf(filename,"tx%ddata_frame%d.m", i, print_frame);
LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1);
}
}
}
//else if (proc->frame_tx > print_frame) oai_exit = 1;
}
}
printf( "Exiting ru_thread \n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment