From fb161a09c6c403e276b7d774f3c0f21d453b7b18 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 10 Apr 2017 23:57:15 +0200 Subject: [PATCH] LimeSDR support (1) --- Readme.md | 15 ++++++++++ cmake/Modules/FindLimeSuite.cmake | 19 +++++++++++++ devices/limesdr/CMakeLists.txt | 41 +++++++++++++++++++++++++++ devices/limesdr/devicelimesdrparam.h | 42 ++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 cmake/Modules/FindLimeSuite.cmake create mode 100644 devices/limesdr/CMakeLists.txt create mode 100644 devices/limesdr/devicelimesdrparam.h diff --git a/Readme.md b/Readme.md index e5b356c04..cb2e47167 100644 --- a/Readme.md +++ b/Readme.md @@ -76,6 +76,21 @@ If you use your own location for libhackrf install directory you need to specify HackRF is better used with a sampling rate of 4.8 MS/s and above. The 2.4 and 3.2 MS/s rates are considered experimental and are way out of specs of the ADC. You may or may not achieve acceptable results depending on the unit. A too low sampling rate will typically create ghost signals (images) and/or raise the noise floor. +

LimeSDR

+ +⚠ This is a wotk in progress + +You will need a minimal installation of LimeSuite: + + - `sudo apt-get install libsqlite3-dev` + - `git clone https://github.com/myriadrf/LimeSuite.git` + - `cd LimeSuite` + - `mkdir builddir` + - `cd builddir` + - `cmake -DCMAKE_INSTALL_PREFIX=/opt/install/LimeSuite` + - `make -j8` + - `make install` +

RTL-SDR

RTL-SDR based dongles are supported through the librtlsdr library that should be installed in your system for proper build of the software and operation support. Add `librtlsdr-dev` to the list of dependencies to install. diff --git a/cmake/Modules/FindLimeSuite.cmake b/cmake/Modules/FindLimeSuite.cmake new file mode 100644 index 000000000..ac358aad4 --- /dev/null +++ b/cmake/Modules/FindLimeSuite.cmake @@ -0,0 +1,19 @@ +# Find Lime Suite + +FIND_PATH(LIMESUITE_INCLUDE_DIR lime/LimeSuite.h) + +IF (LIMESUITE_INCLUDE_DIR AND LIMESUITE_LIBRARY) + SET(LIMESUITE_FOUND TRUE) +ENDIF (LIMESUITE_INCLUDE_DIR AND LIMESUITE_LIBRARY) + +IF (LIMESUITE_FOUND) + IF (NOT LimeSuite_FIND_QUIETLY) + MESSAGE (STATUS "Found Lime Suite: ${LIMESUITE_INCLUDE_DIR}, ${LIMESUITE_LIBRARY}") + ENDIF (NOT LimeSuite_FIND_QUIETLY) +ELSE (LIMESUITE_FOUND) + IF (LimeSuite_FIND_REQUIRED) + MESSAGE (FATAL_ERROR "Could not find Lime Suite") + ENDIF (LimeSuite_FIND_REQUIRED) +ENDIF (LIMESUITE_FOUND) + +mark_as_advanced(LIMESUITE_INCLUDE_DIR LIMESUITE_LIBRARY) diff --git a/devices/limesdr/CMakeLists.txt b/devices/limesdr/CMakeLists.txt new file mode 100644 index 000000000..cbcde3cb5 --- /dev/null +++ b/devices/limesdr/CMakeLists.txt @@ -0,0 +1,41 @@ +project(limesdrdevice) + +set(limesdrdevice_SOURCES +) + +set(limesdrdevice_HEADERS + devicelimesdrparam.h +) + +if (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIMESUITESRC}/include + ${LIMESUITESRC}/src +) +else (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIMESUITE_INCLUDE_DIR} +) +endif (BUILD_DEBIAN) + +add_library(limesdrdevice SHARED + ${limesdrdevice_SOURCES} +) + +if (BUILD_DEBIAN) +target_link_libraries(limesdrdevice + limesuite + sdrbase +) +else (BUILD_DEBIAN) +target_link_libraries(limesdrdevice + ${LIMESUITE_LIBRARY} + sdrbase +) +endif (BUILD_DEBIAN) + +install(TARGETS limesdrdevice DESTINATION lib) diff --git a/devices/limesdr/devicelimesdrparam.h b/devices/limesdr/devicelimesdrparam.h new file mode 100644 index 000000000..ceff0522d --- /dev/null +++ b/devices/limesdr/devicelimesdrparam.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ +#define DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ + +#include "lime/LimeSuite.h" + +/** + * This structure is owned by each of the parties sharing the same physical device + * It allows exchange of information on the common resources + */ +struct DeviceLimeSDRParams +{ + lms_device_t *m_dev; //!< device handle if the party has ownership else 0 + lms_range_t m_lpfRangeRx; //!< Low pass filter range information (Rx side) + lms_range_t m_lpfRangeTx; //!< Low pass filter range information (Tx side) + lms_range_t m_loRangeRx[2]; //!< LO range for Rx + lms_range_t m_loRangeTx[2]; //!< LO range for Tx + lms_range_t m_srRangeRx[2]; //!< ADC sample rate range + lms_range_t m_srRangeTx[2]; //!< DAC sample rate range + + DeviceLimeSDRParams() : + m_dev(0) + { + } +}; + +#endif /* DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ */