From 8433f63a9b6fa6c82535fb3f1293b6f088ae4bef Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 19 Sep 2018 05:26:18 +0200 Subject: [PATCH] LibbladeRF2: migrate devices/bladerf to devices/bladerf1 --- devices/CMakeLists.txt | 4 +-- devices/{bladerf => bladerf1}/CMakeLists.txt | 30 +++++++++---------- .../devicebladerf1.cpp} | 7 +++-- .../devicebladerf1.h} | 2 +- .../devicebladerf1param.h} | 10 +++---- .../devicebladerf1shared.cpp} | 8 ++--- .../devicebladerf1shared.h} | 2 +- .../devicebladerf1values.cpp} | 14 ++++----- .../devicebladerf1values.h} | 8 ++--- .../samplesink/bladerfoutput/CMakeLists.txt | 4 +-- .../bladerfoutput/bladerfoutput.cpp | 14 ++++----- .../samplesink/bladerfoutput/bladerfoutput.h | 7 ++--- .../bladerfoutput/bladerfoutputgui.cpp | 3 +- .../samplesource/bladerfinput/CMakeLists.txt | 4 +-- .../bladerfinput/bladerfinput.cpp | 4 +-- .../samplesource/bladerfinput/bladerfinput.h | 7 +++-- .../samplesink/bladerfoutput/CMakeLists.txt | 4 +-- .../samplesource/bladerfinput/CMakeLists.txt | 4 +-- 18 files changed, 69 insertions(+), 67 deletions(-) rename devices/{bladerf => bladerf1}/CMakeLists.txt (51%) rename devices/{bladerf/devicebladerf.cpp => bladerf1/devicebladerf1.cpp} (95%) rename devices/{bladerf/devicebladerf.h => bladerf1/devicebladerf1.h} (98%) rename devices/{bladerf/devicebladerfparam.h => bladerf1/devicebladerf1param.h} (89%) rename devices/{bladerf/devicebladerfshared.cpp => bladerf1/devicebladerf1shared.cpp} (80%) rename devices/{bladerf/devicebladerfshared.h => bladerf1/devicebladerf1shared.h} (97%) rename devices/{bladerf/devicebladerfvalues.cpp => bladerf1/devicebladerf1values.cpp} (80%) rename devices/{bladerf/devicebladerfvalues.h => bladerf1/devicebladerf1values.h} (88%) diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt index 66429d0c1..1545c534d 100644 --- a/devices/CMakeLists.txt +++ b/devices/CMakeLists.txt @@ -3,7 +3,7 @@ project(devices) find_package(LibUSB) if (BUILD_DEBIAN) - add_subdirectory(bladerf) + add_subdirectory(bladerf1) add_subdirectory(hackrf) add_subdirectory(limesdr) add_subdirectory(perseus) @@ -11,7 +11,7 @@ if (BUILD_DEBIAN) else(BUILD_DEBIAN) find_package(LibBLADERF) if(LIBUSB_FOUND AND LIBBLADERF_FOUND) - add_subdirectory(bladerf) + add_subdirectory(bladerf1) endif(LIBUSB_FOUND AND LIBBLADERF_FOUND) find_package(LibHACKRF) diff --git a/devices/bladerf/CMakeLists.txt b/devices/bladerf1/CMakeLists.txt similarity index 51% rename from devices/bladerf/CMakeLists.txt rename to devices/bladerf1/CMakeLists.txt index 1d698cbdd..ddb327d5f 100644 --- a/devices/bladerf/CMakeLists.txt +++ b/devices/bladerf1/CMakeLists.txt @@ -1,16 +1,16 @@ -project(bladerfdevice) +project(bladerf1device) -set(bladerfdevice_SOURCES - devicebladerf.cpp - devicebladerfvalues.cpp - devicebladerfshared.cpp +set(bladerf1device_SOURCES + devicebladerf1.cpp + devicebladerf1values.cpp + devicebladerf1shared.cpp ) -set(bladerfdevice_HEADERS - devicebladerf.h - devicebladerfvalues.h - devicebladerfparam.h - devicebladerfshared.h +set(bladerf1device_HEADERS + devicebladerf1.h + devicebladerf1values.h + devicebladerf1param.h + devicebladerf1shared.h ) if (BUILD_DEBIAN) @@ -31,20 +31,20 @@ endif (BUILD_DEBIAN) #add_definitions(${QT_DEFINITIONS}) #add_definitions(-DQT_SHARED) -add_library(bladerfdevice SHARED - ${bladerfdevice_SOURCES} +add_library(bladerf1device SHARED + ${bladerf1device_SOURCES} ) if (BUILD_DEBIAN) -target_link_libraries(bladerfdevice +target_link_libraries(bladerf1device bladerf sdrbase ) else (BUILD_DEBIAN) -target_link_libraries(bladerfdevice +target_link_libraries(bladerf1device ${LIBBLADERF_LIBRARIES} sdrbase ) endif (BUILD_DEBIAN) -install(TARGETS bladerfdevice DESTINATION lib) +install(TARGETS bladerf1device DESTINATION lib) diff --git a/devices/bladerf/devicebladerf.cpp b/devices/bladerf1/devicebladerf1.cpp similarity index 95% rename from devices/bladerf/devicebladerf.cpp rename to devices/bladerf1/devicebladerf1.cpp index f650f4015..14ab43374 100644 --- a/devices/bladerf/devicebladerf.cpp +++ b/devices/bladerf1/devicebladerf1.cpp @@ -14,13 +14,14 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include "../bladerf1/devicebladerf1.h" + #include #include #include -#include "devicebladerf.h" -bool DeviceBladeRF::open_bladerf(struct bladerf **dev, const char *serial) +bool DeviceBladeRF1::open_bladerf(struct bladerf **dev, const char *serial) { int fpga_loaded; @@ -47,7 +48,7 @@ bool DeviceBladeRF::open_bladerf(struct bladerf **dev, const char *serial) return true; } -struct bladerf *DeviceBladeRF::open_bladerf_from_serial(const char *serial) +struct bladerf *DeviceBladeRF1::open_bladerf_from_serial(const char *serial) { int status; struct bladerf *dev; diff --git a/devices/bladerf/devicebladerf.h b/devices/bladerf1/devicebladerf1.h similarity index 98% rename from devices/bladerf/devicebladerf.h rename to devices/bladerf1/devicebladerf1.h index 09751ea93..f8a9d1cad 100644 --- a/devices/bladerf/devicebladerf.h +++ b/devices/bladerf1/devicebladerf1.h @@ -21,7 +21,7 @@ #include "export.h" -class DEVICES_API DeviceBladeRF +class DEVICES_API DeviceBladeRF1 { public: static bool open_bladerf(struct bladerf **dev, const char *serial); diff --git a/devices/bladerf/devicebladerfparam.h b/devices/bladerf1/devicebladerf1param.h similarity index 89% rename from devices/bladerf/devicebladerfparam.h rename to devices/bladerf1/devicebladerf1param.h index 8bd4349ec..ad76a67f9 100644 --- a/devices/bladerf/devicebladerfparam.h +++ b/devices/bladerf1/devicebladerf1param.h @@ -14,8 +14,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef DEVICES_BLADERF_DEVICEBLADERFPARAM_H_ -#define DEVICES_BLADERF_DEVICEBLADERFPARAM_H_ +#ifndef DEVICES_BLADERF1_DEVICEBLADERF1PARAM_H_ +#define DEVICES_BLADERF1_DEVICEBLADERF1PARAM_H_ #include @@ -23,16 +23,16 @@ * This structure is owned by each of the parties sharing the same physical device * It allows exchange of information on the common resources */ -struct DeviceBladeRFParams +struct DeviceBladeRF1Params { struct bladerf *m_dev; //!< device handle if the party has ownership else 0 bool m_xb200Attached; //!< true if XB200 is attached and owned by the party - DeviceBladeRFParams() : + DeviceBladeRF1Params() : m_dev(0), m_xb200Attached(false) { } }; -#endif /* DEVICES_BLADERF_DEVICEBLADERFPARAM_H_ */ +#endif /* DEVICES_BLADERF1_DEVICEBLADERF1PARAM_H_ */ diff --git a/devices/bladerf/devicebladerfshared.cpp b/devices/bladerf1/devicebladerf1shared.cpp similarity index 80% rename from devices/bladerf/devicebladerfshared.cpp rename to devices/bladerf1/devicebladerf1shared.cpp index 636318a00..361e430ec 100644 --- a/devices/bladerf/devicebladerfshared.cpp +++ b/devices/bladerf1/devicebladerf1shared.cpp @@ -14,8 +14,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include "devicebladerfshared.h" +#include "../bladerf1/devicebladerf1shared.h" -const float DeviceBladeRFShared::m_sampleFifoLengthInSeconds = 0.25; -const int DeviceBladeRFShared::m_sampleFifoMinSize = 75000; // 300 kS/s knee -const int DeviceBladeRFShared::m_sampleFifoMinSize32 = 150000; // Fixed for interpolation by 32 +const float DeviceBladeRF1Shared::m_sampleFifoLengthInSeconds = 0.25; +const int DeviceBladeRF1Shared::m_sampleFifoMinSize = 75000; // 300 kS/s knee +const int DeviceBladeRF1Shared::m_sampleFifoMinSize32 = 150000; // Fixed for interpolation by 32 diff --git a/devices/bladerf/devicebladerfshared.h b/devices/bladerf1/devicebladerf1shared.h similarity index 97% rename from devices/bladerf/devicebladerfshared.h rename to devices/bladerf1/devicebladerf1shared.h index 2fe2d7f89..cc893c77a 100644 --- a/devices/bladerf/devicebladerfshared.h +++ b/devices/bladerf1/devicebladerf1shared.h @@ -20,7 +20,7 @@ #include "util/message.h" #include "export.h" -class DEVICES_API DeviceBladeRFShared +class DEVICES_API DeviceBladeRF1Shared { public: static const float m_sampleFifoLengthInSeconds; diff --git a/devices/bladerf/devicebladerfvalues.cpp b/devices/bladerf1/devicebladerf1values.cpp similarity index 80% rename from devices/bladerf/devicebladerfvalues.cpp rename to devices/bladerf1/devicebladerf1values.cpp index fb44ad6c2..522953ae0 100644 --- a/devices/bladerf/devicebladerfvalues.cpp +++ b/devices/bladerf1/devicebladerf1values.cpp @@ -14,11 +14,11 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include "devicebladerfvalues.h" +#include "../bladerf1/devicebladerf1values.h" -unsigned int DeviceBladeRFBandwidths::m_nb_halfbw = 16; -unsigned int DeviceBladeRFBandwidths::m_halfbw[] = { +unsigned int DeviceBladeRF1Bandwidths::m_nb_halfbw = 16; +unsigned int DeviceBladeRF1Bandwidths::m_halfbw[] = { 750, 875, 1250, @@ -36,7 +36,7 @@ unsigned int DeviceBladeRFBandwidths::m_halfbw[] = { 10000, 14000}; -unsigned int DeviceBladeRFBandwidths::getBandwidth(unsigned int bandwidth_index) +unsigned int DeviceBladeRF1Bandwidths::getBandwidth(unsigned int bandwidth_index) { if (bandwidth_index < m_nb_halfbw) { @@ -48,7 +48,7 @@ unsigned int DeviceBladeRFBandwidths::getBandwidth(unsigned int bandwidth_index) } } -unsigned int DeviceBladeRFBandwidths::getBandwidthIndex(unsigned int bandwidth) +unsigned int DeviceBladeRF1Bandwidths::getBandwidthIndex(unsigned int bandwidth) { for (unsigned int i=0; i < m_nb_halfbw; i++) { @@ -61,9 +61,9 @@ unsigned int DeviceBladeRFBandwidths::getBandwidthIndex(unsigned int bandwidth) return 0; } -unsigned int DeviceBladeRFBandwidths::getNbBandwidths() +unsigned int DeviceBladeRF1Bandwidths::getNbBandwidths() { - return DeviceBladeRFBandwidths::m_nb_halfbw; + return DeviceBladeRF1Bandwidths::m_nb_halfbw; } diff --git a/devices/bladerf/devicebladerfvalues.h b/devices/bladerf1/devicebladerf1values.h similarity index 88% rename from devices/bladerf/devicebladerfvalues.h rename to devices/bladerf1/devicebladerf1values.h index 2498e6cd6..83afa961b 100644 --- a/devices/bladerf/devicebladerfvalues.h +++ b/devices/bladerf1/devicebladerf1values.h @@ -14,12 +14,12 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef DEVICES_BLADERF_DEVICEBLADERFVALUES_H_ -#define DEVICES_BLADERF_DEVICEBLADERFVALUES_H_ +#ifndef DEVICES_BLADERF1_DEVICEBLADERF1VALUES_H_ +#define DEVICES_BLADERF1_DEVICEBLADERF1VALUES_H_ #include "export.h" -class DEVICES_API DeviceBladeRFBandwidths { +class DEVICES_API DeviceBladeRF1Bandwidths { public: static unsigned int getBandwidth(unsigned int bandwidth_index); static unsigned int getBandwidthIndex(unsigned int bandwidth); @@ -29,4 +29,4 @@ private: static unsigned int m_nb_halfbw; }; -#endif /* DEVICES_BLADERF_DEVICEBLADERFVALUES_H_ */ +#endif /* DEVICES_BLADERF1_DEVICEBLADERF1VALUES_H_ */ diff --git a/plugins/samplesink/bladerfoutput/CMakeLists.txt b/plugins/samplesink/bladerfoutput/CMakeLists.txt index 719a7442e..6b3d35250 100644 --- a/plugins/samplesink/bladerfoutput/CMakeLists.txt +++ b/plugins/samplesink/bladerfoutput/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(outputbladerf sdrbase sdrgui swagger - bladerfdevice + bladerf1device ) else (BUILD_DEBIAN) target_link_libraries(outputbladerf @@ -71,7 +71,7 @@ target_link_libraries(outputbladerf sdrbase sdrgui swagger - bladerfdevice + bladerf1device ) endif (BUILD_DEBIAN) diff --git a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp index 9f279bc04..de47352e2 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp +++ b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp @@ -26,9 +26,9 @@ #include "dsp/dspengine.h" #include "device/devicesinkapi.h" #include "device/devicesourceapi.h" -#include "bladerf/devicebladerfshared.h" - #include "bladerfoutput.h" + +#include "../../../devices/bladerf1/devicebladerf1shared.h" #include "bladerfoutputthread.h" MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgConfigureBladerf, Message) @@ -74,7 +74,7 @@ bool BladerfOutput::openDevice() if (m_deviceAPI->getSourceBuddies().size() > 0) { DeviceSourceAPI *sourceBuddy = m_deviceAPI->getSourceBuddies()[0]; - DeviceBladeRFParams *buddySharedParams = (DeviceBladeRFParams *) sourceBuddy->getBuddySharedPtr(); + DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sourceBuddy->getBuddySharedPtr(); if (buddySharedParams == 0) { @@ -93,7 +93,7 @@ bool BladerfOutput::openDevice() } else { - if (!DeviceBladeRF::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSampleSinkSerial()))) + if (!DeviceBladeRF1::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSampleSinkSerial()))) { qCritical("BladerfOutput::start: could not open BladeRF %s", qPrintable(m_deviceAPI->getSampleSinkSerial())); return false; @@ -318,13 +318,13 @@ bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool fo if (settings.m_log2Interp >= 5) { - fifoSize = DeviceBladeRFShared::m_sampleFifoMinSize32; + fifoSize = DeviceBladeRF1Shared::m_sampleFifoMinSize32; } else { fifoSize = std::max( - (int) ((settings.m_devSampleRate/(1< -#include "bladerf/devicebladerf.h" -#include "bladerf/devicebladerfparam.h" - #include #include +#include "../../../devices/bladerf1/devicebladerf1.h" +#include "../../../devices/bladerf1/devicebladerf1param.h" #include "bladerfoutputsettings.h" class DeviceSinkAPI; @@ -140,7 +139,7 @@ private: struct bladerf* m_dev; BladerfOutputThread* m_bladerfThread; QString m_deviceDescription; - DeviceBladeRFParams m_sharedParams; + DeviceBladeRF1Params m_sharedParams; bool m_running; }; diff --git a/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp b/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp index 86ecc7461..6f120df64 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp +++ b/plugins/samplesink/bladerfoutput/bladerfoutputgui.cpp @@ -27,7 +27,8 @@ #include "device/devicesinkapi.h" #include "device/deviceuiset.h" #include "bladerfoutputgui.h" -#include "bladerf/devicebladerfvalues.h" + +#include "../../../devices/bladerf1/devicebladerf1values.h" BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) : QWidget(parent), diff --git a/plugins/samplesource/bladerfinput/CMakeLists.txt b/plugins/samplesource/bladerfinput/CMakeLists.txt index 943e3a7df..a39e263fe 100644 --- a/plugins/samplesource/bladerfinput/CMakeLists.txt +++ b/plugins/samplesource/bladerfinput/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(inputbladerf sdrbase sdrgui swagger - bladerfdevice + bladerf1device ) else (BUILD_DEBIAN) target_link_libraries(inputbladerf @@ -71,7 +71,7 @@ target_link_libraries(inputbladerf sdrbase sdrgui swagger - bladerfdevice + bladerf1device ) endif (BUILD_DEBIAN) diff --git a/plugins/samplesource/bladerfinput/bladerfinput.cpp b/plugins/samplesource/bladerfinput/bladerfinput.cpp index 78c225a3a..14ad45706 100644 --- a/plugins/samplesource/bladerfinput/bladerfinput.cpp +++ b/plugins/samplesource/bladerfinput/bladerfinput.cpp @@ -83,7 +83,7 @@ bool BladerfInput::openDevice() if (m_deviceAPI->getSinkBuddies().size() > 0) { DeviceSinkAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0]; - DeviceBladeRFParams *buddySharedParams = (DeviceBladeRFParams *) sinkBuddy->getBuddySharedPtr(); + DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sinkBuddy->getBuddySharedPtr(); if (buddySharedParams == 0) { @@ -102,7 +102,7 @@ bool BladerfInput::openDevice() } else { - if (!DeviceBladeRF::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSampleSourceSerial()))) + if (!DeviceBladeRF1::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSampleSourceSerial()))) { qCritical("BladerfInput::start: could not open BladeRF %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); return false; diff --git a/plugins/samplesource/bladerfinput/bladerfinput.h b/plugins/samplesource/bladerfinput/bladerfinput.h index 74254a5a4..df4365350 100644 --- a/plugins/samplesource/bladerfinput/bladerfinput.h +++ b/plugins/samplesource/bladerfinput/bladerfinput.h @@ -22,8 +22,9 @@ #include #include -#include "bladerf/devicebladerf.h" -#include "bladerf/devicebladerfparam.h" + +#include "../../../devices/bladerf1/devicebladerf1.h" +#include "../../../devices/bladerf1/devicebladerf1param.h" #include "bladerfinputsettings.h" class DeviceSourceAPI; @@ -144,7 +145,7 @@ private: struct bladerf* m_dev; BladerfInputThread* m_bladerfThread; QString m_deviceDescription; - DeviceBladeRFParams m_sharedParams; + DeviceBladeRF1Params m_sharedParams; bool m_running; FileRecord *m_fileSink; //!< File sink to record device I/Q output }; diff --git a/pluginssrv/samplesink/bladerfoutput/CMakeLists.txt b/pluginssrv/samplesink/bladerfoutput/CMakeLists.txt index a4f4d0cc9..6a18571f9 100644 --- a/pluginssrv/samplesink/bladerfoutput/CMakeLists.txt +++ b/pluginssrv/samplesink/bladerfoutput/CMakeLists.txt @@ -51,7 +51,7 @@ target_link_libraries(outputbladerfsrv bladerf sdrbase swagger - bladerfdevice + bladerf1device ) else (BUILD_DEBIAN) target_link_libraries(outputbladerfsrv @@ -59,7 +59,7 @@ target_link_libraries(outputbladerfsrv ${LIBBLADERF_LIBRARIES} sdrbase swagger - bladerfdevice + bladerf1device ) endif (BUILD_DEBIAN) diff --git a/pluginssrv/samplesource/bladerfinput/CMakeLists.txt b/pluginssrv/samplesource/bladerfinput/CMakeLists.txt index 78ed1c820..771ba0936 100644 --- a/pluginssrv/samplesource/bladerfinput/CMakeLists.txt +++ b/pluginssrv/samplesource/bladerfinput/CMakeLists.txt @@ -51,7 +51,7 @@ target_link_libraries(inputbladerfsrv bladerf sdrbase swagger - bladerfdevice + bladerf1device ) else (BUILD_DEBIAN) target_link_libraries(inputbladerfsrv @@ -59,7 +59,7 @@ target_link_libraries(inputbladerfsrv ${LIBBLADERF_LIBRARIES} sdrbase swagger - bladerfdevice + bladerf1device ) endif (BUILD_DEBIAN)