Remove set_master_clock_rate from PHY RF API

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 9984e14170
commit db5a21e659

@ -164,8 +164,6 @@ int main(int argc, char **argv) {
srslte_rf_set_rx_gain(&rf, 50);
}
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
// Supress RF messages
srslte_rf_suppress_stdout(&rf);
@ -202,7 +200,6 @@ int main(int argc, char **argv) {
/* set rf_freq */
srslte_rf_set_rx_freq(&rf, 0, (double)channels[freq].fd * MHZ);
srslte_rf_rx_wait_lo_locked(&rf);
INFO("Set rf_freq to %.3f MHz\n", (double) channels[freq].fd * MHZ/1000000);
printf(

@ -785,11 +785,6 @@ int main(int argc, char **argv) {
int srate = srslte_sampling_freq_hz(cell.nof_prb);
if (srate != -1) {
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4*srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000);
float srate_rf = srslte_rf_set_tx_srate(&rf, (double)srate);
if (srate_rf != srate) {

@ -474,12 +474,9 @@ int main(int argc, char **argv) {
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
signal(SIGINT, sig_int_handler);
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
/* set receiver frequency */
printf("Tunning receiver to %.3f MHz\n", (prog_args.rf_freq + prog_args.file_offset_freq) / 1000000);
srslte_rf_set_rx_freq(&rf, prog_args.rf_nof_rx_ant, prog_args.rf_freq + prog_args.file_offset_freq);
srslte_rf_rx_wait_lo_locked(&rf);
uint32_t ntrial = 0;
do {
@ -501,11 +498,6 @@ int main(int argc, char **argv) {
/* set sampling frequency */
int srate = srslte_sampling_freq_hz(cell.nof_prb);
if (srate != -1) {
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4 * srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Setting sampling rate %.2f MHz\n", (float)srate / 1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double) srate);
if (srate_rf != srate) {

@ -123,7 +123,6 @@ int main(int argc, char **argv) {
ERROR("Error opening rf\n");
exit(-1);
}
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
sigset_t sigset;
sigemptyset(&sigset);
@ -134,11 +133,6 @@ int main(int argc, char **argv) {
printf("Set RX gain: %.2f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
float srate = srslte_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) {
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4*rf_rate);
} else {
srslte_rf_set_master_clock_rate(&rf, rf_rate);
}
srate = srslte_rf_set_rx_srate(&rf, rf_rate);
if (srate != rf_rate) {
ERROR("Error setting samplign frequency %.2f MHz\n", rf_rate * 1e-6);
@ -147,7 +141,6 @@ int main(int argc, char **argv) {
}
printf("Correctly RX rate: %.2f MHz\n", srate*1e-6);
srslte_rf_rx_wait_lo_locked(&rf);
srslte_rf_start_rx_stream(&rf, false);

@ -122,7 +122,6 @@ int main(int argc, char **argv) {
ERROR("Error opening rf\n");
exit(-1);
}
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
for (int i = 0; i < nof_rx_antennas; i++) {
buffer[i] = srslte_vec_malloc(3 * sizeof(cf_t) * SRSLTE_SF_LEN_PRB(100));
@ -137,11 +136,6 @@ int main(int argc, char **argv) {
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
int srate = srslte_sampling_freq_hz(nof_prb);
if (srate != -1) {
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4*srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double) srate);
if (srate_rf != srate) {
@ -152,7 +146,6 @@ int main(int argc, char **argv) {
ERROR("Invalid number of PRB %d\n", nof_prb);
exit(-1);
}
srslte_rf_rx_wait_lo_locked(&rf);
srslte_rf_start_rx_stream(&rf, false);
cell.cp = SRSLTE_CP_NORM;

@ -136,14 +136,8 @@ int main(int argc, char **argv) {
ERROR("Error opening rf\n");
exit(-1);
}
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
int srate = srslte_sampling_freq_hz(nof_prb);
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4*srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
int srate = srslte_sampling_freq_hz(nof_prb);
srslte_rf_set_rx_srate(&rf, (double) srate);
srslte_rf_set_tx_srate(&rf, (double) srate);

@ -92,17 +92,9 @@ SRSLTE_API void srslte_rf_flush_buffer(srslte_rf_t *h);
SRSLTE_API bool srslte_rf_has_rssi(srslte_rf_t *h);
SRSLTE_API float srslte_rf_get_rssi(srslte_rf_t *h);
SRSLTE_API float srslte_rf_get_rssi(srslte_rf_t* h);
SRSLTE_API bool srslte_rf_rx_wait_lo_locked(srslte_rf_t *h);
SRSLTE_API void srslte_rf_set_master_clock_rate(srslte_rf_t *h,
double rate);
SRSLTE_API bool srslte_rf_is_master_clock_dynamic(srslte_rf_t *h);
SRSLTE_API double srslte_rf_set_rx_srate(srslte_rf_t *h,
double freq);
SRSLTE_API double srslte_rf_set_rx_srate(srslte_rf_t* h, double freq);
SRSLTE_API double srslte_rf_set_rx_gain(srslte_rf_t *h,
double gain);

@ -49,7 +49,6 @@ class radio {
burst_preamble_samples = 0;
burst_preamble_time_rounded = 0;
master_clock_rate = 0;
cur_tx_srate = 0;
tx_adv_sec = 0;
tx_adv_nsamples = 0;
@ -100,7 +99,6 @@ class radio {
void set_rx_gain(float gain);
void set_tx_rx_gain_offset(float offset);
double set_rx_gain_th(float gain);
void set_master_clock_rate(double rate);
void set_freq_offset(double freq);
void set_tx_freq(uint32_t chan, double freq);
@ -139,7 +137,6 @@ class radio {
uint32_t burst_preamble_samples;
double burst_preamble_time_rounded; // preamble time rounded to sample time
cf_t* zeros;
double master_clock_rate;
double cur_tx_srate;
double tx_adv_sec; // Transmission time advance to compensate for antenna->timestamp delay

@ -173,16 +173,6 @@ int main(int argc, char **argv) {
srslte_rf_set_rx_freq(&rf, 0, uhd_freq);
srslte_rf_set_tx_freq(&rf, 0, uhd_freq);
if (srate > 1e6 && (srate / 1000) > 0) {
if (30720%(srate/1000) == 0) {
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
} else {
srslte_rf_set_master_clock_rate(&rf, 23.04e6);
}
} else {
printf("Invalid sampling rate %d Hz\n", srate);
exit(-1);
}
printf("Setting sampling rate %.2f MHz\n", (float) srate/1000000);
float srate_rf = srslte_rf_set_rx_srate(&rf, (double) srate);
if (srate_rf != srate) {

@ -244,13 +244,6 @@ int rf_blade_close(void *h)
return 0;
}
void rf_blade_set_master_clock_rate(UNUSED void* h, UNUSED double rate) {}
bool rf_blade_is_master_clock_dynamic(UNUSED void* h)
{
return true;
}
double rf_blade_set_rx_srate(void *h, double freq)
{
uint32_t bw;

@ -49,13 +49,7 @@ SRSLTE_API float rf_blade_get_rssi(void *h);
SRSLTE_API bool rf_blade_rx_wait_lo_locked(void *h);
SRSLTE_API void rf_blade_set_master_clock_rate(void *h,
double rate);
SRSLTE_API bool rf_blade_is_master_clock_dynamic(void *h);
SRSLTE_API double rf_blade_set_rx_srate(void *h,
double freq);
SRSLTE_API double rf_blade_set_rx_srate(void* h, double freq);
SRSLTE_API double rf_blade_set_rx_gain(void *h,
double gain);

@ -34,8 +34,6 @@ typedef struct {
int (*srslte_rf_open)(char *args, void **h);
int (*srslte_rf_open_multi)(char *args, void **h, uint32_t nof_channels);
int (*srslte_rf_close)(void *h);
void (*srslte_rf_set_master_clock_rate)(void *h, double rate);
bool (*srslte_rf_is_master_clock_dynamic)(void *h);
double (*srslte_rf_set_rx_srate)(void *h, double freq);
double (*srslte_rf_set_rx_gain)(void *h, double gain);
double (*srslte_rf_set_tx_gain)(void *h, double gain);
@ -77,8 +75,6 @@ static rf_dev_t dev_uhd = {"UHD",
rf_uhd_open,
.srslte_rf_open_multi = rf_uhd_open_multi,
rf_uhd_close,
rf_uhd_set_master_clock_rate,
rf_uhd_is_master_clock_dynamic,
rf_uhd_set_rx_srate,
rf_uhd_set_rx_gain,
rf_uhd_set_tx_gain,
@ -114,8 +110,6 @@ static rf_dev_t dev_blade = {"bladeRF",
rf_blade_open,
.srslte_rf_open_multi = rf_blade_open_multi,
rf_blade_close,
rf_blade_set_master_clock_rate,
rf_blade_is_master_clock_dynamic,
rf_blade_set_rx_srate,
rf_blade_set_rx_gain,
rf_blade_set_tx_gain,
@ -150,8 +144,6 @@ static rf_dev_t dev_soapy = {"soapy",
rf_soapy_open,
rf_soapy_open_multi,
rf_soapy_close,
rf_soapy_set_master_clock_rate,
rf_soapy_is_master_clock_dynamic,
rf_soapy_set_rx_srate,
rf_soapy_set_rx_gain,
rf_soapy_set_tx_gain,
@ -188,8 +180,6 @@ static rf_dev_t dev_zmq = {"zmq",
rf_zmq_open,
.srslte_rf_open_multi = rf_zmq_open_multi,
rf_zmq_close,
rf_zmq_set_master_clock_rate,
rf_zmq_is_master_clock_dynamic,
rf_zmq_set_rx_srate,
rf_zmq_set_rx_gain,
rf_zmq_set_tx_gain,

@ -131,11 +131,6 @@ const char* srslte_rf_name(srslte_rf_t *rf) {
return ((rf_dev_t*) rf->dev)->srslte_rf_devname(rf->handler);
}
bool srslte_rf_rx_wait_lo_locked(srslte_rf_t *rf)
{
return ((rf_dev_t*) rf->dev)->srslte_rf_rx_wait_lo_locked(rf->handler);
}
int srslte_rf_start_rx_stream(srslte_rf_t *rf, bool now)
{
return ((rf_dev_t*) rf->dev)->srslte_rf_start_rx_stream(rf->handler, now);
@ -192,16 +187,6 @@ int srslte_rf_close(srslte_rf_t *rf)
return ((rf_dev_t*) rf->dev)->srslte_rf_close(rf->handler);
}
void srslte_rf_set_master_clock_rate(srslte_rf_t *rf, double rate)
{
((rf_dev_t*) rf->dev)->srslte_rf_set_master_clock_rate(rf->handler, rate);
}
bool srslte_rf_is_master_clock_dynamic(srslte_rf_t *rf)
{
return ((rf_dev_t*) rf->dev)->srslte_rf_is_master_clock_dynamic(rf->handler);
}
double srslte_rf_set_rx_srate(srslte_rf_t *rf, double freq)
{
return ((rf_dev_t*) rf->dev)->srslte_rf_set_rx_srate(rf->handler, freq);

@ -670,23 +670,23 @@ int rf_uhd_close(void* h)
void rf_uhd_set_master_clock_rate(void* h, double rate)
{
rf_uhd_handler_t* handler = (rf_uhd_handler_t*)h;
if (fmod(handler->current_master_clock, rate)) {
if (handler->dynamic_rate) {
uhd_usrp_set_master_clock_rate(handler->usrp, rate, 0);
}
if (handler->dynamic_rate && handler->current_master_clock != rate) {
uhd_usrp_set_master_clock_rate(handler->usrp, rate, 0);
handler->current_master_clock = rate;
}
}
bool rf_uhd_is_master_clock_dynamic(void* h)
{
rf_uhd_handler_t* handler = (rf_uhd_handler_t*)h;
return handler->dynamic_rate;
}
double rf_uhd_set_rx_srate(void* h, double freq)
{
rf_uhd_handler_t* handler = (rf_uhd_handler_t*)h;
// Set master clock rate
if (freq < 10e6) {
rf_uhd_set_master_clock_rate(&handler, 4 * freq);
} else {
rf_uhd_set_master_clock_rate(&handler, freq);
}
if (handler->nof_rx_channels > 1) {
#ifdef UHD_SUPPORTS_COMMAND_TIME
time_t full;
@ -714,6 +714,14 @@ double rf_uhd_set_rx_srate(void* h, double freq)
double rf_uhd_set_tx_srate(void* h, double freq)
{
rf_uhd_handler_t* handler = (rf_uhd_handler_t*)h;
// Set master clock rate
if (freq < 10e6) {
rf_uhd_set_master_clock_rate(&handler, 4 * freq);
} else {
rf_uhd_set_master_clock_rate(&handler, freq);
}
if (handler->nof_tx_channels > 1) {
#ifdef UHD_SUPPORTS_COMMAND_TIME
time_t full;
@ -799,6 +807,7 @@ double rf_uhd_set_rx_freq(void* h, uint32_t ch, double freq)
uhd_usrp_set_rx_freq(handler->usrp, &tune_request, i, &tune_result);
}
}
rf_uhd_rx_wait_lo_locked(handler);
return freq;
}

@ -53,7 +53,6 @@ int rf_rssi_scan(srslte_rf_t *rf, float *freqs, float *rssi, int nof_bands, doub
f = (double) freqs[i];
srslte_rf_set_rx_freq(rf, 0, f);
srslte_rf_rx_wait_lo_locked(rf);
usleep(10000);
srslte_rf_start_rx_stream(rf, false);

@ -601,16 +601,6 @@ int rf_zmq_close(void* h)
return SRSLTE_SUCCESS;
}
void rf_zmq_set_master_clock_rate(void* h, double rate)
{
// Do nothing
}
bool rf_zmq_is_master_clock_dynamic(void* h)
{
return false;
}
void update_rates(rf_zmq_handler_t* handler, double srate)
{
if (handler) {

@ -53,10 +53,6 @@ SRSLTE_API float rf_zmq_get_rssi(void* h);
SRSLTE_API bool rf_zmq_rx_wait_lo_locked(void* h);
SRSLTE_API void rf_zmq_set_master_clock_rate(void* h, double rate);
SRSLTE_API bool rf_zmq_is_master_clock_dynamic(void* h);
SRSLTE_API double rf_zmq_set_rx_srate(void* h, double freq);
SRSLTE_API double rf_zmq_set_rx_gain(void* h, double gain);

@ -177,16 +177,9 @@ int main(int argc, char** argv)
exit(-1);
}
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4 * srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Set RX rate: %.2f MHz\n", srslte_rf_set_rx_srate(&rf, srate) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000);
srslte_rf_rx_wait_lo_locked(&rf);
buffer = malloc(sizeof(cf_t) * flen * 2);
if (!buffer) {

@ -137,16 +137,9 @@ int main(int argc, char** argv)
exit(-1);
}
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4 * srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Set RX rate: %.2f MHz\n", srslte_rf_set_rx_srate(&rf, srate) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000);
srslte_rf_rx_wait_lo_locked(&rf);
buffer = malloc(sizeof(cf_t) * input_len * 2);
if (!buffer) {

@ -157,16 +157,9 @@ int main(int argc, char **argv) {
exit(-1);
}
if (srate < 10e6) {
srslte_rf_set_master_clock_rate(&rf, 4*srate);
} else {
srslte_rf_set_master_clock_rate(&rf, srate);
}
printf("Set RX rate: %.2f MHz\n", srslte_rf_set_rx_srate(&rf, srate) / 1000000);
printf("Set RX gain: %.1f dB\n", srslte_rf_set_rx_gain(&rf, rf_gain));
printf("Set RX freq: %.2f MHz\n", srslte_rf_set_rx_freq(&rf, 0, rf_freq) / 1000000);
srslte_rf_rx_wait_lo_locked(&rf);
buffer = malloc(sizeof(cf_t) * flen * 2);
if (!buffer) {

@ -279,19 +279,8 @@ double radio::set_rx_gain_th(float gain)
return srslte_rf_set_rx_gain_th(&rf_device, gain);
}
void radio::set_master_clock_rate(double rate)
{
if (rate != master_clock_rate) {
srslte_rf_stop_rx_stream(&rf_device);
srslte_rf_set_master_clock_rate(&rf_device, rate);
srslte_rf_start_rx_stream(&rf_device, false);
master_clock_rate = rate;
}
}
void radio::set_rx_srate(double srate)
{
set_master_clock_rate(srate);
srslte_rf_set_rx_srate(&rf_device, srate);
}
@ -332,7 +321,6 @@ float radio::get_rx_gain()
void radio::set_tx_srate(double srate)
{
set_master_clock_rate(srate);
cur_tx_srate = srslte_rf_set_tx_srate(&rf_device, srate);
burst_preamble_samples = (uint32_t) (cur_tx_srate * burst_preamble_sec);
if (burst_preamble_samples > burst_preamble_max_samples) {

Loading…
Cancel
Save