diff options
37 files changed, 1025 insertions, 452 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 84466cf69..3e3cf8685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,9 +211,6 @@ CPACK_COMPONENT("volk_devel" add_subdirectory(volk) endif(ENABLE_VOLK) - -GR_VMCIRCBUF() - ######################################################################## # Distribute the README file ######################################################################## diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake index 189e97c7e..a73e3e6d7 100644 --- a/cmake/Modules/GrMiscUtils.cmake +++ b/cmake/Modules/GrMiscUtils.cmake @@ -208,28 +208,3 @@ function(GR_GEN_TARGET_DEPS name var) set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endif() endfunction(GR_GEN_TARGET_DEPS) - - -######################################################################## -# Control availability of vmcircbuf methods. -# For now, only allows disabling of shm methods, which cause uncatchable -# segmentation faults on Cygwin with gcc 4.x (x <= 5) -# Usage: -# GR_VMCIRCBUF() -# -# Will set TRY_SHM_VMCIRCBUF to 1 by default except on Windows machines. -# Can manually set with -DTRY_SHM_VMCIRCBUF=0|1 -######################################################################## -function(GR_VMCIRCBUF) - if(WIN32) - OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF) - else(WIN32) - OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON) - endif(WIN32) - - message(STATUS "TRY_SHM_VMCIRCBUF set to ${TRY_SHM_VMCIRCBUF}.") - - if(TRY_SHM_VMCIRCBUF) - add_definitions( -DTRY_SHM_VMCIRCBUF ) - endif(TRY_SHM_VMCIRCBUF) -endfunction(GR_VMCIRCBUF) diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake index b8e719353..175d0d759 100644 --- a/cmake/Modules/GrSwig.cmake +++ b/cmake/Modules/GrSwig.cmake @@ -67,7 +67,6 @@ function(GR_SWIG_MAKE_DOCS output_file) #call doxygen on the Doxyfile + input headers add_custom_command( OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml - ${OUTPUT_DIRECTORY}/xml/combine.xslt DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps} COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile COMMENT "Generating doxygen xml for ${name} docs" @@ -81,6 +80,7 @@ function(GR_SWIG_MAKE_DOCS output_file) ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py ${OUTPUT_DIRECTORY}/xml ${output_file} + COMMENT "Generating python docstrings for ${name}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen ) @@ -105,12 +105,15 @@ endfunction(GR_SWIG_MAKE_DOCS) macro(GR_SWIG_MAKE name) set(ifiles ${ARGN}) + list(APPEND GR_SWIG_TARGET_DEPS ${GR_SWIG_LIBRARIES}) + #do swig doc generation if specified if (GR_SWIG_DOC_FILE) set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS}) GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS}) - list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE}) + add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE}) + list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc) endif() #append additional include directories diff --git a/docs/doxygen/swig_doc.py b/docs/doxygen/swig_doc.py index 927747098..f24608b3e 100644 --- a/docs/doxygen/swig_doc.py +++ b/docs/doxygen/swig_doc.py @@ -1,5 +1,5 @@ # -# Copyright 2010,2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -232,25 +232,7 @@ def make_block2_entry(di, block): params=make_func.params)) return "\n\n".join(output) -def wait_if_necessary(tries, swigdocfilename, item=None): - if item is not None: - extra = ', item {0}'.format(item.name()) - else: - extra = '' - if(tries < 3): - # May not be built just yet; sleep and try again - sys.stderr.write("XML parsing problem with file {0}{1}, retrying.\n".format( - swigdocfilename, extra)) - time.sleep(1) - tries += 1 - return tries, True - else: - # if we've given it three tries, give up and raise an error - sys.stderr.write("XML parsing error with file {0}{1}. giving up.\n".format( - swigdocfilename, extra)) - return tries, False - -def make_swig_interface_file(di, swigdocfilename, custom_output=None, tries=0): +def make_swig_interface_file(di, swigdocfilename, custom_output=None): output = [""" /* @@ -264,50 +246,32 @@ def make_swig_interface_file(di, swigdocfilename, custom_output=None, tries=0): output.append(custom_output) # Create docstrings for the blocks. - while(1): - try: - blocks = di.in_category(Block) - blocks2 = di.in_category(Block2) - except: - tries, try_again = wait_if_necessary(tries, swigdocfilename) - if not try_again: - raise - else: - break + blocks = di.in_category(Block) + blocks2 = di.in_category(Block2) + make_funcs = set([]) for block in blocks: - while(1): - try: - make_func = di.get_member(make_name(block.name()), DoxyFunction) - # Don't want to risk writing to output twice. - if make_func.name() not in make_funcs: - make_funcs.add(make_func.name()) - output.append(make_block_entry(di, block)) - except block.ParsingError: - sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) - except: - tries, try_again = wait_if_necessary(tries, swigdocfilename, block) - if not try_again: - raise - else: - break + try: + make_func = di.get_member(make_name(block.name()), DoxyFunction) + # Don't want to risk writing to output twice. + if make_func.name() not in make_funcs: + make_funcs.add(make_func.name()) + output.append(make_block_entry(di, block)) + except block.ParsingError: + sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) + raise + for block in blocks2: - while(1): - try: - make_func = block.get_member('make', DoxyFunction) - make_func_name = block.name() +'::make' - # Don't want to risk writing to output twice. - if make_func_name not in make_funcs: - make_funcs.add(make_func_name) - output.append(make_block2_entry(di, block)) - except block.ParsingError: - sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) - except: - tries, try_again = wait_if_necessary(tries, swigdocfilename, block) - if not try_again: - raise - else: - break + try: + make_func = block.get_member('make', DoxyFunction) + make_func_name = block.name() +'::make' + # Don't want to risk writing to output twice. + if make_func_name not in make_funcs: + make_funcs.add(make_func_name) + output.append(make_block2_entry(di, block)) + except block.ParsingError: + sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) + raise # Create docstrings for functions # Don't include the make functions since they have already been dealt with. @@ -359,16 +323,4 @@ if __name__ == "__main__": custom_output = "\n\n".join(output) # Generate the docstrings interface file. - # If parsing error on NoSuchMember, try again by rereading everything. - # Give up after 3 tries. - tries = 0 - while(1): - try: - make_swig_interface_file(di, swigdocfilename, custom_output=custom_output, tries=tries) - except: - tries, try_again = wait_if_necessary(tries, swigdocfilename) - if not try_again: - raise - else: - break - + make_swig_interface_file(di, swigdocfilename, custom_output=custom_output) diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt index 4e76b3c5a..5f26216d3 100644 --- a/gnuradio-core/CMakeLists.txt +++ b/gnuradio-core/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -64,7 +64,7 @@ GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/gruel/src/swig - ${CMAKE_BINARY_DIR}/gruel/src/swig/ + ${CMAKE_BINARY_DIR}/gruel/src/swig ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig ${GNURADIO_CORE_INCLUDE_DIRS} ) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index b671c963b..53cb16d38 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -37,6 +37,10 @@ ADD_FILE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h ) +add_custom_target(general_generated DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h +) + ######################################################################## # Handle the generated constants ######################################################################## @@ -183,6 +187,7 @@ set(gr_core_general_triple_threats gr_agc2_ff gr_align_on_samplenumbers_ss gr_bin_statistics_f + gr_block_gateway gr_bytes_to_syms gr_char_to_float gr_char_to_short diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index c0ce65527..31acaefb8 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2004-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -264,3 +264,4 @@ %include "gr_add_ff.i" %include "gr_vector_map.i" %include "gr_tag_debug.i" +%include "gr_block_gateway.i" diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.cc b/gnuradio-core/src/lib/general/gr_block_gateway.cc new file mode 100644 index 000000000..79b42803a --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_block_gateway.cc @@ -0,0 +1,184 @@ +/* + * Copyright 2011-2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_block_gateway.h> +#include <gr_io_signature.h> +#include <iostream> +#include <boost/bind.hpp> + +/*********************************************************************** + * Helper routines + **********************************************************************/ +template <typename OutType, typename InType> +void copy_pointers(OutType &out, const InType &in){ + out.resize(in.size()); + for (size_t i = 0; i < in.size(); i++){ + out[i] = (void *)(in[i]); + } +} + +/*********************************************************************** + * The gr_block gateway implementation class + **********************************************************************/ +class gr_block_gateway_impl : public gr_block_gateway{ +public: + gr_block_gateway_impl( + gr_feval_ll *handler, + const std::string &name, + gr_io_signature_sptr in_sig, + gr_io_signature_sptr out_sig, + const gr_block_gw_work_type work_type, + const unsigned factor + ): + gr_block(name, in_sig, out_sig), + _handler(handler), + _work_type(work_type) + { + switch(_work_type){ + case GR_BLOCK_GW_WORK_GENERAL: + _decim = 1; //not relevant, but set anyway + _interp = 1; //not relevant, but set anyway + break; + + case GR_BLOCK_GW_WORK_SYNC: + _decim = 1; + _interp = 1; + this->set_fixed_rate(true); + break; + + case GR_BLOCK_GW_WORK_DECIM: + _decim = factor; + _interp = 1; + break; + + case GR_BLOCK_GW_WORK_INTERP: + _decim = 1; + _interp = factor; + this->set_output_multiple(_interp); + break; + } + } + + /******************************************************************* + * Overloads for various scheduler-called functions + ******************************************************************/ + void forecast( + int noutput_items, + gr_vector_int &ninput_items_required + ){ + switch(_work_type){ + case GR_BLOCK_GW_WORK_GENERAL: + _message.action = gr_block_gw_message_type::ACTION_FORECAST; + _message.forecast_args_noutput_items = noutput_items; + _message.forecast_args_ninput_items_required = ninput_items_required; + _handler->calleval(0); + ninput_items_required = _message.forecast_args_ninput_items_required; + return; + + default: + unsigned ninputs = ninput_items_required.size(); + for (unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items); + return; + } + } + + int general_work( + int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + switch(_work_type){ + case GR_BLOCK_GW_WORK_GENERAL: + _message.action = gr_block_gw_message_type::ACTION_GENERAL_WORK; + _message.general_work_args_noutput_items = noutput_items; + _message.general_work_args_ninput_items = ninput_items; + copy_pointers(_message.general_work_args_input_items, input_items); + _message.general_work_args_output_items = output_items; + _handler->calleval(0); + return _message.general_work_args_return_value; + + default: + int r = work (noutput_items, input_items, output_items); + if (r > 0) consume_each(r*_decim/_interp); + return r; + } + } + + int work( + int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + _message.action = gr_block_gw_message_type::ACTION_WORK; + _message.work_args_ninput_items = fixed_rate_noutput_to_ninput(noutput_items); + if (_message.work_args_ninput_items == 0) return -1; + _message.work_args_noutput_items = noutput_items; + copy_pointers(_message.work_args_input_items, input_items); + _message.work_args_output_items = output_items; + _handler->calleval(0); + return _message.work_args_return_value; + } + + int fixed_rate_noutput_to_ninput(int noutput_items){ + return (noutput_items*_decim/_interp) + history() - 1; + } + + int fixed_rate_ninput_to_noutput(int ninput_items){ + return std::max(0, ninput_items - (int)history() + 1)*_interp/_decim; + } + + bool start(void){ + _message.action = gr_block_gw_message_type::ACTION_START; + _handler->calleval(0); + return _message.start_args_return_value; + } + + bool stop(void){ + _message.action = gr_block_gw_message_type::ACTION_STOP; + _handler->calleval(0); + return _message.stop_args_return_value; + } + + gr_block_gw_message_type &gr_block_message(void){ + return _message; + } + +private: + gr_feval_ll *_handler; + gr_block_gw_message_type _message; + const gr_block_gw_work_type _work_type; + unsigned _decim, _interp; +}; + +boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( + gr_feval_ll *handler, + const std::string &name, + gr_io_signature_sptr in_sig, + gr_io_signature_sptr out_sig, + const gr_block_gw_work_type work_type, + const unsigned factor +){ + return boost::shared_ptr<gr_block_gateway>( + new gr_block_gateway_impl(handler, name, in_sig, out_sig, work_type, factor) + ); +} diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.h b/gnuradio-core/src/lib/general/gr_block_gateway.h new file mode 100644 index 000000000..ae91d41b5 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_block_gateway.h @@ -0,0 +1,212 @@ +/* + * Copyright 2011-2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GRBLOCK_GATEWAY_H +#define INCLUDED_GRBLOCK_GATEWAY_H + +#include <gr_core_api.h> +#include <gr_block.h> +#include <gr_feval.h> + +/*! + * The work type enum tells the gateway what kind of block to implement. + * The choices are familiar gnuradio block overloads (sync, decim, interp). + */ +enum gr_block_gw_work_type{ + GR_BLOCK_GW_WORK_GENERAL, + GR_BLOCK_GW_WORK_SYNC, + GR_BLOCK_GW_WORK_DECIM, + GR_BLOCK_GW_WORK_INTERP, +}; + +/*! + * Shared message structure between python and gateway. + * Each action type represents a scheduler-called function. + */ +struct gr_block_gw_message_type{ + enum action_type{ + ACTION_GENERAL_WORK, //dispatch work + ACTION_WORK, //dispatch work + ACTION_FORECAST, //dispatch forecast + ACTION_START, //dispatch start + ACTION_STOP, //dispatch stop + }; + + action_type action; + + int general_work_args_noutput_items; + std::vector<int> general_work_args_ninput_items; + std::vector<void *> general_work_args_input_items; //TODO this should be const void*, but swig cant int cast it right + std::vector<void *> general_work_args_output_items; + int general_work_args_return_value; + + int work_args_ninput_items; + int work_args_noutput_items; + std::vector<void *> work_args_input_items; //TODO this should be const void*, but swig cant int cast it right + std::vector<void *> work_args_output_items; + int work_args_return_value; + + int forecast_args_noutput_items; + std::vector<int> forecast_args_ninput_items_required; + + bool start_args_return_value; + + bool stop_args_return_value; +}; + +/*! + * The gateway block which performs all the magic. + * + * The gateway provides access to all the gr_block routines. + * The methods prefixed with gr_block__ are renamed + * to class methods without the prefix in python. + */ +class GR_CORE_API gr_block_gateway : virtual public gr_block{ +public: + //! Provide access to the shared message object + virtual gr_block_gw_message_type &gr_block_message(void) = 0; + + long gr_block__unique_id(void) const{ + return gr_block::unique_id(); + } + + std::string gr_block__name(void) const{ + return gr_block::name(); + } + + unsigned gr_block__history(void) const{ + return gr_block::history(); + } + + void gr_block__set_history(unsigned history){ + return gr_block::set_history(history); + } + + void gr_block__set_fixed_rate(bool fixed_rate){ + return gr_block::set_fixed_rate(fixed_rate); + } + + bool gr_block__fixed_rate(void) const{ + return gr_block::fixed_rate(); + } + + void gr_block__set_output_multiple(int multiple){ + return gr_block::set_output_multiple(multiple); + } + + int gr_block__output_multiple(void) const{ + return gr_block::output_multiple(); + } + + void gr_block__consume(int which_input, int how_many_items){ + return gr_block::consume(which_input, how_many_items); + } + + void gr_block__consume_each(int how_many_items){ + return gr_block::consume_each(how_many_items); + } + + void gr_block__produce(int which_output, int how_many_items){ + return gr_block::produce(which_output, how_many_items); + } + + void gr_block__set_relative_rate(double relative_rate){ + return gr_block::set_relative_rate(relative_rate); + } + + double gr_block__relative_rate(void) const{ + return gr_block::relative_rate(); + } + + uint64_t gr_block__nitems_read(unsigned int which_input){ + return gr_block::nitems_read(which_input); + } + + uint64_t gr_block__nitems_written(unsigned int which_output){ + return gr_block::nitems_written(which_output); + } + + gr_block::tag_propagation_policy_t gr_block__tag_propagation_policy(void){ + return gr_block::tag_propagation_policy(); + } + + void gr_block__set_tag_propagation_policy(gr_block::tag_propagation_policy_t p){ + return gr_block::set_tag_propagation_policy(p); + } + + void gr_block__add_item_tag( + unsigned int which_output, const gr_tag_t &tag + ){ + return gr_block::add_item_tag(which_output, tag); + } + + void gr_block__add_item_tag( + unsigned int which_output, + uint64_t abs_offset, + const pmt::pmt_t &key, + const pmt::pmt_t &value, + const pmt::pmt_t &srcid=pmt::PMT_F + ){ + return gr_block::add_item_tag(which_output, abs_offset, key, value, srcid); + } + + std::vector<gr_tag_t> gr_block__get_tags_in_range( + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end + ){ + std::vector<gr_tag_t> tags; + gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end); + return tags; + } + + std::vector<gr_tag_t> gr_block__get_tags_in_range( + unsigned int which_input, + uint64_t abs_start, + uint64_t abs_end, + const pmt::pmt_t &key + ){ + std::vector<gr_tag_t> tags; + gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end, key); + return tags; + } +}; + +/*! + * Make a new gateway block. + * \param handler the swig director object with callback + * \param name the name of the block (Ex: "Shirley") + * \param in_sig the input signature for this block + * \param out_sig the output signature for this block + * \param work_type the type of block overload to implement + * \param factor the decimation or interpolation factor + * \return a new gateway block + */ +GR_CORE_API boost::shared_ptr<gr_block_gateway> gr_make_block_gateway( + gr_feval_ll *handler, + const std::string &name, + gr_io_signature_sptr in_sig, + gr_io_signature_sptr out_sig, + const gr_block_gw_work_type work_type, + const unsigned factor +); + +#endif /* INCLUDED_GRBLOCK_GATEWAY_H */ diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.i b/gnuradio-core/src/lib/general/gr_block_gateway.i new file mode 100644 index 000000000..8adafdfea --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_block_gateway.i @@ -0,0 +1,46 @@ +/* + * Copyright 2011-2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +//////////////////////////////////////////////////////////////////////// +// standard includes +//////////////////////////////////////////////////////////////////////// +%include <gnuradio.i> +%include <gr_tags.i> +%include <gr_feval.i> + +//////////////////////////////////////////////////////////////////////// +// block headers +//////////////////////////////////////////////////////////////////////// +%{ +#include <gr_block_gateway.h> +%} + +//////////////////////////////////////////////////////////////////////// +// data type support +//////////////////////////////////////////////////////////////////////// +%template(int_vector_t) std::vector<int>; +%template(void_star_vector_t) std::vector<void *>; + +//////////////////////////////////////////////////////////////////////// +// block magic +//////////////////////////////////////////////////////////////////////// +GR_SWIG_BLOCK_MAGIC(gr,block_gateway); +%include <gr_block_gateway.h> diff --git a/gnuradio-core/src/lib/gengen/Makefile.gen b/gnuradio-core/src/lib/gengen/Makefile.gen deleted file mode 100644 index b4a255dc0..000000000 --- a/gnuradio-core/src/lib/gengen/Makefile.gen +++ /dev/null @@ -1,333 +0,0 @@ -# -# This file is machine generated. All edits will be overwritten -# -GENERATED_H = \ - gr_add_cc.h \ - gr_add_const_cc.h \ - gr_add_const_ff.h \ - gr_add_const_ii.h \ - gr_add_const_sf.h \ - gr_add_const_ss.h \ - gr_add_const_vcc.h \ - gr_add_const_vff.h \ - gr_add_const_vii.h \ - gr_add_const_vss.h \ - gr_add_ii.h \ - gr_add_ss.h \ - gr_and_bb.h \ - gr_and_const_bb.h \ - gr_and_const_ii.h \ - gr_and_const_ss.h \ - gr_and_ii.h \ - gr_and_ss.h \ - gr_argmax_fs.h \ - gr_argmax_is.h \ - gr_argmax_ss.h \ - gr_chunks_to_symbols_bc.h \ - gr_chunks_to_symbols_bf.h \ - gr_chunks_to_symbols_ic.h \ - gr_chunks_to_symbols_if.h \ - gr_chunks_to_symbols_sc.h \ - gr_chunks_to_symbols_sf.h \ - gr_divide_cc.h \ - gr_divide_ff.h \ - gr_divide_ii.h \ - gr_divide_ss.h \ - gr_integrate_cc.h \ - gr_integrate_ff.h \ - gr_integrate_ii.h \ - gr_integrate_ss.h \ - gr_max_ff.h \ - gr_max_ii.h \ - gr_max_ss.h \ - gr_moving_average_cc.h \ - gr_moving_average_ff.h \ - gr_moving_average_ii.h \ - gr_moving_average_ss.h \ - gr_multiply_const_ii.h \ - gr_multiply_const_ss.h \ - gr_multiply_const_vcc.h \ - gr_multiply_const_vff.h \ - gr_multiply_const_vii.h \ - gr_multiply_const_vss.h \ - gr_multiply_ii.h \ - gr_multiply_ss.h \ - gr_mute_cc.h \ - gr_mute_ff.h \ - gr_mute_ii.h \ - gr_mute_ss.h \ - gr_noise_source_c.h \ - gr_noise_source_f.h \ - gr_noise_source_i.h \ - gr_noise_source_s.h \ - gr_not_bb.h \ - gr_not_ii.h \ - gr_not_ss.h \ - gr_or_bb.h \ - gr_or_ii.h \ - gr_or_ss.h \ - gr_packed_to_unpacked_bb.h \ - gr_packed_to_unpacked_ii.h \ - gr_packed_to_unpacked_ss.h \ - gr_peak_detector_fb.h \ - gr_peak_detector_ib.h \ - gr_peak_detector_sb.h \ - gr_probe_signal_b.h \ - gr_probe_signal_s.h \ - gr_probe_signal_i.h \ - gr_probe_signal_f.h \ - gr_probe_signal_c.h \ - gr_probe_signal_vb.h \ - gr_probe_signal_vs.h \ - gr_probe_signal_vi.h \ - gr_probe_signal_vf.h \ - gr_probe_signal_vc.h \ - gr_sample_and_hold_bb.h \ - gr_sample_and_hold_ff.h \ - gr_sample_and_hold_ii.h \ - gr_sample_and_hold_ss.h \ - gr_sig_source_c.h \ - gr_sig_source_f.h \ - gr_sig_source_i.h \ - gr_sig_source_s.h \ - gr_sub_cc.h \ - gr_sub_ff.h \ - gr_sub_ii.h \ - gr_sub_ss.h \ - gr_unpacked_to_packed_bb.h \ - gr_unpacked_to_packed_ii.h \ - gr_unpacked_to_packed_ss.h \ - gr_vector_sink_b.h \ - gr_vector_sink_c.h \ - gr_vector_sink_f.h \ - gr_vector_sink_i.h \ - gr_vector_sink_s.h \ - gr_vector_source_b.h \ - gr_vector_source_c.h \ - gr_vector_source_f.h \ - gr_vector_source_i.h \ - gr_vector_source_s.h \ - gr_xor_bb.h \ - gr_xor_ii.h \ - gr_xor_ss.h - -GENERATED_I = \ - gr_add_cc.i \ - gr_add_const_cc.i \ - gr_add_const_ff.i \ - gr_add_const_ii.i \ - gr_add_const_sf.i \ - gr_add_const_ss.i \ - gr_add_const_vcc.i \ - gr_add_const_vff.i \ - gr_add_const_vii.i \ - gr_add_const_vss.i \ - gr_add_ii.i \ - gr_add_ss.i \ - gr_and_bb.i \ - gr_and_const_bb.i \ - gr_and_const_ii.i \ - gr_and_const_ss.i \ - gr_and_ii.i \ - gr_and_ss.i \ - gr_argmax_fs.i \ - gr_argmax_is.i \ - gr_argmax_ss.i \ - gr_chunks_to_symbols_bc.i \ - gr_chunks_to_symbols_bf.i \ - gr_chunks_to_symbols_ic.i \ - gr_chunks_to_symbols_if.i \ - gr_chunks_to_symbols_sc.i \ - gr_chunks_to_symbols_sf.i \ - gr_divide_cc.i \ - gr_divide_ff.i \ - gr_divide_ii.i \ - gr_divide_ss.i \ - gr_integrate_cc.i \ - gr_integrate_ff.i \ - gr_integrate_ii.i \ - gr_integrate_ss.i \ - gr_max_ff.i \ - gr_max_ii.i \ - gr_max_ss.i \ - gr_moving_average_cc.i \ - gr_moving_average_ff.i \ - gr_moving_average_ii.i \ - gr_moving_average_ss.i \ - gr_multiply_const_ii.i \ - gr_multiply_const_ss.i \ - gr_multiply_const_vcc.i \ - gr_multiply_const_vff.i \ - gr_multiply_const_vii.i \ - gr_multiply_const_vss.i \ - gr_multiply_ii.i \ - gr_multiply_ss.i \ - gr_mute_cc.i \ - gr_mute_ff.i \ - gr_mute_ii.i \ - gr_mute_ss.i \ - gr_noise_source_c.i \ - gr_noise_source_f.i \ - gr_noise_source_i.i \ - gr_noise_source_s.i \ - gr_not_bb.i \ - gr_not_ii.i \ - gr_not_ss.i \ - gr_or_bb.i \ - gr_or_ii.i \ - gr_or_ss.i \ - gr_packed_to_unpacked_bb.i \ - gr_packed_to_unpacked_ii.i \ - gr_packed_to_unpacked_ss.i \ - gr_peak_detector_fb.i \ - gr_peak_detector_ib.i \ - gr_peak_detector_sb.i \ - gr_probe_signal_b.i \ - gr_probe_signal_s.i \ - gr_probe_signal_i.i \ - gr_probe_signal_f.i \ - gr_probe_signal_c.i \ - gr_probe_signal_vb.i \ - gr_probe_signal_vs.i \ - gr_probe_signal_vi.i \ - gr_probe_signal_vf.i \ - gr_probe_signal_vc.i \ - gr_sample_and_hold_bb.i \ - gr_sample_and_hold_ff.i \ - gr_sample_and_hold_ii.i \ - gr_sample_and_hold_ss.i \ - gr_sig_source_c.i \ - gr_sig_source_f.i \ - gr_sig_source_i.i \ - gr_sig_source_s.i \ - gr_sub_cc.i \ - gr_sub_ff.i \ - gr_sub_ii.i \ - gr_sub_ss.i \ - gr_unpacked_to_packed_bb.i \ - gr_unpacked_to_packed_ii.i \ - gr_unpacked_to_packed_ss.i \ - gr_vector_sink_b.i \ - gr_vector_sink_c.i \ - gr_vector_sink_f.i \ - gr_vector_sink_i.i \ - gr_vector_sink_s.i \ - gr_vector_source_b.i \ - gr_vector_source_c.i \ - gr_vector_source_f.i \ - gr_vector_source_i.i \ - gr_vector_source_s.i \ - gr_xor_bb.i \ - gr_xor_ii.i \ - gr_xor_ss.i - -GENERATED_CC = \ - gr_add_cc.cc \ - gr_add_const_cc.cc \ - gr_add_const_ff.cc \ - gr_add_const_ii.cc \ - gr_add_const_sf.cc \ - gr_add_const_ss.cc \ - gr_add_const_vcc.cc \ - gr_add_const_vff.cc \ - gr_add_const_vii.cc \ - gr_add_const_vss.cc \ - gr_add_ii.cc \ - gr_add_ss.cc \ - gr_and_bb.cc \ - gr_and_const_bb.cc \ - gr_and_const_ii.cc \ - gr_and_const_ss.cc \ - gr_and_ii.cc \ - gr_and_ss.cc \ - gr_argmax_fs.cc \ - gr_argmax_is.cc \ - gr_argmax_ss.cc \ - gr_chunks_to_symbols_bc.cc \ - gr_chunks_to_symbols_bf.cc \ - gr_chunks_to_symbols_ic.cc \ - gr_chunks_to_symbols_if.cc \ - gr_chunks_to_symbols_sc.cc \ - gr_chunks_to_symbols_sf.cc \ - gr_divide_cc.cc \ - gr_divide_ff.cc \ - gr_divide_ii.cc \ - gr_divide_ss.cc \ - gr_integrate_cc.cc \ - gr_integrate_ff.cc \ - gr_integrate_ii.cc \ - gr_integrate_ss.cc \ - gr_max_ff.cc \ - gr_max_ii.cc \ - gr_max_ss.cc \ - gr_moving_average_cc.cc \ - gr_moving_average_ff.cc \ - gr_moving_average_ii.cc \ - gr_moving_average_ss.cc \ - gr_multiply_const_ii.cc \ - gr_multiply_const_ss.cc \ - gr_multiply_const_vcc.cc \ - gr_multiply_const_vff.cc \ - gr_multiply_const_vii.cc \ - gr_multiply_const_vss.cc \ - gr_multiply_ii.cc \ - gr_multiply_ss.cc \ - gr_mute_cc.cc \ - gr_mute_ff.cc \ - gr_mute_ii.cc \ - gr_mute_ss.cc \ - gr_noise_source_c.cc \ - gr_noise_source_f.cc \ - gr_noise_source_i.cc \ - gr_noise_source_s.cc \ - gr_not_bb.cc \ - gr_not_ii.cc \ - gr_not_ss.cc \ - gr_or_bb.cc \ - gr_or_ii.cc \ - gr_or_ss.cc \ - gr_packed_to_unpacked_bb.cc \ - gr_packed_to_unpacked_ii.cc \ - gr_packed_to_unpacked_ss.cc \ - gr_peak_detector_fb.cc \ - gr_peak_detector_ib.cc \ - gr_peak_detector_sb.cc \ - gr_probe_signal_b.cc \ - gr_probe_signal_s.cc \ - gr_probe_signal_i.cc \ - gr_probe_signal_f.cc \ - gr_probe_signal_c.cc \ - gr_probe_signal_vb.cc \ - gr_probe_signal_vs.cc \ - gr_probe_signal_vi.cc \ - gr_probe_signal_vf.cc \ - gr_probe_signal_vc.cc \ - gr_sample_and_hold_bb.cc \ - gr_sample_and_hold_ff.cc \ - gr_sample_and_hold_ii.cc \ - gr_sample_and_hold_ss.cc \ - gr_sig_source_c.cc \ - gr_sig_source_f.cc \ - gr_sig_source_i.cc \ - gr_sig_source_s.cc \ - gr_sub_cc.cc \ - gr_sub_ff.cc \ - gr_sub_ii.cc \ - gr_sub_ss.cc \ - gr_unpacked_to_packed_bb.cc \ - gr_unpacked_to_packed_ii.cc \ - gr_unpacked_to_packed_ss.cc \ - gr_vector_sink_b.cc \ - gr_vector_sink_c.cc \ - gr_vector_sink_f.cc \ - gr_vector_sink_i.cc \ - gr_vector_sink_s.cc \ - gr_vector_source_b.cc \ - gr_vector_source_c.cc \ - gr_vector_source_f.cc \ - gr_vector_source_i.cc \ - gr_vector_source_s.cc \ - gr_xor_bb.cc \ - gr_xor_ii.cc \ - gr_xor_ss.cc - diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index 1415ff4c6..5f3672dde 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -22,6 +22,29 @@ ######################################################################## ######################################################################## +# Control availability of vmcircbuf methods. +# For now, only allows disabling of shm methods, which cause uncatchable +# segmentation faults on Cygwin with gcc 4.x (x <= 5) +# Usage: +# GR_VMCIRCBUF() +# +# Will set TRY_SHM_VMCIRCBUF to 1 by default except on Windows machines. +# Can manually set with -DTRY_SHM_VMCIRCBUF=0|1 +######################################################################## + + if(WIN32) + OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF) + else(WIN32) + OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON) + endif(WIN32) + + message(STATUS "TRY_SHM_VMCIRCBUF set to ${TRY_SHM_VMCIRCBUF}.") + + if(TRY_SHM_VMCIRCBUF) + add_definitions( -DTRY_SHM_VMCIRCBUF ) + endif(TRY_SHM_VMCIRCBUF) + +######################################################################## # Append gnuradio-core library sources ######################################################################## list(APPEND gnuradio_core_sources diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index d3c381b4b..5b740d916 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -43,7 +43,7 @@ set(GR_SWIG_LIBRARIES gnuradio-core) # X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- -set(GR_SWIG_TARGET_DEPS gengen_generated filter_generated) +set(GR_SWIG_TARGET_DEPS general_generated gengen_generated filter_generated pmt_swig) foreach(what runtime general gengen filter io hier) SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i) @@ -61,8 +61,11 @@ foreach(what runtime general gengen filter io hier) DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig" ) + list(APPEND core_swig_deps ${SWIG_MODULE_gnuradio_core_${what}_REAL_NAME}) endforeach(what) +add_custom_target(core_swig DEPENDS ${core_swig_deps}) + ######################################################################## # Install various files ######################################################################## diff --git a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt index 3e75ead03..62f3d7e46 100644 --- a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt @@ -23,6 +23,7 @@ include(GrPython) GR_PYTHON_INSTALL(FILES __init__.py exceptions.py + gateway.py gr_threading.py gr_threading_23.py gr_threading_24.py @@ -43,6 +44,8 @@ file(GLOB py_qa_test_files "qa_*.py") foreach(py_qa_test_file ${py_qa_test_files}) get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) set(GR_TEST_PYTHON_DIRS + ${CMAKE_SOURCE_DIR}/gruel/src/python + ${CMAKE_BINARY_DIR}/gruel/src/swig ${CMAKE_BINARY_DIR}/gnuradio-core/src/python ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ) diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index 602d1119f..5b9a6a32c 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2006,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2003-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -44,6 +44,7 @@ from gnuradio_core import * from exceptions import * from hier_block2 import * from top_block import * +from gateway import basic_block, sync_block, decim_block, interp_block if _RTLD_GLOBAL != 0: sys.setdlopenflags(_dlopenflags) # Restore original flags diff --git a/gnuradio-core/src/python/gnuradio/gr/gateway.py b/gnuradio-core/src/python/gnuradio/gr/gateway.py new file mode 100644 index 000000000..244b8b592 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/gateway.py @@ -0,0 +1,215 @@ +# +# Copyright 2011-2012 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +import gnuradio_core as gr_core +from gnuradio_core import io_signature, io_signaturev +from gnuradio_core import gr_block_gw_message_type +from gnuradio_core import block_gateway +import numpy + +######################################################################## +# Magic to turn pointers into numpy arrays +# http://docs.scipy.org/doc/numpy/reference/arrays.interface.html +######################################################################## +def pointer_to_ndarray(addr, dtype, nitems): + class array_like: + __array_interface__ = { + 'data' : (int(addr), False), + 'typestr' : dtype.base.str, + 'descr' : dtype.base.descr, + 'shape' : (nitems,) + dtype.shape, + 'strides' : None, + 'version' : 3 + } + return numpy.asarray(array_like()).view(dtype.base) + +######################################################################## +# Handler that does callbacks from C++ +######################################################################## +class gateway_handler(gr_core.feval_ll): + + #dont put a constructor, it wont work + + def init(self, callback): + self._callback = callback + + def eval(self, arg): + try: self._callback() + except Exception as ex: + print("handler caught exception: %s"%ex) + import traceback; traceback.print_exc() + raise ex + return 0 + +######################################################################## +# The guts that make this into a gr block +######################################################################## +class gateway_block(object): + + def __init__(self, name, in_sig, out_sig, work_type, factor): + + #ensure that the sigs are iterable dtypes + def sig_to_dtype_sig(sig): + if sig is None: sig = () + return map(numpy.dtype, sig) + self.__in_sig = sig_to_dtype_sig(in_sig) + self.__out_sig = sig_to_dtype_sig(out_sig) + + #cache the ranges to iterate when dispatching work + self.__in_indexes = range(len(self.__in_sig)) + self.__out_indexes = range(len(self.__out_sig)) + + #convert the signatures into gr.io_signatures + def sig_to_gr_io_sigv(sig): + if not len(sig): return io_signature(0, 0, 0) + return io_signaturev(len(sig), len(sig), [s.itemsize for s in sig]) + gr_in_sig = sig_to_gr_io_sigv(self.__in_sig) + gr_out_sig = sig_to_gr_io_sigv(self.__out_sig) + + #create internal gateway block + self.__handler = gateway_handler() + self.__handler.init(self.__gr_block_handle) + self.__gateway = block_gateway( + self.__handler, name, gr_in_sig, gr_out_sig, work_type, factor) + self.__message = self.__gateway.gr_block_message() + + #register gr_block functions + prefix = 'gr_block__' + for attr in [x for x in dir(self.__gateway) if x.startswith(prefix)]: + setattr(self, attr.replace(prefix, ''), getattr(self.__gateway, attr)) + self.pop_msg_queue = lambda: gr_core.gr_block_gw_pop_msg_queue_safe(self.__gateway) + + def to_basic_block(self): + """ + Makes this block connectable by hier/top block python + """ + return self.__gateway.to_basic_block() + + def __gr_block_handle(self): + """ + Dispatch tasks according to the action type specified in the message. + """ + if self.__message.action == gr_block_gw_message_type.ACTION_GENERAL_WORK: + self.__message.general_work_args_return_value = self.general_work( + + input_items=[pointer_to_ndarray( + self.__message.general_work_args_input_items[i], + self.__in_sig[i], + self.__message.general_work_args_ninput_items[i] + ) for i in self.__in_indexes], + + output_items=[pointer_to_ndarray( + self.__message.general_work_args_output_items[i], + self.__out_sig[i], + self.__message.general_work_args_noutput_items + ) for i in self.__out_indexes], + ) + + elif self.__message.action == gr_block_gw_message_type.ACTION_WORK: + self.__message.work_args_return_value = self.work( + + input_items=[pointer_to_ndarray( + self.__message.work_args_input_items[i], + self.__in_sig[i], + self.__message.work_args_ninput_items + ) for i in self.__in_indexes], + + output_items=[pointer_to_ndarray( + self.__message.work_args_output_items[i], + self.__out_sig[i], + self.__message.work_args_noutput_items + ) for i in self.__out_indexes], + ) + + elif self.__message.action == gr_block_gw_message_type.ACTION_FORECAST: + self.forecast( + noutput_items=self.__message.forecast_args_noutput_items, + ninput_items_required=self.__message.forecast_args_ninput_items_required, + ) + + elif self.__message.action == gr_block_gw_message_type.ACTION_START: + self.__message.start_args_return_value = self.start() + + elif self.__message.action == gr_block_gw_message_type.ACTION_STOP: + self.__message.stop_args_return_value = self.stop() + + def forecast(self, noutput_items, ninput_items_required): + """ + forecast is only called from a general block + this is the default implementation + """ + for ninput_item in ninput_items_required: + ninput_item = noutput_items + self.history() - 1; + return + + def general_work(self, *args, **kwargs): + """general work to be overloaded in a derived class""" + raise NotImplementedError("general work not implemented") + + def work(self, *args, **kwargs): + """work to be overloaded in a derived class""" + raise NotImplementedError("work not implemented") + + def start(self): return True + def stop(self): return True + +######################################################################## +# Wrappers for the user to inherit from +######################################################################## +class basic_block(gateway_block): + def __init__(self, name, in_sig, out_sig): + gateway_block.__init__(self, + name=name, + in_sig=in_sig, + out_sig=out_sig, + work_type=gr_core.GR_BLOCK_GW_WORK_GENERAL, + factor=1, #not relevant factor + ) + +class sync_block(gateway_block): + def __init__(self, name, in_sig, out_sig): + gateway_block.__init__(self, + name=name, + in_sig=in_sig, + out_sig=out_sig, + work_type=gr_core.GR_BLOCK_GW_WORK_SYNC, + factor=1, + ) + +class decim_block(gateway_block): + def __init__(self, name, in_sig, out_sig, decim): + gateway_block.__init__(self, + name=name, + in_sig=in_sig, + out_sig=out_sig, + work_type=gr_core.GR_BLOCK_GW_WORK_DECIM, + factor=decim, + ) + +class interp_block(gateway_block): + def __init__(self, name, in_sig, out_sig, interp): + gateway_block.__init__(self, + name=name, + in_sig=in_sig, + out_sig=out_sig, + work_type=gr_core.GR_BLOCK_GW_WORK_INTERP, + factor=interp, + ) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py new file mode 100644 index 000000000..89eb8aed6 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py @@ -0,0 +1,235 @@ +# +# Copyright 2011-2012 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import pmt #from gruel import pmt +import numpy + +class add_2_f32_1_f32(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "add 2 f32", + in_sig = [numpy.float32, numpy.float32], + out_sig = [numpy.float32], + ) + + def work(self, input_items, output_items): + output_items[0][:] = input_items[0] + input_items[1] + return len(output_items[0]) + +class add_2_fc32_1_fc32(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "add 2 fc32", + in_sig = [numpy.complex64, numpy.complex64], + out_sig = [numpy.complex64], + ) + + def work(self, input_items, output_items): + output_items[0][:] = input_items[0] + input_items[1] + return len(output_items[0]) + +class convolve(gr.sync_block): + """ + A demonstration using block history to properly perform a convolution. + """ + def __init__(self): + gr.sync_block.__init__( + self, + name = "convolve", + in_sig = [numpy.float32], + out_sig = [numpy.float32] + ) + self._taps = [1, 0, 0, 0] + self.set_history(len(self._taps)) + + def work(self, input_items, output_items): + output_items[0][:] = numpy.convolve(input_items[0], self._taps, mode='valid') + return len(output_items[0]) + +class decim2x(gr.decim_block): + def __init__(self): + gr.decim_block.__init__( + self, + name = "decim2x", + in_sig = [numpy.float32], + out_sig = [numpy.float32], + decim = 2 + ) + + def work(self, input_items, output_items): + output_items[0][:] = input_items[0][::2] + return len(output_items[0]) + +class interp2x(gr.interp_block): + def __init__(self): + gr.interp_block.__init__( + self, + name = "interp2x", + in_sig = [numpy.float32], + out_sig = [numpy.float32], + interp = 2 + ) + + def work(self, input_items, output_items): + output_items[0][1::2] = input_items[0] + output_items[0][::2] = input_items[0] + return len(output_items[0]) + +class tag_source(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "tag source", + in_sig = None, + out_sig = [numpy.float32], + ) + + def work(self, input_items, output_items): + num_output_items = len(output_items[0]) + + #put code here to fill the output items... + + #make a new tag on the middle element every time work is called + count = self.nitems_written(0) + num_output_items/2 + key = pmt.pmt_string_to_symbol("example_key") + value = pmt.pmt_string_to_symbol("example_value") + self.add_item_tag(0, count, key, value) + + return num_output_items + +class tag_sink(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "tag sink", + in_sig = [numpy.float32], + out_sig = None, + ) + self.key = None + + def work(self, input_items, output_items): + num_input_items = len(input_items[0]) + + #put code here to process the input items... + + #print all the tags received in this work call + nread = self.nitems_read(0) + tags = self.get_tags_in_range(0, nread, nread+num_input_items) + for tag in tags: + print tag.offset + print pmt.pmt_symbol_to_string(tag.key) + print pmt.pmt_symbol_to_string(tag.value) + self.key = pmt.pmt_symbol_to_string(tag.key) + + return num_input_items + +class fc32_to_f32_2(gr.sync_block): + def __init__(self): + gr.sync_block.__init__( + self, + name = "fc32_to_f32_2", + in_sig = [numpy.complex64], + out_sig = [(numpy.float32, 2)], + ) + + def work(self, input_items, output_items): + output_items[0][::,0] = numpy.real(input_items[0]) + output_items[0][::,1] = numpy.imag(input_items[0]) + return len(output_items[0]) + +class test_block_gateway(gr_unittest.TestCase): + + def test_add_f32(self): + tb = gr.top_block() + src0 = gr.vector_source_f([1, 3, 5, 7, 9], False) + src1 = gr.vector_source_f([0, 2, 4, 6, 8], False) + adder = add_2_f32_1_f32() + sink = gr.vector_sink_f() + tb.connect((src0, 0), (adder, 0)) + tb.connect((src1, 0), (adder, 1)) + tb.connect(adder, sink) + tb.run() + self.assertEqual(sink.data(), (1, 5, 9, 13, 17)) + + def test_add_fc32(self): + tb = gr.top_block() + src0 = gr.vector_source_c([1, 3j, 5, 7j, 9], False) + src1 = gr.vector_source_c([0, 2j, 4, 6j, 8], False) + adder = add_2_fc32_1_fc32() + sink = gr.vector_sink_c() + tb.connect((src0, 0), (adder, 0)) + tb.connect((src1, 0), (adder, 1)) + tb.connect(adder, sink) + tb.run() + self.assertEqual(sink.data(), (1, 5j, 9, 13j, 17)) + + def test_convolve(self): + tb = gr.top_block() + src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) + cv = convolve() + sink = gr.vector_sink_f() + tb.connect(src, cv, sink) + tb.run() + self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8)) + + def test_decim2x(self): + tb = gr.top_block() + src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False) + d2x = decim2x() + sink = gr.vector_sink_f() + tb.connect(src, d2x, sink) + tb.run() + self.assertEqual(sink.data(), (1, 3, 5, 7)) + + def test_interp2x(self): + tb = gr.top_block() + src = gr.vector_source_f([1, 3, 5, 7, 9], False) + i2x = interp2x() + sink = gr.vector_sink_f() + tb.connect(src, i2x, sink) + tb.run() + self.assertEqual(sink.data(), (1, 1, 3, 3, 5, 5, 7, 7, 9, 9)) + + def test_tags(self): + src = tag_source() + sink = tag_sink() + head = gr.head(gr.sizeof_float, 50000) #should be enough items to get a tag through + tb = gr.top_block() + tb.connect(src, head, sink) + tb.run() + self.assertEqual(sink.key, "example_key") + + def test_fc32_to_f32_2(self): + tb = gr.top_block() + src = gr.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False) + convert = fc32_to_f32_2() + v2s = gr.vector_to_stream(gr.sizeof_float, 2) + sink = gr.vector_sink_f() + tb.connect(src, convert, v2s, sink) + tb.run() + self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) + +if __name__ == '__main__': + gr_unittest.run(test_block_gateway, "test_block_gateway.xml") + diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt index dc51f0c90..39dbefa60 100644 --- a/gr-atsc/src/lib/CMakeLists.txt +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -204,6 +204,8 @@ if(ENABLE_PYTHON) include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_ATSC_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt index 4997ca3f7..fab366660 100644 --- a/gr-audio/swig/CMakeLists.txt +++ b/gr-audio/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_AUDIO_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-comedi/src/CMakeLists.txt b/gr-comedi/src/CMakeLists.txt index 1d3d16908..5291e4d90 100644 --- a/gr-comedi/src/CMakeLists.txt +++ b/gr-comedi/src/CMakeLists.txt @@ -67,6 +67,8 @@ if(ENABLE_PYTHON) include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_COMEDI_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 0c129e181..df5f04148 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -113,7 +113,7 @@ set(GR_SWIG_INCLUDE_DIRS # Setup swig docs to depend on includes and pull in from build directory set(GR_SWIG_LIBRARIES gnuradio-digital) -set(GR_SWIG_TARGET_DEPS digital_generated_includes) +set(GR_SWIG_TARGET_DEPS digital_generated_includes core_swig) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt index f715c4785..73676ae6a 100644 --- a/gr-fcd/swig/CMakeLists.txt +++ b/gr-fcd/swig/CMakeLists.txt @@ -25,6 +25,8 @@ include(GrSwig) #set(GR_SWIG_FLAGS -DGR_HAVE_FCD) #needed to parse fcd_swig.i +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_FCD_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-fft/swig/CMakeLists.txt b/gr-fft/swig/CMakeLists.txt index 7ea41f220..327666985 100644 --- a/gr-fft/swig/CMakeLists.txt +++ b/gr-fft/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_FFT_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-noaa/swig/CMakeLists.txt b/gr-noaa/swig/CMakeLists.txt index a8335062c..a336bf8a4 100644 --- a/gr-noaa/swig/CMakeLists.txt +++ b/gr-noaa/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_NOAA_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-pager/swig/CMakeLists.txt b/gr-pager/swig/CMakeLists.txt index 9a8d9d0d8..0fa8e6ee5 100644 --- a/gr-pager/swig/CMakeLists.txt +++ b/gr-pager/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_PAGER_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt index 9f092f6c6..e84035b9f 100644 --- a/gr-qtgui/swig/CMakeLists.txt +++ b/gr-qtgui/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} ${GR_QTGUI_INCLUDE_DIRS} diff --git a/gr-shd/swig/CMakeLists.txt b/gr-shd/swig/CMakeLists.txt index b61adfcad..878b80c0f 100644 --- a/gr-shd/swig/CMakeLists.txt +++ b/gr-shd/swig/CMakeLists.txt @@ -25,6 +25,8 @@ include(GrSwig) set(GR_SWIG_FLAGS -DGR_HAVE_SHD) #needed to parse shd_swig.i +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_SHD_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt index 9080afa56..8f29f9605 100644 --- a/gr-trellis/src/lib/CMakeLists.txt +++ b/gr-trellis/src/lib/CMakeLists.txt @@ -187,7 +187,7 @@ if(ENABLE_PYTHON) trellis_siso_combined_f.i trellis_constellation_metrics_cf.i ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i - ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i + ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "trellis_swig" ) @@ -198,6 +198,8 @@ if(ENABLE_PYTHON) include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_SOURCE_DEPS ${generated_trellis_includes} ${generated_trellis_swigs} diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 80d80bcb8..b5acabee4 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -60,11 +60,17 @@ class uhd_usrp_source; * * The following tag keys will be produced by the work function: * - pmt::pmt_string_to_symbol("rx_time") + * - pmt::pmt_string_to_symbol("rx_rate") + * - pmt::pmt_string_to_symbol("rx_freq") * * The timstamp tag value is a pmt tuple of the following: * (uint64 seconds, and double fractional seconds). * A timestamp tag is produced at start() and after overflows. * + * The sample rate and center frequency tags are doubles, + * representing the sample rate in Sps and frequency in Hz. + * These tags are produced upon the user changing parameters. + * * See the UHD manual for more detailed documentation: * http://code.ettus.com/redmine/ettus/projects/uhd/wiki * diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 8aa965401..ad4cb4d81 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -24,10 +24,13 @@ #include <stdexcept> #include <iostream> #include <boost/format.hpp> +#include <boost/thread/thread.hpp> #include <boost/make_shared.hpp> #include "gr_uhd_common.h" static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("rx_time"); +static const pmt::pmt_t RATE_KEY = pmt::pmt_string_to_symbol("rx_rate"); +static const pmt::pmt_t FREQ_KEY = pmt::pmt_string_to_symbol("rx_freq"); #include <uhd/convert.hpp> inline gr_io_signature_sptr args_to_io_sig(const uhd::stream_args_t &args){ @@ -88,6 +91,8 @@ public: void set_samp_rate(double rate){ _dev->set_rx_rate(rate); + _samp_rate = this->get_samp_rate(); + _tag_now = true; } double get_samp_rate(void){ @@ -105,7 +110,10 @@ public: uhd::tune_result_t set_center_freq( const uhd::tune_request_t tune_request, size_t chan ){ - return _dev->set_rx_freq(tune_request, chan); + const uhd::tune_result_t res = _dev->set_rx_freq(tune_request, chan); + _center_freq = this->get_center_freq(chan); + _tag_now = true; + return res; } double get_center_freq(size_t chan){ @@ -330,9 +338,10 @@ public: //If receive resulted in a timeout condition: //We now receive a single packet with a large timeout. - if (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ + while (_metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT){ + if (boost::this_thread::interruption_requested()) return WORK_DONE; num_samps = _rx_stream->recv( - output_items, noutput_items, _metadata, 1.0, true/*one pkt*/ + output_items, noutput_items, _metadata, 0.1, true/*one pkt*/ ); } #else @@ -358,9 +367,11 @@ public: pmt::pmt_from_uint64(_metadata.time_spec.get_full_secs()), pmt::pmt_from_double(_metadata.time_spec.get_frac_secs()) ); - //create a timestamp tag for each channel + //create a tag set for each channel for (size_t i = 0; i < _nchan; i++){ this->add_item_tag(i, nitems_written(0), TIME_KEY, val, _id); + this->add_item_tag(i, nitems_written(0), RATE_KEY, pmt::pmt_from_double(_samp_rate), _id); + this->add_item_tag(i, nitems_written(0), FREQ_KEY, pmt::pmt_from_double(_center_freq), _id); } } break; @@ -508,6 +519,10 @@ private: uhd::time_spec_t _start_time; bool _start_time_set; + + //tag shadows + double _samp_rate; + double _center_freq; }; diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt index 26470b3b9..795b46567 100644 --- a/gr-uhd/swig/CMakeLists.txt +++ b/gr-uhd/swig/CMakeLists.txt @@ -25,6 +25,8 @@ include(GrSwig) set(GR_SWIG_FLAGS -DGR_HAVE_UHD) #needed to parse uhd_swig.i +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_UHD_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt index c21c9a9c8..a5c5b8cbd 100644 --- a/gr-video-sdl/src/CMakeLists.txt +++ b/gr-video-sdl/src/CMakeLists.txt @@ -66,6 +66,8 @@ if(ENABLE_PYTHON) include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_COMEDI_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt index aaf09700f..da89370fe 100644 --- a/gr-vocoder/swig/CMakeLists.txt +++ b/gr-vocoder/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_VOCODER_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt index 2c5f433eb..4c78575f8 100644 --- a/gr-wavelet/swig/CMakeLists.txt +++ b/gr-wavelet/swig/CMakeLists.txt @@ -23,6 +23,8 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS core_swig) + set(GR_SWIG_INCLUDE_DIRS ${GR_WAVELET_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} diff --git a/gruel/src/lib/pmt/CMakeLists.txt b/gruel/src/lib/pmt/CMakeLists.txt index 72bd27a04..6ea616e10 100644 --- a/gruel/src/lib/pmt/CMakeLists.txt +++ b/gruel/src/lib/pmt/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -53,6 +53,8 @@ ADD_FILE_DEPENDENCIES( ${PMT_SERIAL_TAGS_H} ) +add_custom_target(pmt_generated DEPENDS ${PMT_SERIAL_TAGS_H}) + ######################################################################## # Generate other pmt stuff ######################################################################## diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt index a0f84c832..332d5866f 100644 --- a/gruel/src/swig/CMakeLists.txt +++ b/gruel/src/swig/CMakeLists.txt @@ -23,6 +23,7 @@ include(GrPython) include(GrSwig) +set(GR_SWIG_TARGET_DEPS pmt_generated) set(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) set(GR_SWIG_LIBRARIES gruel) @@ -43,3 +44,5 @@ install( DESTINATION ${GR_INCLUDE_DIR}/gruel/swig COMPONENT "gruel_swig" ) + +add_custom_target(pmt_swig DEPENDS ${SWIG_MODULE_pmt_swig_REAL_NAME}) diff --git a/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h index 05732b1ea..51b6041ec 100644 --- a/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h +++ b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h @@ -21,7 +21,6 @@ static inline void volk_32fc_s32fc_x2_rotator_32fc_a_generic(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){ - *phase = lv_cmake(1.0, 0.0); unsigned int i = 0; int j = 0; for(i = 0; i < (unsigned int)(num_points/ROTATOR_RELOAD); ++i) { @@ -44,7 +43,6 @@ static inline void volk_32fc_s32fc_x2_rotator_32fc_a_generic(lv_32fc_t* outVecto #include <smmintrin.h> static inline void volk_32fc_s32fc_x2_rotator_32fc_a_sse4_1(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){ - *phase = lv_cmake(1.0, 0.0); lv_32fc_t* cPtr = outVector; const lv_32fc_t* aPtr = inVector; lv_32fc_t incr = 1; @@ -156,7 +154,6 @@ static inline void volk_32fc_s32fc_x2_rotator_32fc_a_sse4_1(lv_32fc_t* outVector static inline void volk_32fc_s32fc_x2_rotator_32fc_a_avx(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){ - *phase = lv_cmake(1.0, 0.0); lv_32fc_t* cPtr = outVector; const lv_32fc_t* aPtr = inVector; lv_32fc_t incr = 1; |