Compare commits

..

71 Commits

Author SHA1 Message Date
Jon Szymaniak fe99478a0c bladeRF: RXVGA2 range is [0, 30]
While the RXVGA2 gain can technically go up to 60 dB, the LMS6002D
datasheet recommends it be clamped to 30dB. libbladeRF clamps to a max
of 30dB, so there's no use in setting max to 60 dB here.
2014-02-16 09:10:08 +01:00
Jon Szymaniak b7360fc879 bladerf: Added 'verbosity' and 'loopback' device parameters
The 'verbosity' parameter may be used to increase or suppress output from
libbladeRF. The available log levels are, in order of decreasing
verbosity are:
    verbose, debug, info, warning, critical, silent

The 'loopback' parameter may be used to put the bladeRF into one of the
supported loopback modes.  The valid modes are listed below. Their
descriptions may be found in the libbladeRF documentation:

      bb_txlpf_rxvga2, bb_txlpf_rxlpf bb_txvga1_rxvga2, bb_txvga1_rxlpf
      rf_lna1, rf_lna2, rf_lna3
2014-02-16 09:10:04 +01:00
Dimitri Stolnikov 99c9e5ead9 osmosdr/rtl/miri/hackrf: use 15 buffers by default
folowing rtl-sdr commit 89f73b183f2dac9c0dd75beca4cf2f77f20c4a36

So far we had 32 * 256KB which was a bit overkill, 15 are more than
enough.

15 was chosen instead of 16 because at least on Linux there seems to be
a system-wide limit of 63 transfers (when they are 256KB large), so 4
dongles can be used on a single machine without lowering the default
transfer number.
2014-02-16 09:10:01 +01:00
Dimitri Stolnikov 9d85dcf6d1 airspy: add support for AirSpy wideband receiver
Requires https://github.com/airspy/host

Usage example:

osmocom_fft -a airspy

The following named gain stages are available:

LNA: 0 to 15, step 1
MIX: 0 to 15, step 1
IF: 0 to 15, step 1

At the moment the gains are not in dB but gain indices internal to R820t
tuner.
2014-02-16 09:09:55 +01:00
Dimitri Stolnikov 0e99eb95f7 rfspace: properly cover the absense of a serial number 2014-01-26 19:55:36 +01:00
Brian Padalino 98a6e7604f bladeRF: Modifying correction calls.
Modifying correction function calls to match libbladeRF API.
2014-01-26 17:36:56 +01:00
Jon Szymaniak 9964a5e6a9 bladerf: Removed sign extension and masking of samples
This is no longer required as of FPGA v0.0.1, and has been removed to
remove some unnecessary computation on samples.
2014-01-26 17:36:53 +01:00
Jon Szymaniak 9a8710757f bladerf: Updates for libbladeRF v0.11.0 API changes 2014-01-26 17:36:50 +01:00
Jon Szymaniak 0ee06038ae bladerf: Use rational sample rate functions
libbladeRF provides accessors for rational sample rates, which the
integer sample rate functions use under the hood. Therefore, there's no
need to check if the requested rate contains a fractional portion and
switch between the two sets of functions.
2014-01-26 17:36:47 +01:00
Jon Szymaniak 1905cdc64c bladerf: Added start()/stop() implementations 2014-01-26 17:36:43 +01:00
Dimitri Stolnikov a734c1ae85 osmocom_fft: print the exception thrown in DC/IQ correction setters 2014-01-26 17:36:38 +01:00
Dimitri Stolnikov d7557d9432 osmocom_siggen: add controls for DC offset and IQ imbalance correction 2014-01-26 17:36:35 +01:00
Dimitri Stolnikov 9701906aaf bladerf: shorten the serial number that is being shown to the user 2014-01-26 17:36:32 +01:00
Dimitri Stolnikov 27a5e07ba3 bladerf: implement DC offset and IQ imbalance correction
This patch has been provided by Brent J.
2014-01-26 17:36:29 +01:00
Dimitri Stolnikov 22705c89cf bladerf: FX3 firmware loading not supported from within gr-osmosdr 2014-01-26 17:36:25 +01:00
Dimitri Stolnikov f78d79398f bladerf: prepare functions to control DC offset / IQ balance (WIP) 2014-01-26 17:36:22 +01:00
Dimitri Stolnikov 6b61662b37 apps/osmocom_fft: gui to set DC offset / IQ imbalance correction mode 2014-01-26 17:36:16 +01:00
Dimitri Stolnikov 2a54ac2aed rfspace: add missing header for basename() 2014-01-26 17:36:12 +01:00
Sylvain Munaut 81c53bf547 osmocom_fft: Properly set initial sample rate for fosphor output
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-01-26 17:36:07 +01:00
Dimitri Stolnikov 9b76d230e9 rfspace: add support for RFSPACE SDR-IQ and SDR-IP
Usage example:

osmocom_fft -a sdr-iq=/dev/ttyUSB0
osmocom_fft -a sdr-ip=host[:port]
osmocom_fft -a netsdr=host[:port][,nchan=2]

The following named gain stages are available:

SDR-IQ: ATT: -20 to +10 dB, in 10dB steps
SDR-IP: ATT: -30 to 0 dB, in 10dB steps

The ftdi_sio driver is being used for SDR-IQ. It creates a character
device of the form:

crw-rw---- 1 root dialout 188, 0 Dec 19 22:14 /dev/ttyUSB0

To be able to open the device without root permissions add yourself to
the "dialout" group or do a "chmod 666 /dev/ttyUSB0" after pluggin in.
2014-01-26 17:35:59 +01:00
Dimitri Stolnikov c7a77e88d9 device: implement "nofake" hint to exclude dummy devices from discovery
usage example:

osmosdr::device_t hint( "nofake" );
osmosdr::devices_t devs = osmosdr::device::find( hint );
2014-01-26 17:35:55 +01:00
Dimitri Stolnikov 411a2b683b cmake: pull updates from gnuradio master 2014-01-26 17:35:51 +01:00
Dimitri Stolnikov 8984357be5 add UmTRX to the list of supported devices
requires Fairwaves' port of the Ettus UHD library:

https://github.com/fairwaves/UHD-Fairwaves
2014-01-26 17:35:38 +01:00
Dimitri Stolnikov e48f8cf2c9 file: add missing include for boost::format 2014-01-26 17:35:33 +01:00
Steve Markgraf 19556d00da rtl/rtl_tcp: add 2.56e6 as 'good' sample rate
Several tests have shown that this is the
highest sample rate where no samples
are being dropped on rtl devices.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-26 17:35:28 +01:00
Dimitri Stolnikov 505c19f82e apps/osmocom_fft: recover when .step property is not given for a range 2014-01-26 17:35:20 +01:00
Dimitri Stolnikov 8522c4edf2 sink/source: fix error message when unable to connect blocks internally 2014-01-26 17:35:16 +01:00
Dimitri Stolnikov 2bd29cbe99 netsdr: implement sample rate change in run mode 2014-01-26 17:34:55 +01:00
Steve Markgraf eb3865010d rtl: add R828D tuner
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04 21:22:11 +01:00
Dimitri Stolnikov 8c5e74c213 netsdr: replace boost asio sockets with native bsd sockets
until we find out what's exactly interfering with fosphor when using
python based flowgraphs (osmocom_fft). c++ flowgraphs are not affected.
2013-11-04 21:22:07 +01:00
Jon Szymaniak dd35921292 bladerf: Don't reload the FPGA unless the force-reload param is set 2013-11-04 21:22:00 +01:00
Jon Szymaniak e735418224 bladerf: Moved initializations to bladerf_common.c, misc. cleanup
Common parameter handling has been moved into bladerf_common::init().

The buflen parameter is now in units of samples, not bytes. This
deviates from the other gr-osmosdr items. However, with the requirement
that buffers be in multiples of 1024 samples, this makes specifying this
parameter a bit easier. The user shouldn't need to know we're operating
on SC16Q12 values under the hood, and have to calculate accordingly.

To avoid confusion when both a bladeRF source and sink are in a flow
graph a [bladeRF source/sink] prefix has been added to output. Error
number have been replaced with bladeRF string representations of these
error values.

Firmware flashing has been removed. The bladeRF-cli or bladeRF-flash
tools are the preferred route for firmware upgrades.
2013-11-04 21:21:54 +01:00
Jon Szymaniak 3ef7394f61 bladerf: Moved no longer "common" items out of bladerf_common
The gr_complex FIFO is no longer used on the TX side, so it doesn't
really make sense to have it in bladerf_common. The associated items
have been moved into bladerf_source, and some renaming has been done in
bladerf_sink to tidy up.

Pending further performance tests of the bladerf_source, the _fifo
member (boost::circular_buffer) may need to be replaced.
2013-11-04 21:21:48 +01:00
Daniel Gröber 0d75ab353d bladerf: Added device caching, this enables full-duplex operation. 2013-11-04 21:21:44 +01:00
Sylvain Munaut 49a3772491 osmocom_fft: Make the scope area fill all available space
The control area is now fixed / packed

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:27:47 +02:00
Sylvain Munaut 2cbc1e14e0 osmocom_fft: Use the new WX version of fosphor sink
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:27:43 +02:00
Dimitri Stolnikov 0ee591f163 netsdr: add support for RFSPACE NetSDR receiver
- implements broadcast UDP based device discovery
- prints device information (serial/versions) on startup
- reads available frequency range(s) from the device
- integrity checks of IQ stream using sequence numbers
- automatic bandpass or a wideband lowpass selectable

The following named gain stages are available:

ATT: -30 to 0 dB, in 10dB steps

Known limitations:

- setting the sample rate is possible only before the
  flowgraph has been started
2013-10-26 15:09:43 +02:00
Dimitri Stolnikov 8f86bd2dca apps/osmocom_fft: use reasonable defaults for gain & center frequency 2013-10-26 15:05:47 +02:00
Dimitri Stolnikov f7640dc11c bladerf: remove unused variable 2013-10-25 23:45:48 +02:00
Dimitri Stolnikov 26acce3d35 use numchan instead of nchan to prevent ambiguity...
..when specifying total number of channels offered by the block
2013-10-25 23:45:30 +02:00
Dimitri Stolnikov dd7d584137 hackrf: implement device discovery
Unfortunately libhackrf still doesn't offer a way to enumerate devices
*or* to open a specific device by index or it's serial number. Thus we
have implemented a rather hack-ish way to detect the presence of a
device by trying to open it and closing right after that.
2013-10-25 23:45:24 +02:00
Dimitri Stolnikov 68481ac40d uhd: improve device discovery 2013-10-25 23:45:20 +02:00
Dimitri Stolnikov 860962e501 file: allow changing the sample rate when throttle=true
this is dangerous from signal processing perspective and should be used
with caution.
2013-10-20 18:51:44 +02:00
Dimitri Stolnikov 8300354c05 cmake: fix flag passing to Clang compiler 2013-10-19 16:36:39 +02:00
Dimitri Stolnikov 2934d8512b apps: catch corner cases for file= mode in osmocom_fft
verified for gqrx and sdrangerlove as well:

file=/tmp/lte.cfile,rate=40e6,freq=1815e6,repeat=true,throttle=true
2013-10-18 19:47:21 +02:00
Sylvain Munaut 5534662c0c apps/osmocom_fft: Add option to use fosphor for the main display
Currently the GLFW variant as it's all that's available currently

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-17 21:27:41 +02:00
Dimitri Stolnikov f61734e58b cmake: make uhd component optional in standalone mode 2013-10-05 12:08:27 +02:00
Dimitri Stolnikov d81936d907 bladerf: use newstyle version getters 2013-10-04 18:31:39 +02:00
Dimitri Stolnikov 7b199a8b95 bladerf: make source less picky wrt rf gain 2013-10-03 14:37:02 +02:00
Dimitri Stolnikov 1f44c44054 source/sink: initialize sample rate cache variable
Thanks to Jiří Pinkava for bringing this up.
2013-10-03 14:25:28 +02:00
Dimitri Stolnikov 56281a6a30 source/sink: fix automatic bandwidth selection 2013-10-03 14:20:31 +02:00
Dimitri Stolnikov 882cac8465 rtl: don't try to parse empty device index values 2013-09-28 13:46:36 +02:00
Dimitri Stolnikov 217872a785 apps: filter bandwidth follows sample rate in osmocom_fft 2013-09-28 13:40:03 +02:00
Dimitri Stolnikov b97cac30c6 updated header documentation for bandwidth setter 2013-09-28 13:35:26 +02:00
Dimitri Stolnikov d8534d8721 bladerf: implement automatic bandwidth selection 2013-09-28 13:33:30 +02:00
Dimitri Stolnikov 851e94b82f hackrf: enable AMP gain stage by default 2013-09-28 13:29:03 +02:00
Dimitri Stolnikov a279fb1455 hackrf: don't set automatic bandwidth on samplerate change
automatic bandwidth selection may be triggered by calling
set_bandwidth(0) after changing the sample rate
2013-09-28 13:27:58 +02:00
Jon Szymaniak cbf791469c bladeRF: Refactored buffering scheme in sink
Removed the use of an intermediate sample FIFO in the sink
implementation. Note the the FIFO has not been moved out of
bladerf_common --> bladerf_source_c in this commit.

work() now handles converting samples from complex to SC16_Q12, and filling
"transmit-ready" buffers. The callbacks are now only responsible for
marking the provided buffer free, and returning the next buffer.

It appears that a small deadlock issues remains in this changest, which
can be induced by:
 1: Using a small sample rate (160Khz)
 2: Switching back and forth between sinusoid <-> GSM burst

 In this case, it appears that work() is blocked waiting for a buffer to
 become free. More investigation here is required...
2013-09-28 00:05:32 +02:00
Dimitri Stolnikov 0690c077d2 bladerf: migration to async api (WIP)
receive works, transmit locks up in work() after few seconds
2013-09-28 00:05:25 +02:00
Dimitri Stolnikov 154100a11f cmake: drop gnuradio-pmt dependency in .pc file 2013-09-20 21:37:58 +02:00
Sylvain Munaut 970658c071 apps: Improve the GSM burst generation
Not sure the power window is really aligned to the samples yet though.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-09-12 23:50:05 +02:00
Frederik M.J. Vestre cdeb105495 Support setting external sampling to bladerf 2013-08-29 23:37:20 +02:00
Dimitri Stolnikov 6fe392546a bladerf: follow recent API changes
tested against aea04c5f119288370166ece05166a8a4157da6fa
2013-08-27 22:40:52 +02:00
Dimitri Stolnikov e65dd08785 cmake: use *_INCLUDE_DIRS in modules 2013-08-13 20:10:51 +02:00
Dimitri Stolnikov 80f72d52ea grc: move around documentation 2013-08-04 22:31:44 +02:00
Dimitri Stolnikov bdc8f22132 uhd: use gr-uhd by default, fall back to built-in code if not found 2013-08-04 10:16:06 +02:00
Dimitri Stolnikov 6e29bf179f rtl_tcp: remove gr-blocks usage for float-to-complex conversion
thanks to Hoernchen for the initial patch
2013-08-04 00:20:29 +02:00
Dimitri Stolnikov bd800ed89e file: import file_source to make it independent from gr blocks 2013-08-04 00:10:40 +02:00
Dimitri Stolnikov f4fd3a176a runtime: always export runtime and blocks symbols 2013-08-03 21:51:51 +02:00
Dimitri Stolnikov 3df0e00276 uhd: import gr-uhd code to be independent from gnuradio-runtime
stripped stream tags support due to lack of pmt
2013-08-03 21:05:18 +02:00
Dimitri Stolnikov be1314af10 runtime: import minimal gr runtime for standalone mode (wip)
stripped pmt and message infrastructure, no logging, no nothing...
2013-08-03 21:00:47 +02:00
324 changed files with 33551 additions and 18163 deletions

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
/.vscode/*
/build/*
*.pyc
*.pyo

View File

@ -2,8 +2,3 @@ Dimitri Stolnikov <horiz0n@gmx.net>
Steve Markgraf <steve@steve-m.de>
Hoernchen <la@tfc-server.de>
Nuand LLC folks
Josh Blum
SDRplay Ltd.
Pavel Demin
Marcus Müller
Lukas Lao Beyer

View File

@ -1,32 +1,30 @@
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
# This file is part of GNU Radio
#
# gr-osmosdr is free software; you can redistribute it and/or modify
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# gr-osmosdr is distributed in the hope that it will be useful,
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-osmosdr; see the file COPYING. If not, write to
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 2.6)
project(gr-osmosdr CXX C)
include(GNUInstallDirs)
enable_testing()
#policy setup
cmake_policy(SET CMP0011 NEW)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
@ -35,205 +33,217 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
########################################################################
# GNURadio setup
########################################################################
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Find GNURadio (pmt and runtime are core, always included)
include(FindPkgConfig)
find_package(Gnuradio "3.9" REQUIRED COMPONENTS blocks fft filter)
# Set the version information here
set(VERSION_MAJOR 0)
set(VERSION_API 2)
set(VERSION_ABI 0)
set(VERSION_PATCH 0)
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_API_COMPAT 1)
set(VERSION_INFO_MINOR_VERSION 1)
set(VERSION_INFO_MAINT_VERSION git)
include(GrVersion) #setup version info
########################################################################
# Compiler specific setup
########################################################################
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
add_definitions(-fvisibility-inlines-hidden)
endif()
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
ELSE()
SET(USE_SIMD "no" CACHE STRING "Use SIMD instructions")
ENDIF()
SET(USE_SIMD_VALUES "no" "SSE2" "AVX")
SET_PROPERTY(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES})
LIST(FIND USE_SIMD_VALUES ${USE_SIMD} USE_SIMD_INDEX)
IF(${USE_SIMD_INDEX} EQUAL -1)
message(FATAL_ERROR "Option ${USE_SIMD} not supported, valid entries are ${USE_SIMD_VALUES}")
ENDIF()
set(CMAKE_CXX_STANDARD 11)
IF(CMAKE_CXX_COMPILER MATCHES ".*clang")
SET(CMAKE_COMPILER_IS_CLANGXX 1)
ENDIF()
# Misc options
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-Wno-unused-parameter)
add_definitions(-Wsign-compare)
#add_definitions(-Wconversion)
#add_definitions(-pedantic)
#add_definitions(-ansi)
endif()
# SIMD
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
set(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
else()
set(USE_SIMD "no" CACHE STRING "Use SIMD instructions")
endif()
set(USE_SIMD_VALUES "no" "SSE2" "AVX")
set_property(CACHE USE_SIMD PROPERTY STRINGS ${USE_SIMD_VALUES})
list(FIND USE_SIMD_VALUES ${USE_SIMD} USE_SIMD_INDEX)
if(${USE_SIMD_INDEX} EQUAL -1)
message(FATAL_ERROR "Option ${USE_SIMD} not supported, valid entries are ${USE_SIMD_VALUES}")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(USE_SIMD MATCHES SSE2)
add_definitions(-msse2)
add_definitions(-DUSE_SSE2)
endif()
if(USE_SIMD MATCHES AVX)
add_definitions(-march=native)
add_definitions(-DUSE_AVX)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(USE_SIMD MATCHES SSE2)
add_definitions(/arch:SSE2)
add_definitions(-DUSE_SSE2)
endif()
if(USE_SIMD MATCHES AVX)
add_definitions(/arch:AVX)
add_definitions(-DUSE_AVX)
endif()
# boost feels like using lib pragmas to link to libs,
# but the boost libs might not even be in the (default) lib search path
add_definitions(-DBOOST_ALL_NO_LIB)
# macro turns std::min into errors...
add_definitions(-DNOMINMAX)
endif()
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
ADD_DEFINITIONS(-Wall)
ADD_DEFINITIONS(-Wextra)
ADD_DEFINITIONS(-Wno-unused-parameter)
ADD_DEFINITIONS(-Wsign-compare)
#ADD_DEFINITIONS(-Wconversion)
#ADD_DEFINITIONS(-pedantic)
#ADD_DEFINITIONS(-ansi)
IF(NOT WIN32)
#only export symbols that are declared to be part of the api (non dll platforms)
ADD_DEFINITIONS(-fvisibility=hidden)
ADD_DEFINITIONS(-fvisibility-inlines-hidden)
ENDIF(NOT WIN32)
IF(USE_SIMD MATCHES SSE2)
ADD_DEFINITIONS(-msse2)
ADD_DEFINITIONS(-DUSE_SSE2)
ENDIF()
IF(USE_SIMD MATCHES AVX)
ADD_DEFINITIONS(-march=native)
ADD_DEFINITIONS(-DUSE_AVX)
ENDIF()
ELSEIF(MSVC)
IF(USE_SIMD MATCHES SSE2)
ADD_DEFINITIONS(/arch:SSE2)
ADD_DEFINITIONS(-DUSE_SSE2)
ENDIF()
IF(USE_SIMD MATCHES AVX)
ADD_DEFINITIONS(/arch:AVX)
ADD_DEFINITIONS(-DUSE_AVX)
ENDIF()
ENDIF()
########################################################################
# Find boost
# Setup boost
########################################################################
find_package(Boost "1.65" REQUIRED chrono thread system)
MESSAGE(STATUS "Configuring Boost C++ Libraries...")
# Although not required on my system, some users have linking issues without
SET(BOOST_REQUIRED_COMPONENTS
thread
system
filesystem
)
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
set(Boost_ADDITIONAL_VERSIONS
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
)
find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost required to compile osmosdr")
message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME})
endif()
########################################################################
# Find build dependencies and setup options
########################################################################
include(GrComponent)
set(ENABLE_NONFREE FALSE CACHE BOOL "Enable or disable nonfree components.")
# GNURadio components & OOTs
##############################
# Note this is not supposed to be lique that for GR components
# but ATM GR's handling of components is broken
message(STATUS "Searching for GNURadio-Blocks...")
find_package(gnuradio-blocks PATHS ${Gnuradio_DIR})
message(STATUS " Found GNURadio-Blocks: ${gnuradio-blocks_FOUND}")
message(STATUS "Searching for IQ Balance...")
find_package(gnuradio-iqbalance PATHS ${Gnuradio_DIR})
message (STATUS " Found IQ Balance: ${gnuradio-iqbalance_FOUND}")
message(STATUS "Searching for UHD Drivers...")
find_package(UHD)
message (STATUS " Found UHD Driver: ${UHD_FOUND}")
message(STATUS "Searching for UHD Block...")
find_package(gnuradio-uhd PATHS ${Gnuradio_DIR})
message (STATUS " Found UHD Block: ${gnuradio-uhd_FOUND}")
message(STATUS "Searching for Volk...")
find_package(Volk REQUIRED)
message (STATUS " Found Volk: ${Volk_FOUND}")
# Hardware drivers
####################
find_package(LibRTLSDR)
if(ENABLE_NONFREE)
find_package(LibSDRplay)
endif(ENABLE_NONFREE)
find_package(LibHackRF)
find_package(LibAIRSPY)
find_package(LibAIRSPYHF)
find_package(LibbladeRF)
find_package(GnuradioFuncube)
find_package(SoapySDR NO_MODULE)
find_package(LibFreeSRP)
find_package(LibXTRX)
find_package(Doxygen)
# Python
##########
find_package(PythonLibs 3)
find_package(pybind11)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
pybind11_FOUND
)
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
########################################################################
# Install directories
########################################################################
include(GrPlatform) #define LIB_SUFFIX
if(NOT CMAKE_MODULES_DIR)
set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
endif(NOT CMAKE_MODULES_DIR)
set(GR_RUNTIME_DIR bin)
set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
set(GR_INCLUDE_DIR include)
set(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/osmosdr)
set(GR_DATA_DIR share)
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
if (NOT GR_PKG_DOC_DIR)
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
endif()
set(GR_CONF_DIR etc)
set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
set(GR_LIBEXEC_DIR libexec)
set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
# Special exception if prefix is /usr so we don't make a /usr/etc.
string(COMPARE EQUAL ${CMAKE_INSTALL_PREFIX} "/usr" isusr)
if(isusr)
set(SYSCONFDIR "/${GR_CONF_DIR}" CACHE PATH "System configuration directory")
else(isusr)
set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/${GR_CONF_DIR}" CACHE PATH "System configuration directory" FORCE)
endif(isusr)
set(GR_PREFSDIR ${SYSCONFDIR}/${CMAKE_PROJECT_NAME}/conf.d)
########################################################################
# On Apple only, set install name and use rpath correctly, if not already set
# Variables replaced when configuring the package config files
########################################################################
if(APPLE)
if(NOT CMAKE_INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
PATH "Library Install Name Destination Directory" FORCE)
endif(NOT CMAKE_INSTALL_NAME_DIR)
if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
PATH "Library Install RPath" FORCE)
endif(NOT CMAKE_INSTALL_RPATH)
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
BOOL "Do Build Using Library Install RPath" FORCE)
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
endif(APPLE)
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" prefix)
file(TO_NATIVE_PATH "\${prefix}" exec_prefix)
file(TO_NATIVE_PATH "\${exec_prefix}/${GR_LIBRARY_DIR}" libdir)
file(TO_NATIVE_PATH "\${prefix}/${GR_INCLUDE_DIR}" includedir)
file(TO_NATIVE_PATH "${SYSCONFDIR}" SYSCONFDIR)
file(TO_NATIVE_PATH "${GR_PREFSDIR}" GR_PREFSDIR)
########################################################################
# Setup doxygen option
# Find build dependencies
########################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS)
find_package(Gnuradio "3.7.0")
find_package(GnuradioIQBalance)
find_package(UHD)
find_package(GnuradioUHD)
find_package(GnuradioFCD)
find_package(GnuradioFCDPP)
find_package(LibOsmoSDR)
find_package(LibRTLSDR)
find_package(LibMiriSDR)
find_package(LibHackRF)
find_package(LibAIRSPY)
find_package(LibbladeRF)
find_package(Doxygen)
if(DOXYGEN_FOUND)
option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
else(DOXYGEN_FOUND)
option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
endif(DOXYGEN_FOUND)
set(PYTHON_RUNTIME_CHECK TRUE)
if(NOT GNURADIO_RUNTIME_FOUND)
message(STATUS "Enabling built-in GNU Radio runtime...")
set(RUNTIME_MODE TRUE CACHE INTERNAL "Built-in GNU Radio runtime")
add_subdirectory(include/osmosdr/runtime)
set(GNURADIO_RUNTIME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include/osmosdr/runtime)
set(GNURADIO_RUNTIME_LIBRARY_DIRS "")
set(GNURADIO_RUNTIME_LIBRARIES "")
set(GNURADIO_PMT_INCLUDE_DIRS "")
set(GNURADIO_PMT_LIBRARY_DIRS "")
set(GNURADIO_PMT_LIBRARIES "")
set(GNURADIO_BLOCKS_INCLUDE_DIRS "")
set(GNURADIO_BLOCKS_LIBRARY_DIRS "")
set(GNURADIO_BLOCKS_LIBRARIES "")
set(GNURADIO_UHD_INCLUDE_DIRS "")
set(GNURADIO_UHD_LIBRARIES "")
LIST(APPEND GR_OSMOSDR_PC_CFLAGS "-I\${includedir}/osmosdr/runtime")
# disable python bindings as long as we don't have any swig files for the runtime
set(PYTHON_RUNTIME_CHECK FALSE)
endif(NOT GNURADIO_RUNTIME_FOUND)
if(GNURADIO_RUNTIME_FOUND)
LIST(APPEND GR_OSMOSDR_PC_REQUIRES "gnuradio-runtime")
endif(GNURADIO_RUNTIME_FOUND)
if(GNURADIO_PMT_FOUND)
# LIST(APPEND GR_OSMOSDR_PC_REQUIRES "gnuradio-pmt")
endif(GNURADIO_PMT_FOUND)
if(GNURADIO_BLOCKS_FOUND)
LIST(APPEND GR_OSMOSDR_PC_REQUIRES "gnuradio-blocks")
endif(GNURADIO_BLOCKS_FOUND)
########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/lib
${Boost_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_PMT_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
)
link_directories(
${Boost_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
${GNURADIO_PMT_LIBRARY_DIRS}
${GNURADIO_BLOCKS_LIBRARY_DIRS}
)
# Set component parameters
set(GR_OSMOSDR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
set(GR_OSMOSDR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
########################################################################
# Create uninstall target
@ -245,7 +255,29 @@ configure_file(
add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
)
########################################################################
# Enable python component
########################################################################
find_package(PythonLibs 2)
find_package(SWIG)
if(SWIG_FOUND)
message(STATUS "Minimum SWIG version required is 1.3.31")
set(SWIG_VERSION_CHECK FALSE)
if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
set(SWIG_VERSION_CHECK TRUE)
endif()
endif(SWIG_FOUND)
include(GrComponent)
GR_REGISTER_COMPONENT("Python bindings" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
PYTHON_RUNTIME_CHECK
)
########################################################################
# Add subdirectories
@ -253,22 +285,53 @@ add_custom_target(uninstall
add_subdirectory(include/osmosdr)
add_subdirectory(lib)
if(ENABLE_PYTHON)
add_subdirectory(swig)
add_subdirectory(python)
add_subdirectory(grc)
add_subdirectory(apps)
endif(ENABLE_PYTHON)
add_subdirectory(docs)
########################################################################
# Create Pkg Config File
########################################################################
FOREACH(inc ${Boost_INCLUDE_DIRS})
LIST(APPEND GR_OSMOSDR_PC_CFLAGS "-I${inc}")
ENDFOREACH(inc)
FOREACH(lib ${Boost_LIBRARY_DIRS})
LIST(APPEND GR_OSMOSDR_PC_LIBS "-L${lib}")
ENDFOREACH(lib)
# use space-separation format for the pc file
STRING(REPLACE ";" " " GR_OSMOSDR_PC_REQUIRES "${GR_OSMOSDR_PC_REQUIRES}")
STRING(REPLACE ";" " " GR_OSMOSDR_PC_CFLAGS "${GR_OSMOSDR_PC_CFLAGS}")
STRING(REPLACE ";" " " GR_OSMOSDR_PC_LIBS "${GR_OSMOSDR_PC_LIBS}")
# unset these vars to avoid hard-coded paths to cross environment
IF(CMAKE_CROSSCOMPILING)
UNSET(GR_OSMOSDR_PC_CFLAGS)
UNSET(GR_OSMOSDR_PC_LIBS)
ENDIF(CMAKE_CROSSCOMPILING)
# fake gnuradio cpack behavior as long as we don't use it directly
set(CPACK_PACKAGE_NAME "gnuradio-osmosdr")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio block for various radio hardware")
set(CPACK_PACKAGE_VERSION ${VERSION})
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-osmosdr.pc.in
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
@ONLY)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-osmosdr.pc
DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
)
########################################################################
# Print Summary
########################################################################
GR_PRINT_COMPONENT_SUMMARY()
if(ENABLE_NONFREE)
MESSAGE(STATUS
"NONFREE components have been enabled. The resulting
binaries cannot be distributed under GPL terms.
")
endif(ENABLE_NONFREE)
MESSAGE(STATUS "Building for version: ${VERSION} / ${LIBVER}")
MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")

View File

@ -1,33 +0,0 @@
title: gr-osmosdr
brief: GNU Radio block for interfacing with various radio hardware
tags:
- rtlsdr
- bladerf
- airspy
- rfspace
- hackrf
- soapy
- sdrplay
- uhd
- osmocom
author:
- Dimitri Stolnikov <horiz0n@gmx.net>
copyright_owner:
- Dimitri Stolnikov <horiz0n@gmx.net>
license: GPLv3
repo: git://git.osmocom.org/gr-osmosdr
website: http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
---
GNU Radio block for interfacing with various radio hardware
![FFT](http://sdr.osmocom.org/trac/raw-attachment/wiki/GrOsmoSDR/fft-lte.png "osmocom_fft")
![SIG](http://sdr.osmocom.org/trac/raw-attachment/wiki/GrOsmoSDR/siggen-gsm.png "osmocom_siggen")
![GS2](http://sdr.osmocom.org/trac/raw-attachment/wiki/GrOsmoSDR/gsm-hackrf-8M.png "osmocom_siggen with hackrf")
Support for gr-fosphor in `osmocom_fft` is available through the -F option.
![LTE](http://sdr.osmocom.org/trac/raw-attachment/wiki/GrOsmoSDR/fosphor.png "LTE")
![GSM](http://sdr.osmocom.org/trac/raw-attachment/wiki/GrOsmoSDR/fosphor2.png "GSM")
Please refer to the documentation on http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
for installation instructions.

16
README
View File

@ -1,21 +1,19 @@
While primarily being developed for the OsmoSDR hardware, this block
as well supports:
* FUNcube Dongle / Pro+ through gr-funcube
* FUNcube Dongle through libgnuradio-fcd
* FUNcube Dongle Pro+ through gr-fcdproplus
* sysmocom OsmoSDR Devices through libosmosdr
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* SDRplay RSP through SDRplay API library
* MSi2500 based DVB-T dongles through libmirisdr
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
* AirSpy Wideband Receiver through libairspy
* CCCamp 2015 rad1o Badge through libhackrf
* Great Scott Gadgets HackRF through libhackrf
* Nuand LLC bladeRF through libbladeRF library
* Ettus USRP Devices through Ettus UHD library
* Fairwaves UmTRX through Fairwaves' module for UHD
* Fairwaves XTRX through libxtrx
* Red Pitaya SDR transceiver (http://bazaar.redpitaya.com)
* FreeSRP through libfreesrp
* Fairwaves UmTRX through Fairwaves' fork of UHD
By using the OsmoSDR block you can take advantage of a common software api in
your application(s) independent of the underlying radio hardware.
@ -23,11 +21,11 @@ your application(s) independent of the underlying radio hardware.
For installation and usage guidelines please read the documentation available
at http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
For the impatient :) a short excerpt:
A short excerpt from the wiki:
The Gnu Radio block requires a recent gnuradio (>= v3.7) to be installed.
Before building the block you have to make sure that all the dependencies
Before building the block you have to make sure that all dependencies
(see list of supported devices above) you are intend to work with are
properly installed. The build system of gr-osmosdr will recognize them and
enable specific source/sink components thereafter.

View File

@ -1,19 +1,19 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
# This file is part of GNU Radio
#
# gr-osmosdr is free software; you can redistribute it and/or modify
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# gr-osmosdr is distributed in the hope that it will be useful,
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-osmosdr; see the file COPYING. If not, write to
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
@ -28,8 +28,8 @@ GR_PYTHON_INSTALL(
GR_PYTHON_INSTALL(
PROGRAMS
osmocom_fft
# osmocom_siggen
osmocom_siggen
osmocom_siggen_nogui
# osmocom_spectrum_sense
osmocom_spectrum_sense
DESTINATION ${GR_RUNTIME_DIR}
)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
#
# Copyright 2009,2011,2012 Free Software Foundation, Inc.
#
@ -164,19 +164,16 @@ class app_gui(pubsub):
)
freq_hbox.AddSpacer(5)
try:
forms.slider(
parent=self.panel, sizer=freq_hbox,
proportion=2,
ps=self.tb,
key=osmocom_siggen.TX_FREQ_KEY,
minimum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].start(),
maximum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].stop(),
num_steps=101,
)
freq_hbox.AddSpacer(3)
except:
pass
forms.slider(
parent=self.panel, sizer=freq_hbox,
proportion=2,
ps=self.tb,
key=osmocom_siggen.TX_FREQ_KEY,
minimum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].start(),
maximum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].stop(),
num_steps=101,
)
freq_hbox.AddSpacer(3)
corr_hbox.AddSpacer(3)
forms.text_box(
@ -483,7 +480,7 @@ def main():
app.MainLoop()
except RuntimeError, e:
print(e)
print e
sys.exit(1)
# Make sure to create the top block (tb) within a function: That code

View File

@ -46,7 +46,7 @@ from gnuradio import blocks
from gnuradio import filter
from gnuradio import analog
from gnuradio import digital
from gnuradio import gr, eng_notation
from gnuradio import gr, gru, eng_notation
from gnuradio.gr.pubsub import pubsub
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@ -109,9 +109,9 @@ class gsm_source_c(gr.hier_block2):
[0,0,0],
]
burst = sum(chunks,[])
burst = sum(list(map(list, list(zip(burst, (1,) * len(burst))))), [])
burst = sum(map(list, zip(burst, (1,) * len(burst))), [])
burst += [1,0] * (l-148)
return list(map(int, burst))
return map(int, burst)
def gen_gsm_frame(self):
return \
@ -186,13 +186,9 @@ class top_block(gr.top_block, pubsub):
try:
self._sink.get_sample_rates().start()
except RuntimeError:
print("Sink has no sample rates (wrong device arguments?).")
print "Sink has no sample rates (wrong device arguments?)."
sys.exit(1)
# Set the clock source:
if options.clock_source is not None:
self.src.set_clock_source(options.clock_source)
if options.samp_rate is None:
options.samp_rate = self._sink.get_sample_rates().start()
@ -202,60 +198,25 @@ class top_block(gr.top_block, pubsub):
if(options.gain):
gain = self._sink.set_gain(options.gain)
if self._verbose:
print("Set gain to:", gain)
if self._verbose:
gain_names = self._sink.get_gain_names()
for name in gain_names:
range = self._sink.get_gain_range(name)
print("%s gain range: start %d stop %d step %d" % (name, range.start(), range.stop(), range.step()))
if options.gains:
for tuple in options.gains.split(","):
name, gain = tuple.split(":")
gain = int(gain)
print("Setting gain %s to %d." % (name, gain))
self._sink.set_gain(gain, name)
if self._verbose:
rates = self._sink.get_sample_rates()
print('Supported sample rates %d-%d step %d.' % (rates.start(), rates.stop(), rates.step()))
print "Set gain to:", gain
# Set the antenna
if self._verbose:
print("setting antenna...")
if(options.antenna):
ant = self._sink.set_antenna(options.antenna, 0)
if self._verbose:
print("Set antenna to:", ant)
try:
self.publish(FREQ_RANGE_KEY, self._sink.get_freq_range)
except:
print("Couldn't publish %s" % FREQ_RANGE_KEY)
print "Set antenna to:", ant
try:
for name in self.get_gain_names():
self.publish(GAIN_RANGE_KEY(name), (lambda self=self,name=name: self._sink.get_gain_range(name)))
except:
print("Couldn't publish %s" % FREQ_RANGE_KEY)
self.publish(FREQ_RANGE_KEY, self._sink.get_freq_range)
try:
self.publish(BWIDTH_RANGE_KEY, self._sink.get_bandwidth_range)
except:
if self._verbose:
print("Couldn't publish %s" % BWIDTH_RANGE_KEY)
for name in self.get_gain_names():
self.publish(GAIN_RANGE_KEY(name), (lambda self=self,name=name: self._sink.get_gain_range(name)))
try:
for name in self.get_gain_names():
self.publish(GAIN_KEY(name), (lambda self=self,name=name: self._sink.get_gain(name)))
except:
if self._verbose:
print("Couldn't publish GAIN_KEYs")
try:
self.publish(BWIDTH_KEY, self._sink.get_bandwidth)
except:
if self._verbose:
print("Couldn't publish %s" % BWIDTH_KEY)
self.publish(BWIDTH_RANGE_KEY, self._sink.get_bandwidth_range)
for name in self.get_gain_names():
self.publish(GAIN_KEY(name), (lambda self=self,name=name: self._sink.get_gain(name)))
self.publish(BWIDTH_KEY, self._sink.get_bandwidth)
def get_gain_names(self):
return self._sink.get_gain_names()
@ -277,7 +238,7 @@ class top_block(gr.top_block, pubsub):
return True # Waveform not yet set
if self._verbose:
print("Set sample rate to:", sr)
print "Set sample rate to:", sr
return True
@ -286,27 +247,21 @@ class top_block(gr.top_block, pubsub):
g = self[GAIN_RANGE_KEY(name)]
gain = float(g.start()+g.stop())/2
if self._verbose:
print("Using auto-calculated mid-point gain")
print "Using auto-calculated mid-point gain"
self[GAIN_KEY(name)] = gain
return
gain = self._sink.set_gain(gain, name)
if self._verbose:
print("Set " + name + " gain to:", gain)
print "Set " + name + " gain to:", gain
def set_bandwidth(self, bw):
try:
clipped_bw = self[BWIDTH_RANGE_KEY].clip(bw)
except:
if self._verbose:
print("couldn't clip bandwidth")
return
clipped_bw = self[BWIDTH_RANGE_KEY].clip(bw)
if self._sink.get_bandwidth() != clipped_bw:
bw = self._sink.set_bandwidth(clipped_bw)
if self._verbose:
print("Set bandwidth to:", bw)
print "Set bandwidth to:", bw
def set_dc_offset(self, value):
correction = complex( self[DC_OFFSET_REAL], self[DC_OFFSET_IMAG] )
@ -315,9 +270,9 @@ class top_block(gr.top_block, pubsub):
self._sink.set_dc_offset( correction )
if self._verbose:
print("Set DC offset to", correction)
print "Set DC offset to", correction
except RuntimeError as ex:
print(ex)
print ex
def set_iq_balance(self, value):
correction = complex( self[IQ_BALANCE_MAG], self[IQ_BALANCE_PHA] )
@ -326,16 +281,16 @@ class top_block(gr.top_block, pubsub):
self._sink.set_iq_balance( correction )
if self._verbose:
print("Set IQ balance to", correction)
print "Set IQ balance to", correction
except RuntimeError as ex:
print(ex)
print ex
def set_freq(self, freq):
if freq is None:
f = self[FREQ_RANGE_KEY]
freq = float(f.start()+f.stop())/2.0
if self._verbose:
print("Using auto-calculated mid-point frequency")
print "Using auto-calculated mid-point frequency"
self[TX_FREQ_KEY] = freq
return
@ -343,22 +298,22 @@ class top_block(gr.top_block, pubsub):
if freq is not None:
self._freq = freq
if self._verbose:
print("Set center frequency to", freq)
print "Set center frequency to", freq
elif self._verbose:
print("Failed to set freq.")
print "Failed to set freq."
return freq
def set_freq_corr(self, ppm):
if ppm is None:
ppm = 0.0
if self._verbose:
print("Using frequency corrrection of", ppm)
print "Using frequency corrrection of", ppm
self[FREQ_CORR_KEY] = ppm
return
ppm = self._sink.set_freq_corr(ppm)
if self._verbose:
print("Set frequency correction to:", ppm)
print "Set frequency correction to:", ppm
def set_waveform_freq(self, freq):
if self[TYPE_KEY] == analog.GR_SIN_WAVE:
@ -433,24 +388,24 @@ class top_block(gr.top_block, pubsub):
self.unlock()
if self._verbose:
print("Set baseband modulation to:", waveforms[type])
print "Set baseband modulation to:", waveforms[type]
if type == analog.GR_SIN_WAVE:
print("Modulation frequency: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),))
print("Initial phase:", self[WAVEFORM_OFFSET_KEY])
print "Modulation frequency: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),)
print "Initial phase:", self[WAVEFORM_OFFSET_KEY]
elif type == "2tone":
print("Tone 1: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),))
print("Tone 2: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),))
print "Tone 1: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),)
print "Tone 2: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),)
elif type == "sweep":
print("Sweeping across %sHz to %sHz" % (n2s(-self[WAVEFORM_FREQ_KEY]/2.0),n2s(self[WAVEFORM_FREQ_KEY]/2.0)))
print("Sweep rate: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),))
print "Sweeping across %sHz to %sHz" % (n2s(-self[WAVEFORM_FREQ_KEY]/2.0),n2s(self[WAVEFORM_FREQ_KEY]/2.0))
print "Sweep rate: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),)
elif type == "gsm":
print("GSM Burst Sequence")
print("TX amplitude:", self[AMPLITUDE_KEY])
print "GSM Burst Sequence"
print "TX amplitude:", self[AMPLITUDE_KEY]
def set_amplitude(self, amplitude):
if amplitude < 0.0 or amplitude > 1.0:
if self._verbose:
print("Amplitude out of range:", amplitude)
print "Amplitude out of range:", amplitude
return False
if self[TYPE_KEY] in (analog.GR_SIN_WAVE, analog.GR_CONST_WAVE, analog.GR_GAUSSIAN, analog.GR_UNIFORM):
@ -466,7 +421,7 @@ class top_block(gr.top_block, pubsub):
return True # Waveform not yet set
if self._verbose:
print("Set amplitude to:", amplitude)
print "Set amplitude to:", amplitude
return True
def get_options():
@ -477,14 +432,10 @@ def get_options():
help="Device args, [default=%default]")
parser.add_option("-A", "--antenna", type="string", default=None,
help="Select Rx Antenna where appropriate")
parser.add_option("", "--clock-source",
help="Set the clock source; typically 'internal', 'external', 'external_1pps', 'mimo' or 'gpsdo'")
parser.add_option("-s", "--samp-rate", type="eng_float", default=None,
help="Set sample rate (bandwidth), minimum by default")
parser.add_option("-g", "--gain", type="eng_float", default=None,
help="Set gain in dB (default is midpoint)")
parser.add_option("-G", "--gains", type="string", default=None,
help="Set named gain in dB, name:gain,name:gain,...")
parser.add_option("-f", "--tx-freq", type="eng_float", default=None,
help="Set carrier frequency to FREQ [default=mid-point]",
metavar="FREQ")
@ -525,19 +476,19 @@ def get_options():
# the below does not run.
def test_main():
if gr.enable_realtime_scheduling() != gr.RT_OK:
print("Note: failed to enable realtime scheduling, continuing")
print "Note: failed to enable realtime scheduling, continuing"
# Grab command line options and create top block
try:
(options, args) = get_options()
tb = top_block(options, args)
except RuntimeError as e:
print(e)
except RuntimeError, e:
print e
sys.exit(1)
tb.start()
input('Press Enter to quit: ')
raw_input('Press Enter to quit: ')
tb.stop()
tb.wait()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
#
# Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
#
@ -26,19 +26,19 @@ import sys
def main():
if gr.enable_realtime_scheduling() != gr.RT_OK:
print("Note: failed to enable realtime scheduling, continuing")
print "Note: failed to enable realtime scheduling, continuing"
# Grab command line options and create top block
try:
(options, args) = osmocom_siggen.get_options()
tb = osmocom_siggen.top_block(options, args)
except RuntimeError as e:
print(e)
except RuntimeError, e:
print e
sys.exit(1)
tb.start()
input('Press Enter to quit: ')
raw_input('Press Enter to quit: ')
tb.stop()
tb.wait()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
#
# Copyright 2005,2007,2011 Free Software Foundation, Inc.
#
@ -71,13 +71,13 @@ class tune(gr.feval_dd):
# wait until msgq is empty before continuing
while(self.tb.msgq.full_p()):
#print("msgq full, holding..")
#print "msgq full, holding.."
time.sleep(0.1)
return new_freq
except Exception as e:
print("tune: Exception: ", e)
except Exception, e:
print "tune: Exception: ", e
class parse_msg(object):
@ -147,7 +147,7 @@ class my_top_block(gr.top_block):
realtime = True
else:
realtime = False
print("Note: failed to enable realtime scheduling")
print "Note: failed to enable realtime scheduling"
# build graph
self.u = osmosdr.source(options.args)
@ -155,7 +155,7 @@ class my_top_block(gr.top_block):
try:
self.u.get_sample_rates().start()
except RuntimeError:
print("Source has no sample rates (wrong device arguments?).")
print "Source has no sample rates (wrong device arguments?)."
sys.exit(1)
# Set the antenna
@ -218,7 +218,7 @@ class my_top_block(gr.top_block):
options.gain = float(g.start()+g.stop())/2.0
self.set_gain(options.gain)
print("gain =", options.gain)
print "gain =", options.gain
def set_next_freq(self):
target_freq = self.next_freq
@ -227,7 +227,7 @@ class my_top_block(gr.top_block):
self.next_freq = self.min_center_freq
if not self.set_freq(target_freq):
print("Failed to set frequency to", target_freq)
print "Failed to set frequency to", target_freq
sys.exit(1)
return target_freq
@ -259,9 +259,9 @@ def main_loop(tb):
def bin_freq(i_bin, center_freq):
#hz_per_bin = tb.usrp_rate / tb.fft_size
freq = center_freq - (tb.usrp_rate / 2) + (tb.channel_bandwidth * i_bin)
#print("freq original:",freq)
#print "freq original:",freq
#freq = nearest_freq(freq, tb.channel_bandwidth)
#print("freq rounded:",freq)
#print "freq rounded:",freq
return freq
bin_start = int(tb.fft_size * ((1 - 0.75) / 2))
@ -287,7 +287,7 @@ def main_loop(tb):
power_db = 10*math.log10(m.data[i_bin]/tb.usrp_rate) - noise_floor_db
if (power_db > tb.squelch_threshold) and (freq >= tb.min_freq) and (freq <= tb.max_freq):
print(datetime.now(), "center_freq", center_freq, "freq", freq, "power_db", power_db, "noise_floor_db", noise_floor_db)
print datetime.now(), "center_freq", center_freq, "freq", freq, "power_db", power_db, "noise_floor_db", noise_floor_db
if __name__ == '__main__':
t = ThreadClass()

View File

@ -0,0 +1,138 @@
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
#
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
# parsing the arguments given to that macro or function.
# It processes the arguments and defines a set of variables which hold the
# values of the respective options.
#
# The <options> argument contains all options for the respective macro,
# i.e. keywords which can be used when calling the macro without any value
# following, like e.g. the OPTIONAL keyword of the install() command.
#
# The <one_value_keywords> argument contains all keywords for this macro
# which are followed by one value, like e.g. DESTINATION keyword of the
# install() command.
#
# The <multi_value_keywords> argument contains all keywords for this macro
# which can be followed by more than one value, like e.g. the TARGETS or
# FILES keywords of the install() command.
#
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
# keywords listed in <options>, <one_value_keywords> and
# <multi_value_keywords> a variable composed of the given <prefix>
# followed by "_" and the name of the respective keyword.
# These variables will then hold the respective value from the argument list.
# For the <options> keywords this will be TRUE or FALSE.
#
# All remaining arguments are collected in a variable
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
# your macro was called with unrecognized parameters.
#
# As an example here a my_install() macro, which takes similar arguments as the
# real install() command:
#
# function(MY_INSTALL)
# set(options OPTIONAL FAST)
# set(oneValueArgs DESTINATION RENAME)
# set(multiValueArgs TARGETS CONFIGURATIONS)
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
# ...
#
# Assume my_install() has been called like this:
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
#
# After the cmake_parse_arguments() call the macro will have set the following
# variables:
# MY_INSTALL_OPTIONAL = TRUE
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
# MY_INSTALL_DESTINATION = "bin"
# MY_INSTALL_RENAME = "" (was not used)
# MY_INSTALL_TARGETS = "foo;bar"
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
#
# You can the continue and process these variables.
#
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
# another recognized keyword follows, this is interpreted as the beginning of
# the new option.
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
return()
endif()
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
# first set all result variables to empty/FALSE
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
set(${prefix}_${arg_name})
endforeach(arg_name)
foreach(option ${_optionNames})
set(${prefix}_${option} FALSE)
endforeach(option)
set(${prefix}_UNPARSED_ARGUMENTS)
set(insideValues FALSE)
set(currentArgName)
# now iterate over all arguments and fill the result variables
foreach(currentArg ${ARGN})
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
if(insideValues)
if("${insideValues}" STREQUAL "SINGLE")
set(${prefix}_${currentArgName} ${currentArg})
set(insideValues FALSE)
elseif("${insideValues}" STREQUAL "MULTI")
list(APPEND ${prefix}_${currentArgName} ${currentArg})
endif()
else(insideValues)
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
endif(insideValues)
else()
if(NOT ${optionIndex} EQUAL -1)
set(${prefix}_${currentArg} TRUE)
set(insideValues FALSE)
elseif(NOT ${singleArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "SINGLE")
elseif(NOT ${multiArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "MULTI")
endif()
endif()
endforeach(currentArg)
# propagate the result variables to the caller:
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
endforeach(arg_name)
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)

View File

@ -0,0 +1,34 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_FCD gnuradio-fcd)
FIND_PATH(
GNURADIO_FCD_INCLUDE_DIRS
NAMES gnuradio/fcd/api.h
HINTS $ENV{GNURADIO_FCD_DIR}/include
${PC_GNURADIO_FCD_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GNURADIO_FCD_LIBRARIES
NAMES gnuradio-fcd
HINTS $ENV{GNURADIO_FCD_DIR}/lib
${PC_GNURADIO_FCD_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
if(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
set(GNURADIO_FCD_FOUND TRUE CACHE INTERNAL "gnuradio-fcd found")
message(STATUS "Found gnuradio-fcd: ${GNURADIO_FCD_INCLUDE_DIRS}, ${GNURADIO_FCD_LIBRARIES}")
else(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
set(GNURADIO_FCD_FOUND FALSE CACHE INTERNAL "gnuradio-fcd found")
message(STATUS "gnuradio-fcd not found.")
endif(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FCD DEFAULT_MSG GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS)

View File

@ -0,0 +1,34 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_FCDPP gnuradio-fcdproplus)
FIND_PATH(
GNURADIO_FCDPP_INCLUDE_DIRS
NAMES fcdproplus/api.h
HINTS $ENV{GNURADIO_FCDPP_DIR}/include
${PC_GNURADIO_FCDPP_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GNURADIO_FCDPP_LIBRARIES
NAMES gnuradio-fcdproplus
HINTS $ENV{GNURADIO_FCDPP_DIR}/lib
${PC_GNURADIO_FCDPP_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
if(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
set(GNURADIO_FCDPP_FOUND TRUE CACHE INTERNAL "gnuradio-fcdproplus found")
message(STATUS "Found gnuradio-fcdproplus: ${GNURADIO_FCDPP_INCLUDE_DIRS}, ${GNURADIO_FCDPP_LIBRARIES}")
else(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
set(GNURADIO_FCDPP_FOUND FALSE CACHE INTERNAL "gnuradio-fcdproplus found")
message(STATUS "gnuradio-fcdproplus not found.")
endif(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FCDPP DEFAULT_MSG GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS)

View File

@ -1,27 +0,0 @@
if(NOT GNURADIO_FUNCUBE_FOUND)
pkg_check_modules (GNURADIO_FUNCUBE_PKG libgnuradio-funcube)
find_path(GNURADIO_FUNCUBE_INCLUDE_DIRS NAMES funcube/api.h
PATHS
${GNURADIO_FUNCUBE_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(GNURADIO_FUNCUBE_LIBRARIES NAMES gnuradio-funcube
PATHS
${GNURADIO_FUNCUBE_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
set(GNURADIO_FUNCUBE_FOUND TRUE CACHE INTERNAL "gnuradio-funcube found")
message(STATUS "Found gnuradio-funcube: ${GNURADIO_FUNCUBE_INCLUDE_DIRS}, ${GNURADIO_FUNCUBE_LIBRARIES}")
else(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
set(GNURADIO_FUNCUBE_FOUND FALSE CACHE INTERNAL "gnuradio-funcube found")
message(STATUS "gnuradio-funcube not found.")
endif(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
mark_as_advanced(GNURADIO_FUNCUBE_LIBRARIES GNURADIO_FUNCUBE_INCLUDE_DIRS)
endif(NOT GNURADIO_FUNCUBE_FOUND)

View File

@ -0,0 +1,29 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_IQBALANCE gnuradio-iqbalance)
FIND_PATH(
GNURADIO_IQBALANCE_INCLUDE_DIRS
NAMES gnuradio/iqbalance/api.h
HINTS $ENV{GNURADIO_IQBALANCE_DIR}/include
${PC_GNURADIO_IQBALANCE_INCLUDEDIR}
${CMAKE_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GNURADIO_IQBALANCE_LIBRARIES
NAMES gnuradio-iqbalance
HINTS $ENV{GNURADIO_IQBALANCE_DIR}/lib
${PC_GNURADIO_IQBALANCE_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib64
${CMAKE_INSTALL_PREFIX}/lib
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_IQBALANCE DEFAULT_MSG GNURADIO_IQBALANCE_LIBRARIES GNURADIO_IQBALANCE_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_IQBALANCE_LIBRARIES GNURADIO_IQBALANCE_INCLUDE_DIRS)

View File

@ -0,0 +1,34 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_UHD gnuradio-uhd)
FIND_PATH(
GNURADIO_UHD_INCLUDE_DIRS
NAMES gnuradio/uhd/api.h
HINTS $ENV{GNURADIO_UHD_DIR}/include
${PC_GNURADIO_UHD_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GNURADIO_UHD_LIBRARIES
NAMES gnuradio-uhd
HINTS $ENV{GNURADIO_UHD_DIR}/lib
${PC_GNURADIO_UHD_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
if(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
set(GNURADIO_UHD_FOUND TRUE CACHE INTERNAL "gnuradio-uhd found")
message(STATUS "Found gnuradio-uhd: ${GNURADIO_UHD_INCLUDE_DIRS}, ${GNURADIO_UHD_LIBRARIES}")
else(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
set(GNURADIO_UHD_FOUND FALSE CACHE INTERNAL "gnuradio-uhd found")
message(STATUS "gnuradio-uhd not found.")
endif(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_UHD DEFAULT_MSG GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS)

View File

@ -1,6 +1,4 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBAIRSPY libairspy)
FIND_PATH(
@ -22,5 +20,5 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAIRSPY DEFAULT_MSG LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBAIRSPY DEFAULT_MSG LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)

View File

@ -1,26 +0,0 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
PKG_CHECK_MODULES(PC_LIBAIRSPYHF libairspyhf)
FIND_PATH(
LIBAIRSPYHF_INCLUDE_DIRS
NAMES libairspyhf/airspyhf.h
HINTS $ENV{LIBAIRSPYHF_DIR}/include
${PC_LIBAIRSPYHF_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
LIBAIRSPYHF_LIBRARIES
NAMES airspyhf
HINTS $ENV{LIBAIRSPYHF_DIR}/lib
${PC_LIBAIRSPYHF_LIBDIR}
PATHS /usr/local/lib
/usr/lib
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAIRSPYHF DEFAULT_MSG LIBAIRSPYHF_LIBRARIES LIBAIRSPYHF_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBAIRSPYHF_LIBRARIES LIBAIRSPYHF_INCLUDE_DIRS)

View File

@ -1,27 +0,0 @@
if(NOT LIBFREESRP_FOUND)
pkg_check_modules (LIBFREESRP_PKG libfreesrp)
find_path(LIBFREESRP_INCLUDE_DIRS NAMES freesrp.hpp
PATHS
${LIBFREESRP_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBFREESRP_LIBRARIES NAMES freesrp
PATHS
${LIBFREESRP_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBFREESRP_INCLUDE_DIRS AND LIBFREESRP_LIBRARIES)
set(LIBFREESRP_FOUND TRUE CACHE INTERNAL "libfreesrp found")
message(STATUS "Found libfreesrp: ${LIBFREESRP_INCLUDE_DIRS}, ${LIBFREESRP_LIBRARIES}")
else(LIBFREESRP_INCLUDE_DIRS AND LIBFREESRP_LIBRARIES)
set(LIBFREESRP_FOUND FALSE CACHE INTERNAL "libfreesrp found")
message(STATUS "libfreesrp not found.")
endif(LIBFREESRP_INCLUDE_DIRS AND LIBFREESRP_LIBRARIES)
mark_as_advanced(LIBFREESRP_LIBRARIES LIBFREESRP_INCLUDE_DIRS)
endif(NOT LIBFREESRP_FOUND)

View File

@ -1,6 +1,4 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBHACKRF libhackrf)
FIND_PATH(
@ -22,6 +20,5 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibHackRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)

View File

@ -0,0 +1,27 @@
if(NOT LIBMIRISDR_FOUND)
pkg_check_modules (LIBMIRISDR_PKG libmirisdr)
find_path(LIBMIRISDR_INCLUDE_DIRS NAMES mirisdr.h
PATHS
${LIBMIRISDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBMIRISDR_LIBRARIES NAMES mirisdr
PATHS
${LIBMIRISDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
set(LIBMIRISDR_FOUND TRUE CACHE INTERNAL "libmirisdr found")
message(STATUS "Found libmirisdr: ${LIBMIRISDR_INCLUDE_DIRS}, ${LIBMIRISDR_LIBRARIES}")
else(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
set(LIBMIRISDR_FOUND FALSE CACHE INTERNAL "libmirisdr found")
message(STATUS "libmirisdr not found.")
endif(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
mark_as_advanced(LIBMIRISDR_LIBRARIES LIBMIRISDR_INCLUDE_DIRS)
endif(NOT LIBMIRISDR_FOUND)

View File

@ -0,0 +1,27 @@
if(NOT LIBOSMOSDR_FOUND)
pkg_check_modules (LIBOSMOSDR_PKG libosmosdr)
find_path(LIBOSMOSDR_INCLUDE_DIRS NAMES osmosdr.h
PATHS
${LIBOSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
PATHS
${LIBOSMOSDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBOSMOSDR_INCLUDE_DIRS AND LIBOSMOSDR_LIBRARIES)
set(LIBOSMOSDR_FOUND TRUE CACHE INTERNAL "libosmosdr found")
message(STATUS "Found libosmosdr: ${LIBOSMOSDR_INCLUDE_DIRS}, ${LIBOSMOSDR_LIBRARIES}")
else(LIBOSMOSDR_INCLUDE_DIRS AND LIBOSMOSDR_LIBRARIES)
set(LIBOSMOSDR_FOUND FALSE CACHE INTERNAL "libosmosdr found")
message(STATUS "libosmosdr not found.")
endif(LIBOSMOSDR_INCLUDE_DIRS AND LIBOSMOSDR_LIBRARIES)
mark_as_advanced(LIBOSMOSDR_LIBRARIES LIBOSMOSDR_INCLUDE_DIRS)
endif(NOT LIBOSMOSDR_FOUND)

View File

@ -1,27 +0,0 @@
if(NOT LIBSDRPLAY_FOUND)
pkg_check_modules (LIBSDRPLAY_PKG libsdrplay)
find_path(LIBSDRPLAY_INCLUDE_DIRS NAMES mirsdrapi-rsp.h
PATHS
${LIBSDRPLAY_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBSDRPLAY_LIBRARIES NAMES mirsdrapi-rsp
PATHS
${LIBSDRPLAY_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
set(LIBSDRPLAY_FOUND TRUE CACHE INTERNAL "libsdrplay found")
message(STATUS "Found libsdrplay: ${LIBSDRPLAY_INCLUDE_DIRS}, ${LIBSDRPLAY_LIBRARIES}")
else(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
set(LIBSDRPLAY_FOUND FALSE CACHE INTERNAL "libsdrplay found")
message(STATUS "libsdrplay not found.")
endif(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES)
mark_as_advanced(LIBSDRPLAY_LIBRARIES LIBSDRPLAY_INCLUDE_DIRS)
endif(NOT LIBSDRPLAY_FOUND)

View File

@ -1,27 +0,0 @@
if(NOT LIBXTRX_FOUND)
pkg_check_modules (LIBXTRX_PKG libxtrx)
find_path(LIBXTRX_INCLUDE_DIRS NAMES xtrx_api.h
PATHS
${LIBXTRX_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBXTRX_LIBRARIES NAMES xtrx
PATHS
${LIBXTRX_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBXTRX_INCLUDE_DIRS AND LIBXTRX_LIBRARIES)
set(LIBXTRX_FOUND TRUE CACHE INTERNAL "libxtrx found")
message(STATUS "Found libxtrx: ${LIBXTRX_INCLUDE_DIRS}, ${LIBXTRX_LIBRARIES}")
else(LIBXTRX_INCLUDE_DIRS AND LIBXTRX_LIBRARIES)
set(LIBXTRX_FOUND FALSE CACHE INTERNAL "libxtrx found")
message(STATUS "libxtrx not found.")
endif(LIBXTRX_INCLUDE_DIRS AND LIBXTRX_LIBRARIES)
mark_as_advanced(LIBXTRX_LIBRARIES LIBXTRX_INCLUDE_DIRS)
endif(NOT LIBXTRX_FOUND)

View File

@ -1,9 +1,5 @@
if(NOT LIBBLADERF_FOUND)
pkg_check_modules (LIBBLADERF_PKG libbladeRF)
if (LIBBLADERF_PKG_FOUND AND LIBBLADERF_PKG_VERSION VERSION_LESS "2")
message( FATAL_ERROR "Install version 2 or greater of libbladeRF."
" Current version ( ${LIBBLADERF_PKG_VERSION} ) is out of date." )
endif()
find_path(LIBBLADERF_INCLUDE_DIRS NAMES libbladeRF.h
PATHS
${LIBBLADERF_PKG_INCLUDE_DIRS}

View File

@ -0,0 +1,115 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_COMPONENT_CMAKE)
return()
endif()
set(__INCLUDED_GR_COMPONENT_CMAKE TRUE)
set(_gr_enabled_components "" CACHE INTERNAL "" FORCE)
set(_gr_disabled_components "" CACHE INTERNAL "" FORCE)
if(NOT DEFINED ENABLE_DEFAULT)
set(ENABLE_DEFAULT ON)
message(STATUS "")
message(STATUS "The build system will automatically enable all components.")
message(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.")
endif()
########################################################################
# Register a component into the system
# - name: canonical component name
# - var: variable for enabled status
# - argn: list of dependencies
########################################################################
function(GR_REGISTER_COMPONENT name var)
include(CMakeDependentOption)
message(STATUS "")
message(STATUS "Configuring ${name} support...")
foreach(dep ${ARGN})
message(STATUS " Dependency ${dep} = ${${dep}}")
endforeach(dep)
#if the user set the var to force, we note this
if("${${var}}" STREQUAL "FORCE")
set(${var} ON)
set(var_force TRUE)
else()
set(var_force FALSE)
endif()
#rewrite the dependency list so that deps that are also components use the cached version
unset(comp_deps)
foreach(dep ${ARGN})
list(FIND _gr_enabled_components ${dep} dep_enb_index)
list(FIND _gr_disabled_components ${dep} dep_dis_index)
if (${dep_enb_index} EQUAL -1 AND ${dep_dis_index} EQUAL -1)
list(APPEND comp_deps ${dep})
else()
list(APPEND comp_deps ${dep}_cached) #is a component, use cached version
endif()
endforeach(dep)
#setup the dependent option for this component
CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ENABLE_DEFAULT} "${comp_deps}" OFF)
set(${var} "${${var}}" PARENT_SCOPE)
set(${var}_cached "${${var}}" CACHE INTERNAL "" FORCE)
#force was specified, but the dependencies were not met
if(NOT ${var} AND var_force)
message(FATAL_ERROR "user force-enabled ${name} but configuration checked failed")
endif()
#append the component into one of the lists
if(${var})
message(STATUS " Enabling ${name} support.")
list(APPEND _gr_enabled_components ${name})
else(${var})
message(STATUS " Disabling ${name} support.")
list(APPEND _gr_disabled_components ${name})
endif(${var})
message(STATUS " Override with -D${var}=ON/OFF")
#make components lists into global variables
set(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE)
set(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE)
endfunction(GR_REGISTER_COMPONENT)
########################################################################
# Print the registered component summary
########################################################################
function(GR_PRINT_COMPONENT_SUMMARY)
message(STATUS "")
message(STATUS "######################################################")
message(STATUS "# gr-osmosdr enabled components ")
message(STATUS "######################################################")
foreach(comp ${_gr_enabled_components})
message(STATUS " * ${comp}")
endforeach(comp)
message(STATUS "")
message(STATUS "######################################################")
message(STATUS "# gr-osmosdr disabled components ")
message(STATUS "######################################################")
foreach(comp ${_gr_disabled_components})
message(STATUS " * ${comp}")
endforeach(comp)
message(STATUS "")
endfunction(GR_PRINT_COMPONENT_SUMMARY)

View File

@ -0,0 +1,347 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
return()
endif()
set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
########################################################################
# Set global variable macro.
# Used for subdirectories to export settings.
# Example: include and library paths.
########################################################################
function(GR_SET_GLOBAL var)
set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
endfunction(GR_SET_GLOBAL)
########################################################################
# Set the pre-processor definition if the condition is true.
# - def the pre-processor definition to set and condition name
########################################################################
function(GR_ADD_COND_DEF def)
if(${def})
add_definitions(-D${def})
endif(${def})
endfunction(GR_ADD_COND_DEF)
########################################################################
# Check for a header and conditionally set a compile define.
# - hdr the relative path to the header file
# - def the pre-processor definition to set
########################################################################
function(GR_CHECK_HDR_N_DEF hdr def)
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
GR_ADD_COND_DEF(${def})
endfunction(GR_CHECK_HDR_N_DEF)
########################################################################
# Include subdirectory macro.
# Sets the CMake directory variables,
# includes the subdirectory CMakeLists.txt,
# resets the CMake directory variables.
#
# This macro includes subdirectories rather than adding them
# so that the subdirectory can affect variables in the level above.
# This provides a work-around for the lack of convenience libraries.
# This way a subdirectory can append to the list of library sources.
########################################################################
macro(GR_INCLUDE_SUBDIRECTORY subdir)
#insert the current directories on the front of the list
list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
#set the current directories to the names of the subdirs
set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
#include the subdirectory CMakeLists to run it
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
#reset the value of the current directories
list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
#pop the subdir names of the front of the list
list(REMOVE_AT _cmake_source_dirs 0)
list(REMOVE_AT _cmake_binary_dirs 0)
endmacro(GR_INCLUDE_SUBDIRECTORY)
########################################################################
# Check if a compiler flag works and conditionally set a compile define.
# - flag the compiler flag to check for
# - have the variable to set with result
########################################################################
macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(${flag} ${have})
if(${have})
add_definitions(${flag})
endif(${have})
endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
########################################################################
# Generates the .la libtool file
# This appears to generate libtool files that cannot be used by auto*.
# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
# Notice: there is not COMPONENT option, these will not get distributed.
########################################################################
function(GR_LIBTOOL)
if(NOT DEFINED GENERATE_LIBTOOL)
set(GENERATE_LIBTOOL OFF) #disabled by default
endif()
if(GENERATE_LIBTOOL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
find_program(LIBTOOL libtool)
if(LIBTOOL)
include(CMakeMacroLibtoolFile)
CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
endif(LIBTOOL)
endif(GENERATE_LIBTOOL)
endfunction(GR_LIBTOOL)
########################################################################
# Do standard things to the library target
# - set target properties
# - make install rules
# Also handle gnuradio custom naming conventions w/ extras mode.
########################################################################
function(GR_LIBRARY_FOO target)
#parse the arguments for component names
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
#set additional target properties
set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
#install the generated files like so...
install(TARGETS ${target}
LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
)
#extras mode enabled automatically on linux
if(NOT DEFINED LIBRARY_EXTRAS)
set(LIBRARY_EXTRAS ${LINUX})
endif()
#special extras mode to enable alternative naming conventions
if(LIBRARY_EXTRAS)
#create .la file before changing props
GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
#give the library a special name with ultra-zero soversion
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
set(target_name lib${target}-${LIBVER}.so.0.0.0)
#custom command to generate symlinks
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
)
#and install the extra symlinks
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
)
endif(LIBRARY_EXTRAS)
endfunction(GR_LIBRARY_FOO)
########################################################################
# Create a dummy custom command that depends on other targets.
# Usage:
# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
#
# Custom command cant depend on targets, but can depend on executables,
# and executables can depend on targets. So this is the process:
########################################################################
function(GR_GEN_TARGET_DEPS name var)
file(
WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
"int main(void){return 0;}\n"
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
)
add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
if(ARGN)
add_dependencies(${name} ${ARGN})
endif(ARGN)
if(CMAKE_CROSSCOMPILING)
set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
else()
set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
endif()
endfunction(GR_GEN_TARGET_DEPS)
########################################################################
# Control use of gr_logger
# Usage:
# GR_LOGGING()
#
# Will set ENABLE_GR_LOG to 1 by default.
# Can manually set with -DENABLE_GR_LOG=0|1
########################################################################
function(GR_LOGGING)
find_package(Log4cpp)
OPTION(ENABLE_GR_LOG "Use gr_logger" ON)
if(ENABLE_GR_LOG)
# If gr_logger is enabled, make it usable
add_definitions( -DENABLE_GR_LOG )
# also test LOG4CPP; if we have it, use this version of the logger
# otherwise, default to the stdout/stderr model.
if(LOG4CPP_FOUND)
SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE)
add_definitions( -DHAVE_LOG4CPP )
else(not LOG4CPP_FOUND)
SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE)
SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
endif(LOG4CPP_FOUND)
SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE)
else(ENABLE_GR_LOG)
SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE)
SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE)
SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE)
SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE)
endif(ENABLE_GR_LOG)
message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.")
message(STATUS "HAVE_LOG4CPP set to ${HAVE_LOG4CPP}.")
message(STATUS "LOG4CPP_LIBRARIES set to ${LOG4CPP_LIBRARIES}.")
endfunction(GR_LOGGING)
########################################################################
# Run GRCC to compile .grc files into .py files.
#
# Usage: GRCC(filename, directory)
# - filenames: List of file name of .grc file
# - directory: directory of built .py file - usually in
# ${CMAKE_CURRENT_BINARY_DIR}
# - Sets PYFILES: output converted GRC file names to Python files.
########################################################################
function(GRCC)
# Extract directory from list of args, remove it for the list of filenames.
list(GET ARGV -1 directory)
list(REMOVE_AT ARGV -1)
set(filenames ${ARGV})
file(MAKE_DIRECTORY ${directory})
SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc)
# GRCC uses some stuff in grc and gnuradio-runtime, so we force
# the known paths here
list(APPEND PYTHONPATHS
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/gnuradio-runtime/python
${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/swig
${CMAKE_BINARY_DIR}/gnuradio-runtime/lib/swig
)
if(WIN32)
#SWIG generates the python library files into a subdirectory.
#Therefore, we must append this subdirectory into PYTHONPATH.
#Only do this for the python directories matching the following:
foreach(pydir ${PYTHONPATHS})
get_filename_component(name ${pydir} NAME)
if(name MATCHES "^(swig|lib|src)$")
list(APPEND PYTHONPATHS ${pydir}/${CMAKE_BUILD_TYPE})
endif()
endforeach(pydir)
endif(WIN32)
file(TO_NATIVE_PATH "${PYTHONPATHS}" pypath)
if(UNIX)
list(APPEND pypath "$PYTHONPATH")
string(REPLACE ";" ":" pypath "${pypath}")
set(ENV{PYTHONPATH} ${pypath})
endif(UNIX)
if(WIN32)
list(APPEND pypath "%PYTHONPATH%")
string(REPLACE ";" "\\;" pypath "${pypath}")
#list(APPEND environs "PYTHONPATH=${pypath}")
set(ENV{PYTHONPATH} ${pypath})
endif(WIN32)
foreach(f ${filenames})
execute_process(
COMMAND ${GRCC_COMMAND} -d ${directory} ${f}
)
string(REPLACE ".grc" ".py" pyfile "${f}")
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" pyfile "${pyfile}")
list(APPEND pyfiles ${pyfile})
endforeach(f)
set(PYFILES ${pyfiles} PARENT_SCOPE)
endfunction(GRCC)
########################################################################
# Check if HAVE_PTHREAD_SETSCHEDPARAM and HAVE_SCHED_SETSCHEDULER
# should be defined
########################################################################
macro(GR_CHECK_LINUX_SCHED_AVAIL)
set(CMAKE_REQUIRED_LIBRARIES -lpthread)
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
pthread_t pthread;
pthread_setschedparam(pthread, 0, 0);
return 0;
} " HAVE_PTHREAD_SETSCHEDPARAM
)
GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main(){
pid_t pid;
sched_setscheduler(pid, 0, 0);
return 0;
} " HAVE_SCHED_SETSCHEDULER
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)

View File

@ -0,0 +1,54 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
return()
endif()
set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
########################################################################
# Setup additional defines for OS types
########################################################################
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(LINUX TRUE)
endif()
if(LINUX AND EXISTS "/etc/debian_version")
set(DEBIAN TRUE)
endif()
if(LINUX AND EXISTS "/etc/redhat-release")
set(REDHAT TRUE)
endif()
if(LINUX AND EXISTS "/etc/slackware-version")
set(SLACKWARE TRUE)
endif()
########################################################################
# when the library suffix should be 64 (applies to redhat linux family)
########################################################################
if (REDHAT OR SLACKWARE)
set(LIB64_CONVENTION TRUE)
endif()
if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
set(LIB_SUFFIX 64)
endif()
set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")

View File

@ -0,0 +1,241 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
return()
endif()
set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
########################################################################
# Setup the python interpreter:
# This allows the user to specify a specific interpreter,
# or finds the interpreter via the built-in cmake module.
########################################################################
#this allows the user to override PYTHON_EXECUTABLE
if(PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND TRUE)
#otherwise if not set, try to automatically find it
else(PYTHON_EXECUTABLE)
#use the built-in find script
find_package(PythonInterp 2)
#and if that fails use the find program routine
if(NOT PYTHONINTERP_FOUND)
find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
if(PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND TRUE)
endif(PYTHON_EXECUTABLE)
endif(NOT PYTHONINTERP_FOUND)
endif(PYTHON_EXECUTABLE)
if (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE "/usr/bin/python")
else (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
endif(CMAKE_CROSSCOMPILING)
#make the path to the executable appear in the cmake gui
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests")
#make sure we can use -B with python (introduced in 2.6)
if(PYTHON_EXECUTABLE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -B -c ""
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
)
if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
set(PYTHON_DASH_B "-B")
endif()
endif(PYTHON_EXECUTABLE)
########################################################################
# Check for the existence of a python module:
# - desc a string description of the check
# - mod the name of the module to import
# - cmd an additional command to run
# - have the result variable to set
########################################################################
macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
message(STATUS "")
message(STATUS "Python checking for ${desc}")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "
#########################################
try:
import ${mod}
assert ${cmd}
except ImportError, AssertionError: exit(-1)
except: pass
#########################################"
RESULT_VARIABLE ${have}
)
if(${have} EQUAL 0)
message(STATUS "Python checking for ${desc} - found")
set(${have} TRUE)
else(${have} EQUAL 0)
message(STATUS "Python checking for ${desc} - not found")
set(${have} FALSE)
endif(${have} EQUAL 0)
endmacro(GR_PYTHON_CHECK_MODULE)
########################################################################
# Sets the python installation directory GR_PYTHON_DIR
########################################################################
if(NOT DEFINED GR_PYTHON_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
from distutils import sysconfig
print sysconfig.get_python_lib(plat_specific=True, prefix='')
" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
########################################################################
# Create an always-built target with a unique name
# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
########################################################################
function(GR_UNIQUE_TARGET desc)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
endfunction(GR_UNIQUE_TARGET)
########################################################################
# Install python sources (also builds and installs byte-compiled python)
########################################################################
function(GR_PYTHON_INSTALL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
####################################################################
if(GR_PYTHON_INSTALL_FILES)
####################################################################
install(${ARGN}) #installs regular python files
#create a list of all generated files
unset(pysrcfiles)
unset(pycfiles)
unset(pyofiles)
foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
get_filename_component(pyfile ${pyfile} ABSOLUTE)
list(APPEND pysrcfiles ${pyfile})
#determine if this file is in the source or binary directory
file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
string(LENGTH "${source_rel_path}" source_rel_path_len)
file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
string(LENGTH "${binary_rel_path}" binary_rel_path_len)
#and set the generated path appropriately
if(${source_rel_path_len} GREATER ${binary_rel_path_len})
set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
else()
set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
endif()
list(APPEND pycfiles ${pygenfile}c)
list(APPEND pyofiles ${pygenfile}o)
#ensure generation path exists
get_filename_component(pygen_path ${pygenfile} PATH)
file(MAKE_DIRECTORY ${pygen_path})
endforeach(pyfile)
#the command to generate the pyc files
add_custom_command(
DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
)
#the command to generate the pyo files
add_custom_command(
DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
)
#create install rule and add generated files to target list
set(python_install_gen_targets ${pycfiles} ${pyofiles})
install(FILES ${python_install_gen_targets}
DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
)
####################################################################
elseif(GR_PYTHON_INSTALL_PROGRAMS)
####################################################################
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
if (CMAKE_CROSSCOMPILING)
set(pyexe_native /usr/bin/env python)
endif()
foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
get_filename_component(pyfile_name ${pyfile} NAME)
get_filename_component(pyfile ${pyfile} ABSOLUTE)
string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
list(APPEND python_install_gen_targets ${pyexefile})
get_filename_component(pyexefile_path ${pyexefile} PATH)
file(MAKE_DIRECTORY ${pyexefile_path})
add_custom_command(
OUTPUT ${pyexefile} DEPENDS ${pyfile}
COMMAND ${PYTHON_EXECUTABLE} -c
\"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
COMMENT "Shebangin ${pyfile_name}"
)
#on windows, python files need an extension to execute
get_filename_component(pyfile_ext ${pyfile} EXT)
if(WIN32 AND NOT pyfile_ext)
set(pyfile_name "${pyfile_name}.py")
endif()
install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
)
endforeach(pyfile)
endif()
GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
endfunction(GR_PYTHON_INSTALL)
########################################################################
# Write the python helper script that generates byte code files
########################################################################
file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
import sys, py_compile
files = sys.argv[1:]
srcs, gens = files[:len(files)/2], files[len(files)/2:]
for src, gen in zip(srcs, gens):
py_compile.compile(file=src, cfile=gen, doraise=True)
")

248
cmake/Modules/GrSwig.cmake Normal file
View File

@ -0,0 +1,248 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
return()
endif()
set(__INCLUDED_GR_SWIG_CMAKE TRUE)
include(GrPython)
########################################################################
# Builds a swig documentation file to be generated into python docstrings
# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
#
# Set the following variable to specify extra dependent targets:
# - GR_SWIG_DOCS_SOURCE_DEPS
# - GR_SWIG_DOCS_TARGET_DEPS
########################################################################
function(GR_SWIG_MAKE_DOCS output_file)
if(ENABLE_DOXYGEN)
#setup the input files variable list, quote formated
set(input_files)
unset(INPUT_PATHS)
foreach(input_path ${ARGN})
if (IS_DIRECTORY ${input_path}) #when input path is a directory
file(GLOB input_path_h_files ${input_path}/*.h)
else() #otherwise its just a file, no glob
set(input_path_h_files ${input_path})
endif()
list(APPEND input_files ${input_path_h_files})
set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
endforeach(input_path)
#determine the output directory
get_filename_component(name ${output_file} NAME_WE)
get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
make_directory(${OUTPUT_DIRECTORY})
#generate the Doxyfile used by doxygen
configure_file(
${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
${OUTPUT_DIRECTORY}/Doxyfile
@ONLY)
#Create a dummy custom command that depends on other targets
include(GrMiscUtils)
GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
#call doxygen on the Doxyfile + input headers
add_custom_command(
OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
COMMENT "Generating doxygen xml for ${name} docs"
)
#call the swig_doc script on the xml files
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
${OUTPUT_DIRECTORY}/xml
${output_file}
COMMENT "Generating python docstrings for ${name}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
)
else(ENABLE_DOXYGEN)
file(WRITE ${output_file} "\n") #no doxygen -> empty file
endif(ENABLE_DOXYGEN)
endfunction(GR_SWIG_MAKE_DOCS)
########################################################################
# Build a swig target for the common gnuradio use case. Usage:
# GR_SWIG_MAKE(target ifile ifile ifile...)
#
# Set the following variables before calling:
# - GR_SWIG_FLAGS
# - GR_SWIG_INCLUDE_DIRS
# - GR_SWIG_LIBRARIES
# - GR_SWIG_SOURCE_DEPS
# - GR_SWIG_TARGET_DEPS
# - GR_SWIG_DOC_FILE
# - GR_SWIG_DOC_DIRS
########################################################################
macro(GR_SWIG_MAKE name)
set(ifiles ${ARGN})
# Shimming this in here to take care of a SWIG bug with handling
# vector<size_t> and vector<unsigned int> (on 32-bit machines) and
# vector<long unsigned int> (on 64-bit machines). Use this to test
# the size of size_t, then set SIZE_T_32 if it's a 32-bit machine
# or not if it's 64-bit. The logic in gr_type.i handles the rest.
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
if(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
list(APPEND GR_SWIG_FLAGS -DSIZE_T_32)
endif(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
#do swig doc generation if specified
if (GR_SWIG_DOC_FILE)
set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
list(APPEND GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc ${GR_RUNTIME_SWIG_DOC_FILE})
endif()
#append additional include directories
find_package(PythonLibs 2)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
#prepend local swig directories
list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_SOURCE_DIR})
list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_BINARY_DIR})
#determine include dependencies for swig file
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_BINARY_DIR}/get_swig_deps.py
"${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
#Create a dummy custom command that depends on other targets
include(GrMiscUtils)
GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
add_custom_command(
OUTPUT ${tag_file}
DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
)
#append the specified include directories
include_directories(${GR_SWIG_INCLUDE_DIRS})
list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
#setup the swig flags with flags and include directories
set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
foreach(dir ${GR_SWIG_INCLUDE_DIRS})
list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
endforeach(dir)
#set the C++ property on the swig .i file so it builds
set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
#setup the actual swig library target to be built
include(UseSWIG)
SWIG_ADD_MODULE(${name} python ${ifiles})
SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
endmacro(GR_SWIG_MAKE)
########################################################################
# Install swig targets generated by GR_SWIG_MAKE. Usage:
# GR_SWIG_INSTALL(
# TARGETS target target target...
# [DESTINATION destination]
# [COMPONENT component]
# )
########################################################################
macro(GR_SWIG_INSTALL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
foreach(name ${GR_SWIG_INSTALL_TARGETS})
install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
)
include(GrPython)
GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
)
GR_LIBTOOL(
TARGET ${SWIG_MODULE_${name}_REAL_NAME}
DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
)
endforeach(name)
endmacro(GR_SWIG_INSTALL)
########################################################################
# Generate a python file that can determine swig dependencies.
# Used by the make macro above to determine extra dependencies.
# When you build C++, CMake figures out the header dependencies.
# This code essentially performs that logic for swig includes.
########################################################################
file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
import os, sys, re
i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
include_dirs = sys.argv[2].split(';')
def get_swig_incs(file_path):
if file_path.endswith('.i'): matcher = i_include_matcher
else: matcher = h_include_matcher
file_contents = open(file_path, 'r').read()
return matcher.findall(file_contents, re.MULTILINE)
def get_swig_deps(file_path, level):
deps = [file_path]
if level == 0: return deps
for keyword, inc_file in get_swig_incs(file_path):
for inc_dir in include_dirs:
inc_path = os.path.join(inc_dir, inc_file)
if not os.path.exists(inc_path): continue
deps.extend(get_swig_deps(inc_path, level-1))
break #found, we dont search in lower prio inc dirs
return deps
if __name__ == '__main__':
ifiles = sys.argv[1].split(';')
deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
#sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
print(';'.join(set(deps)))
")

143
cmake/Modules/GrTest.cmake Normal file
View File

@ -0,0 +1,143 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_TEST_CMAKE)
return()
endif()
set(__INCLUDED_GR_TEST_CMAKE TRUE)
########################################################################
# Add a unit test and setup the environment for a unit test.
# Takes the same arguments as the ADD_TEST function.
#
# Before calling set the following variables:
# GR_TEST_TARGET_DEPS - built targets for the library path
# GR_TEST_LIBRARY_DIRS - directories for the library path
# GR_TEST_PYTHON_DIRS - directories for the python path
# GR_TEST_ENVIRONS - other environment key/value pairs
########################################################################
function(GR_ADD_TEST test_name)
#Ensure that the build exe also appears in the PATH.
list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
#In the land of windows, all libraries must be in the PATH.
#Since the dependent libraries are not yet installed,
#we must manually set them in the PATH to run tests.
#The following appends the path of a target dependency.
foreach(target ${GR_TEST_TARGET_DEPS})
get_target_property(location ${target} LOCATION)
if(location)
get_filename_component(path ${location} PATH)
string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
list(APPEND GR_TEST_LIBRARY_DIRS ${path})
endif(location)
endforeach(target)
if(WIN32)
#SWIG generates the python library files into a subdirectory.
#Therefore, we must append this subdirectory into PYTHONPATH.
#Only do this for the python directories matching the following:
foreach(pydir ${GR_TEST_PYTHON_DIRS})
get_filename_component(name ${pydir} NAME)
if(name MATCHES "^(swig|lib|src)$")
list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
endif()
endforeach(pydir)
endif(WIN32)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
list(APPEND environs ${GR_TEST_ENVIRONS})
#http://www.cmake.org/pipermail/cmake/2009-May/029464.html
#Replaced this add test + set environs code with the shell script generation.
#Its nicer to be able to manually run the shell script to diagnose problems.
#ADD_TEST(${ARGV})
#SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
if(UNIX)
set(LD_PATH_VAR "LD_LIBRARY_PATH")
if(APPLE)
set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
endif()
set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
list(APPEND libpath "$${LD_PATH_VAR}")
list(APPEND pypath "$PYTHONPATH")
#replace list separator with the path separator
string(REPLACE ";" ":" libpath "${libpath}")
string(REPLACE ";" ":" pypath "${pypath}")
list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
#generate a bat file that sets the environment and runs the test
if (CMAKE_CROSSCOMPILING)
set(SHELL "/bin/sh")
else(CMAKE_CROSSCOMPILING)
find_program(SHELL sh)
endif(CMAKE_CROSSCOMPILING)
set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
file(WRITE ${sh_file} "#!${SHELL}\n")
#each line sets an environment variable
foreach(environ ${environs})
file(APPEND ${sh_file} "export ${environ}\n")
endforeach(environ)
#load the command to run with its arguments
foreach(arg ${ARGN})
file(APPEND ${sh_file} "${arg} ")
endforeach(arg)
file(APPEND ${sh_file} "\n")
#make the shell file executable
execute_process(COMMAND chmod +x ${sh_file})
add_test(${test_name} ${SHELL} ${sh_file})
endif(UNIX)
if(WIN32)
list(APPEND libpath ${DLL_PATHS} "%PATH%")
list(APPEND pypath "%PYTHONPATH%")
#replace list separator with the path separator (escaped)
string(REPLACE ";" "\\;" libpath "${libpath}")
string(REPLACE ";" "\\;" pypath "${pypath}")
list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
#generate a bat file that sets the environment and runs the test
set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
file(WRITE ${bat_file} "@echo off\n")
#each line sets an environment variable
foreach(environ ${environs})
file(APPEND ${bat_file} "SET ${environ}\n")
endforeach(environ)
#load the command to run with its arguments
foreach(arg ${ARGN})
file(APPEND ${bat_file} "${arg} ")
endforeach(arg)
file(APPEND ${bat_file} "\n")
add_test(${test_name} ${bat_file})
endif(WIN32)
endfunction(GR_ADD_TEST)

View File

@ -0,0 +1,82 @@
# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_VERSION_CMAKE)
return()
endif()
set(__INCLUDED_GR_VERSION_CMAKE TRUE)
#eventually, replace version.sh and fill in the variables below
set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION})
set(API_COMPAT ${VERSION_INFO_API_COMPAT})
set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION})
set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION})
########################################################################
# Extract the version string from git describe.
########################################################################
find_package(Git)
if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
message(STATUS "Extracting version information from git describe...")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
else()
set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
endif()
########################################################################
# Use the logic below to set the version constants
########################################################################
if("${MINOR_VERSION}" STREQUAL "git")
# VERSION: 3.3git-xxx-gxxxxxxxx
# DOCVER: 3.3git
# LIBVER: 3.3git
set(VERSION "${GIT_DESCRIBE}")
set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
set(RC_MINOR_VERSION "0")
set(RC_MAINT_VERSION "0")
elseif("${MAINT_VERSION}" STREQUAL "git")
# VERSION: 3.3.1git-xxx-gxxxxxxxx
# DOCVER: 3.3.1git
# LIBVER: 3.3.1git
set(VERSION "${GIT_DESCRIBE}")
set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
math(EXPR RC_MINOR_VERSION "${MINOR_VERSION} - 1")
set(RC_MAINT_VERSION "0")
else()
# This is a numbered release.
# VERSION: 3.3.1{.x}
# DOCVER: 3.3.1{.x}
# LIBVER: 3.3.1{.x}
if("${MAINT_VERSION}" STREQUAL "0")
set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}")
else()
set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}")
endif()
set(DOCVER "${VERSION}")
set(LIBVER "${VERSION}")
set(RC_MINOR_VERSION ${MINOR_VERSION})
set(RC_MAINT_VERSION ${MAINT_VERSION})
endif()

View File

@ -1,26 +0,0 @@
# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
include(CMakeFindDependencyMacro)
set(target_deps "@TARGET_DEPENDENCIES@")
foreach(dep IN LISTS target_deps)
find_dependency(${dep})
endforeach()
include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")

58
cmake/msvc/config.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_CONFIG_H_ // [
#define _MSC_CONFIG_H_
////////////////////////////////////////////////////////////////////////
// enable inline functions for C code
////////////////////////////////////////////////////////////////////////
#ifndef __cplusplus
# define inline __inline
#endif
////////////////////////////////////////////////////////////////////////
// signed size_t
////////////////////////////////////////////////////////////////////////
#include <stddef.h>
typedef ptrdiff_t ssize_t;
////////////////////////////////////////////////////////////////////////
// rint functions
////////////////////////////////////////////////////////////////////////
#include <math.h>
static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);}
static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);}
////////////////////////////////////////////////////////////////////////
// math constants
////////////////////////////////////////////////////////////////////////
#define INFINITY HUGE_VAL
# define M_E 2.7182818284590452354 /* e */
# define M_LOG2E 1.4426950408889634074 /* log_2 e */
# define M_LOG10E 0.43429448190325182765 /* log_10 e */
# define M_LN2 0.69314718055994530942 /* log_e 2 */
# define M_LN10 2.30258509299404568402 /* log_e 10 */
# define M_PI 3.14159265358979323846 /* pi */
# define M_PI_2 1.57079632679489661923 /* pi/2 */
# define M_PI_4 0.78539816339744830962 /* pi/4 */
# define M_1_PI 0.31830988618379067154 /* 1/pi */
# define M_2_PI 0.63661977236758134308 /* 2/pi */
# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
////////////////////////////////////////////////////////////////////////
// random and srandom
////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
static inline long int random (void) { return rand(); }
static inline void srandom (unsigned int seed) { srand(seed); }
#endif // _MSC_CONFIG_H_ ]

301
cmake/msvc/inttypes.h Normal file
View File

@ -0,0 +1,301 @@
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <stdint.h>
// 7.8 Format conversion of integer types
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
// 7.8.1 Macros for format specifiers
// The fprintf macros for signed integers are:
#define PRId8 "d"
#define PRIi8 "i"
#define PRIdLEAST8 "d"
#define PRIiLEAST8 "i"
#define PRIdFAST8 "d"
#define PRIiFAST8 "i"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIdLEAST16 "hd"
#define PRIiLEAST16 "hi"
#define PRIdFAST16 "hd"
#define PRIiFAST16 "hi"
#define PRId32 "I32d"
#define PRIi32 "I32i"
#define PRIdLEAST32 "I32d"
#define PRIiLEAST32 "I32i"
#define PRIdFAST32 "I32d"
#define PRIiFAST32 "I32i"
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIdLEAST64 "I64d"
#define PRIiLEAST64 "I64i"
#define PRIdFAST64 "I64d"
#define PRIiFAST64 "I64i"
#define PRIdMAX "I64d"
#define PRIiMAX "I64i"
#define PRIdPTR "Id"
#define PRIiPTR "Ii"
// The fprintf macros for unsigned integers are:
#define PRIo8 "o"
#define PRIu8 "u"
#define PRIx8 "x"
#define PRIX8 "X"
#define PRIoLEAST8 "o"
#define PRIuLEAST8 "u"
#define PRIxLEAST8 "x"
#define PRIXLEAST8 "X"
#define PRIoFAST8 "o"
#define PRIuFAST8 "u"
#define PRIxFAST8 "x"
#define PRIXFAST8 "X"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRIoLEAST16 "ho"
#define PRIuLEAST16 "hu"
#define PRIxLEAST16 "hx"
#define PRIXLEAST16 "hX"
#define PRIoFAST16 "ho"
#define PRIuFAST16 "hu"
#define PRIxFAST16 "hx"
#define PRIXFAST16 "hX"
#define PRIo32 "I32o"
#define PRIu32 "I32u"
#define PRIx32 "I32x"
#define PRIX32 "I32X"
#define PRIoLEAST32 "I32o"
#define PRIuLEAST32 "I32u"
#define PRIxLEAST32 "I32x"
#define PRIXLEAST32 "I32X"
#define PRIoFAST32 "I32o"
#define PRIuFAST32 "I32u"
#define PRIxFAST32 "I32x"
#define PRIXFAST32 "I32X"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRIoLEAST64 "I64o"
#define PRIuLEAST64 "I64u"
#define PRIxLEAST64 "I64x"
#define PRIXLEAST64 "I64X"
#define PRIoFAST64 "I64o"
#define PRIuFAST64 "I64u"
#define PRIxFAST64 "I64x"
#define PRIXFAST64 "I64X"
#define PRIoMAX "I64o"
#define PRIuMAX "I64u"
#define PRIxMAX "I64x"
#define PRIXMAX "I64X"
#define PRIoPTR "Io"
#define PRIuPTR "Iu"
#define PRIxPTR "Ix"
#define PRIXPTR "IX"
// The fscanf macros for signed integers are:
#define SCNd8 "d"
#define SCNi8 "i"
#define SCNdLEAST8 "d"
#define SCNiLEAST8 "i"
#define SCNdFAST8 "d"
#define SCNiFAST8 "i"
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNdLEAST16 "hd"
#define SCNiLEAST16 "hi"
#define SCNdFAST16 "hd"
#define SCNiFAST16 "hi"
#define SCNd32 "ld"
#define SCNi32 "li"
#define SCNdLEAST32 "ld"
#define SCNiLEAST32 "li"
#define SCNdFAST32 "ld"
#define SCNiFAST32 "li"
#define SCNd64 "I64d"
#define SCNi64 "I64i"
#define SCNdLEAST64 "I64d"
#define SCNiLEAST64 "I64i"
#define SCNdFAST64 "I64d"
#define SCNiFAST64 "I64i"
#define SCNdMAX "I64d"
#define SCNiMAX "I64i"
#ifdef _WIN64 // [
# define SCNdPTR "I64d"
# define SCNiPTR "I64i"
#else // _WIN64 ][
# define SCNdPTR "ld"
# define SCNiPTR "li"
#endif // _WIN64 ]
// The fscanf macros for unsigned integers are:
#define SCNo8 "o"
#define SCNu8 "u"
#define SCNx8 "x"
#define SCNX8 "X"
#define SCNoLEAST8 "o"
#define SCNuLEAST8 "u"
#define SCNxLEAST8 "x"
#define SCNXLEAST8 "X"
#define SCNoFAST8 "o"
#define SCNuFAST8 "u"
#define SCNxFAST8 "x"
#define SCNXFAST8 "X"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNX16 "hX"
#define SCNoLEAST16 "ho"
#define SCNuLEAST16 "hu"
#define SCNxLEAST16 "hx"
#define SCNXLEAST16 "hX"
#define SCNoFAST16 "ho"
#define SCNuFAST16 "hu"
#define SCNxFAST16 "hx"
#define SCNXFAST16 "hX"
#define SCNo32 "lo"
#define SCNu32 "lu"
#define SCNx32 "lx"
#define SCNX32 "lX"
#define SCNoLEAST32 "lo"
#define SCNuLEAST32 "lu"
#define SCNxLEAST32 "lx"
#define SCNXLEAST32 "lX"
#define SCNoFAST32 "lo"
#define SCNuFAST32 "lu"
#define SCNxFAST32 "lx"
#define SCNXFAST32 "lX"
#define SCNo64 "I64o"
#define SCNu64 "I64u"
#define SCNx64 "I64x"
#define SCNX64 "I64X"
#define SCNoLEAST64 "I64o"
#define SCNuLEAST64 "I64u"
#define SCNxLEAST64 "I64x"
#define SCNXLEAST64 "I64X"
#define SCNoFAST64 "I64o"
#define SCNuFAST64 "I64u"
#define SCNxFAST64 "I64x"
#define SCNXFAST64 "I64X"
#define SCNoMAX "I64o"
#define SCNuMAX "I64u"
#define SCNxMAX "I64x"
#define SCNXMAX "I64X"
#ifdef _WIN64 // [
# define SCNoPTR "I64o"
# define SCNuPTR "I64u"
# define SCNxPTR "I64x"
# define SCNXPTR "I64X"
#else // _WIN64 ][
# define SCNoPTR "lo"
# define SCNuPTR "lu"
# define SCNxPTR "lx"
# define SCNXPTR "lX"
#endif // _WIN64 ]
// 7.8.2 Functions for greatest-width integer types
// 7.8.2.1 The imaxabs function
#define imaxabs _abs64
// 7.8.2.2 The imaxdiv function
// This is modified version of div() function from Microsoft's div.c found
// in %MSVC.NET%\crt\src\div.c
#ifdef STATIC_IMAXDIV // [
static
#else // STATIC_IMAXDIV ][
_inline
#endif // STATIC_IMAXDIV ]
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
{
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
#define strtoimax _strtoi64
#define strtoumax _strtoui64
// 7.8.2.4 The wcstoimax and wcstoumax functions
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
#endif // _MSC_INTTYPES_H_ ]

45
cmake/msvc/stdbool.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2005, 2006 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef STDBOOL_WIN32_H
#define STDBOOL_WIN32_H
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef __cplusplus
typedef unsigned char bool;
#define true 1
#define false 0
#ifndef CASSERT
#define CASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
#endif
CASSERT(sizeof(bool) == 1, bool_is_one_byte)
CASSERT(true, true_is_true)
CASSERT(!false, false_is_false)
#endif
#endif

251
cmake/msvc/stdint.h Normal file
View File

@ -0,0 +1,251 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#ifndef INTMAX_C
#define INTMAX_C INT64_C
#endif
#ifndef UINTMAX_C
#define UINTMAX_C UINT64_C
#endif
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]

69
cmake/msvc/sys/time.h Normal file
View File

@ -0,0 +1,69 @@
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_SYS_TIME_H_
#define _MSC_SYS_TIME_H_
//http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/430449b3-f6dd-4e18-84de-eebd26a8d668
#include < time.h >
#include <windows.h> //I've ommited this line.
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct timespec {
time_t tv_sec; /* Seconds since 00:00:00 GMT, */
/* 1 January 1970 */
long tv_nsec; /* Additional nanoseconds since */
/* tv_sec */
};
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
static inline int gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag;
if (NULL != tv)
{
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL);
}
if (NULL != tz)
{
if (!tzflag)
{
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
}
#endif //_MSC_SYS_TIME_H_

10
cmake/msvc/unistd.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_UNISTD_H_ // [
#define _MSC_UNISTD_H_
#include <process.h>
#endif // _MSC_UNISTD_H_ ]

View File

@ -1,19 +1,19 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
# This file is part of GNU Radio
#
# gr-osmosdr is free software; you can redistribute it and/or modify
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# gr-osmosdr is distributed in the hope that it will be useful,
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-osmosdr; see the file COPYING. If not, write to
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.

View File

@ -1,7 +1,6 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,7 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -64,9 +63,8 @@ This line is uninformative and is only to test line breaks in the comments.
u'Outputs the vital aadvark statistics.'
"""
from __future__ import unicode_literals
from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
def _test():
import os

View File

@ -1,8 +1,7 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -25,26 +24,24 @@ A base class is created.
Classes based upon this are used to make more user-friendly interfaces
to the doxygen xml docs than the generated classes provide.
"""
from __future__ import print_function
from __future__ import unicode_literals
import os
import pdb
from xml.parsers.expat import ExpatError
from .generated import compound
from generated import compound
class Base(object):
class Duplicate(Exception):
class Duplicate(StandardError):
pass
class NoSuchMember(Exception):
class NoSuchMember(StandardError):
pass
class ParsingError(Exception):
class ParsingError(StandardError):
pass
def __init__(self, parse_data, top=None):
@ -97,7 +94,7 @@ class Base(object):
for cls in self.mem_classes:
if cls.can_parse(mem):
return cls
raise Exception(("Did not find a class for object '%s'." \
raise StandardError(("Did not find a class for object '%s'." \
% (mem.get_name())))
def convert_mem(self, mem):
@ -105,11 +102,11 @@ class Base(object):
cls = self.get_cls(mem)
converted = cls.from_parse_data(mem, self.top)
if converted is None:
raise Exception('No class matched this object.')
raise StandardError('No class matched this object.')
self.add_ref(converted)
return converted
except Exception as e:
print(e)
except StandardError, e:
print e
@classmethod
def includes(cls, inst):

View File

@ -1,8 +1,7 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,14 +22,12 @@
Classes providing more user-friendly interfaces to the doxygen xml
docs than the generated classes provide.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from .generated import index
from .base import Base
from .text import description
from generated import index
from base import Base
from text import description
class DoxyIndex(Base):
"""
@ -46,16 +43,13 @@ class DoxyIndex(Base):
self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
for mem in self._root.compound:
converted = self.convert_mem(mem)
# For files and namespaces we want the contents to be
# accessible directly from the parent rather than having
# to go through the file object.
# For files we want the contents to be accessible directly
# from the parent rather than having to go through the file
# object.
if self.get_cls(mem) == DoxyFile:
if mem.name.endswith('.h'):
self._members += converted.members()
self._members.append(converted)
elif self.get_cls(mem) == DoxyNamespace:
self._members += converted.members()
self._members.append(converted)
else:
self._members.append(converted)
@ -86,29 +80,13 @@ class DoxyCompMem(Base):
self._data['brief_description'] = bd
self._data['detailed_description'] = dd
def set_parameters(self, data):
vs = [ddc.value for ddc in data.detaileddescription.content_]
pls = []
for v in vs:
if hasattr(v, 'parameterlist'):
pls += v.parameterlist
pis = []
for pl in pls:
pis += pl.parameteritem
dpis = []
for pi in pis:
dpi = DoxyParameterItem(pi)
dpi._parse()
dpis.append(dpi)
self._data['params'] = dpis
class DoxyCompound(DoxyCompMem):
pass
class DoxyMember(DoxyCompMem):
pass
class DoxyFunction(DoxyMember):
__module__ = "gnuradio.utils.doxyxml"
@ -120,13 +98,10 @@ class DoxyFunction(DoxyMember):
return
super(DoxyFunction, self)._parse()
self.set_descriptions(self._parse_data)
self.set_parameters(self._parse_data)
if not self._data['params']:
# If the params weren't set by a comment then just grab the names.
self._data['params'] = []
prms = self._parse_data.param
for prm in prms:
self._data['params'].append(DoxyParam(prm))
self._data['params'] = []
prms = self._parse_data.param
for prm in prms:
self._data['params'].append(DoxyParam(prm))
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(lambda self: self.data()['detailed_description'])
@ -146,39 +121,9 @@ class DoxyParam(DoxyMember):
self.set_descriptions(self._parse_data)
self._data['declname'] = self._parse_data.declname
@property
def description(self):
descriptions = []
if self.brief_description:
descriptions.append(self.brief_description)
if self.detailed_description:
descriptions.append(self.detailed_description)
return '\n\n'.join(descriptions)
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(lambda self: self.data()['detailed_description'])
name = property(lambda self: self.data()['declname'])
class DoxyParameterItem(DoxyMember):
"""A different representation of a parameter in Doxygen."""
def _parse(self):
if self._parsed:
return
super(DoxyParameterItem, self)._parse()
names = []
for nl in self._parse_data.parameternamelist:
for pn in nl.parametername:
names.append(description(pn))
# Just take first name
self._data['name'] = names[0]
# Get description
pd = description(self._parse_data.get_parameterdescription())
self._data['description'] = pd
description = property(lambda self: self.data()['description'])
name = property(lambda self: self.data()['name'])
declname = property(lambda self: self.data()['declname'])
class DoxyClass(DoxyCompound):
@ -194,14 +139,12 @@ class DoxyClass(DoxyCompound):
if self._error:
return
self.set_descriptions(self._retrieved_data.compounddef)
self.set_parameters(self._retrieved_data.compounddef)
# Sectiondef.kind tells about whether private or public.
# We just ignore this for now.
self.process_memberdefs()
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(lambda self: self.data()['detailed_description'])
params = property(lambda self: self.data()['params'])
Base.mem_classes.append(DoxyClass)
@ -234,16 +177,6 @@ class DoxyNamespace(DoxyCompound):
kind = 'namespace'
def _parse(self):
if self._parsed:
return
super(DoxyNamespace, self)._parse()
self.retrieve_data()
self.set_descriptions(self._retrieved_data.compounddef)
if self._error:
return
self.process_memberdefs()
Base.mem_classes.append(DoxyNamespace)
@ -294,11 +227,11 @@ class DoxyOther(Base):
__module__ = "gnuradio.utils.doxyxml"
kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum',
'dir', 'page', 'signal', 'slot', 'property'])
kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page'])
@classmethod
def can_parse(cls, obj):
return obj.kind in cls.kinds
Base.mem_classes.append(DoxyOther)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* -*- c++ -*- */
/*
* Copyright 2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include <iostream>
#include "aadvark.h"
void Aadvark::print() {
std::cout << "aadvark is " << aadvarkness << "/10 aadvarky" << std::endl;
}
Aadvark::Aadvark(int aaness): aadvarkness(aaness) {}
bool aadvarky_enough(Aadvark aad) {
if (aad.get_aadvarkness() > 6)
return true;
else
return false;
}
int Aadvark::get_aadvarkness() {
return aadvarkness;
}
int main() {
Aadvark arold = Aadvark(6);
arold.print();
if (aadvarky_enough(arold))
std::cout << "He is aadvarky enough" << std::endl;
else
std::cout << "He is not aadvarky enough" << std::endl;
}

View File

@ -0,0 +1,44 @@
/* -*- c++ -*- */
/*
* Copyright 2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include <iostream>
/*!
* \brief Models the mammal Aadvark.
*
* Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
*
* This line is uninformative and is only to test line breaks in the comments.
*/
class Aadvark {
public:
//! \brief Outputs the vital aadvark statistics.
void print();
//! \param aaness The aadvarkness of an aadvark is a measure of how aadvarky it is.
Aadvark(int aaness);
int get_aadvarkness();
private:
int aadvarkness;
};
bool aadvarky_enough(Aadvark aad);
int main();

View File

@ -0,0 +1,88 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
<compounddef id="aadvark_8cc" kind="file">
<compoundname>aadvark.cc</compoundname>
<includes local="no">iostream</includes>
<includes refid="aadvark_8cc" local="yes">aadvark.h</includes>
<includedby refid="aadvark_8cc" local="yes">aadvark.cc</includedby>
<incdepgraph>
<node id="0">
<label>aadvark.cc</label>
<link refid="aadvark.cc"/>
<childnode refid="1" relation="include">
</childnode>
</node>
<node id="1">
<label>iostream</label>
</node>
</incdepgraph>
<sectiondef kind="func">
<memberdef kind="function" id="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>bool</type>
<definition>bool aadvarky_enough</definition>
<argsstring>(Aadvark aad)</argsstring>
<name>aadvarky_enough</name>
<param>
<type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
<declname>aad</declname>
</param>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
</memberdef>
<memberdef kind="function" id="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>int</type>
<definition>int main</definition>
<argsstring>()</argsstring>
<name>main</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;aadvark.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">Aadvark::print</ref>()<sp/>{</highlight></codeline>
<codeline lineno="5"><highlight class="normal"><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;aadvark<sp/>is<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>aadvarkness<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;/10<sp/>aadvarky&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
<codeline lineno="6"><highlight class="normal">}</highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark::Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness):<sp/>aadvarkness(aaness)<sp/>{}</highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad)<sp/>{</highlight></codeline>
<codeline lineno="11"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aad.get_aadvarkness()<sp/>&gt;<sp/>6)</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="15"><highlight class="normal">}</highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Aadvark::get_aadvarkness()<sp/>{</highlight></codeline>
<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
<codeline lineno="19"><highlight class="normal">}</highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main()<sp/>{</highlight></codeline>
<codeline lineno="22"><highlight class="normal"><sp/><sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>arold<sp/>=<sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref>(6);</highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/>arold.<ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aadvarky_enough(arold))</highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
<codeline lineno="26"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>not<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
<codeline lineno="28"><highlight class="normal">}</highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight></codeline>
</programlisting>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc"/>
</compounddef>
</doxygen>

View File

@ -0,0 +1,72 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
<compounddef id="aadvark_8h" kind="file">
<compoundname>aadvark.h</compoundname>
<includes local="no">iostream</includes>
<incdepgraph>
<node id="3">
<label>aadvark.h</label>
<link refid="aadvark.h"/>
<childnode refid="4" relation="include">
</childnode>
</node>
<node id="4">
<label>iostream</label>
</node>
</incdepgraph>
<innerclass refid="classAadvark" prot="public">Aadvark</innerclass>
<sectiondef kind="func">
<memberdef kind="function" id="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>bool</type>
<definition>bool aadvarky_enough</definition>
<argsstring>(Aadvark aad)</argsstring>
<name>aadvarky_enough</name>
<param>
<type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
<declname>aad</declname>
</param>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
</memberdef>
<memberdef kind="function" id="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>int</type>
<definition>int main</definition>
<argsstring>()</argsstring>
<name>main</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="23" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight></codeline>
<codeline lineno="10" refid="classAadvark" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>{</highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
<codeline lineno="15"><highlight class="normal"><sp/><sp/><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness);</highlight></codeline>
<codeline lineno="16"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>get_aadvarkness();</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keyword">private</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
<codeline lineno="19"><highlight class="normal">};</highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad);</highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main();</highlight></codeline>
</programlisting>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h"/>
</compounddef>
</doxygen>

View File

@ -0,0 +1,86 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
<compounddef id="classAadvark" kind="class" prot="public">
<compoundname>Aadvark</compoundname>
<includes refid="aadvark_8h" local="no">aadvark.h</includes>
<sectiondef kind="private-attrib">
<memberdef kind="variable" id="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" static="no" mutable="no">
<type>int</type>
<definition>int Aadvark::aadvarkness</definition>
<argsstring></argsstring>
<name>aadvarkness</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="18" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="18" bodyend="-1"/>
</memberdef>
</sectiondef>
<sectiondef kind="public-func">
<memberdef kind="function" id="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
<definition>void Aadvark::print</definition>
<argsstring>()</argsstring>
<name>print</name>
<briefdescription>
<para>Outputs the vital aadvark statistics. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="13" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="4" bodyend="6"/>
</memberdef>
<memberdef kind="function" id="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type></type>
<definition>Aadvark::Aadvark</definition>
<argsstring>(int aaness)</argsstring>
<name>Aadvark</name>
<param>
<type>int</type>
<declname>aaness</declname>
</param>
<briefdescription>
</briefdescription>
<detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>aaness</parametername>
</parameternamelist>
<parameterdescription>
<para>The aadvarkness of an aadvark is a measure of how aadvarky it is. </para></parameterdescription>
</parameteritem>
</parameterlist>
</para> </detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="15" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="8" bodyend="8"/>
</memberdef>
<memberdef kind="function" id="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>int</type>
<definition>int Aadvark::get_aadvarkness</definition>
<argsstring>()</argsstring>
<name>get_aadvarkness</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="16" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="17" bodyend="19"/>
</memberdef>
</sectiondef>
<briefdescription>
<para>Models the mammal <ref refid="classAadvark" kindref="compound">Aadvark</ref>. </para> </briefdescription>
<detaileddescription>
<para>Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.</para><para>This line is uninformative and is only to test line breaks in the comments. </para> </detaileddescription>
<location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="10" bodyend="19"/>
<listofallmembers>
<member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>Aadvark</name></member>
<member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" virt="non-virtual"><scope>Aadvark</scope><name>aadvarkness</name></member>
<member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>get_aadvarkness</name></member>
<member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>print</name></member>
</listofallmembers>
</compounddef>
</doxygen>

View File

@ -0,0 +1,15 @@
<!-- XSLT script to combine the generated output into a single file.
If you have xsltproc you could use:
xsltproc combine.xslt index.xml >all.xml
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" indent="yes" standalone="yes" />
<xsl:template match="/">
<doxygen version="{doxygenindex/@version}">
<!-- Load all doxgen generated xml files -->
<xsl:for-each select="doxygenindex/compound">
<xsl:copy-of select="document( concat( @refid, '.xml' ) )/doxygen/*" />
</xsl:for-each>
</doxygen>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,814 @@
<?xml version='1.0' encoding='utf-8' ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="doxygen" type="DoxygenType"/>
<!-- Complex types -->
<xsd:complexType name="DoxygenType">
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="compounddef" type="compounddefType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="version" type="DoxVersionNumber" use="required" />
</xsd:complexType>
<xsd:complexType name="compounddefType">
<xsd:sequence>
<xsd:element name="compoundname" type="xsd:string"/>
<xsd:element name="title" type="xsd:string" minOccurs="0" />
<xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="includes" type="incType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="includedby" type="incType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="incdepgraph" type="graphType" minOccurs="0" />
<xsd:element name="invincdepgraph" type="graphType" minOccurs="0" />
<xsd:element name="innerdir" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="innerfile" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="innerclass" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="innernamespace" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="innerpage" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
<xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
<xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
<xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
<xsd:element name="collaborationgraph" type="graphType" minOccurs="0" />
<xsd:element name="programlisting" type="listingType" minOccurs="0" />
<xsd:element name="location" type="locationType" minOccurs="0" />
<xsd:element name="listofallmembers" type="listofallmembersType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="kind" type="DoxCompoundKind" />
<xsd:attribute name="prot" type="DoxProtectionKind" />
</xsd:complexType>
<xsd:complexType name="listofallmembersType">
<xsd:sequence>
<xsd:element name="member" type="memberRefType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="memberRefType">
<xsd:sequence>
<xsd:element name="scope" />
<xsd:element name="name" />
</xsd:sequence>
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="prot" type="DoxProtectionKind" />
<xsd:attribute name="virt" type="DoxVirtualKind" />
<xsd:attribute name="ambiguityscope" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="compoundRefType" mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="refid" type="xsd:string" use="optional" />
<xsd:attribute name="prot" type="DoxProtectionKind" />
<xsd:attribute name="virt" type="DoxVirtualKind" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="reimplementType" mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="refid" type="xsd:string" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="incType" mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="local" type="DoxBool" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="refType" mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="prot" type="DoxProtectionKind" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="refTextType" mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="kindref" type="DoxRefKind" />
<xsd:attribute name="external" type="xsd:string" use="optional"/>
<xsd:attribute name="tooltip" type="xsd:string" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="sectiondefType">
<xsd:sequence>
<xsd:element name="header" type="xsd:string" minOccurs="0" />
<xsd:element name="description" type="descriptionType" minOccurs="0" />
<xsd:element name="memberdef" type="memberdefType" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="kind" type="DoxSectionKind" />
</xsd:complexType>
<xsd:complexType name="memberdefType">
<xsd:sequence>
<xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
<xsd:element name="type" type="linkedTextType" minOccurs="0" />
<xsd:element name="definition" minOccurs="0" />
<xsd:element name="argsstring" minOccurs="0" />
<xsd:element name="name" />
<xsd:element name="read" minOccurs="0" />
<xsd:element name="write" minOccurs="0" />
<xsd:element name="bitfield" minOccurs="0" />
<xsd:element name="reimplements" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="reimplementedby" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="enumvalue" type="enumvalueType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
<xsd:element name="exceptions" type="linkedTextType" minOccurs="0" />
<xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
<xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
<xsd:element name="inbodydescription" type="descriptionType" minOccurs="0" />
<xsd:element name="location" type="locationType" />
<xsd:element name="references" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="referencedby" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="kind" type="DoxMemberKind" />
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="prot" type="DoxProtectionKind" />
<xsd:attribute name="static" type="DoxBool" />
<xsd:attribute name="const" type="DoxBool" />
<xsd:attribute name="explicit" type="DoxBool" />
<xsd:attribute name="inline" type="DoxBool" />
<xsd:attribute name="virt" type="DoxVirtualKind" />
<xsd:attribute name="volatile" type="DoxBool" />
<xsd:attribute name="mutable" type="DoxBool" />
<!-- Qt property -->
<xsd:attribute name="readable" type="DoxBool" use="optional"/>
<xsd:attribute name="writable" type="DoxBool" use="optional"/>
<!-- C++/CLI variable -->
<xsd:attribute name="initonly" type="DoxBool" use="optional"/>
<!-- C++/CLI and C# property -->
<xsd:attribute name="settable" type="DoxBool" use="optional"/>
<xsd:attribute name="gettable" type="DoxBool" use="optional"/>
<!-- C++/CLI function -->
<xsd:attribute name="final" type="DoxBool" use="optional"/>
<xsd:attribute name="sealed" type="DoxBool" use="optional"/>
<xsd:attribute name="new" type="DoxBool" use="optional"/>
<!-- C++/CLI event -->
<xsd:attribute name="add" type="DoxBool" use="optional"/>
<xsd:attribute name="remove" type="DoxBool" use="optional"/>
<xsd:attribute name="raise" type="DoxBool" use="optional"/>
<!-- Objective-C 2.0 protocol method -->
<xsd:attribute name="optional" type="DoxBool" use="optional"/>
<xsd:attribute name="required" type="DoxBool" use="optional"/>
<!-- Objective-C 2.0 property accessor -->
<xsd:attribute name="accessor" type="DoxAccessor" use="optional"/>
</xsd:complexType>
<xsd:complexType name="descriptionType" mixed="true">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" minOccurs="0"/>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalType" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="enumvalueType" mixed="true">
<xsd:sequence>
<xsd:element name="name" />
<xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
<xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
<xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="prot" type="DoxProtectionKind" />
</xsd:complexType>
<xsd:complexType name="templateparamlistType">
<xsd:sequence>
<xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="paramType">
<xsd:sequence>
<xsd:element name="type" type="linkedTextType" minOccurs="0" />
<xsd:element name="declname" minOccurs="0" />
<xsd:element name="defname" minOccurs="0" />
<xsd:element name="array" minOccurs="0" />
<xsd:element name="defval" type="linkedTextType" minOccurs="0" />
<xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="linkedTextType" mixed="true">
<xsd:sequence>
<xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="graphType">
<xsd:sequence>
<xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="nodeType">
<xsd:sequence>
<xsd:element name="label" />
<xsd:element name="link" type="linkType" minOccurs="0" />
<xsd:element name="childnode" type="childnodeType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="childnodeType">
<xsd:sequence>
<xsd:element name="edgelabel" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="relation" type="DoxGraphRelation" />
</xsd:complexType>
<xsd:complexType name="linkType">
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="external" type="xsd:string" use="optional"/>
</xsd:complexType>
<xsd:complexType name="listingType">
<xsd:sequence>
<xsd:element name="codeline" type="codelineType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="codelineType">
<xsd:sequence>
<xsd:element name="highlight" type="highlightType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="lineno" type="xsd:integer" />
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="refkind" type="DoxRefKind" />
<xsd:attribute name="external" type="DoxBool" />
</xsd:complexType>
<xsd:complexType name="highlightType" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="sp" />
<xsd:element name="ref" type="refTextType" />
</xsd:choice>
<xsd:attribute name="class" type="DoxHighlightClass" />
</xsd:complexType>
<xsd:complexType name="referenceType" mixed="true">
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="compoundref" type="xsd:string" use="optional" />
<xsd:attribute name="startline" type="xsd:integer" />
<xsd:attribute name="endline" type="xsd:integer" />
</xsd:complexType>
<xsd:complexType name="locationType">
<xsd:attribute name="file" type="xsd:string" />
<xsd:attribute name="line" type="xsd:integer" />
<xsd:attribute name="bodyfile" type="xsd:string" />
<xsd:attribute name="bodystart" type="xsd:integer" />
<xsd:attribute name="bodyend" type="xsd:integer" />
</xsd:complexType>
<xsd:complexType name="docSect1Type" mixed="true">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalS1Type" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docSect2Type" mixed="true">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalS2Type" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docSect3Type" mixed="true">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect4" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalS3Type" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docSect4Type" mixed="true">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalS4Type" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docInternalType" mixed="true">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docInternalS1Type" mixed="true">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docInternalS2Type" mixed="true">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docInternalS3Type" mixed="true">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect3" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docInternalS4Type" mixed="true">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:group name="docTitleCmdGroup">
<xsd:choice>
<xsd:element name="ulink" type="docURLLink" />
<xsd:element name="bold" type="docMarkupType" />
<xsd:element name="emphasis" type="docMarkupType" />
<xsd:element name="computeroutput" type="docMarkupType" />
<xsd:element name="subscript" type="docMarkupType" />
<xsd:element name="superscript" type="docMarkupType" />
<xsd:element name="center" type="docMarkupType" />
<xsd:element name="small" type="docMarkupType" />
<xsd:element name="htmlonly" type="xsd:string" />
<xsd:element name="latexonly" type="xsd:string" />
<xsd:element name="dot" type="xsd:string" />
<xsd:element name="anchor" type="docAnchorType" />
<xsd:element name="formula" type="docFormulaType" />
<xsd:element name="ref" type="docRefTextType" />
<xsd:element name="copy" type="docEmptyType" />
<xsd:element name="trademark" type="docEmptyType" />
<xsd:element name="registered" type="docEmptyType" />
<xsd:element name="lsquo" type="docEmptyType" />
<xsd:element name="rsquo" type="docEmptyType" />
<xsd:element name="ldquo" type="docEmptyType" />
<xsd:element name="rdquo" type="docEmptyType" />
<xsd:element name="ndash" type="docEmptyType" />
<xsd:element name="mdash" type="docEmptyType" />
<xsd:element name="umlaut" type="docCharType" />
<xsd:element name="acute" type="docCharType" />
<xsd:element name="grave" type="docCharType" />
<xsd:element name="circ" type="docCharType" />
<xsd:element name="slash" type="docCharType" />
<xsd:element name="tilde" type="docCharType" />
<xsd:element name="cedil" type="docCharType" />
<xsd:element name="ring" type="docCharType" />
<xsd:element name="szlig" type="docEmptyType" />
<xsd:element name="nonbreakablespace" type="docEmptyType" />
</xsd:choice>
</xsd:group>
<xsd:complexType name="docTitleType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
</xsd:complexType>
<xsd:group name="docCmdGroup">
<xsd:choice>
<xsd:group ref="docTitleCmdGroup"/>
<xsd:element name="linebreak" type="docEmptyType" />
<xsd:element name="hruler" type="docEmptyType" />
<xsd:element name="preformatted" type="docMarkupType" />
<xsd:element name="programlisting" type="listingType" />
<xsd:element name="verbatim" type="xsd:string" />
<xsd:element name="indexentry" type="docIndexEntryType" />
<xsd:element name="orderedlist" type="docListType" />
<xsd:element name="itemizedlist" type="docListType" />
<xsd:element name="simplesect" type="docSimpleSectType" />
<xsd:element name="title" type="docTitleType" />
<xsd:element name="variablelist" type="docVariableListType" />
<xsd:element name="table" type="docTableType" />
<xsd:element name="heading" type="docHeadingType" />
<xsd:element name="image" type="docImageType" />
<xsd:element name="dotfile" type="docDotFileType" />
<xsd:element name="toclist" type="docTocListType" />
<xsd:element name="language" type="docLanguageType" />
<xsd:element name="parameterlist" type="docParamListType" />
<xsd:element name="xrefsect" type="docXRefSectType" />
<xsd:element name="copydoc" type="docCopyType" />
</xsd:choice>
</xsd:group>
<xsd:complexType name="docParaType" mixed="true">
<xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
</xsd:complexType>
<xsd:complexType name="docMarkupType" mixed="true">
<xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
</xsd:complexType>
<xsd:complexType name="docURLLink" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="url" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docAnchorType" mixed="true">
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docFormulaType" mixed="true">
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docIndexEntryType">
<xsd:sequence>
<xsd:element name="primaryie" type="xsd:string" />
<xsd:element name="secondaryie" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docListType">
<xsd:sequence>
<xsd:element name="listitem" type="docListItemType" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docListItemType">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docSimpleSectType">
<xsd:sequence>
<xsd:element name="title" type="docTitleType" minOccurs="0" />
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" />
<xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/>
</xsd:sequence>
</xsd:sequence>
<xsd:attribute name="kind" type="DoxSimpleSectKind" />
</xsd:complexType>
<xsd:complexType name="docVarListEntryType">
<xsd:sequence>
<xsd:element name="term" type="docTitleType" />
</xsd:sequence>
</xsd:complexType>
<xsd:group name="docVariableListGroup">
<xsd:sequence>
<xsd:element name="varlistentry" type="docVarListEntryType" />
<xsd:element name="listitem" type="docListItemType" />
</xsd:sequence>
</xsd:group>
<xsd:complexType name="docVariableListType">
<xsd:sequence>
<xsd:group ref="docVariableListGroup" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docRefTextType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="refid" type="xsd:string" />
<xsd:attribute name="kindref" type="DoxRefKind" />
<xsd:attribute name="external" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docTableType">
<xsd:sequence>
<xsd:element name="row" type="docRowType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="caption" type="docCaptionType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="rows" type="xsd:integer" />
<xsd:attribute name="cols" type="xsd:integer" />
</xsd:complexType>
<xsd:complexType name="docRowType">
<xsd:sequence>
<xsd:element name="entry" type="docEntryType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docEntryType">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="thead" type="DoxBool" />
</xsd:complexType>
<xsd:complexType name="docCaptionType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
</xsd:complexType>
<xsd:complexType name="docHeadingType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
</xsd:complexType>
<xsd:complexType name="docImageType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="type" type="DoxImageKind" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="width" type="xsd:string" />
<xsd:attribute name="height" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docDotFileType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docTocItemType" mixed="true">
<xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docTocListType">
<xsd:sequence>
<xsd:element name="tocitem" type="docTocItemType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docLanguageType">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="langid" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docParamListType">
<xsd:sequence>
<xsd:element name="parameteritem" type="docParamListItem" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="kind" type="DoxParamListKind" />
</xsd:complexType>
<xsd:complexType name="docParamListItem">
<xsd:sequence>
<xsd:element name="parameternamelist" type="docParamNameList" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="parameterdescription" type="descriptionType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docParamNameList">
<xsd:sequence>
<xsd:element name="parametername" type="docParamName" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="docParamName" mixed="true">
<xsd:sequence>
<xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="direction" type="DoxParamDir" use="optional" />
</xsd:complexType>
<xsd:complexType name="docXRefSectType">
<xsd:sequence>
<xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="xrefdescription" type="descriptionType" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docCopyType">
<xsd:sequence>
<xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="internal" type="docInternalType" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="link" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="docCharType">
<xsd:attribute name="char" type="DoxCharRange"/>
</xsd:complexType>
<xsd:complexType name="docEmptyType"/>
<!-- Simple types -->
<xsd:simpleType name="DoxBool">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="yes" />
<xsd:enumeration value="no" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxGraphRelation">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="include" />
<xsd:enumeration value="usage" />
<xsd:enumeration value="template-instance" />
<xsd:enumeration value="public-inheritance" />
<xsd:enumeration value="protected-inheritance" />
<xsd:enumeration value="private-inheritance" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxRefKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="compound" />
<xsd:enumeration value="member" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxMemberKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="define" />
<xsd:enumeration value="property" />
<xsd:enumeration value="event" />
<xsd:enumeration value="variable" />
<xsd:enumeration value="typedef" />
<xsd:enumeration value="enum" />
<xsd:enumeration value="function" />
<xsd:enumeration value="signal" />
<xsd:enumeration value="prototype" />
<xsd:enumeration value="friend" />
<xsd:enumeration value="dcop" />
<xsd:enumeration value="slot" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxProtectionKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="public" />
<xsd:enumeration value="protected" />
<xsd:enumeration value="private" />
<xsd:enumeration value="package" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxVirtualKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="non-virtual" />
<xsd:enumeration value="virtual" />
<xsd:enumeration value="pure-virtual" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxCompoundKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="class" />
<xsd:enumeration value="struct" />
<xsd:enumeration value="union" />
<xsd:enumeration value="interface" />
<xsd:enumeration value="protocol" />
<xsd:enumeration value="category" />
<xsd:enumeration value="exception" />
<xsd:enumeration value="file" />
<xsd:enumeration value="namespace" />
<xsd:enumeration value="group" />
<xsd:enumeration value="page" />
<xsd:enumeration value="example" />
<xsd:enumeration value="dir" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxSectionKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="user-defined" />
<xsd:enumeration value="public-type" />
<xsd:enumeration value="public-func" />
<xsd:enumeration value="public-attrib" />
<xsd:enumeration value="public-slot" />
<xsd:enumeration value="signal" />
<xsd:enumeration value="dcop-func" />
<xsd:enumeration value="property" />
<xsd:enumeration value="event" />
<xsd:enumeration value="public-static-func" />
<xsd:enumeration value="public-static-attrib" />
<xsd:enumeration value="protected-type" />
<xsd:enumeration value="protected-func" />
<xsd:enumeration value="protected-attrib" />
<xsd:enumeration value="protected-slot" />
<xsd:enumeration value="protected-static-func" />
<xsd:enumeration value="protected-static-attrib" />
<xsd:enumeration value="package-type" />
<xsd:enumeration value="package-func" />
<xsd:enumeration value="package-attrib" />
<xsd:enumeration value="package-static-func" />
<xsd:enumeration value="package-static-attrib" />
<xsd:enumeration value="private-type" />
<xsd:enumeration value="private-func" />
<xsd:enumeration value="private-attrib" />
<xsd:enumeration value="private-slot" />
<xsd:enumeration value="private-static-func" />
<xsd:enumeration value="private-static-attrib" />
<xsd:enumeration value="friend" />
<xsd:enumeration value="related" />
<xsd:enumeration value="define" />
<xsd:enumeration value="prototype" />
<xsd:enumeration value="typedef" />
<xsd:enumeration value="enum" />
<xsd:enumeration value="func" />
<xsd:enumeration value="var" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxHighlightClass">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="comment" />
<xsd:enumeration value="normal" />
<xsd:enumeration value="preprocessor" />
<xsd:enumeration value="keyword" />
<xsd:enumeration value="keywordtype" />
<xsd:enumeration value="keywordflow" />
<xsd:enumeration value="stringliteral" />
<xsd:enumeration value="charliteral" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxSimpleSectKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="see" />
<xsd:enumeration value="return" />
<xsd:enumeration value="author" />
<xsd:enumeration value="authors" />
<xsd:enumeration value="version" />
<xsd:enumeration value="since" />
<xsd:enumeration value="date" />
<xsd:enumeration value="note" />
<xsd:enumeration value="warning" />
<xsd:enumeration value="pre" />
<xsd:enumeration value="post" />
<xsd:enumeration value="invariant" />
<xsd:enumeration value="remark" />
<xsd:enumeration value="attention" />
<xsd:enumeration value="par" />
<xsd:enumeration value="rcs" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxVersionNumber">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d+\.\d+.*" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxImageKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="html" />
<xsd:enumeration value="latex" />
<xsd:enumeration value="rtf" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxParamListKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="param" />
<xsd:enumeration value="retval" />
<xsd:enumeration value="exception" />
<xsd:enumeration value="templateparam" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxCharRange">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[aeiouncAEIOUNC]" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxParamDir">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="in"/>
<xsd:enumeration value="out"/>
<xsd:enumeration value="inout"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="DoxAccessor">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="retain"/>
<xsd:enumeration value="copy"/>
<xsd:enumeration value="assign"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

View File

@ -0,0 +1,17 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd" version="1.6.3">
<compound refid="classAadvark" kind="class"><name>Aadvark</name>
<member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" kind="variable"><name>aadvarkness</name></member>
<member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kind="function"><name>print</name></member>
<member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kind="function"><name>Aadvark</name></member>
<member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" kind="function"><name>get_aadvarkness</name></member>
</compound>
<compound refid="aadvark_8cc" kind="file"><name>aadvark.cc</name>
<member refid="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
<member refid="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
</compound>
<compound refid="aadvark_8h" kind="file"><name>aadvark.h</name>
<member refid="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
<member refid="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
</compound>
</doxygenindex>

View File

@ -0,0 +1,66 @@
<?xml version='1.0' encoding='utf-8' ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="doxygenindex" type="DoxygenType"/>
<xsd:complexType name="DoxygenType">
<xsd:sequence>
<xsd:element name="compound" type="CompoundType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="CompoundType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="refid" type="xsd:string" use="required"/>
<xsd:attribute name="kind" type="CompoundKind" use="required"/>
</xsd:complexType>
<xsd:complexType name="MemberType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="refid" type="xsd:string" use="required"/>
<xsd:attribute name="kind" type="MemberKind" use="required"/>
</xsd:complexType>
<xsd:simpleType name="CompoundKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="class"/>
<xsd:enumeration value="struct"/>
<xsd:enumeration value="union"/>
<xsd:enumeration value="interface"/>
<xsd:enumeration value="protocol"/>
<xsd:enumeration value="category"/>
<xsd:enumeration value="exception"/>
<xsd:enumeration value="file"/>
<xsd:enumeration value="namespace"/>
<xsd:enumeration value="group"/>
<xsd:enumeration value="page"/>
<xsd:enumeration value="example"/>
<xsd:enumeration value="dir"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="MemberKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="define"/>
<xsd:enumeration value="property"/>
<xsd:enumeration value="event"/>
<xsd:enumeration value="variable"/>
<xsd:enumeration value="typedef"/>
<xsd:enumeration value="enum"/>
<xsd:enumeration value="enumvalue"/>
<xsd:enumeration value="function"/>
<xsd:enumeration value="signal"/>
<xsd:enumeration value="prototype"/>
<xsd:enumeration value="friend"/>
<xsd:enumeration value="dcop"/>
<xsd:enumeration value="slot"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

View File

@ -5,4 +5,3 @@ These do the real work of parsing the doxygen xml files but the
resultant classes are not very friendly to navigate so the rest of the
doxyxml module processes them further.
"""
from __future__ import unicode_literals

View File

@ -3,17 +3,15 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
import sys
from . import compoundsuper as supermod
from .compoundsuper import MixedContainer
import compoundsuper as supermod
from compoundsuper import MixedContainer
class DoxygenTypeSub(supermod.DoxygenType):

View File

@ -4,17 +4,12 @@
# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
#
from __future__ import print_function
from __future__ import unicode_literals
import sys
import getopt
from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
import six
#
# User methods
#
@ -24,9 +19,9 @@ import six
try:
from generatedssuper import GeneratedsSuper
except ImportError as exp:
except ImportError, exp:
class GeneratedsSuper(object):
class GeneratedsSuper:
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@ -69,7 +64,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
s1 = (isinstance(inStr, six.string_types) and inStr or
s1 = (isinstance(inStr, basestring) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@ -77,7 +72,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
s1 = (isinstance(inStr, six.string_types) and inStr or
s1 = (isinstance(inStr, basestring) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@ -107,7 +102,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
class MixedContainer(object):
class MixedContainer:
# Constants for category:
CategoryNone = 0
CategoryText = 1
@ -4226,7 +4221,7 @@ class codelineType(GeneratedsSuper):
if attrs.get('lineno'):
try:
self.lineno = int(attrs.get('lineno').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (lineno): %s' % exp)
if attrs.get('refkind'):
self.refkind = attrs.get('refkind').value
@ -4509,12 +4504,12 @@ class referenceType(GeneratedsSuper):
if attrs.get('endline'):
try:
self.endline = int(attrs.get('endline').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (endline): %s' % exp)
if attrs.get('startline'):
try:
self.startline = int(attrs.get('startline').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (startline): %s' % exp)
if attrs.get('refid'):
self.refid = attrs.get('refid').value
@ -4632,17 +4627,17 @@ class locationType(GeneratedsSuper):
if attrs.get('bodystart'):
try:
self.bodystart = int(attrs.get('bodystart').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (bodystart): %s' % exp)
if attrs.get('line'):
try:
self.line = int(attrs.get('line').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (line): %s' % exp)
if attrs.get('bodyend'):
try:
self.bodyend = int(attrs.get('bodyend').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (bodyend): %s' % exp)
if attrs.get('bodyfile'):
self.bodyfile = attrs.get('bodyfile').value
@ -6783,12 +6778,12 @@ class docTableType(GeneratedsSuper):
if attrs.get('rows'):
try:
self.rows = int(attrs.get('rows').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (rows): %s' % exp)
if attrs.get('cols'):
try:
self.cols = int(attrs.get('cols').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (cols): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
@ -7113,7 +7108,7 @@ class docHeadingType(GeneratedsSuper):
if attrs.get('level'):
try:
self.level = int(attrs.get('level').value)
except ValueError as exp:
except ValueError, exp:
raise ValueError('Bad integer attribute (level): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.TEXT_NODE:
@ -8288,7 +8283,7 @@ Options:
"""
def usage():
print(USAGE_TEXT)
print USAGE_TEXT
sys.exit(1)
@ -8344,3 +8339,4 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')

View File

@ -3,16 +3,14 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from xml.dom import minidom
import os
import sys
from . import compound
import compound
from . import indexsuper as supermod
import indexsuper as supermod
class DoxygenTypeSub(supermod.DoxygenType):
def __init__(self, version=None, compound=None):

View File

@ -4,16 +4,12 @@
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
from __future__ import print_function
from __future__ import unicode_literals
import sys
import getopt
from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
import six
#
# User methods
#
@ -23,9 +19,9 @@ import six
try:
from generatedssuper import GeneratedsSuper
except ImportError as exp:
except ImportError, exp:
class GeneratedsSuper(object):
class GeneratedsSuper:
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@ -68,7 +64,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
s1 = (isinstance(inStr, six.string_types) and inStr or
s1 = (isinstance(inStr, basestring) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@ -76,7 +72,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
s1 = (isinstance(inStr, six.string_types) and inStr or
s1 = (isinstance(inStr, basestring) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@ -106,7 +102,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
class MixedContainer(object):
class MixedContainer:
# Constants for category:
CategoryNone = 0
CategoryText = 1
@ -466,7 +462,7 @@ Options:
"""
def usage():
print(USAGE_TEXT)
print USAGE_TEXT
sys.exit(1)
@ -524,3 +520,4 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')

View File

@ -1,8 +1,7 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -22,13 +21,12 @@
"""
Utilities for extracting text from generated classes.
"""
from __future__ import unicode_literals
def is_string(txt):
if isinstance(txt, str):
return True
try:
if isinstance(txt, str):
if isinstance(txt, unicode):
return True
except NameError:
pass
@ -51,7 +49,7 @@ def description_bit(obj):
elif is_string(obj):
return obj
else:
raise Exception('Expecting a string or something with content, content_ or value attribute')
raise StandardError('Expecting a string or something with content, content_ or value attribute')
# If this bit is a paragraph then add one some line breaks.
if hasattr(obj, 'name') and obj.name == 'para':
result += "\n\n"

View File

@ -1,7 +1,6 @@
/*!
* \defgroup block GNU Radio TEST C++ Signal Processing Blocks
* \brief All C++ blocks that can be used from the TEST GNU Radio
* \defgroup block GNU Radio OsmoSDR C++ Signal Processing Blocks
* \brief All C++ blocks that can be used from the OsmoSDR GNU Radio
* module are listed here or in the subcategories below.
*
*/

View File

@ -1,10 +1,5 @@
/*! \mainpage
Welcome to the GNU Radio TEST Block
This is the intro page for the Doxygen manual generated for the TEST
block (docs/doxygen/other/main_page.dox). Edit it to add more detailed
documentation about the new GNU Radio modules contained in this
project.
Welcome to the OsmoSDR GNUradio blocks
*/

View File

@ -1,19 +0,0 @@
#ifndef PYDOC_MACROS_H
#define PYDOC_MACROS_H
#define __EXPAND(x) x
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1))
#define __CAT1(a, b) a##b
#define __CAT2(a, b) __CAT1(a, b)
#define __DOC1(n1) __doc_##n1
#define __DOC2(n1, n2) __doc_##n1##_##n2
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__))
#endif // PYDOC_MACROS_H

255
docs/doxygen/swig_doc.py Normal file
View File

@ -0,0 +1,255 @@
#
# Copyright 2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
"""
Creates the swig_doc.i SWIG interface file.
Execute using: python swig_doc.py xml_path outputfilename
The file instructs SWIG to transfer the doxygen comments into the
python docstrings.
"""
import sys
try:
from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
except ImportError:
from gnuradio.doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
def py_name(name):
bits = name.split('_')
return '_'.join(bits[1:])
def make_name(name):
bits = name.split('_')
return bits[0] + '_make_' + '_'.join(bits[1:])
class Block(object):
"""
Checks if doxyxml produced objects correspond to a gnuradio block.
"""
@classmethod
def includes(cls, item):
if not isinstance(item, DoxyClass):
return False
# Check for a parsing error.
if item.error():
return False
return item.has_member(make_name(item.name()), DoxyFriend)
def utoascii(text):
"""
Convert unicode text into ascii and escape quotes.
"""
if text is None:
return ''
out = text.encode('ascii', 'replace')
out = out.replace('"', '\\"')
return out
def combine_descriptions(obj):
"""
Combines the brief and detailed descriptions of an object together.
"""
description = []
bd = obj.brief_description.strip()
dd = obj.detailed_description.strip()
if bd:
description.append(bd)
if dd:
description.append(dd)
return utoascii('\n\n'.join(description)).strip()
entry_templ = '%feature("docstring") {name} "{docstring}"'
def make_entry(obj, name=None, templ="{description}", description=None):
"""
Create a docstring entry for a swig interface file.
obj - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to obj.name())
templ - an optional template for the docstring containing only one
variable named 'description'.
description - if this optional variable is set then it's value is
used as the description instead of extracting it from obj.
"""
if name is None:
name=obj.name()
if "operator " in name:
return ''
if description is None:
description = combine_descriptions(obj)
docstring = templ.format(description=description)
if not docstring:
return ''
return entry_templ.format(
name=name,
docstring=docstring,
)
def make_func_entry(func, name=None, description=None, params=None):
"""
Create a function docstring entry for a swig interface file.
func - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to func.name())
description - if this optional variable is set then it's value is
used as the description instead of extracting it from func.
params - a parameter list that overrides using func.params.
"""
if params is None:
params = func.params
params = [prm.declname for prm in params]
if params:
sig = "Params: (%s)" % ", ".join(params)
else:
sig = "Params: (NONE)"
templ = "{description}\n\n" + sig
return make_entry(func, name=name, templ=utoascii(templ),
description=description)
def make_class_entry(klass, description=None):
"""
Create a class docstring for a swig interface file.
"""
output = []
output.append(make_entry(klass, description=description))
for func in klass.in_category(DoxyFunction):
name = klass.name() + '::' + func.name()
output.append(make_func_entry(func, name=name))
return "\n\n".join(output)
def make_block_entry(di, block):
"""
Create class and function docstrings of a gnuradio block for a
swig interface file.
"""
descriptions = []
# Get the documentation associated with the class.
class_desc = combine_descriptions(block)
if class_desc:
descriptions.append(class_desc)
# Get the documentation associated with the make function
make_func = di.get_member(make_name(block.name()), DoxyFunction)
make_func_desc = combine_descriptions(make_func)
if make_func_desc:
descriptions.append(make_func_desc)
# Get the documentation associated with the file
try:
block_file = di.get_member(block.name() + ".h", DoxyFile)
file_desc = combine_descriptions(block_file)
if file_desc:
descriptions.append(file_desc)
except base.Base.NoSuchMember:
# Don't worry if we can't find a matching file.
pass
# And join them all together to make a super duper description.
super_description = "\n\n".join(descriptions)
# Associate the combined description with the class and
# the make function.
output = []
output.append(make_class_entry(block, description=super_description))
creator = block.get_member(block.name(), DoxyFunction)
output.append(make_func_entry(make_func, description=super_description,
params=creator.params))
return "\n\n".join(output)
def make_swig_interface_file(di, swigdocfilename, custom_output=None):
output = ["""
/*
* This file was automatically generated using swig_doc.py.
*
* Any changes to it will be lost next time it is regenerated.
*/
"""]
if custom_output is not None:
output.append(custom_output)
# Create docstrings for the blocks.
blocks = di.in_category(Block)
make_funcs = set([])
for block in blocks:
try:
make_func = di.get_member(make_name(block.name()), DoxyFunction)
make_funcs.add(make_func.name())
output.append(make_block_entry(di, block))
except block.ParsingError:
print('Parsing error for block %s' % block.name())
# Create docstrings for functions
# Don't include the make functions since they have already been dealt with.
funcs = [f for f in di.in_category(DoxyFunction) if f.name() not in make_funcs]
for f in funcs:
try:
output.append(make_func_entry(f))
except f.ParsingError:
print('Parsing error for function %s' % f.name())
# Create docstrings for classes
block_names = [block.name() for block in blocks]
klasses = [k for k in di.in_category(DoxyClass) if k.name() not in block_names]
for k in klasses:
try:
output.append(make_class_entry(k))
except k.ParsingError:
print('Parsing error for class %s' % k.name())
# Docstrings are not created for anything that is not a function or a class.
# If this excludes anything important please add it here.
output = "\n\n".join(output)
swig_doc = file(swigdocfilename, 'w')
swig_doc.write(output)
swig_doc.close()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
if len(sys.argv) != 3:
raise StandardError(err_msg)
xml_path = sys.argv[1]
swigdocfilename = sys.argv[2]
di = DoxyIndex(xml_path)
# gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
# This is presumably a bug in SWIG.
#msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
#insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
#delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
output = []
#output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
#output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
custom_output = "\n\n".join(output)
# Generate the docstrings interface file.
make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)

View File

@ -1,346 +0,0 @@
#
# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gnuradio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Updates the *pydoc_h files for a module
Execute using: python update_pydoc.py xml_path outputfilename
The file instructs Pybind11 to transfer the doxygen comments into the
python docstrings.
"""
import os, sys, time, glob, re, json
from argparse import ArgumentParser
from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile
from doxyxml import DoxyOther, base
def py_name(name):
bits = name.split('_')
return '_'.join(bits[1:])
def make_name(name):
bits = name.split('_')
return bits[0] + '_make_' + '_'.join(bits[1:])
class Block(object):
"""
Checks if doxyxml produced objects correspond to a gnuradio block.
"""
@classmethod
def includes(cls, item):
if not isinstance(item, DoxyClass):
return False
# Check for a parsing error.
if item.error():
return False
friendname = make_name(item.name())
is_a_block = item.has_member(friendname, DoxyFriend)
# But now sometimes the make function isn't a friend so check again.
if not is_a_block:
is_a_block = di.has_member(friendname, DoxyFunction)
return is_a_block
class Block2(object):
"""
Checks if doxyxml produced objects correspond to a new style
gnuradio block.
"""
@classmethod
def includes(cls, item):
if not isinstance(item, DoxyClass):
return False
# Check for a parsing error.
if item.error():
return False
is_a_block2 = item.has_member('make', DoxyFunction) and item.has_member('sptr', DoxyOther)
return is_a_block2
def utoascii(text):
"""
Convert unicode text into ascii and escape quotes and backslashes.
"""
if text is None:
return ''
out = text.encode('ascii', 'replace')
# swig will require us to replace blackslash with 4 backslashes
# TODO: evaluate what this should be for pybind11
out = out.replace(b'\\', b'\\\\\\\\')
out = out.replace(b'"', b'\\"').decode('ascii')
return str(out)
def combine_descriptions(obj):
"""
Combines the brief and detailed descriptions of an object together.
"""
description = []
bd = obj.brief_description.strip()
dd = obj.detailed_description.strip()
if bd:
description.append(bd)
if dd:
description.append(dd)
return utoascii('\n\n'.join(description)).strip()
def format_params(parameteritems):
output = ['Args:']
template = ' {0} : {1}'
for pi in parameteritems:
output.append(template.format(pi.name, pi.description))
return '\n'.join(output)
entry_templ = '%feature("docstring") {name} "{docstring}"'
def make_entry(obj, name=None, templ="{description}", description=None, params=[]):
"""
Create a docstring key/value pair, where the key is the object name.
obj - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to obj.name())
templ - an optional template for the docstring containing only one
variable named 'description'.
description - if this optional variable is set then it's value is
used as the description instead of extracting it from obj.
"""
if name is None:
name=obj.name()
if hasattr(obj,'_parse_data') and hasattr(obj._parse_data,'definition'):
name=obj._parse_data.definition.split(' ')[-1]
if "operator " in name:
return ''
if description is None:
description = combine_descriptions(obj)
if params:
description += '\n\n'
description += utoascii(format_params(params))
docstring = templ.format(description=description)
return {name: docstring}
def make_class_entry(klass, description=None, ignored_methods=[], params=None):
"""
Create a class docstring key/value pair.
"""
if params is None:
params = klass.params
output = {}
output.update(make_entry(klass, description=description, params=params))
for func in klass.in_category(DoxyFunction):
if func.name() not in ignored_methods:
name = klass.name() + '::' + func.name()
output.update(make_entry(func, name=name))
return output
def make_block_entry(di, block):
"""
Create class and function docstrings of a gnuradio block
"""
descriptions = []
# Get the documentation associated with the class.
class_desc = combine_descriptions(block)
if class_desc:
descriptions.append(class_desc)
# Get the documentation associated with the make function
make_func = di.get_member(make_name(block.name()), DoxyFunction)
make_func_desc = combine_descriptions(make_func)
if make_func_desc:
descriptions.append(make_func_desc)
# Get the documentation associated with the file
try:
block_file = di.get_member(block.name() + ".h", DoxyFile)
file_desc = combine_descriptions(block_file)
if file_desc:
descriptions.append(file_desc)
except base.Base.NoSuchMember:
# Don't worry if we can't find a matching file.
pass
# And join them all together to make a super duper description.
super_description = "\n\n".join(descriptions)
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(block, description=super_description))
output.update(make_entry(make_func, description=super_description,
params=block.params))
return output
def make_block2_entry(di, block):
"""
Create class and function docstrings of a new style gnuradio block
"""
# For new style blocks all the relevant documentation should be
# associated with the 'make' method.
class_description = combine_descriptions(block)
make_func = block.get_member('make', DoxyFunction)
make_description = combine_descriptions(make_func)
description = class_description + "\n\nConstructor Specific Documentation:\n\n" + make_description
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(
block, description=description,
ignored_methods=['make'], params=make_func.params))
makename = block.name() + '::make'
output.update(make_entry(
make_func, name=makename, description=description,
params=make_func.params))
return output
def get_docstrings_dict(di, custom_output=None):
output = {}
if custom_output:
output.update(custom_output)
# Create docstrings for the blocks.
blocks = di.in_category(Block)
blocks2 = di.in_category(Block2)
make_funcs = set([])
for block in blocks:
try:
make_func = di.get_member(make_name(block.name()), DoxyFunction)
# Don't want to risk writing to output twice.
if make_func.name() not in make_funcs:
make_funcs.add(make_func.name())
output.update(make_block_entry(di, block))
except block.ParsingError:
sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
raise
for block in blocks2:
try:
make_func = block.get_member('make', DoxyFunction)
make_func_name = block.name() +'::make'
# Don't want to risk writing to output twice.
if make_func_name not in make_funcs:
make_funcs.add(make_func_name)
output.update(make_block2_entry(di, block))
except block.ParsingError:
sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
raise
# Create docstrings for functions
# Don't include the make functions since they have already been dealt with.
funcs = [f for f in di.in_category(DoxyFunction)
if f.name() not in make_funcs and not f.name().startswith('std::')]
for f in funcs:
try:
output.update(make_entry(f))
except f.ParsingError:
sys.stderr.write('Parsing error for function {0}\n'.format(f.name()))
# Create docstrings for classes
block_names = [block.name() for block in blocks]
block_names += [block.name() for block in blocks2]
klasses = [k for k in di.in_category(DoxyClass)
if k.name() not in block_names and not k.name().startswith('std::')]
for k in klasses:
try:
output.update(make_class_entry(k))
except k.ParsingError:
sys.stderr.write('Parsing error for class {0}\n'.format(k.name()))
# Docstrings are not created for anything that is not a function or a class.
# If this excludes anything important please add it here.
return output
def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_str=None):
if filter_str:
docstrings_dict = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str)}
with open(os.path.join(output_dir,'docstring_status'),'w') as status_file:
for pydoc_file in pydoc_files:
if filter_str:
filter_str2 = "::".join((filter_str,os.path.split(pydoc_file)[-1].split('_pydoc_template.h')[0]))
docstrings_dict2 = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2)}
else:
docstrings_dict2 = docstrings_dict
file_in = open(pydoc_file,'r').read()
for key, value in docstrings_dict2.items():
file_in_tmp = file_in
try:
doc_key = key.split("::")
# if 'gr' in doc_key:
# doc_key.remove('gr')
doc_key = '_'.join(doc_key)
regexp = r'(__doc_{} =\sR\"doc\()[^)]*(\)doc\")'.format(doc_key)
regexp = re.compile(regexp, re.MULTILINE)
(file_in, nsubs) = regexp.subn(r'\1'+value+r'\2', file_in, count=1)
if nsubs == 1:
status_file.write("PASS: " + pydoc_file + "\n")
except KeyboardInterrupt:
raise KeyboardInterrupt
except: # be permissive, TODO log, but just leave the docstring blank
status_file.write("FAIL: " + pydoc_file + "\n")
file_in = file_in_tmp
output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h'))
# FIXME: Remove this debug print
print('output docstrings to {}'.format(output_pathname))
with open(output_pathname,'w') as file_out:
file_out.write(file_in)
def copy_docstring_templates(pydoc_files, output_dir):
with open(os.path.join(output_dir,'docstring_status'),'w') as status_file:
for pydoc_file in pydoc_files:
file_in = open(pydoc_file,'r').read()
output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h'))
# FIXME: Remove this debug print
print('copy docstrings to {}'.format(output_pathname))
with open(output_pathname,'w') as file_out:
file_out.write(file_in)
status_file.write("DONE")
def argParse():
"""Parses commandline args."""
desc='Scrape the doxygen generated xml for docstrings to insert into python bindings'
parser = ArgumentParser(description=desc)
parser.add_argument("function", help="Operation to perform on docstrings", choices=["scrape","sub","copy"])
parser.add_argument("--xml_path")
parser.add_argument("--bindings_dir")
parser.add_argument("--output_dir")
parser.add_argument("--json_path")
parser.add_argument("--filter", default=None)
return parser.parse_args()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
args = argParse()
if args.function.lower() == 'scrape':
di = DoxyIndex(args.xml_path)
docstrings_dict = get_docstrings_dict(di)
with open(args.json_path, 'w') as fp:
json.dump(docstrings_dict, fp)
elif args.function.lower() == 'sub':
with open(args.json_path, 'r') as fp:
docstrings_dict = json.load(fp)
pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h'))
sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, args.output_dir, args.filter)
elif args.function.lower() == 'copy':
pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h'))
copy_docstring_templates(pydoc_files, args.output_dir)

15
gnuradio-osmosdr.pc.in Normal file
View File

@ -0,0 +1,15 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @CPACK_PACKAGE_NAME@
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
URL: http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
Version: @CPACK_PACKAGE_VERSION@
Requires: @GR_OSMOSDR_PC_REQUIRES@
Requires.private:
Conflicts:
Cflags: -I${includedir} @GR_OSMOSDR_PC_CFLAGS@
Libs: -L${libdir} -lgnuradio-osmosdr
Libs.private: @GR_OSMOSDR_PC_LIBS@

View File

@ -1,44 +1,45 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
# This file is part of GNU Radio
#
# gr-osmosdr is free software; you can redistribute it and/or modify
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# gr-osmosdr is distributed in the hope that it will be useful,
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-osmosdr; see the file COPYING. If not, write to
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Rules for generating the source and sink yml wrappers
# Rules for generating the source and sink xml wrappers
########################################################################
include(GrPython)
macro(GEN_BLOCK_YAML _generator _yaml_block)
macro(GEN_BLOCK_XML _generator _xml_block)
set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator})
set(yaml_block ${CMAKE_CURRENT_BINARY_DIR}/${_yaml_block})
list(APPEND yaml_blocks ${yaml_block})
set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block})
list(APPEND xml_blocks ${xml_block})
add_custom_command(
DEPENDS ${generator} OUTPUT ${yaml_block}
COMMAND ${PYTHON_EXECUTABLE} ${generator} ${yaml_block}
DEPENDS ${generator} OUTPUT ${xml_block}
COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block}
)
endmacro(GEN_BLOCK_YAML)
endmacro(GEN_BLOCK_XML)
GEN_BLOCK_YAML(gen_osmosdr_blocks.py rtlsdr_source.block.yml)
GEN_BLOCK_YAML(gen_osmosdr_blocks.py osmosdr_source.block.yml)
GEN_BLOCK_YAML(gen_osmosdr_blocks.py osmosdr_sink.block.yml)
GEN_BLOCK_XML(gen_osmosdr_blocks.py rtlsdr_source.xml)
GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_source.xml)
GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_sink.xml)
add_custom_target(osmosdr_grc_yaml_blocks ALL DEPENDS ${yaml_blocks})
add_custom_target(osmosdr_grc_xml_blocks ALL DEPENDS ${xml_blocks})
install(FILES
${yaml_blocks}
${xml_blocks}
# DESTINATION ${GRC_BLOCKS_DIR}
DESTINATION share/gnuradio/grc/blocks
)

View File

@ -19,386 +19,369 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
MAIN_TMPL = """\
id: ${prefix}_${sourk}
label: '${title} ${sourk.title()}'
category: '[OsmoSDR]'
flags: throttle
<?xml version="1.0"?>
<block>
<name>$(title) $sourk.title()</name>
<key>$(prefix)_$(sourk)</key>
<category>$($sourk.title())s</category>
<throttle>1</throttle>
<import>import osmosdr</import>
<make>osmosdr.$(sourk)( args="numchan=" + str(\$nchan) + " " + \$args )
self.\$(id).set_sample_rate(\$sample_rate)
#for $n in range($max_nchan)
\#if \$nchan() > $n
self.\$(id).set_center_freq(\$freq$(n), $n)
self.\$(id).set_freq_corr(\$corr$(n), $n)
#if $sourk == 'source':
self.\$(id).set_dc_offset_mode(\$dc_offset_mode$(n), $n)
self.\$(id).set_iq_balance_mode(\$iq_balance_mode$(n), $n)
self.\$(id).set_gain_mode(\$gain_mode$(n), $n)
#end if
self.\$(id).set_gain(\$gain$(n), $n)
self.\$(id).set_if_gain(\$if_gain$(n), $n)
self.\$(id).set_bb_gain(\$bb_gain$(n), $n)
self.\$(id).set_antenna(\$ant$(n), $n)
self.\$(id).set_bandwidth(\$bw$(n), $n)
\#end if
#end for
</make>
<callback>set_sample_rate(\$sample_rate)</callback>
#for $n in range($max_nchan)
<callback>set_center_freq(\$freq$(n), $n)</callback>
<callback>set_freq_corr(\$corr$(n), $n)</callback>
#if $sourk == 'source':
<callback>set_dc_offset_mode(\$dc_offset_mode$(n), $n)</callback>
<callback>set_iq_balance_mode(\$iq_balance_mode$(n), $n)</callback>
<callback>set_gain_mode(\$gain_mode$(n), $n)</callback>
#end if
<callback>set_gain(\$gain$(n), $n)</callback>
<callback>set_if_gain(\$if_gain$(n), $n)</callback>
<callback>set_bb_gain(\$bb_gain$(n), $n)</callback>
<callback>set_antenna(\$ant$(n), $n)</callback>
<callback>set_bandwidth(\$bw$(n), $n)</callback>
#end for
<param>
<name>$(dir.title())put Type</name>
<key>type</key>
<type>enum</type>
<option>
<name>Complex float32</name>
<key>fc32</key>
<opt>type:fc32</opt>
</option>
</param>
<param>
<name>Device Arguments</name>
<key>args</key>
<value></value>
<type>string</type>
<hide>
\#if \$args()
none
\#else
part
\#end if
</hide>
</param>
<param>
<name>Num Channels</name>
<key>nchan</key>
<value>1</value>
<type>int</type>
#for $n in range(1, $max_nchan+1)
<option>
<name>$(n)</name>
<key>$n</key>
</option>
#end for
</param>
<param>
<name>Sample Rate (sps)</name>
<key>sample_rate</key>
<value>samp_rate</value>
<type>real</type>
</param>
$params
<check>$max_nchan >= \$nchan</check>
<check>\$nchan > 0</check>
<$sourk>
<name>$dir</name>
<type>\$type.type</type>
<nports>\$nchan</nports>
</$sourk>
<doc>
The osmocom $sourk block:
parameters:
- id: type
label: '${direction.title()}put Type'
dtype: enum
options: [fc32]
option_labels: [Complex Float32]
option_attributes:
type: [fc32]
hide: part
- id: args
label: 'Device Arguments'
dtype: string
default: '""'
hide: ${'$'}{ 'none' if args else 'part'}
- id: sync
label: Sync
dtype: enum
options: [sync, pc_clock, none]
option_labels: [Unknown PPS, PC Clock, Don't Sync]
hide: ${'$'}{ 'none' if sync else 'part'}
- id: num_mboards
label: 'Number MBoards'
dtype: int
default: 1
options: [ ${", ".join([str(n) for n in range(1, max_mboards+1)])} ]
hide: part
% for m in range(max_mboards):
- id: clock_source${m}
label: 'MB${m}: Clock Source'
dtype: string
options: ['', internal, external, external_1pps, mimo, gpsdo]
option_labels: [Default, Internal, External, External 1PPS, MIMO Cable, O/B GPSDO]
hide: ${'$'}{ 'all' if not (num_mboards > ${m}) else ( 'none' if clock_source${m} else 'part' )}
- id: time_source${m}
label: 'MB${m}: Time Source'
dtype: string
options: ['', external, mimo, gpsdo]
option_labels: [Default, External, MIMO Cable, O/B GPSDO]
hide: ${'$'}{ 'all' if not (num_mboards > ${m}) else ( 'none' if time_source${m} else 'part' )}
% endfor
- id: nchan
label: 'Number Channels'
dtype: int
default: 1
options: [ ${", ".join([str(n) for n in range(1, max_nchan+1)])} ]
- id: sample_rate
label: 'Sample Rate (sps)'
dtype: real
default: samp_rate
${params}
While primarily being developed for the OsmoSDR hardware, this block as well supports:
inputs:
- domain: message
id: command
optional: true
% if sourk == 'source':
#if $sourk == 'source':
* FUNcube Dongle through libgnuradio-fcd
* FUNcube Dongle Pro+ through gr-fcdproplus
* sysmocom OsmoSDR Devices through libosmosdr
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* MSi2500 based DVB-T dongles through libmirisdr
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
* AirSpy Wideband Receiver through libairspy
#end if
* Great Scott Gadgets HackRF through libhackrf
* Nuand LLC bladeRF through libbladeRF library
* Ettus USRP Devices through Ettus UHD library
* Fairwaves UmTRX through Fairwaves' fork of UHD
outputs:
% endif
- domain: stream
dtype: ${'$'}{type.type}
multiplicity: ${'$'}{nchan}
% if sourk == 'sink':
By using the osmocom $sourk block you can take advantage of a common software api in your application(s) independent of the underlying radio hardware.
outputs:
- domain: message
id: async_msgs
optional: true
% endif
Output Type:
This parameter controls the data type of the stream in gnuradio. Only complex float32 samples are supported at the moment.
templates:
imports: |-
import osmosdr
import time
make: |
osmosdr.${sourk}(
args="numchan=" + str(${'$'}{nchan}) + " " + ${'$'}{args}
)
% for m in range(max_mboards):
${'%'} if context.get('num_mboards')() > ${m}:
${'%'} if context.get('clock_source${m}')():
self.${'$'}{id}.set_clock_source(${'$'}{${'clock_source' + str(m)}}, ${m})
${'%'} endif
${'%'} if context.get('time_source${m}')():
self.${'$'}{id}.set_time_source(${'$'}{${'time_source' + str(m)}}, ${m})
${'%'} endif
${'%'} endif
% endfor
${'%'} if sync == 'sync':
self.${'$'}{id}.set_time_unknown_pps(osmosdr.time_spec_t())
${'%'} elif sync == 'pc_clock':
self.${'$'}{id}.set_time_now(osmosdr.time_spec_t(time.time()), osmosdr.ALL_MBOARDS)
${'%'} endif
self.${'$'}{id}.set_sample_rate(${'$'}{sample_rate})
% for n in range(max_nchan):
${'%'} if context.get('nchan')() > ${n}:
self.${'$'}{id}.set_center_freq(${'$'}{${'freq' + str(n)}}, ${n})
self.${'$'}{id}.set_freq_corr(${'$'}{${'corr' + str(n)}}, ${n})
% if sourk == 'source':
self.${'$'}{id}.set_dc_offset_mode(${'$'}{${'dc_offset_mode' + str(n)}}, ${n})
self.${'$'}{id}.set_iq_balance_mode(${'$'}{${'iq_balance_mode' + str(n)}}, ${n})
self.${'$'}{id}.set_gain_mode(${'$'}{${'gain_mode' + str(n)}}, ${n})
% endif
self.${'$'}{id}.set_gain(${'$'}{${'gain' + str(n)}}, ${n})
self.${'$'}{id}.set_if_gain(${'$'}{${'if_gain' + str(n)}}, ${n})
self.${'$'}{id}.set_bb_gain(${'$'}{${'bb_gain' + str(n)}}, ${n})
self.${'$'}{id}.set_antenna(${'$'}{${'ant' + str(n)}}, ${n})
self.${'$'}{id}.set_bandwidth(${'$'}{${'bw' + str(n)}}, ${n})
${'%'} endif
% endfor
callbacks:
- set_sample_rate(${'$'}{sample_rate})
% for n in range(max_nchan):
- set_center_freq(${'$'}{${'freq' + str(n)}}, ${n})
- set_freq_corr(${'$'}{${'corr' + str(n)}}, ${n})
% if sourk == 'source':
- set_dc_offset_mode(${'$'}{${'dc_offset_mode' + str(n)}}, ${n})
- set_iq_balance_mode(${'$'}{${'iq_balance_mode' + str(n)}}, ${n})
- set_gain_mode(${'$'}{${'gain_mode' + str(n)}}, ${n})
% endif
- set_gain(${'$'}{${'gain' + str(n)}}, ${n})
- set_if_gain(${'$'}{${'if_gain' + str(n)}}, ${n})
- set_bb_gain(${'$'}{${'bb_gain' + str(n)}}, ${n})
- set_antenna(${'$'}{${'ant' + str(n)}}, ${n})
- set_bandwidth(${'$'}{${'bw' + str(n)}}, ${n})
% endfor
Device Arguments:
The device argument is a comma delimited string used to locate devices on your system. Device arguments for multiple devices may be given by separating them with a space.
Use the device id or name/serial (if applicable) to specify a certain device or list of devices. If left blank, the first device found will be used.
documentation: |-
The osmocom ${sourk} block:
Examples:
While primarily being developed for the OsmoSDR hardware, this block as well supports:
Optional arguments are placed into [] brackets, remove the brackets before using them! Specific variable values are separated with a |, choose one of them. Variable values containing spaces shall be enclosed in '' as demonstrated in examples section below.
Lines ending with ... mean it's possible to bind devices together by specifying multiple device arguments separated with a space.
% if sourk == 'source':
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* SDRplay RSP devices through SDRplay library
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
* AirSpy Wideband Receiver through libairspy
% endif
% if sourk == 'sink':
* gnuradio .cfile output through libgnuradio-blocks
% endif
* CCCamp 2015 rad1o Badge through libhackrf
* Great Scott Gadgets HackRF through libhackrf
* Nuand LLC bladeRF through libbladeRF library
* Ettus USRP Devices through Ettus UHD library
* Fairwaves XTRX through libxtrx
* Fairwaves UmTRX through Fairwaves' module for UHD
* Red Pitaya SDR transceiver (http://bazaar.redpitaya.com)
* FreeSRP through libfreesrp library
#if $sourk == 'source':
fcd=0[,device=hw:2][,type=2]
miri=0[,buffers=32] ...
rtl=serial_number ...
rtl=0[,rtl_xtal=28.8e6][,tuner_xtal=28.8e6] ...
rtl=1[,buffers=32][,buflen=N*512] ...
rtl=2[,direct_samp=0|1|2][,offset_tune=0|1] ...
rtl_tcp=127.0.0.1:1234[,psize=16384][,direct_samp=0|1|2][,offset_tune=0|1] ...
osmosdr=0[,buffers=32][,buflen=N*512] ...
file='/path/to/your file',rate=1e6[,freq=100e6][,repeat=true][,throttle=true] ...
netsdr=127.0.0.1[:50000][,nchan=2]
sdr-ip=127.0.0.1[:50000]
sdr-iq=/dev/ttyUSB0
airspy=0
#end if
hackrf=0[,buffers=32]
bladerf=0[,fpga='/path/to/the/bitstream.rbf']
uhd[,serial=...][,lo_offset=0][,mcr=52e6][,nchan=2][,subdev='\\\\'B:0 A:0\\\\''] ...
By using the osmocom $sourk block you can take advantage of a common software api in your application(s) independent of the underlying radio hardware.
Num Channels:
Selects the total number of channels in this multi-device configuration. Required when specifying multiple device arguments.
Output Type:
This parameter controls the data type of the stream in gnuradio. Only complex float32 samples are supported at the moment.
Sample Rate:
The sample rate is the number of samples per second output by this block on each channel.
Device Arguments:
The device argument is a comma delimited string used to locate devices on your system. Device arguments for multiple devices may be given by separating them with a space.
Use the device id or name/serial (if applicable) to specify a certain device or list of devices. If left blank, the first device found will be used.
Frequency:
The center frequency is the frequency the RF chain is tuned to.
Examples:
Freq. Corr.:
The frequency correction factor in parts per million (ppm). Set to 0 if unknown.
Optional arguments are placed into [] brackets, remove the brackets before using them! Specific variable values are separated with a |, choose one of them. Variable values containing spaces shall be enclosed in '' as demonstrated in examples section below.
Lines ending with ... mean it's possible to bind devices together by specifying multiple device arguments separated with a space.
#if $sourk == 'source':
DC Offset Mode:
Controls the behavior of hardware DC offset corrrection.
Off: Disable correction algorithm (pass through).
Manual: Keep last estimated correction when switched from Automatic to Manual.
Automatic: Periodicallly find the best solution to compensate for DC offset.
% if sourk == 'source':
rtl=serial_number ...
rtl=0[,rtl_xtal=28.8e6][,tuner_xtal=28.8e6] ...
rtl=1[,buffers=32][,buflen=N*512] ...
rtl=2[,direct_samp=0|1|2][,offset_tune=0|1][,bias=0|1] ...
rtl_tcp=127.0.0.1:1234[,psize=16384][,direct_samp=0|1|2][,offset_tune=0|1][,bias=0|1] ...
file='/path/to/your file',rate=1e6[,freq=100e6][,repeat=true][,throttle=true] ...
netsdr=127.0.0.1[:50000][,nchan=2]
sdr-ip=127.0.0.1[:50000]
cloudiq=127.0.0.1[:50000]
sdr-iq=/dev/ttyUSB0
airspy=0[,bias=0|1][,linearity][,sensitivity]
% endif
% if sourk == 'sink':
file='/path/to/your file',rate=1e6[,freq=100e6][,append=true][,throttle=true] ...
% endif
redpitaya=192.168.1.100[:1001]
freesrp=0[,fx3='path/to/fx3.img',fpga='path/to/fpga.bin',loopback]
hackrf=0[,buffers=32][,bias=0|1][,bias_tx=0|1]
bladerf=0[,tamer=internal|external|external_1pps][,smb=25e6]
uhd[,serial=...][,lo_offset=0][,mcr=52e6][,nchan=2][,subdev='\\\\'B:0 A:0\\\\''] ...
xtrx
This functionality is available for USRP devices only.
Num Channels:
Selects the total number of channels in this multi-device configuration. Required when specifying multiple device arguments.
IQ Balance Mode:
Controls the behavior of software IQ imbalance corrrection.
Off: Disable correction algorithm (pass through).
Manual: Keep last estimated correction when switched from Automatic to Manual.
Automatic: Periodicallly find the best solution to compensate for image signals.
Sample Rate:
The sample rate is the number of samples per second output by this block on each channel.
This functionality depends on http://cgit.osmocom.org/cgit/gr-iqbal/
Frequency:
The center frequency is the frequency the RF chain is tuned to.
Gain Mode:
Chooses between the manual (default) and automatic gain mode where appropriate.
To allow manual control of RF/IF/BB gain stages, manual gain mode must be configured.
Currently, only RTL-SDR devices support automatic gain mode.
Freq. Corr.:
The frequency correction factor in parts per million (ppm). Set to 0 if unknown.
#end if
RF Gain:
Overall RF gain of the device.
% if sourk == 'source':
DC Offset Mode:
Controls the behavior of hardware DC offset corrrection.
Off: Disable correction algorithm (pass through).
Manual: Keep last estimated correction when switched from Automatic to Manual.
Automatic: Periodicallly find the best solution to compensate for DC offset.
IF Gain:
Overall intermediate frequency gain of the device.
This setting is available for RTL-SDR and OsmoSDR devices with E4000 tuners and HackRF Jawbreaker in receive and transmit mode. Observations lead to a reasonable gain range from 15 to 30dB.
This functionality is available for USRP devices only.
BB Gain:
Overall baseband gain of the device.
This setting is available for HackRF Jawbreaker in receive mode. Observations lead to a reasonable gain range from 15 to 30dB.
IQ Balance Mode:
Controls the behavior of software IQ imbalance corrrection.
Off: Disable correction algorithm (pass through).
Manual: Keep last estimated correction when switched from Automatic to Manual.
Automatic: Periodicallly find the best solution to compensate for image signals.
Antenna:
For devices with only one antenna, this may be left blank.
Otherwise, the user should specify one of the possible antenna choices.
This functionality depends on http://cgit.osmocom.org/cgit/gr-iqbal/
Bandwidth:
Set the bandpass filter on the radio frontend. To use the default (automatic) bandwidth filter setting, this should be zero.
Gain Mode:
Chooses between the manual (default) and automatic gain mode where appropriate.
To allow manual control of RF/IF/BB gain stages, manual gain mode must be configured.
Currently, only RTL-SDR devices support automatic gain mode.
% endif
RF Gain:
Overall RF gain of the device.
IF Gain:
Overall intermediate frequency gain of the device.
This setting is available for RTL-SDR and OsmoSDR devices with E4000 tuners and HackRF in receive and transmit mode. Observations lead to a reasonable gain range from 15 to 30dB.
BB Gain:
Overall baseband gain of the device.
This setting is available for HackRF in receive mode. Observations lead to a reasonable gain range from 15 to 30dB.
Antenna:
For devices with only one antenna, this may be left blank.
Otherwise, the user should specify one of the possible antenna choices.
Bandwidth:
Set the bandpass filter on the radio frontend. To use the default (automatic) bandwidth filter setting, this should be zero.
See the OsmoSDR project page for more detailed documentation:
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
http://sdr.osmocom.org/trac/wiki/rtl-sdr
http://sdr.osmocom.org/trac/
file_format: 1
See the OsmoSDR project page for more detailed documentation:
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
http://sdr.osmocom.org/trac/wiki/rtl-sdr
http://sdr.osmocom.org/trac/
</doc>
</block>
"""
# MAIN_TMPL = """\
# <block>
# <check>$max_nchan >= \$nchan</check>
# <check>\$nchan > 0</check>
# <check>$max_mboards >= \$num_mboards</check>
# <check>\$num_mboards > 0</check>
# <check>\$nchan >= \$num_mboards</check>
# </block>
# """
PARAMS_TMPL = """
- id: freq${n}
label: 'Ch${n}: Frequency (Hz)'
dtype: real
default: 100e6
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: corr${n}
label: 'Ch${n}: Frequency Correction (ppm)'
dtype: real
default: 0
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
% if sourk == 'source':
- id: dc_offset_mode${n}
label: 'Ch${n}: DC Offset Mode'
dtype: int
default: 0
options: [0, 1, 2]
option_labels: [Off, Manual, Automatic]
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: iq_balance_mode${n}
label: 'Ch${n}: IQ Balance Mode'
dtype: int
default: 0
options: [0, 1, 2]
option_labels: [Off, Manual, Automatic]
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: gain_mode${n}
label: 'Ch${n}: Gain Mode'
dtype: bool
default: False
options: [False, True]
option_labels: [Manual, Automatic]
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
% endif
- id: gain${n}
label: 'Ch${n}: RF Gain (dB)'
dtype: real
default: 10
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: if_gain${n}
label: 'Ch${n}: IF Gain (dB)'
dtype: real
default: 20
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: bb_gain${n}
label: 'Ch${n}: BB Gain (dB)'
dtype: real
default: 20
hide: ${'$'}{'none' if (nchan > ${n}) else 'all'}
- id: ant${n}
label: 'Ch${n}: Antenna'
dtype: string
default: ""
hide: ${'$'}{'all' if not (nchan > ${n}) else ('none' if eval('ant' + str(${n})) else 'part')}
- id: bw${n}
label: 'Ch${n}: Bandwidth (Hz)'
dtype: real
default: 0
hide: ${'$'}{'all' if not (nchan > ${n}) else ('none' if eval('bw' + str(${n})) else 'part')}
<param>
<name>Ch$(n): Frequency (Hz)</name>
<key>freq$(n)</key>
<value>100e6</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
<name>Ch$(n): Freq. Corr. (ppm)</name>
<key>corr$(n)</key>
<value>0</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
#if $sourk == 'source':
<param>
<name>Ch$(n): DC Offset Mode</name>
<key>dc_offset_mode$(n)</key>
<value>0</value>
<type>int</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
<option>
<name>Off</name>
<key>0</key>
</option>
<option>
<name>Manual</name>
<key>1</key>
</option>
<option>
<name>Automatic</name>
<key>2</key>
</option>
</param>
<param>
<name>Ch$(n): IQ Balance Mode</name>
<key>iq_balance_mode$(n)</key>
<value>0</value>
<type>int</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
<option>
<name>Off</name>
<key>0</key>
</option>
<option>
<name>Manual</name>
<key>1</key>
</option>
<option>
<name>Automatic</name>
<key>2</key>
</option>
</param>
<param>
<name>Ch$(n): Gain Mode</name>
<key>gain_mode$(n)</key>
<value>0</value>
<type>int</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
<option>
<name>Manual</name>
<key>0</key>
</option>
<option>
<name>Automatic</name>
<key>1</key>
</option>
</param>
#end if
<param>
<name>Ch$(n): RF Gain (dB)</name>
<key>gain$(n)</key>
<value>10</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
<name>Ch$(n): IF Gain (dB)</name>
<key>if_gain$(n)</key>
<value>20</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
<name>Ch$(n): BB Gain (dB)</name>
<key>bb_gain$(n)</key>
<value>20</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
<name>Ch$(n): Antenna</name>
<key>ant$(n)</key>
<value></value>
<type>string</type>
<hide>
\#if not \$nchan() > $n
all
\#elif \$ant$(n)()
none
\#else
part
\#end if
</hide>
</param>
<param>
<name>Ch$(n): Bandwidth (Hz)</name>
<key>bw$(n)</key>
<value>0</value>
<type>real</type>
<hide>
\#if not \$nchan() > $n
all
\#elif \$bw$(n)()
none
\#else
part
\#end if
</hide>
</param>
"""
def parse_tmpl(_tmpl, **kwargs):
from mako.template import Template
from mako import exceptions
from Cheetah import Template
return str(Template.Template(_tmpl, kwargs))
try:
block_template = Template(_tmpl)
return str(block_template.render(**kwargs))
except:
print(exceptions.text_error_template().render())
MAX_NUM_MBOARDS = 8
MAX_NUM_CHANNELS = MAX_NUM_MBOARDS * 4
max_num_channels = 5
import os.path
if __name__ == '__main__':
import sys
import sys
for file in sys.argv[1:]:
head, tail = os.path.split(file)
for file in sys.argv[1:]:
head, tail = os.path.split(file)
if tail.startswith('rtlsdr'):
title = 'RTL-SDR'
prefix = 'rtlsdr'
elif tail.startswith('osmosdr'):
title = 'osmocom'
prefix = 'osmosdr'
else: raise Exception, 'file %s has wrong syntax!'%tail
if tail.startswith('rtlsdr'):
title = 'RTL-SDR'
prefix = 'rtlsdr'
elif tail.startswith('osmosdr'):
title = 'osmocom'
prefix = 'osmosdr'
else:
raise Exception("file {} has wrong syntax!".format(tail))
if tail.endswith ('source.xml'):
sourk = 'source'
dir = 'out'
elif tail.endswith ('sink.xml'):
sourk = 'sink'
dir = 'in'
else: raise Exception, 'is %s a source or sink?'%file
if tail.endswith('source.block.yml'):
sourk = 'source'
direction = 'out'
elif tail.endswith('sink.block.yml'):
sourk = 'sink'
direction = 'in'
else:
raise Exception("is {} a source or sink?".format(file))
params = ''.join([
parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk)
for n in range(MAX_NUM_CHANNELS)
])
open(file, 'w').write(
parse_tmpl(
MAIN_TMPL,
max_nchan=MAX_NUM_CHANNELS,
max_mboards=MAX_NUM_MBOARDS,
params=params,
title=title,
prefix=prefix,
sourk=sourk,
direction=direction,
)
)
params = ''.join([parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk) for n in range(max_num_channels)])
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
max_nchan=max_num_channels,
params=params,
title=title,
prefix=prefix,
sourk=sourk,
dir=dir,
))

View File

@ -1,19 +1,19 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
# This file is part of GNU Radio
#
# gr-osmosdr is free software; you can redistribute it and/or modify
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# gr-osmosdr is distributed in the hope that it will be useful,
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-osmosdr; see the file COPYING. If not, write to
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
@ -24,7 +24,6 @@ install(FILES
api.h
pimpl.h
ranges.h
time_spec.h
device.h
source.h
sink.h

View File

@ -18,7 +18,7 @@
#ifndef INCLUDED_OSMOSDR_PIMPL_H
#define INCLUDED_OSMOSDR_PIMPL_H
#include <memory>
#include <boost/shared_ptr.hpp>
/*! \file pimpl.h
* "Pimpl idiom" (pointer to implementation idiom).
@ -39,7 +39,7 @@
* \param _name the name of the pimpl class
*/
#define OSMOSDR_PIMPL_DECL(_name) \
struct _name; std::shared_ptr<_name>
struct _name; boost::shared_ptr<_name>
/*!
* Make an instance of a pimpl in a source file.
@ -49,6 +49,6 @@
* \param _args the constructor args for the pimpl
*/
#define OSMOSDR_PIMPL_MAKE(_name, _args) \
std::shared_ptr<_name>(new _name _args)
boost::shared_ptr<_name>(new _name _args)
#endif /* INCLUDED_OSMOSDR_PIMPL_H */

View File

@ -25,12 +25,6 @@
namespace osmosdr{
//! A wildcard motherboard index
static const size_t ALL_MBOARDS = size_t(~0);
//! A wildcard channel index
static const size_t ALL_CHANS = size_t(~0);
/*!
* A range object describes a set of discrete values of the form:
* y = start + step*n, where n is an integer between 0 and (stop - start)/step

View File

@ -0,0 +1,83 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; either version 3, or (at your option)
# any later version.
#
# GNU Radio 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Install public header files
########################################################################
install(FILES
gnuradio/blocks/api.h
gnuradio/blocks/null_sink.h
gnuradio/blocks/null_source.h
gnuradio/blocks/throttle.h
DESTINATION include/osmosdr/runtime/gnuradio/blocks
)
install(FILES
gnuradio/thread/thread.h
gnuradio/thread/thread_body_wrapper.h
gnuradio/thread/thread_group.h
DESTINATION include/osmosdr/runtime/gnuradio/thread
)
install(FILES
gnuradio/uhd/api.h
gnuradio/uhd/usrp_sink.h
gnuradio/uhd/usrp_source.h
DESTINATION include/osmosdr/runtime/gnuradio/uhd
)
install(FILES
gnuradio/api.h
gnuradio/attributes.h
gnuradio/basic_block.h
gnuradio/block.h
gnuradio/block_detail.h
gnuradio/block_gateway.h
gnuradio/block_registry.h
gnuradio/buffer.h
gnuradio/constants.h
gnuradio/endianness.h
gnuradio/expj.h
gnuradio/feval.h
gnuradio/flowgraph.h
gnuradio/fxpt.h
gnuradio/fxpt_nco.h
gnuradio/fxpt_vco.h
gnuradio/gr_complex.h
gnuradio/hier_block2.h
gnuradio/high_res_timer.h
gnuradio/io_signature.h
gnuradio/logger.h
gnuradio/math.h
gnuradio/misc.h
gnuradio/prefs.h
gnuradio/random.h
gnuradio/realtime.h
gnuradio/realtime_impl.h
gnuradio/runtime_types.h
gnuradio/sincos.h
gnuradio/sptr_magic.h
gnuradio/sync_block.h
gnuradio/sync_decimator.h
gnuradio/sync_interpolator.h
gnuradio/sys_paths.h
gnuradio/top_block.h
gnuradio/tpb_detail.h
gnuradio/types.h
DESTINATION include/osmosdr/runtime/gnuradio
)

View File

@ -0,0 +1,33 @@
/*
* Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_RUNTIME_API_H
#define INCLUDED_GR_RUNTIME_RUNTIME_API_H
#include <gnuradio/attributes.h>
#ifdef gnuradio_runtime_EXPORTS
# define GR_RUNTIME_API __GR_ATTR_EXPORT
#else
# define GR_RUNTIME_API __GR_ATTR_IMPORT
#endif
#endif /* INCLUDED_GR_RUNTIME_RUNTIME_API_H */

View File

@ -0,0 +1,74 @@
/*
* Copyright 2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GNURADIO_ATTRIBUTES_H
#define INCLUDED_GNURADIO_ATTRIBUTES_H
////////////////////////////////////////////////////////////////////////
// Cross-platform attribute macros
////////////////////////////////////////////////////////////////////////
#if defined __GNUC__
# define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
# define __GR_ATTR_UNUSED __attribute__((unused))
# define __GR_ATTR_INLINE __attribute__((always_inline))
# define __GR_ATTR_DEPRECATED __attribute__((deprecated))
# if __GNUC__ >= 4
# define __GR_ATTR_EXPORT __attribute__((visibility("default")))
# define __GR_ATTR_IMPORT __attribute__((visibility("default")))
# else
# define __GR_ATTR_EXPORT
# define __GR_ATTR_IMPORT
# endif
#elif _MSC_VER
# define __GR_ATTR_ALIGNED(x) __declspec(align(x))
# define __GR_ATTR_UNUSED
# define __GR_ATTR_INLINE __forceinline
# define __GR_ATTR_DEPRECATED __declspec(deprecated)
# define __GR_ATTR_EXPORT __declspec(dllexport)
# define __GR_ATTR_IMPORT __declspec(dllimport)
#else
# define __GR_ATTR_ALIGNED(x)
# define __GR_ATTR_UNUSED
# define __GR_ATTR_INLINE
# define __GR_ATTR_DEPRECATED
# define __GR_ATTR_EXPORT
# define __GR_ATTR_IMPORT
#endif
////////////////////////////////////////////////////////////////////////
// define inline when building C
////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
# define inline __inline
#endif
////////////////////////////////////////////////////////////////////////
// suppress warnings
////////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
# pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data
# pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float'
# pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
#endif /* INCLUDED_GNURADIO_ATTRIBUTES_H */

View File

@ -0,0 +1,209 @@
/* -*- c++ -*- */
/*
* Copyright 2006,2008,2009,2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_BASIC_BLOCK_H
#define INCLUDED_GR_BASIC_BLOCK_H
#include <gnuradio/api.h>
#include <gnuradio/sptr_magic.h>
#include <gnuradio/runtime_types.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/thread/thread.h>
#include <boost/enable_shared_from_this.hpp>
#include <boost/function.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/any.hpp>
#include <iostream>
#include <string>
#include <deque>
#include <map>
#ifdef GR_CTRLPORT
#include <gnuradio/rpcregisterhelpers.h>
#endif
namespace gr {
/*!
* \brief The abstract base class for all signal processing blocks.
* \ingroup internal
*
* Basic blocks are the bare abstraction of an entity that has a
* name, a set of inputs and outputs, and a message queue. These
* are never instantiated directly; rather, this is the abstract
* parent class of both gr_hier_block, which is a recursive
* container, and block, which implements actual signal
* processing functions.
*/
class GR_RUNTIME_API basic_block : public boost::enable_shared_from_this<basic_block>
{
private:
gr::thread::mutex mutex; //< protects all vars
protected:
friend class flowgraph;
friend class flat_flowgraph; // TODO: will be redundant
friend class tpb_thread_body;
enum vcolor { WHITE, GREY, BLACK };
std::string d_name;
gr::io_signature::sptr d_input_signature;
gr::io_signature::sptr d_output_signature;
long d_unique_id;
long d_symbolic_id;
std::string d_symbol_name;
std::string d_symbol_alias;
vcolor d_color;
bool d_rpc_set;
std::vector<boost::any> d_rpc_vars; // container for all RPC variables
basic_block(void) {} // allows pure virtual interface sub-classes
//! Protected constructor prevents instantiation by non-derived classes
basic_block(const std::string &name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature);
//! may only be called during constructor
void set_input_signature(gr::io_signature::sptr iosig) {
d_input_signature = iosig;
}
//! may only be called during constructor
void set_output_signature(gr::io_signature::sptr iosig) {
d_output_signature = iosig;
}
/*!
* \brief Allow the flowgraph to set for sorting and partitioning
*/
void set_color(vcolor color) { d_color = color; }
vcolor color() const { return d_color; }
public:
virtual ~basic_block();
long unique_id() const { return d_unique_id; }
long symbolic_id() const { return d_symbolic_id; }
std::string name() const { return d_name; }
std::string symbol_name() const { return d_symbol_name; }
gr::io_signature::sptr input_signature() const { return d_input_signature; }
gr::io_signature::sptr output_signature() const { return d_output_signature; }
basic_block_sptr to_basic_block(); // Needed for Python type coercion
bool alias_set() { return !d_symbol_alias.empty(); }
std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); }
void set_block_alias(std::string name);
#ifdef GR_CTRLPORT
/*!
* \brief Add an RPC variable (get or set).
*
* Using controlport, we create new getters/setters and need to
* store them. Each block has a vector to do this, and these never
* need to be accessed again once they are registered with the RPC
* backend. This function takes a
* boost::shared_sptr<rpcbasic_base> so that when the block is
* deleted, all RPC registered variables are cleaned up.
*
* \param s an rpcbasic_sptr of the new RPC variable register to store.
*/
void add_rpc_variable(rpcbasic_sptr s)
{
d_rpc_vars.push_back(s);
}
#endif /* GR_CTRLPORT */
/*!
* \brief Set up the RPC registered variables.
*
* This must be overloaded by a block that wants to use
* controlport. This is where rpcbasic_register_{get,set} pointers
* are created, which then get wrapped as shared pointers
* (rpcbasic_sptr(...)) and stored using add_rpc_variable.
*/
virtual void setup_rpc() {};
/*!
* \brief Ask if this block has been registered to the RPC.
*
* We can only register a block once, so we use this to protect us
* from calling it multiple times.
*/
bool is_rpc_set() { return d_rpc_set; }
/*!
* \brief When the block is registered with the RPC, set this.
*/
void rpc_set() { d_rpc_set = true; }
/*!
* \brief Confirm that ninputs and noutputs is an acceptable combination.
*
* \param ninputs number of input streams connected
* \param noutputs number of output streams connected
*
* \returns true if this is a valid configuration for this block.
*
* This function is called by the runtime system whenever the
* topology changes. Most classes do not need to override this.
* This check is in addition to the constraints specified by the
* input and output gr::io_signatures.
*/
virtual bool check_topology(int ninputs, int noutputs) {
(void)ninputs;
(void)noutputs;
return true;
}
virtual void set_processor_affinity(const std::vector<int> &mask)
{ throw std::runtime_error("set_processor_affinity not overloaded in child class."); }
virtual void unset_processor_affinity()
{ throw std::runtime_error("unset_processor_affinity not overloaded in child class."); }
virtual std::vector<int> processor_affinity()
{ throw std::runtime_error("processor_affinity not overloaded in child class."); }
};
inline bool operator<(basic_block_sptr lhs, basic_block_sptr rhs)
{
return lhs->unique_id() < rhs->unique_id();
}
typedef std::vector<basic_block_sptr> basic_block_vector_t;
typedef std::vector<basic_block_sptr>::iterator basic_block_viter_t;
GR_RUNTIME_API long basic_block_ncurrently_allocated();
inline std::ostream &operator << (std::ostream &os, basic_block_sptr basic_block)
{
os << basic_block->name() << "(" << basic_block->unique_id() << ")";
return os;
}
} /* namespace gr */
#endif /* INCLUDED_GR_BASIC_BLOCK_H */

View File

@ -0,0 +1,573 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2007,2009,2010,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_BLOCK_H
#define INCLUDED_GR_RUNTIME_BLOCK_H
#include <gnuradio/api.h>
#include <gnuradio/basic_block.h>
#include <gnuradio/logger.h>
namespace gr {
/*!
* \brief The abstract base class for all 'terminal' processing blocks.
* \ingroup base_blk
*
* A signal processing flow is constructed by creating a tree of
* hierarchical blocks, which at any level may also contain terminal
* nodes that actually implement signal processing functions. This
* is the base class for all such leaf nodes.
*
* Blocks have a set of input streams and output streams. The
* input_signature and output_signature define the number of input
* streams and output streams respectively, and the type of the data
* items in each stream.
*
* Although blocks may consume data on each input stream at a
* different rate, all outputs streams must produce data at the same
* rate. That rate may be different from any of the input rates.
*
* User derived blocks override two methods, forecast and
* general_work, to implement their signal processing
* behavior. forecast is called by the system scheduler to determine
* how many items are required on each input stream in order to
* produce a given number of output items.
*
* general_work is called to perform the signal processing in the
* block. It reads the input items and writes the output items.
*/
class GR_RUNTIME_API block : public basic_block
{
public:
//! Magic return values from general_work
enum {
WORK_CALLED_PRODUCE = -2,
WORK_DONE = -1
};
enum tag_propagation_policy_t {
TPP_DONT = 0,
TPP_ALL_TO_ALL = 1,
TPP_ONE_TO_ONE = 2
};
virtual ~block();
/*!
* Assume block computes y_i = f(x_i, x_i-1, x_i-2, x_i-3...)
* History is the number of x_i's that are examined to produce one y_i.
* This comes in handy for FIR filters, where we use history to
* ensure that our input contains the appropriate "history" for the
* filter. History should be equal to the number of filter taps.
*/
unsigned history() const { return d_history; }
void set_history(unsigned history) { d_history = history; }
/*!
* \brief Return true if this block has a fixed input to output rate.
*
* If true, then fixed_rate_in_to_out and fixed_rate_out_to_in may be called.
*/
bool fixed_rate() const { return d_fixed_rate; }
// ----------------------------------------------------------------
// override these to define your behavior
// ----------------------------------------------------------------
/*!
* \brief Estimate input requirements given output request
*
* \param noutput_items number of output items to produce
* \param ninput_items_required number of input items required on each input stream
*
* Given a request to product \p noutput_items, estimate the
* number of data items required on each input stream. The
* estimate doesn't have to be exact, but should be close.
*/
virtual void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
/*!
* \brief compute output items from input items
*
* \param noutput_items number of output items to write on each output stream
* \param ninput_items number of input items available on each input stream
* \param input_items vector of pointers to the input items, one entry per input stream
* \param output_items vector of pointers to the output items, one entry per output stream
*
* \returns number of items actually written to each output stream, or -1 on EOF.
* It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items
*
* general_work must call consume or consume_each to indicate how
* many items were consumed on each input stream.
*/
virtual int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
/*!
* \brief Called to enable drivers, etc for i/o devices.
*
* This allows a block to enable an associated driver to begin
* transfering data just before we start to execute the scheduler.
* The end result is that this reduces latency in the pipeline
* when dealing with audio devices, usrps, etc.
*/
virtual bool start();
/*!
* \brief Called to disable drivers, etc for i/o devices.
*/
virtual bool stop();
// ----------------------------------------------------------------
/*!
* \brief Constrain the noutput_items argument passed to forecast and general_work
*
* set_output_multiple causes the scheduler to ensure that the
* noutput_items argument passed to forecast and general_work will
* be an integer multiple of \param multiple The default value of
* output multiple is 1.
*/
void set_output_multiple(int multiple);
int output_multiple() const { return d_output_multiple; }
bool output_multiple_set() const { return d_output_multiple_set; }
/*!
* \brief Constrains buffers to work on a set item alignment (for SIMD)
*
* set_alignment_multiple causes the scheduler to ensure that the
* noutput_items argument passed to forecast and general_work will
* be an integer multiple of \param multiple The default value is
* 1.
*
* This control is similar to the output_multiple setting, except
* that if the number of items passed to the block is less than
* the output_multiple, this value is ignored and the block can
* produce like normal. The d_unaligned value is set to the number
* of items the block is off by. In the next call to general_work,
* the noutput_items is set to d_unaligned or less until
* d_unaligned==0. The buffers are now aligned again and the
* aligned calls can be performed again.
*/
void set_alignment(int multiple);
int alignment() const { return d_output_multiple; }
void set_unaligned(int na);
int unaligned() const { return d_unaligned; }
void set_is_unaligned(bool u);
bool is_unaligned() const { return d_is_unaligned; }
/*!
* \brief Tell the scheduler \p how_many_items of input stream \p
* which_input were consumed.
*/
void consume(int which_input, int how_many_items);
/*!
* \brief Tell the scheduler \p how_many_items were consumed on
* each input stream.
*/
void consume_each(int how_many_items);
/*!
* \brief Tell the scheduler \p how_many_items were produced on
* output stream \p which_output.
*
* If the block's general_work method calls produce, \p
* general_work must return WORK_CALLED_PRODUCE.
*/
void produce(int which_output, int how_many_items);
/*!
* \brief Set the approximate output rate / input rate
*
* Provide a hint to the buffer allocator and scheduler.
* The default relative_rate is 1.0
*
* decimators have relative_rates < 1.0
* interpolators have relative_rates > 1.0
*/
void set_relative_rate(double relative_rate);
/*!
* \brief return the approximate output rate / input rate
*/
double relative_rate() const { return d_relative_rate; }
/*
* The following two methods provide special case info to the
* scheduler in the event that a block has a fixed input to output
* ratio. sync_block, sync_decimator and
* sync_interpolator override these. If you're fixed rate,
* subclass one of those.
*/
/*!
* \brief Given ninput samples, return number of output samples that will be produced.
* N.B. this is only defined if fixed_rate returns true.
* Generally speaking, you don't need to override this.
*/
virtual int fixed_rate_ninput_to_noutput(int ninput);
/*!
* \brief Given noutput samples, return number of input samples required to produce noutput.
* N.B. this is only defined if fixed_rate returns true.
* Generally speaking, you don't need to override this.
*/
virtual int fixed_rate_noutput_to_ninput(int noutput);
/*!
* \brief Return the number of items read on input stream which_input
*/
uint64_t nitems_read(unsigned int which_input);
/*!
* \brief Return the number of items written on output stream which_output
*/
uint64_t nitems_written(unsigned int which_output);
/*!
* \brief Return the minimum number of output items this block can
* produce during a call to work.
*
* Should be 0 for most blocks. Useful if we're dealing with
* packets and the block produces one packet per call to work.
*/
int min_noutput_items() const { return d_min_noutput_items; }
/*!
* \brief Set the minimum number of output items this block can
* produce during a call to work.
*
* \param m the minimum noutput_items this block can produce.
*/
void set_min_noutput_items(int m) { d_min_noutput_items = m; }
/*!
* \brief Return the maximum number of output items this block will
* handle during a call to work.
*/
int max_noutput_items();
/*!
* \brief Set the maximum number of output items this block will
* handle during a call to work.
*
* \param m the maximum noutput_items this block will handle.
*/
void set_max_noutput_items(int m);
/*!
* \brief Clear the switch for using the max_noutput_items value of this block.
*
* When is_set_max_noutput_items() returns 'true', the scheduler
* will use the value returned by max_noutput_items() to limit the
* size of the number of items possible for this block's work
* function. If is_set_max_notput_items() returns 'false', then
* the scheduler ignores the internal value and uses the value set
* globally in the top_block.
*
* Use this value to clear the 'is_set' flag so the scheduler will
* ignore this. Use the set_max_noutput_items(m) call to both set
* a new value for max_noutput_items and to reenable its use in
* the scheduler.
*/
void unset_max_noutput_items();
/*!
* \brief Ask the block if the flag is or is not set to use the
* internal value of max_noutput_items during a call to work.
*/
bool is_set_max_noutput_items();
/*
* Used to expand the vectors that hold the min/max buffer sizes.
*
* Specifically, when -1 is used, the vectors are just initialized
* with 1 value; this is used by the flat_flowgraph to expand when
* required to add a new value for new ports on these blocks.
*/
void expand_minmax_buffer(int port);
/*!
* \brief Returns max buffer size on output port \p i.
*/
long max_output_buffer(size_t i);
/*!
* \brief Sets max buffer size on all output ports.
*/
void set_max_output_buffer(long max_output_buffer);
/*!
* \brief Sets max buffer size on output port \p port.
*/
void set_max_output_buffer(int port, long max_output_buffer);
/*!
* \brief Returns min buffer size on output port \p i.
*/
long min_output_buffer(size_t i);
/*!
* \brief Sets min buffer size on all output ports.
*/
void set_min_output_buffer(long min_output_buffer);
/*!
* \brief Sets min buffer size on output port \p port.
*/
void set_min_output_buffer(int port, long min_output_buffer);
// --------------- Performance counter functions -------------
/*!
* \brief Gets instantaneous noutput_items performance counter.
*/
float pc_noutput_items();
/*!
* \brief Gets average noutput_items performance counter.
*/
float pc_noutput_items_avg();
/*!
* \brief Gets variance of noutput_items performance counter.
*/
float pc_noutput_items_var();
/*!
* \brief Gets instantaneous num items produced performance counter.
*/
float pc_nproduced();
/*!
* \brief Gets average num items produced performance counter.
*/
float pc_nproduced_avg();
/*!
* \brief Gets variance of num items produced performance counter.
*/
float pc_nproduced_var();
/*!
* \brief Gets instantaneous fullness of \p which input buffer.
*/
float pc_input_buffers_full(int which);
/*!
* \brief Gets average fullness of \p which input buffer.
*/
float pc_input_buffers_full_avg(int which);
/*!
* \brief Gets variance of fullness of \p which input buffer.
*/
float pc_input_buffers_full_var(int which);
/*!
* \brief Gets instantaneous fullness of all input buffers.
*/
std::vector<float> pc_input_buffers_full();
/*!
* \brief Gets average fullness of all input buffers.
*/
std::vector<float> pc_input_buffers_full_avg();
/*!
* \brief Gets variance of fullness of all input buffers.
*/
std::vector<float> pc_input_buffers_full_var();
/*!
* \brief Gets instantaneous fullness of \p which input buffer.
*/
float pc_output_buffers_full(int which);
/*!
* \brief Gets average fullness of \p which input buffer.
*/
float pc_output_buffers_full_avg(int which);
/*!
* \brief Gets variance of fullness of \p which input buffer.
*/
float pc_output_buffers_full_var(int which);
/*!
* \brief Gets instantaneous fullness of all output buffers.
*/
std::vector<float> pc_output_buffers_full();
/*!
* \brief Gets average fullness of all output buffers.
*/
std::vector<float> pc_output_buffers_full_avg();
/*!
* \brief Gets variance of fullness of all output buffers.
*/
std::vector<float> pc_output_buffers_full_var();
/*!
* \brief Gets instantaneous clock cycles spent in work.
*/
float pc_work_time();
/*!
* \brief Gets average clock cycles spent in work.
*/
float pc_work_time_avg();
/*!
* \brief Gets average clock cycles spent in work.
*/
float pc_work_time_var();
/*!
* \brief Resets the performance counters
*/
void reset_perf_counters();
/*!
* \brief Sets up export of perf. counters to ControlPort. Only
* called by the scheduler.
*/
void setup_pc_rpc();
/*!
* \brief Checks if this block is already exporting perf. counters
* to ControlPort.
*/
bool is_pc_rpc_set() { return d_pc_rpc_set; }
/*!
* \brief If the block calls this in its constructor, it's
* perf. counters will not be exported.
*/
void no_pc_rpc() { d_pc_rpc_set = true; }
// ----------------------------------------------------------------------------
// Functions to handle thread affinity
/*!
* \brief Set the thread's affinity to processor core \p n.
*
* \param mask a vector of ints of the core numbers available to this block.
*/
void set_processor_affinity(const std::vector<int> &mask);
/*!
* \brief Remove processor affinity to a specific core.
*/
void unset_processor_affinity();
/*!
* \brief Get the current processor affinity.
*/
std::vector<int> processor_affinity() { return d_affinity; }
/*!
* \brief Get the current thread priority in use
*/
int active_thread_priority();
/*!
* \brief Get the current thread priority stored
*/
int thread_priority();
/*!
* \brief Set the current thread priority
*/
int set_thread_priority(int priority);
// ----------------------------------------------------------------------------
private:
int d_output_multiple;
bool d_output_multiple_set;
int d_unaligned;
bool d_is_unaligned;
double d_relative_rate; // approx output_rate / input_rate
block_detail_sptr d_detail; // implementation details
unsigned d_history;
bool d_fixed_rate;
bool d_max_noutput_items_set; // if d_max_noutput_items is valid
int d_max_noutput_items; // value of max_noutput_items for this block
int d_min_noutput_items;
std::vector<int> d_affinity; // thread affinity proc. mask
int d_priority; // thread priority level
bool d_pc_rpc_set;
protected:
block(void) {} // allows pure virtual interface sub-classes
block(const std::string &name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature);
void set_fixed_rate(bool fixed_rate) { d_fixed_rate = fixed_rate; }
std::vector<long> d_max_output_buffer;
std::vector<long> d_min_output_buffer;
/*! Used by block's setters and work functions to make
* setting/resetting of parameters thread-safe.
*
* Used by calling gr::thread::scoped_lock l(d_setlock);
*/
gr::thread::mutex d_setlock;
/*! Used by blocks to access the logger system.
*/
gr::logger_ptr d_logger;
gr::logger_ptr d_debug_logger;
// These are really only for internal use, but leaving them public avoids
// having to work up an ever-varying list of friend GR_RUNTIME_APIs
public:
block_detail_sptr detail() const { return d_detail; }
void set_detail(block_detail_sptr detail) { d_detail = detail; }
};
typedef std::vector<block_sptr> block_vector_t;
typedef std::vector<block_sptr>::iterator block_viter_t;
inline block_sptr cast_to_block_sptr(basic_block_sptr p)
{
return boost::dynamic_pointer_cast<block, basic_block>(p);
}
std::ostream&
operator << (std::ostream& os, const block *m);
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_BLOCK_H */

View File

@ -0,0 +1,207 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2009,2010,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more detail.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H
#define INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H
#include <gnuradio/api.h>
#include <gnuradio/runtime_types.h>
#include <gnuradio/tpb_detail.h>
#include <gnuradio/high_res_timer.h>
#include <stdexcept>
namespace gr {
/*!
* \brief Implementation details to support the signal processing abstraction
* \ingroup internal
*
* This class contains implementation detail that should be "out of
* sight" of almost all users of GNU Radio. This decoupling also
* means that we can make changes to the guts without having to
* recompile everything.
*/
class GR_RUNTIME_API block_detail
{
public:
~block_detail();
int ninputs() const { return d_ninputs; }
int noutputs() const { return d_noutputs; }
bool sink_p() const { return d_noutputs == 0; }
bool source_p() const { return d_ninputs == 0; }
void set_done(bool done);
bool done() const { return d_done; }
void set_input(unsigned int which, buffer_reader_sptr reader);
buffer_reader_sptr input(unsigned int which)
{
if(which >= d_ninputs)
throw std::invalid_argument("block_detail::input");
return d_input[which];
}
void set_output(unsigned int which, buffer_sptr buffer);
buffer_sptr output(unsigned int which)
{
if(which >= d_noutputs)
throw std::invalid_argument("block_detail::output");
return d_output[which];
}
/*!
* \brief Tell the scheduler \p how_many_items of input stream \p
* which_input were consumed.
*/
void consume(int which_input, int how_many_items);
/*!
* \brief Tell the scheduler \p how_many_items were consumed on
* each input stream.
*/
void consume_each(int how_many_items);
/*!
* \brief Tell the scheduler \p how_many_items were produced on
* output stream \p which_output.
*/
void produce(int which_output, int how_many_items);
/*!
* \brief Tell the scheduler \p how_many_items were produced on
* each output stream.
*/
void produce_each(int how_many_items);
// Return the number of items read on input stream which_input
uint64_t nitems_read(unsigned int which_input);
// Return the number of items written on output stream which_output
uint64_t nitems_written(unsigned int which_output);
/*!
* \brief Set core affinity of block to the cores in the vector
* mask.
*
* \param mask a vector of ints of the core numbers available to
* this block.
*/
void set_processor_affinity(const std::vector<int> &mask);
/*!
* \brief Unset core affinity.
*/
void unset_processor_affinity();
/*!
* \brief Get the current thread priority
*/
int thread_priority();
/*!
* \brief Set the current thread priority
*
* \param priority the new thread priority to set
*/
int set_thread_priority(int priority);
bool threaded; // set if thread is currently running.
gr::thread::gr_thread_t thread; // portable thread handle
void start_perf_counters();
void stop_perf_counters(int noutput_items, int nproduced);
void reset_perf_counters();
// Calls to get performance counter items
float pc_noutput_items();
float pc_nproduced();
float pc_input_buffers_full(size_t which);
std::vector<float> pc_input_buffers_full();
float pc_output_buffers_full(size_t which);
std::vector<float> pc_output_buffers_full();
float pc_work_time();
float pc_noutput_items_avg();
float pc_nproduced_avg();
float pc_input_buffers_full_avg(size_t which);
std::vector<float> pc_input_buffers_full_avg();
float pc_output_buffers_full_avg(size_t which);
std::vector<float> pc_output_buffers_full_avg();
float pc_work_time_avg();
float pc_noutput_items_var();
float pc_nproduced_var();
float pc_input_buffers_full_var(size_t which);
std::vector<float> pc_input_buffers_full_var();
float pc_output_buffers_full_var(size_t which);
std::vector<float> pc_output_buffers_full_var();
float pc_work_time_var();
tpb_detail d_tpb; // used by thread-per-block scheduler
int d_produce_or;
// ----------------------------------------------------------------------------
private:
unsigned int d_ninputs;
unsigned int d_noutputs;
std::vector<buffer_reader_sptr> d_input;
std::vector<buffer_sptr> d_output;
bool d_done;
// Performance counters
float d_ins_noutput_items;
float d_avg_noutput_items;
float d_var_noutput_items;
float d_ins_nproduced;
float d_avg_nproduced;
float d_var_nproduced;
std::vector<float> d_ins_input_buffers_full;
std::vector<float> d_avg_input_buffers_full;
std::vector<float> d_var_input_buffers_full;
std::vector<float> d_ins_output_buffers_full;
std::vector<float> d_avg_output_buffers_full;
std::vector<float> d_var_output_buffers_full;
gr::high_res_timer_type d_start_of_work, d_end_of_work;
float d_ins_work_time;
float d_avg_work_time;
float d_var_work_time;
float d_pc_counter;
block_detail(unsigned int ninputs, unsigned int noutputs);
friend struct tpb_detail;
friend GR_RUNTIME_API block_detail_sptr
make_block_detail(unsigned int ninputs, unsigned int noutputs);
};
GR_RUNTIME_API block_detail_sptr
make_block_detail(unsigned int ninputs, unsigned int noutputs);
GR_RUNTIME_API long
block_detail_ncurrently_allocated();
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_BLOCK_DETAIL_H */

View File

@ -0,0 +1,178 @@
/* -*- c++ -*- */
/*
* Copyright 2011-2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_RUNTIME_BLOCK_GATEWAY_H
#define INCLUDED_RUNTIME_BLOCK_GATEWAY_H
#include <gnuradio/api.h>
#include <gnuradio/block.h>
#include <gnuradio/feval.h>
namespace gr {
/*!
* The work type enum tells the gateway what kind of block to
* implement. The choices are familiar gnuradio block overloads
* (sync, decim, interp).
*/
enum block_gw_work_type {
GR_BLOCK_GW_WORK_GENERAL,
GR_BLOCK_GW_WORK_SYNC,
GR_BLOCK_GW_WORK_DECIM,
GR_BLOCK_GW_WORK_INTERP,
};
/*!
* Shared message structure between python and gateway.
* Each action type represents a scheduler-called function.
*/
struct block_gw_message_type {
enum action_type {
ACTION_GENERAL_WORK, //dispatch work
ACTION_WORK, //dispatch work
ACTION_FORECAST, //dispatch forecast
ACTION_START, //dispatch start
ACTION_STOP, //dispatch stop
};
action_type action;
int general_work_args_noutput_items;
std::vector<int> general_work_args_ninput_items;
std::vector<void *> general_work_args_input_items; //TODO this should be const void*, but swig cant int cast it right
std::vector<void *> general_work_args_output_items;
int general_work_args_return_value;
int work_args_ninput_items;
int work_args_noutput_items;
std::vector<void *> work_args_input_items; //TODO this should be const void*, but swig cant int cast it right
std::vector<void *> work_args_output_items;
int work_args_return_value;
int forecast_args_noutput_items;
std::vector<int> forecast_args_ninput_items_required;
bool start_args_return_value;
bool stop_args_return_value;
};
/*!
* The gateway block which performs all the magic.
*
* The gateway provides access to all the gr::block routines.
* The methods prefixed with gr::block__ are renamed
* to class methods without the prefix in python.
*/
class GR_RUNTIME_API block_gateway : virtual public gr::block
{
public:
// gr::block_gateway::sptr
typedef boost::shared_ptr<block_gateway> sptr;
/*!
* Make a new gateway block.
* \param handler the swig director object with callback
* \param name the name of the block (Ex: "Shirley")
* \param in_sig the input signature for this block
* \param out_sig the output signature for this block
* \param work_type the type of block overload to implement
* \param factor the decimation or interpolation factor
* \return a new gateway block
*/
static sptr make(gr::feval_ll *handler,
const std::string &name,
gr::io_signature::sptr in_sig,
gr::io_signature::sptr out_sig,
const block_gw_work_type work_type,
const unsigned factor);
//! Provide access to the shared message object
virtual block_gw_message_type &block_message(void) = 0;
long block__unique_id(void) const {
return gr::block::unique_id();
}
std::string block__name(void) const {
return gr::block::name();
}
unsigned block__history(void) const {
return gr::block::history();
}
void block__set_history(unsigned history) {
return gr::block::set_history(history);
}
void block__set_fixed_rate(bool fixed_rate) {
return gr::block::set_fixed_rate(fixed_rate);
}
bool block__fixed_rate(void) const {
return gr::block::fixed_rate();
}
void block__set_output_multiple(int multiple) {
return gr::block::set_output_multiple(multiple);
}
int block__output_multiple(void) const {
return gr::block::output_multiple();
}
void block__consume(int which_input, int how_many_items) {
return gr::block::consume(which_input, how_many_items);
}
void block__consume_each(int how_many_items) {
return gr::block::consume_each(how_many_items);
}
void block__produce(int which_output, int how_many_items) {
return gr::block::produce(which_output, how_many_items);
}
void block__set_relative_rate(double relative_rate) {
return gr::block::set_relative_rate(relative_rate);
}
double block__relative_rate(void) const {
return gr::block::relative_rate();
}
uint64_t block__nitems_read(unsigned int which_input) {
return gr::block::nitems_read(which_input);
}
uint64_t block__nitems_written(unsigned int which_output) {
return gr::block::nitems_written(which_output);
}
protected:
};
} /* namespace gr */
#endif /* INCLUDED_RUNTIME_BLOCK_GATEWAY_H */

View File

@ -0,0 +1,66 @@
/* -*- c++ -*- */
/*
* Copyright 2012-2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef GR_RUNTIME_BLOCK_REGISTRY_H
#define GR_RUNTIME_BLOCK_REGISTRY_H
#include <gnuradio/api.h>
#include <gnuradio/basic_block.h>
#include <map>
namespace gr {
#ifndef GR_BASIC_BLOCK_H
class basic_block;
class block;
#endif
class GR_RUNTIME_API block_registry
{
public:
block_registry();
long block_register(basic_block* block);
void block_unregister(basic_block* block);
std::string register_symbolic_name(basic_block* block);
void register_symbolic_name(basic_block* block, std::string name);
void register_primitive(std::string blk, gr::block* ref);
void unregister_primitive(std::string blk);
void notify_blk(std::string blk);
private:
//typedef std::map< long, basic_block_sptr > blocksubmap_t;
typedef std::map< long, basic_block* > blocksubmap_t;
typedef std::map< std::string, blocksubmap_t > blockmap_t;
blockmap_t d_map;
std::map< std::string, block*> primitive_map;
gr::thread::mutex d_mutex;
};
} /* namespace gr */
GR_RUNTIME_API extern gr::block_registry global_block_registry;
#endif /* GR_RUNTIME_BLOCK_REGISTRY_H */

View File

@ -0,0 +1,33 @@
/*
* Copyright 2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_BLOCKS_API_H
#define INCLUDED_BLOCKS_API_H
#include <gnuradio/attributes.h>
#ifdef gnuradio_blocks_EXPORTS
# define BLOCKS_API __GR_ATTR_EXPORT
#else
# define BLOCKS_API __GR_ATTR_IMPORT
#endif
#endif /* INCLUDED_BLOCKS_API_H */

View File

@ -0,0 +1,85 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_BLOCKS_FILE_SOURCE_H
#define INCLUDED_BLOCKS_FILE_SOURCE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace blocks {
/*!
* \brief Read stream from file
* \ingroup file_operators_blk
*/
class BLOCKS_API file_source : virtual public sync_block
{
public:
// gr::blocks::file_source::sptr
typedef boost::shared_ptr<file_source> sptr;
/*!
* \brief Create a file source.
*
* Opens \p filename as a source of items into a flowgraph. The
* data is expected to be in binary format, item after item. The
* \p itemsize of the block determines the conversion from bits
* to items.
*
* If \p repeat is turned on, the file will repeat the file after
* it's reached the end.
*
* \param itemsize the size of each item in the file, in bytes
* \param filename name of the file to source from
* \param repeat repeat file from start
*/
static sptr make(size_t itemsize, const char *filename, bool repeat = false);
/*!
* \brief seek file to \p seek_point relative to \p whence
*
* \param seek_point sample offset in file
* \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
*/
virtual bool seek(long seek_point, int whence) = 0;
/*!
* \brief Opens a new file.
*
* \param filename name of the file to source from
* \param repeat repeat file from start
*/
virtual void open(const char *filename, bool repeat) = 0;
/*!
* \brief Close the file handle.
*/
virtual void close() = 0;
};
} /* namespace blocks */
} /* namespace gr */
#endif /* INCLUDED_BLOCKS_FILE_SOURCE_H */

View File

@ -0,0 +1,55 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2010,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_NULL_SINK_H
#define INCLUDED_GR_NULL_SINK_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
#include <stddef.h> // size_t
namespace gr {
namespace blocks {
/*!
* \brief Bit bucket. Use as a termination point when a sink is
* required and we don't want to do anything real.
* \ingroup misc_blk
*/
class BLOCKS_API null_sink : virtual public sync_block
{
public:
// gr::blocks::null_sink::sptr
typedef boost::shared_ptr<null_sink> sptr;
/*!
* Build a null sink block.
*
* \param sizeof_stream_item size of the stream items in bytes.
*/
static sptr make(size_t sizeof_stream_item);
};
} /* namespace blocks */
} /* namespace gr */
#endif /* INCLUDED_GR_NULL_SINK_H */

View File

@ -0,0 +1,53 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2010,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_NULL_SOURCE_H
#define INCLUDED_GR_NULL_SOURCE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace blocks {
/*!
* \brief A source of zeros used mainly for testing.
* \ingroup misc_blk
*/
class BLOCKS_API null_source : virtual public sync_block
{
public:
// gr::blocks::null_source::sptr
typedef boost::shared_ptr<null_source> sptr;
/*!
* Build a null source block.
*
* \param sizeof_stream_item size of the stream items in bytes.
*/
static sptr make(size_t sizeof_stream_item);
};
} /* namespace blocks */
} /* namespace gr */
#endif /* INCLUDED_GR_NULL_SOURCE_H */

View File

@ -0,0 +1,63 @@
/* -*- c++ -*- */
/*
* Copyright 2005-2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_THROTTLE_H
#define INCLUDED_GR_THROTTLE_H
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace blocks {
/*!
* \brief throttle flow of samples such that the average rate does
* not exceed samples_per_sec.
* \ingroup misc_blk
*
* \details
* input: one stream of itemsize; output: one stream of itemsize
*
* N.B. this should only be used in GUI apps where there is no
* other rate limiting block. It is not intended nor effective at
* precisely controlling the rate of samples. That should be
* controlled by a source or sink tied to sample clock. E.g., a
* USRP or audio card.
*/
class BLOCKS_API throttle : virtual public sync_block
{
public:
typedef boost::shared_ptr<throttle> sptr;
static sptr make(size_t itemsize, double samples_per_sec);
//! Sets the sample rate in samples per second.
virtual void set_sample_rate(double rate) = 0;
//! Get the sample rate in samples per second.
virtual double sample_rate() const = 0;
};
} /* namespace blocks */
} /* namespace gr */
#endif /* INCLUDED_GR_THROTTLE_H */

View File

@ -0,0 +1,258 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2009-2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_BUFFER_H
#define INCLUDED_GR_RUNTIME_BUFFER_H
#include <gnuradio/api.h>
#include <gnuradio/runtime_types.h>
#include <boost/weak_ptr.hpp>
#include <gnuradio/thread/thread.h>
#include <deque>
namespace gr {
class vmcircbuf;
/*!
* \brief Allocate a buffer that holds at least \p nitems of size \p sizeof_item.
*
* The total size of the buffer will be rounded up to a system
* dependent boundary. This is typically the system page size, but
* under MS windows is 64KB.
*
* \param nitems is the minimum number of items the buffer will hold.
* \param sizeof_item is the size of an item in bytes.
* \param link is the block that writes to this buffer.
*/
GR_RUNTIME_API buffer_sptr make_buffer(int nitems, size_t sizeof_item,
block_sptr link=block_sptr());
/*!
* \brief Single writer, multiple reader fifo.
* \ingroup internal
*/
class GR_RUNTIME_API buffer
{
public:
virtual ~buffer();
/*!
* \brief return number of items worth of space available for writing
*/
int space_available();
/*!
* \brief return size of this buffer in items
*/
int bufsize() const { return d_bufsize; }
/*!
* \brief return pointer to write buffer.
*
* The return value points at space that can hold at least
* space_available() items.
*/
void *write_pointer();
/*!
* \brief tell buffer that we wrote \p nitems into it
*/
void update_write_pointer(int nitems);
void set_done(bool done);
bool done() const { return d_done; }
/*!
* \brief Return the block that writes to this buffer.
*/
block_sptr link() { return block_sptr(d_link); }
size_t nreaders() const { return d_readers.size(); }
buffer_reader* reader(size_t index) { return d_readers[index]; }
gr::thread::mutex *mutex() { return &d_mutex; }
uint64_t nitems_written() { return d_abs_write_offset; }
size_t get_sizeof_item() { return d_sizeof_item; }
// -------------------------------------------------------------------------
private:
friend class buffer_reader;
friend GR_RUNTIME_API buffer_sptr make_buffer(int nitems, size_t sizeof_item, block_sptr link);
friend GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link);
protected:
char *d_base; // base address of buffer
unsigned int d_bufsize; // in items
private:
gr::vmcircbuf *d_vmcircbuf;
size_t d_sizeof_item; // in bytes
std::vector<buffer_reader *> d_readers;
boost::weak_ptr<block> d_link; // block that writes to this buffer
//
// The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags
// and the d_read_index's and d_abs_read_offset's in the buffer readers.
//
gr::thread::mutex d_mutex;
unsigned int d_write_index; // in items [0,d_bufsize)
uint64_t d_abs_write_offset; // num items written since the start
bool d_done;
uint64_t d_last_min_items_read;
unsigned index_add(unsigned a, unsigned b)
{
unsigned s = a + b;
if(s >= d_bufsize)
s -= d_bufsize;
assert(s < d_bufsize);
return s;
}
unsigned index_sub(unsigned a, unsigned b)
{
int s = a - b;
if(s < 0)
s += d_bufsize;
assert((unsigned) s < d_bufsize);
return s;
}
virtual bool allocate_buffer(int nitems, size_t sizeof_item);
/*!
* \brief constructor is private. Use gr_make_buffer to create instances.
*
* Allocate a buffer that holds at least \p nitems of size \p sizeof_item.
*
* \param nitems is the minimum number of items the buffer will hold.
* \param sizeof_item is the size of an item in bytes.
* \param link is the block that writes to this buffer.
*
* The total size of the buffer will be rounded up to a system
* dependent boundary. This is typically the system page size, but
* under MS windows is 64KB.
*/
buffer(int nitems, size_t sizeof_item, block_sptr link);
/*!
* \brief disassociate \p reader from this buffer
*/
void drop_reader(buffer_reader *reader);
};
/*!
* \brief Create a new gr::buffer_reader and attach it to buffer \p buf
* \param buf is the buffer the \p gr::buffer_reader reads from.
* \param nzero_preload -- number of zero items to "preload" into buffer.
* \param link is the block that reads from the buffer using this gr::buffer_reader.
*/
GR_RUNTIME_API buffer_reader_sptr
buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link=block_sptr());
//! returns # of buffers currently allocated
GR_RUNTIME_API long buffer_ncurrently_allocated();
// ---------------------------------------------------------------------------
/*!
* \brief How we keep track of the readers of a gr::buffer.
* \ingroup internal
*/
class GR_RUNTIME_API buffer_reader
{
public:
~buffer_reader();
/*!
* \brief Return number of items available for reading.
*/
int items_available() const;
/*!
* \brief Return buffer this reader reads from.
*/
buffer_sptr buffer() const { return d_buffer; }
/*!
* \brief Return maximum number of items that could ever be available for reading.
* This is used as a sanity check in the scheduler to avoid looping forever.
*/
int max_possible_items_available() const { return d_buffer->d_bufsize - 1; }
/*!
* \brief return pointer to read buffer.
*
* The return value points to items_available() number of items
*/
const void *read_pointer();
/*
* \brief tell buffer we read \p items from it
*/
void update_read_pointer(int nitems);
void set_done(bool done) { d_buffer->set_done(done); }
bool done() const { return d_buffer->done(); }
gr::thread::mutex *mutex() { return d_buffer->mutex(); }
uint64_t nitems_read() { return d_abs_read_offset; }
size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); }
/*!
* \brief Return the block that reads via this reader.
*
*/
block_sptr link() { return block_sptr(d_link); }
// -------------------------------------------------------------------------
private:
friend class buffer;
friend GR_RUNTIME_API buffer_reader_sptr
buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link);
buffer_sptr d_buffer;
unsigned int d_read_index; // in items [0,d->buffer.d_bufsize)
uint64_t d_abs_read_offset; // num items seen since the start
boost::weak_ptr<block> d_link; // block that reads via this buffer reader
//! constructor is private. Use gr::buffer::add_reader to create instances
buffer_reader(buffer_sptr buffer, unsigned int read_index, block_sptr link);
};
//! returns # of buffer_readers currently allocated
GR_RUNTIME_API long buffer_reader_ncurrently_allocated ();
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_BUFFER_H */

View File

@ -0,0 +1,58 @@
/* -*- c++ -*- */
/*
* Copyright 2006,2009,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_CONSTANTS_H
#define INCLUDED_GR_CONSTANTS_H
#include <gnuradio/api.h>
#include <string>
namespace gr {
/*!
* \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc
*/
GR_RUNTIME_API const std::string prefix();
/*!
* \brief return SYSCONFDIR. Typically ${CMAKE_INSTALL_PREFIX}/etc or /etc
*/
GR_RUNTIME_API const std::string sysconfdir();
/*!
* \brief return preferences file directory. Typically ${SYSCONFDIR}/etc/conf.d
*/
GR_RUNTIME_API const std::string prefsdir();
/*!
* \brief return date/time of build, as set when 'cmake' is run
*/
GR_RUNTIME_API const std::string build_date();
/*!
* \brief return version string defined by cmake (GrVersion.cmake)
*/
GR_RUNTIME_API const std::string version();
} /* namespace gr */
#endif /* INCLUDED_GR_CONSTANTS_H */

View File

@ -0,0 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_ENDIANNESS_H
#define INCLUDED_GR_ENDIANNESS_H
namespace gr {
typedef enum {GR_MSB_FIRST, GR_LSB_FIRST} endianness_t;
} /* namespace gr */
#endif /* INCLUDED_GR_ENDIANNESS_H */

View File

@ -1,6 +1,8 @@
/* -*- c++ -*- */
/*
* Copyright 2017 Josh Blum <josh@joshknows.com>
* Copyright 2006 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,27 +19,20 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_EXPJ_H
#define INCLUDED_GR_EXPJ_H
#include "soapy_common.h"
#include <SoapySDR/Version.hpp>
#include <gnuradio/api.h>
#include <gnuradio/sincos.h>
#include <gnuradio/types.h>
osmosdr::gain_range_t soapy_range_to_gain_range(const SoapySDR::Range &r)
static inline gr_complex
gr_expj(float phase)
{
//default step size when unspecified
double step = 1.0;
//support the step size in 0.6 API and above
//but do not allow unspecified steps
//to avoid device by zero in some applications
#ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP
if (r.step() != 0.0) step = r.step();
#endif
return osmosdr::gain_range_t(r.minimum(), r.maximum(), step);
float t_imag, t_real;
gr::sincosf(phase, &t_imag, &t_real);
return gr_complex(t_real, t_imag);
}
std::mutex &get_soapy_maker_mutex(void)
{
static std::mutex m;
return m;
}
#endif /* INCLUDED_GR_EXPJ_H */

View File

@ -0,0 +1,186 @@
/* -*- c++ -*- */
/*
* Copyright 2006,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_FEVAL_H
#define INCLUDED_GR_FEVAL_H
#include <gnuradio/api.h>
#include <gnuradio/gr_complex.h>
namespace gr {
/*!
* \brief base class for evaluating a function: double -> double
* \ingroup misc
*
* This class is designed to be subclassed in Python or C++ and is
* callable from both places. It uses SWIG's "director" feature to
* implement the magic.
*
* It's slow. Don't use it in a performance critical path.
*
* Override eval to define the behavior.
* Use calleval to invoke eval (this kludge is required to allow a
* python specific "shim" to be inserted.
*/
class GR_RUNTIME_API feval_dd
{
protected:
/*!
* \brief override this to define the function
*/
virtual double eval(double x);
public:
feval_dd() {}
virtual ~feval_dd();
virtual double calleval(double x); // invoke "eval"
};
/*!
* \brief base class for evaluating a function: complex -> complex
* \ingroup misc
*
* This class is designed to be subclassed in Python or C++ and is
* callable from both places. It uses SWIG's "director" feature to
* implement the magic.
*
* It's slow. Don't use it in a performance critical path.
*
* Override eval to define the behavior.
* Use calleval to invoke eval (this kludge is required to allow a
* python specific "shim" to be inserted.
*/
class GR_RUNTIME_API feval_cc
{
protected:
/*!
* \brief override this to define the function
*/
virtual gr_complex eval(gr_complex x);
public:
feval_cc() {}
virtual ~feval_cc();
virtual gr_complex calleval(gr_complex x); // invoke "eval"
};
/*!
* \brief base class for evaluating a function: long -> long
* \ingroup misc
*
* This class is designed to be subclassed in Python or C++ and is
* callable from both places. It uses SWIG's "director" feature to
* implement the magic.
*
* It's slow. Don't use it in a performance critical path.
*
* Override eval to define the behavior.
* Use calleval to invoke eval (this kludge is required to allow a
* python specific "shim" to be inserted.
*/
class GR_RUNTIME_API feval_ll
{
protected:
/*!
* \brief override this to define the function
*/
virtual long eval(long x);
public:
feval_ll() {}
virtual ~feval_ll();
virtual long calleval(long x); // invoke "eval"
};
/*!
* \brief base class for evaluating a function: void -> void
* \ingroup misc
*
* This class is designed to be subclassed in Python or C++ and is
* callable from both places. It uses SWIG's "director" feature to
* implement the magic.
*
* It's slow. Don't use it in a performance critical path.
*
* Override eval to define the behavior.
* Use calleval to invoke eval (this kludge is required to allow a
* python specific "shim" to be inserted.
*/
class GR_RUNTIME_API feval
{
protected:
/*!
* \brief override this to define the function
*/
virtual void eval();
public:
feval() {}
virtual ~feval();
virtual void calleval(); // invoke "eval"
};
/*!
* \brief base class for evaluating a function: pmt -> void
* \ingroup misc
*
* This class is designed to be subclassed in Python or C++ and is
* callable from both places. It uses SWIG's "director" feature to
* implement the magic.
*
* It's slow. Don't use it in a performance critical path.
*
* Override eval to define the behavior.
* Use calleval to invoke eval (this kludge is required to allow a
* python specific "shim" to be inserted.
*/
class GR_RUNTIME_API feval_p
{
protected:
/*!
* \brief override this to define the function
*/
virtual void eval(double);
public:
feval_p() {}
virtual ~feval_p();
virtual void calleval(double); // invoke "eval"
};
/*!
* \brief trivial examples / test cases showing C++ calling Python code
*/
GR_RUNTIME_API double feval_dd_example(feval_dd *f, double x);
GR_RUNTIME_API gr_complex feval_cc_example(feval_cc *f, gr_complex x);
GR_RUNTIME_API long feval_ll_example(feval_ll *f, long x);
GR_RUNTIME_API void feval_example(feval *f);
} /* namespace gr */
#endif /* INCLUDED_GR_FEVAL_H */

View File

@ -0,0 +1,194 @@
/* -*- c++ -*- */
/*
* Copyright 2006,2007,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_FLOWGRAPH_H
#define INCLUDED_GR_RUNTIME_FLOWGRAPH_H
#include <gnuradio/api.h>
#include <gnuradio/basic_block.h>
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
/*!
* \brief Class representing a specific input or output graph endpoint
* \ingroup internal
*/
class GR_RUNTIME_API endpoint
{
private:
basic_block_sptr d_basic_block;
int d_port;
public:
endpoint() : d_basic_block(), d_port(0) { }
endpoint(basic_block_sptr block, int port) { d_basic_block = block; d_port = port; }
basic_block_sptr block() const { return d_basic_block; }
int port() const { return d_port; }
bool operator==(const endpoint &other) const;
};
inline bool endpoint::operator==(const endpoint &other) const
{
return (d_basic_block == other.d_basic_block &&
d_port == other.d_port);
}
// Hold vectors of gr::endpoint objects
typedef std::vector<endpoint> endpoint_vector_t;
typedef std::vector<endpoint>::iterator endpoint_viter_t;
/*!
*\brief Class representing a connection between to graph endpoints
*/
class GR_RUNTIME_API edge
{
public:
edge() : d_src(), d_dst() { };
edge(const endpoint &src, const endpoint &dst)
: d_src(src), d_dst(dst) { }
~edge();
const endpoint &src() const { return d_src; }
const endpoint &dst() const { return d_dst; }
private:
endpoint d_src;
endpoint d_dst;
};
// Hold vectors of gr::edge objects
typedef std::vector<edge> edge_vector_t;
typedef std::vector<edge>::iterator edge_viter_t;
// Create a shared pointer to a heap allocated flowgraph
// (types defined in runtime_types.h)
GR_RUNTIME_API flowgraph_sptr make_flowgraph();
/*!
* \brief Class representing a directed, acyclic graph of basic blocks
* \ingroup internal
*/
class GR_RUNTIME_API flowgraph
{
public:
friend GR_RUNTIME_API flowgraph_sptr make_flowgraph();
// Destruct an arbitrary flowgraph
~flowgraph();
// Connect two endpoints
void connect(const endpoint &src, const endpoint &dst);
// Disconnect two endpoints
void disconnect(const endpoint &src, const endpoint &dst);
// Connect an output port to an input port (convenience)
void connect(basic_block_sptr src_block, int src_port,
basic_block_sptr dst_block, int dst_port);
// Disconnect an input port from an output port (convenience)
void disconnect(basic_block_sptr src_block, int src_port,
basic_block_sptr dst_block, int dst_port);
// Validate connectivity, raise exception if invalid
void validate();
// Clear existing flowgraph
void clear();
// Return vector of edges
const edge_vector_t &edges() const { return d_edges; }
// Return vector of connected blocks
basic_block_vector_t calc_used_blocks();
// Return toplogically sorted vector of blocks. All the sources come first.
basic_block_vector_t topological_sort(basic_block_vector_t &blocks);
// Return vector of vectors of disjointly connected blocks,
// topologically sorted.
std::vector<basic_block_vector_t> partition();
protected:
basic_block_vector_t d_blocks;
edge_vector_t d_edges;
flowgraph();
std::vector<int> calc_used_ports(basic_block_sptr block, bool check_inputs);
basic_block_vector_t calc_downstream_blocks(basic_block_sptr block, int port);
edge_vector_t calc_upstream_edges(basic_block_sptr block);
bool has_block_p(basic_block_sptr block);
edge calc_upstream_edge(basic_block_sptr block, int port);
private:
void check_valid_port(gr::io_signature::sptr sig, int port);
void check_dst_not_used(const endpoint &dst);
void check_type_match(const endpoint &src, const endpoint &dst);
edge_vector_t calc_connections(basic_block_sptr block, bool check_inputs); // false=use outputs
void check_contiguity(basic_block_sptr block, const std::vector<int> &used_ports, bool check_inputs);
basic_block_vector_t calc_downstream_blocks(basic_block_sptr block);
basic_block_vector_t calc_reachable_blocks(basic_block_sptr block, basic_block_vector_t &blocks);
void reachable_dfs_visit(basic_block_sptr block, basic_block_vector_t &blocks);
basic_block_vector_t calc_adjacent_blocks(basic_block_sptr block, basic_block_vector_t &blocks);
basic_block_vector_t sort_sources_first(basic_block_vector_t &blocks);
bool source_p(basic_block_sptr block);
void topological_dfs_visit(basic_block_sptr block, basic_block_vector_t &output);
};
// Convenience functions
inline
void flowgraph::connect(basic_block_sptr src_block, int src_port,
basic_block_sptr dst_block, int dst_port)
{
connect(endpoint(src_block, src_port),
endpoint(dst_block, dst_port));
}
inline
void flowgraph::disconnect(basic_block_sptr src_block, int src_port,
basic_block_sptr dst_block, int dst_port)
{
disconnect(endpoint(src_block, src_port),
endpoint(dst_block, dst_port));
}
inline std::ostream&
operator <<(std::ostream &os, const endpoint endp)
{
os << endp.block()->alias() << ":" << endp.port();
return os;
}
inline std::ostream&
operator <<(std::ostream &os, const edge edge)
{
os << edge.src() << "->" << edge.dst();
return os;
}
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_FLOWGRAPH_H */

View File

@ -0,0 +1,108 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_FXPT_H
#define INCLUDED_GR_FXPT_H
#include <gnuradio/api.h>
#include <gnuradio/types.h>
namespace gr {
/*!
* \brief fixed point sine and cosine and friends.
* \ingroup misc
*
* fixed pt radians
* --------- --------
* -2**31 -pi
* 0 0
* 2**31-1 pi - epsilon
*/
class GR_RUNTIME_API fxpt
{
static const int WORDBITS = 32;
static const int NBITS = 10;
static const float s_sine_table[1 << NBITS][2];
static const float PI;
static const float TWO_TO_THE_31;
public:
static gr_int32
float_to_fixed(float x)
{
// Fold x into -PI to PI.
int d = (int)floor(x/2/PI+0.5);
x -= d*2*PI;
// And convert to an integer.
return (gr_int32) ((float) x * TWO_TO_THE_31 / PI);
}
static float
fixed_to_float (gr_int32 x)
{
return x * (PI / TWO_TO_THE_31);
}
/*!
* \brief Given a fixed point angle x, return float sine (x)
*/
static float
sin(gr_int32 x)
{
gr_uint32 ux = x;
int index = ux >> (WORDBITS - NBITS);
return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
}
/*
* \brief Given a fixed point angle x, return float cosine (x)
*/
static float
cos (gr_int32 x)
{
gr_uint32 ux = x + 0x40000000;
int index = ux >> (WORDBITS - NBITS);
return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
}
/*
* \brief Given a fixedpoint angle x, return float cos(x) and sin (x)
*/
static void sincos(gr_int32 x, float *s, float *c)
{
gr_uint32 ux = x;
int sin_index = ux >> (WORDBITS - NBITS);
*s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1];
ux = x + 0x40000000;
int cos_index = ux >> (WORDBITS - NBITS);
*c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1];
return;
}
};
} /* namespace gr */
#endif /* INCLUDED_GR_FXPT_H */

View File

@ -0,0 +1,160 @@
/* -*- c++ -*- */
/*
* Copyright 2002,2004,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_FXPT_NCO_H
#define INCLUDED_GR_FXPT_NCO_H
#include <gnuradio/api.h>
#include <gnuradio/fxpt.h>
#include <gnuradio/gr_complex.h>
#include <stdint.h>
namespace gr {
/*!
* \brief Numerically Controlled Oscillator (NCO)
* \ingroup misc
*/
class /*GR_RUNTIME_API*/ fxpt_nco
{
uint32_t d_phase;
int32_t d_phase_inc;
public:
fxpt_nco() : d_phase(0), d_phase_inc(0) {}
~fxpt_nco() {}
// radians
void set_phase(float angle) {
d_phase = gr::fxpt::float_to_fixed(angle);
}
void adjust_phase(float delta_phase) {
d_phase += gr::fxpt::float_to_fixed(delta_phase);
}
// angle_rate is in radians / step
void set_freq(float angle_rate){
d_phase_inc = gr::fxpt::float_to_fixed(angle_rate);
}
// angle_rate is a delta in radians / step
void adjust_freq(float delta_angle_rate)
{
d_phase_inc += gr::fxpt::float_to_fixed(delta_angle_rate);
}
// increment current phase angle
void step()
{
d_phase += d_phase_inc;
}
void step(int n)
{
d_phase += d_phase_inc * n;
}
// units are radians / step
float get_phase() const { return gr::fxpt::fixed_to_float(d_phase); }
float get_freq() const { return gr::fxpt::fixed_to_float(d_phase_inc); }
// compute sin and cos for current phase angle
void sincos(float *sinx, float *cosx) const
{
*sinx = gr::fxpt::sin(d_phase);
*cosx = gr::fxpt::cos(d_phase);
}
// compute cos and sin for a block of phase angles
void sincos(gr_complex *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = gr_complex(gr::fxpt::cos(d_phase) * ampl, gr::fxpt::sin(d_phase) * ampl);
step();
}
}
// compute sin for a block of phase angles
void sin(float *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (float)(gr::fxpt::sin(d_phase) * ampl);
step();
}
}
// compute cos for a block of phase angles
void cos(float *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (float)(gr::fxpt::cos(d_phase) * ampl);
step ();
}
}
// compute sin for a block of phase angles
void sin(short *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (short)(gr::fxpt::sin(d_phase) * ampl);
step();
}
}
// compute cos for a block of phase angles
void cos(short *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (short)(gr::fxpt::cos(d_phase) * ampl);
step();
}
}
// compute sin for a block of phase angles
void sin(int *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (int)(gr::fxpt::sin(d_phase) * ampl);
step();
}
}
// compute cos for a block of phase angles
void cos(int *output, int noutput_items, double ampl=1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (int)(gr::fxpt::cos(d_phase) * ampl);
step();
}
}
// compute cos or sin for current phase angle
float cos() const { return gr::fxpt::cos(d_phase); }
float sin() const { return gr::fxpt::sin(d_phase); }
};
} /* namespace gr */
#endif /* INCLUDED_GR_FXPT_NCO_H */

View File

@ -0,0 +1,80 @@
/* -*- c++ -*- */
/*
* Copyright 2002,2004,2005,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_FXPT_VCO_H
#define INCLUDED_GR_FXPT_VCO_H
#include <gnuradio/api.h>
#include <gnuradio/fxpt.h>
#include <gnuradio/gr_complex.h>
namespace gr {
/*!
* \brief Voltage Controlled Oscillator (VCO)
* \ingroup misc
*/
class /*GR_RUNTIME_API*/ fxpt_vco {
gr_int32 d_phase;
public:
fxpt_vco () : d_phase(0) {}
~fxpt_vco() {}
// radians
void set_phase(float angle) {
d_phase = fxpt::float_to_fixed(angle);
}
void adjust_phase(float delta_phase) {
d_phase += fxpt::float_to_fixed(delta_phase);
}
float get_phase() const {
return fxpt::fixed_to_float(d_phase);
}
// compute sin and cos for current phase angle
void sincos(float *sinx, float *cosx) const
{
*sinx = fxpt::sin(d_phase);
*cosx = fxpt::cos(d_phase);
}
// compute a block at a time
void cos(float *output, const float *input, int noutput_items, float k, float ampl = 1.0)
{
for(int i = 0; i < noutput_items; i++) {
output[i] = (float)(fxpt::cos(d_phase) * ampl);
adjust_phase(input[i] * k);
}
}
// compute cos or sin for current phase angle
float cos() const { return fxpt::cos(d_phase); }
float sin() const { return fxpt::sin(d_phase); }
};
} /* namespace gr */
#endif /* INCLUDED_GR_FXPT_VCO_H */

View File

@ -0,0 +1,45 @@
/* -*- c++ -*- */
/*
* Copyright 2004 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_COMPLEX_H
#define INCLUDED_GR_COMPLEX_H
#include <complex>
typedef std::complex<float> gr_complex;
typedef std::complex<double> gr_complexd;
inline bool is_complex (gr_complex x) { (void) x; return true;}
inline bool is_complex (gr_complexd x) { (void) x; return true;}
inline bool is_complex (float x) { (void) x; return false;}
inline bool is_complex (double x) { (void) x; return false;}
inline bool is_complex (int x) { (void) x; return false;}
inline bool is_complex (char x) { (void) x; return false;}
inline bool is_complex (short x) { (void) x; return false;}
// this doesn't really belong here, but there are worse places for it...
#define CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected,actual,delta) \
CPPUNIT_ASSERT_DOUBLES_EQUAL (expected.real(), actual.real(), delta); \
CPPUNIT_ASSERT_DOUBLES_EQUAL (expected.imag(), actual.imag(), delta);
#endif /* INCLUDED_GR_COMPLEX_H */

View File

@ -0,0 +1,192 @@
/* -*- c++ -*- */
/*
* Copyright 2006-2009,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_RUNTIME_HIER_BLOCK2_H
#define INCLUDED_GR_RUNTIME_HIER_BLOCK2_H
#include <gnuradio/api.h>
#include <gnuradio/basic_block.h>
namespace gr {
/*!
* \brief public constructor for hier_block2
*/
GR_RUNTIME_API hier_block2_sptr
make_hier_block2(const std::string &name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature);
class hier_block2_detail;
/*!
* \brief Hierarchical container class for gr::block's and gr::hier_block2's
* \ingroup container_blk
* \ingroup base_blk
*/
class GR_RUNTIME_API hier_block2 : public basic_block
{
private:
friend class hier_block2_detail;
friend GR_RUNTIME_API hier_block2_sptr
make_hier_block2(const std::string &name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature);
/*!
* \brief Private implementation details of gr::hier_block2
*/
hier_block2_detail *d_detail;
protected:
hier_block2(void) {} // allows pure virtual interface sub-classes
hier_block2(const std::string &name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature);
public:
virtual ~hier_block2();
/*!
* \brief typedef for object returned from self().
*
* This type is only guaranteed to be passable to connect and
* disconnect. No other assumptions should be made about it.
*/
typedef basic_block_sptr opaque_self;
/*!
* \brief Return an object, representing the current block, which
* can be passed to connect.
*
* The returned object may only be used as an argument to connect
* or disconnect. Any other use of self() results in unspecified
* (erroneous) behavior.
*/
opaque_self self();
/*!
* \brief Add a stand-alone (possibly hierarchical) block to
* internal graph
*
* This adds a gr-block or hierarchical block to the internal
* graph without wiring it to anything else.
*/
void connect(basic_block_sptr block);
/*!
* \brief Add gr-blocks or hierarchical blocks to internal graph
* and wire together
*
* This adds (if not done earlier by another connect) a pair of
* gr-blocks or hierarchical blocks to the internal flowgraph, and
* wires the specified output port to the specified input port.
*/
void connect(basic_block_sptr src, int src_port,
basic_block_sptr dst, int dst_port);
/*!
* \brief Remove a gr-block or hierarchical block from the
* internal flowgraph.
*
* This removes a gr-block or hierarchical block from the internal
* flowgraph, disconnecting it from other blocks as needed.
*/
void disconnect(basic_block_sptr block);
/*!
* \brief Disconnect a pair of gr-blocks or hierarchical blocks in
* internal flowgraph.
*
* This disconnects the specified input port from the specified
* output port of a pair of gr-blocks or hierarchical blocks.
*/
void disconnect(basic_block_sptr src, int src_port,
basic_block_sptr dst, int dst_port);
/*!
* \brief Disconnect all connections in the internal flowgraph.
*
* This call removes all output port to input port connections in
* the internal flowgraph.
*/
void disconnect_all();
/*!
* Lock a flowgraph in preparation for reconfiguration. When an
* equal number of calls to lock() and unlock() have occurred, the
* flowgraph will be reconfigured.
*
* N.B. lock() and unlock() may not be called from a flowgraph
* thread (E.g., gr::block::work method) or deadlock will occur
* when reconfiguration happens.
*/
virtual void lock();
/*!
* Unlock a flowgraph in preparation for reconfiguration. When an
* equal number of calls to lock() and unlock() have occurred, the
* flowgraph will be reconfigured.
*
* N.B. lock() and unlock() may not be called from a flowgraph
* thread (E.g., gr::block::work method) or deadlock will occur
* when reconfiguration happens.
*/
virtual void unlock();
// This is a public method for ease of code organization, but should be
// ignored by the user.
flat_flowgraph_sptr flatten() const;
hier_block2_sptr to_hier_block2(); // Needed for Python type coercion
/*!
* \brief Set the affinity of all blocks in hier_block2 to processor core \p n.
*
* \param mask a vector of ints of the core numbers available to this block.
*/
void set_processor_affinity(const std::vector<int> &mask);
/*!
* \brief Remove processor affinity for all blocks in hier_block2.
*/
void unset_processor_affinity();
/*!
* \brief Get the current processor affinity.
*
* \details This returns the processor affinity value for the first
* block in the hier_block2's list of blocks with the assumption
* that they have always only been set through the hier_block2's
* interface. If any block has been individually set, then this
* call could be misleading.
*/
std::vector<int> processor_affinity();
};
inline hier_block2_sptr cast_to_hier_block2_sptr(basic_block_sptr block) {
return boost::dynamic_pointer_cast<hier_block2, basic_block>(block);
}
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_HIER_BLOCK2_H */

View File

@ -0,0 +1,156 @@
/* -*- c++ -*- */
/*
* Copyright 2011,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef INCLUDED_GNURADIO_HIGH_RES_TIMER_H
#define INCLUDED_GNURADIO_HIGH_RES_TIMER_H
#include <gnuradio/api.h>
////////////////////////////////////////////////////////////////////////
// Use architecture defines to determine the implementation
////////////////////////////////////////////////////////////////////////
#if defined(linux) || defined(__linux) || defined(__linux__)
#define GNURADIO_HRT_USE_CLOCK_GETTIME
#include <ctime>
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
#define GNURADIO_HRT_USE_QUERY_PERFORMANCE_COUNTER
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#define GNURADIO_HRT_USE_MACH_ABSOLUTE_TIME
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define GNURADIO_HRT_USE_CLOCK_GETTIME
#include <ctime>
#else
#define GNURADIO_HRT_USE_MICROSEC_CLOCK
#endif
////////////////////////////////////////////////////////////////////////
namespace gr {
//! Typedef for the timer tick count
typedef signed long long high_res_timer_type;
//! Get the current time in ticks
high_res_timer_type high_res_timer_now(void);
//! Get the current time in ticks - for performance monitoring
high_res_timer_type high_res_timer_now_perfmon(void);
//! Get the number of ticks per second
high_res_timer_type high_res_timer_tps(void);
//! Get the tick count at the epoch
high_res_timer_type high_res_timer_epoch(void);
#ifdef GNURADIO_HRT_USE_CLOCK_GETTIME
//! storage for high res timer type
GR_RUNTIME_API extern clockid_t high_res_timer_source;
#endif
} /* namespace gr */
////////////////////////////////////////////////////////////////////////
#ifdef GNURADIO_HRT_USE_CLOCK_GETTIME
inline gr::high_res_timer_type gr::high_res_timer_now(void){
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec*high_res_timer_tps() + ts.tv_nsec;
}
inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){
timespec ts;
clock_gettime(high_res_timer_source, &ts);
return ts.tv_sec*high_res_timer_tps() + ts.tv_nsec;
}
inline gr::high_res_timer_type gr::high_res_timer_tps(void){
return 1000000000UL;
}
#endif /* GNURADIO_HRT_USE_CLOCK_GETTIME */
////////////////////////////////////////////////////////////////////////
#ifdef GNURADIO_HRT_USE_MACH_ABSOLUTE_TIME
#include <mach/mach_time.h>
inline gr::high_res_timer_type gr::high_res_timer_now(void){
return mach_absolute_time();
}
inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){
return gr::high_res_timer_now();
}
inline gr::high_res_timer_type gr::high_res_timer_tps(void){
mach_timebase_info_data_t info;
mach_timebase_info(&info);
return gr::high_res_timer_type(info.numer*1000000000UL)/info.denom;
}
#endif
////////////////////////////////////////////////////////////////////////
#ifdef GNURADIO_HRT_USE_QUERY_PERFORMANCE_COUNTER
#include <Windows.h>
inline gr::high_res_timer_type gr::high_res_timer_now(void){
LARGE_INTEGER counts;
QueryPerformanceCounter(&counts);
return counts.QuadPart;
}
inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){
return gr::high_res_timer_now();
}
inline gr::high_res_timer_type gr::high_res_timer_tps(void){
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
return freq.QuadPart;
}
#endif
////////////////////////////////////////////////////////////////////////
#ifdef GNURADIO_HRT_USE_MICROSEC_CLOCK
#include <boost/date_time/posix_time/posix_time.hpp>
inline gr::high_res_timer_type gr::high_res_timer_now(void){
static const boost::posix_time::ptime epoch(boost::posix_time::from_time_t(0));
return (boost::posix_time::microsec_clock::universal_time() - epoch).ticks();
}
inline gr::high_res_timer_type gr::high_res_timer_now_perfmon(void){
return gr::high_res_timer_now();
}
inline gr::high_res_timer_type gr::high_res_timer_tps(void){
return boost::posix_time::time_duration::ticks_per_second();
}
#endif
////////////////////////////////////////////////////////////////////////
#include <boost/date_time/posix_time/posix_time.hpp>
inline gr::high_res_timer_type gr::high_res_timer_epoch(void){
static const double hrt_ticks_per_utc_ticks = gr::high_res_timer_tps()/double(boost::posix_time::time_duration::ticks_per_second());
boost::posix_time::time_duration utc = boost::posix_time::microsec_clock::universal_time() - boost::posix_time::from_time_t(0);
return gr::high_res_timer_now() - utc.ticks()*hrt_ticks_per_utc_ticks;
}
#endif /* INCLUDED_GNURADIO_HIGH_RES_TIMER_H */

View File

@ -0,0 +1,111 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_IO_SIGNATURE_H
#define INCLUDED_IO_SIGNATURE_H
#include <gnuradio/api.h>
#include <gnuradio/runtime_types.h>
namespace gr {
/*!
* \brief i/o signature for input and output ports.
* \brief misc
*/
class GR_RUNTIME_API io_signature
{
int d_min_streams;
int d_max_streams;
std::vector<int> d_sizeof_stream_item;
io_signature(int min_streams, int max_streams,
const std::vector<int> &sizeof_stream_items);
public:
typedef boost::shared_ptr<io_signature> sptr;
static const int IO_INFINITE = -1;
~io_signature();
/*!
* \brief Create an i/o signature
*
* \ingroup internal
* \param min_streams specify minimum number of streams (>= 0)
* \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
* \param sizeof_stream_item specify the size of the items in each stream
*/
static sptr make(int min_streams, int max_streams,
int sizeof_stream_item);
/*!
* \brief Create an i/o signature
*
* \param min_streams specify minimum number of streams (>= 0)
* \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
* \param sizeof_stream_item1 specify the size of the items in the first stream
* \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
*/
static sptr make2(int min_streams, int max_streams,
int sizeof_stream_item1,
int sizeof_stream_item2);
/*!
* \brief Create an i/o signature
*
* \param min_streams specify minimum number of streams (>= 0)
* \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
* \param sizeof_stream_item1 specify the size of the items in the first stream
* \param sizeof_stream_item2 specify the size of the items in the second stream
* \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
*/
static sptr make3(int min_streams, int max_streams,
int sizeof_stream_item1,
int sizeof_stream_item2,
int sizeof_stream_item3);
/*!
* \brief Create an i/o signature
*
* \param min_streams specify minimum number of streams (>= 0)
* \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
* \param sizeof_stream_items specify the size of the items in the streams
*
* If there are more streams than there are entries in
* sizeof_stream_items, the value of the last entry in
* sizeof_stream_items is used for the missing values.
* sizeof_stream_items must contain at least 1 entry.
*/
static sptr makev(int min_streams, int max_streams,
const std::vector<int> &sizeof_stream_items);
int min_streams() const { return d_min_streams; }
int max_streams() const { return d_max_streams; }
int sizeof_stream_item(int index) const;
std::vector<int> sizeof_stream_items() const;
};
} /* namespace gr */
#endif /* INCLUDED_IO_SIGNATURE_H */

Some files were not shown because too many files have changed in this diff Show More