kopia lustrzana https://github.com/cariboulabs/cariboulite
rodzic
0105e1baf0
commit
5840d627ce
|
@ -123,7 +123,6 @@ void runSoapyProcess( SoapySDR::Device *device, SoapySDR::Stream *stream, const
|
|||
**********************************************************************/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SoapySDR::ModuleManager mm(false);
|
||||
SoapySDR::Device *device(nullptr);
|
||||
std::vector<size_t> channels;
|
||||
std::string argStr = "driver=Cariboulite,channel=HiF";
|
||||
|
|
|
@ -130,10 +130,10 @@ int at86rf215_calibrate_device(at86rf215_st* dev, at86rf215_rf_channel_en ch, in
|
|||
for (int i = 0; i < NUM_CAL_STEPS; i ++)
|
||||
{
|
||||
at86rf215_radio_set_state(dev, ch, at86rf215_radio_state_cmd_trx_off);
|
||||
io_utils_usleep(10000);
|
||||
io_utils_usleep(2000);
|
||||
at86rf215_radio_set_state(dev, ch, at86rf215_radio_state_cmd_tx_prep);
|
||||
|
||||
io_utils_usleep(80000);
|
||||
io_utils_usleep(10000);
|
||||
|
||||
at86rf215_radio_get_tx_iq_calibration(dev, ch, &cal_i[i], &cal_q[i]);
|
||||
//printf("[%d,%d], ", cal_i[i], cal_q[i]);
|
||||
|
@ -283,15 +283,15 @@ int at86rf215_print_version(at86rf215_st* dev)
|
|||
|
||||
if (pn == at86rf215_pn_at86rf215) // 0x34
|
||||
{
|
||||
ZF_LOGI("MODEM Version: AT86RF215 (with basebands), version: %02x", vn);
|
||||
ZF_LOGD("MODEM Version: AT86RF215 (with basebands), version: %02x", vn);
|
||||
}
|
||||
else if (pn == at86rf215_pn_at86rf215iq) // 0x35
|
||||
{
|
||||
ZF_LOGI("MODEM Version: AT86RF215IQ (without basebands), version: %02x", vn);
|
||||
ZF_LOGD("MODEM Version: AT86RF215IQ (without basebands), version: %02x", vn);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZF_LOGI("MODEM Version: not AT86RF215 IQ capable modem (product number: 0x%02x, versions %02x)", pn, vn);
|
||||
ZF_LOGW("MODEM Version: not AT86RF215 IQ capable modem (product number: 0x%02x, versions %02x)", pn, vn);
|
||||
}
|
||||
return pn;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ int caribou_fpga_init(caribou_fpga_st* dev, io_utils_spi_st* io_spi)
|
|||
|
||||
dev->io_spi = io_spi;
|
||||
|
||||
ZF_LOGI("configuring reset and irq pins");
|
||||
ZF_LOGD("configuring reset and irq pins");
|
||||
// Configure GPIO pins
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_output, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->soft_reset_pin, io_utils_dir_output, io_utils_pull_up);
|
||||
|
@ -123,7 +123,7 @@ int caribou_fpga_init(caribou_fpga_st* dev, io_utils_spi_st* io_spi)
|
|||
// set to known state
|
||||
io_utils_write_gpio(dev->soft_reset_pin, 1);
|
||||
|
||||
ZF_LOGI("Initializing io_utils_spi");
|
||||
ZF_LOGD("Initializing io_utils_spi");
|
||||
io_utils_hard_spi_st hard_dev_fpga = { .spi_dev_id = dev->spi_dev,
|
||||
.spi_dev_channel = dev->spi_channel, };
|
||||
dev->io_spi_handle = io_utils_spi_add_chip(dev->io_spi, dev->cs_pin, 1000000, 0, 0,
|
||||
|
@ -304,7 +304,7 @@ int caribou_fpga_get_versions (caribou_fpga_st* dev, caribou_fpga_versions_st* v
|
|||
oc.mid = caribou_fpga_mid_smi_ctrl;
|
||||
caribou_fpga_spi_transfer (dev, poc, &dev->versions.smi_ctrl_mod_ver);
|
||||
|
||||
caribou_fpga_print_versions (dev);
|
||||
//caribou_fpga_print_versions (dev);
|
||||
|
||||
if (vers)
|
||||
{
|
||||
|
|
|
@ -81,10 +81,10 @@ int caribou_prog_init(caribou_prog_st *dev, io_utils_spi_st* io_spi)
|
|||
// check if the FPGA is already configures
|
||||
if (caribou_prog_check_if_programmed(dev) == 1)
|
||||
{
|
||||
ZF_LOGI("FPGA is already configured and running");
|
||||
ZF_LOGD("FPGA is already configured and running");
|
||||
}
|
||||
|
||||
ZF_LOGI("device init completed");
|
||||
ZF_LOGD("device init completed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static int caribou_prog_configure_prepare(caribou_prog_st *dev)
|
|||
io_utils_usleep(200);
|
||||
|
||||
// Wait for DONE low
|
||||
ZF_LOGI("RESET low, Waiting for CDONE low");
|
||||
ZF_LOGD("RESET low, Waiting for CDONE low");
|
||||
ct = LATTICE_ICE40_TO_COUNT;
|
||||
|
||||
while(io_utils_read_gpio(dev->cdone_pin)==1 && ct--)
|
||||
|
@ -189,7 +189,7 @@ static int caribou_prog_configure_finish(caribou_prog_st *dev)
|
|||
|
||||
|
||||
/* send dummy data while waiting for DONE */
|
||||
ZF_LOGI("sending dummy clocks, waiting for CDONE to rise (or fail)");
|
||||
ZF_LOGD("sending dummy clocks, waiting for CDONE to rise (or fail)");
|
||||
|
||||
ct = LATTICE_ICE40_TO_COUNT;
|
||||
while(caribou_prog_check_if_programmed(dev)==0 && ct--)
|
||||
|
@ -200,11 +200,11 @@ static int caribou_prog_configure_finish(caribou_prog_st *dev)
|
|||
|
||||
if(ct)
|
||||
{
|
||||
ZF_LOGI("%d dummy clocks sent", (LATTICE_ICE40_TO_COUNT-ct)*8);
|
||||
ZF_LOGD("%d dummy clocks sent", (LATTICE_ICE40_TO_COUNT-ct)*8);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZF_LOGI("timeout waiting for CDONE");
|
||||
ZF_LOGW("timeout waiting for CDONE");
|
||||
}
|
||||
|
||||
/* return status */
|
||||
|
@ -278,7 +278,7 @@ int caribou_prog_configure_from_buffer( caribou_prog_st *dev,
|
|||
printf("[%2d%%]\r", progress); fflush(stdout);
|
||||
}
|
||||
io_utils_write_gpio_with_wait(dev->cs_pin, 1, 200);
|
||||
ZF_LOGI("bitstream sent %d bytes", ct);
|
||||
ZF_LOGD("bitstream sent %d bytes", ct);
|
||||
|
||||
// CONFIGURATION EPILOGUE
|
||||
// ----------------------
|
||||
|
|
|
@ -513,7 +513,7 @@ int caribou_smi_init(caribou_smi_st* dev,
|
|||
dev->read_temp_buffer = NULL;
|
||||
dev->write_temp_buffer = NULL;
|
||||
|
||||
ZF_LOGI("initializing caribou_smi");
|
||||
ZF_LOGD("initializing caribou_smi");
|
||||
|
||||
// start from a defined state
|
||||
memset(dev, 0, sizeof(caribou_smi_st));
|
||||
|
@ -548,7 +548,7 @@ int caribou_smi_init(caribou_smi_st* dev,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (caribou_smi_setup_settings(dev, &settings, true) != 0)
|
||||
if (caribou_smi_setup_settings(dev, &settings, false) != 0)
|
||||
{
|
||||
caribou_smi_close (dev);
|
||||
return -1;
|
||||
|
|
|
@ -471,7 +471,7 @@ int cariboulite_self_test(sys_st* sys, cariboulite_self_test_result_st* res)
|
|||
int error_occured = 0;
|
||||
|
||||
//------------------------------------------------------
|
||||
ZF_LOGI("Testing modem communication and versions");
|
||||
ZF_LOGD("Testing modem communication and versions");
|
||||
|
||||
uint8_t modem_pn = 0;
|
||||
modem_pn = at86rf215_print_version(&sys->modem);
|
||||
|
@ -486,7 +486,7 @@ int cariboulite_self_test(sys_st* sys, cariboulite_self_test_result_st* res)
|
|||
// Mixer only relevant to the full version
|
||||
if (sys->board_info.numeric_product_id == system_type_cariboulite_full)
|
||||
{
|
||||
ZF_LOGI("Testing mixer communication and versions");
|
||||
ZF_LOGD("Testing mixer communication and versions");
|
||||
rffc507x_device_id_st dev_id;
|
||||
rffc507x_readback_status(&sys->mixer, &dev_id, NULL);
|
||||
if (dev_id.device_id != 0x1140 && dev_id.device_id != 0x11C0)
|
||||
|
@ -497,13 +497,10 @@ int cariboulite_self_test(sys_st* sys, cariboulite_self_test_result_st* res)
|
|||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
ZF_LOGI("Testing smi communication");
|
||||
|
||||
// check and report problems
|
||||
if (!error_occured)
|
||||
{
|
||||
ZF_LOGI("Self-test process finished successfully!");
|
||||
ZF_LOGD("Self-test process finished successfully!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ int spi_init(spi_t *self,
|
|||
return SPI_ERR_SET_SPEED;
|
||||
}
|
||||
|
||||
printf("open device='%s' mode=%d bits=%d lsb=%d max_speed=%d [Hz]", device, (int)self->mode, (int)self->bits, (int)self->lsb, (int)self->speed);
|
||||
//printf("open device='%s' mode=%d bits=%d lsb=%d max_speed=%d [Hz]", device, (int)self->mode, (int)self->bits, (int)self->lsb, (int)self->speed);
|
||||
|
||||
return SPI_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -112,11 +112,11 @@ int rffc507x_init( rffc507x_st* dev,
|
|||
ZF_LOGE("input dev is NULL");
|
||||
return -1;
|
||||
}
|
||||
ZF_LOGI("Initializing RFFC507x driver");
|
||||
ZF_LOGD("Initializing RFFC507x driver");
|
||||
memcpy(dev->rffc507x_regs, rffc507x_regs_default, sizeof(dev->rffc507x_regs));
|
||||
dev->rffc507x_regs_dirty = 0x7fffffff;
|
||||
|
||||
ZF_LOGI("Setting up device GPIOs");
|
||||
ZF_LOGD("Setting up device GPIOs");
|
||||
|
||||
dev->io_spi = io_spi;
|
||||
|
||||
|
@ -129,7 +129,7 @@ int rffc507x_init( rffc507x_st* dev,
|
|||
dev->io_spi_handle = io_utils_spi_add_chip(dev->io_spi, dev->cs_pin, 5000000, 0, 0,
|
||||
io_utils_spi_chip_type_rffc, NULL);
|
||||
|
||||
ZF_LOGI("Received spi handle %d", dev->io_spi_handle);
|
||||
ZF_LOGD("Received spi handle %d", dev->io_spi_handle);
|
||||
|
||||
rffc507x_device_id_st did = {0};
|
||||
rffc507x_device_status_st stat = {0};
|
||||
|
@ -209,7 +209,7 @@ int rffc507x_release(rffc507x_st* dev)
|
|||
// Release the SPI device
|
||||
io_utils_spi_remove_chip(dev->io_spi, dev->io_spi_handle);
|
||||
|
||||
ZF_LOGI("Device release completed");
|
||||
ZF_LOGD("Device release completed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ void rffc507x_print_dev_id(rffc507x_device_id_st* dev_id)
|
|||
{
|
||||
if (!dev_id) return;
|
||||
uint16_t *temp = (uint16_t*)dev_id;
|
||||
ZF_LOGI("RFFC507X DEVID: 0x%04X ID: 0x%04X, Rev: %d (%s)", *temp,
|
||||
ZF_LOGD("RFFC507X DEVID: 0x%04X ID: 0x%04X, Rev: %d (%s)", *temp,
|
||||
dev_id->device_id, dev_id->device_rev,
|
||||
dev_id->device_rev==1?"RFFC507x":"RFFC507xA");
|
||||
}
|
||||
|
|
|
@ -16,18 +16,18 @@ Cariboulite::Cariboulite(const SoapySDR::Kwargs &args)
|
|||
|
||||
if (!args.at("channel").compare ("HiF"))
|
||||
{
|
||||
cariboulite_radio_init(&radio, &sess.sys, cariboulite_channel_6g);
|
||||
radio = &sess.sys.radio_low;
|
||||
}
|
||||
else if (!args.at("channel").compare ("S1G"))
|
||||
{
|
||||
cariboulite_radio_init(&radio, &sess.sys, cariboulite_channel_s1g);
|
||||
radio = &sess.sys.radio_high;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error( "Channel type is not specified correctly" );
|
||||
}
|
||||
|
||||
stream = new SoapySDR::Stream(&radio);
|
||||
stream = new SoapySDR::Stream(radio);
|
||||
if (stream == NULL)
|
||||
{
|
||||
throw std::runtime_error( "Stream allocation failed" );
|
||||
|
@ -37,8 +37,6 @@ Cariboulite::Cariboulite(const SoapySDR::Kwargs &args)
|
|||
//========================================================
|
||||
Cariboulite::~Cariboulite()
|
||||
{
|
||||
SoapySDR_logf(SOAPY_SDR_INFO, "Disposing radio type '%d'", radio.type);
|
||||
cariboulite_radio_dispose(&radio);
|
||||
if (stream) delete stream;
|
||||
}
|
||||
|
||||
|
@ -66,6 +64,11 @@ SoapySDR::Kwargs Cariboulite::getHardwareInfo() const
|
|||
return args;
|
||||
}
|
||||
|
||||
std::string Cariboulite::getHardwareKey() const
|
||||
{
|
||||
return "Cariboulite Rev2.8";
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* Antenna API
|
||||
******************************************************************/
|
||||
|
@ -73,8 +76,8 @@ std::vector<std::string> Cariboulite::listAntennas( const int direction, const s
|
|||
{
|
||||
//printf("listAntennas dir: %d, channel: %ld\n", direction, channel);
|
||||
std::vector<std::string> options;
|
||||
if (radio.type == cariboulite_channel_s1g) options.push_back( "TX/RX Sub1GHz" );
|
||||
else if (radio.type == cariboulite_channel_6g) options.push_back( "TX/RX 6GHz" );
|
||||
if (radio->type == cariboulite_channel_s1g) options.push_back( "TX/RX Sub1GHz" );
|
||||
else if (radio->type == cariboulite_channel_6g) options.push_back( "TX/RX 6GHz" );
|
||||
|
||||
return(options);
|
||||
}
|
||||
|
@ -83,8 +86,8 @@ std::vector<std::string> Cariboulite::listAntennas( const int direction, const s
|
|||
std::string Cariboulite::getAntenna( const int direction, const size_t channel ) const
|
||||
{
|
||||
//printf("getAntenna dir: %d, channel: %ld\n", direction, channel);
|
||||
if (radio.type == cariboulite_channel_s1g) return "TX/RX Sub1GHz";
|
||||
else if (radio.type == cariboulite_channel_6g) return "TX/RX 6GHz";
|
||||
if (radio->type == cariboulite_channel_s1g) return "TX/RX Sub1GHz";
|
||||
else if (radio->type == cariboulite_channel_6g) return "TX/RX 6GHz";
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -118,16 +121,16 @@ std::vector<std::string> Cariboulite::listGains(const int direction, const size_
|
|||
void Cariboulite::setGain(const int direction, const size_t channel, const double value)
|
||||
{
|
||||
//printf("setGain dir: %d, channel: %ld, value: %.2f\n", direction, channel, value);
|
||||
bool cur_agc_mode = radio.rx_agc_on;
|
||||
bool cur_agc_mode = radio->rx_agc_on;
|
||||
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_set_rx_gain_control(&radio, cur_agc_mode, value);
|
||||
cariboulite_radio_set_rx_gain_control(radio, cur_agc_mode, value);
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
// base if -18dBm output so, given a gain of 0dB we should have -18 dBm
|
||||
cariboulite_radio_set_tx_power(&radio, value - 18.0);
|
||||
cariboulite_radio_set_tx_power(radio, value - 18.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,12 +148,12 @@ double Cariboulite::getGain(const int direction, const size_t channel) const
|
|||
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_get_rx_gain_control((cariboulite_radio_state_st*)&radio, NULL, &value);
|
||||
cariboulite_radio_get_rx_gain_control((cariboulite_radio_state_st*)radio, NULL, &value);
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
int temp = 0;
|
||||
cariboulite_radio_get_tx_power((cariboulite_radio_state_st*)&radio, &temp);
|
||||
cariboulite_radio_get_tx_power((cariboulite_radio_state_st*)radio, &temp);
|
||||
value = temp + 18.0;
|
||||
}
|
||||
SoapySDR_logf(SOAPY_SDR_INFO, "getGain dir: %d, channel: %ld, value: %d", direction, channel, value);
|
||||
|
@ -200,11 +203,11 @@ bool Cariboulite::hasGainMode(const int direction, const size_t channel) const
|
|||
void Cariboulite::setGainMode( const int direction, const size_t channel, const bool automatic )
|
||||
{
|
||||
//printf("setGainMode dir: %d, channel: %ld, auto: %d\n", direction, channel, automatic);
|
||||
bool rx_gain = radio.rx_gain_value_db;
|
||||
bool rx_gain = radio->rx_gain_value_db;
|
||||
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_set_rx_gain_control(&radio, automatic, rx_gain);
|
||||
cariboulite_radio_set_rx_gain_control(radio, automatic, rx_gain);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +224,7 @@ bool Cariboulite::getGainMode( const int direction, const size_t channel ) const
|
|||
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_get_rx_gain_control((cariboulite_radio_state_st*)&radio, &mode, NULL);
|
||||
cariboulite_radio_get_rx_gain_control((cariboulite_radio_state_st*)radio, &mode, NULL);
|
||||
SoapySDR_logf(SOAPY_SDR_INFO, "getGainMode dir: %d, channel: %ld, auto: %d", direction, channel, mode);
|
||||
return mode;
|
||||
}
|
||||
|
@ -235,8 +238,8 @@ bool Cariboulite::getGainMode( const int direction, const size_t channel ) const
|
|||
void Cariboulite::setSampleRate( const int direction, const size_t channel, const double rate )
|
||||
{
|
||||
at86rf215_radio_sample_rate_en fs = at86rf215_radio_rx_sample_rate_4000khz;
|
||||
at86rf215_radio_f_cut_en rx_cuttof = radio.rx_fcut;
|
||||
at86rf215_radio_f_cut_en tx_cuttof = radio.tx_fcut;
|
||||
at86rf215_radio_f_cut_en rx_cuttof = radio->rx_fcut;
|
||||
at86rf215_radio_f_cut_en tx_cuttof = radio->tx_fcut;
|
||||
|
||||
if (fabs(rate - (400000)) < 1) fs = at86rf215_radio_rx_sample_rate_400khz;
|
||||
if (fabs(rate - (500000)) < 1) fs = at86rf215_radio_rx_sample_rate_500khz;
|
||||
|
@ -250,11 +253,11 @@ void Cariboulite::setSampleRate( const int direction, const size_t channel, cons
|
|||
//printf("setSampleRate dir: %d, channel: %ld, rate: %.2f\n", direction, channel, rate);
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_set_rx_samp_cutoff((cariboulite_radio_state_st*)&radio, fs, rx_cuttof);
|
||||
cariboulite_radio_set_rx_samp_cutoff((cariboulite_radio_state_st*)radio, fs, rx_cuttof);
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
cariboulite_radio_set_tx_samp_cutoff((cariboulite_radio_state_st*)&radio, fs, tx_cuttof);
|
||||
cariboulite_radio_set_tx_samp_cutoff((cariboulite_radio_state_st*)radio, fs, tx_cuttof);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,11 +268,11 @@ double Cariboulite::getSampleRate( const int direction, const size_t channel ) c
|
|||
|
||||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
cariboulite_radio_get_rx_samp_cutoff((cariboulite_radio_state_st*)&radio, &fs, NULL);
|
||||
cariboulite_radio_get_rx_samp_cutoff((cariboulite_radio_state_st*)radio, &fs, NULL);
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
cariboulite_radio_get_tx_samp_cutoff((cariboulite_radio_state_st*)&radio, &fs, NULL);
|
||||
cariboulite_radio_get_tx_samp_cutoff((cariboulite_radio_state_st*)radio, &fs, NULL);
|
||||
}
|
||||
|
||||
switch(fs)
|
||||
|
@ -398,11 +401,11 @@ void Cariboulite::setBandwidth( const int direction, const size_t channel, const
|
|||
}
|
||||
else stream->setDigitalFilter(SoapySDR::Stream::DigitalFilter_None);
|
||||
|
||||
cariboulite_radio_set_rx_bandwidth(&radio, convertRxBandwidth(modem_bw));
|
||||
cariboulite_radio_set_rx_bandwidth(radio, convertRxBandwidth(modem_bw));
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
cariboulite_radio_set_tx_bandwidth(&radio, convertTxBandwidth(modem_bw));
|
||||
cariboulite_radio_set_tx_bandwidth(radio, convertTxBandwidth(modem_bw));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,13 +417,13 @@ double Cariboulite::getBandwidth( const int direction, const size_t channel ) co
|
|||
if (direction == SOAPY_SDR_RX)
|
||||
{
|
||||
at86rf215_radio_rx_bw_en bw;
|
||||
cariboulite_radio_get_rx_bandwidth((cariboulite_radio_state_st*)&radio, &bw);
|
||||
cariboulite_radio_get_rx_bandwidth((cariboulite_radio_state_st*)radio, &bw);
|
||||
return convertRxBandwidth(bw);
|
||||
}
|
||||
else if (direction == SOAPY_SDR_TX)
|
||||
{
|
||||
at86rf215_radio_tx_cut_off_en bw;
|
||||
cariboulite_radio_get_tx_bandwidth((cariboulite_radio_state_st*)&radio, &bw);
|
||||
cariboulite_radio_get_tx_bandwidth((cariboulite_radio_state_st*)radio, &bw);
|
||||
return convertTxBandwidth(bw);
|
||||
}
|
||||
return 0.0;
|
||||
|
@ -480,7 +483,7 @@ void Cariboulite::setFrequency( const int direction, const size_t channel, const
|
|||
return;
|
||||
}
|
||||
|
||||
err = cariboulite_radio_set_frequency(&radio, true, (double *)&frequency);
|
||||
err = cariboulite_radio_set_frequency(radio, true, (double *)&frequency);
|
||||
if (err == 0) SoapySDR_logf(SOAPY_SDR_INFO, "setFrequency dir: %d, channel: %ld, freq: %.2f", direction, channel, frequency);
|
||||
else SoapySDR_logf(SOAPY_SDR_ERROR, "setFrequency dir: %d, channel: %ld, freq: %.2f FAILED", direction, channel, frequency);
|
||||
}
|
||||
|
@ -495,7 +498,7 @@ double Cariboulite::getFrequency( const int direction, const size_t channel, con
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
cariboulite_radio_get_frequency((cariboulite_radio_state_st*)&radio, &freq, NULL, NULL);
|
||||
cariboulite_radio_get_frequency((cariboulite_radio_state_st*)radio, &freq, NULL, NULL);
|
||||
return freq;
|
||||
}
|
||||
|
||||
|
@ -527,14 +530,14 @@ SoapySDR::RangeList Cariboulite::getFrequencyRange( const int direction, const s
|
|||
throw std::runtime_error( "getFrequencyRange(" + name + ") unknown name" );
|
||||
}
|
||||
|
||||
if (radio.type == cariboulite_channel_s1g)
|
||||
if (radio->type == cariboulite_channel_s1g)
|
||||
{
|
||||
SoapySDR::RangeList list;
|
||||
list.push_back(SoapySDR::Range( 389.5e6, 510e6 ));
|
||||
list.push_back(SoapySDR::Range( 779e6, 1020e6 ));
|
||||
return list;
|
||||
}
|
||||
else if (radio.type == cariboulite_channel_6g)
|
||||
else if (radio->type == cariboulite_channel_6g)
|
||||
{
|
||||
return (SoapySDR::RangeList( 1, SoapySDR::Range( 1e6, 6000e6 ) ) );
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
* Identification API
|
||||
******************************************************************/
|
||||
std::string getDriverKey(void) const { return "Cariboulite"; }
|
||||
std::string getHardwareKey(void) const { return "Cariboulite Rev2"; }
|
||||
std::string getHardwareKey(void) const;
|
||||
SoapySDR::Kwargs getHardwareInfo(void) const;
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
Type readSensor(const int direction, const size_t channel, const std::string &key) const;
|
||||
|
||||
public:
|
||||
cariboulite_radio_state_st radio;
|
||||
cariboulite_radio_state_st *radio;
|
||||
SoapySDR::Stream* stream;
|
||||
|
||||
// Static load time initializations
|
||||
|
|
|
@ -77,25 +77,25 @@ Type Cariboulite::readSensor(const int direction, const size_t channel, const st
|
|||
if (key == "RSSI")
|
||||
{
|
||||
float rssi = 0.0f;
|
||||
cariboulite_radio_get_rssi((cariboulite_radio_state_st*)&radio, &rssi);
|
||||
cariboulite_radio_get_rssi((cariboulite_radio_state_st*)radio, &rssi);
|
||||
return rssi;
|
||||
}
|
||||
if (key == "ENERGY")
|
||||
{
|
||||
float energy = 0.0f;
|
||||
cariboulite_radio_get_energy_det((cariboulite_radio_state_st*)&radio, &energy);
|
||||
cariboulite_radio_get_energy_det((cariboulite_radio_state_st*)radio, &energy);
|
||||
return energy;
|
||||
}
|
||||
}
|
||||
|
||||
if (key == "PLL_LOCK_MODEM")
|
||||
{
|
||||
return radio.modem_pll_locked;
|
||||
return radio->modem_pll_locked;
|
||||
}
|
||||
|
||||
if (channel == cariboulite_channel_6g && key == "PLL_LOCK_MIXER")
|
||||
{
|
||||
return radio.lo_pll_locked;
|
||||
return radio->lo_pll_locked;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -45,6 +45,7 @@ SoapyCaribouliteSession::SoapyCaribouliteSession(void)
|
|||
memcpy(&sys, &temp, sizeof(sys_st));
|
||||
|
||||
sys.force_fpga_reprogramming = false;
|
||||
cariboulite_set_log_level(cariboulite_log_level_info);
|
||||
int ret = cariboulite_init_driver(&sys, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
|
@ -116,8 +116,8 @@ SoapySDR::Stream *Cariboulite::setupStream(const int direction,
|
|||
|
||||
stream->setInnerStreamType(direction == SOAPY_SDR_TX ? cariboulite_channel_dir_tx : cariboulite_channel_dir_rx);
|
||||
|
||||
cariboulite_radio_set_cw_outputs(&radio, false, false);
|
||||
cariboulite_radio_activate_channel(&radio, stream->getInnerStreamType(), false);
|
||||
cariboulite_radio_set_cw_outputs(radio, false, false);
|
||||
cariboulite_radio_activate_channel(radio, stream->getInnerStreamType(), false);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ SoapySDR::Stream *Cariboulite::setupStream(const int direction,
|
|||
*/
|
||||
void Cariboulite::closeStream(SoapySDR::Stream *stream)
|
||||
{
|
||||
cariboulite_radio_activate_channel(&radio, stream->getInnerStreamType(), false);
|
||||
cariboulite_radio_activate_channel(radio, stream->getInnerStreamType(), false);
|
||||
}
|
||||
|
||||
//========================================================
|
||||
|
@ -144,7 +144,7 @@ void Cariboulite::closeStream(SoapySDR::Stream *stream)
|
|||
*/
|
||||
size_t Cariboulite::getStreamMTU(SoapySDR::Stream *stream) const
|
||||
{
|
||||
return cariboulite_radio_get_native_mtu_size_samples((cariboulite_radio_state_st*)&radio);
|
||||
return cariboulite_radio_get_native_mtu_size_samples((cariboulite_radio_state_st*)radio);
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@ int Cariboulite::activateStream(SoapySDR::Stream *stream,
|
|||
const size_t numElems)
|
||||
{
|
||||
stream->activateStream(1);
|
||||
int ret = cariboulite_radio_activate_channel(&radio, stream->getInnerStreamType(), true);
|
||||
int ret = cariboulite_radio_activate_channel(radio, stream->getInnerStreamType(), true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
return ret;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ int Cariboulite::activateStream(SoapySDR::Stream *stream,
|
|||
int Cariboulite::deactivateStream(SoapySDR::Stream *stream, const int flags, const long long timeNs)
|
||||
{
|
||||
stream->activateStream(0);
|
||||
return cariboulite_radio_activate_channel(&radio, stream->getInnerStreamType(), false);
|
||||
return cariboulite_radio_activate_channel(radio, stream->getInnerStreamType(), false);
|
||||
}
|
||||
|
||||
//========================================================
|
||||
|
|
Ładowanie…
Reference in New Issue