diff -Nru libad9361-0.1/ad9361_baseband_auto_rate.c libad9361-0.1.6/ad9361_baseband_auto_rate.c --- libad9361-0.1/ad9361_baseband_auto_rate.c 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/ad9361_baseband_auto_rate.c 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2016 Analog Devices, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + */ + +#include "ad9361.h" + +#include +#include +#include +#ifdef _WIN32 +#include +#else +#include +#endif + +#ifdef _MSC_BUILD +#define snprintf sprintf_s +#endif + +static int16_t fir_128_4[] = { + -15,-27,-23,-6,17,33,31,9,-23,-47,-45,-13,34,69,67,21,-49,-102,-99,-32,69,146,143,48,-96,-204,-200,-69,129,278,275,97,-170, + -372,-371,-135,222,494,497,187,-288,-654,-665,-258,376,875,902,363,-500,-1201,-1265,-530,699,1748,1906,845,-1089,-2922,-3424, + -1697,2326,7714,12821,15921,15921,12821,7714,2326,-1697,-3424,-2922,-1089,845,1906,1748,699,-530,-1265,-1201,-500,363,902,875, + 376,-258,-665,-654,-288,187,497,494,222,-135,-371,-372,-170,97,275,278,129,-69,-200,-204,-96,48,143,146,69,-32,-99,-102,-49,21, + 67,69,34,-13,-45,-47,-23,9,31,33,17,-6,-23,-27,-15}; + +static int16_t fir_128_2[] = { + -0,0,1,-0,-2,0,3,-0,-5,0,8,-0,-11,0,17,-0,-24,0,33,-0,-45,0,61,-0,-80,0,104,-0,-134,0,169,-0, + -213,0,264,-0,-327,0,401,-0,-489,0,595,-0,-724,0,880,-0,-1075,0,1323,-0,-1652,0,2114,-0,-2819,0,4056,-0,-6883,0,20837,32767, + 20837,0,-6883,-0,4056,0,-2819,-0,2114,0,-1652,-0,1323,0,-1075,-0,880,0,-724,-0,595,0,-489,-0,401,0,-327,-0,264,0,-213,-0, + 169,0,-134,-0,104,0,-80,-0,61,0,-45,-0,33,0,-24,-0,17,0,-11,-0,8,0,-5,-0,3,0,-2,-0,1,0,-0, 0 }; + +static int16_t fir_96_2[] = { + -4,0,8,-0,-14,0,23,-0,-36,0,52,-0,-75,0,104,-0,-140,0,186,-0,-243,0,314,-0,-400,0,505,-0,-634,0,793,-0, + -993,0,1247,-0,-1585,0,2056,-0,-2773,0,4022,-0,-6862,0,20830,32767,20830,0,-6862,-0,4022,0,-2773,-0,2056,0,-1585,-0,1247,0,-993,-0, + 793,0,-634,-0,505,0,-400,-0,314,0,-243,-0,186,0,-140,-0,104,0,-75,-0,52,0,-36,-0,23,0,-14,-0,8,0,-4,0}; + +static int16_t fir_64_2[] = { + -58,0,83,-0,-127,0,185,-0,-262,0,361,-0,-488,0,648,-0,-853,0,1117,-0,-1466,0,1954,-0,-2689,0,3960,-0,-6825,0,20818,32767, + 20818,0,-6825,-0,3960,0,-2689,-0,1954,0,-1466,-0,1117,0,-853,-0,648,0,-488,-0,361,0,-262,-0,185,0,-127,-0,83,0,-58,0}; + +#define FIR_BUF_SIZE 8192 + +int ad9361_set_trx_fir_enable(struct iio_device *dev, int enable) +{ + int ret = iio_device_attr_write_bool(dev, + "in_out_voltage_filter_fir_en", !!enable); + if (ret < 0) + ret = iio_channel_attr_write_bool(iio_device_find_channel(dev, "out", false), + "voltage_filter_fir_en", !!enable); + return ret; +} + +int ad9361_get_trx_fir_enable(struct iio_device *dev, int *enable) +{ + bool value; + + int ret = iio_device_attr_read_bool(dev, "in_out_voltage_filter_fir_en", &value); + + if (ret < 0) + ret = iio_channel_attr_read_bool(iio_device_find_channel(dev, "out", false), + "voltage_filter_fir_en", &value); + + if (!ret) + *enable = value; + + return ret; +} + +int ad9361_set_bb_rate(struct iio_device *dev, unsigned long rate) +{ + struct iio_channel *chan; + long long current_rate; + int dec, taps, ret, i, enable, len = 0; + int16_t *fir; + char *buf; + + if (rate <= 20000000UL) { + dec = 4; + taps = 128; + fir = fir_128_4; + } else if (rate <= 40000000UL) { + dec = 2; + fir = fir_128_2; + taps = 128; + } else if (rate <= 53333333UL) { + dec = 2; + fir = fir_96_2; + taps = 96; + } else { + dec = 2; + fir = fir_64_2; + taps = 64; + } + + chan = iio_device_find_channel(dev, "voltage0", true); + if (chan == NULL) + return -ENODEV; + + ret = iio_channel_attr_read_longlong(chan, "sampling_frequency", ¤t_rate); + if (ret < 0) + return ret; + + ret = ad9361_get_trx_fir_enable(dev, &enable); + if (ret < 0) + return ret; + + if (enable) { + if (current_rate <= (25000000 / 12)) + iio_channel_attr_write_longlong(chan, "sampling_frequency", 3000000); + + ret = ad9361_set_trx_fir_enable(dev, false); + if (ret < 0) + return ret; + } + + buf = malloc(FIR_BUF_SIZE); + if (!buf) + return -ENOMEM; + + len += snprintf(buf + len, FIR_BUF_SIZE - len, "RX 3 GAIN -6 DEC %d\n", dec); + len += snprintf(buf + len, FIR_BUF_SIZE - len, "TX 3 GAIN 0 INT %d\n", dec); + + for (i = 0; i < taps; i++) + len += snprintf(buf + len, FIR_BUF_SIZE - len, "%d,%d\n", fir[i], fir[i]); + + len += snprintf(buf + len, FIR_BUF_SIZE - len, "\n"); + + ret = iio_device_attr_write_raw(dev, "filter_fir_config", buf, len); + free (buf); + + if (ret < 0) + return ret; + + if (rate <= (25000000 / 12)) { + ret = ad9361_set_trx_fir_enable(dev, true); + if (ret < 0) + return ret; + ret = iio_channel_attr_write_longlong(chan, "sampling_frequency", rate); + if (ret < 0) + return ret; + } else { + ret = iio_channel_attr_write_longlong(chan, "sampling_frequency", rate); + if (ret < 0) + return ret; + ret = ad9361_set_trx_fir_enable(dev, true); + if (ret < 0) + return ret; + } + + return 0; +} diff -Nru libad9361-0.1/ad9361.h libad9361-0.1.6/ad9361.h --- libad9361-0.1/ad9361.h 2015-08-17 13:38:16.000000000 +0000 +++ libad9361-0.1.6/ad9361.h 2017-12-07 19:00:34.000000000 +0000 @@ -23,16 +23,38 @@ #define FIXUP_INTERFACE_TIMING 1 #define CHECK_SAMPLE_RATES 2 +#ifdef _WIN32 +# ifdef LIBAD9361_EXPORTS +# define __api __declspec(dllexport) +# else +# define __api __declspec(dllimport) +# endif +#elif __GNUC__ >= 4 +# define __api __attribute__((visibility ("default"))) +#else +# define __api +#endif + struct iio_context; struct iio_device; -int ad9361_multichip_sync(struct iio_device *master, struct iio_device **slaves, - unsigned int num_slaves, unsigned int flags); +__api int ad9361_multichip_sync(struct iio_device *master, + struct iio_device **slaves, unsigned int num_slaves, + unsigned int flags); + +__api int ad9361_fmcomms5_multichip_sync( + struct iio_context *ctx, unsigned int flags); -int ad9361_fmcomms5_multichip_sync(struct iio_context *ctx, unsigned int flags); +__api int ad9361_set_bb_rate(struct iio_device *dev, unsigned long rate); + +__api int ad9361_set_trx_fir_enable(struct iio_device *dev, int enable); + +__api int ad9361_get_trx_fir_enable(struct iio_device *dev, int *enable); #ifdef __cplusplus } #endif +#undef __api + #endif /* __AD9361_H__ */ diff -Nru libad9361-0.1/ad9361_multichip_sync.c libad9361-0.1.6/ad9361_multichip_sync.c --- libad9361-0.1/ad9361_multichip_sync.c 2015-08-17 13:38:16.000000000 +0000 +++ libad9361-0.1.6/ad9361_multichip_sync.c 2017-12-07 19:00:34.000000000 +0000 @@ -17,7 +17,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #define MAX_AD9361_SYNC_DEVS 4 @@ -86,7 +90,11 @@ else iio_device_attr_write_longlong(master, "multichip_sync", step); +#ifdef _WIN32 + Sleep(1); +#else usleep(1000); +#endif } iio_device_attr_write(master, "ensm_mode", ensm_mode[0]); diff -Nru libad9361-0.1/appveyor.yml libad9361-0.1.6/appveyor.yml --- libad9361-0.1/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/appveyor.yml 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,47 @@ +version: 2015.1.{build} +clone_depth: 1 + +install: + # Download libiio + - cd c:\ + - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win32.zip?branch=master + - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win64.zip?branch=master + - 7z x libiio-win32.zip + - 7z x libiio-win64.zip + +build_script: + # 32-bit build + - mkdir c:\projects\libad9361-iio\build-win32 + - cd c:\projects\libad9361-iio\build-win32 + - cmake -G "Visual Studio 12" \ + -DLIBIIO_LIBRARIES:FILEPATH=c:/libiio-win32/libiio.lib \ + -DLIBIIO_INCLUDEDIR:PATH=c:/libiio-win32 \ + -DCMAKE_CONFIGURATION_TYPES=Release \ + .. + - cmake --build . --config Release + + # 64-bit build + - mkdir c:\projects\libad9361-iio\build-win64 + - cd c:\projects\libad9361-iio\build-win64 + - cmake -G "Visual Studio 12 Win64" \ + -DLIBIIO_LIBRARIES:FILEPATH=c:/libiio-win64/libiio.lib \ + -DLIBIIO_INCLUDEDIR:PATH=c:/libiio-win64 \ + -DCMAKE_CONFIGURATION_TYPES=Release \ + .. + - cmake --build . --config Release + + # Create ZIPs + - cd c:\projects\libad9361-iio + - mkdir c:\libad9361-win32 + - copy ad9361.h c:\libad9361-win32\ + - copy build-win32\Release\libad9361.* c:\libad9361-win32\ + - copy c:\libiio-win32\*.dll c:\libad9361-win32\ + - 7z a "c:\libad9361-win32.zip" c:\libad9361-win32 + - appveyor PushArtifact c:\libad9361-win32.zip + + - mkdir c:\libad9361-win64 + - copy ad9361.h c:\libad9361-win64\ + - copy build-win64\Release\libad9361.* c:\libad9361-win64\ + - copy c:\libiio-win64\*.dll c:\libad9361-win64\ + - 7z a "c:\libad9361-win64.zip" c:\libad9361-win64 + - appveyor PushArtifact c:\libad9361-win64.zip diff -Nru libad9361-0.1/CI/travis/before_deploy libad9361-0.1.6/CI/travis/before_deploy --- libad9361-0.1/CI/travis/before_deploy 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/before_deploy 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,58 @@ +#!/bin/sh + +cd $TRAVIS_BUILD_DIR + +check_file() +{ +temp=$(find ./build* -maxdepth 1 -name "*.$1") +if [ "$(echo ${temp} | wc -w)" -gt "1" ] ; then + echo "I am confused - more than 2 $1 files" + echo $temp + exit +fi +} + +check_file deb +if [ -n "${temp}" ] ; then + export RELEASE_PKG_FILE_DEB=${temp} + export TARGET_DEB=$(echo ${RELEASE_PKG_FILE_DEB} | \ + sed -e 's:^./.*/::' -e 's:.deb$::')${LDIST}.deb + echo "deploying $RELEASE_PKG_FILE_DEB to nightly $TARGET_DEB" + ls -lh ${RELEASE_PKG_FILE_DEB} +else + echo "Skipping deployment of debian package" +fi + +check_file rpm +if [ -n "${temp}" ] ; then + export RELEASE_PKG_FILE_RPM=${temp} + export TARGET_RPM=$(echo ${RELEASE_PKG_FILE_RPM} | \ + sed -e 's:^./.*/::' -e 's:.rpm$::')${LDIST}.rpm + echo "deploying $RELEASE_PKG_FILE_RPM to nightly $TARGET_RPM" + ls -lh ${RELEASE_PKG_FILE_RPM} +else + echo "Skipping deployment of rpm package" +fi + +check_file tar.gz +if [ -n "${temp}" ] ; then + export RELEASE_PKG_FILE_TGZ=${temp} + export TARGET_TGZ=$(echo ${RELEASE_PKG_FILE_TGZ} | \ + sed -e 's:^./.*/::' -e 's:.tar.gz$::')${LDIST}.tar.gz; + echo "deploying $RELEASE_PKG_FILE_TGZ to $TARGET_TGZ" + ls -lh ${RELEASE_PKG_FILE_TGZ} +else + echo "Skipping deployment of tarball" +fi + +check_file pkg +if [ -n "${temp}" ] ; then + export RELEASE_PKG_FILE_PKG=${temp} + export TARGET_PKG=$(echo ${RELEASE_PKG_FILE_PKG} | \ + sed -e 's:^./.*/::' -e 's:.pkg$::')${LDIST}.pkg + echo "deploying $RELEASE_PKG_FILE_PKG to nightly $TARGET_PKG" + ls -lh ${RELEASE_PKG_FILE_PKG} +else + echo "Skipping deployment of OS X package" +fi + diff -Nru libad9361-0.1/CI/travis/before_install_darwin libad9361-0.1.6/CI/travis/before_install_darwin --- libad9361-0.1/CI/travis/before_install_darwin 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/before_install_darwin 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh + +brew update +if ! brew ls --version cmake &>/dev/null; then + brew install cmake +else + brew upgrade cmake +fi +brew install doxygen +brew install --build-from-source libusb +brew install libxml2 + +wget http://swdownloads.analog.com/cse/travis_builds/latest_libiio${LDIST}.pkg +sudo installer -pkg latest_libiio${LDIST}.pkg -target / diff -Nru libad9361-0.1/CI/travis/before_install_linux libad9361-0.1.6/CI/travis/before_install_linux --- libad9361-0.1/CI/travis/before_install_linux 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/before_install_linux 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,16 @@ +#!/bin/sh + +sudo apt-get -qq update +sudo apt-get install -y cmake doxygen libaio-dev libavahi-client-dev libavahi-common-dev libusb-1.0-0-dev libxml2-dev rpm tar bzip2 gzip +if [ `sudo apt-cache search libserialport-dev | wc -l` -gt 0 ] ; then + sudo apt-get install -y libserialport-dev +fi + +if [ `lsb_release -da 2>&1 | grep -i precise | wc -l` -gt 0 ] ; then + wget http://swdownloads.analog.com/cse/travis_builds/latest_libiio-precise.deb + mv ./latest_libiio-precise.deb ./latest_libiio.deb +else + wget http://swdownloads.analog.com/cse/travis_builds/latest_libiio-trusty.deb + mv ./latest_libiio-trusty.deb ./latest_libiio.deb +fi +sudo apt install ./latest_libiio.deb diff -Nru libad9361-0.1/CI/travis/deploy libad9361-0.1.6/CI/travis/deploy --- libad9361-0.1/CI/travis/deploy 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/deploy 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,70 @@ +#!/bin/sh + +cd $TRAVIS_BUILD_DIR + +send() +{ +if [ "$#" -ne 3 ] ; then + echo "skipping deployment of something" + echo "send called with $@" + return +fi + +if [ "x$1" = "x" ] ; then + echo no file to send + return +fi + +if [ ! -r "$1" ] ; then + echo "file $1 is not readable" + ls -l $1 + return +fi + +if [ $BRANCH_PULL ] ; then + branch=$BRANCH_PULL +else + branch=$BRANCH +fi + +FROM=$1 +TO=${branch}_$2 +LATE=${branch}_latest_libad9361-iio${LDIST}$3 +GLOB=${DEPLOY_TO}/${branch}_libad9361-iio-* + +echo attemting to deploy $FROM to $TO +echo and ${branch}_libad9361-iio${LDIST}$3 +ssh -V + +echo "cd ${DEPLOY_TO}" > script$3 +if curl -m 10 -s -I -f -o /dev/null http://swdownloads.analog.com/cse/travis_builds/${TO} ; then + echo "rm ${TO}" >> script$3 +fi +echo "put ${FROM} ${TO}" >> script$3 +echo "ls -l ${TO}" >> script$3 +if curl -m 10 -s -I -f -o /dev/null http://swdownloads.analog.com/cse/travis_builds/${LATE} ; then + echo "rm ${LATE}" >> script$3 +fi +echo "symlink ${TO} ${LATE}" >> script$3 +echo "ls -l ${LATE}" >> script$3 +echo "bye" >> script$3 + +sftp ${EXTRA_SSH} -b script$3 ${SSHUSER}@${SSHHOST} + +# limit things to a few files, so things don't grow forever +if [ "${LDIST}" = "-precise" -a "$3" = ".deb" ] ; then + for files in $(ssh ${EXTRA_SSH} ${SSHUSER}@${SSHHOST} \ + "ls -lt ${GLOB}" | tail -n +100 | awk '{print $NF}') + do + ssh ${EXTRA_SSH} ${SSHUSER}@${SSHHOST} \ + "rm ${DEPLOY_TO}/${files}" + done +fi +} + +# from to suffix +send ${RELEASE_PKG_FILE_DEB} ${TARGET_DEB} .deb +send ${RELEASE_PKG_FILE_RPM} ${TARGET_RPM} .rpm +send ${RELEASE_PKG_FILE_TGZ} ${TARGET_TGZ} .tar.gz +send ${RELEASE_PKG_FILE_PKG} ${TARGET_PKG} .pkg + Binary files /tmp/tmp5nTHhk/X2KWcRSIVS/libad9361-0.1/CI/travis/deploy.rsa.enc and /tmp/tmp5nTHhk/BJkPdlcJQV/libad9361-0.1.6/CI/travis/deploy.rsa.enc differ diff -Nru libad9361-0.1/CI/travis/make_darwin libad9361-0.1.6/CI/travis/make_darwin --- libad9361-0.1/CI/travis/make_darwin 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/make_darwin 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "x${COVERITY_SCAN_PROJECT_NAME}" != "x" ] ; then exit 0; fi + +cd $TRAVIS_BUILD_DIR/build +cmake -DOSX_PACKAGE=ON .. +make +ls + +cd $TRAVIS_BUILD_DIR/build_tar +cmake -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON .. +make && make package +ls diff -Nru libad9361-0.1/CI/travis/make_linux libad9361-0.1.6/CI/travis/make_linux --- libad9361-0.1/CI/travis/make_linux 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/CI/travis/make_linux 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "x${COVERITY_SCAN_PROJECT_NAME}" != "x" ] ; then exit 0; fi + +cd $TRAVIS_BUILD_DIR/build +cmake -DENABLE_PACKAGING=ON -DDEB_DETECT_DEPENDENCIES=ON .. +make && make package + diff -Nru libad9361-0.1/cmake/DarwinPackaging.cmake libad9361-0.1.6/cmake/DarwinPackaging.cmake --- libad9361-0.1/cmake/DarwinPackaging.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/cmake/DarwinPackaging.cmake 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,12 @@ +# support creating some basic binpkgs via `make package` + +set(CPACK_SET_DESTDIR ON) +set(CPACK_GENERATOR TGZ) + +set(CPACK_PACKAGE_VERSION_MAJOR ${LIBAD9361_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${LIBAD9361_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH g${LIBAD9361_VERSION_GIT}) +set(CPACK_BUNDLE_NAME libad9361) +set(CPACK_PACKAGE_VERSION ${LIBAD9361_VERSION}) + +include(CPack) diff -Nru libad9361-0.1/cmake/LinuxPackaging.cmake libad9361-0.1.6/cmake/LinuxPackaging.cmake --- libad9361-0.1/cmake/LinuxPackaging.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/cmake/LinuxPackaging.cmake 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,96 @@ +# support creating some basic binpkgs via `make package` +set(CPACK_SET_DESTDIR ON) +set(CPACK_GENERATOR TGZ;DEB) + +FIND_PROGRAM(RPMBUILD_CMD rpmbuild) +if (RPMBUILD_CMD) + set(CPACK_PACKAGE_RELOCATABLE OFF) + set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) +endif() + +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) +set(CPACK_PACKAGE_VERSION_MAJOR ${LIBAD9361_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${LIBAD9361_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH g${LIBAD9361_VERSION_GIT}) +set(CPACK_BUNDLE_NAME libad9361) +set(CPACK_PACKAGE_VERSION ${LIBAD9361_VERSION}) +# debian specific package settings +set(CPACK_PACKAGE_CONTACT "Engineerzone ") + +option(DEB_DETECT_DEPENDENCIES "Detect dependencies for .deb packages" OFF) + +# if we are going to be looking for things, make sure we have the utilities +if(DEB_DETECT_DEPENDENCIES) + FIND_PROGRAM(DPKG_CMD dpkg) + FIND_PROGRAM(DPKGQ_CMD dpkg-query) +endif() + +# if we want to, and have the capabilities find what is needed, +# based on what backends are turned on and what libraries are installed +if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) + message(STATUS "querying installed packages on system for dependancies") + execute_process(COMMAND "${DPKG_CMD}" --print-architecture + OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE) + # don't add a package dependancy if it is not installed locally + # these should be the debian package names + set(PACKAGES "libc6 libiio") + # find the version of the installed package, which is hard to do in + # cmake first, turn the list into an list (seperated by semicolons) + string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES}) + # then iterate over each + foreach(package ${PACKAGES}) + # List packages matching given pattern ${package}, + # key is the glob (*) at the end of the ${package} name, + # so we don't need to be so specific + execute_process(COMMAND "${DPKG_CMD}" -l ${package}* + OUTPUT_VARIABLE DPKG_PACKAGES) + # returns a string, in a format: + # ii libxml2:amd64 2.9.4+dfsg1- amd64 GNOME XML library + # 'ii' means installed - which is what we are looking for + STRING(REGEX MATCHALL "ii ${package}[a-z0-9A-Z.-]*" + DPKG_INSTALLED_PACKAGES ${DPKG_PACKAGES}) + # get rid of the 'ii', and split things up, so we can look + # at the name + STRING(REGEX REPLACE "ii " ";" NAME_INSTALLED_PACKAGES + ${DPKG_INSTALLED_PACKAGES}) + foreach(match ${NAME_INSTALLED_PACKAGES}) + # ignore packages marked as dev, debug, + # documentations, or utils + STRING(REGEX MATCHALL "dev|dbg|doc|utils" TEMP_TEST + ${match}) + if("${TEMP_TEST}" STREQUAL "") + # find the actual version, executes: + # dpkg-query --showformat='\${Version}' + # --show libusb-1.0-0 + execute_process(COMMAND "${DPKGQ_CMD}" + --showformat='\${Version}' + --show "${match}" + OUTPUT_VARIABLE DPKGQ_VER) + # debian standard is package_ver-debian_ver, + # "'2.9.4+dfsg1-2.1'" + # ignore patches and debian suffix version, and + # remove single quote + string(REGEX REPLACE "[+-][a-z0-9A-Z.]*" "" + DPKGQ_VER ${DPKGQ_VER}) + string(REGEX REPLACE "'" "" DPKGQ_VER + ${DPKGQ_VER}) + # build the string for the Debian dependancy + set(CPACK_DEBIAN_PACKAGE_DEPENDS + "${CPACK_DEBIAN_PACKAGE_DEPENDS}" + "${match} (>= ${DPKGQ_VER}), ") + endif() + endforeach(match) + endforeach(package) + # remove the dangling end comma + string(REGEX REPLACE ", $" "" CPACK_DEBIAN_PACKAGE_DEPENDS + ${CPACK_DEBIAN_PACKAGE_DEPENDS}) +else() + # assume everything is turned on, and running on a modern OS + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6-dev (>= 2.19)") + message(STATUS "Using default dependencies for packaging") +endif() + +message(STATUS "Package dependencies: " ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + +include(CPack) diff -Nru libad9361-0.1/CMakeLists.txt libad9361-0.1.6/CMakeLists.txt --- libad9361-0.1/CMakeLists.txt 2015-08-17 13:38:16.000000000 +0000 +++ libad9361-0.1.6/CMakeLists.txt 2017-12-07 19:00:34.000000000 +0000 @@ -15,23 +15,70 @@ set(LIBAD9361_VERSION_MAJOR 0) set(LIBAD9361_VERSION_MINOR 1) -set(LIBAD9361_VERSION ${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}) +set(VERSION ${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + option(OSX_PACKAGE "Create a OSX package" ON) + set(CMAKE_MACOSX_RPATH ON) + set(SKIP_INSTALL_ALL ${OSX_PACKAGE}) +endif() + +include(FindGit OPTIONAL) +if (GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE LIBAD9361_GIT_REPO + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +if (${LIBAD9361_GIT_REPO} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE LIBAD9361_VERSION_GIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() +endif() + +if (NOT LIBAD9361_VERSION_GIT) + set(LIBAD9361_VERSION_GIT v${VERSION}) +endif() set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") +if (NOT WIN32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") +endif() + +add_definitions(-DLIBAD9361_EXPORTS=1) + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") mark_as_advanced(INSTALL_LIB_DIR) -include(FindPkgConfig REQUIRED) -pkg_check_modules(LIBIIO REQUIRED libiio) +find_library(LIBIIO_LIBRARIES iio) +find_path(LIBIIO_INCLUDEDIR iio.h) set(LIBAD9361_HEADERS ad9361.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBIIO_INCLUDEDIR}) -add_library(ad9361 ad9361_multichip_sync.c ${LIBAD9361_HEADERS}) -set_target_properties(ad9361 PROPERTIES VERSION ${LIBAD9361_VERSION} SOVERSION ${LIBAD9361_VERSION_MAJOR} FRAMEWORK TRUE PUBLIC_HEADER "${LIBAD9361_HEADERS}") -target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBS}) +add_library(ad9361 ad9361_multichip_sync.c ad9361_baseband_auto_rate.c ${LIBAD9361_HEADERS}) +set_target_properties(ad9361 PROPERTIES + VERSION ${VERSION} + SOVERSION ${LIBAD9361_VERSION_MAJOR} + FRAMEWORK TRUE + PUBLIC_HEADER ${LIBAD9361_HEADERS} + C_STANDARD 99 + C_STANDARD_REQUIRED ON + C_EXTENSIONS OFF +) +target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBRARIES}) + +if (MSVC) + set_target_properties(ad9361 PROPERTIES OUTPUT_NAME libad9361) +endif() set(LIBAD9361_PC ${CMAKE_CURRENT_BINARY_DIR}/libad9361.pc) configure_file(libad9361.pc.cmakein ${LIBAD9361_PC} @ONLY) @@ -45,3 +92,55 @@ FRAMEWORK DESTINATION lib PUBLIC_HEADER DESTINATION include) endif() + +# Create an installer if compiling for OSX +if(OSX_PACKAGE) + set(LIBAD9361_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad9361-${VERSION}.pkg) + set(LIBAD9361_TEMP_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad9361-${VERSION}-temp.pkg) + set(LIBAD9361_DISTRIBUTION_XML ${CMAKE_CURRENT_BINARY_DIR}/Distribution.xml) + set(LIBAD9361_FRAMEWORK_DIR ${CMAKE_CURRENT_BINARY_DIR}/ad9361.framework) + configure_file(Distribution.xml.cmakein ${LIBAD9361_DISTRIBUTION_XML} @ONLY) + + find_program(PKGBUILD_EXECUTABLE + NAMES pkgbuild + DOC "OSX Package builder (pkgbuild)") + mark_as_advanced(PKGBUILD_EXECUTABLE) + + find_program(PRODUCTBUILD_EXECUTABLE + NAMES productbuild + DOC "OSX Package builder (productbuild)") + mark_as_advanced(PRODUCTBUILD_EXECUTABLE) + + add_custom_command(OUTPUT ${LIBAD9361_PKG} + COMMAND ${PKGBUILD_EXECUTABLE} + --component ${LIBAD9361_FRAMEWORK_DIR} + --identifier com.adi.ad9361 --version ${VERSION} + --install-location /Library/Frameworks ${LIBAD9361_TEMP_PKG} + COMMAND ${PRODUCTBUILD_EXECUTABLE} + --distribution ${LIBAD9361_DISTRIBUTION_XML} ${LIBAD9361_PKG} + COMMAND ${CMAKE_COMMAND} -E remove ${LIBAD9361_TEMP_PKG} + DEPENDS ad9361 ${LIBAD9361_DISTRIBUTION_XML} + ) + + if (PKGBUILD_EXECUTABLE AND PRODUCTBUILD_EXECUTABLE) + add_custom_target(libad9361-pkg ALL DEPENDS ${LIBAD9361_PKG}) + + install(CODE "execute_process(COMMAND /usr/sbin/installer -pkg ${LIBAD9361_PKG} -target /)") + else() + message(WARNING "Missing pkgbuild or productbuild: OSX installer won't be created.") + endif() +else() + # Support creating some basic binpkgs via `make package`. + # Disabled if OSX_PACKAGE is enabled, as tarballs would + # end up empty otherwise. + option(ENABLE_PACKAGING "Create .deb/.rpm or .tar.gz packages via 'make package'" ON) + + if(ENABLE_PACKAGING) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + include(cmake/DarwinPackaging.cmake) + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + include(cmake/LinuxPackaging.cmake) + endif() + endif() +endif() diff -Nru libad9361-0.1/debian/changelog libad9361-0.1.6/debian/changelog --- libad9361-0.1/debian/changelog 2017-09-06 00:41:48.000000000 +0000 +++ libad9361-0.1.6/debian/changelog 2018-04-29 10:20:01.000000000 +0000 @@ -1,32 +1,6 @@ -libad9361 (0.1-4) unstable; urgency=medium +libad9361 (0.1.6-myriadrf1~bionic) bionic; urgency=low - * Adopt package, update Vcs + * Initial package for Ubuntu 18.04. - -- A. Maitland Bottoms Tue, 05 Sep 2017 20:41:48 -0400 + -- Alexandru Csete Sun, 29 Apr 2018 11:20:00 +0200 -libad9361 (0.1-3) unstable; urgency=medium - - * update to 6027674 - - -- A. Maitland Bottoms Mon, 04 Sep 2017 15:51:20 -0400 - -libad9361 (0.1-2) unstable; urgency=medium - - * update to faa8556 - - -- A. Maitland Bottoms Thu, 28 Apr 2016 00:12:24 -0400 - -libad9361 (0.1-1) unstable; urgency=medium - - * Initial upload to Debian (closes: #814039) - * Sponsor libad9361 for Paul Cercueil - * Update to 3.0 (quilt) - * Add no-op watch file - - -- A. Maitland Bottoms Sun, 07 Feb 2016 16:23:10 -0500 - -libad9361 (0.1) unstable; urgency=low - - * Initial release. - - -- Paul Cercueil Wed, 29 Jul 2015 14:46:52 +0200 diff -Nru libad9361-0.1/debian/control libad9361-0.1.6/debian/control --- libad9361-0.1/debian/control 2017-09-06 00:41:48.000000000 +0000 +++ libad9361-0.1.6/debian/control 2016-04-28 15:49:10.000000000 +0000 @@ -1,15 +1,15 @@ Source: libad9361 Section: libs Priority: optional -Maintainer: A. Maitland Bottoms +Maintainer: Paul Cercueil +Uploaders: A. Maitland Bottoms Build-Depends: cmake (>= 2.8), debhelper (>= 9), libiio-dev, pkg-config -Standards-Version: 4.1.0 +Standards-Version: 3.9.8 Homepage: https://github.com/analogdevicesinc/libad9361-iio -Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/libad9361.git -Vcs-Git: https://anonscm.debian.org/git/collab-maint/libad9361.git +Vcs-Git: https://github.com/analogdevicesinc/libad9361-iio.git Package: libad9361-0 Architecture: any diff -Nru libad9361-0.1/debian/patches/0001-ad9361_multichip_sync.c-Build-fix-for-Visual-Studio.patch libad9361-0.1.6/debian/patches/0001-ad9361_multichip_sync.c-Build-fix-for-Visual-Studio.patch --- libad9361-0.1/debian/patches/0001-ad9361_multichip_sync.c-Build-fix-for-Visual-Studio.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0001-ad9361_multichip_sync.c-Build-fix-for-Visual-Studio.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -From 5f4dd73f1a3bdc977cce2ed57bc9fe94a5624197 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:38:19 +0100 -Subject: [PATCH 01/11] ad9361_multichip_sync.c: Build fix for Visual Studio - -Signed-off-by: Paul Cercueil ---- - ad9361_multichip_sync.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/ad9361_multichip_sync.c b/ad9361_multichip_sync.c -index e2dbcdf..ddc6fad 100644 ---- a/ad9361_multichip_sync.c -+++ b/ad9361_multichip_sync.c -@@ -17,7 +17,11 @@ - #include - #include - #include -+#ifdef _WIN32 -+#include -+#else - #include -+#endif - - #define MAX_AD9361_SYNC_DEVS 4 - -@@ -86,7 +90,11 @@ int ad9361_multichip_sync(struct iio_device *master, struct iio_device **slaves, - else - iio_device_attr_write_longlong(master, "multichip_sync", step); - -+#ifdef _WIN32 -+ Sleep(1); -+#else - usleep(1000); -+#endif - } - - iio_device_attr_write(master, "ensm_mode", ensm_mode[0]); --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0002-ad9361.h-Use-a-__api-tag-to-mark-API-functions.patch libad9361-0.1.6/debian/patches/0002-ad9361.h-Use-a-__api-tag-to-mark-API-functions.patch --- libad9361-0.1/debian/patches/0002-ad9361.h-Use-a-__api-tag-to-mark-API-functions.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0002-ad9361.h-Use-a-__api-tag-to-mark-API-functions.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -From f550cc061bdfda0e6db6a952839528b4fddfd63c Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:38:56 +0100 -Subject: [PATCH 02/11] ad9361.h: Use a __api tag to mark API functions - -This is required for building the library for Windows. - -It also allows to reduce the visibility of non-API functions -on other platforms. - -Signed-off-by: Paul Cercueil ---- - ad9361.h | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/ad9361.h b/ad9361.h -index 36ee6dc..d96dc83 100644 ---- a/ad9361.h -+++ b/ad9361.h -@@ -23,16 +23,32 @@ extern "C" { - #define FIXUP_INTERFACE_TIMING 1 - #define CHECK_SAMPLE_RATES 2 - -+#ifdef _WIN32 -+# ifdef LIBAD9361_EXPORTS -+# define __api __declspec(dllexport) -+# else -+# define __api __declspec(dllimport) -+# endif -+#elif __GNUC__ >= 4 -+# define __api __attribute__((visibility ("default"))) -+#else -+# define __api -+#endif -+ - struct iio_context; - struct iio_device; - --int ad9361_multichip_sync(struct iio_device *master, struct iio_device **slaves, -- unsigned int num_slaves, unsigned int flags); -+__api int ad9361_multichip_sync(struct iio_device *master, -+ struct iio_device **slaves, unsigned int num_slaves, -+ unsigned int flags); - --int ad9361_fmcomms5_multichip_sync(struct iio_context *ctx, unsigned int flags); -+__api int ad9361_fmcomms5_multichip_sync( -+ struct iio_context *ctx, unsigned int flags); - - #ifdef __cplusplus - } - #endif - -+#undef __api -+ - #endif /* __AD9361_H__ */ --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0003-CMake-Avoid-using-pkg-config-to-find-libiio.patch libad9361-0.1.6/debian/patches/0003-CMake-Avoid-using-pkg-config-to-find-libiio.patch --- libad9361-0.1/debian/patches/0003-CMake-Avoid-using-pkg-config-to-find-libiio.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0003-CMake-Avoid-using-pkg-config-to-find-libiio.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -From 20335745c911027caed6bec510739f0adfeee461 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:47:35 +0100 -Subject: [PATCH 03/11] CMake: Avoid using pkg-config to find libiio - -It is not very convenient for Windows builds. - -Signed-off-by: Paul Cercueil ---- - CMakeLists.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4af74f2..ce0d0b4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -23,15 +23,15 @@ set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" - CACHE PATH "Installation directory for libraries") - mark_as_advanced(INSTALL_LIB_DIR) - --include(FindPkgConfig REQUIRED) --pkg_check_modules(LIBIIO REQUIRED libiio) -+find_library(LIBIIO_LIBRARIES iio) -+find_path(LIBIIO_INCLUDEDIR iio.h) - - set(LIBAD9361_HEADERS ad9361.h) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBIIO_INCLUDEDIR}) - add_library(ad9361 ad9361_multichip_sync.c ${LIBAD9361_HEADERS}) - set_target_properties(ad9361 PROPERTIES VERSION ${LIBAD9361_VERSION} SOVERSION ${LIBAD9361_VERSION_MAJOR} FRAMEWORK TRUE PUBLIC_HEADER "${LIBAD9361_HEADERS}") --target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBS}) -+target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBRARIES}) - - set(LIBAD9361_PC ${CMAKE_CURRENT_BINARY_DIR}/libad9361.pc) - configure_file(libad9361.pc.cmakein ${LIBAD9361_PC} @ONLY) --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0004-CMake-Add-support-for-building-under-Visual-Studio.patch libad9361-0.1.6/debian/patches/0004-CMake-Add-support-for-building-under-Visual-Studio.patch --- libad9361-0.1/debian/patches/0004-CMake-Add-support-for-building-under-Visual-Studio.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0004-CMake-Add-support-for-building-under-Visual-Studio.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From 6f3f9064025fe8c38611afe7411157b271d5300c Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:48:45 +0100 -Subject: [PATCH 04/11] CMake: Add support for building under Visual Studio - -Signed-off-by: Paul Cercueil ---- - CMakeLists.txt | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ce0d0b4..8fb514e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,6 +19,8 @@ set(LIBAD9361_VERSION ${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}) - - set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") - -+add_definitions(-DLIBAD9361_EXPORTS=1) -+ - set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" - CACHE PATH "Installation directory for libraries") - mark_as_advanced(INSTALL_LIB_DIR) -@@ -33,6 +35,10 @@ add_library(ad9361 ad9361_multichip_sync.c ${LIBAD9361_HEADERS}) - set_target_properties(ad9361 PROPERTIES VERSION ${LIBAD9361_VERSION} SOVERSION ${LIBAD9361_VERSION_MAJOR} FRAMEWORK TRUE PUBLIC_HEADER "${LIBAD9361_HEADERS}") - target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBRARIES}) - -+if (MSVC) -+ set_target_properties(ad9361 PROPERTIES OUTPUT_NAME libad9361) -+endif() -+ - set(LIBAD9361_PC ${CMAKE_CURRENT_BINARY_DIR}/libad9361.pc) - configure_file(libad9361.pc.cmakein ${LIBAD9361_PC} @ONLY) - install(FILES ${LIBAD9361_PC} DESTINATION ${INSTALL_LIB_DIR}/pkgconfig) --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0005-CMake-Hide-all-non-API-functions.patch libad9361-0.1.6/debian/patches/0005-CMake-Hide-all-non-API-functions.patch --- libad9361-0.1/debian/patches/0005-CMake-Hide-all-non-API-functions.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0005-CMake-Hide-all-non-API-functions.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -From ea5b3e3e2da0f93549bdf85d74537e07bbd36c34 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:49:19 +0100 -Subject: [PATCH 05/11] CMake: Hide all non-API functions - -Ok, right now we don't have any non-API function. -But it's better to be future-proof. - -Signed-off-by: Paul Cercueil ---- - CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8fb514e..14787f4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,6 +19,10 @@ set(LIBAD9361_VERSION ${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}) - - set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") - -+if (NOT WIN32) -+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") -+endif() -+ - add_definitions(-DLIBAD9361_EXPORTS=1) - - set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0006-Add-appveyor.yml-file-to-build-under-AppVeyor-CI.patch libad9361-0.1.6/debian/patches/0006-Add-appveyor.yml-file-to-build-under-AppVeyor-CI.patch --- libad9361-0.1/debian/patches/0006-Add-appveyor.yml-file-to-build-under-AppVeyor-CI.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0006-Add-appveyor.yml-file-to-build-under-AppVeyor-CI.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -From faa8556a8109d9ee56e00d5827983ef58a0a9439 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 25 Feb 2016 15:51:07 +0100 -Subject: [PATCH 06/11] Add appveyor.yml file to build under AppVeyor CI - -Signed-off-by: Paul Cercueil ---- - appveyor.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 47 insertions(+) - create mode 100644 appveyor.yml - -diff --git a/appveyor.yml b/appveyor.yml -new file mode 100644 -index 0000000..9dbedf0 ---- /dev/null -+++ b/appveyor.yml -@@ -0,0 +1,47 @@ -+version: 2015.1.{build} -+clone_depth: 1 -+ -+install: -+ # Download libiio -+ - cd c:\ -+ - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win32.zip -+ - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win64.zip -+ - 7z x libiio-win32.zip -+ - 7z x libiio-win64.zip -+ -+build_script: -+ # 32-bit build -+ - mkdir c:\projects\libad9361-iio\build-win32 -+ - cd c:\projects\libad9361-iio\build-win32 -+ - cmake -G "Visual Studio 12" \ -+ -DLIBIIO_LIBRARIES:FILEPATH=c:/libiio-win32/libiio.lib \ -+ -DLIBIIO_INCLUDEDIR:PATH=c:/libiio-win32 \ -+ -DCMAKE_CONFIGURATION_TYPES=Release \ -+ .. -+ - cmake --build . --config Release -+ -+ # 64-bit build -+ - mkdir c:\projects\libad9361-iio\build-win64 -+ - cd c:\projects\libad9361-iio\build-win64 -+ - cmake -G "Visual Studio 12 Win64" \ -+ -DLIBIIO_LIBRARIES:FILEPATH=c:/libiio-win64/libiio.lib \ -+ -DLIBIIO_INCLUDEDIR:PATH=c:/libiio-win64 \ -+ -DCMAKE_CONFIGURATION_TYPES=Release \ -+ .. -+ - cmake --build . --config Release -+ -+ # Create ZIPs -+ - cd c:\projects\libad9361-iio -+ - mkdir c:\libad9361-win32 -+ - copy ad9361.h c:\libad9361-win32\ -+ - copy build-win32\Release\libad9361.* c:\libad9361-win32\ -+ - copy c:\libiio-win32\*.dll c:\libad9361-win32\ -+ - 7z a "c:\libad9361-win32.zip" c:\libad9361-win32 -+ - appveyor PushArtifact c:\libad9361-win32.zip -+ -+ - mkdir c:\libad9361-win64 -+ - copy ad9361.h c:\libad9361-win64\ -+ - copy build-win64\Release\libad9361.* c:\libad9361-win64\ -+ - copy c:\libiio-win64\*.dll c:\libad9361-win64\ -+ - 7z a "c:\libad9361-win64.zip" c:\libad9361-win64 -+ - appveyor PushArtifact c:\libad9361-win64.zip -\ No newline at end of file --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0007-Create-README.md.patch libad9361-0.1.6/debian/patches/0007-Create-README.md.patch --- libad9361-0.1/debian/patches/0007-Create-README.md.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0007-Create-README.md.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -From 50cec623db3acf863c22a3fada66f2c99522c774 Mon Sep 17 00:00:00 2001 -From: Robin Getz -Date: Sun, 19 Jun 2016 23:45:12 -0400 -Subject: [PATCH 07/11] Create README.md - ---- - README.md | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - create mode 100644 README.md - -diff --git a/README.md b/README.md -new file mode 100644 -index 0000000..4ec82b1 ---- /dev/null -+++ b/README.md -@@ -0,0 +1,35 @@ -+# libad9361-iio -+ -+This is a simple library used for userspace, which manages multi-chip sync, on platforms (FMCOMMS5) where multiple AD9361 devices are used. -+ -+## Building & Installing -+ -+should be a quick matter of `cmake`, then `make`, then `make install`: -+ -+``` -+rgetz@pinky:~/libad9361-iio$ cmake ./CMakeLists.txt -+-- The C compiler identification is GNU 4.7.2 -+-- Check for working C compiler: /usr/bin/gcc -+-- Check for working C compiler: /usr/bin/gcc -- works -+-- Detecting C compiler ABI info -+-- Detecting C compiler ABI info - done -+-- Configuring done -+-- Generating done -+-- Build files have been written to: /home/rgetz/libad9361-iio -+rgetz@pinky:~/libad9361-iio$ make -+Scanning dependencies of target ad9361 -+[100%] Building C object CMakeFiles/ad9361.dir/ad9361_multichip_sync.c.o -+Linking C shared library libad9361.so -+Copying OS X content Headers/ad9361.h -+[100%] Built target ad9361 -+rgetz@pinky:~/libad9361-iio$ sudo make install -+[sudo] password for rgetz: -+[100%] Built target ad9361 -+Install the project... -+-- Install configuration: "" -+-- Installing: /usr/local/lib/pkgconfig/libad9361.pc -+-- Installing: /usr/local/lib/libad9361.so.0.1 -+-- Installing: /usr/local/lib/libad9361.so.0 -+-- Installing: /usr/local/lib/libad9361.so -+-- Installing: /usr/local/include/ad9361.h -+``` --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0008-appveyor.yml-Always-download-libiio-builds-of-the-ma.patch libad9361-0.1.6/debian/patches/0008-appveyor.yml-Always-download-libiio-builds-of-the-ma.patch --- libad9361-0.1/debian/patches/0008-appveyor.yml-Always-download-libiio-builds-of-the-ma.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0008-appveyor.yml-Always-download-libiio-builds-of-the-ma.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From af541b1b3f1e2462d18abdba2a108df2bfd55647 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 30 Jun 2016 10:34:20 +0200 -Subject: [PATCH 08/11] appveyor.yml: Always download libiio builds of the - 'master' branch - -Signed-off-by: Paul Cercueil ---- - appveyor.yml | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/appveyor.yml b/appveyor.yml -index 9dbedf0..62b6227 100644 ---- a/appveyor.yml -+++ b/appveyor.yml -@@ -4,8 +4,8 @@ clone_depth: 1 - install: - # Download libiio - - cd c:\ -- - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win32.zip -- - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win64.zip -+ - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win32.zip?branch=master -+ - appveyor DownloadFile https://ci.appveyor.com/api/projects/analogdevicesinc/libiio/artifacts/libiio-win64.zip?branch=master - - 7z x libiio-win32.zip - - 7z x libiio-win64.zip - -@@ -44,4 +44,4 @@ build_script: - - copy build-win64\Release\libad9361.* c:\libad9361-win64\ - - copy c:\libiio-win64\*.dll c:\libad9361-win64\ - - 7z a "c:\libad9361-win64.zip" c:\libad9361-win64 -- - appveyor PushArtifact c:\libad9361-win64.zip -\ No newline at end of file -+ - appveyor PushArtifact c:\libad9361-win64.zip --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0009-New-functions-ad9361_set_bb_rate.patch libad9361-0.1.6/debian/patches/0009-New-functions-ad9361_set_bb_rate.patch --- libad9361-0.1/debian/patches/0009-New-functions-ad9361_set_bb_rate.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0009-New-functions-ad9361_set_bb_rate.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,210 +0,0 @@ -From bda561f9f49d092b595d508039aaa806cf109a41 Mon Sep 17 00:00:00 2001 -From: Michael Hennerich -Date: Wed, 26 Oct 2016 15:39:05 +0200 -Subject: [PATCH 09/11] New functions ad9361_set_bb_rate() - -Signed-off-by: Michael Hennerich ---- - CMakeLists.txt | 2 +- - ad9361.h | 6 ++ - ad9361_baseband_auto_rate.c | 158 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 165 insertions(+), 1 deletion(-) - create mode 100644 ad9361_baseband_auto_rate.c - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 14787f4..13da43e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -35,7 +35,7 @@ find_path(LIBIIO_INCLUDEDIR iio.h) - set(LIBAD9361_HEADERS ad9361.h) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LIBIIO_INCLUDEDIR}) --add_library(ad9361 ad9361_multichip_sync.c ${LIBAD9361_HEADERS}) -+add_library(ad9361 ad9361_multichip_sync.c ad9361_baseband_auto_rate.c ${LIBAD9361_HEADERS}) - set_target_properties(ad9361 PROPERTIES VERSION ${LIBAD9361_VERSION} SOVERSION ${LIBAD9361_VERSION_MAJOR} FRAMEWORK TRUE PUBLIC_HEADER "${LIBAD9361_HEADERS}") - target_link_libraries(ad9361 LINK_PRIVATE ${LIBIIO_LIBRARIES}) - -diff --git a/ad9361.h b/ad9361.h -index d96dc83..69f6ff8 100644 ---- a/ad9361.h -+++ b/ad9361.h -@@ -45,6 +45,12 @@ __api int ad9361_multichip_sync(struct iio_device *master, - __api int ad9361_fmcomms5_multichip_sync( - struct iio_context *ctx, unsigned int flags); - -+__api int ad9361_set_bb_rate(struct iio_device *dev, unsigned long rate); -+ -+__api int ad9361_set_trx_fir_enable(struct iio_device *dev, int enable); -+ -+__api int ad9361_get_trx_fir_enable(struct iio_device *dev, int *enable); -+ - #ifdef __cplusplus - } - #endif -diff --git a/ad9361_baseband_auto_rate.c b/ad9361_baseband_auto_rate.c -new file mode 100644 -index 0000000..f3c0f2c ---- /dev/null -+++ b/ad9361_baseband_auto_rate.c -@@ -0,0 +1,158 @@ -+/* -+ * Copyright (C) 2016 Analog Devices, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ */ -+ -+#include "ad9361.h" -+ -+#include -+#include -+#include -+#ifdef _WIN32 -+#include -+#else -+#include -+#endif -+ -+static int16_t fir_128_4[] = { -+ -15,-27,-23,-6,17,33,31,9,-23,-47,-45,-13,34,69,67,21,-49,-102,-99,-32,69,146,143,48,-96,-204,-200,-69,129,278,275,97,-170, -+ -372,-371,-135,222,494,497,187,-288,-654,-665,-258,376,875,902,363,-500,-1201,-1265,-530,699,1748,1906,845,-1089,-2922,-3424, -+ -1697,2326,7714,12821,15921,15921,12821,7714,2326,-1697,-3424,-2922,-1089,845,1906,1748,699,-530,-1265,-1201,-500,363,902,875, -+ 376,-258,-665,-654,-288,187,497,494,222,-135,-371,-372,-170,97,275,278,129,-69,-200,-204,-96,48,143,146,69,-32,-99,-102,-49,21, -+ 67,69,34,-13,-45,-47,-23,9,31,33,17,-6,-23,-27,-15}; -+ -+static int16_t fir_128_2[] = { -+ -0,0,1,-0,-2,0,3,-0,-5,0,8,-0,-11,0,17,-0,-24,0,33,-0,-45,0,61,-0,-80,0,104,-0,-134,0,169,-0, -+ -213,0,264,-0,-327,0,401,-0,-489,0,595,-0,-724,0,880,-0,-1075,0,1323,-0,-1652,0,2114,-0,-2819,0,4056,-0,-6883,0,20837,32767, -+ 20837,0,-6883,-0,4056,0,-2819,-0,2114,0,-1652,-0,1323,0,-1075,-0,880,0,-724,-0,595,0,-489,-0,401,0,-327,-0,264,0,-213,-0, -+ 169,0,-134,-0,104,0,-80,-0,61,0,-45,-0,33,0,-24,-0,17,0,-11,-0,8,0,-5,-0,3,0,-2,-0,1,0,-0, 0 }; -+ -+static int16_t fir_96_2[] = { -+ -4,0,8,-0,-14,0,23,-0,-36,0,52,-0,-75,0,104,-0,-140,0,186,-0,-243,0,314,-0,-400,0,505,-0,-634,0,793,-0, -+ -993,0,1247,-0,-1585,0,2056,-0,-2773,0,4022,-0,-6862,0,20830,32767,20830,0,-6862,-0,4022,0,-2773,-0,2056,0,-1585,-0,1247,0,-993,-0, -+ 793,0,-634,-0,505,0,-400,-0,314,0,-243,-0,186,0,-140,-0,104,0,-75,-0,52,0,-36,-0,23,0,-14,-0,8,0,-4,0}; -+ -+static int16_t fir_64_2[] = { -+ -58,0,83,-0,-127,0,185,-0,-262,0,361,-0,-488,0,648,-0,-853,0,1117,-0,-1466,0,1954,-0,-2689,0,3960,-0,-6825,0,20818,32767, -+ 20818,0,-6825,-0,3960,0,-2689,-0,1954,0,-1466,-0,1117,0,-853,-0,648,0,-488,-0,361,0,-262,-0,185,0,-127,-0,83,0,-58,0}; -+ -+#define FIR_BUF_SIZE 8192 -+ -+int ad9361_set_trx_fir_enable(struct iio_device *dev, int enable) -+{ -+ int ret = iio_device_attr_write_bool(dev, -+ "in_out_voltage_filter_fir_en", !!enable); -+ if (ret < 0) -+ ret = iio_channel_attr_write_bool(iio_device_find_channel(dev, "out", false), -+ "voltage_filter_fir_en", !!enable); -+ return ret; -+} -+ -+int ad9361_get_trx_fir_enable(struct iio_device *dev, int *enable) -+{ -+ bool value; -+ -+ int ret = iio_device_attr_read_bool(dev, "in_out_voltage_filter_fir_en", &value); -+ -+ if (ret < 0) -+ ret = iio_channel_attr_read_bool(iio_device_find_channel(dev, "out", false), -+ "voltage_filter_fir_en", &value); -+ -+ if (!ret) -+ *enable = value; -+ -+ return ret; -+} -+ -+int ad9361_set_bb_rate(struct iio_device *dev, unsigned long rate) -+{ -+ struct iio_channel *chan; -+ long long current_rate; -+ int dec, taps, ret, i, enable, len = 0; -+ int16_t *fir; -+ char *buf; -+ -+ if (rate <= 20000000UL) { -+ dec = 4; -+ taps = 128; -+ fir = fir_128_4; -+ } else if (rate <= 40000000UL) { -+ dec = 2; -+ fir = fir_128_2; -+ taps = 128; -+ } else if (rate <= 53333333UL) { -+ dec = 2; -+ fir = fir_96_2; -+ taps = 96; -+ } else { -+ dec = 2; -+ fir = fir_64_2; -+ taps = 64; -+ } -+ -+ chan = iio_device_find_channel(dev, "voltage0", true); -+ if (chan == NULL) -+ return -ENODEV; -+ -+ ret = iio_channel_attr_read_longlong(chan, "sampling_frequency", ¤t_rate); -+ if (ret < 0) -+ return ret; -+ -+ ret = ad9361_get_trx_fir_enable(dev, &enable); -+ if (ret < 0) -+ return ret; -+ -+ if (enable) { -+ if (current_rate <= (25000000 / 12)) -+ iio_channel_attr_write_longlong(chan, "sampling_frequency", 3000000); -+ -+ ret = ad9361_set_trx_fir_enable(dev, false); -+ if (ret < 0) -+ return ret; -+ } -+ -+ buf = malloc(FIR_BUF_SIZE); -+ if (!buf) -+ return -ENOMEM; -+ -+ len += snprintf(buf + len, FIR_BUF_SIZE - len, "RX 3 GAIN -6 DEC %d\n", dec); -+ len += snprintf(buf + len, FIR_BUF_SIZE - len, "TX 3 GAIN 0 INT %d\n", dec); -+ -+ for (i = 0; i < taps; i++) -+ len += snprintf(buf + len, FIR_BUF_SIZE - len, "%d,%d\n", fir[i], fir[i]); -+ -+ len += snprintf(buf + len, FIR_BUF_SIZE - len, "\n"); -+ -+ ret = iio_device_attr_write_raw(dev, "filter_fir_config", buf, len); -+ free (buf); -+ -+ if (ret < 0) -+ return ret; -+ -+ if (rate <= (25000000 / 12)) { -+ ret = ad9361_set_trx_fir_enable(dev, true); -+ if (ret < 0) -+ return ret; -+ ret = iio_channel_attr_write_longlong(chan, "sampling_frequency", rate); -+ if (ret < 0) -+ return ret; -+ } else { -+ ret = iio_channel_attr_write_longlong(chan, "sampling_frequency", rate); -+ if (ret < 0) -+ return ret; -+ ret = ad9361_set_trx_fir_enable(dev, true); -+ if (ret < 0) -+ return ret; -+ } -+ -+ return 0; -+} --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0010-ad9361_baseband_auto_rate.c-Add-workaround-for-build.patch libad9361-0.1.6/debian/patches/0010-ad9361_baseband_auto_rate.c-Add-workaround-for-build.patch --- libad9361-0.1/debian/patches/0010-ad9361_baseband_auto_rate.c-Add-workaround-for-build.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0010-ad9361_baseband_auto_rate.c-Add-workaround-for-build.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -From e037d45536618a392cba4478fe4aa5da53097b0e Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Tue, 8 Nov 2016 11:11:11 +0100 -Subject: [PATCH 10/11] ad9361_baseband_auto_rate.c: Add workaround for - building in MSVC - -Signed-off-by: Paul Cercueil ---- - ad9361_baseband_auto_rate.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/ad9361_baseband_auto_rate.c b/ad9361_baseband_auto_rate.c -index f3c0f2c..6d3906d 100644 ---- a/ad9361_baseband_auto_rate.c -+++ b/ad9361_baseband_auto_rate.c -@@ -23,6 +23,10 @@ - #include - #endif - -+#ifdef _MSC_BUILD -+#define snprintf sprintf_s -+#endif -+ - static int16_t fir_128_4[] = { - -15,-27,-23,-6,17,33,31,9,-23,-47,-45,-13,34,69,67,21,-49,-102,-99,-32,69,146,143,48,-96,-204,-200,-69,129,278,275,97,-170, - -372,-371,-135,222,494,497,187,-288,-654,-665,-258,376,875,902,363,-500,-1201,-1265,-530,699,1748,1906,845,-1089,-2922,-3424, --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/0011-CMake-Add-support-for-creating-OSX-packages.patch libad9361-0.1.6/debian/patches/0011-CMake-Add-support-for-creating-OSX-packages.patch --- libad9361-0.1/debian/patches/0011-CMake-Add-support-for-creating-OSX-packages.patch 2017-09-04 19:49:23.000000000 +0000 +++ libad9361-0.1.6/debian/patches/0011-CMake-Add-support-for-creating-OSX-packages.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -From 6027674bc2ef400147f1607d0252e5347163f2f7 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Tue, 7 Feb 2017 16:40:35 +0100 -Subject: [PATCH 11/11] CMake: Add support for creating OSX packages - -Signed-off-by: Paul Cercueil ---- - CMakeLists.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ - Distribution.xml.cmakein | 20 ++++++++++++++++++++ - 2 files changed, 64 insertions(+) - create mode 100644 Distribution.xml.cmakein - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 13da43e..d285613 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -17,6 +17,12 @@ set(LIBAD9361_VERSION_MAJOR 0) - set(LIBAD9361_VERSION_MINOR 1) - set(LIBAD9361_VERSION ${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}) - -+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -+ option(OSX_PACKAGE "Create a OSX package" ON) -+ set(CMAKE_MACOSX_RPATH ON) -+ set(SKIP_INSTALL_ALL ${OSX_PACKAGE}) -+endif() -+ - set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries") - - if (NOT WIN32) -@@ -55,3 +61,41 @@ if(NOT SKIP_INSTALL_ALL) - FRAMEWORK DESTINATION lib - PUBLIC_HEADER DESTINATION include) - endif() -+ -+# Create an installer if compiling for OSX -+if(OSX_PACKAGE) -+ set(LIBAD9361_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad9361-${LIBAD9361_VERSION}.pkg) -+ set(LIBAD9361_TEMP_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad6361-${LIBAD9361_VERSION}-temp.pkg) -+ set(LIBAD9361_DISTRIBUTION_XML ${CMAKE_CURRENT_BINARY_DIR}/Distribution.xml) -+ set(LIBAD9361_FRAMEWORK_DIR ${CMAKE_CURRENT_BINARY_DIR}/ad9361.framework) -+ configure_file(Distribution.xml.cmakein ${LIBAD9361_DISTRIBUTION_XML} @ONLY) -+ -+ find_program(PKGBUILD_EXECUTABLE -+ NAMES pkgbuild -+ DOC "OSX Package builder (pkgbuild)") -+ mark_as_advanced(PKGBUILD_EXECUTABLE) -+ -+ find_program(PRODUCTBUILD_EXECUTABLE -+ NAMES productbuild -+ DOC "OSX Package builder (productbuild)") -+ mark_as_advanced(PRODUCTBUILD_EXECUTABLE) -+ -+ add_custom_command(OUTPUT ${LIBAD9361_PKG} -+ COMMAND ${PKGBUILD_EXECUTABLE} -+ --component ${LIBAD9361_FRAMEWORK_DIR} -+ --identifier com.adi.ad9361 --version ${LIBAD9361_VERSION} -+ --install-location /Library/Frameworks ${LIBAD9361_TEMP_PKG} -+ COMMAND ${PRODUCTBUILD_EXECUTABLE} -+ --distribution ${LIBAD9361_DISTRIBUTION_XML} ${LIBAD9361_PKG} -+ COMMAND ${CMAKE_COMMAND} -E remove ${LIBAD9361_TEMP_PKG} -+ DEPENDS ad9361 ${LIBAD9361_DISTRIBUTION_XML} -+ ) -+ -+ if (PKGBUILD_EXECUTABLE AND PRODUCTBUILD_EXECUTABLE) -+ add_custom_target(libad9361-pkg ALL DEPENDS ${LIBAD9361_PKG}) -+ -+ install(CODE "execute_process(COMMAND /usr/sbin/installer -pkg ${LIBAD9361_PKG} -target /)") -+ else() -+ message(WARNING "Missing pkgbuild or productbuild: OSX installer won't be created.") -+ endif() -+endif() -diff --git a/Distribution.xml.cmakein b/Distribution.xml.cmakein -new file mode 100644 -index 0000000..fe8d830 ---- /dev/null -+++ b/Distribution.xml.cmakein -@@ -0,0 +1,20 @@ -+ -+ -+ Libad9361 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ @LIBAD9361_TEMP_PKG@ -+ --- -2.11.0 - diff -Nru libad9361-0.1/debian/patches/series libad9361-0.1.6/debian/patches/series --- libad9361-0.1/debian/patches/series 2017-09-04 19:50:09.000000000 +0000 +++ libad9361-0.1.6/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -0001-ad9361_multichip_sync.c-Build-fix-for-Visual-Studio.patch -0002-ad9361.h-Use-a-__api-tag-to-mark-API-functions.patch -0003-CMake-Avoid-using-pkg-config-to-find-libiio.patch -0004-CMake-Add-support-for-building-under-Visual-Studio.patch -0005-CMake-Hide-all-non-API-functions.patch -0006-Add-appveyor.yml-file-to-build-under-AppVeyor-CI.patch -0007-Create-README.md.patch -0008-appveyor.yml-Always-download-libiio-builds-of-the-ma.patch -0009-New-functions-ad9361_set_bb_rate.patch -0010-ad9361_baseband_auto_rate.c-Add-workaround-for-build.patch -0011-CMake-Add-support-for-creating-OSX-packages.patch diff -Nru libad9361-0.1/debian/rules libad9361-0.1.6/debian/rules --- libad9361-0.1/debian/rules 2017-09-06 00:41:48.000000000 +0000 +++ libad9361-0.1.6/debian/rules 2015-08-17 13:38:16.000000000 +0000 @@ -10,3 +10,6 @@ override_dh_compress: dh_compress -X.c -X.C + +override_dh_clistrip: + dh_clistrip --exclude=mdb diff -Nru libad9361-0.1/debian/watch libad9361-0.1.6/debian/watch --- libad9361-0.1/debian/watch 2017-09-06 00:41:48.000000000 +0000 +++ libad9361-0.1.6/debian/watch 2015-12-17 21:37:12.000000000 +0000 @@ -1,3 +1,3 @@ version=3 -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/v$1.tar.gz/ \ - https://github.com/analogdevicesinc/libad9361-iio/tags .*/v(\d\S*)\.tar\.gz +# git source https://github.com/analogdevicesinc/libad9361-iio.git +# no tags, no releases, nothing to watch diff -Nru libad9361-0.1/Distribution.xml.cmakein libad9361-0.1.6/Distribution.xml.cmakein --- libad9361-0.1/Distribution.xml.cmakein 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/Distribution.xml.cmakein 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,20 @@ + + + Libad9361 + + + + + + + + + + + + + + + + @LIBAD9361_TEMP_PKG@ + diff -Nru libad9361-0.1/.gitignore libad9361-0.1.6/.gitignore --- libad9361-0.1/.gitignore 2015-08-17 13:38:16.000000000 +0000 +++ libad9361-0.1.6/.gitignore 2017-12-07 19:00:34.000000000 +0000 @@ -1,5 +1,10 @@ +*.swp +CPackConfig.cmake +CPackSourceConfig.cmake CMakeCache.txt CMakeFiles Makefile cmake_install.cmake install_manifest.txt +libad9361.pc +libad9361.so* diff -Nru libad9361-0.1/README.md libad9361-0.1.6/README.md --- libad9361-0.1/README.md 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/README.md 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,58 @@ +# libad9361-iio + +This is a simple library used for userspace, + - which manages multi-chip sync (on platforms (FMCOMMS5) where multiple AD9361 devices are use) + - can create AD9361 specific FIR filters on the fly, + + +License : [![License](https://img.shields.io/badge/license-LGPL2-blue.svg)](https://github.com/analogdevicesinc/libad9361-iio/blob/master/COPYING.txt) +Latest Release : [![GitHub release](https://img.shields.io/github/release/analogdevicesinc/libad9361-iio.svg)](https://github.com/analogdevicesinc/libad9361-iio/releases/latest) +Downloads : [![Github All Releases](https://img.shields.io/github/downloads/analogdevicesinc/libad9361-iio/total.svg)](https://github.com/analogdevicesinc/libad9361-iio/releases/latest) + +As with many open source packages, we use [GitHub](https://github.com/analogdevicesinc/libad9361-iio) to do develop and maintain the source, and [Travis CI](https://travis-ci.com/) and [Appveyor](https://www.appveyor.com/) for continuous integration. + - If you want to just use libad9361-iio, we suggest using the [latest release](https://github.com/analogdevicesinc/libad9361-iio/releases/latest). + - If you think you have found a bug in the release, or need a feature which isn't in the release, try the latest **untested** binaries from the master branch. We provide builds for a few operating systems. If you need something else, we can most likely add that -- just ask. + +| Operating System | GitHub master status | Version | Installer Package | tarball or zip | +|:-----------------------:|:---------------------:|:-------:|:-------------------:|:--------------:| +| Windows | [![Windows Status](https://ci.appveyor.com/api/projects/status/github/analogdevicesinc/libad9361-iio?svg=true)](https://ci.appveyor.com/project/analogdevicesinc/libad9361-iio/branch/master) | Windows 10
Windows 8.1
Windows 8
Windows 7 | [![Latest Windows installer](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/win_box.png)](https://ci.appveyor.com/api/projects/analogdevicesinc/libad9361-iio/artifacts/libad9361-setup.exe?branch=master) | Win32 : [![Latest 32-bit Windows zip](https://raw.githubusercontent.com/wiki/analogdevicesinc/libad9361-iio/img/win_box.png)](https://ci.appveyor.com/api/projects/analogdevicesinc/libad9361-iio/artifacts/libad9361-win32.zip?branch=master)
Win64: [![Latest 64-bit Windows zip](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/win_box.png)](https://ci.appveyor.com/api/projects/analogdevicesinc/libad9361-iio/artifacts/libad9361-win64.zip?branch=master) | +| OS X | [![OSX Status](https://api.travis-ci.org/analogdevicesinc/libad9361-iio.svg?branch=master&label=osx&passingTex=foo)](https://travis-ci.org/analogdevicesinc/libad9361-iio) | macOS Sierra
(v 10.12) | [![OS-X package 10.12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.12.pkg) | [![OS-X tarball 10.12](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.12.tar.gz) | +| | | OS X El Capitan
(v 10.11) | [![OS-X package 10.11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.11.pkg) | [![OS-X tarball 10.11](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.11.tar.gz) | +| | | OS X Yosemite
(v 10.10) | [![OS-X package 10.10](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.10.pkg) | [![OS-X tarball 10.10](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/osx_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-osx_10.10.tar.gz) | +| Linux | [![Linux Status](https://api.travis-ci.org/analogdevicesinc/libad9361-iio.svg?branch=master&label=linux)](https://travis-ci.org/analogdevicesinc/libiio) | Ubuntu Trusty Tahr
(v 14.04)1 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-trusty.deb) [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-trusty.rpm)3 | [![tar.gz file](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-trusty.tar.gz) | +| | | Ubuntu Precise Pangolin
(v 12.04)2 | [![Debian](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/deb.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-precise.deb) [![RPM File](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/rpm.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-precise.rpm)3 | [![tar.gz](https://raw.githubusercontent.com/wiki/analogdevicesinc/libiio/img/linux_box.png)](http://swdownloads.analog.com/cse/travis_builds/master_latest_libad9361-iio-precise.tar.gz) | + +If you use it, and like it - please let us know. If you use it, and hate it - please let us know that too. The goal of the project is to try to make Linux IIO devices easier to use on a variety of platforms. If we aren't doing that - we will try to make it better. + + +## Building & Installing + +should be a quick matter of `cmake`, then `make`, then `make install`: + +``` +rgetz@pinky:~/libad9361-iio$ cmake ./CMakeLists.txt +-- The C compiler identification is GNU 4.7.2 +-- Check for working C compiler: /usr/bin/gcc +-- Check for working C compiler: /usr/bin/gcc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/rgetz/libad9361-iio +rgetz@pinky:~/libad9361-iio$ make +Scanning dependencies of target ad9361 +[100%] Building C object CMakeFiles/ad9361.dir/ad9361_multichip_sync.c.o +Linking C shared library libad9361.so +Copying OS X content Headers/ad9361.h +[100%] Built target ad9361 +rgetz@pinky:~/libad9361-iio$ sudo make install +[sudo] password for rgetz: +[100%] Built target ad9361 +Install the project... +-- Install configuration: "" +-- Installing: /usr/local/lib/pkgconfig/libad9361.pc +-- Installing: /usr/local/lib/libad9361.so.0.1 +-- Installing: /usr/local/lib/libad9361.so.0 +-- Installing: /usr/local/lib/libad9361.so +-- Installing: /usr/local/include/ad9361.h +``` diff -Nru libad9361-0.1/.travis.yml libad9361-0.1.6/.travis.yml --- libad9361-0.1/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ libad9361-0.1.6/.travis.yml 2017-12-07 19:00:34.000000000 +0000 @@ -0,0 +1,98 @@ +language: c +sudo: required + +env: + global: + # SSHHOST + - secure: "Izx3rvvdDSlv26z0OLsyHj6uN5YoOz/Deg0bLx8IHRqPcRULJlQLqXOaeX41DmsltFq1X8AbVW2TmqzaLHnsGfM76IyqIWVLANC0TcevKyonDujkiuWoFDrYciKJyLS2aN4SgnG4jyp9977Z0Vc5EL9D61QDlh3LUU+x3+CYxQIWWpMoOsfyZUw8FU/b/KmjqE7zvtgN/RMAeuDIn7jLP9Yg9pFB8KnOFyWHSfT5cXux4WSYqwQasYf68+3JyuJSebS3kK/FgCJOODMs+xed9BjeP8QinhmXFdy+epIFXLARUKZrLzj9+94PZ8n0m0TV39yqFfk96qRjM4bJNwCqfUU6iaSsuLNlSU2HbQeqSDW//BsXFL3EicM+7xgYnx/luboLQZgqJYQAPk3ihaH456Gl9PNF6h4zv8vXsHE+nHDZvubwsgNdTk25YP+3GglQZdRHBhsdBSASGYc0CxYwPHsBi4/QD0RQ2k0W4D1dwJXXRXxTqoSfveP8QIsQVfDwfAhWLG9QMjVwp1dMl+5wIp25E4v1C2I2rQJVuc7pjPb/av34ltWBlQwcXkxUl3/E3qDrO4b5gS/UD47bRCCqYf9GLniXVBm7z+ebA7tW4G/q/RJvb3G7q59nAJXSwJOvB5Kt3pnfeCmfgv6wGeeNizQer+AjHkQy1uNQBBSI8Jw=" + # SSHUSER + - secure: "qNOraig2HbEH9MfIzwiXTZ9+DIKN1RpXaIEurkGFr96UNeeNPqsyPBtzHqXJvXRtq0Wta5S5VI3t8dWe4kqfkYhctYqFJ0lHWRanYd+NXBSHqFWndU3Q+wy5p7NZ4st/jFaHyiVPkpTGv5T8IPsCahgaCt3wYVLloSrTytBXc9iSn3T71JhFBj47zqEa+E8MSNZlNaqh7BnxI6lVhpMrgft7dOIaByFkieeqFFsOKU4D79/XwCcpo66pmIo5OenfRHCtmp2xYMHXbUrKGDaZMhnoc9VBDsaHsMFiyEKWukHwxmFjt2k60AqkqT8BuBf2uyT/20/JQw4W9iDwedPmhz3mHmHh6cc2EMwrBrD3sIpnMuxabrUwfuwfTFgWHd7IkEw9WGwM1DMsWlxxi5u8fF2xMA+4KYcuZIkHPjl5nQ+RQhd0Y9N/+HrVrf88z0cw9lIlobf0MuZvPfxLv2hJbHaNZsOet5d1W9DsZWS0+V6BxNRjEpJci5xKZpgPaEyY+p+kKz/Q11PW+A1VGSVs+aRUHJb0tPm/MrySF8D3uClHKiadFy1mwvvOHUyHuOtiTbb0LGbnEoyySTjLDwsSJ2ybhbqPCbnFNclDWX7Jv20dpY9ZuWVdt/Z4PCmk7/vKw6eyfI0xsGBQQJcizKICQei+Zh8UeHCdU1GOMFiy26Y=" + # DEPLOY_TO directory + - secure: "KejjF6Zyhd37TCFfn08Htco7LYkKc+yEwMzgSEUF6kjeoMe0VYlNCDqlAvQRdGXONZg7cz83h298gJfbvDkKdMm32e73NPfXcCdQBWTuWYx8xzM63WuKrYjM+oFyAxJ2hgOOaK14ctSQtAcnpaZRm12aIpbeRgwpe2oZEBOwwYi4TdwMvrG7WyxhZniqfFQYYjT/8xAgzkmREAJRxp/PBp1+Xe2vkTHZUMHxOM3JAiganSfvgnPA7imY/wu5si9qcwNw0bo+0ISDNXk3mV9p5dlB5Cudjfme8kMjYjqUrBcQ9p0heODZXRCfwC+kdsg4oLAYdDB5nOvPX3b18liWl6ZZ/qaiaq6eLro9IgJgrALFBpElr6oVlMaAil8yKIokM9Pfga1MhdZLLZEuziK2B1T34IS7/5PEy/l9+9cFezpCj0e2Mdpa6FbcrjyX1uPK/U2Hy9tKdVzuLPBS4bQgrKah+Xc2ml3EU+SEhz3UGSi2d+9GZQ0G2n1sVcawVOyzcdqHO6Y53WQ2/UVwJ9TsnLPTWUHLplGgRmAXbTtEhQDDYeffwVd7nZfTQlEug00DlrSoJoSHra6s7oEYLC2lrJoyH82/nkjvCupqxZM9D1V82sUsYAgC4KVzZNg0VROycbBefpgIrvw01eSakay1vOVNsrxptcNXjK9/wiuFbOI=" + - BRANCH_PULL=$TRAVIS_PULL_REQUEST_BRANCH + - PULL=$TRAVIS_PULL_REQUEST + - BRANCH=$TRAVIS_BRANCH + +matrix: + include: + - compiler: "clang" + os: linux + dist: trusty + env: LDIST=DO_NOT_DEPLOY + - compiler: "gcc" + os: linux + dist: precise + env: LDIST=-precise + - compiler: "gcc" + os: linux + dist: trusty + env: LDIST=-trusty + - compiler: "gcc" + os: osx + osx_image: xcode6.4 + env: LDIST=-osx_10.10 + - compiler: "gcc" + os: osx + osx_image: xcode7.3 + env: LDIST=-osx_10.11 + - compiler: "gcc" + os: osx + osx_image: xcode8.1 + env: + - LDIST=-osx_10.12 + - EXTRA_SSH=-oHostKeyAlgorithms=+ssh-dss + +addons: + artifacts: true + ssh_known_hosts: + secure: "HzU57pX/0iwRgPCnrP7QQ92XkrySsx/jjCLEqNAyWuQBYTMl2vVXnys7dclUp841CWRHv3TQXT0Jem9mZ9oZbzMR8Nxo2mjJyiH06BMcBYmTiaGxzSOh0XjiYTm3ZZvH+SQYdiXNBbPIY7B1ekC6Vw/ZQ8N4U1SiMh5W38+jXgqTYefB2h8GjmYB8f3DP0WE97ITaLG0/dUF+vLkuyJaLHND2j0e+cjjir8ah8eioK67+iX1dnDnN4U6su7tdVcqHGdgS3sSjvFl8+q9R9IFuT2RuQLd05Fu5gehV5ruJP0GzjJ8eU1fhkFSiWPenBGgkDRsv7ORmtL9ZmZKjtXIxhIlgVBdH8Rb9qtDCbKf6tSSrOU14TkN1FR8uPw68xhlnptS31AwB+OisWw1ULRJBEWRTABw+avUloDhgFMgUtFnSukjMlst16Qwq5bGKn5yQ6KBJU8BP/uX6ptGQemTokEe92TWJq6TS6kNpb8rA537gaMp8VQ2zk8Nhw6LovA5LbuKB73rcjuQsOto2/DF2GhJkBQ0peVzu1vsAFD5WmMTPzQziTLiTyI+gQktYJSoV8ERAvxqeDptqUYMrRMg7VtuV5fNEQ2Q5fVMrcqB9NGkeUjfIo7GHP0tBEzLCNjaRNYrMxEqKYW8OQSfINA3b3gLZuwLepHW71j2xqnFlpQ=" + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./CI/travis/before_install_darwin ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./CI/travis/before_install_linux ; fi + + - mkdir -p $TRAVIS_BUILD_DIR/build + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p $TRAVIS_BUILD_DIR/build_tar ; fi + +script: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ${TRAVIS_BUILD_DIR}/CI/travis/make_linux; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ${TRAVIS_BUILD_DIR}/CI/travis/make_darwin; fi + +notifications: + email: + on_success: change + on_failure: always + +before_deploy: + - . ${TRAVIS_BUILD_DIR}/CI/travis/before_deploy + - openssl aes-256-cbc -K $encrypted_ca7c55addc40_key -iv $encrypted_ca7c55addc40_iv -in ${TRAVIS_BUILD_DIR}/CI/travis/deploy.rsa.enc -out /tmp/deploy.rsa -d + - eval "$(ssh-agent -s)" + - chmod 600 /tmp/deploy.rsa + - ssh-add /tmp/deploy.rsa +deploy: + - provider: releases + api_key: + secure: "ocDkFUpRYim0o3kEzO5It8mTjg4FnVYT+KaXoUtZA6r9x6VZteSFvimELIV/WePGnNLOavlXPgRb+cXmJiYSkVkFqrrwRkHgYvTapjPn/LBh0xDQZi9SrvTj/ICW3tMu7Esxqa7P2snhLf7P4XkLMySxeooKe4BoV5Uy8WUy+IE0HCkCxaiokUFEg7UVVDLy5ahTyVcdV4su44E+URCBDTk+UvgKJ3VDjNVDZp8uea7RBRHVfSucb/12AeJr+PkaxrbsqtI+GHMohvmLVBmALkP+WtLLMklxPofEnBW/UV6iU+hvEd6dROqG9T52hDQpcBqdJlqx4C3mHkPpt7lxSFTcyyTKEqRKZA0sBexadMZ3fnS2gNXizstuDAxIuCowc+nOjk1WNAN8z4ADxk5t4ct8U1I7CTA0TgkTzkRizeelTTZCbt8kHwh4oTalBt/5rIg3Tk8+YgrwvuEIAmRwPIORob+xbYGK9GCKwmdfpSuVhcLsgb43eh96ZXQ2bBn30I3pebCMm9xa+1c8pStBlMYmJPJv0Y6m5uNUJAvOImWNoZlyA967Df8b3pbODqhFkUN3OgDyR3uYRxBCohZgmguOvHsqtkM66/QgIMy2vQxhcnzc78dMT/BfLJ13RuN6+9DiGUMuGCzsVgQ7MNQu8MAkUV+fiEdGz6yxskiwpAQ=" + file: + - "${RELEASE_PKG_FILE_DEB}" + - "${RELEASE_PKG_FILE_RPM}" + - "${RELEASE_PKG_FILE_TGZ}" + skip_cleanup: true + on: + repo: analogdevicesinc/libad9361-iio + tags: true + condition: "($CC = gcc) && ($TRAVIS_OS_NAME = linux)" + - provider: script + skip_cleanup: true + script: + - ${TRAVIS_BUILD_DIR}/CI/travis/deploy + on: + condition: "($CC = gcc) && ($TRAVIS_OS_NAME = linux)" + all_branches: true + - provider: script + skip_cleanup: true + script: + - ${TRAVIS_BUILD_DIR}/CI/travis/deploy + on: + condition: "$TRAVIS_OS_NAME = osx" + all_branches: true