|
|
|
@ -69,7 +69,7 @@ private:
|
|
|
|
|
const uhd::fs_path TREE_RX_SENSORS = "/mboards/0/dboards/A/rx_frontends/0/sensors";
|
|
|
|
|
const std::string TX_ANTENNA_PORT = "TX/RX";
|
|
|
|
|
const std::string RX_ANTENNA_PORT = "RX2";
|
|
|
|
|
const size_t spp = 246;
|
|
|
|
|
const size_t spp = 1920 / 8;
|
|
|
|
|
|
|
|
|
|
// Primary parameters
|
|
|
|
|
double master_clock_rate = 184.32e6;
|
|
|
|
@ -78,7 +78,6 @@ private:
|
|
|
|
|
size_t nof_channels = 1; ///< Number of Channels per Radio
|
|
|
|
|
std::vector<double> rx_freq_hz;
|
|
|
|
|
std::vector<double> tx_freq_hz;
|
|
|
|
|
size_t nof_samples_per_packet = spp * 4 + 2 * sizeof(uint64_t);
|
|
|
|
|
size_t dma_fifo_depth = 8192UL * 4096UL;
|
|
|
|
|
|
|
|
|
|
// Radio control
|
|
|
|
@ -181,8 +180,11 @@ private:
|
|
|
|
|
radio_ctrl[i]->set_tx_antenna(TX_ANTENNA_PORT, 0);
|
|
|
|
|
|
|
|
|
|
radio_ctrl[i]->enable_rx_timestamps(true, 0);
|
|
|
|
|
|
|
|
|
|
if (spp) {
|
|
|
|
|
radio_ctrl[i]->set_arg("spp", spp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sleep for some time
|
|
|
|
|
std::this_thread::sleep_for(SETUP_TIME_MS);
|
|
|
|
@ -274,6 +276,12 @@ private:
|
|
|
|
|
|
|
|
|
|
uhd_error connect()
|
|
|
|
|
{
|
|
|
|
|
size_t nof_samples_per_packet = 0;
|
|
|
|
|
|
|
|
|
|
if (spp != 0) {
|
|
|
|
|
nof_samples_per_packet = spp * 4 + 2 * sizeof(uint64_t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this,
|
|
|
|
|
|
|
|
|
|
// Get Tx and Rx Graph
|
|
|
|
@ -437,7 +445,8 @@ public:
|
|
|
|
|
this, uhd::stream_args_t stream_args("fc32", "sc16");
|
|
|
|
|
|
|
|
|
|
stream_args.channels.resize(nof_radios * nof_channels);
|
|
|
|
|
stream_args.args["spp"] = std::to_string(spp);
|
|
|
|
|
|
|
|
|
|
if (spp != 0) { stream_args.args["spp"] = std::to_string(spp); }
|
|
|
|
|
|
|
|
|
|
// Populate stream arguments with RF-NOC blocks interfaces
|
|
|
|
|
size_t channel_count = 0;
|
|
|
|
@ -461,7 +470,7 @@ public:
|
|
|
|
|
this, uhd::stream_args_t stream_args("fc32", "sc16");
|
|
|
|
|
|
|
|
|
|
stream_args.channels.resize(nof_radios * nof_channels);
|
|
|
|
|
stream_args.args["spp"] = std::to_string(spp);
|
|
|
|
|
if (spp != 0) { stream_args.args["spp"] = std::to_string(spp); }
|
|
|
|
|
|
|
|
|
|
// Populate stream arguments with RF-NOC blocks interfaces
|
|
|
|
|
size_t channel_count = 0;
|
|
|
|
@ -546,10 +555,9 @@ public:
|
|
|
|
|
tx_freq_hz[ch] = target_freq;
|
|
|
|
|
actual_freq = tx_freq_hz[ch];
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this,
|
|
|
|
|
Debug("Tuning Tx " << ch << " to " << actual_freq / 1e6 << " MHz...");
|
|
|
|
|
size_t i = ch / nof_channels;
|
|
|
|
|
|
|
|
|
|
// For each radio...
|
|
|
|
|
for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
// Calculate center frequency from average
|
|
|
|
|
double center_freq_hz = 0.0;
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
@ -560,6 +568,9 @@ public:
|
|
|
|
|
}
|
|
|
|
|
center_freq_hz /= nof_channels;
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this,
|
|
|
|
|
|
|
|
|
|
// Set Radio Tx freq
|
|
|
|
|
UHD_LOG_DEBUG(radio_id[i], "Setting TX Freq: " << center_freq_hz / 1e6 << " MHz...");
|
|
|
|
|
radio_ctrl[i]->set_tx_frequency(center_freq_hz, 0);
|
|
|
|
@ -571,7 +582,6 @@ public:
|
|
|
|
|
double freq_hz = tx_freq_hz[nof_channels * i + j] - center_freq_hz;
|
|
|
|
|
UHD_LOG_DEBUG(duc_id[i], "Setting " << j << " freq: " << freq_hz / 1e6 << " MHz ...");
|
|
|
|
|
duc_ctrl[i]->set_arg("freq", std::to_string(freq_hz), j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
uhd_error set_rx_freq(uint32_t ch, double target_freq, double& actual_freq) override
|
|
|
|
@ -596,7 +606,9 @@ public:
|
|
|
|
|
rx_freq_hz[ch] = target_freq;
|
|
|
|
|
actual_freq = rx_freq_hz[ch];
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
Debug("Tuning Rx " << ch << " to " << actual_freq / 1e6 << " MHz...");
|
|
|
|
|
size_t i = ch / nof_channels;
|
|
|
|
|
|
|
|
|
|
// Calculate center frequency from average
|
|
|
|
|
double center_freq_hz = 0.0;
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
@ -607,6 +619,9 @@ public:
|
|
|
|
|
}
|
|
|
|
|
center_freq_hz /= nof_channels;
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this,
|
|
|
|
|
|
|
|
|
|
// Set Radio Tx freq
|
|
|
|
|
UHD_LOG_DEBUG(radio_id[i], "Setting RX Freq: " << center_freq_hz / 1e6 << " MHz...");
|
|
|
|
|
radio_ctrl[i]->set_rx_frequency(center_freq_hz, 0);
|
|
|
|
@ -618,7 +633,6 @@ public:
|
|
|
|
|
double freq_hz = center_freq_hz - rx_freq_hz[nof_channels * i + j];
|
|
|
|
|
UHD_LOG_DEBUG(ddc_id[i], "Setting " << j << " freq: " << freq_hz / 1e6 << " MHz ...");
|
|
|
|
|
ddc_ctrl[i]->set_arg("freq", freq_hz, j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|