Exposed continuous TX mode to ue.conf

master
Ismael Gomez 7 years ago
parent 68cbb6ca7f
commit 3ab74fb552

@ -34,150 +34,152 @@
#define SRSLTE_RADIO_H
typedef struct {
float tx_corr_dc_gain;
float tx_corr_dc_phase;
float tx_corr_iq_i;
float tx_corr_iq_q;
float rx_corr_dc_gain;
float rx_corr_dc_phase;
float rx_corr_iq_i;
float rx_corr_iq_q;
}rf_cal_t;
float tx_corr_dc_gain;
float tx_corr_dc_phase;
float tx_corr_iq_i;
float tx_corr_iq_q;
float rx_corr_dc_gain;
float rx_corr_dc_phase;
float rx_corr_iq_i;
float rx_corr_iq_q;
} rf_cal_t;
namespace srslte {
/* Interface to the RF frontend.
*/
class radio
{
public:
radio() : tr_local_time(1024*10), tr_usrp_time(1024*10), tr_tx_time(1024*10), tr_is_eob(1024*10) {
bzero(&rf_device, sizeof(srslte_rf_t));
bzero(&end_of_burst_time, sizeof(srslte_timestamp_t));
bzero(zeros, burst_preamble_max_samples*sizeof(cf_t));
burst_preamble_sec = 0;
is_start_of_burst = false;
burst_preamble_samples = 0;
burst_preamble_time_rounded = 0;
cur_tx_srate = 0;
tx_adv_sec = 0;
tx_adv_nsamples = 0;
tx_adv_auto = false;
tx_adv_negative = false;
tx_freq = 0;
rx_freq = 0;
trace_enabled = false;
tti = 0;
agc_enabled = false;
radio_is_streaming = false;
is_initialized = false;
};
bool init(char *args = NULL, char *devname = NULL, uint32_t nof_channels = 1);
void stop();
void reset();
bool start_agc(bool tx_gain_same_rx);
void set_burst_preamble(double preamble_us);
void set_tx_adv(int nsamples);
void set_tx_adv_neg(bool tx_adv_is_neg);
void set_manual_calibration(rf_cal_t *calibration);
void get_time(srslte_timestamp_t *now);
bool tx_single(void *buffer, uint32_t nof_samples, srslte_timestamp_t tx_time);
bool tx(void *buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t tx_time);
void tx_end();
bool rx_now(void *buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t *rxd_time);
bool rx_at(void *buffer, uint32_t nof_samples, srslte_timestamp_t rx_time);
void set_tx_gain(float gain);
void set_rx_gain(float gain);
void set_tx_rx_gain_offset(float offset);
double set_rx_gain_th(float gain);
void set_freq_offset(double freq);
void set_tx_freq(double freq);
void set_rx_freq(double freq);
double get_freq_offset();
double get_tx_freq();
double get_rx_freq();
void set_master_clock_rate(double rate);
void set_tx_srate(double srate);
void set_rx_srate(double srate);
float get_tx_gain();
float get_rx_gain();
float get_max_tx_power();
float set_tx_power(float power);
float get_rssi();
bool has_rssi();
void start_trace();
void write_trace(std::string filename);
void set_tti(uint32_t tti);
bool is_first_of_burst();
bool is_init();
void register_error_handler(srslte_rf_error_handler_t h);
protected:
void save_trace(uint32_t is_eob, srslte_timestamp_t *usrp_time);
srslte_rf_t rf_device;
const static uint32_t burst_preamble_max_samples = 30720000; // 30.72 MHz is maximum frequency
double burst_preamble_sec;// Start of burst preamble time (off->on RF transition time)
srslte_timestamp_t end_of_burst_time;
bool is_start_of_burst;
uint32_t burst_preamble_samples;
double burst_preamble_time_rounded; // preamble time rounded to sample time
cf_t zeros[burst_preamble_max_samples];
double cur_tx_srate;
double tx_adv_sec; // Transmission time advance to compensate for antenna->timestamp delay
int tx_adv_nsamples; // Transmision time advance in number of samples
// Define default values for known radios
bool tx_adv_auto;
bool tx_adv_negative;
const static double uhd_default_burst_preamble_sec = 600*1e-6;
const static double uhd_default_tx_adv_samples = 98;
const static double uhd_default_tx_adv_offset_sec = 4*1e-6;
class radio {
public:
radio() : tr_local_time(1024 * 10), tr_usrp_time(1024 * 10), tr_tx_time(1024 * 10), tr_is_eob(1024 * 10) {
bzero(&rf_device, sizeof(srslte_rf_t));
bzero(&end_of_burst_time, sizeof(srslte_timestamp_t));
bzero(zeros, burst_preamble_max_samples * sizeof(cf_t));
burst_preamble_sec = 0;
is_start_of_burst = false;
burst_preamble_samples = 0;
burst_preamble_time_rounded = 0;
cur_tx_srate = 0;
tx_adv_sec = 0;
tx_adv_nsamples = 0;
tx_adv_auto = false;
tx_adv_negative = false;
tx_freq = 0;
rx_freq = 0;
trace_enabled = false;
tti = 0;
agc_enabled = false;
radio_is_streaming = false;
is_initialized = false;
continuous_tx = false;
};
const static double blade_default_burst_preamble_sec = 0.0;
const static double blade_default_tx_adv_samples = 27;
const static double blade_default_tx_adv_offset_sec = 1e-6;
bool init(char *args = NULL, char *devname = NULL, uint32_t nof_channels = 1);
void stop();
void reset();
bool start_agc(bool tx_gain_same_rx);
double tx_freq, rx_freq, freq_offset;
void set_burst_preamble(double preamble_us);
void set_tx_adv(int nsamples);
void set_tx_adv_neg(bool tx_adv_is_neg);
trace<uint32_t> tr_local_time;
trace<uint32_t> tr_usrp_time;
trace<uint32_t> tr_tx_time;
trace<uint32_t> tr_is_eob;
bool trace_enabled;
uint32_t tti;
bool agc_enabled;
void set_manual_calibration(rf_cal_t *calibration);
bool is_initialized = true;;
bool radio_is_streaming;
bool is_continuous_tx();
void set_continuous_tx(bool enable);
uint32_t saved_nof_channels;
char saved_args[128];
char saved_devname[128];
void get_time(srslte_timestamp_t *now);
bool tx_single(void *buffer, uint32_t nof_samples, srslte_timestamp_t tx_time);
bool tx(void *buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t tx_time);
void tx_end();
bool rx_now(void *buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t *rxd_time);
bool rx_at(void *buffer, uint32_t nof_samples, srslte_timestamp_t rx_time);
};
void set_tx_gain(float gain);
void set_rx_gain(float gain);
void set_tx_rx_gain_offset(float offset);
double set_rx_gain_th(float gain);
void set_freq_offset(double freq);
void set_tx_freq(double freq);
void set_rx_freq(double freq);
double get_freq_offset();
double get_tx_freq();
double get_rx_freq();
void set_master_clock_rate(double rate);
void set_tx_srate(double srate);
void set_rx_srate(double srate);
float get_tx_gain();
float get_rx_gain();
float get_max_tx_power();
float set_tx_power(float power);
float get_rssi();
bool has_rssi();
void start_trace();
void write_trace(std::string filename);
void set_tti(uint32_t tti);
bool is_first_of_burst();
bool is_init();
void register_error_handler(srslte_rf_error_handler_t h);
protected:
void save_trace(uint32_t is_eob, srslte_timestamp_t *usrp_time);
srslte_rf_t rf_device;
const static uint32_t burst_preamble_max_samples = 30720000; // 30.72 MHz is maximum frequency
double burst_preamble_sec;// Start of burst preamble time (off->on RF transition time)
srslte_timestamp_t end_of_burst_time;
bool is_start_of_burst;
uint32_t burst_preamble_samples;
double burst_preamble_time_rounded; // preamble time rounded to sample time
cf_t zeros[burst_preamble_max_samples];
double cur_tx_srate;
double tx_adv_sec; // Transmission time advance to compensate for antenna->timestamp delay
int tx_adv_nsamples; // Transmision time advance in number of samples
// Define default values for known radios
bool tx_adv_auto;
bool tx_adv_negative;
const static double uhd_default_burst_preamble_sec = 600 * 1e-6;
const static double uhd_default_tx_adv_samples = 98;
const static double uhd_default_tx_adv_offset_sec = 4 * 1e-6;
const static double blade_default_burst_preamble_sec = 0.0;
const static double blade_default_tx_adv_samples = 27;
const static double blade_default_tx_adv_offset_sec = 1e-6;
double tx_freq, rx_freq, freq_offset;
trace<uint32_t> tr_local_time;
trace<uint32_t> tr_usrp_time;
trace<uint32_t> tr_tx_time;
trace<uint32_t> tr_is_eob;
bool trace_enabled;
uint32_t tti;
bool agc_enabled;
bool continuous_tx;
bool is_initialized;
bool radio_is_streaming;
uint32_t saved_nof_channels;
char saved_args[128];
char saved_devname[128];
};
}
#endif // SRSLTE_RADIO_H

@ -51,11 +51,13 @@ bool radio::init(char *args, char *devname, uint32_t nof_channels)
// Suppress radio stdout
srslte_rf_suppress_stdout(&rf_device);
continuous_tx = false;
tx_adv_auto = true;
// Set default preamble length each known device
// We distinguish by device family, maybe we should calibrate per device
if (strstr(srslte_rf_name(&rf_device), "uhd")) {
burst_preamble_sec = uhd_default_burst_preamble_sec;
continuous_tx = true;
} else if (strstr(srslte_rf_name(&rf_device), "bladerf")) {
burst_preamble_sec = blade_default_burst_preamble_sec;
} else {
@ -111,6 +113,14 @@ void radio::set_burst_preamble(double preamble_us)
burst_preamble_sec = (double) preamble_us/1e6;
}
void radio::set_continuous_tx(bool enable) {
continuous_tx = enable;
}
bool radio::is_continuous_tx() {
return continuous_tx;
}
void radio::set_tx_adv(int nsamples)
{
tx_adv_auto = false;

@ -27,9 +27,6 @@
#ifndef SRSUE_PHCH_COMMON_H
#define SRSUE_PHCH_COMMON_H
#define TX_MODE_CONTINUOUS 1
#include <pthread.h>
#include <string.h>
#include <vector>

@ -64,6 +64,7 @@ typedef struct {
std::string device_args;
std::string time_adv_nsamples;
std::string burst_preamble;
std::string continuous_tx;
}rf_args_t;
typedef struct {

@ -77,6 +77,7 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
("rf.time_adv_nsamples", bpo::value<string>(&args->rf.time_adv_nsamples)->default_value("auto"),
"Transmission time advance")
("rf.burst_preamble_us", bpo::value<string>(&args->rf.burst_preamble)->default_value("auto"), "Transmission time advance")
("rf.continuous_tx", bpo::value<string>(&args->rf.continuous_tx)->default_value("auto"), "Transmit samples continuously to the radio or on bursts (auto/yes/no). Default is auto (yes for UHD, no for rest)")
("rrc.feature_group", bpo::value<uint32_t>(&args->rrc.feature_group)->default_value(0xe6041c00), "Hex value of the featureGroupIndicators field in the"
"UECapabilityInformation message. Default 0xe6041c00")

@ -248,7 +248,7 @@ void phch_common::worker_end(uint32_t tti, bool tx_enable,
radio_h->tx_single(buffer, nof_samples, tx_time);
is_first_of_burst = false;
} else {
if (TX_MODE_CONTINUOUS) {
if (radio_h->is_continuous_tx()) {
if (!is_first_of_burst) {
radio_h->tx_single(zeros, nof_samples, tx_time);
}

@ -160,6 +160,9 @@ bool ue::init(all_args_t *args_)
if (args->rf.burst_preamble.compare("auto")) {
radio.set_burst_preamble(atof(args->rf.burst_preamble.c_str()));
}
if (args->rf.continuous_tx.compare("auto")) {
radio.set_continuous_tx(args->rf.continuous_tx.compare("yes")?false:true);
}
radio.set_manual_calibration(&args->rf_cal);

@ -21,6 +21,8 @@
# Default "auto". B210 USRP: 100 samples, bladeRF: 27.
# burst_preamble_us: Preamble length to transmit before start of burst.
# Default "auto". B210 USRP: 400 us, bladeRF: 0 us.
# continuous_tx: Transmit samples continuously to the radio or on bursts (auto/yes/no).
# Default is auto (yes for UHD, no for rest)
#####################################################################
[rf]
dl_earfcn = 3400
@ -33,6 +35,7 @@ rx_gain = 40
#device_args = auto
#time_adv_nsamples = auto
#burst_preamble_us = auto
#continuous_tx = auto
#####################################################################

Loading…
Cancel
Save