LimeSDR Windows build: build only for 64 bits. Fixed some missing files

This commit is contained in:
f4exb 2017-05-09 13:19:36 +02:00
parent e6ebf6ffe7
commit 4858ca345c
5 changed files with 190 additions and 20 deletions

View File

@ -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

View File

@ -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\

View File

@ -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<ConnectionHandle> Connection_uLimeSDREntry::enumerate(const ConnectionHandle &hint)
{
std::vector<ConnectionHandle> 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<devCount; ++i)
{
ConnectionHandle handle;
handle.media = "USB";
handle.name = "uLimeSDR";
handle.index = i;
handles.push_back(handle);
}
}
#else
libusb_device **devs; //pointer to pointer of device, used to retrieve a list of devices
int usbDeviceCount = libusb_get_device_list(ctx, &devs);
if (usbDeviceCount < 0) {
printf("failed to get libusb device list: %s\n", libusb_strerror(libusb_error(usbDeviceCount)));
return handles;
}
libusb_device_descriptor desc;
for(int i=0; i<usbDeviceCount; ++i)
{
int r = libusb_get_device_descriptor(devs[i], &desc);
if(r<0)
printf("failed to get device description\n");
int pid = desc.idProduct;
int vid = desc.idVendor;
if( vid == 0x0403)
{
if(pid == 0x601F)
{
libusb_device_handle *tempDev_handle;
tempDev_handle = libusb_open_device_with_vid_pid(ctx, vid, pid);
if(libusb_kernel_driver_active(tempDev_handle, 0) == 1) //find out if kernel driver is attached
{
if(libusb_detach_kernel_driver(tempDev_handle, 0) == 0) //detach it
printf("Kernel Driver Detached!\n");
}
if(libusb_claim_interface(tempDev_handle, 0) < 0) //claim interface 0 (the first) of device
{
printf("Cannot Claim Interface\n");
}
ConnectionHandle handle;
//check operating speed
int speed = libusb_get_device_speed(devs[i]);
if(speed == LIBUSB_SPEED_HIGH)
handle.media = "USB 2.0";
else if(speed == LIBUSB_SPEED_SUPER)
handle.media = "USB 3.0";
else
handle.media = "USB";
//read device name
char data[255];
memset(data, 0, 255);
int st = libusb_get_string_descriptor_ascii(tempDev_handle, 2, (unsigned char*)data, 255);
if(st < 0)
printf("Error getting usb descriptor\n");
if(strlen(data) > 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
}

View File

@ -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

View File

@ -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