mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-26 14:05:33 -04:00
commit
547a43563a
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@ sdrangelove.supp
|
|||||||
.settings/
|
.settings/
|
||||||
*.cs
|
*.cs
|
||||||
*.pro.user
|
*.pro.user
|
||||||
|
.idea/*
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.1.0)
|
cmake_minimum_required(VERSION 3.1.0)
|
||||||
cmake_policy(SET CMP0043 OLD)
|
cmake_policy(SET CMP0043 OLD)
|
||||||
|
|
||||||
|
# QT Framework
|
||||||
|
set(CMAKE_PREFIX_PATH "/Applications/Qt/5.7/clang_64/lib/cmake")
|
||||||
|
|
||||||
# use, i.e. don't skip the full RPATH for the build tree
|
# use, i.e. don't skip the full RPATH for the build tree
|
||||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
|
|
||||||
@ -56,6 +59,10 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
|
|||||||
SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
|
SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# MacOS Compatibility
|
||||||
|
if(APPLE)
|
||||||
|
find_package(ICONV)
|
||||||
|
endif(APPLE)
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
#include(${QT_USE_FILE})
|
#include(${QT_USE_FILE})
|
||||||
|
77
apple_compat.c
Normal file
77
apple_compat.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* APPLE Compatibility
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "apple_compat.h"
|
||||||
|
|
||||||
|
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
|
||||||
|
{
|
||||||
|
if(count == 0)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(pthread_mutex_init(&barrier->mutex, 0) < 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(pthread_cond_init(&barrier->cond, 0) < 0)
|
||||||
|
{
|
||||||
|
pthread_mutex_destroy(&barrier->mutex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
barrier->tripCount = count;
|
||||||
|
barrier->count = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_barrier_destroy(pthread_barrier_t *barrier)
|
||||||
|
{
|
||||||
|
pthread_cond_destroy(&barrier->cond);
|
||||||
|
pthread_mutex_destroy(&barrier->mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_barrier_wait(pthread_barrier_t *barrier)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&barrier->mutex);
|
||||||
|
++(barrier->count);
|
||||||
|
if(barrier->count >= barrier->tripCount)
|
||||||
|
{
|
||||||
|
barrier->count = 0;
|
||||||
|
pthread_cond_broadcast(&barrier->cond);
|
||||||
|
pthread_mutex_unlock(&barrier->mutex);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pthread_cond_wait(&barrier->cond, &(barrier->mutex));
|
||||||
|
pthread_mutex_unlock(&barrier->mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Missing POSIX RealTime/Monotonic Clock
|
||||||
|
*/
|
||||||
|
#include <mach/mach_time.h>
|
||||||
|
|
||||||
|
int clock_gettime(int clk_id, struct timespec *t) {
|
||||||
|
mach_timebase_info_data_t timebase;
|
||||||
|
mach_timebase_info(&timebase);
|
||||||
|
uint64_t time;
|
||||||
|
time = mach_absolute_time();
|
||||||
|
double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom);
|
||||||
|
double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9);
|
||||||
|
t->tv_sec = seconds;
|
||||||
|
t->tv_nsec = nseconds;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // APPLE Compatibility
|
45
apple_compat.h
Normal file
45
apple_compat.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* APPLE Compatibility
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Missing POSIX Thread Barriers implementation
|
||||||
|
*/
|
||||||
|
#ifndef PTHREAD_BARRIER_H_
|
||||||
|
#define PTHREAD_BARRIER_H_
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
typedef int pthread_barrierattr_t;
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
pthread_cond_t cond;
|
||||||
|
int count;
|
||||||
|
int tripCount;
|
||||||
|
} pthread_barrier_t;
|
||||||
|
|
||||||
|
|
||||||
|
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count);
|
||||||
|
|
||||||
|
int pthread_barrier_destroy(pthread_barrier_t *barrier);
|
||||||
|
|
||||||
|
int pthread_barrier_wait(pthread_barrier_t *barrier);
|
||||||
|
|
||||||
|
#endif // PTHREAD_BARRIER_H_
|
||||||
|
|
||||||
|
// <time.h>
|
||||||
|
#ifndef CLOCK_REALTIME
|
||||||
|
# define CLOCK_REALTIME 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CLOCK_MONOTONIC
|
||||||
|
# define CLOCK_MONOTONIC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int clock_gettime(int clk_id, struct timespec *t);
|
||||||
|
|
||||||
|
#endif // APPLE Compatibility
|
73
cmake/Modules/FindICONV.cmake
Normal file
73
cmake/Modules/FindICONV.cmake
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
if (ICONV_INCLUDE_DIR)
|
||||||
|
# Already in cache, be silent
|
||||||
|
set(ICONV_FIND_QUIETLY TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(ICONV_INCLUDE_DIR iconv.h
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include)
|
||||||
|
|
||||||
|
set(POTENTIAL_ICONV_LIBS iconv libiconv libiconv2)
|
||||||
|
|
||||||
|
find_library(ICONV_LIBRARY NAMES ${POTENTIAL_ICONV_LIBS}
|
||||||
|
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(ICONV_DLL_NAMES iconv.dll libiconv.dll libiconv2.dll)
|
||||||
|
find_file(ICONV_DLL
|
||||||
|
NAMES ${ICONV_DLL_NAMES}
|
||||||
|
PATHS ENV PATH
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
find_file(ICONV_DLL_HELP
|
||||||
|
NAMES ${ICONV_DLL_NAMES}
|
||||||
|
PATHS ENV PATH
|
||||||
|
${ICONV_INCLUDE_DIR}/../bin)
|
||||||
|
if(ICONV_FIND_REQUIRED)
|
||||||
|
if(NOT ICONV_DLL AND NOT ICONV_DLL_HELP)
|
||||||
|
message(FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")
|
||||||
|
endif()
|
||||||
|
if(NOT ICONV_DLL AND ICONV_DLL_HELP)
|
||||||
|
get_filename_component(ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH)
|
||||||
|
message(STATUS)
|
||||||
|
message(STATUS "Could not find iconv.dll in standard search path, please add ")
|
||||||
|
message(STATUS "${ICONV_DLL_HELP}")
|
||||||
|
message(STATUS "to your PATH environment variable.")
|
||||||
|
message(STATUS)
|
||||||
|
message(FATAL_ERROR "exit cmake")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)
|
||||||
|
set(ICONV_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
check_function_exists(iconv HAVE_ICONV_IN_LIBC)
|
||||||
|
if(ICONV_INCLUDE_DIR AND HAVE_ICONV_IN_LIBC)
|
||||||
|
set(ICONV_FOUND TRUE)
|
||||||
|
set(ICONV_LIBRARY CACHE TYPE STRING FORCE)
|
||||||
|
endif()
|
||||||
|
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
|
||||||
|
set(ICONV_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(ICONV_FOUND)
|
||||||
|
if(NOT ICONV_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found iconv library: ${ICONV_LIBRARY}")
|
||||||
|
#message(STATUS "Found iconv dll : ${ICONV_DLL}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(ICONV_FIND_REQUIRED)
|
||||||
|
message(STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.")
|
||||||
|
message(STATUS "Found no acceptable iconv library. This is fatal.")
|
||||||
|
message(STATUS "iconv header: ${ICONV_INCLUDE_DIR}")
|
||||||
|
message(STATUS "iconv lib : ${ICONV_LIBRARY}")
|
||||||
|
message(FATAL_ERROR "Could NOT find iconv library")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR)
|
@ -1,11 +1,13 @@
|
|||||||
project(fcdhid)
|
project(fcdhid)
|
||||||
|
|
||||||
set(fcdhid_SOURCES
|
set(fcdhid_SOURCES
|
||||||
|
../apple_compat.c
|
||||||
hid-libusb.c
|
hid-libusb.c
|
||||||
fcdhid.c
|
fcdhid.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(fcdhid_HEADERS
|
set(fcdhid_HEADERS
|
||||||
|
../apple_compat.h
|
||||||
fcdhid.h
|
fcdhid.h
|
||||||
hid-libusb.h
|
hid-libusb.h
|
||||||
hidapi.h
|
hidapi.h
|
||||||
@ -25,6 +27,7 @@ add_library(fcdhid SHARED
|
|||||||
|
|
||||||
target_link_libraries(fcdhid
|
target_link_libraries(fcdhid
|
||||||
${LIBUSB_LIBRARIES}
|
${LIBUSB_LIBRARIES}
|
||||||
|
${ICONV_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS fcdhid DESTINATION lib)
|
install(TARGETS fcdhid DESTINATION lib)
|
@ -65,6 +65,15 @@ extern "C" {
|
|||||||
#define DETACH_KERNEL_DRIVER
|
#define DETACH_KERNEL_DRIVER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MacOS does not implement POSIX Thread Barriers
|
||||||
|
*/
|
||||||
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
#include "../apple_compat.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Uncomment to enable the retrieval of Usage and Usage Page in
|
/* Uncomment to enable the retrieval of Usage and Usage Page in
|
||||||
hid_enumerate(). Warning, on platforms different from FreeBSD
|
hid_enumerate(). Warning, on platforms different from FreeBSD
|
||||||
this is very invasive as it requires the detach
|
this is very invasive as it requires the detach
|
||||||
|
@ -526,15 +526,21 @@ void RDSParser::decode_type0(unsigned int *group, bool B)
|
|||||||
|
|
||||||
if (af_1)
|
if (af_1)
|
||||||
{
|
{
|
||||||
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_1/1e3);
|
// @TODO: Find proper header or STL on OSX
|
||||||
m_g0_af_updated = m_g0_af_updated || res.second;
|
#ifndef __APPLE__
|
||||||
|
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_1/1e3);
|
||||||
|
m_g0_af_updated = m_g0_af_updated || res.second;
|
||||||
|
#endif
|
||||||
no_af += 1;
|
no_af += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (af_2)
|
if (af_2)
|
||||||
{
|
{
|
||||||
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_2/1e3);
|
// @TODO: Find proper header or STL on OSX
|
||||||
m_g0_af_updated = m_g0_af_updated || res.second;
|
#ifndef __APPLE__
|
||||||
|
std::pair<std::_Rb_tree_const_iterator<double>, bool> res = m_g0_alt_freq.insert(af_2/1e3);
|
||||||
|
m_g0_af_updated = m_g0_af_updated || res.second;
|
||||||
|
#endif
|
||||||
no_af += 2;
|
no_af += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ set(hackrf_FORMS
|
|||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${LIBHACKRF_INCLUDE_DIR}
|
${LIBHACKRF_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
30
sdrangel.macos.pro
Normal file
30
sdrangel.macos.pro
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#--------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Pro file for MacOS builds with Qt Creator
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------
|
||||||
|
|
||||||
|
TEMPLATE = subdirs
|
||||||
|
SUBDIRS = sdrbase
|
||||||
|
SUBDIRS += lz4
|
||||||
|
SUBDIRS += librtlsdr
|
||||||
|
SUBDIRS += libhackrf
|
||||||
|
SUBDIRS += libairspy
|
||||||
|
SUBDIRS += plugins/samplesource/filesource
|
||||||
|
SUBDIRS += plugins/samplesource/sdrdaemon
|
||||||
|
SUBDIRS += plugins/samplesource/rtlsdr
|
||||||
|
SUBDIRS += plugins/samplesource/hackrf
|
||||||
|
SUBDIRS += plugins/samplesource/airspy
|
||||||
|
SUBDIRS += plugins/channel/chanalyzer
|
||||||
|
SUBDIRS += plugins/channel/demodam
|
||||||
|
SUBDIRS += plugins/channel/demodbfm
|
||||||
|
SUBDIRS += plugins/channel/demodlora
|
||||||
|
SUBDIRS += plugins/channel/demodnfm
|
||||||
|
SUBDIRS += plugins/channel/demodssb
|
||||||
|
SUBDIRS += plugins/channel/demodwfm
|
||||||
|
SUBDIRS += plugins/channel/tcpsrc
|
||||||
|
SUBDIRS += plugins/channel/udpsrc
|
||||||
|
|
||||||
|
# Main app must be last
|
||||||
|
CONFIG += ordered
|
||||||
|
SUBDIRS += app
|
@ -150,8 +150,12 @@ bool AudioOutput::open(OpenMode mode)
|
|||||||
|
|
||||||
qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
||||||
{
|
{
|
||||||
//qDebug("AudioOutput::readData: %lld", maxLen);
|
//qDebug("AudioOutput::readData: %lld", maxLen);
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
|
||||||
|
// @TODO: Study this mutex on OSX, for now deadlocks possible
|
||||||
|
#ifndef __APPLE__
|
||||||
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned int framesPerBuffer = maxLen / 4;
|
unsigned int framesPerBuffer = maxLen / 4;
|
||||||
|
|
||||||
@ -183,7 +187,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
|||||||
|
|
||||||
if (samples != framesPerBuffer)
|
if (samples != framesPerBuffer)
|
||||||
{
|
{
|
||||||
//qDebug("AudioOutput::readData: read %d samples vs %d requested", samples, framesPerBuffer);
|
qDebug("AudioOutput::readData: read %d samples vs %d requested", samples, framesPerBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < samples; i++)
|
for (uint i = 0; i < samples; i++)
|
||||||
@ -195,8 +199,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
|||||||
++src;
|
++src;
|
||||||
++dst;
|
++dst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert to int16
|
// convert to int16
|
||||||
|
|
||||||
//std::vector<qint32>::const_iterator src = m_mixBuffer.begin(); // Valgrind optim
|
//std::vector<qint32>::const_iterator src = m_mixBuffer.begin(); // Valgrind optim
|
||||||
|
@ -182,7 +182,7 @@ void PhaseLock::process(const std::vector<Real>& samples_in, std::vector<Real>&
|
|||||||
|
|
||||||
// Convert I/Q ratio to estimate of phase error.
|
// Convert I/Q ratio to estimate of phase error.
|
||||||
Real phase_err;
|
Real phase_err;
|
||||||
if (phasor_i > abs(phasor_q)) {
|
if (phasor_i > std::abs(phasor_q)) {
|
||||||
// We are within +/- 45 degrees from lock.
|
// We are within +/- 45 degrees from lock.
|
||||||
// Use simple linear approximation of arctan.
|
// Use simple linear approximation of arctan.
|
||||||
phase_err = phasor_q / phasor_i;
|
phase_err = phasor_q / phasor_i;
|
||||||
@ -278,7 +278,7 @@ void PhaseLock::process(const Real& sample_in, Real *samples_out)
|
|||||||
|
|
||||||
// Convert I/Q ratio to estimate of phase error.
|
// Convert I/Q ratio to estimate of phase error.
|
||||||
Real phase_err;
|
Real phase_err;
|
||||||
if (phasor_i > abs(phasor_q)) {
|
if (phasor_i > std::abs(phasor_q)) {
|
||||||
// We are within +/- 45 degrees from lock.
|
// We are within +/- 45 degrees from lock.
|
||||||
// Use simple linear approximation of arctan.
|
// Use simple linear approximation of arctan.
|
||||||
phase_err = phasor_q / phasor_i;
|
phase_err = phasor_q / phasor_i;
|
||||||
|
@ -355,7 +355,7 @@ void PluginManager::loadPlugins(const QDir& dir)
|
|||||||
|
|
||||||
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
|
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
|
||||||
{
|
{
|
||||||
if (fileName.endsWith(".so") || fileName.endsWith(".dll"))
|
if (fileName.endsWith(".so") || fileName.endsWith(".dll") || fileName.endsWith(".dylib"))
|
||||||
{
|
{
|
||||||
qDebug() << "PluginManager::loadPlugins: fileName: " << qPrintable(fileName);
|
qDebug() << "PluginManager::loadPlugins: fileName: " << qPrintable(fileName);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user