Commit 1396d22d authored by Raymond Knopp's avatar Raymond Knopp

minor changes in openair_device structure (naming of fields), calibration...

minor changes in openair_device structure (naming of fields), calibration information for X310 timing, some initializations from lte-softmodem.c for USRP moved to usrp_lib.cpp
parent ebbdf1e4
......@@ -84,8 +84,10 @@ typedef struct {
double sample_rate;
//! number of samples per RX/TX packet (USRP + Ethernet)
int samples_per_packet;
// delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_delay;
//! delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
int tx_scheduling_advance;
//! offset in samples between TX and RX paths
int tx_sample_advance;
//! adjust the position of the samples after delay when sending
unsigned int tx_forward_nsamps;
//! number of RX channels (=RX antennas)
......
......@@ -404,6 +404,35 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
//s->usrp->set_master_clock_rate(usrp_master_clock);
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
switch (openair0_cfg[0].sample_rate) {
case 30.72e6:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[card].samples_per_packet;
break;
case 15.36e6:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 45;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[card].samples_per_packet;
break;
case 7.6e6:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[card].samples_per_packet;
break;
case 1.92e6:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 50;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[card].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
} else {
printf("Found USRP B200");
s->usrp = uhd::usrp::multi_usrp::make(args);
......@@ -415,9 +444,39 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
// // lock mboard clocks
// s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF
s->usrp->set_master_clock_rate(30.72e6);
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
switch (openair0_cfg[0].sample_rate) {
case 30.72e6:
// from usrp_time_offset
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 175;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[card].samples_per_packet;
break;
case 15.36e6:
openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 95;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[card].samples_per_packet;
break;
case 7.6e6:
openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 70;
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[card].samples_per_packet;
break;
case 1.92e6:
openair0_cfg[0].samples_per_packet = 256;
openair0_cfg[0].tx_sample_advance = 40;
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[card].samples_per_packet;
break;
default:
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
exit(-1);
break;
}
}
......
......@@ -293,10 +293,6 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char ref[128] = "internal";
char channels[128] = "0";
//unsigned int samples_per_frame = 307200;
//unsigned int tx_forward_nsamps=0;
//int tx_delay;
#endif
int rx_input_level_dBm;
......@@ -1559,7 +1555,7 @@ static void* eNB_thread( void* arg )
int hw_subframe = 0; // 0..NUM_ENB_THREADS-1 => 0..9
unsigned int rx_pos = 0;
unsigned int tx_pos = 0; //spp*tx_delay;
unsigned int tx_pos = 0;
#endif
int CC_id=0;
struct timespec trx_time0, trx_time1, trx_time2;
......@@ -1635,7 +1631,8 @@ static void* eNB_thread( void* arg )
#ifndef EXMIMO
spp = openair0_cfg[0].samples_per_packet;
tx_pos=spp*openair0_cfg[0].tx_delay;
tx_pos = openair0_cfg[0].tx_scheduling_advance;
tx_advance = openair0_cfg[0].tx_sample_advance;
#endif
while (!oai_exit) {
......@@ -1796,11 +1793,10 @@ static void* eNB_thread( void* arg )
// prepare tx buffer pointers
for (i=0; i<PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx; i++)
txp[i] = (void*)&txdata[i][tx_pos];
//printf("tx_pos %d ts %d, ts_offset %d txp[i] %p, ap %d\n", tx_pos, timestamp, (timestamp+(tx_delay*spp)-tx_forward_nsamps),txp[i], i);
// if symb_written < spp ==> error
if (frame > 50) {
openair0.trx_write_func(&openair0,
(timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps),
(timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance),
txp,
spp,
PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx,
......@@ -1808,7 +1804,7 @@ static void* eNB_thread( void* arg )
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, timestamp&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance)&0xffffffff );
stop_meas( &softmodem_stats_mt );
clock_gettime( CLOCK_MONOTONIC, &trx_time2 );
......@@ -2847,66 +2843,33 @@ int main( int argc, char **argv )
for (card=0; card<MAX_CARDS; card++) {
if(frame_parms[0]->N_RB_DL == 100) {
sample_rate = 30.72e6;
bw = 10.0e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=30.72e6;
openair0_cfg[card].samples_per_packet = 2048;
openair0_cfg[card].samples_per_frame = 307200;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
// from usrp_time_offset
openair0_cfg[card].tx_forward_nsamps = 175;
openair0_cfg[card].tx_delay = 8;
#endif
} else if(frame_parms[0]->N_RB_DL == 50) {
sample_rate = 15.36e6;
bw = 5.0e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=15.36e6;
openair0_cfg[card].samples_per_packet = 2048;
openair0_cfg[card].samples_per_frame = 153600;
openair0_cfg[card].tx_bw = 5e6;
openair0_cfg[card].rx_bw = 5e6;
openair0_cfg[card].tx_forward_nsamps = 95;
openair0_cfg[card].tx_delay = 5;
#endif
} else if (frame_parms[0]->N_RB_DL == 25) {
sample_rate = 7.68e6;
bw = 2.5e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=7.68e6;
openair0_cfg[card].samples_per_frame = 76800;
openair0_cfg[card].tx_bw = 2.5e6;
openair0_cfg[card].rx_bw = 2.5e6;
openair0_cfg[card].samples_per_packet = 1024;
#ifdef OAI_USRP
openair0_cfg[card].tx_forward_nsamps = 70;
openair0_cfg[card].tx_delay = 5;
#elif OAI_BLADERF
openair0_cfg[card].tx_forward_nsamps = 0;
openair0_cfg[card].tx_delay = 8;
#endif
#endif
} else if (frame_parms[0]->N_RB_DL == 6) {
sample_rate = 1.92e6;
bw = 0.96e6;
#ifndef EXMIMO
openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_packet = 256;
openair0_cfg[card].samples_per_frame = 19200;
openair0_cfg[card].tx_bw = 1.5e6;
openair0_cfg[card].rx_bw = 1.5e6;
openair0_cfg[card].tx_forward_nsamps = 40;
openair0_cfg[card].tx_delay = 8;
#endif
}
#ifdef ETHERNET
//calib needed
openair0_cfg[card].tx_delay = 0;
openair0_cfg[card].tx_forward_nsamps = 0;
openair0_cfg[card].tx_scheduling_advance = 0;
openair0_cfg[card].tx_sample_advance = 0;
if (frame_parms[0]->N_RB_DL == 6)
openair0_cfg[card].samples_per_packet = 256;
......@@ -2917,9 +2880,6 @@ int main( int argc, char **argv )
#endif
#ifndef EXMIMO
openair0_cfg[card].samples_per_packet = openair0_cfg[0].samples_per_packet;
#endif
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_tx),
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_rx));
......@@ -2935,11 +2895,9 @@ int main( int argc, char **argv )
openair0_cfg[card].remote_ip = &rrh_eNB_ip[0];
openair0_cfg[card].remote_port = rrh_eNB_port;
}
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
#endif
openair0_cfg[card].sample_rate = sample_rate;
openair0_cfg[card].tx_bw = bw;
openair0_cfg[card].rx_bw = bw;
// in the case of the USRP, the following variables need to be initialized before the init
// since the USRP only supports one CC (for the moment), we initialize all the cards with first CC.
// in the case of EXMIMO2, these values are overwirtten in the function setup_eNB/UE_buffer
......@@ -3074,7 +3032,7 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
// connect the TX/RX buffers
if (UE_flag==1) {
#ifdef OAI_USRP
openair_daq_vars.timing_advance = 160;
openair_daq_vars.timing_advance = 0;
#else
openair_daq_vars.timing_advance = 160;
#endif
......
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