Skip to content

Commit a20c980

Browse files
committed
everything
1 parent 89109a9 commit a20c980

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+5229
-0
lines changed

CMakeLists.txt

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Copyright 2011 Free Software Foundation, Inc.
2+
#
3+
# This file is part of GNU Radio
4+
#
5+
# GNU Radio is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GNU Radio is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GNU Radio; see the file COPYING. If not, write to
17+
# the Free Software Foundation, Inc., 51 Franklin Street,
18+
# Boston, MA 02110-1301, USA.
19+
20+
21+
22+
cmake_minimum_required(VERSION 2.6)
23+
project(gr-osmosdr CXX C)
24+
25+
set(CMAKE_BUILD_TYPE Debug)
26+
27+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
28+
29+
########################################################################
30+
# Find build dependencies
31+
########################################################################
32+
find_package(Gruel)
33+
find_package(GnuradioCore)
34+
find_package(GnuradioIQBalance)
35+
find_package(UHD)
36+
find_package(GnuradioUHD)
37+
find_package(GnuradioFCD)
38+
find_package(GnuradioFCDPP)
39+
find_package(LibOsmoSDR)
40+
find_package(LibRTLSDR)
41+
find_package(LibMiriSDR)
42+
find_package(LibHackRF)
43+
find_package(LibbladeRF)
44+
#find_package(LibDSD)
45+
46+
if(NOT GRUEL_FOUND)
47+
message(FATAL_ERROR "Gruel required to build " ${CMAKE_PROJECT_NAME})
48+
endif()
49+
50+
if(NOT GNURADIO_CORE_FOUND)
51+
message(FATAL_ERROR "GnuRadio Core required to build " ${CMAKE_PROJECT_NAME})
52+
endif()
53+
54+
55+
########################################################################
56+
# Setup boost
57+
########################################################################
58+
MESSAGE(STATUS "Configuring Boost C++ Libraries...")
59+
60+
# Although not required on my system, some users have linking issues without
61+
SET(BOOST_REQUIRED_COMPONENTS
62+
thread
63+
system
64+
program_options
65+
)
66+
67+
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
68+
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
69+
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
70+
71+
set(Boost_ADDITIONAL_VERSIONS
72+
"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"
73+
"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"
74+
"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"
75+
"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"
76+
"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"
77+
"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"
78+
"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"
79+
)
80+
81+
find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
82+
83+
if(NOT Boost_FOUND)
84+
message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME})
85+
endif()
86+
87+
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
88+
89+
90+
########################################################################
91+
# Register component
92+
########################################################################
93+
#include(GrComponent)
94+
#GR_REGISTER_COMPONENT("gr-audio" ENABLE_GR_AUDIO
95+
# Boost_FOUND
96+
# ENABLE_GR_CORE
97+
#)
98+
99+
100+
101+
102+
SET(GR_PKG_AUDIO_EXAMPLES_DIR .)
103+
104+
105+
106+
########################################################################
107+
# Setup the include and linker paths
108+
########################################################################
109+
include_directories(
110+
${Boost_INCLUDE_DIRS}
111+
${GRUEL_INCLUDE_DIRS}
112+
${GNURADIO_CORE_INCLUDE_DIRS}
113+
${LIBOSMOSDR_INCLUDE_DIR}
114+
${LIBDSD_INCLUDE_DIR}
115+
/usr/local/include/dsd/
116+
./lib/
117+
)
118+
119+
link_directories(
120+
${Boost_LIBRARY_DIRS}
121+
${GRUEL_LIBRARY_DIRS}
122+
${GNURADIO_CORE_LIBRARY_DIRS}
123+
${LIBOSMOSDR_LIBRARIES}
124+
${LIBDSD_LIBRARIES}
125+
/usr/local/lib/
126+
/usr/local/lib/pyton2.7/dist-packages/gnuradio/
127+
)
128+
129+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
130+
131+
add_executable(smartnet smartnet.cc smartnet_crc.cc smartnet_deinterleave.cc logging_receiver_dsd.cc logging_receiver_p25.cc smartnet_wavfile.cc smartnet_wavsink.cc)
132+
target_link_libraries(smartnet gnuradio-core gnuradio-audio gnuradio-blocks gnuradio-osmosdr gnuradio-filter gnuradio-digital gnuradio-analog ${GRUEL_LIBRARIES} ${Boost_LIBRARIES} gr-dsd op25 itpp)
133+
134+
#${CMAKE_SOURCE_DIR}/libs/op25_fsk4_demod_ff.o ${CMAKE_SOURCE_DIR}/libs/op25_decoder_bf.o ${CMAKE_SOURCE_DIR}/libs/data_unit.o ${CMAKE_SOURCE_DIR}/libs/data_unit_handler.o ${CMAKE_SOURCE_DIR}/libs/bch.o/home/luke/sdr/smartnet/libs/abstract_data_unit.o
135+
136+
INSTALL(TARGETS
137+
smartnet
138+
DESTINATION ${GR_PKG_AUDIO_EXAMPLES_DIR}
139+
COMPONENT "audio_examples"
140+
)

break.cc

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include <gnuradio/gr_file_sink.h>
2+
#include <gnuradio/gr_sig_source_f.h>
3+
#include <gnuradio/gr_hier_block2.h>
4+
#include <gnuradio/gr_io_signature.h>
5+
#include <gnuradio/gr_top_block.h>
6+
7+
static void connect(gr_top_block_sptr block, gr_sig_source_f_sptr
8+
source,
9+
gr_hier_block2_sptr block2) {
10+
fprintf(stderr, "connect: calling lock, connect, unlock\n");
11+
block->lock();
12+
block->connect(source, 0, block2, 0);
13+
block->unlock();
14+
fprintf(stderr, "connect: done\n");
15+
}
16+
17+
static void disconnect(gr_top_block_sptr block, gr_sig_source_f_sptr
18+
source,
19+
gr_hier_block2_sptr block2) {
20+
fprintf(stderr, "disconnect: calling block->lock\n");
21+
block->lock();
22+
23+
fprintf(stderr, "disconnect: calling block->disconnect\n");
24+
block->disconnect(source, 0, block2, 0);
25+
26+
fprintf(stderr, "disconnect: calling block->unlock\n");
27+
block->unlock(); // It usually hangs here.
28+
29+
fprintf(stderr, "disconnect: done\n");
30+
}
31+
32+
int main(int argc, char** argv) {
33+
// Inner block: block to sink.
34+
gr_hier_block2_sptr inner;
35+
inner = gr_make_hier_block2("inner",
36+
gr_make_io_signature(1, 1, sizeof(float)),
37+
gr_make_io_signature(0, 0, 0));
38+
39+
gr_file_sink_sptr sink;
40+
sink = gr_make_file_sink(sizeof(float), "/dev/null");
41+
inner->connect(inner, 0, sink, 0);
42+
43+
// Outer block: signal source to inner block.
44+
gr_top_block_sptr outer = gr_make_top_block("outer");
45+
gr_sig_source_f_sptr src = gr_make_sig_source_f(11025, GR_COS_WAVE,
46+
400, .1, 0);
47+
48+
// Hook it up and get it going.
49+
connect(outer, src, inner);
50+
outer->start();
51+
52+
// Frob it until we die.
53+
while (true) {
54+
disconnect(outer, src, inner);
55+
fprintf(stderr, "\n\n------------------------\n\n");
56+
57+
connect(outer, src, inner);
58+
}
59+
60+
return 0;
61+
}
+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
2+
#
3+
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
4+
# parsing the arguments given to that macro or function.
5+
# It processes the arguments and defines a set of variables which hold the
6+
# values of the respective options.
7+
#
8+
# The <options> argument contains all options for the respective macro,
9+
# i.e. keywords which can be used when calling the macro without any value
10+
# following, like e.g. the OPTIONAL keyword of the install() command.
11+
#
12+
# The <one_value_keywords> argument contains all keywords for this macro
13+
# which are followed by one value, like e.g. DESTINATION keyword of the
14+
# install() command.
15+
#
16+
# The <multi_value_keywords> argument contains all keywords for this macro
17+
# which can be followed by more than one value, like e.g. the TARGETS or
18+
# FILES keywords of the install() command.
19+
#
20+
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
21+
# keywords listed in <options>, <one_value_keywords> and
22+
# <multi_value_keywords> a variable composed of the given <prefix>
23+
# followed by "_" and the name of the respective keyword.
24+
# These variables will then hold the respective value from the argument list.
25+
# For the <options> keywords this will be TRUE or FALSE.
26+
#
27+
# All remaining arguments are collected in a variable
28+
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
29+
# your macro was called with unrecognized parameters.
30+
#
31+
# As an example here a my_install() macro, which takes similar arguments as the
32+
# real install() command:
33+
#
34+
# function(MY_INSTALL)
35+
# set(options OPTIONAL FAST)
36+
# set(oneValueArgs DESTINATION RENAME)
37+
# set(multiValueArgs TARGETS CONFIGURATIONS)
38+
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
39+
# ...
40+
#
41+
# Assume my_install() has been called like this:
42+
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
43+
#
44+
# After the cmake_parse_arguments() call the macro will have set the following
45+
# variables:
46+
# MY_INSTALL_OPTIONAL = TRUE
47+
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
48+
# MY_INSTALL_DESTINATION = "bin"
49+
# MY_INSTALL_RENAME = "" (was not used)
50+
# MY_INSTALL_TARGETS = "foo;bar"
51+
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
52+
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
53+
#
54+
# You can the continue and process these variables.
55+
#
56+
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
57+
# another recognized keyword follows, this is interpreted as the beginning of
58+
# the new option.
59+
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
60+
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
61+
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
62+
63+
#=============================================================================
64+
# Copyright 2010 Alexander Neundorf <[email protected]>
65+
#
66+
# Distributed under the OSI-approved BSD License (the "License");
67+
# see accompanying file Copyright.txt for details.
68+
#
69+
# This software is distributed WITHOUT ANY WARRANTY; without even the
70+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
71+
# See the License for more information.
72+
#=============================================================================
73+
# (To distribute this file outside of CMake, substitute the full
74+
# License text for the above reference.)
75+
76+
77+
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
78+
return()
79+
endif()
80+
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
81+
82+
83+
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
84+
# first set all result variables to empty/FALSE
85+
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
86+
set(${prefix}_${arg_name})
87+
endforeach(arg_name)
88+
89+
foreach(option ${_optionNames})
90+
set(${prefix}_${option} FALSE)
91+
endforeach(option)
92+
93+
set(${prefix}_UNPARSED_ARGUMENTS)
94+
95+
set(insideValues FALSE)
96+
set(currentArgName)
97+
98+
# now iterate over all arguments and fill the result variables
99+
foreach(currentArg ${ARGN})
100+
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
101+
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
102+
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
103+
104+
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
105+
if(insideValues)
106+
if("${insideValues}" STREQUAL "SINGLE")
107+
set(${prefix}_${currentArgName} ${currentArg})
108+
set(insideValues FALSE)
109+
elseif("${insideValues}" STREQUAL "MULTI")
110+
list(APPEND ${prefix}_${currentArgName} ${currentArg})
111+
endif()
112+
else(insideValues)
113+
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
114+
endif(insideValues)
115+
else()
116+
if(NOT ${optionIndex} EQUAL -1)
117+
set(${prefix}_${currentArg} TRUE)
118+
set(insideValues FALSE)
119+
elseif(NOT ${singleArgIndex} EQUAL -1)
120+
set(currentArgName ${currentArg})
121+
set(${prefix}_${currentArgName})
122+
set(insideValues "SINGLE")
123+
elseif(NOT ${multiArgIndex} EQUAL -1)
124+
set(currentArgName ${currentArg})
125+
set(${prefix}_${currentArgName})
126+
set(insideValues "MULTI")
127+
endif()
128+
endif()
129+
130+
endforeach(currentArg)
131+
132+
# propagate the result variables to the caller:
133+
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
134+
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
135+
endforeach(arg_name)
136+
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
137+
138+
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)

cmake/Modules/FindGnuradioAudio.cmake

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
INCLUDE(FindPkgConfig)
2+
PKG_CHECK_MODULES(PC_GNURADIO_AUDIO gnuradio-audio)
3+
4+
FIND_PATH(
5+
GNURADIO_AUDIO_INCLUDE_DIRS
6+
NAMES gnuradio/gr_audio_api.h
7+
HINTS $ENV{GNURADIO_AUDIO_DIR}/include
8+
${PC_GNURADIO_AUDIO_INCLUDEDIR}
9+
PATHS /usr/local/include
10+
/usr/include
11+
)
12+
13+
FIND_LIBRARY(
14+
GNURADIO_AUDIO_LIBRARIES
15+
NAMES gnuradio-audio
16+
HINTS $ENV{GNURADIO_AUDIO_DIR}/lib
17+
${PC_GNURADIO_AUDIO_LIBDIR}
18+
PATHS /usr/local/lib
19+
/usr/local/lib64
20+
/usr/lib
21+
/usr/lib64
22+
)
23+
24+
INCLUDE(FindPackageHandleStandardArgs)
25+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_AUDIO DEFAULT_MSG GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS)
26+
MARK_AS_ADVANCED(GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS)

cmake/Modules/FindGnuradioCore.cmake

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
INCLUDE(FindPkgConfig)
2+
PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core)
3+
4+
FIND_PATH(
5+
GNURADIO_CORE_INCLUDE_DIRS
6+
NAMES gr_core_api.h
7+
HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio
8+
${PC_GNURADIO_CORE_INCLUDEDIR}
9+
${CMAKE_INSTALL_PREFIX}/include/gnuradio
10+
PATHS /usr/local/include/gnuradio
11+
/usr/include/gnuradio
12+
)
13+
14+
FIND_LIBRARY(
15+
GNURADIO_CORE_LIBRARIES
16+
NAMES gnuradio-core
17+
HINTS $ENV{GNURADIO_CORE_DIR}/lib
18+
${PC_GNURADIO_CORE_LIBDIR}
19+
${CMAKE_INSTALL_PREFIX}/lib64
20+
${CMAKE_INSTALL_PREFIX}/lib
21+
PATHS /usr/local/lib
22+
/usr/local/lib64
23+
/usr/lib
24+
/usr/lib64
25+
)
26+
27+
INCLUDE(FindPackageHandleStandardArgs)
28+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
29+
MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)

0 commit comments

Comments
 (0)