diff --git a/devices/devices.pro b/devices/devices.pro index 3d58982c9..723c3361b 100644 --- a/devices/devices.pro +++ b/devices/devices.pro @@ -25,17 +25,17 @@ INCLUDEPATH += $$PWD INCLUDEPATH += ../sdrbase INCLUDEPATH += $$LIBBLADERFSRC INCLUDEPATH += $$LIBHACKRFSRC -INCLUDEPATH += ../liblimesuite/srcmw -INCLUDEPATH += $$LIBLIMESUITESRC/src -INCLUDEPATH += $$LIBLIMESUITESRC/src/ADF4002 -INCLUDEPATH += $$LIBLIMESUITESRC/src/ConnectionRegistry -INCLUDEPATH += $$LIBLIMESUITESRC/src/FPGA_common -INCLUDEPATH += $$LIBLIMESUITESRC/src/GFIR -INCLUDEPATH += $$LIBLIMESUITESRC/src/lms7002m -INCLUDEPATH += $$LIBLIMESUITESRC/src/lms7002m_mcu -INCLUDEPATH += $$LIBLIMESUITESRC/src/Si5351C -INCLUDEPATH += $$LIBLIMESUITESRC/src/protocols -INCLUDEPATH += $$LIBLIMESUITESRC/external/cpp-feather-ini-parser +CONFIG(MINGW64)INCLUDEPATH += ../liblimesuite/srcmw +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/ADF4002 +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/ConnectionRegistry +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/FPGA_common +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/GFIR +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/lms7002m +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/lms7002m_mcu +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/Si5351C +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/src/protocols +CONFIG(MINGW64)INCLUDEPATH += $$LIBLIMESUITESRC/external/cpp-feather-ini-parser CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug @@ -43,8 +43,9 @@ CONFIG(Debug):build_subdir = debug SOURCES += bladerf/devicebladerf.cpp\ bladerf/devicebladerfvalues.cpp\ hackrf/devicehackrf.cpp\ - hackrf/devicehackrfvalues.cpp\ - limesdr/devicelimesdr.cpp\ + hackrf/devicehackrfvalues.cpp + +CONFIG(MINGW64)SOURCES += limesdr/devicelimesdr.cpp\ limesdr/devicelimesdrparam.cpp\ limesdr/devicelimesdrshared.cpp @@ -54,11 +55,12 @@ HEADERS += bladerf/devicebladerf.h\ hackrf/devicehackrf.h\ hackrf/devicehackrfparam.h\ hackrf/devicehackrfvalues.h\ - limesdr/devicelimesdr.h\ + +CONFIG(MINGW64)HEADERS += limesdr/devicelimesdr.h\ limesdr/devicelimesdrparam.h\ limesdr/devicelimesdrshared.h LIBS += -L../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../libbladerf/$${build_subdir} -llibbladerf LIBS += -L../libhackrf/$${build_subdir} -llibhackrf -LIBS += -L../liblimesuite/$${build_subdir} -lliblimesuite +CONFIG(MINGW64)LIBS += -L../liblimesuite/$${build_subdir} -lliblimesuite diff --git a/liblimesuite/liblimesuite.pro b/liblimesuite/liblimesuite.pro index 6c872015a..543e319d7 100644 --- a/liblimesuite/liblimesuite.pro +++ b/liblimesuite/liblimesuite.pro @@ -44,7 +44,7 @@ SOURCES = $$LIBLIMESUITESRC/src/ADF4002/ADF4002.cpp\ srcmw/ConnectionSTREAM/ConnectionSTREAMImages.cpp\ srcmw/ConnectionSTREAM/ConnectionSTREAMing.cpp\ srcmw/Connection_uLimeSDR/Connection_uLimeSDR.cpp\ - $$LIBLIMESUITESRC/src/Connection_uLimeSDR/Connection_uLimeSDREntry.cpp\ + srcmw/Connection_uLimeSDR/Connection_uLimeSDREntry.cpp\ srcmw/Connection_uLimeSDR/Connection_uLimeSDRing.cpp\ $$LIBLIMESUITESRC/src/ConnectionXillybus/ConnectionXillybus.cpp\ $$LIBLIMESUITESRC/src/ConnectionXillybus/ConnectionXillybusEntry.cpp\ diff --git a/liblimesuite/srcmw/Connection_uLimeSDR/Connection_uLimeSDREntry.cpp b/liblimesuite/srcmw/Connection_uLimeSDR/Connection_uLimeSDREntry.cpp new file mode 100644 index 000000000..0d6132a21 --- /dev/null +++ b/liblimesuite/srcmw/Connection_uLimeSDR/Connection_uLimeSDREntry.cpp @@ -0,0 +1,167 @@ +/** + @file Connection_uLimeSDREntry.cpp + @author Lime Microsystems + @brief Implementation of uLimeSDR board connection. +*/ + +#include "Connection_uLimeSDR.h" +using namespace lime; + +#ifdef __unix__ +void Connection_uLimeSDREntry::handle_libusb_events() +{ + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 250000; + while(mProcessUSBEvents.load() == true) + { + int r = libusb_handle_events_timeout_completed(ctx, &tv, NULL); + if(r != 0) printf("error libusb_handle_events %s\n", libusb_strerror(libusb_error(r))); + } +} +#endif // __UNIX__ + +int Connection_uLimeSDR::USBTransferContext::idCounter=0; + +//! make a static-initialized entry in the registry +void __loadConnection_uLimeSDREntry(void) //TODO fixme replace with LoadLibrary/dlopen +{ +static Connection_uLimeSDREntry uLimeSDREntry; +} + +Connection_uLimeSDREntry::Connection_uLimeSDREntry(void): + ConnectionRegistryEntry("uLimeSDR") +{ +#ifndef __unix__ + //m_pDriver = new CDriverInterface(); +#else + int r = libusb_init(&ctx); //initialize the library for the session we just declared + if(r < 0) + printf("Init Error %i\n", r); //there was an error + libusb_set_debug(ctx, 3); //set verbosity level to 3, as suggested in the documentation + mProcessUSBEvents.store(true); + mUSBProcessingThread = std::thread(&Connection_uLimeSDREntry::handle_libusb_events, this); +#endif +} + +Connection_uLimeSDREntry::~Connection_uLimeSDREntry(void) +{ +#ifndef __unix__ + //delete m_pDriver; +#else + mProcessUSBEvents.store(false); + mUSBProcessingThread.join(); + libusb_exit(ctx); +#endif +} + +std::vector Connection_uLimeSDREntry::enumerate(const ConnectionHandle &hint) +{ + std::vector handles; + +#ifndef __unix__ + DWORD devCount = 0; + FT_STATUS ftStatus = FT_OK; + ftStatus = FT_ListDevices(&devCount, NULL, FT_LIST_NUMBER_ONLY); + if(FT_FAILED(ftStatus)) + return handles; + if (devCount > 0) + { + for(int i = 0; i 0) + handle.name = std::string(data, size_t(st)); + handle.addr = std::to_string(int(pid))+":"+std::to_string(int(vid)); + + if (desc.iSerialNumber > 0) + { + r = libusb_get_string_descriptor_ascii(tempDev_handle,desc.iSerialNumber,(unsigned char*)data, sizeof(data)); + if(r<0) + printf("failed to get serial number\n"); + else + handle.serial = std::string(data, size_t(r)); + } + libusb_close(tempDev_handle); + + //add handle conditionally, filter by serial number + if (hint.serial.empty() or hint.serial == handle.serial) + { + handles.push_back(handle); + } + } + } + } + + libusb_free_device_list(devs, 1); +#endif + return handles; +} + +IConnection *Connection_uLimeSDREntry::make(const ConnectionHandle &handle) +{ +#ifndef __unix__ + return new Connection_uLimeSDR(mFTHandle, handle.index); +#else + const auto pidvid = handle.addr; + const auto splitPos = pidvid.find(":"); + const auto pid = std::stoi(pidvid.substr(0, splitPos)); + const auto vid = std::stoi(pidvid.substr(splitPos+1)); + return new Connection_uLimeSDR(ctx, handle.index, vid, pid); +#endif +} diff --git a/sdrangel.windows.pro b/sdrangel.windows.pro index ebc2907e1..1cd276c75 100644 --- a/sdrangel.windows.pro +++ b/sdrangel.windows.pro @@ -15,8 +15,8 @@ SUBDIRS += librtlsdr SUBDIRS += libhackrf SUBDIRS += libairspy SUBDIRS += libbladerf -SUBDIRS += libsqlite3 -SUBDIRS += liblimesuite +CONFIG(MINGW64)SUBDIRS += libsqlite3 +CONFIG(MINGW64)SUBDIRS += liblimesuite SUBDIRS += mbelib SUBDIRS += dsdcc SUBDIRS += serialdv @@ -28,11 +28,11 @@ SUBDIRS += plugins/samplesource/rtlsdr SUBDIRS += plugins/samplesource/hackrfinput SUBDIRS += plugins/samplesource/airspy SUBDIRS += plugins/samplesource/bladerfinput -SUBDIRS += plugins/samplesource/limesdrinput +CONFIG(MINGW64)SUBDIRS += plugins/samplesource/limesdrinput SUBDIRS += plugins/samplesink/filesink SUBDIRS += plugins/samplesink/bladerfoutput SUBDIRS += plugins/samplesink/hackrfoutput -SUBDIRS += plugins/samplesink/limesdroutput +CONFIG(MINGW64)SUBDIRS += plugins/samplesink/limesdroutput SUBDIRS += plugins/channelrx/chanalyzer SUBDIRS += plugins/channelrx/chanalyzerng SUBDIRS += plugins/channelrx/demodam diff --git a/windows64.install.bat b/windows64.install.bat index ce3bff5a8..a2c210d9f 100644 --- a/windows64.install.bat +++ b/windows64.install.bat @@ -25,6 +25,7 @@ copy libhackrf\%1\libhackrf.dll %2 copy librtlsdr\%1\librtlsdr.dll %2 copy libairspy\%1\libairspy.dll %2 copy libbladerf\%1\libbladerf.dll %2 +copy libsqlite3\%1\libsqlite3.dll %2 copy liblimesuite\%1\liblimesuite.dll %2 copy %libusbdir%\dll\libusb-1.0.dll %2 copy %opencvdir%\opencv_ffmpeg2413_64.dll %2