├── beaglebone └── gpio │ ├── gpio.h │ ├── Makefile │ ├── repeat.c │ ├── send_message.c │ └── gpio.c ├── gnuradio ├── gr-hamming │ ├── docs │ │ ├── doxygen │ │ │ ├── other │ │ │ │ ├── group_defs.dox │ │ │ │ └── main_page.dox │ │ │ ├── doxyxml │ │ │ │ ├── generated │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── index.py │ │ │ │ ├── text.py │ │ │ │ ├── __init__.py │ │ │ │ ├── doxyindex.py │ │ │ │ └── base.py │ │ │ └── CMakeLists.txt │ │ ├── README.hamming │ │ └── CMakeLists.txt │ ├── grc │ │ ├── hamming_decode_hamming_bb.xml │ │ ├── hamming_wait_for_prefix_bb.xml │ │ └── CMakeLists.txt │ ├── swig │ │ ├── hamming_swig.i │ │ └── CMakeLists.txt │ ├── apps │ │ └── CMakeLists.txt │ ├── cmake │ │ ├── Modules │ │ │ ├── FindCppUnit.cmake │ │ │ ├── FindGnuradioRuntime.cmake │ │ │ ├── GrPlatform.cmake │ │ │ ├── GrTest.cmake │ │ │ └── CMakeParseArgumentsCopy.cmake │ │ └── cmake_uninstall.cmake.in │ ├── include │ │ └── hamming │ │ │ ├── api.h │ │ │ ├── CMakeLists.txt │ │ │ ├── decode_hamming_bb.h │ │ │ └── wait_for_prefix_bb.h │ ├── lib │ │ ├── qa_hamming.cc │ │ ├── qa_hamming.h │ │ ├── test_hamming.cc │ │ ├── decode_hamming_bb_impl.h │ │ ├── wait_for_prefix_bb_impl.h │ │ ├── CMakeLists.txt │ │ ├── decode_hamming_bb_impl.cc │ │ └── wait_for_prefix_bb_impl.cc │ ├── python │ │ ├── build_utils_codes.py │ │ ├── __init__.py │ │ ├── CMakeLists.txt │ │ ├── qa_wait_for_prefix_bb.py │ │ └── qa_decode_hamming_bb.py │ └── CMakeLists.txt └── gr-cw_binary │ ├── docs │ ├── doxygen │ │ ├── other │ │ │ ├── group_defs.dox │ │ │ └── main_page.dox │ │ ├── doxyxml │ │ │ ├── generated │ │ │ │ ├── __init__.py │ │ │ │ └── index.py │ │ │ ├── text.py │ │ │ ├── __init__.py │ │ │ ├── doxyindex.py │ │ │ └── base.py │ │ └── CMakeLists.txt │ ├── README.cw_binary │ └── CMakeLists.txt │ ├── grc │ ├── cw_binary_change_fb.xml │ ├── cw_binary_sample_bit_bb.xml │ ├── CMakeLists.txt │ └── cw_binary_sample_on_ctrl_ff.xml │ ├── swig │ ├── cw_binary_swig.i │ └── CMakeLists.txt │ ├── apps │ └── CMakeLists.txt │ ├── cmake │ ├── Modules │ │ ├── FindCppUnit.cmake │ │ ├── FindGnuradioRuntime.cmake │ │ ├── GrPlatform.cmake │ │ ├── GrTest.cmake │ │ └── CMakeParseArgumentsCopy.cmake │ └── cmake_uninstall.cmake.in │ ├── include │ └── cw_binary │ │ ├── CMakeLists.txt │ │ ├── api.h │ │ ├── change_fb.h │ │ ├── sample_bit_bb.h │ │ └── sample_on_ctrl_ff.h │ ├── lib │ ├── qa_cw_binary.cc │ ├── qa_cw_binary.h │ ├── test_cw_binary.cc │ ├── change_fb_impl.h │ ├── sample_bit_bb_impl.h │ ├── sample_on_ctrl_ff_impl.h │ ├── change_fb_impl.cc │ ├── sample_bit_bb_impl.cc │ ├── CMakeLists.txt │ └── sample_on_ctrl_ff_impl.cc │ ├── python │ ├── build_utils_codes.py │ ├── qa_change_fb.py │ ├── qa_sample_bit_bb.py │ ├── qa_sample_on_ctrl_ff.py │ ├── __init__.py │ ├── CMakeLists.txt │ └── build_utils.py │ └── CMakeLists.txt └── README.md /beaglebone/gpio/gpio.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* A non-conflicting number. */ 4 | #define IOC_MAGIC 60 5 | 6 | /* Set the number of cycles per bit. */ 7 | #define IOC_SET _IOW(IOC_MAGIC, 1, int) 8 | 9 | /* Only one ioctl option. */ 10 | #define IOC_MAXNR 1 11 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/other/group_defs.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | * \defgroup block GNU Radio HAMMING C++ Signal Processing Blocks 3 | * \brief All C++ blocks that can be used from the HAMMING GNU Radio 4 | * module are listed here or in the subcategories below. 5 | * 6 | */ 7 | 8 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/other/group_defs.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | * \defgroup block GNU Radio CW_BINARY C++ Signal Processing Blocks 3 | * \brief All C++ blocks that can be used from the CW_BINARY GNU Radio 4 | * module are listed here or in the subcategories below. 5 | * 6 | */ 7 | 8 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/generated/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains generated files produced by generateDS.py. 3 | 4 | These do the real work of parsing the doxygen xml files but the 5 | resultant classes are not very friendly to navigate so the rest of the 6 | doxyxml module processes them further. 7 | """ 8 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/generated/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains generated files produced by generateDS.py. 3 | 4 | These do the real work of parsing the doxygen xml files but the 5 | resultant classes are not very friendly to navigate so the rest of the 6 | doxyxml module processes them further. 7 | """ 8 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/other/main_page.dox: -------------------------------------------------------------------------------- 1 | /*! \mainpage 2 | 3 | Welcome to the GNU Radio HAMMING Block 4 | 5 | This is the intro page for the Doxygen manual generated for the HAMMING 6 | block (docs/doxygen/other/main_page.dox). Edit it to add more detailed 7 | documentation about the new GNU Radio modules contained in this 8 | project. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/other/main_page.dox: -------------------------------------------------------------------------------- 1 | /*! \mainpage 2 | 3 | Welcome to the GNU Radio CW_BINARY Block 4 | 5 | This is the intro page for the Doxygen manual generated for the CW_BINARY 6 | block (docs/doxygen/other/main_page.dox). Edit it to add more detailed 7 | documentation about the new GNU Radio modules contained in this 8 | project. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /beaglebone/gpio/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += gpio.o 2 | KDIR = /usr/src/kernel 3 | PWD := $(shell pwd) 4 | 5 | .PHONY: 6 | all: kernel repeat message 7 | 8 | kernel: 9 | make -C $(KDIR) M=$(PWD) modules 10 | 11 | repeat: repeat.c 12 | gcc -o repeat repeat.c 13 | 14 | message: send_message.c 15 | gcc -o send_message send_message.c 16 | 17 | clean: 18 | make -C $(KDIR) M=$(PWD) clean 19 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/README.hamming: -------------------------------------------------------------------------------- 1 | This is the hamming-write-a-block package meant as a guide to building 2 | out-of-tree packages. To use the hamming blocks, the Python namespaces 3 | is in 'hamming', which is imported as: 4 | 5 | import hamming 6 | 7 | See the Doxygen documentation for details about the blocks available 8 | in this package. A quick listing of the details can be found in Python 9 | after importing by using: 10 | 11 | help(hamming) 12 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/grc/hamming_decode_hamming_bb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | decode_hamming_bb 4 | hamming_decode_hamming_bb 5 | hamming 6 | import hamming 7 | hamming.decode_hamming_bb() 8 | 9 | in 10 | byte 11 | 12 | 13 | out 14 | byte 15 | 16 | 17 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/README.cw_binary: -------------------------------------------------------------------------------- 1 | This is the cw_binary-write-a-block package meant as a guide to building 2 | out-of-tree packages. To use the cw_binary blocks, the Python namespaces 3 | is in 'cw_binary', which is imported as: 4 | 5 | import cw_binary 6 | 7 | See the Doxygen documentation for details about the blocks available 8 | in this package. A quick listing of the details can be found in Python 9 | after importing by using: 10 | 11 | help(cw_binary) 12 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/grc/hamming_wait_for_prefix_bb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | wait_for_prefix_bb 4 | hamming_wait_for_prefix_bb 5 | hamming 6 | import hamming 7 | hamming.wait_for_prefix_bb() 8 | 9 | 10 | in 11 | byte 12 | 13 | 14 | 15 | out 16 | byte 17 | 18 | 19 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/swig/hamming_swig.i: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | 3 | #define HAMMING_API 4 | 5 | %include "gnuradio.i" // the common stuff 6 | 7 | //load generated python docstrings 8 | %include "hamming_swig_doc.i" 9 | 10 | %{ 11 | #include "hamming/decode_hamming_bb.h" 12 | #include "hamming/wait_for_prefix_bb.h" 13 | %} 14 | 15 | 16 | %include "hamming/decode_hamming_bb.h" 17 | GR_SWIG_BLOCK_MAGIC2(hamming, decode_hamming_bb); 18 | 19 | 20 | %include "hamming/wait_for_prefix_bb.h" 21 | GR_SWIG_BLOCK_MAGIC2(hamming, wait_for_prefix_bb); 22 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/grc/cw_binary_change_fb.xml: -------------------------------------------------------------------------------- 1 | 2 | Change fb 3 | cw_binary_change_fb 4 | CW_BINARY 5 | import cw_binary 6 | cw_binary.change_fb($epsilon) 7 | 8 | Epsilon 9 | epsilon 10 | 0.000001 11 | float 12 | 13 | 14 | in 15 | float 16 | 17 | 18 | out 19 | byte 20 | 21 | 22 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/grc/cw_binary_sample_bit_bb.xml: -------------------------------------------------------------------------------- 1 | 2 | Sample bit bb 3 | cw_binary_sample_bit_bb 4 | CW_BINARY 5 | import cw_binary 6 | cw_binary.sample_bit_bb($bit_length) 7 | 8 | Bit_length 9 | bit_length 10 | 1000 11 | int 12 | 13 | 14 | in 15 | byte 16 | 17 | 18 | out 19 | byte 20 | 21 | 22 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/swig/cw_binary_swig.i: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | 3 | #define CW_BINARY_API 4 | 5 | %include "gnuradio.i" // the common stuff 6 | 7 | //load generated python docstrings 8 | %include "cw_binary_swig_doc.i" 9 | 10 | %{ 11 | #include "cw_binary/change_fb.h" 12 | #include "cw_binary/sample_bit_bb.h" 13 | #include "cw_binary/sample_on_ctrl_ff.h" 14 | %} 15 | 16 | 17 | %include "cw_binary/change_fb.h" 18 | GR_SWIG_BLOCK_MAGIC2(cw_binary, change_fb); 19 | %include "cw_binary/sample_bit_bb.h" 20 | GR_SWIG_BLOCK_MAGIC2(cw_binary, sample_bit_bb); 21 | %include "cw_binary/sample_on_ctrl_ff.h" 22 | GR_SWIG_BLOCK_MAGIC2(cw_binary, sample_on_ctrl_ff); 23 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/apps/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | include(GrPython) 21 | 22 | GR_PYTHON_INSTALL( 23 | PROGRAMS 24 | DESTINATION bin 25 | ) 26 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/apps/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | include(GrPython) 21 | 22 | GR_PYTHON_INSTALL( 23 | PROGRAMS 24 | DESTINATION bin 25 | ) 26 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/grc/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | install(FILES 21 | cw_binary_change_fb.xml 22 | cw_binary_sample_bit_bb.xml 23 | cw_binary_sample_on_ctrl_ff.xml DESTINATION share/gnuradio/grc/blocks 24 | ) 25 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/grc/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | install(FILES 20 | hamming_decode_hamming_bb.xml 21 | hamming_wait_for_prefix_bb.xml 22 | hamming_wait_for_prefix_bb.xml 23 | hamming_decode_bb.xml DESTINATION share/gnuradio/grc/blocks 24 | ) 25 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/Modules/FindCppUnit.cmake: -------------------------------------------------------------------------------- 1 | # http://www.cmake.org/pipermail/cmake/2006-October/011446.html 2 | # Modified to use pkg config and use standard var names 3 | 4 | # 5 | # Find the CppUnit includes and library 6 | # 7 | # This module defines 8 | # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. 9 | # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. 10 | # CPPUNIT_FOUND, If false, do not try to use CppUnit. 11 | 12 | INCLUDE(FindPkgConfig) 13 | PKG_CHECK_MODULES(PC_CPPUNIT "cppunit") 14 | 15 | FIND_PATH(CPPUNIT_INCLUDE_DIRS 16 | NAMES cppunit/TestCase.h 17 | HINTS ${PC_CPPUNIT_INCLUDE_DIR} 18 | PATHS 19 | /usr/local/include 20 | /usr/include 21 | ) 22 | 23 | FIND_LIBRARY(CPPUNIT_LIBRARIES 24 | NAMES cppunit 25 | HINTS ${PC_CPPUNIT_LIBDIR} 26 | PATHS 27 | ${CPPUNIT_INCLUDE_DIRS}/../lib 28 | /usr/local/lib 29 | /usr/lib 30 | ) 31 | 32 | LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) 33 | 34 | INCLUDE(FindPackageHandleStandardArgs) 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 36 | MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/Modules/FindCppUnit.cmake: -------------------------------------------------------------------------------- 1 | # http://www.cmake.org/pipermail/cmake/2006-October/011446.html 2 | # Modified to use pkg config and use standard var names 3 | 4 | # 5 | # Find the CppUnit includes and library 6 | # 7 | # This module defines 8 | # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. 9 | # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. 10 | # CPPUNIT_FOUND, If false, do not try to use CppUnit. 11 | 12 | INCLUDE(FindPkgConfig) 13 | PKG_CHECK_MODULES(PC_CPPUNIT "cppunit") 14 | 15 | FIND_PATH(CPPUNIT_INCLUDE_DIRS 16 | NAMES cppunit/TestCase.h 17 | HINTS ${PC_CPPUNIT_INCLUDE_DIR} 18 | PATHS 19 | /usr/local/include 20 | /usr/include 21 | ) 22 | 23 | FIND_LIBRARY(CPPUNIT_LIBRARIES 24 | NAMES cppunit 25 | HINTS ${PC_CPPUNIT_LIBDIR} 26 | PATHS 27 | ${CPPUNIT_INCLUDE_DIRS}/../lib 28 | /usr/local/lib 29 | /usr/lib 30 | ) 31 | 32 | LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) 33 | 34 | INCLUDE(FindPackageHandleStandardArgs) 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 36 | MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/include/hamming/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * GNU Radio is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * GNU Radio is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with GNU Radio; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef INCLUDED_HAMMING_API_H 23 | #define INCLUDED_HAMMING_API_H 24 | 25 | #include 26 | 27 | #ifdef gnuradio_hamming_EXPORTS 28 | # define HAMMING_API __GR_ATTR_EXPORT 29 | #else 30 | # define HAMMING_API __GR_ATTR_IMPORT 31 | #endif 32 | 33 | #endif /* INCLUDED_HAMMING_API_H */ 34 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/include/cw_binary/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | api.h 25 | change_fb.h 26 | sample_bit_bb.h 27 | sample_on_ctrl_ff.h DESTINATION include/cw_binary 28 | ) 29 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/include/hamming/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | api.h 25 | decode_hamming_bb.h 26 | wait_for_prefix_bb.h 27 | wait_for_prefix_bb.h DESTINATION include/hamming 28 | ) 29 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/include/cw_binary/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * GNU Radio is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * GNU Radio is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with GNU Radio; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef INCLUDED_CW_BINARY_API_H 23 | #define INCLUDED_CW_BINARY_API_H 24 | 25 | #include 26 | 27 | #ifdef gnuradio_cw_binary_EXPORTS 28 | # define CW_BINARY_API __GR_ATTR_EXPORT 29 | #else 30 | # define CW_BINARY_API __GR_ATTR_IMPORT 31 | #endif 32 | 33 | #endif /* INCLUDED_CW_BINARY_API_H */ 34 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/qa_hamming.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * GNU Radio is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * GNU Radio is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with GNU Radio; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | /* 23 | * This class gathers together all the test cases for the gr-filter 24 | * directory into a single test suite. As you create new test cases, 25 | * add them here. 26 | */ 27 | 28 | #include "qa_hamming.h" 29 | 30 | CppUnit::TestSuite * 31 | qa_hamming::suite() 32 | { 33 | CppUnit::TestSuite *s = new CppUnit::TestSuite("hamming"); 34 | 35 | return s; 36 | } 37 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/qa_cw_binary.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * GNU Radio is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * GNU Radio is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with GNU Radio; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | /* 23 | * This class gathers together all the test cases for the gr-filter 24 | * directory into a single test suite. As you create new test cases, 25 | * add them here. 26 | */ 27 | 28 | #include "qa_cw_binary.h" 29 | 30 | CppUnit::TestSuite * 31 | qa_cw_binary::suite() 32 | { 33 | CppUnit::TestSuite *s = new CppUnit::TestSuite("cw_binary"); 34 | 35 | return s; 36 | } 37 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/grc/cw_binary_sample_on_ctrl_ff.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | sample_on_ctrl_ff 4 | cw_binary_sample_on_ctrl_ff 5 | cw_binary 6 | import cw_binary 7 | cw_binary.sample_on_ctrl_ff($) 8 | 13 | 14 | ... 15 | ... 16 | ... 17 | 18 | 19 | 24 | 25 | in 26 | 27 | 28 | 29 | 34 | 35 | out 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/Modules/FindGnuradioRuntime.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) 3 | 4 | if(PC_GNURADIO_RUNTIME_FOUND) 5 | # look for include files 6 | FIND_PATH( 7 | GNURADIO_RUNTIME_INCLUDE_DIRS 8 | NAMES gnuradio/top_block.h 9 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/include 10 | ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS} 11 | ${CMAKE_INSTALL_PREFIX}/include 12 | PATHS /usr/local/include 13 | /usr/include 14 | ) 15 | 16 | # look for libs 17 | FIND_LIBRARY( 18 | GNURADIO_RUNTIME_LIBRARIES 19 | NAMES gnuradio-runtime 20 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib 21 | ${PC_GNURADIO_RUNTIME_LIBDIR} 22 | ${CMAKE_INSTALL_PREFIX}/lib/ 23 | ${CMAKE_INSTALL_PREFIX}/lib64/ 24 | PATHS /usr/local/lib 25 | /usr/local/lib64 26 | /usr/lib 27 | /usr/lib64 28 | ) 29 | 30 | set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) 31 | endif(PC_GNURADIO_RUNTIME_FOUND) 32 | 33 | INCLUDE(FindPackageHandleStandardArgs) 34 | # do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) 36 | MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/Modules/FindGnuradioRuntime.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) 3 | 4 | if(PC_GNURADIO_RUNTIME_FOUND) 5 | # look for include files 6 | FIND_PATH( 7 | GNURADIO_RUNTIME_INCLUDE_DIRS 8 | NAMES gnuradio/top_block.h 9 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/include 10 | ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS} 11 | ${CMAKE_INSTALL_PREFIX}/include 12 | PATHS /usr/local/include 13 | /usr/include 14 | ) 15 | 16 | # look for libs 17 | FIND_LIBRARY( 18 | GNURADIO_RUNTIME_LIBRARIES 19 | NAMES gnuradio-runtime 20 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib 21 | ${PC_GNURADIO_RUNTIME_LIBDIR} 22 | ${CMAKE_INSTALL_PREFIX}/lib/ 23 | ${CMAKE_INSTALL_PREFIX}/lib64/ 24 | PATHS /usr/local/lib 25 | /usr/local/lib64 26 | /usr/lib 27 | /usr/lib64 28 | ) 29 | 30 | set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) 31 | endif(PC_GNURADIO_RUNTIME_FOUND) 32 | 33 | INCLUDE(FindPackageHandleStandardArgs) 34 | # do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) 36 | MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/qa_hamming.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2012 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with GNU Radio; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef _QA_HAMMING_H_ 24 | #define _QA_HAMMING_H_ 25 | 26 | #include 27 | #include 28 | 29 | //! collect all the tests for the gr-filter directory 30 | 31 | class __GR_ATTR_EXPORT qa_hamming 32 | { 33 | public: 34 | //! return suite of tests for all of gr-filter directory 35 | static CppUnit::TestSuite *suite(); 36 | }; 37 | 38 | #endif /* _QA_HAMMING_H_ */ 39 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/qa_cw_binary.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2012 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with GNU Radio; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef _QA_CW_BINARY_H_ 24 | #define _QA_CW_BINARY_H_ 25 | 26 | #include 27 | #include 28 | 29 | //! collect all the tests for the gr-filter directory 30 | 31 | class __GR_ATTR_EXPORT qa_cw_binary 32 | { 33 | public: 34 | //! return suite of tests for all of gr-filter directory 35 | static CppUnit::TestSuite *suite(); 36 | }; 37 | 38 | #endif /* _QA_CW_BINARY_H_ */ 39 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Setup dependencies 22 | ######################################################################## 23 | find_package(Doxygen) 24 | 25 | ######################################################################## 26 | # Begin conditional configuration 27 | ######################################################################## 28 | if(ENABLE_DOXYGEN) 29 | 30 | ######################################################################## 31 | # Add subdirectories 32 | ######################################################################## 33 | add_subdirectory(doxygen) 34 | 35 | endif(ENABLE_DOXYGEN) 36 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Setup dependencies 22 | ######################################################################## 23 | find_package(Doxygen) 24 | 25 | ######################################################################## 26 | # Begin conditional configuration 27 | ######################################################################## 28 | if(ENABLE_DOXYGEN) 29 | 30 | ######################################################################## 31 | # Add subdirectories 32 | ######################################################################## 33 | add_subdirectory(doxygen) 34 | 35 | endif(ENABLE_DOXYGEN) 36 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/test_hamming.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2012 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with GNU Radio; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include "qa_hamming.h" 32 | #include 33 | 34 | int 35 | main (int argc, char **argv) 36 | { 37 | CppUnit::TextTestRunner runner; 38 | std::ofstream xmlfile(get_unittest_path("hamming.xml").c_str()); 39 | CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); 40 | 41 | runner.addTest(qa_hamming::suite()); 42 | runner.setOutputter(xmlout); 43 | 44 | bool was_successful = runner.run("", false); 45 | 46 | return was_successful ? 0 : 1; 47 | } 48 | -------------------------------------------------------------------------------- /beaglebone/gpio/repeat.c: -------------------------------------------------------------------------------- 1 | #include "gpio.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | /* Convert a char into a char[8], where each char in the array is a 1 or 0 11 | * corresponding to the bits in the given char. 12 | */ 13 | char *get_byte(char byte) 14 | { 15 | int i; 16 | char *buf = malloc(sizeof(char) * 8); 17 | 18 | for (i = 0; i < 8; i++) { 19 | buf[i] = byte >> (8 - 1 - i) & 0x1; 20 | } 21 | 22 | return buf; 23 | } 24 | 25 | /* Broadcast a repeated 10101010 pattern from GPIO pin 38. */ 26 | main(int argc, char **argv) 27 | { 28 | char byte = -86; // 10101010 29 | char *buf; 30 | int length = 10; 31 | int fd, i, j; 32 | 33 | // Make sure to 'mknod /dev/gpio c 60 0' 34 | // may also need to 'chmod 666 /dev/gpio' 35 | fd = open("/dev/gpio", O_RDWR | O_SYNC); 36 | 37 | if (fd < 0) { 38 | printf("Can't open device file\n"); 39 | exit(-1); 40 | } 41 | 42 | int ret_val = ioctl(fd, IOC_SET, 200000); 43 | if (ret_val < 0) { 44 | printf("set cycles failed:%d\n", ret_val); 45 | exit(-1); 46 | } 47 | 48 | buf = malloc(sizeof(char *) * 8 * length); 49 | for (i = 0; i < length + 2; ++i) { 50 | char *tmp = get_byte(byte); 51 | 52 | for (j = 0; j < 8; j++) { 53 | buf[i*8+j] = tmp[j]; 54 | } 55 | 56 | free(tmp); 57 | } 58 | 59 | for(;;) { 60 | ret_val = write(fd, buf, 8 * length); 61 | } 62 | 63 | free(buf); 64 | close(fd); 65 | } 66 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/test_cw_binary.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2012 Free Software Foundation, Inc. 4 | * 5 | * This file is part of GNU Radio 6 | * 7 | * GNU Radio is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * GNU Radio is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with GNU Radio; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include "qa_cw_binary.h" 32 | #include 33 | 34 | int 35 | main (int argc, char **argv) 36 | { 37 | CppUnit::TextTestRunner runner; 38 | std::ofstream xmlfile(get_unittest_path("cw_binary.xml").c_str()); 39 | CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); 40 | 41 | runner.addTest(qa_cw_binary::suite()); 42 | runner.setOutputter(xmlout); 43 | 44 | bool was_successful = runner.run("", false); 45 | 46 | return was_successful ? 0 : 1; 47 | } 48 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/build_utils_codes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | def i_code (code3): 23 | return code3[0] 24 | 25 | def o_code (code3): 26 | if len (code3) >= 2: 27 | return code3[1] 28 | else: 29 | return code3[0] 30 | 31 | def tap_code (code3): 32 | if len (code3) >= 3: 33 | return code3[2] 34 | else: 35 | return code3[0] 36 | 37 | def i_type (code3): 38 | return char_to_type[i_code (code3)] 39 | 40 | def o_type (code3): 41 | return char_to_type[o_code (code3)] 42 | 43 | def tap_type (code3): 44 | return char_to_type[tap_code (code3)] 45 | 46 | 47 | char_to_type = {} 48 | char_to_type['s'] = 'short' 49 | char_to_type['i'] = 'int' 50 | char_to_type['f'] = 'float' 51 | char_to_type['c'] = 'gr_complex' 52 | char_to_type['b'] = 'unsigned char' 53 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/python/build_utils_codes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | def i_code (code3): 23 | return code3[0] 24 | 25 | def o_code (code3): 26 | if len (code3) >= 2: 27 | return code3[1] 28 | else: 29 | return code3[0] 30 | 31 | def tap_code (code3): 32 | if len (code3) >= 3: 33 | return code3[2] 34 | else: 35 | return code3[0] 36 | 37 | def i_type (code3): 38 | return char_to_type[i_code (code3)] 39 | 40 | def o_type (code3): 41 | return char_to_type[o_code (code3)] 42 | 43 | def tap_type (code3): 44 | return char_to_type[tap_code (code3)] 45 | 46 | 47 | char_to_type = {} 48 | char_to_type['s'] = 'short' 49 | char_to_type['i'] = 'int' 50 | char_to_type['f'] = 'float' 51 | char_to_type['c'] = 'gr_complex' 52 | char_to_type['b'] = 'unsigned char' 53 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/change_fb_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_change_fb_IMPL_H 22 | #define INCLUDED_CW_BINARY_change_fb_IMPL_H 23 | 24 | #include 25 | 26 | namespace gr { 27 | namespace cw_binary { 28 | 29 | class change_fb_impl : public change_fb 30 | { 31 | private: 32 | bool _started; 33 | float _last; 34 | float _epsilon; 35 | 36 | public: 37 | change_fb_impl(float epsilon); 38 | ~change_fb_impl(); 39 | 40 | // Where all the action really happens 41 | int work(int noutput_items, 42 | gr_vector_const_void_star &input_items, 43 | gr_vector_void_star &output_items); 44 | }; 45 | 46 | } // namespace cw_binary 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_CW_BINARY_change_fb_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/sample_bit_bb_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_SAMPLE_BIT_BB_IMPL_H 22 | #define INCLUDED_CW_BINARY_SAMPLE_BIT_BB_IMPL_H 23 | 24 | #include 25 | 26 | namespace gr { 27 | namespace cw_binary { 28 | 29 | class sample_bit_bb_impl : public sample_bit_bb 30 | { 31 | private: 32 | bool _started; 33 | int _count; 34 | int _bit_length; 35 | 36 | public: 37 | sample_bit_bb_impl(int bit_length); 38 | ~sample_bit_bb_impl(); 39 | 40 | // Where all the action really happens 41 | int work(int noutput_items, 42 | gr_vector_const_void_star &input_items, 43 | gr_vector_void_star &output_items); 44 | }; 45 | 46 | } // namespace cw_binary 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_CW_BINARY_SAMPLE_BIT_BB_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/decode_hamming_bb_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_HAMMING_DECODE_HAMMING_BB_IMPL_H 22 | #define INCLUDED_HAMMING_DECODE_HAMMING_BB_IMPL_H 23 | 24 | #include 25 | #include 26 | 27 | namespace gr { 28 | namespace hamming { 29 | 30 | class decode_hamming_bb_impl : public decode_hamming_bb 31 | { 32 | private: 33 | std::vector H; // detect errors 34 | std::vector R; // decode corrected value 35 | 36 | public: 37 | decode_hamming_bb_impl(); 38 | ~decode_hamming_bb_impl(); 39 | 40 | // Where all the action really happens 41 | int work(int noutput_items, 42 | gr_vector_const_void_star &input_items, 43 | gr_vector_void_star &output_items); 44 | }; 45 | 46 | } // namespace hamming 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_HAMMING_DECODE_HAMMING_BB_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/qa_change_fb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2013 <+YOU OR YOUR COMPANY+>. 5 | # 6 | # This is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # This software is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this software; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | from gnuradio import gr, gr_unittest, blocks 23 | import cw_binary_swig as cw_binary 24 | 25 | class qa_change_fb (gr_unittest.TestCase): 26 | 27 | def setUp (self): 28 | self.tb = gr.top_block () 29 | 30 | def tearDown (self): 31 | self.tb = None 32 | 33 | def test_001_t (self): 34 | src_data = (1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0) 35 | expected_result = (0, 0, 0, 1, 0, 1, 1) 36 | 37 | src = blocks.vector_source_f(src_data) 38 | change = cw_binary.change_fb() 39 | dst = blocks.vector_sink_b() 40 | self.tb.connect(src, change) 41 | self.tb.connect(change, dst) 42 | self.tb.run() 43 | result_data = dst.data() 44 | 45 | self.tb.run () 46 | 47 | self.assertTupleEqual(expected_result, result_data) 48 | 49 | 50 | if __name__ == '__main__': 51 | gr_unittest.run(qa_change_fb, "qa_change_fb.xml") 52 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/sample_on_ctrl_ff_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_IMPL_H 22 | #define INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_IMPL_H 23 | 24 | #include 25 | 26 | namespace gr { 27 | namespace cw_binary { 28 | 29 | class sample_on_ctrl_ff_impl : public sample_on_ctrl_ff 30 | { 31 | private: 32 | // Nothing to declare in this block. 33 | 34 | public: 35 | sample_on_ctrl_ff_impl(); 36 | ~sample_on_ctrl_ff_impl(); 37 | 38 | // Where all the action really happens 39 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 40 | 41 | int general_work(int noutput_items, 42 | gr_vector_int &ninput_items, 43 | gr_vector_const_void_star &input_items, 44 | gr_vector_void_star &output_items); 45 | }; 46 | 47 | } // namespace cw_binary 48 | } // namespace gr 49 | 50 | #endif /* INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_IMPL_H */ 51 | 52 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/qa_sample_bit_bb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2013 <+YOU OR YOUR COMPANY+>. 5 | # 6 | # This is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # This software is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this software; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | from gnuradio import gr, gr_unittest, blocks 23 | import cw_binary_swig as cw_binary 24 | 25 | class qa_sample_bit_bb (gr_unittest.TestCase): 26 | 27 | def setUp (self): 28 | self.tb = gr.top_block () 29 | 30 | def tearDown (self): 31 | self.tb = None 32 | 33 | def test_001_t (self): 34 | src_data = (0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) 35 | expected_result = (0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0) 36 | 37 | src = blocks.vector_source_b(src_data) 38 | sample = cw_binary.sample_bit_bb(4) 39 | dst = blocks.vector_sink_b() 40 | self.tb.connect(src, sample) 41 | self.tb.connect(sample, dst) 42 | self.tb.run() 43 | result_data = dst.data() 44 | 45 | self.tb.run () 46 | 47 | self.assertTupleEqual(expected_result, result_data) 48 | 49 | if __name__ == '__main__': 50 | gr_unittest.run(qa_sample_bit_bb, "qa_sample_bit_bb.xml") 51 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/Modules/GrPlatform.cmake: -------------------------------------------------------------------------------- 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 | if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) 24 | 25 | ######################################################################## 26 | # Setup additional defines for OS types 27 | ######################################################################## 28 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 29 | set(LINUX TRUE) 30 | endif() 31 | 32 | if(LINUX AND EXISTS "/etc/debian_version") 33 | set(DEBIAN TRUE) 34 | endif() 35 | 36 | if(LINUX AND EXISTS "/etc/redhat-release") 37 | set(REDHAT TRUE) 38 | endif() 39 | 40 | ######################################################################## 41 | # when the library suffix should be 64 (applies to redhat linux family) 42 | ######################################################################## 43 | if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") 44 | set(LIB_SUFFIX 64) 45 | endif() 46 | set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") 47 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/Modules/GrPlatform.cmake: -------------------------------------------------------------------------------- 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 | if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) 24 | 25 | ######################################################################## 26 | # Setup additional defines for OS types 27 | ######################################################################## 28 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 29 | set(LINUX TRUE) 30 | endif() 31 | 32 | if(LINUX AND EXISTS "/etc/debian_version") 33 | set(DEBIAN TRUE) 34 | endif() 35 | 36 | if(LINUX AND EXISTS "/etc/redhat-release") 37 | set(REDHAT TRUE) 38 | endif() 39 | 40 | ######################################################################## 41 | # when the library suffix should be 64 (applies to redhat linux family) 42 | ######################################################################## 43 | if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") 44 | set(LIB_SUFFIX 64) 45 | endif() 46 | set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") 47 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/include/cw_binary/change_fb.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_change_fb_H 23 | #define INCLUDED_CW_BINARY_change_fb_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace cw_binary { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup cw_binary 34 | * 35 | */ 36 | class CW_BINARY_API change_fb : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef boost::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of cw_binary::change_fb. 43 | * 44 | * To avoid accidental use of raw pointers, cw_binary::change_fb's 45 | * constructor is in a private implementation 46 | * class. cw_binary::change_fb::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(float epsilon=0.000001); 50 | }; 51 | 52 | } // namespace cw_binary 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_CW_BINARY_change_fb_H */ 56 | 57 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/include/hamming/decode_hamming_bb.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_HAMMING_DECODE_HAMMING_BB_H 23 | #define INCLUDED_HAMMING_DECODE_HAMMING_BB_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace hamming { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup hamming 34 | * 35 | */ 36 | class HAMMING_API decode_hamming_bb : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef boost::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of hamming::decode_hamming_bb. 43 | * 44 | * To avoid accidental use of raw pointers, hamming::decode_hamming_bb's 45 | * constructor is in a private implementation 46 | * class. hamming::decode_hamming_bb::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(); 50 | }; 51 | 52 | } // namespace hamming 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_HAMMING_DECODE_HAMMING_BB_H */ 56 | 57 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/include/hamming/wait_for_prefix_bb.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_H 23 | #define INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace hamming { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup hamming 34 | * 35 | */ 36 | class HAMMING_API wait_for_prefix_bb : virtual public gr::block 37 | { 38 | public: 39 | typedef boost::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of hamming::wait_for_prefix_bb. 43 | * 44 | * To avoid accidental use of raw pointers, hamming::wait_for_prefix_bb's 45 | * constructor is in a private implementation 46 | * class. hamming::wait_for_prefix_bb::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(); 50 | }; 51 | 52 | } // namespace hamming 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_H */ 56 | 57 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/include/cw_binary/sample_bit_bb.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_SAMPLE_BIT_BB_H 23 | #define INCLUDED_CW_BINARY_SAMPLE_BIT_BB_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace cw_binary { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup cw_binary 34 | * 35 | */ 36 | class CW_BINARY_API sample_bit_bb : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef boost::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of cw_binary::sample_bit_bb. 43 | * 44 | * To avoid accidental use of raw pointers, cw_binary::sample_bit_bb's 45 | * constructor is in a private implementation 46 | * class. cw_binary::sample_bit_bb::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(int bit_length=1000); 50 | }; 51 | 52 | } // namespace cw_binary 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_CW_BINARY_SAMPLE_BIT_BB_H */ 56 | 57 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/include/cw_binary/sample_on_ctrl_ff.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_H 23 | #define INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace cw_binary { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup cw_binary 34 | * 35 | */ 36 | class CW_BINARY_API sample_on_ctrl_ff : virtual public gr::block 37 | { 38 | public: 39 | typedef boost::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of cw_binary::sample_on_ctrl_ff. 43 | * 44 | * To avoid accidental use of raw pointers, cw_binary::sample_on_ctrl_ff's 45 | * constructor is in a private implementation 46 | * class. cw_binary::sample_on_ctrl_ff::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(); 50 | }; 51 | 52 | } // namespace cw_binary 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_CW_BINARY_SAMPLE_ON_CTRL_FF_H */ 56 | 57 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/qa_sample_on_ctrl_ff.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2013 <+YOU OR YOUR COMPANY+>. 5 | # 6 | # This is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # This software is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this software; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | from gnuradio import gr, gr_unittest, blocks 23 | import cw_binary_swig as cw_binary 24 | 25 | class qa_sample_on_ctrl_ff (gr_unittest.TestCase): 26 | 27 | def setUp (self): 28 | self.tb = gr.top_block () 29 | 30 | def tearDown (self): 31 | self.tb = None 32 | 33 | def test_001_t (self): 34 | src_data = (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) 35 | ctrl_data = (0, 1, 0, 0, 1, 0, 1, 1, 0, 1) 36 | expected_result = (2.0, 5.0, 7.0, 8.0, 10.0) 37 | 38 | src = blocks.vector_source_f(src_data) 39 | ctrl = blocks.vector_source_b(ctrl_data) 40 | sample = cw_binary.sample_on_ctrl_ff() 41 | dst = blocks.vector_sink_f() 42 | self.tb.connect(src, (sample, 0)) 43 | self.tb.connect(ctrl, (sample, 1)) 44 | self.tb.connect(sample, dst) 45 | self.tb.run() 46 | result_data = dst.data() 47 | 48 | self.assertTupleEqual(expected_result, result_data) 49 | 50 | 51 | if __name__ == '__main__': 52 | gr_unittest.run(qa_sample_on_ctrl_ff, "qa_sample_on_ctrl_ff.xml") 53 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/wait_for_prefix_bb_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifndef INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_IMPL_H 22 | #define INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_IMPL_H 23 | 24 | #include 25 | #include 26 | 27 | namespace gr { 28 | namespace hamming { 29 | 30 | class wait_for_prefix_bb_impl : public wait_for_prefix_bb 31 | { 32 | private: 33 | bool _prefix_seen; 34 | bool _length_seen; 35 | int _count; 36 | int _length; 37 | std::queue _history; 38 | std::queue _prefix; 39 | // Nothing to declare in this block. 40 | 41 | public: 42 | wait_for_prefix_bb_impl(); 43 | ~wait_for_prefix_bb_impl(); 44 | 45 | // Where all the action really happens 46 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 47 | 48 | int general_work(int noutput_items, 49 | gr_vector_int &ninput_items, 50 | gr_vector_const_void_star &input_items, 51 | gr_vector_void_star &output_items); 52 | }; 53 | 54 | } // namespace hamming 55 | } // namespace gr 56 | 57 | #endif /* INCLUDED_HAMMING_WAIT_FOR_PREFIX_BB_IMPL_H */ 58 | 59 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/python/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009 Free Software Foundation, Inc. 3 | # 4 | # This application is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 3, or (at your option) 7 | # any later version. 8 | # 9 | # This application is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along 15 | # with this program; if not, write to the Free Software Foundation, Inc., 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | # 18 | 19 | # The presence of this file turns this directory into a Python package 20 | 21 | ''' 22 | This is the GNU Radio HAMMING module. Place your Python package 23 | description here (python/__init__.py). 24 | ''' 25 | 26 | # ---------------------------------------------------------------- 27 | # Temporary workaround for ticket:181 (swig+python problem) 28 | import sys 29 | _RTLD_GLOBAL = 0 30 | try: 31 | from dl import RTLD_GLOBAL as _RTLD_GLOBAL 32 | except ImportError: 33 | try: 34 | from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL 35 | except ImportError: 36 | pass 37 | 38 | if _RTLD_GLOBAL != 0: 39 | _dlopenflags = sys.getdlopenflags() 40 | sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) 41 | # ---------------------------------------------------------------- 42 | 43 | 44 | # import swig generated symbols into the hamming namespace 45 | from hamming_swig import * 46 | 47 | # import any pure python here 48 | # 49 | 50 | # ---------------------------------------------------------------- 51 | # Tail of workaround 52 | if _RTLD_GLOBAL != 0: 53 | sys.setdlopenflags(_dlopenflags) # Restore original flags 54 | # ---------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009 Free Software Foundation, Inc. 3 | # 4 | # This application is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 3, or (at your option) 7 | # any later version. 8 | # 9 | # This application is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along 15 | # with this program; if not, write to the Free Software Foundation, Inc., 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | # 18 | 19 | # The presence of this file turns this directory into a Python package 20 | 21 | ''' 22 | This is the GNU Radio CW_BINARY module. Place your Python package 23 | description here (python/__init__.py). 24 | ''' 25 | 26 | # ---------------------------------------------------------------- 27 | # Temporary workaround for ticket:181 (swig+python problem) 28 | import sys 29 | _RTLD_GLOBAL = 0 30 | try: 31 | from dl import RTLD_GLOBAL as _RTLD_GLOBAL 32 | except ImportError: 33 | try: 34 | from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL 35 | except ImportError: 36 | pass 37 | 38 | if _RTLD_GLOBAL != 0: 39 | _dlopenflags = sys.getdlopenflags() 40 | sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) 41 | # ---------------------------------------------------------------- 42 | 43 | 44 | # import swig generated symbols into the cw_binary namespace 45 | from cw_binary_swig import * 46 | 47 | # import any pure python here 48 | # 49 | 50 | # ---------------------------------------------------------------- 51 | # Tail of workaround 52 | if _RTLD_GLOBAL != 0: 53 | sys.setdlopenflags(_dlopenflags) # Restore original flags 54 | # ---------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Include python install macros 22 | ######################################################################## 23 | include(GrPython) 24 | if(NOT PYTHONINTERP_FOUND) 25 | return() 26 | endif() 27 | 28 | ######################################################################## 29 | # Install python sources 30 | ######################################################################## 31 | GR_PYTHON_INSTALL( 32 | FILES 33 | __init__.py 34 | DESTINATION ${GR_PYTHON_DIR}/cw_binary 35 | ) 36 | 37 | ######################################################################## 38 | # Handle the unit tests 39 | ######################################################################## 40 | include(GrTest) 41 | 42 | set(GR_TEST_TARGET_DEPS gnuradio-cw_binary) 43 | set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) 44 | GR_ADD_TEST(qa_change_fb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_change_fb.py) 45 | GR_ADD_TEST(qa_sample_bit_bb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_sample_bit_bb.py) 46 | GR_ADD_TEST(qa_sample_on_ctrl_ff ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_sample_on_ctrl_ff.py) 47 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/text.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Utilities for extracting text from generated classes. 23 | """ 24 | 25 | def is_string(txt): 26 | if isinstance(txt, str): 27 | return True 28 | try: 29 | if isinstance(txt, unicode): 30 | return True 31 | except NameError: 32 | pass 33 | return False 34 | 35 | def description(obj): 36 | if obj is None: 37 | return None 38 | return description_bit(obj).strip() 39 | 40 | def description_bit(obj): 41 | if hasattr(obj, 'content'): 42 | contents = [description_bit(item) for item in obj.content] 43 | result = ''.join(contents) 44 | elif hasattr(obj, 'content_'): 45 | contents = [description_bit(item) for item in obj.content_] 46 | result = ''.join(contents) 47 | elif hasattr(obj, 'value'): 48 | result = description_bit(obj.value) 49 | elif is_string(obj): 50 | return obj 51 | else: 52 | raise StandardError('Expecting a string or something with content, content_ or value attribute') 53 | # If this bit is a paragraph then add one some line breaks. 54 | if hasattr(obj, 'name') and obj.name == 'para': 55 | result += "\n\n" 56 | return result 57 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/text.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Utilities for extracting text from generated classes. 23 | """ 24 | 25 | def is_string(txt): 26 | if isinstance(txt, str): 27 | return True 28 | try: 29 | if isinstance(txt, unicode): 30 | return True 31 | except NameError: 32 | pass 33 | return False 34 | 35 | def description(obj): 36 | if obj is None: 37 | return None 38 | return description_bit(obj).strip() 39 | 40 | def description_bit(obj): 41 | if hasattr(obj, 'content'): 42 | contents = [description_bit(item) for item in obj.content] 43 | result = ''.join(contents) 44 | elif hasattr(obj, 'content_'): 45 | contents = [description_bit(item) for item in obj.content_] 46 | result = ''.join(contents) 47 | elif hasattr(obj, 'value'): 48 | result = description_bit(obj.value) 49 | elif is_string(obj): 50 | return obj 51 | else: 52 | raise StandardError('Expecting a string or something with content, content_ or value attribute') 53 | # If this bit is a paragraph then add one some line breaks. 54 | if hasattr(obj, 'name') and obj.name == 'para': 55 | result += "\n\n" 56 | return result 57 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/python/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Include python install macros 22 | ######################################################################## 23 | include(GrPython) 24 | if(NOT PYTHONINTERP_FOUND) 25 | return() 26 | endif() 27 | 28 | ######################################################################## 29 | # Install python sources 30 | ######################################################################## 31 | GR_PYTHON_INSTALL( 32 | FILES 33 | __init__.py 34 | DESTINATION ${GR_PYTHON_DIR}/hamming 35 | ) 36 | 37 | ######################################################################## 38 | # Handle the unit tests 39 | ######################################################################## 40 | include(GrTest) 41 | 42 | set(GR_TEST_TARGET_DEPS gnuradio-hamming) 43 | set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) 44 | GR_ADD_TEST(qa_decode_hamming_bb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_decode_hamming_bb.py) 45 | GR_ADD_TEST(qa_wait_for_prefix_bb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_wait_for_prefix_bb.py) 46 | GR_ADD_TEST(qa_wait_for_prefix_bb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_wait_for_prefix_bb.py) 47 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/generated/index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | """ 4 | Generated Mon Feb 9 19:08:05 2009 by generateDS.py. 5 | """ 6 | 7 | from xml.dom import minidom 8 | 9 | import os 10 | import sys 11 | import compound 12 | 13 | import indexsuper as supermod 14 | 15 | class DoxygenTypeSub(supermod.DoxygenType): 16 | def __init__(self, version=None, compound=None): 17 | supermod.DoxygenType.__init__(self, version, compound) 18 | 19 | def find_compounds_and_members(self, details): 20 | """ 21 | Returns a list of all compounds and their members which match details 22 | """ 23 | 24 | results = [] 25 | for compound in self.compound: 26 | members = compound.find_members(details) 27 | if members: 28 | results.append([compound, members]) 29 | else: 30 | if details.match(compound): 31 | results.append([compound, []]) 32 | 33 | return results 34 | 35 | supermod.DoxygenType.subclass = DoxygenTypeSub 36 | # end class DoxygenTypeSub 37 | 38 | 39 | class CompoundTypeSub(supermod.CompoundType): 40 | def __init__(self, kind=None, refid=None, name='', member=None): 41 | supermod.CompoundType.__init__(self, kind, refid, name, member) 42 | 43 | def find_members(self, details): 44 | """ 45 | Returns a list of all members which match details 46 | """ 47 | 48 | results = [] 49 | 50 | for member in self.member: 51 | if details.match(member): 52 | results.append(member) 53 | 54 | return results 55 | 56 | supermod.CompoundType.subclass = CompoundTypeSub 57 | # end class CompoundTypeSub 58 | 59 | 60 | class MemberTypeSub(supermod.MemberType): 61 | 62 | def __init__(self, kind=None, refid=None, name=''): 63 | supermod.MemberType.__init__(self, kind, refid, name) 64 | 65 | supermod.MemberType.subclass = MemberTypeSub 66 | # end class MemberTypeSub 67 | 68 | 69 | def parse(inFilename): 70 | 71 | doc = minidom.parse(inFilename) 72 | rootNode = doc.documentElement 73 | rootObj = supermod.DoxygenType.factory() 74 | rootObj.build(rootNode) 75 | 76 | return rootObj 77 | 78 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Create the doxygen configuration file 22 | ######################################################################## 23 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) 24 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) 25 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) 26 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) 27 | 28 | set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) 29 | set(enable_html_docs YES) 30 | set(enable_latex_docs NO) 31 | set(enable_xml_docs YES) 32 | 33 | configure_file( 34 | ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in 35 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 36 | @ONLY) 37 | 38 | set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) 39 | 40 | ######################################################################## 41 | # Make and install doxygen docs 42 | ######################################################################## 43 | add_custom_command( 44 | OUTPUT ${BUILT_DIRS} 45 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 46 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 47 | COMMENT "Generating documentation with doxygen" 48 | ) 49 | 50 | add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS}) 51 | 52 | install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR}) 53 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/generated/index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | """ 4 | Generated Mon Feb 9 19:08:05 2009 by generateDS.py. 5 | """ 6 | 7 | from xml.dom import minidom 8 | 9 | import os 10 | import sys 11 | import compound 12 | 13 | import indexsuper as supermod 14 | 15 | class DoxygenTypeSub(supermod.DoxygenType): 16 | def __init__(self, version=None, compound=None): 17 | supermod.DoxygenType.__init__(self, version, compound) 18 | 19 | def find_compounds_and_members(self, details): 20 | """ 21 | Returns a list of all compounds and their members which match details 22 | """ 23 | 24 | results = [] 25 | for compound in self.compound: 26 | members = compound.find_members(details) 27 | if members: 28 | results.append([compound, members]) 29 | else: 30 | if details.match(compound): 31 | results.append([compound, []]) 32 | 33 | return results 34 | 35 | supermod.DoxygenType.subclass = DoxygenTypeSub 36 | # end class DoxygenTypeSub 37 | 38 | 39 | class CompoundTypeSub(supermod.CompoundType): 40 | def __init__(self, kind=None, refid=None, name='', member=None): 41 | supermod.CompoundType.__init__(self, kind, refid, name, member) 42 | 43 | def find_members(self, details): 44 | """ 45 | Returns a list of all members which match details 46 | """ 47 | 48 | results = [] 49 | 50 | for member in self.member: 51 | if details.match(member): 52 | results.append(member) 53 | 54 | return results 55 | 56 | supermod.CompoundType.subclass = CompoundTypeSub 57 | # end class CompoundTypeSub 58 | 59 | 60 | class MemberTypeSub(supermod.MemberType): 61 | 62 | def __init__(self, kind=None, refid=None, name=''): 63 | supermod.MemberType.__init__(self, kind, refid, name) 64 | 65 | supermod.MemberType.subclass = MemberTypeSub 66 | # end class MemberTypeSub 67 | 68 | 69 | def parse(inFilename): 70 | 71 | doc = minidom.parse(inFilename) 72 | rootNode = doc.documentElement 73 | rootObj = supermod.DoxygenType.factory() 74 | rootObj.build(rootNode) 75 | 76 | return rootObj 77 | 78 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Create the doxygen configuration file 22 | ######################################################################## 23 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) 24 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) 25 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) 26 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) 27 | 28 | set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) 29 | set(enable_html_docs YES) 30 | set(enable_latex_docs NO) 31 | set(enable_xml_docs YES) 32 | 33 | configure_file( 34 | ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in 35 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 36 | @ONLY) 37 | 38 | set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) 39 | 40 | ######################################################################## 41 | # Make and install doxygen docs 42 | ######################################################################## 43 | add_custom_command( 44 | OUTPUT ${BUILT_DIRS} 45 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 46 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 47 | COMMENT "Generating documentation with doxygen" 48 | ) 49 | 50 | add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS}) 51 | 52 | install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR}) 53 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/swig/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Include swig generation macros 22 | ######################################################################## 23 | find_package(SWIG) 24 | find_package(PythonLibs 2) 25 | if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) 26 | return() 27 | endif() 28 | include(GrSwig) 29 | include(GrPython) 30 | 31 | ######################################################################## 32 | # Setup swig generation 33 | ######################################################################## 34 | foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) 35 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) 36 | endforeach(incdir) 37 | 38 | set(GR_SWIG_LIBRARIES gnuradio-hamming) 39 | set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/hamming_swig_doc.i) 40 | set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) 41 | 42 | GR_SWIG_MAKE(hamming_swig hamming_swig.i) 43 | 44 | ######################################################################## 45 | # Install the build swig module 46 | ######################################################################## 47 | GR_SWIG_INSTALL(TARGETS hamming_swig DESTINATION ${GR_PYTHON_DIR}/hamming) 48 | 49 | ######################################################################## 50 | # Install swig .i files for development 51 | ######################################################################## 52 | install( 53 | FILES 54 | hamming_swig.i 55 | ${CMAKE_CURRENT_BINARY_DIR}/hamming_swig_doc.i 56 | DESTINATION ${GR_INCLUDE_DIR}/hamming/swig 57 | ) 58 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/swig/CMakeLists.txt: -------------------------------------------------------------------------------- 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 | # Include swig generation macros 22 | ######################################################################## 23 | find_package(SWIG) 24 | find_package(PythonLibs 2) 25 | if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) 26 | return() 27 | endif() 28 | include(GrSwig) 29 | include(GrPython) 30 | 31 | ######################################################################## 32 | # Setup swig generation 33 | ######################################################################## 34 | foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) 35 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) 36 | endforeach(incdir) 37 | 38 | set(GR_SWIG_LIBRARIES gnuradio-cw_binary) 39 | set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/cw_binary_swig_doc.i) 40 | set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) 41 | 42 | GR_SWIG_MAKE(cw_binary_swig cw_binary_swig.i) 43 | 44 | ######################################################################## 45 | # Install the build swig module 46 | ######################################################################## 47 | GR_SWIG_INSTALL(TARGETS cw_binary_swig DESTINATION ${GR_PYTHON_DIR}/cw_binary) 48 | 49 | ######################################################################## 50 | # Install swig .i files for development 51 | ######################################################################## 52 | install( 53 | FILES 54 | cw_binary_swig.i 55 | ${CMAKE_CURRENT_BINARY_DIR}/cw_binary_swig_doc.i 56 | DESTINATION ${GR_INCLUDE_DIR}/cw_binary/swig 57 | ) 58 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/python/qa_wait_for_prefix_bb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2013 <+YOU OR YOUR COMPANY+>. 5 | # 6 | # This is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # This software is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this software; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | from gnuradio import gr, gr_unittest, blocks 23 | import hamming_swig as hamming 24 | 25 | class qa_wait_for_prefix_bb (gr_unittest.TestCase): 26 | 27 | 28 | def setUp (self): 29 | self.tb = gr.top_block () 30 | self.prefix = (1, 1, 0, 0) * 4 31 | 32 | def tearDown (self): 33 | self.tb = None 34 | 35 | def test_001_t (self): 36 | msg_len = 3 37 | msg = (1, 0, 1, 0, 1, 0, 1, 0) * msg_len * 2 38 | msg_len_bin = (0, 0, 0, 0, 0, 0, 1, 1) 39 | src_data = self.prefix + msg_len_bin + msg + (0, 0, 0, 0, 0, 0, 0, 0) 40 | expected_result = msg 41 | 42 | src = blocks.vector_source_b(src_data) 43 | wait = hamming.wait_for_prefix_bb() 44 | dst = blocks.vector_sink_b() 45 | 46 | self.tb.connect(src, wait) 47 | self.tb.connect(wait, dst) 48 | self.tb.run () 49 | 50 | self.assertTupleEqual(expected_result, dst.data()) 51 | 52 | def test_001_t (self): 53 | msg_len = 3 54 | msg = (1, 0, 1, 0, 1, 0, 1, 0) * msg_len * 2 55 | msg_len_bin = (0, 0, 0, 0, 0, 0, 1, 1) 56 | src_data = (0, 0, 0, 0) + self.prefix + msg_len_bin + msg + (0, 0, 0, 0, 0, 0, 0, 0) 57 | expected_result = msg * 2 58 | 59 | src = blocks.vector_source_b(src_data * 2) 60 | wait = hamming.wait_for_prefix_bb() 61 | dst = blocks.vector_sink_b() 62 | 63 | self.tb.connect(src, wait) 64 | self.tb.connect(wait, dst) 65 | self.tb.run () 66 | 67 | self.assertTupleEqual(expected_result, dst.data()) 68 | 69 | 70 | if __name__ == '__main__': 71 | gr_unittest.run(qa_wait_for_prefix_bb, "qa_wait_for_prefix_bb.xml") 72 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/change_fb_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include 27 | #include "change_fb_impl.h" 28 | 29 | namespace gr { 30 | namespace cw_binary { 31 | 32 | change_fb::sptr 33 | change_fb::make(float epsilon) 34 | { 35 | return gnuradio::get_initial_sptr 36 | (new change_fb_impl(epsilon)); 37 | } 38 | 39 | /* 40 | * The private constructor 41 | */ 42 | change_fb_impl::change_fb_impl(float epsilon) 43 | : gr::sync_block("change_fb", 44 | gr::io_signature::make(1, 1, sizeof(float)), 45 | gr::io_signature::make(1, 1, sizeof(char))) 46 | { 47 | _epsilon = epsilon; 48 | _last = 0; 49 | _started = false; 50 | } 51 | 52 | /* 53 | * Our virtual destructor. 54 | */ 55 | change_fb_impl::~change_fb_impl() 56 | { 57 | } 58 | 59 | int 60 | change_fb_impl::work(int noutput_items, 61 | gr_vector_const_void_star &input_items, 62 | gr_vector_void_star &output_items) 63 | { 64 | const float *in = (const float *) input_items[0]; 65 | char *out = (char *) output_items[0]; 66 | 67 | // Do <+signal processing+> 68 | for(size_t i = 0; i < noutput_items; i++) { 69 | if (_started && abs(_last - in[i]) > _epsilon) { 70 | out[i] = 1; 71 | } else { 72 | out[i] = 0; 73 | } 74 | _started = true; 75 | _last = in[i]; 76 | } 77 | 78 | // Tell runtime system how many output items we produced. 79 | return noutput_items; 80 | } 81 | 82 | } /* namespace cw_binary */ 83 | } /* namespace gr */ 84 | 85 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/sample_bit_bb_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include "sample_bit_bb_impl.h" 27 | 28 | namespace gr { 29 | namespace cw_binary { 30 | 31 | sample_bit_bb::sptr 32 | sample_bit_bb::make(int bit_length) 33 | { 34 | return gnuradio::get_initial_sptr 35 | (new sample_bit_bb_impl(bit_length)); 36 | } 37 | 38 | /* 39 | * The private constructor 40 | */ 41 | sample_bit_bb_impl::sample_bit_bb_impl(int bit_length) 42 | : gr::sync_block("sample_bit_bb", 43 | gr::io_signature::make(1, 1, sizeof(char)), 44 | gr::io_signature::make(1, 1, sizeof(char))) 45 | { 46 | _started = false; 47 | _bit_length = bit_length; 48 | } 49 | 50 | /* 51 | * Our virtual destructor. 52 | */ 53 | sample_bit_bb_impl::~sample_bit_bb_impl() 54 | { 55 | } 56 | 57 | int 58 | sample_bit_bb_impl::work(int noutput_items, 59 | gr_vector_const_void_star &input_items, 60 | gr_vector_void_star &output_items) 61 | { 62 | const char *in = (const char *) input_items[0]; 63 | char *out = (char *) output_items[0]; 64 | 65 | for(int i = 0; i < noutput_items; i++) { 66 | out[i] = 0; 67 | if (in[i]) { 68 | _started = true; 69 | _count = _bit_length / 2; 70 | } else if (_started && _count++ == _bit_length) { 71 | out[i] = 1; 72 | _count = 0; 73 | } 74 | } 75 | 76 | // Tell runtime system how many output items we produced. 77 | return noutput_items; 78 | } 79 | 80 | } /* namespace cw_binary */ 81 | } /* namespace gr */ 82 | 83 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Setup library 22 | ######################################################################## 23 | include(GrPlatform) #define LIB_SUFFIX 24 | 25 | include_directories(${Boost_INCLUDE_DIR}) 26 | link_directories(${Boost_LIBRARY_DIRS}) 27 | list(APPEND hamming_sources 28 | decode_hamming_bb_impl.cc 29 | wait_for_prefix_bb_impl.cc 30 | wait_for_prefix_bb_impl.cc 31 | ) 32 | 33 | add_library(gnuradio-hamming SHARED ${hamming_sources}) 34 | target_link_libraries(gnuradio-hamming ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) 35 | set_target_properties(gnuradio-hamming PROPERTIES DEFINE_SYMBOL "gnuradio_hamming_EXPORTS") 36 | 37 | ######################################################################## 38 | # Install built library files 39 | ######################################################################## 40 | install(TARGETS gnuradio-hamming 41 | LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file 42 | ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file 43 | RUNTIME DESTINATION bin # .dll file 44 | ) 45 | 46 | ######################################################################## 47 | # Build and register unit test 48 | ######################################################################## 49 | include(GrTest) 50 | 51 | include_directories(${CPPUNIT_INCLUDE_DIRS}) 52 | 53 | list(APPEND test_hamming_sources 54 | ${CMAKE_CURRENT_SOURCE_DIR}/test_hamming.cc 55 | ${CMAKE_CURRENT_SOURCE_DIR}/qa_hamming.cc 56 | ) 57 | 58 | add_executable(test-hamming ${test_hamming_sources}) 59 | 60 | target_link_libraries( 61 | test-hamming 62 | ${GNURADIO_RUNTIME_LIBRARIES} 63 | ${Boost_LIBRARIES} 64 | ${CPPUNIT_LIBRARIES} 65 | gnuradio-hamming 66 | ) 67 | 68 | GR_ADD_TEST(test_hamming test-hamming) 69 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Setup library 22 | ######################################################################## 23 | include(GrPlatform) #define LIB_SUFFIX 24 | 25 | include_directories(${Boost_INCLUDE_DIR}) 26 | link_directories(${Boost_LIBRARY_DIRS}) 27 | 28 | list(APPEND cw_binary_sources 29 | change_fb_impl.cc 30 | sample_bit_bb_impl.cc 31 | sample_on_ctrl_ff_impl.cc 32 | ) 33 | 34 | add_library(gnuradio-cw_binary SHARED ${cw_binary_sources}) 35 | target_link_libraries(gnuradio-cw_binary ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) 36 | set_target_properties(gnuradio-cw_binary PROPERTIES DEFINE_SYMBOL "gnuradio_cw_binary_EXPORTS") 37 | 38 | ######################################################################## 39 | # Install built library files 40 | ######################################################################## 41 | install(TARGETS gnuradio-cw_binary 42 | LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file 43 | ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file 44 | RUNTIME DESTINATION bin # .dll file 45 | ) 46 | 47 | ######################################################################## 48 | # Build and register unit test 49 | ######################################################################## 50 | include(GrTest) 51 | 52 | include_directories(${CPPUNIT_INCLUDE_DIRS}) 53 | 54 | list(APPEND test_cw_binary_sources 55 | ${CMAKE_CURRENT_SOURCE_DIR}/test_cw_binary.cc 56 | ${CMAKE_CURRENT_SOURCE_DIR}/qa_cw_binary.cc 57 | ) 58 | 59 | add_executable(test-cw_binary ${test_cw_binary_sources}) 60 | 61 | target_link_libraries( 62 | test-cw_binary 63 | ${GNURADIO_RUNTIME_LIBRARIES} 64 | ${Boost_LIBRARIES} 65 | ${CPPUNIT_LIBRARIES} 66 | gnuradio-cw_binary 67 | ) 68 | 69 | GR_ADD_TEST(test_cw_binary test-cw_binary) 70 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Python interface to contents of doxygen xml documentation. 23 | 24 | Example use: 25 | See the contents of the example folder for the C++ and 26 | doxygen-generated xml used in this example. 27 | 28 | >>> # Parse the doxygen docs. 29 | >>> import os 30 | >>> this_dir = os.path.dirname(globals()['__file__']) 31 | >>> xml_path = this_dir + "/example/xml/" 32 | >>> di = DoxyIndex(xml_path) 33 | 34 | Get a list of all top-level objects. 35 | 36 | >>> print([mem.name() for mem in di.members()]) 37 | [u'Aadvark', u'aadvarky_enough', u'main'] 38 | 39 | Get all functions. 40 | 41 | >>> print([mem.name() for mem in di.in_category(DoxyFunction)]) 42 | [u'aadvarky_enough', u'main'] 43 | 44 | Check if an object is present. 45 | 46 | >>> di.has_member(u'Aadvark') 47 | True 48 | >>> di.has_member(u'Fish') 49 | False 50 | 51 | Get an item by name and check its properties. 52 | 53 | >>> aad = di.get_member(u'Aadvark') 54 | >>> print(aad.brief_description) 55 | Models the mammal Aadvark. 56 | >>> print(aad.detailed_description) 57 | Sadly the model is incomplete and cannot capture all aspects of an aadvark yet. 58 | 59 | This line is uninformative and is only to test line breaks in the comments. 60 | >>> [mem.name() for mem in aad.members()] 61 | [u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness'] 62 | >>> aad.get_member(u'print').brief_description 63 | u'Outputs the vital aadvark statistics.' 64 | 65 | """ 66 | 67 | from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther 68 | 69 | def _test(): 70 | import os 71 | this_dir = os.path.dirname(globals()['__file__']) 72 | xml_path = this_dir + "/example/xml/" 73 | di = DoxyIndex(xml_path) 74 | # Get the Aadvark class 75 | aad = di.get_member('Aadvark') 76 | aad.brief_description 77 | import doctest 78 | return doctest.testmod() 79 | 80 | if __name__ == "__main__": 81 | _test() 82 | 83 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Python interface to contents of doxygen xml documentation. 23 | 24 | Example use: 25 | See the contents of the example folder for the C++ and 26 | doxygen-generated xml used in this example. 27 | 28 | >>> # Parse the doxygen docs. 29 | >>> import os 30 | >>> this_dir = os.path.dirname(globals()['__file__']) 31 | >>> xml_path = this_dir + "/example/xml/" 32 | >>> di = DoxyIndex(xml_path) 33 | 34 | Get a list of all top-level objects. 35 | 36 | >>> print([mem.name() for mem in di.members()]) 37 | [u'Aadvark', u'aadvarky_enough', u'main'] 38 | 39 | Get all functions. 40 | 41 | >>> print([mem.name() for mem in di.in_category(DoxyFunction)]) 42 | [u'aadvarky_enough', u'main'] 43 | 44 | Check if an object is present. 45 | 46 | >>> di.has_member(u'Aadvark') 47 | True 48 | >>> di.has_member(u'Fish') 49 | False 50 | 51 | Get an item by name and check its properties. 52 | 53 | >>> aad = di.get_member(u'Aadvark') 54 | >>> print(aad.brief_description) 55 | Models the mammal Aadvark. 56 | >>> print(aad.detailed_description) 57 | Sadly the model is incomplete and cannot capture all aspects of an aadvark yet. 58 | 59 | This line is uninformative and is only to test line breaks in the comments. 60 | >>> [mem.name() for mem in aad.members()] 61 | [u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness'] 62 | >>> aad.get_member(u'print').brief_description 63 | u'Outputs the vital aadvark statistics.' 64 | 65 | """ 66 | 67 | from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther 68 | 69 | def _test(): 70 | import os 71 | this_dir = os.path.dirname(globals()['__file__']) 72 | xml_path = this_dir + "/example/xml/" 73 | di = DoxyIndex(xml_path) 74 | # Get the Aadvark class 75 | aad = di.get_member('Aadvark') 76 | aad.brief_description 77 | import doctest 78 | return doctest.testmod() 79 | 80 | if __name__ == "__main__": 81 | _test() 82 | 83 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/lib/sample_on_ctrl_ff_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include "sample_on_ctrl_ff_impl.h" 27 | 28 | namespace gr { 29 | namespace cw_binary { 30 | 31 | sample_on_ctrl_ff::sptr 32 | sample_on_ctrl_ff::make() 33 | { 34 | return gnuradio::get_initial_sptr 35 | (new sample_on_ctrl_ff_impl()); 36 | } 37 | 38 | /* 39 | * The private constructor 40 | */ 41 | sample_on_ctrl_ff_impl::sample_on_ctrl_ff_impl() 42 | : gr::block("sample_on_ctrl_ff", 43 | gr::io_signature::make2(2, 2, sizeof(float), sizeof(char)), 44 | gr::io_signature::make(1, 1, sizeof(float))) 45 | {} 46 | 47 | /* 48 | * Our virtual destructor. 49 | */ 50 | sample_on_ctrl_ff_impl::~sample_on_ctrl_ff_impl() 51 | { 52 | } 53 | 54 | void 55 | sample_on_ctrl_ff_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) 56 | { 57 | ninput_items_required[0] = noutput_items; 58 | ninput_items_required[1] = noutput_items; 59 | } 60 | 61 | int 62 | sample_on_ctrl_ff_impl::general_work (int noutput_items, 63 | gr_vector_int &ninput_items, 64 | gr_vector_const_void_star &input_items, 65 | gr_vector_void_star &output_items) 66 | { 67 | const float *in = (const float *) input_items[0]; 68 | const char *ctrl = (const char *) input_items[1]; 69 | float *out = (float *) output_items[0]; 70 | 71 | // Do <+signal processing+> 72 | int j = 0; 73 | for (int i = 0; i < noutput_items; i++) { 74 | if (ctrl[i]) { 75 | out[j++] = in[i]; 76 | } 77 | } 78 | 79 | // Tell runtime system how many input items we consumed on 80 | // each input stream. 81 | consume_each (noutput_items); 82 | 83 | // Tell runtime system how many output items we produced. 84 | return j; 85 | } 86 | 87 | } /* namespace cw_binary */ 88 | } /* namespace gr */ 89 | 90 | -------------------------------------------------------------------------------- /beaglebone/gpio/send_message.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "gpio.h" 9 | 10 | /* Code for working with a Hamming(7,4) code with extra parity bit. */ 11 | const unsigned char HAMMING[] = { 12 | 0b00000000, 13 | 0b11010010, 14 | 0b01010101, 15 | 0b10000111, 16 | 0b10011001, 17 | 0b01001011, 18 | 0b11001100, 19 | 0b00011110, 20 | 0b11100001, 21 | 0b00110011, 22 | 0b10110100, 23 | 0b01100110, 24 | 0b01111000, 25 | 0b10101010, 26 | 0b00101101, 27 | 0b11111111 28 | }; 29 | 30 | /* Convert the lower 4 bytes of nibble into 8 bytes, representing the Hamming 31 | * encoding. 32 | */ 33 | unsigned char nibble_to_hamming(unsigned char nibble) 34 | { 35 | return HAMMING[nibble]; 36 | } 37 | 38 | /* Convert the data in the given array to its Hamming-encoded version of length 39 | * (2*length). 40 | */ 41 | unsigned char *data_to_hamming(unsigned char *data, size_t length) 42 | { 43 | size_t i; 44 | unsigned char *hamming = calloc(length * 2, sizeof(char)); 45 | 46 | for (i = 0; i < length; i++) { 47 | hamming[2*i] = (unsigned char) nibble_to_hamming(data[i] >> 4); 48 | hamming[2*i+1] = (unsigned char) nibble_to_hamming(data[i] & 0x0f); 49 | } 50 | 51 | return hamming; 52 | } 53 | 54 | /* Convert a char to a char[8], where the values are 1 or 0 corresponding to the 55 | * bits in the original char. 56 | */ 57 | char *get_byte(char byte) 58 | { 59 | int i; 60 | char *buf = malloc(sizeof(char) * 8); 61 | 62 | for (i = 0; i < 8; i++) { 63 | buf[i] = byte >> (8 - 1 - i) & 0x1; 64 | } 65 | 66 | return buf; 67 | } 68 | 69 | /* Send a message, converted to its Hamming coding and with a special prefix, 70 | * over GPIO. 71 | */ 72 | main(int argc, char **argv) 73 | { 74 | unsigned char prefix[] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xcc, 0xcc}; 75 | int prefix_len = sizeof(prefix) / sizeof(char); 76 | unsigned char *data = argv[1]; 77 | unsigned char *hamming, *message, *buf; 78 | int length = strlen(data); 79 | int fd, i, j; 80 | 81 | // Make sure to 'mknod /dev/gpio c 60 0' 82 | // May also need to 'chmod 666 /dev/gpio' 83 | fd = open("/dev/gpio", O_RDWR | O_SYNC); 84 | 85 | if (fd < 0) { 86 | printf("Can't open device file\n"); 87 | exit(-1); 88 | } 89 | 90 | int ret_val = ioctl(fd, IOC_SET, 200000); 91 | if (ret_val < 0) { 92 | printf("set cycles failed:%d\n", ret_val); 93 | exit(-1); 94 | } 95 | 96 | // Each byte takes 2 bytes to transmit Hamming-coded 97 | // Each packet has a prefix of fixed length followed by a 1-byte size field 98 | hamming = data_to_hamming(data, length); 99 | message = malloc(sizeof(char) * (length * 2 + prefix_len + 1)); 100 | memcpy(message, prefix, prefix_len); 101 | message[prefix_len] = (char) length; 102 | memcpy(message + prefix_len + 1, hamming, length * 2); 103 | buf = malloc(sizeof(char *) * 8 * (length * 2 + prefix_len + 1)); 104 | 105 | for (i = 0; i < length * 2 + prefix_len + 1; ++i) { 106 | char *tmp = get_byte(message[i]); 107 | 108 | for (j = 0; j < 8; j++) { 109 | buf[i*8+j] = tmp[j]; 110 | } 111 | 112 | free(tmp); 113 | } 114 | 115 | ret_val = write(fd, buf, 8 * (length * 2 + prefix_len + 1)); 116 | 117 | free(message); 118 | close(fd); 119 | } 120 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/decode_hamming_bb_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include 27 | #include "decode_hamming_bb_impl.h" 28 | 29 | namespace gr { 30 | namespace hamming { 31 | 32 | decode_hamming_bb::sptr 33 | decode_hamming_bb::make() 34 | { 35 | return gnuradio::get_initial_sptr 36 | (new decode_hamming_bb_impl()); 37 | } 38 | 39 | /* 40 | * The private constructor 41 | */ 42 | decode_hamming_bb_impl::decode_hamming_bb_impl() 43 | : gr::sync_block("decode_hamming_bb", 44 | gr::io_signature::make(1, 1, sizeof(char)), 45 | gr::io_signature::make(1, 1, sizeof(char))) 46 | { 47 | H = std::vector(3); 48 | H[0] = 0b01010101; 49 | H[1] = 0b00110011; 50 | H[2] = 0b00001111; 51 | 52 | R = std::vector(4); 53 | R[0] = 0b00010000; 54 | R[1] = 0b00000100; 55 | R[2] = 0b00000010; 56 | R[3] = 0b00000001; 57 | } 58 | 59 | /* 60 | * Our virtual destructor. 61 | */ 62 | decode_hamming_bb_impl::~decode_hamming_bb_impl() 63 | { 64 | } 65 | 66 | int 67 | decode_hamming_bb_impl::work(int noutput_items, 68 | gr_vector_const_void_star &input_items, 69 | gr_vector_void_star &output_items) 70 | { 71 | const char *in = (const char *) input_items[0]; 72 | char *out = (char *) output_items[0]; 73 | 74 | for (size_t i = 0; i < noutput_items; i++) { 75 | // get rid of parity bit 76 | char hamming_coded = (in[i] >> 1) & 0b01111111; 77 | 78 | char error_bit = 0; 79 | for (int j = 0; j < 3; j++) { 80 | char a = hamming_coded & H[j]; 81 | int count = 0; 82 | while (a) { 83 | a &= a - 1; 84 | count++; 85 | } 86 | if (count % 2 != 0) { 87 | error_bit |= 1 << j; 88 | } 89 | } 90 | if (error_bit) { 91 | hamming_coded = (in[i] ^ (1 << (8 - error_bit))) >> 1; 92 | hamming_coded &= 0b01111111; 93 | } 94 | 95 | char data = 0; 96 | for (int j = 0; j < 4; j++) { 97 | if (hamming_coded & R[j]) { 98 | data += 1 << (3 - j); 99 | } 100 | } 101 | out[i] = data; 102 | } 103 | 104 | // Tell runtime system how many output items we produced. 105 | return noutput_items; 106 | } 107 | 108 | } /* namespace hamming */ 109 | } /* namespace gr */ 110 | 111 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/python/qa_decode_hamming_bb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2013 <+YOU OR YOUR COMPANY+>. 5 | # 6 | # This is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # This software is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this software; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | from gnuradio import gr, gr_unittest, blocks 23 | import hamming_swig as hamming 24 | 25 | class qa_decode_hamming_bb (gr_unittest.TestCase): 26 | 27 | def setUp (self): 28 | self.tb = gr.top_block () 29 | 30 | def tearDown (self): 31 | self.tb = None 32 | 33 | def test_001_t (self): 34 | # test perfectly hamming coded 35 | hamming_vals = [ 36 | (0b0000, 0b00000000), 37 | (0b1000, 0b11100001), 38 | (0b0100, 0b10011001), 39 | (0b1100, 0b01111000), 40 | (0b0010, 0b01010101), 41 | (0b1010, 0b10110100), 42 | (0b0110, 0b11001100), 43 | (0b1110, 0b00101101), 44 | (0b0001, 0b11010010), 45 | (0b1001, 0b00110011), 46 | (0b0101, 0b01001011), 47 | (0b1101, 0b10101010), 48 | (0b0011, 0b10000111), 49 | (0b1011, 0b01100110), 50 | (0b0111, 0b00011110), 51 | (0b1111, 0b11111111) 52 | ] 53 | expected_results, src_data = zip(*hamming_vals) 54 | 55 | src = blocks.vector_source_b(src_data) 56 | hamming_decode = hamming.decode_hamming_bb() 57 | dst = blocks.vector_sink_b() 58 | self.tb.connect(src, hamming_decode) 59 | self.tb.connect(hamming_decode, dst) 60 | self.tb.run () 61 | # check data 62 | result_data = dst.data() 63 | self.assertTupleEqual(expected_results, result_data) 64 | 65 | def test_002_t (self): 66 | # test 1 error hamming coded 67 | hamming_vals = [ 68 | (0b0000, 0b00000000 ^ 0b10000000), 69 | (0b1000, 0b11100001 ^ 0b01000000), 70 | (0b0100, 0b10011001 ^ 0b00100000), 71 | (0b1100, 0b01111000 ^ 0b00010000), 72 | (0b0010, 0b01010101 ^ 0b00001000), 73 | (0b1010, 0b10110100 ^ 0b00000100), 74 | (0b0110, 0b11001100 ^ 0b00000010), 75 | (0b1110, 0b00101101 ^ 0b00000001), 76 | (0b0001, 0b11010010 ^ 0b10000000), 77 | (0b1001, 0b00110011 ^ 0b01000000), 78 | (0b0101, 0b01001011 ^ 0b00100000), 79 | (0b1101, 0b10101010 ^ 0b00010000), 80 | (0b0011, 0b10000111 ^ 0b00001000), 81 | (0b1011, 0b01100110 ^ 0b00000100), 82 | (0b0111, 0b00011110 ^ 0b00000010), 83 | (0b1111, 0b11111111 ^ 0b00000001) 84 | ] 85 | expected_results, src_data = zip(*hamming_vals) 86 | 87 | src = blocks.vector_source_b(src_data) 88 | hamming_decode = hamming.decode_hamming_bb() 89 | dst = blocks.vector_sink_b() 90 | self.tb.connect(src, hamming_decode) 91 | self.tb.connect(hamming_decode, dst) 92 | self.tb.run () 93 | # check data 94 | result_data = dst.data() 95 | self.assertTupleEqual(expected_results, result_data) 96 | 97 | 98 | if __name__ == '__main__': 99 | gr_unittest.run(qa_decode_hamming_bb, "qa_decode_hamming_bb.xml") 100 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/lib/wait_for_prefix_bb_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2013 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This 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 | * This software 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 this software; 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 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include "wait_for_prefix_bb_impl.h" 29 | 30 | using namespace std; 31 | 32 | namespace gr { 33 | namespace hamming { 34 | 35 | wait_for_prefix_bb::sptr 36 | wait_for_prefix_bb::make() 37 | { 38 | return gnuradio::get_initial_sptr 39 | (new wait_for_prefix_bb_impl()); 40 | } 41 | 42 | /* 43 | * The private constructor 44 | */ 45 | wait_for_prefix_bb_impl::wait_for_prefix_bb_impl() 46 | : gr::block("wait_for_prefix_bb", 47 | gr::io_signature::make(1, 1, sizeof(char)), 48 | gr::io_signature::make(1, 1, sizeof(char))) 49 | { 50 | _prefix_seen = false; 51 | _length_seen = false; 52 | _count = 0; 53 | _length = 0; 54 | _history = queue(); 55 | // 1100110011001100 56 | _prefix = queue(); 57 | for (int i = 0; i < 16; i++) { 58 | _prefix.push((i / 2 + 1) % 2); 59 | } 60 | } 61 | 62 | /* 63 | * Our virtual destructor. 64 | */ 65 | wait_for_prefix_bb_impl::~wait_for_prefix_bb_impl() 66 | { 67 | } 68 | 69 | void 70 | wait_for_prefix_bb_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) 71 | { 72 | ninput_items_required[0] = noutput_items; 73 | } 74 | 75 | int 76 | wait_for_prefix_bb_impl::general_work (int noutput_items, 77 | gr_vector_int &ninput_items, 78 | gr_vector_const_void_star &input_items, 79 | gr_vector_void_star &output_items) 80 | { 81 | const char *in = (const char *) input_items[0]; 82 | char *out = (char *) output_items[0]; 83 | 84 | size_t j = 0; 85 | for (size_t i = 0; i < noutput_items; ++i) { 86 | if (!_prefix_seen) { 87 | _history.push(in[i]); 88 | if (_history.size() > _prefix.size()) { 89 | _history.pop(); 90 | } 91 | if (_history == _prefix) { 92 | _prefix_seen = true; 93 | _history = queue(); 94 | } 95 | } else if (!_length_seen) { 96 | _length = (_length << 1) + in[i]; 97 | if (++_count == 8) { 98 | _length_seen = true; 99 | _count = 0; 100 | } 101 | } else { 102 | if (_count++ < _length * 16) { 103 | out[j++] = in[i]; 104 | } else { 105 | _prefix_seen = false; 106 | _length_seen = false; 107 | _count = 0; 108 | _length = 0; 109 | } 110 | } 111 | } 112 | 113 | consume_each (noutput_items); 114 | 115 | // Tell runtime system how many output items we produced. 116 | return j; 117 | } 118 | 119 | } /* namespace hamming */ 120 | } /* namespace gr */ 121 | 122 | -------------------------------------------------------------------------------- /beaglebone/gpio/gpio.c: -------------------------------------------------------------------------------- 1 | /* Necessary includes for device drivers */ 2 | #include 3 | #include 4 | #include /* printk() */ 5 | #include /* kmalloc() */ 6 | #include /* everything... */ 7 | #include /* error codes */ 8 | #include /* size_t */ 9 | #include 10 | #include /* O_ACCMODE */ 11 | #include /* cli(), *_flags */ 12 | #include /* copy_from/to_user */ 13 | #include /* request_region */ 14 | #include /* ioremap */ 15 | #include /* .ioctl fops */ 16 | 17 | #include "gpio.h" 18 | #define DEVICE_NAME "gpio" 19 | MODULE_LICENSE("DUAL BSD/GPL"); 20 | 21 | /* Declaration of functions */ 22 | int gpio_init(void); 23 | void gpio_exit(void); 24 | 25 | /* User commands to kernel module */ 26 | ssize_t gpio_write(struct file *filp, const char *buf, size_t count, 27 | loff_t *f_pos); 28 | long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); 29 | 30 | /* File operations, has unlocked_ioctl */ 31 | struct file_operations gpio_fops = { 32 | .write = gpio_write, 33 | .unlocked_ioctl = gpio_ioctl, 34 | }; 35 | 36 | 37 | /* Global variables of the driver */ 38 | #define MMAP_OFFSET 0x44c00000 39 | #define MMAP_SIZE (0x48ffffff-MMAP_OFFSET) 40 | #define GPIO_PIN_SW 38 // GPIO1.6, Beaglebone P8.3 41 | 42 | static void *baseAddr; 43 | static void *gpioSetAddr; 44 | static void *gpioClearAddr; 45 | static void *directionAddr; 46 | static long cyclesPerBit; 47 | 48 | int gpio_major = 60; 49 | 50 | /* Declaration of the init and exit functions */ 51 | module_init(gpio_init); 52 | module_exit(gpio_exit); 53 | 54 | /* Initialize the pointers and register char device */ 55 | int gpio_init(void) 56 | { 57 | printk("Init GPIO module\n"); 58 | 59 | // Register the char device 60 | int result = register_chrdev(gpio_major, "gpio", &gpio_fops); 61 | 62 | if (result < 0) { 63 | printk("<1>gpio: cannot obtain major number %d\n", gpio_major); 64 | return result; 65 | } 66 | 67 | baseAddr = ioremap(MMAP_OFFSET, MMAP_SIZE); 68 | 69 | // GPIO configuration 70 | gpioSetAddr = baseAddr + (0x4804c194 - MMAP_OFFSET); 71 | gpioClearAddr = baseAddr + (0x4804c190 - MMAP_OFFSET); 72 | directionAddr = baseAddr + (0x4804c134 - MMAP_OFFSET); 73 | cyclesPerBit = 20000000; 74 | 75 | // Set GPIO38 Pin to OUTPUT (drive data) 76 | *((volatile unsigned int *)directionAddr) &= 0xffffffbf; 77 | 78 | return 0; 79 | } 80 | 81 | /* Unregister the device and undo the memory mapping. */ 82 | void gpio_exit(void) 83 | { 84 | // Unmap the ioremap 85 | iounmap(baseAddr); 86 | 87 | // Unregister the char device 88 | unregister_chrdev(gpio_major, "gpio"); 89 | 90 | printk("Removed GPIO module\n"); 91 | } 92 | 93 | /* Write the count bytes of data in buf to GPIO pin 38, 94 | * 95 | * For a nonzero value, the pin will be toggled on and off for the configured 96 | * number of cycles; for a zero, the pin will be held off for the given number 97 | * of cycles. 98 | */ 99 | ssize_t gpio_write(struct file *filp, const char *buf, size_t count, 100 | loff_t *f_pos) 101 | { 102 | int j, k; 103 | 104 | for (j = 0; j < count; ++j) { 105 | if (buf[j]) { 106 | for (k = 0; k < cyclesPerBit; ++k) { 107 | *((volatile unsigned int *)gpioSetAddr) = 0x40; 108 | *((volatile unsigned int *)gpioClearAddr) = 0x40; 109 | } 110 | } else { 111 | for (k = 0; k < cyclesPerBit; ++k) { 112 | *((volatile unsigned int *)gpioClearAddr) = 0x40; 113 | *((volatile unsigned int *)gpioClearAddr) = 0x40; 114 | } 115 | } 116 | } 117 | 118 | return 0; 119 | } 120 | 121 | /* The only valid ioctl option is IOC_SET, which sets the number of cycles per 122 | * broadcast bit. 123 | */ 124 | long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 125 | { 126 | switch (cmd) { 127 | case IOC_SET: 128 | cyclesPerBit = arg; 129 | break; 130 | 131 | default: 132 | return -ENOTTY; 133 | } 134 | 135 | return 0; 136 | } 137 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Funtenna: Reference Implementation 2 | 3 | This repository contains the code for the reference funtenna implementation. 4 | 5 | It transmits Hamming-coded data from a BeagleBone's GPIO pin, bit-banged at 6 | about 12.5 MHz. This data is received on a USRP2, then demodulated in GNU Radio. 7 | 8 | ## Materials 9 | 10 | * BeagleBone (Rev2) running Ångström Linux 11 | * Antenna: we used a long wire wrapped in an oval around a small wooden cross. 12 | * Ettus research USRP2 (this is discontinued, but any GNU Radio-compatible SDR 13 | board that can receive at 12.5 MHz will do) 14 | * Computer with GNU Radio >=3.7 15 | 16 | ## Steps/setup 17 | 18 | 1. Hook up a wire/antenna to pin 8.46 on the Beaglebone (consult the 19 | [reference manual](http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SRM.pdf)). 20 | 21 | 2. Copy `beaglebone/gpio` to BeagleBone; compile the kernel module. 22 | [This](http://nomel.tumblr.com/post/30357133735/beaglebone-tutorial-how-to-compile-kernel-modules-and) 23 | is a good resource for installing the dependencies necessary for compiling a 24 | kernel module and compiling. Once that's done, load the kernel module and begin 25 | transmitting. 26 | 27 | make 28 | insmod gpio.ko 29 | mknod /dev/gpio c 60 0 30 | 31 | Now, the `repeat` executable will broadcast a `10101010` bit pattern over and 32 | over. This helps the AGC in the GNU Radio circuit adjust to the appropriate 33 | level. 34 | 35 | 3. Power on and connect USRP. 36 | 37 | 4. Compile and install GNU Radio blocks found in `gr-cw_binary` and 38 | `gr-hamming` directories (if this fails at any step, it's probably due to 39 | missing dependencies): 40 | 41 | cd gr-cw_binary 42 | mkdir build 43 | cd build 44 | # NB: the install prefix option is important to make sure that GRC can find 45 | # your blocks; look for /usr/share/gnuradio/grc (it might be in 46 | # /usr/local/share/gnuradio/grc) 47 | cmake -D CMAKE_INSTALL_PREFIX=/usr ../ 48 | make 49 | make test 50 | sudo make install # if all looks good 51 | sudo ldconfig 52 | 53 | 5. Start GNURadio companion. Open flow found in `demod/online-demod.grc`. Run 54 | the flow. Wait for the levels in the scope to settle. 55 | 56 | 6. Tail `/tmp/bitpattern`. 57 | 58 | 7. On the BeagleBone, ^C the `repeat` executable and run `./send_message 'test 59 | message here'`. If all is well, the message should appear in `/tmp/bitpattern`. 60 | 61 | ## Implementation Details 62 | 63 | ### BeagleBone 64 | 65 | The BeagleBone code is a kernel module that writes either alternating `10`s or 66 | `00`s to memory-mapped IO for the BeagleBone's GPIO pin 8.46. The number of 67 | repetitions can be set. The kernel module reads from a `char` array, toggling 68 | the pin for a nonzero value or holding the pin low for a zero. This broadcasts 69 | the given bit-pattern using 70 | [on-off keying](https://en.wikipedia.org/wiki/On-off_keying). 71 | 72 | There are two userspace programs to broadcast data. One sends out a `10101010` 73 | bit pattern on repeat until interrupted; this allows the receiving end to adjust 74 | their levels. The other program encodes data it is given via the command line 75 | into packets: 76 | 77 | * A fixed 6-byte prefix: `0xaaaaaaaacccc` 78 | * One unsigned byte to indicate the length of the message 79 | * Length * 2 bytes that include the data sent, Hamming[7,4]-coded for error 80 | correction 81 | 82 | The BeagleBone broadcasts at 12.5 MHz. 83 | 84 | ### USRP 85 | 86 | We used an Ettus Research USRP2 (discontinued) with a homemade antenna. We were 87 | able to observe a clear signal from at least 30 feet away before signal 88 | processing. 89 | 90 | ### GNU Radio 91 | 92 | We used GNU Radio for signal processing and demodulation; the flow graph 93 | includes the following: 94 | 95 | * USRP Source centered at 12.49 MHz 96 | * Band Pass Filter to isolate the BeagleBone signal 97 | * Automatic Gain Control to adjust to the level of the received signal 98 | * Moving Average to smooth the signal 99 | * Threshold to convert the signal into binary responses 100 | * Sampling logic (our blocks) to turn the binary samples into a stream of bits 101 | * Packet logic (our blocks) to recognize packets 102 | * Hamming decoder (our blocks) perform error correction and detection 103 | * Digital logic to combine nibbles into bytes and write them to a file 104 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/Modules/GrTest.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2010-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 | if(DEFINED __INCLUDED_GR_TEST_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_GR_TEST_CMAKE TRUE) 24 | 25 | ######################################################################## 26 | # Add a unit test and setup the environment for a unit test. 27 | # Takes the same arguments as the ADD_TEST function. 28 | # 29 | # Before calling set the following variables: 30 | # GR_TEST_TARGET_DEPS - built targets for the library path 31 | # GR_TEST_LIBRARY_DIRS - directories for the library path 32 | # GR_TEST_PYTHON_DIRS - directories for the python path 33 | ######################################################################## 34 | function(GR_ADD_TEST test_name) 35 | 36 | if(WIN32) 37 | #Ensure that the build exe also appears in the PATH. 38 | list(APPEND GR_TEST_TARGET_DEPS ${ARGN}) 39 | 40 | #In the land of windows, all libraries must be in the PATH. 41 | #Since the dependent libraries are not yet installed, 42 | #we must manually set them in the PATH to run tests. 43 | #The following appends the path of a target dependency. 44 | foreach(target ${GR_TEST_TARGET_DEPS}) 45 | get_target_property(location ${target} LOCATION) 46 | if(location) 47 | get_filename_component(path ${location} PATH) 48 | string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) 49 | list(APPEND GR_TEST_LIBRARY_DIRS ${path}) 50 | endif(location) 51 | endforeach(target) 52 | 53 | #SWIG generates the python library files into a subdirectory. 54 | #Therefore, we must append this subdirectory into PYTHONPATH. 55 | #Only do this for the python directories matching the following: 56 | foreach(pydir ${GR_TEST_PYTHON_DIRS}) 57 | get_filename_component(name ${pydir} NAME) 58 | if(name MATCHES "^(swig|lib|src)$") 59 | list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) 60 | endif() 61 | endforeach(pydir) 62 | endif(WIN32) 63 | 64 | file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) 65 | file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? 66 | file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? 67 | 68 | set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") 69 | 70 | #http://www.cmake.org/pipermail/cmake/2009-May/029464.html 71 | #Replaced this add test + set environs code with the shell script generation. 72 | #Its nicer to be able to manually run the shell script to diagnose problems. 73 | #ADD_TEST(${ARGV}) 74 | #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") 75 | 76 | if(UNIX) 77 | set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") 78 | #set both LD and DYLD paths to cover multiple UNIX OS library paths 79 | list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") 80 | list(APPEND pypath "$PYTHONPATH") 81 | 82 | #replace list separator with the path separator 83 | string(REPLACE ";" ":" libpath "${libpath}") 84 | string(REPLACE ";" ":" pypath "${pypath}") 85 | list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") 86 | 87 | #generate a bat file that sets the environment and runs the test 88 | find_program(SHELL sh) 89 | set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) 90 | file(WRITE ${sh_file} "#!${SHELL}\n") 91 | #each line sets an environment variable 92 | foreach(environ ${environs}) 93 | file(APPEND ${sh_file} "export ${environ}\n") 94 | endforeach(environ) 95 | #load the command to run with its arguments 96 | foreach(arg ${ARGN}) 97 | file(APPEND ${sh_file} "${arg} ") 98 | endforeach(arg) 99 | file(APPEND ${sh_file} "\n") 100 | 101 | #make the shell file executable 102 | execute_process(COMMAND chmod +x ${sh_file}) 103 | 104 | add_test(${test_name} ${SHELL} ${sh_file}) 105 | 106 | endif(UNIX) 107 | 108 | if(WIN32) 109 | list(APPEND libpath ${DLL_PATHS} "%PATH%") 110 | list(APPEND pypath "%PYTHONPATH%") 111 | 112 | #replace list separator with the path separator (escaped) 113 | string(REPLACE ";" "\\;" libpath "${libpath}") 114 | string(REPLACE ";" "\\;" pypath "${pypath}") 115 | list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") 116 | 117 | #generate a bat file that sets the environment and runs the test 118 | set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) 119 | file(WRITE ${bat_file} "@echo off\n") 120 | #each line sets an environment variable 121 | foreach(environ ${environs}) 122 | file(APPEND ${bat_file} "SET ${environ}\n") 123 | endforeach(environ) 124 | #load the command to run with its arguments 125 | foreach(arg ${ARGN}) 126 | file(APPEND ${bat_file} "${arg} ") 127 | endforeach(arg) 128 | file(APPEND ${bat_file} "\n") 129 | 130 | add_test(${test_name} ${bat_file}) 131 | endif(WIN32) 132 | 133 | endfunction(GR_ADD_TEST) 134 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/Modules/GrTest.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2010-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 | if(DEFINED __INCLUDED_GR_TEST_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_GR_TEST_CMAKE TRUE) 24 | 25 | ######################################################################## 26 | # Add a unit test and setup the environment for a unit test. 27 | # Takes the same arguments as the ADD_TEST function. 28 | # 29 | # Before calling set the following variables: 30 | # GR_TEST_TARGET_DEPS - built targets for the library path 31 | # GR_TEST_LIBRARY_DIRS - directories for the library path 32 | # GR_TEST_PYTHON_DIRS - directories for the python path 33 | ######################################################################## 34 | function(GR_ADD_TEST test_name) 35 | 36 | if(WIN32) 37 | #Ensure that the build exe also appears in the PATH. 38 | list(APPEND GR_TEST_TARGET_DEPS ${ARGN}) 39 | 40 | #In the land of windows, all libraries must be in the PATH. 41 | #Since the dependent libraries are not yet installed, 42 | #we must manually set them in the PATH to run tests. 43 | #The following appends the path of a target dependency. 44 | foreach(target ${GR_TEST_TARGET_DEPS}) 45 | get_target_property(location ${target} LOCATION) 46 | if(location) 47 | get_filename_component(path ${location} PATH) 48 | string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) 49 | list(APPEND GR_TEST_LIBRARY_DIRS ${path}) 50 | endif(location) 51 | endforeach(target) 52 | 53 | #SWIG generates the python library files into a subdirectory. 54 | #Therefore, we must append this subdirectory into PYTHONPATH. 55 | #Only do this for the python directories matching the following: 56 | foreach(pydir ${GR_TEST_PYTHON_DIRS}) 57 | get_filename_component(name ${pydir} NAME) 58 | if(name MATCHES "^(swig|lib|src)$") 59 | list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) 60 | endif() 61 | endforeach(pydir) 62 | endif(WIN32) 63 | 64 | file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) 65 | file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? 66 | file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? 67 | 68 | set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") 69 | 70 | #http://www.cmake.org/pipermail/cmake/2009-May/029464.html 71 | #Replaced this add test + set environs code with the shell script generation. 72 | #Its nicer to be able to manually run the shell script to diagnose problems. 73 | #ADD_TEST(${ARGV}) 74 | #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") 75 | 76 | if(UNIX) 77 | set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") 78 | #set both LD and DYLD paths to cover multiple UNIX OS library paths 79 | list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") 80 | list(APPEND pypath "$PYTHONPATH") 81 | 82 | #replace list separator with the path separator 83 | string(REPLACE ";" ":" libpath "${libpath}") 84 | string(REPLACE ";" ":" pypath "${pypath}") 85 | list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") 86 | 87 | #generate a bat file that sets the environment and runs the test 88 | find_program(SHELL sh) 89 | set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) 90 | file(WRITE ${sh_file} "#!${SHELL}\n") 91 | #each line sets an environment variable 92 | foreach(environ ${environs}) 93 | file(APPEND ${sh_file} "export ${environ}\n") 94 | endforeach(environ) 95 | #load the command to run with its arguments 96 | foreach(arg ${ARGN}) 97 | file(APPEND ${sh_file} "${arg} ") 98 | endforeach(arg) 99 | file(APPEND ${sh_file} "\n") 100 | 101 | #make the shell file executable 102 | execute_process(COMMAND chmod +x ${sh_file}) 103 | 104 | add_test(${test_name} ${SHELL} ${sh_file}) 105 | 106 | endif(UNIX) 107 | 108 | if(WIN32) 109 | list(APPEND libpath ${DLL_PATHS} "%PATH%") 110 | list(APPEND pypath "%PYTHONPATH%") 111 | 112 | #replace list separator with the path separator (escaped) 113 | string(REPLACE ";" "\\;" libpath "${libpath}") 114 | string(REPLACE ";" "\\;" pypath "${pypath}") 115 | list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") 116 | 117 | #generate a bat file that sets the environment and runs the test 118 | set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) 119 | file(WRITE ${bat_file} "@echo off\n") 120 | #each line sets an environment variable 121 | foreach(environ ${environs}) 122 | file(APPEND ${bat_file} "SET ${environ}\n") 123 | endforeach(environ) 124 | #load the command to run with its arguments 125 | foreach(arg ${ARGN}) 126 | file(APPEND ${bat_file} "${arg} ") 127 | endforeach(arg) 128 | file(APPEND ${bat_file} "\n") 129 | 130 | add_test(${test_name} ${bat_file}) 131 | endif(WIN32) 132 | 133 | endfunction(GR_ADD_TEST) 134 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Project setup 23 | ######################################################################## 24 | cmake_minimum_required(VERSION 2.6) 25 | project(gr-hamming CXX C) 26 | enable_testing() 27 | 28 | #select the release build type by default to get optimization flags 29 | if(NOT CMAKE_BUILD_TYPE) 30 | set(CMAKE_BUILD_TYPE "Release") 31 | message(STATUS "Build type not specified: defaulting to release.") 32 | endif(NOT CMAKE_BUILD_TYPE) 33 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") 34 | 35 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) 36 | 37 | ######################################################################## 38 | # Compiler specific setup 39 | ######################################################################## 40 | if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) 41 | #http://gcc.gnu.org/wiki/Visibility 42 | add_definitions(-fvisibility=hidden) 43 | endif() 44 | 45 | ######################################################################## 46 | # Find boost 47 | ######################################################################## 48 | if(UNIX AND EXISTS "/usr/lib64") 49 | list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix 50 | endif(UNIX AND EXISTS "/usr/lib64") 51 | set(Boost_ADDITIONAL_VERSIONS 52 | "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" 53 | "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" 54 | "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" 55 | "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" 56 | "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" 57 | "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" 58 | "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" 59 | ) 60 | find_package(Boost "1.35" COMPONENTS filesystem system) 61 | 62 | if(NOT Boost_FOUND) 63 | message(FATAL_ERROR "Boost required to compile hamming") 64 | endif() 65 | 66 | ######################################################################## 67 | # Install directories 68 | ######################################################################## 69 | include(GrPlatform) #define LIB_SUFFIX 70 | set(GR_RUNTIME_DIR bin) 71 | set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) 72 | set(GR_INCLUDE_DIR include/hamming) 73 | set(GR_DATA_DIR share) 74 | set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) 75 | set(GR_DOC_DIR ${GR_DATA_DIR}/doc) 76 | set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) 77 | set(GR_CONF_DIR etc) 78 | set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) 79 | set(GR_LIBEXEC_DIR libexec) 80 | set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) 81 | set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) 82 | 83 | ######################################################################## 84 | # Find gnuradio build dependencies 85 | ######################################################################## 86 | find_package(GnuradioRuntime) 87 | find_package(CppUnit) 88 | 89 | # To run a more advanced search for GNU Radio and it's components and 90 | # versions, use the following. Add any components required to the list 91 | # of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the 92 | # minimum API compatible version required. 93 | # 94 | # set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...) 95 | # find_package(Gnuradio "version") 96 | 97 | if(NOT GNURADIO_RUNTIME_FOUND) 98 | message(FATAL_ERROR "GnuRadio Runtime required to compile hamming") 99 | endif() 100 | if(NOT CPPUNIT_FOUND) 101 | message(FATAL_ERROR "CppUnit required to compile hamming") 102 | endif() 103 | 104 | ######################################################################## 105 | # Setup the include and linker paths 106 | ######################################################################## 107 | include_directories( 108 | ${CMAKE_SOURCE_DIR}/lib 109 | ${CMAKE_SOURCE_DIR}/include 110 | ${CMAKE_BINARY_DIR}/lib 111 | ${CMAKE_BINARY_DIR}/include 112 | ${Boost_INCLUDE_DIRS} 113 | ${CPPUNIT_INCLUDE_DIRS} 114 | ${GNURADIO_RUNTIME_INCLUDE_DIRS} 115 | ) 116 | 117 | link_directories( 118 | ${Boost_LIBRARY_DIRS} 119 | ${CPPUNIT_LIBRARY_DIRS} 120 | ${GNURADIO_RUNTIME_LIBRARY_DIRS} 121 | ) 122 | 123 | # Set component parameters 124 | set(GR_HAMMING_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) 125 | set(GR_HAMMING_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) 126 | 127 | ######################################################################## 128 | # Create uninstall target 129 | ######################################################################## 130 | configure_file( 131 | ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in 132 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 133 | @ONLY) 134 | 135 | add_custom_target(uninstall 136 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 137 | ) 138 | 139 | ######################################################################## 140 | # Add subdirectories 141 | ######################################################################## 142 | add_subdirectory(include/hamming) 143 | add_subdirectory(lib) 144 | add_subdirectory(swig) 145 | add_subdirectory(python) 146 | add_subdirectory(grc) 147 | add_subdirectory(apps) 148 | add_subdirectory(docs) 149 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 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 | # Project setup 23 | ######################################################################## 24 | cmake_minimum_required(VERSION 2.6) 25 | project(gr-cw_binary CXX C) 26 | enable_testing() 27 | 28 | #select the release build type by default to get optimization flags 29 | if(NOT CMAKE_BUILD_TYPE) 30 | set(CMAKE_BUILD_TYPE "Release") 31 | message(STATUS "Build type not specified: defaulting to release.") 32 | endif(NOT CMAKE_BUILD_TYPE) 33 | set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") 34 | 35 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) 36 | 37 | ######################################################################## 38 | # Compiler specific setup 39 | ######################################################################## 40 | if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) 41 | #http://gcc.gnu.org/wiki/Visibility 42 | add_definitions(-fvisibility=hidden) 43 | endif() 44 | 45 | ######################################################################## 46 | # Find boost 47 | ######################################################################## 48 | if(UNIX AND EXISTS "/usr/lib64") 49 | list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix 50 | endif(UNIX AND EXISTS "/usr/lib64") 51 | set(Boost_ADDITIONAL_VERSIONS 52 | "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" 53 | "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" 54 | "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" 55 | "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" 56 | "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" 57 | "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" 58 | "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" 59 | ) 60 | find_package(Boost "1.35" COMPONENTS filesystem system) 61 | 62 | if(NOT Boost_FOUND) 63 | message(FATAL_ERROR "Boost required to compile cw_binary") 64 | endif() 65 | 66 | ######################################################################## 67 | # Install directories 68 | ######################################################################## 69 | include(GrPlatform) #define LIB_SUFFIX 70 | set(GR_RUNTIME_DIR bin) 71 | set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) 72 | set(GR_INCLUDE_DIR include/cw_binary) 73 | set(GR_DATA_DIR share) 74 | set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) 75 | set(GR_DOC_DIR ${GR_DATA_DIR}/doc) 76 | set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) 77 | set(GR_CONF_DIR etc) 78 | set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) 79 | set(GR_LIBEXEC_DIR libexec) 80 | set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) 81 | set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) 82 | 83 | ######################################################################## 84 | # Find gnuradio build dependencies 85 | ######################################################################## 86 | find_package(GnuradioRuntime) 87 | find_package(CppUnit) 88 | 89 | # To run a more advanced search for GNU Radio and it's components and 90 | # versions, use the following. Add any components required to the list 91 | # of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the 92 | # minimum API compatible version required. 93 | # 94 | # set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...) 95 | # find_package(Gnuradio "version") 96 | 97 | if(NOT GNURADIO_RUNTIME_FOUND) 98 | message(FATAL_ERROR "GnuRadio Runtime required to compile cw_binary") 99 | endif() 100 | if(NOT CPPUNIT_FOUND) 101 | message(FATAL_ERROR "CppUnit required to compile cw_binary") 102 | endif() 103 | 104 | ######################################################################## 105 | # Setup the include and linker paths 106 | ######################################################################## 107 | include_directories( 108 | ${CMAKE_SOURCE_DIR}/lib 109 | ${CMAKE_SOURCE_DIR}/include 110 | ${CMAKE_BINARY_DIR}/lib 111 | ${CMAKE_BINARY_DIR}/include 112 | ${Boost_INCLUDE_DIRS} 113 | ${CPPUNIT_INCLUDE_DIRS} 114 | ${GNURADIO_RUNTIME_INCLUDE_DIRS} 115 | ) 116 | 117 | link_directories( 118 | ${Boost_LIBRARY_DIRS} 119 | ${CPPUNIT_LIBRARY_DIRS} 120 | ${GNURADIO_RUNTIME_LIBRARY_DIRS} 121 | ) 122 | 123 | # Set component parameters 124 | set(GR_CW_BINARY_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) 125 | set(GR_CW_BINARY_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) 126 | 127 | ######################################################################## 128 | # Create uninstall target 129 | ######################################################################## 130 | configure_file( 131 | ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in 132 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 133 | @ONLY) 134 | 135 | add_custom_target(uninstall 136 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 137 | ) 138 | 139 | ######################################################################## 140 | # Add subdirectories 141 | ######################################################################## 142 | add_subdirectory(include/cw_binary) 143 | add_subdirectory(lib) 144 | add_subdirectory(swig) 145 | add_subdirectory(python) 146 | add_subdirectory(grc) 147 | add_subdirectory(apps) 148 | add_subdirectory(docs) 149 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/cmake/Modules/CMakeParseArgumentsCopy.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE_PARSE_ARGUMENTS( 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 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 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 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 , and 22 | # a variable composed of the given 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 keywords this will be TRUE or FALSE. 26 | # 27 | # All remaining arguments are collected in a variable 28 | # _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 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) 139 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/cmake/Modules/CMakeParseArgumentsCopy.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE_PARSE_ARGUMENTS( 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 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 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 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 , and 22 | # a variable composed of the given 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 keywords this will be TRUE or FALSE. 26 | # 27 | # All remaining arguments are collected in a variable 28 | # _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 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) 139 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/doxyindex.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Classes providing more user-friendly interfaces to the doxygen xml 23 | docs than the generated classes provide. 24 | """ 25 | 26 | import os 27 | 28 | from generated import index 29 | from base import Base 30 | from text import description 31 | 32 | class DoxyIndex(Base): 33 | """ 34 | Parses a doxygen xml directory. 35 | """ 36 | 37 | __module__ = "gnuradio.utils.doxyxml" 38 | 39 | def _parse(self): 40 | if self._parsed: 41 | return 42 | super(DoxyIndex, self)._parse() 43 | self._root = index.parse(os.path.join(self._xml_path, 'index.xml')) 44 | for mem in self._root.compound: 45 | converted = self.convert_mem(mem) 46 | # For files we want the contents to be accessible directly 47 | # from the parent rather than having to go through the file 48 | # object. 49 | if self.get_cls(mem) == DoxyFile: 50 | if mem.name.endswith('.h'): 51 | self._members += converted.members() 52 | self._members.append(converted) 53 | else: 54 | self._members.append(converted) 55 | 56 | 57 | def generate_swig_doc_i(self): 58 | """ 59 | %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state " 60 | Wraps the C++: gr_align_on_samplenumbers_ss::align_state"; 61 | """ 62 | pass 63 | 64 | 65 | class DoxyCompMem(Base): 66 | 67 | 68 | kind = None 69 | 70 | def __init__(self, *args, **kwargs): 71 | super(DoxyCompMem, self).__init__(*args, **kwargs) 72 | 73 | @classmethod 74 | def can_parse(cls, obj): 75 | return obj.kind == cls.kind 76 | 77 | def set_descriptions(self, parse_data): 78 | bd = description(getattr(parse_data, 'briefdescription', None)) 79 | dd = description(getattr(parse_data, 'detaileddescription', None)) 80 | self._data['brief_description'] = bd 81 | self._data['detailed_description'] = dd 82 | 83 | class DoxyCompound(DoxyCompMem): 84 | pass 85 | 86 | class DoxyMember(DoxyCompMem): 87 | pass 88 | 89 | 90 | class DoxyFunction(DoxyMember): 91 | 92 | __module__ = "gnuradio.utils.doxyxml" 93 | 94 | kind = 'function' 95 | 96 | def _parse(self): 97 | if self._parsed: 98 | return 99 | super(DoxyFunction, self)._parse() 100 | self.set_descriptions(self._parse_data) 101 | self._data['params'] = [] 102 | prms = self._parse_data.param 103 | for prm in prms: 104 | self._data['params'].append(DoxyParam(prm)) 105 | 106 | brief_description = property(lambda self: self.data()['brief_description']) 107 | detailed_description = property(lambda self: self.data()['detailed_description']) 108 | params = property(lambda self: self.data()['params']) 109 | 110 | Base.mem_classes.append(DoxyFunction) 111 | 112 | 113 | class DoxyParam(DoxyMember): 114 | 115 | __module__ = "gnuradio.utils.doxyxml" 116 | 117 | def _parse(self): 118 | if self._parsed: 119 | return 120 | super(DoxyParam, self)._parse() 121 | self.set_descriptions(self._parse_data) 122 | self._data['declname'] = self._parse_data.declname 123 | 124 | brief_description = property(lambda self: self.data()['brief_description']) 125 | detailed_description = property(lambda self: self.data()['detailed_description']) 126 | declname = property(lambda self: self.data()['declname']) 127 | 128 | class DoxyClass(DoxyCompound): 129 | 130 | __module__ = "gnuradio.utils.doxyxml" 131 | 132 | kind = 'class' 133 | 134 | def _parse(self): 135 | if self._parsed: 136 | return 137 | super(DoxyClass, self)._parse() 138 | self.retrieve_data() 139 | if self._error: 140 | return 141 | self.set_descriptions(self._retrieved_data.compounddef) 142 | # Sectiondef.kind tells about whether private or public. 143 | # We just ignore this for now. 144 | self.process_memberdefs() 145 | 146 | brief_description = property(lambda self: self.data()['brief_description']) 147 | detailed_description = property(lambda self: self.data()['detailed_description']) 148 | 149 | Base.mem_classes.append(DoxyClass) 150 | 151 | 152 | class DoxyFile(DoxyCompound): 153 | 154 | __module__ = "gnuradio.utils.doxyxml" 155 | 156 | kind = 'file' 157 | 158 | def _parse(self): 159 | if self._parsed: 160 | return 161 | super(DoxyFile, self)._parse() 162 | self.retrieve_data() 163 | self.set_descriptions(self._retrieved_data.compounddef) 164 | if self._error: 165 | return 166 | self.process_memberdefs() 167 | 168 | brief_description = property(lambda self: self.data()['brief_description']) 169 | detailed_description = property(lambda self: self.data()['detailed_description']) 170 | 171 | Base.mem_classes.append(DoxyFile) 172 | 173 | 174 | class DoxyNamespace(DoxyCompound): 175 | 176 | __module__ = "gnuradio.utils.doxyxml" 177 | 178 | kind = 'namespace' 179 | 180 | Base.mem_classes.append(DoxyNamespace) 181 | 182 | 183 | class DoxyGroup(DoxyCompound): 184 | 185 | __module__ = "gnuradio.utils.doxyxml" 186 | 187 | kind = 'group' 188 | 189 | def _parse(self): 190 | if self._parsed: 191 | return 192 | super(DoxyGroup, self)._parse() 193 | self.retrieve_data() 194 | if self._error: 195 | return 196 | cdef = self._retrieved_data.compounddef 197 | self._data['title'] = description(cdef.title) 198 | # Process inner groups 199 | grps = cdef.innergroup 200 | for grp in grps: 201 | converted = DoxyGroup.from_refid(grp.refid, top=self.top) 202 | self._members.append(converted) 203 | # Process inner classes 204 | klasses = cdef.innerclass 205 | for kls in klasses: 206 | converted = DoxyClass.from_refid(kls.refid, top=self.top) 207 | self._members.append(converted) 208 | # Process normal members 209 | self.process_memberdefs() 210 | 211 | title = property(lambda self: self.data()['title']) 212 | 213 | 214 | Base.mem_classes.append(DoxyGroup) 215 | 216 | 217 | class DoxyFriend(DoxyMember): 218 | 219 | __module__ = "gnuradio.utils.doxyxml" 220 | 221 | kind = 'friend' 222 | 223 | Base.mem_classes.append(DoxyFriend) 224 | 225 | 226 | class DoxyOther(Base): 227 | 228 | __module__ = "gnuradio.utils.doxyxml" 229 | 230 | kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page']) 231 | 232 | @classmethod 233 | def can_parse(cls, obj): 234 | return obj.kind in cls.kinds 235 | 236 | Base.mem_classes.append(DoxyOther) 237 | 238 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/doxyindex.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | Classes providing more user-friendly interfaces to the doxygen xml 23 | docs than the generated classes provide. 24 | """ 25 | 26 | import os 27 | 28 | from generated import index 29 | from base import Base 30 | from text import description 31 | 32 | class DoxyIndex(Base): 33 | """ 34 | Parses a doxygen xml directory. 35 | """ 36 | 37 | __module__ = "gnuradio.utils.doxyxml" 38 | 39 | def _parse(self): 40 | if self._parsed: 41 | return 42 | super(DoxyIndex, self)._parse() 43 | self._root = index.parse(os.path.join(self._xml_path, 'index.xml')) 44 | for mem in self._root.compound: 45 | converted = self.convert_mem(mem) 46 | # For files we want the contents to be accessible directly 47 | # from the parent rather than having to go through the file 48 | # object. 49 | if self.get_cls(mem) == DoxyFile: 50 | if mem.name.endswith('.h'): 51 | self._members += converted.members() 52 | self._members.append(converted) 53 | else: 54 | self._members.append(converted) 55 | 56 | 57 | def generate_swig_doc_i(self): 58 | """ 59 | %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state " 60 | Wraps the C++: gr_align_on_samplenumbers_ss::align_state"; 61 | """ 62 | pass 63 | 64 | 65 | class DoxyCompMem(Base): 66 | 67 | 68 | kind = None 69 | 70 | def __init__(self, *args, **kwargs): 71 | super(DoxyCompMem, self).__init__(*args, **kwargs) 72 | 73 | @classmethod 74 | def can_parse(cls, obj): 75 | return obj.kind == cls.kind 76 | 77 | def set_descriptions(self, parse_data): 78 | bd = description(getattr(parse_data, 'briefdescription', None)) 79 | dd = description(getattr(parse_data, 'detaileddescription', None)) 80 | self._data['brief_description'] = bd 81 | self._data['detailed_description'] = dd 82 | 83 | class DoxyCompound(DoxyCompMem): 84 | pass 85 | 86 | class DoxyMember(DoxyCompMem): 87 | pass 88 | 89 | 90 | class DoxyFunction(DoxyMember): 91 | 92 | __module__ = "gnuradio.utils.doxyxml" 93 | 94 | kind = 'function' 95 | 96 | def _parse(self): 97 | if self._parsed: 98 | return 99 | super(DoxyFunction, self)._parse() 100 | self.set_descriptions(self._parse_data) 101 | self._data['params'] = [] 102 | prms = self._parse_data.param 103 | for prm in prms: 104 | self._data['params'].append(DoxyParam(prm)) 105 | 106 | brief_description = property(lambda self: self.data()['brief_description']) 107 | detailed_description = property(lambda self: self.data()['detailed_description']) 108 | params = property(lambda self: self.data()['params']) 109 | 110 | Base.mem_classes.append(DoxyFunction) 111 | 112 | 113 | class DoxyParam(DoxyMember): 114 | 115 | __module__ = "gnuradio.utils.doxyxml" 116 | 117 | def _parse(self): 118 | if self._parsed: 119 | return 120 | super(DoxyParam, self)._parse() 121 | self.set_descriptions(self._parse_data) 122 | self._data['declname'] = self._parse_data.declname 123 | 124 | brief_description = property(lambda self: self.data()['brief_description']) 125 | detailed_description = property(lambda self: self.data()['detailed_description']) 126 | declname = property(lambda self: self.data()['declname']) 127 | 128 | class DoxyClass(DoxyCompound): 129 | 130 | __module__ = "gnuradio.utils.doxyxml" 131 | 132 | kind = 'class' 133 | 134 | def _parse(self): 135 | if self._parsed: 136 | return 137 | super(DoxyClass, self)._parse() 138 | self.retrieve_data() 139 | if self._error: 140 | return 141 | self.set_descriptions(self._retrieved_data.compounddef) 142 | # Sectiondef.kind tells about whether private or public. 143 | # We just ignore this for now. 144 | self.process_memberdefs() 145 | 146 | brief_description = property(lambda self: self.data()['brief_description']) 147 | detailed_description = property(lambda self: self.data()['detailed_description']) 148 | 149 | Base.mem_classes.append(DoxyClass) 150 | 151 | 152 | class DoxyFile(DoxyCompound): 153 | 154 | __module__ = "gnuradio.utils.doxyxml" 155 | 156 | kind = 'file' 157 | 158 | def _parse(self): 159 | if self._parsed: 160 | return 161 | super(DoxyFile, self)._parse() 162 | self.retrieve_data() 163 | self.set_descriptions(self._retrieved_data.compounddef) 164 | if self._error: 165 | return 166 | self.process_memberdefs() 167 | 168 | brief_description = property(lambda self: self.data()['brief_description']) 169 | detailed_description = property(lambda self: self.data()['detailed_description']) 170 | 171 | Base.mem_classes.append(DoxyFile) 172 | 173 | 174 | class DoxyNamespace(DoxyCompound): 175 | 176 | __module__ = "gnuradio.utils.doxyxml" 177 | 178 | kind = 'namespace' 179 | 180 | Base.mem_classes.append(DoxyNamespace) 181 | 182 | 183 | class DoxyGroup(DoxyCompound): 184 | 185 | __module__ = "gnuradio.utils.doxyxml" 186 | 187 | kind = 'group' 188 | 189 | def _parse(self): 190 | if self._parsed: 191 | return 192 | super(DoxyGroup, self)._parse() 193 | self.retrieve_data() 194 | if self._error: 195 | return 196 | cdef = self._retrieved_data.compounddef 197 | self._data['title'] = description(cdef.title) 198 | # Process inner groups 199 | grps = cdef.innergroup 200 | for grp in grps: 201 | converted = DoxyGroup.from_refid(grp.refid, top=self.top) 202 | self._members.append(converted) 203 | # Process inner classes 204 | klasses = cdef.innerclass 205 | for kls in klasses: 206 | converted = DoxyClass.from_refid(kls.refid, top=self.top) 207 | self._members.append(converted) 208 | # Process normal members 209 | self.process_memberdefs() 210 | 211 | title = property(lambda self: self.data()['title']) 212 | 213 | 214 | Base.mem_classes.append(DoxyGroup) 215 | 216 | 217 | class DoxyFriend(DoxyMember): 218 | 219 | __module__ = "gnuradio.utils.doxyxml" 220 | 221 | kind = 'friend' 222 | 223 | Base.mem_classes.append(DoxyFriend) 224 | 225 | 226 | class DoxyOther(Base): 227 | 228 | __module__ = "gnuradio.utils.doxyxml" 229 | 230 | kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page']) 231 | 232 | @classmethod 233 | def can_parse(cls, obj): 234 | return obj.kind in cls.kinds 235 | 236 | Base.mem_classes.append(DoxyOther) 237 | 238 | -------------------------------------------------------------------------------- /gnuradio/gr-hamming/docs/doxygen/doxyxml/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | A base class is created. 23 | 24 | Classes based upon this are used to make more user-friendly interfaces 25 | to the doxygen xml docs than the generated classes provide. 26 | """ 27 | 28 | import os 29 | import pdb 30 | 31 | from xml.parsers.expat import ExpatError 32 | 33 | from generated import compound 34 | 35 | 36 | class Base(object): 37 | 38 | class Duplicate(StandardError): 39 | pass 40 | 41 | class NoSuchMember(StandardError): 42 | pass 43 | 44 | class ParsingError(StandardError): 45 | pass 46 | 47 | def __init__(self, parse_data, top=None): 48 | self._parsed = False 49 | self._error = False 50 | self._parse_data = parse_data 51 | self._members = [] 52 | self._dict_members = {} 53 | self._in_category = {} 54 | self._data = {} 55 | if top is not None: 56 | self._xml_path = top._xml_path 57 | # Set up holder of references 58 | else: 59 | top = self 60 | self._refs = {} 61 | self._xml_path = parse_data 62 | self.top = top 63 | 64 | @classmethod 65 | def from_refid(cls, refid, top=None): 66 | """ Instantiate class from a refid rather than parsing object. """ 67 | # First check to see if its already been instantiated. 68 | if top is not None and refid in top._refs: 69 | return top._refs[refid] 70 | # Otherwise create a new instance and set refid. 71 | inst = cls(None, top=top) 72 | inst.refid = refid 73 | inst.add_ref(inst) 74 | return inst 75 | 76 | @classmethod 77 | def from_parse_data(cls, parse_data, top=None): 78 | refid = getattr(parse_data, 'refid', None) 79 | if refid is not None and top is not None and refid in top._refs: 80 | return top._refs[refid] 81 | inst = cls(parse_data, top=top) 82 | if refid is not None: 83 | inst.refid = refid 84 | inst.add_ref(inst) 85 | return inst 86 | 87 | def add_ref(self, obj): 88 | if hasattr(obj, 'refid'): 89 | self.top._refs[obj.refid] = obj 90 | 91 | mem_classes = [] 92 | 93 | def get_cls(self, mem): 94 | for cls in self.mem_classes: 95 | if cls.can_parse(mem): 96 | return cls 97 | raise StandardError(("Did not find a class for object '%s'." \ 98 | % (mem.get_name()))) 99 | 100 | def convert_mem(self, mem): 101 | try: 102 | cls = self.get_cls(mem) 103 | converted = cls.from_parse_data(mem, self.top) 104 | if converted is None: 105 | raise StandardError('No class matched this object.') 106 | self.add_ref(converted) 107 | return converted 108 | except StandardError, e: 109 | print e 110 | 111 | @classmethod 112 | def includes(cls, inst): 113 | return isinstance(inst, cls) 114 | 115 | @classmethod 116 | def can_parse(cls, obj): 117 | return False 118 | 119 | def _parse(self): 120 | self._parsed = True 121 | 122 | def _get_dict_members(self, cat=None): 123 | """ 124 | For given category a dictionary is returned mapping member names to 125 | members of that category. For names that are duplicated the name is 126 | mapped to None. 127 | """ 128 | self.confirm_no_error() 129 | if cat not in self._dict_members: 130 | new_dict = {} 131 | for mem in self.in_category(cat): 132 | if mem.name() not in new_dict: 133 | new_dict[mem.name()] = mem 134 | else: 135 | new_dict[mem.name()] = self.Duplicate 136 | self._dict_members[cat] = new_dict 137 | return self._dict_members[cat] 138 | 139 | def in_category(self, cat): 140 | self.confirm_no_error() 141 | if cat is None: 142 | return self._members 143 | if cat not in self._in_category: 144 | self._in_category[cat] = [mem for mem in self._members 145 | if cat.includes(mem)] 146 | return self._in_category[cat] 147 | 148 | def get_member(self, name, cat=None): 149 | self.confirm_no_error() 150 | # Check if it's in a namespace or class. 151 | bits = name.split('::') 152 | first = bits[0] 153 | rest = '::'.join(bits[1:]) 154 | member = self._get_dict_members(cat).get(first, self.NoSuchMember) 155 | # Raise any errors that are returned. 156 | if member in set([self.NoSuchMember, self.Duplicate]): 157 | raise member() 158 | if rest: 159 | return member.get_member(rest, cat=cat) 160 | return member 161 | 162 | def has_member(self, name, cat=None): 163 | try: 164 | mem = self.get_member(name, cat=cat) 165 | return True 166 | except self.NoSuchMember: 167 | return False 168 | 169 | def data(self): 170 | self.confirm_no_error() 171 | return self._data 172 | 173 | def members(self): 174 | self.confirm_no_error() 175 | return self._members 176 | 177 | def process_memberdefs(self): 178 | mdtss = [] 179 | for sec in self._retrieved_data.compounddef.sectiondef: 180 | mdtss += sec.memberdef 181 | # At the moment we lose all information associated with sections. 182 | # Sometimes a memberdef is in several sectiondef. 183 | # We make sure we don't get duplicates here. 184 | uniques = set([]) 185 | for mem in mdtss: 186 | converted = self.convert_mem(mem) 187 | pair = (mem.name, mem.__class__) 188 | if pair not in uniques: 189 | uniques.add(pair) 190 | self._members.append(converted) 191 | 192 | def retrieve_data(self): 193 | filename = os.path.join(self._xml_path, self.refid + '.xml') 194 | try: 195 | self._retrieved_data = compound.parse(filename) 196 | except ExpatError: 197 | print('Error in xml in file %s' % filename) 198 | self._error = True 199 | self._retrieved_data = None 200 | 201 | def check_parsed(self): 202 | if not self._parsed: 203 | self._parse() 204 | 205 | def confirm_no_error(self): 206 | self.check_parsed() 207 | if self._error: 208 | raise self.ParsingError() 209 | 210 | def error(self): 211 | self.check_parsed() 212 | return self._error 213 | 214 | def name(self): 215 | # first see if we can do it without processing. 216 | if self._parse_data is not None: 217 | return self._parse_data.name 218 | self.check_parsed() 219 | return self._retrieved_data.compounddef.name 220 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/docs/doxygen/doxyxml/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | """ 22 | A base class is created. 23 | 24 | Classes based upon this are used to make more user-friendly interfaces 25 | to the doxygen xml docs than the generated classes provide. 26 | """ 27 | 28 | import os 29 | import pdb 30 | 31 | from xml.parsers.expat import ExpatError 32 | 33 | from generated import compound 34 | 35 | 36 | class Base(object): 37 | 38 | class Duplicate(StandardError): 39 | pass 40 | 41 | class NoSuchMember(StandardError): 42 | pass 43 | 44 | class ParsingError(StandardError): 45 | pass 46 | 47 | def __init__(self, parse_data, top=None): 48 | self._parsed = False 49 | self._error = False 50 | self._parse_data = parse_data 51 | self._members = [] 52 | self._dict_members = {} 53 | self._in_category = {} 54 | self._data = {} 55 | if top is not None: 56 | self._xml_path = top._xml_path 57 | # Set up holder of references 58 | else: 59 | top = self 60 | self._refs = {} 61 | self._xml_path = parse_data 62 | self.top = top 63 | 64 | @classmethod 65 | def from_refid(cls, refid, top=None): 66 | """ Instantiate class from a refid rather than parsing object. """ 67 | # First check to see if its already been instantiated. 68 | if top is not None and refid in top._refs: 69 | return top._refs[refid] 70 | # Otherwise create a new instance and set refid. 71 | inst = cls(None, top=top) 72 | inst.refid = refid 73 | inst.add_ref(inst) 74 | return inst 75 | 76 | @classmethod 77 | def from_parse_data(cls, parse_data, top=None): 78 | refid = getattr(parse_data, 'refid', None) 79 | if refid is not None and top is not None and refid in top._refs: 80 | return top._refs[refid] 81 | inst = cls(parse_data, top=top) 82 | if refid is not None: 83 | inst.refid = refid 84 | inst.add_ref(inst) 85 | return inst 86 | 87 | def add_ref(self, obj): 88 | if hasattr(obj, 'refid'): 89 | self.top._refs[obj.refid] = obj 90 | 91 | mem_classes = [] 92 | 93 | def get_cls(self, mem): 94 | for cls in self.mem_classes: 95 | if cls.can_parse(mem): 96 | return cls 97 | raise StandardError(("Did not find a class for object '%s'." \ 98 | % (mem.get_name()))) 99 | 100 | def convert_mem(self, mem): 101 | try: 102 | cls = self.get_cls(mem) 103 | converted = cls.from_parse_data(mem, self.top) 104 | if converted is None: 105 | raise StandardError('No class matched this object.') 106 | self.add_ref(converted) 107 | return converted 108 | except StandardError, e: 109 | print e 110 | 111 | @classmethod 112 | def includes(cls, inst): 113 | return isinstance(inst, cls) 114 | 115 | @classmethod 116 | def can_parse(cls, obj): 117 | return False 118 | 119 | def _parse(self): 120 | self._parsed = True 121 | 122 | def _get_dict_members(self, cat=None): 123 | """ 124 | For given category a dictionary is returned mapping member names to 125 | members of that category. For names that are duplicated the name is 126 | mapped to None. 127 | """ 128 | self.confirm_no_error() 129 | if cat not in self._dict_members: 130 | new_dict = {} 131 | for mem in self.in_category(cat): 132 | if mem.name() not in new_dict: 133 | new_dict[mem.name()] = mem 134 | else: 135 | new_dict[mem.name()] = self.Duplicate 136 | self._dict_members[cat] = new_dict 137 | return self._dict_members[cat] 138 | 139 | def in_category(self, cat): 140 | self.confirm_no_error() 141 | if cat is None: 142 | return self._members 143 | if cat not in self._in_category: 144 | self._in_category[cat] = [mem for mem in self._members 145 | if cat.includes(mem)] 146 | return self._in_category[cat] 147 | 148 | def get_member(self, name, cat=None): 149 | self.confirm_no_error() 150 | # Check if it's in a namespace or class. 151 | bits = name.split('::') 152 | first = bits[0] 153 | rest = '::'.join(bits[1:]) 154 | member = self._get_dict_members(cat).get(first, self.NoSuchMember) 155 | # Raise any errors that are returned. 156 | if member in set([self.NoSuchMember, self.Duplicate]): 157 | raise member() 158 | if rest: 159 | return member.get_member(rest, cat=cat) 160 | return member 161 | 162 | def has_member(self, name, cat=None): 163 | try: 164 | mem = self.get_member(name, cat=cat) 165 | return True 166 | except self.NoSuchMember: 167 | return False 168 | 169 | def data(self): 170 | self.confirm_no_error() 171 | return self._data 172 | 173 | def members(self): 174 | self.confirm_no_error() 175 | return self._members 176 | 177 | def process_memberdefs(self): 178 | mdtss = [] 179 | for sec in self._retrieved_data.compounddef.sectiondef: 180 | mdtss += sec.memberdef 181 | # At the moment we lose all information associated with sections. 182 | # Sometimes a memberdef is in several sectiondef. 183 | # We make sure we don't get duplicates here. 184 | uniques = set([]) 185 | for mem in mdtss: 186 | converted = self.convert_mem(mem) 187 | pair = (mem.name, mem.__class__) 188 | if pair not in uniques: 189 | uniques.add(pair) 190 | self._members.append(converted) 191 | 192 | def retrieve_data(self): 193 | filename = os.path.join(self._xml_path, self.refid + '.xml') 194 | try: 195 | self._retrieved_data = compound.parse(filename) 196 | except ExpatError: 197 | print('Error in xml in file %s' % filename) 198 | self._error = True 199 | self._retrieved_data = None 200 | 201 | def check_parsed(self): 202 | if not self._parsed: 203 | self._parse() 204 | 205 | def confirm_no_error(self): 206 | self.check_parsed() 207 | if self._error: 208 | raise self.ParsingError() 209 | 210 | def error(self): 211 | self.check_parsed() 212 | return self._error 213 | 214 | def name(self): 215 | # first see if we can do it without processing. 216 | if self._parse_data is not None: 217 | return self._parse_data.name 218 | self.check_parsed() 219 | return self._retrieved_data.compounddef.name 220 | -------------------------------------------------------------------------------- /gnuradio/gr-cw_binary/python/build_utils.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004,2009,2012 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | """Misc utilities used at build time 23 | """ 24 | 25 | import re, os, os.path 26 | from build_utils_codes import * 27 | 28 | 29 | # set srcdir to the directory that contains Makefile.am 30 | try: 31 | srcdir = os.environ['srcdir'] 32 | except KeyError, e: 33 | srcdir = "." 34 | srcdir = srcdir + '/' 35 | 36 | # set do_makefile to either true or false dependeing on the environment 37 | try: 38 | if os.environ['do_makefile'] == '0': 39 | do_makefile = False 40 | else: 41 | do_makefile = True 42 | except KeyError, e: 43 | do_makefile = False 44 | 45 | # set do_sources to either true or false dependeing on the environment 46 | try: 47 | if os.environ['do_sources'] == '0': 48 | do_sources = False 49 | else: 50 | do_sources = True 51 | except KeyError, e: 52 | do_sources = True 53 | 54 | name_dict = {} 55 | 56 | def log_output_name (name): 57 | (base, ext) = os.path.splitext (name) 58 | ext = ext[1:] # drop the leading '.' 59 | 60 | entry = name_dict.setdefault (ext, []) 61 | entry.append (name) 62 | 63 | def open_and_log_name (name, dir): 64 | global do_sources 65 | if do_sources: 66 | f = open (name, dir) 67 | else: 68 | f = None 69 | log_output_name (name) 70 | return f 71 | 72 | def expand_template (d, template_filename, extra = ""): 73 | '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file 74 | ''' 75 | global do_sources 76 | output_extension = extract_extension (template_filename) 77 | template = open_src (template_filename, 'r') 78 | output_name = d['NAME'] + extra + '.' + output_extension 79 | log_output_name (output_name) 80 | if do_sources: 81 | output = open (output_name, 'w') 82 | do_substitution (d, template, output) 83 | output.close () 84 | template.close () 85 | 86 | def output_glue (dirname): 87 | output_makefile_fragment () 88 | output_ifile_include (dirname) 89 | 90 | def output_makefile_fragment (): 91 | global do_makefile 92 | if not do_makefile: 93 | return 94 | # overwrite the source, which must be writable; this should have been 95 | # checked for beforehand in the top-level Makefile.gen.gen . 96 | f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w') 97 | f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n') 98 | output_subfrag (f, 'h') 99 | output_subfrag (f, 'i') 100 | output_subfrag (f, 'cc') 101 | f.close () 102 | 103 | def output_ifile_include (dirname): 104 | global do_sources 105 | if do_sources: 106 | f = open ('%s_generated.i' % (dirname,), 'w') 107 | f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n') 108 | files = name_dict.setdefault ('i', []) 109 | files.sort () 110 | f.write ('%{\n') 111 | for file in files: 112 | f.write ('#include <%s>\n' % (file[0:-1] + 'h',)) 113 | f.write ('%}\n\n') 114 | for file in files: 115 | f.write ('%%include <%s>\n' % (file,)) 116 | 117 | def output_subfrag (f, ext): 118 | files = name_dict.setdefault (ext, []) 119 | files.sort () 120 | f.write ("GENERATED_%s =" % (ext.upper ())) 121 | for file in files: 122 | f.write (" \\\n\t%s" % (file,)) 123 | f.write ("\n\n") 124 | 125 | def extract_extension (template_name): 126 | # template name is something like: GrFIRfilterXXX.h.t 127 | # we return everything between the penultimate . and .t 128 | mo = re.search (r'\.([a-z]+)\.t$', template_name) 129 | if not mo: 130 | raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,) 131 | return mo.group (1) 132 | 133 | def open_src (name, mode): 134 | global srcdir 135 | return open (os.path.join (srcdir, name), mode) 136 | 137 | def do_substitution (d, in_file, out_file): 138 | def repl (match_obj): 139 | key = match_obj.group (1) 140 | # print key 141 | return d[key] 142 | 143 | inp = in_file.read () 144 | out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp) 145 | out_file.write (out) 146 | 147 | 148 | 149 | copyright = '''/* -*- c++ -*- */ 150 | /* 151 | * Copyright 2003,2004 Free Software Foundation, Inc. 152 | * 153 | * This file is part of GNU Radio 154 | * 155 | * GNU Radio is free software; you can redistribute it and/or modify 156 | * it under the terms of the GNU General Public License as published by 157 | * the Free Software Foundation; either version 3, or (at your option) 158 | * any later version. 159 | * 160 | * GNU Radio is distributed in the hope that it will be useful, 161 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 162 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 163 | * GNU General Public License for more details. 164 | * 165 | * You should have received a copy of the GNU General Public License 166 | * along with GNU Radio; see the file COPYING. If not, write to 167 | * the Free Software Foundation, Inc., 51 Franklin Street, 168 | * Boston, MA 02110-1301, USA. 169 | */ 170 | ''' 171 | 172 | def is_complex (code3): 173 | if i_code (code3) == 'c' or o_code (code3) == 'c': 174 | return '1' 175 | else: 176 | return '0' 177 | 178 | 179 | def standard_dict (name, code3, package='gr'): 180 | d = {} 181 | d['NAME'] = name 182 | d['NAME_IMPL'] = name+'_impl' 183 | d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) 184 | d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper()) 185 | d['BASE_NAME'] = re.sub ('^' + package + '_', '', name) 186 | d['SPTR_NAME'] = '%s_sptr' % name 187 | d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' 188 | d['COPYRIGHT'] = copyright 189 | d['TYPE'] = i_type (code3) 190 | d['I_TYPE'] = i_type (code3) 191 | d['O_TYPE'] = o_type (code3) 192 | d['TAP_TYPE'] = tap_type (code3) 193 | d['IS_COMPLEX'] = is_complex (code3) 194 | return d 195 | 196 | 197 | def standard_dict2 (name, code3, package): 198 | d = {} 199 | d['NAME'] = name 200 | d['BASE_NAME'] = name 201 | d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) 202 | d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' 203 | d['COPYRIGHT'] = copyright 204 | d['TYPE'] = i_type (code3) 205 | d['I_TYPE'] = i_type (code3) 206 | d['O_TYPE'] = o_type (code3) 207 | d['TAP_TYPE'] = tap_type (code3) 208 | d['IS_COMPLEX'] = is_complex (code3) 209 | return d 210 | 211 | def standard_impl_dict2 (name, code3, package): 212 | d = {} 213 | d['NAME'] = name 214 | d['IMPL_NAME'] = name 215 | d['BASE_NAME'] = name.rstrip("impl").rstrip("_") 216 | d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) 217 | d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' 218 | d['COPYRIGHT'] = copyright 219 | d['FIR_TYPE'] = "fir_filter_" + code3 220 | d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c' 221 | d['TYPE'] = i_type (code3) 222 | d['I_TYPE'] = i_type (code3) 223 | d['O_TYPE'] = o_type (code3) 224 | d['TAP_TYPE'] = tap_type (code3) 225 | d['IS_COMPLEX'] = is_complex (code3) 226 | return d 227 | --------------------------------------------------------------------------------