diff --git a/Readme.md b/Readme.md index 54c920605..0441fd932 100644 --- a/Readme.md +++ b/Readme.md @@ -38,7 +38,7 @@ Since version 2 SDRangel can integrate more than one hardware device running con Since version 3 transmission or signal generation is supported for BladeRF, HackRF (since version 3.1), LimeSDR (since version 3.4) and PlutoSDR (since version 3.7.8) using a sample sink plugin. These plugins are: - - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) + - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerf1output) - [HackRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/hackrfoutput) - [LimeSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/limesdroutput) - [PlutoSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/plutosdroutput) @@ -55,7 +55,7 @@ Since version 4 the `sdrangelsrv` binary launches a server mode SDRangel instanc

Detached RF head server (SDRdaemon)

-Since version 4.1 the previously separated project SDRdaemon has been modified and included in SDRangel. Another binary `sdrdaemonsrv` is provided for handling just the RF part of the SDRangel processing chain. The baseband samples are comunicated via UDP to/from a SDRangel instance. More details are provided in the server instance documentation in the `sdrdaemon` folder. +Since version 4.1 the previously separated project SDRdaemon has been modified and included in SDRangel. The `sdrangelsrv` headless variant can be used for this purpose using the Daemon source or sink channels.

Notes on pulseaudio setup

diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt index 1545c534d..5437b4595 100644 --- a/devices/CMakeLists.txt +++ b/devices/CMakeLists.txt @@ -4,6 +4,7 @@ find_package(LibUSB) if (BUILD_DEBIAN) add_subdirectory(bladerf1) + add_subdirectory(bladerf2) add_subdirectory(hackrf) add_subdirectory(limesdr) add_subdirectory(perseus) @@ -12,6 +13,7 @@ else(BUILD_DEBIAN) find_package(LibBLADERF) if(LIBUSB_FOUND AND LIBBLADERF_FOUND) add_subdirectory(bladerf1) + add_subdirectory(bladerf2) endif(LIBUSB_FOUND AND LIBBLADERF_FOUND) find_package(LibHACKRF) @@ -33,5 +35,4 @@ else(BUILD_DEBIAN) if(LIBUSB_FOUND AND LIBPERSEUS_FOUND) add_subdirectory(perseus) endif() - endif (BUILD_DEBIAN) diff --git a/devices/bladerf2/CMakeLists.txt b/devices/bladerf2/CMakeLists.txt new file mode 100644 index 000000000..45754e6e7 --- /dev/null +++ b/devices/bladerf2/CMakeLists.txt @@ -0,0 +1,45 @@ +project(bladerf2device) + +set(bladerf2device_SOURCES + devicebladerf2.cpp +) + +set(bladerf2device_HEADERS + devicebladerf2.h +) + +if (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBBLADERFLIBSRC}/include + ${LIBBLADERFLIBSRC}/src +) +else (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBBLADERF_INCLUDE_DIR} +) +endif (BUILD_DEBIAN) + +#add_definitions(${QT_DEFINITIONS}) +#add_definitions(-DQT_SHARED) + +add_library(bladerf2device SHARED + ${bladerf1device_SOURCES} +) + +if (BUILD_DEBIAN) +target_link_libraries(bladerf2device + bladerf + sdrbase +) +else (BUILD_DEBIAN) +target_link_libraries(bladerf2device + ${LIBBLADERF_LIBRARIES} + sdrbase +) +endif (BUILD_DEBIAN) + +install(TARGETS bladerf2device DESTINATION lib) diff --git a/devices/bladerf2/devicebladerf2.cpp b/devices/bladerf2/devicebladerf2.cpp new file mode 100644 index 000000000..7f7a9c244 --- /dev/null +++ b/devices/bladerf2/devicebladerf2.cpp @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016-2017 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "devicebladerf2.h" + +#include + +#include +#include + +bool DeviceBladeRF2::open_bladerf(struct bladerf **dev, const char *serial) +{ + int fpga_loaded; + + if ((*dev = open_bladerf_from_serial(serial)) == 0) + { + qCritical("DeviceBladeRF2::open_bladerf: could not open BladeRF"); + return false; + } + + fpga_loaded = bladerf_is_fpga_configured(*dev); + + if (fpga_loaded < 0) + { + qCritical("DeviceBladeRF2::open_bladerf: failed to check FPGA state: %s", + bladerf_strerror(fpga_loaded)); + return false; + } + else if (fpga_loaded == 0) + { + qCritical("DeviceBladeRF2::start: the device's FPGA is not loaded."); + return false; + } + + return true; +} + +struct bladerf *DeviceBladeRF2::open_bladerf_from_serial(const char *serial) +{ + int status; + struct bladerf *dev; + struct bladerf_devinfo info; + + /* Initialize all fields to "don't care" wildcard values. + * + * Immediately passing this to bladerf_open_with_devinfo() would cause + * libbladeRF to open any device on any available backend. */ + bladerf_init_devinfo(&info); + + /* Specify the desired device's serial number, while leaving all other + * fields in the info structure wildcard values */ + if (serial != 0) + { + strncpy(info.serial, serial, BLADERF_SERIAL_LENGTH - 1); + info.serial[BLADERF_SERIAL_LENGTH - 1] = '\0'; + } + + status = bladerf_open_with_devinfo(&dev, &info); + + if (status == BLADERF_ERR_NODEV) + { + qCritical("DeviceBladeRF2::open_bladerf_from_serial: No devices available with serial %s", serial); + return 0; + } + else if (status != 0) + { + qCritical("DeviceBladeRF2::open_bladerf_from_serial: Failed to open device with serial %s (%s)", + serial, bladerf_strerror(status)); + return 0; + } + else + { + return dev; + } +} + + diff --git a/devices/bladerf2/devicebladerf2.h b/devices/bladerf2/devicebladerf2.h new file mode 100644 index 000000000..1189146cf --- /dev/null +++ b/devices/bladerf2/devicebladerf2.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2018 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef DEVICES_BLADERF2_DEVICEBLADERF2_H_ +#define DEVICES_BLADERF2_DEVICEBLADERF2_H_ + +#include + +#include "export.h" + +class DEVICES_API DeviceBladeRF2 +{ +public: + static bool open_bladerf(struct bladerf **dev, const char *serial); + +private: + static struct bladerf *open_bladerf_from_serial(const char *serial); +}; + + + +#endif /* DEVICES_BLADERF2_DEVICEBLADERF2_H_ */ diff --git a/devices/devices.pro b/devices/devices.pro index de7df266a..1dd90d844 100644 --- a/devices/devices.pro +++ b/devices/devices.pro @@ -18,8 +18,6 @@ QMAKE_CXXFLAGS += -msse4.1 QMAKE_CXXFLAGS += -std=c++11 macx:QMAKE_LFLAGS += -F/Library/Frameworks -CONFIG(MINGW32):LIBBLADERFSRC = "C:\softs\bladeRF\host\libraries\libbladeRF\include" -CONFIG(MINGW64):LIBBLADERFSRC = "C:\softs\bladeRF\host\libraries\libbladeRF\include" CONFIG(macx):LIBHACKRFSRC = "/opt/local/include" CONFIG(MINGW32):LIBHACKRFSRC = "C:\softs\hackrf\host" CONFIG(MINGW64):LIBHACKRFSRC = "C:\softs\hackrf\host" @@ -34,7 +32,6 @@ CONFIG(MINGW64):LIBIIOSRC = "C:\softs\libiio" INCLUDEPATH += $$PWD INCLUDEPATH += ../exports INCLUDEPATH += ../sdrbase -INCLUDEPATH += $$LIBBLADERFSRC INCLUDEPATH += $$LIBHACKRFSRC INCLUDEPATH += "C:\softs\boost_1_66_0" INCLUDEPATH += "C:\softs\libusb-1.0.20\include" @@ -55,10 +52,6 @@ INCLUDEPATH += $$LIBPERSEUSSRC CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug -!macx:SOURCES += bladerf/devicebladerf.cpp\ - bladerf/devicebladerfvalues.cpp\ - bladerf/devicebladerfshared.cpp - SOURCES += hackrf/devicehackrf.cpp\ hackrf/devicehackrfvalues.cpp\ hackrf/devicehackrfshared.cpp @@ -73,11 +66,6 @@ SOURCES += limesdr/devicelimesdr.cpp\ plutosdr/deviceplutosdrscan.cpp\ plutosdr/deviceplutosdrshared.cpp -!macx:HEADERS -= bladerf/devicebladerf.h\ - bladerf/devicebladerfparam.h\ - bladerf/devicebladerfvalues.h\ - bladerf/devicebladerfshared.h - HEADERS += hackrf/devicehackrf.h\ hackrf/devicehackrfparam.h\ hackrf/devicehackrfvalues.h\ @@ -95,7 +83,6 @@ HEADERS += plutosdr/deviceplutosdr.h\ LIBS += -L../sdrbase/$${build_subdir} -lsdrbase !macx { - LIBS += -L../libbladerf/$${build_subdir} -llibbladerf LIBS += -L../libhackrf/$${build_subdir} -llibhackrf LIBS += -L../liblimesuite/$${build_subdir} -lliblimesuite LIBS += -L../libiio/$${build_subdir} -llibiio diff --git a/devices/readme.md b/devices/readme.md index 13ecf2f02..f6b28ca62 100644 --- a/devices/readme.md +++ b/devices/readme.md @@ -2,21 +2,22 @@ This folder contains classes and methods that can be used by different plugins that work with a common physical device or via network. Thus this can be one of the following devices: - - BladeRF: one Rx and one Tx full duplex. Plugins are: - - bladerfinput - - bladerfoutput + - BladeRF1: one Rx and one Tx full duplex. Plugins are: + - bladerf1input + - bladerf1output + + - BladeRF2: 2 Rx and 2 Tx full duplex (BladeRF 2.0 micro). Plugins are: + - bladerf2input + - bladerf2output - HackRF: one Rx and one Tx half duplex. Plugins are: - hackrfinput - hackrfoutput - - LimeSDR: 2 Rx and 2 Tx full duplex. Plugins are + - LimeSDR: 2 Rx and 2 Tx full duplex (Lime-USB). 1 Rx and 1 Tx full duplex (Lime-Mini). Plugins are - limesdrinput - limesdroutput - PlutoSDR: one Rx and one Tx full duplex. Plugins are - plutosdrinput - plutosdroutput - - - SDRdaemon: sends or receive samples to/from device remotely through the network. Used on the Tx plugin only - - sdrdaemonsink \ No newline at end of file