diff options
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/tag_utils.py | 16 | ||||
-rw-r--r-- | gr-analog/lib/agc3_cc_impl.cc | 10 | ||||
-rw-r--r-- | gr-blocks/examples/ctrlport/simple_copy.grc | 100 | ||||
-rw-r--r-- | gr-fft/lib/fft.cc | 28 |
4 files changed, 128 insertions, 26 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py index a7745428c7..0d4805a8b8 100644 --- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py +++ b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py @@ -57,17 +57,17 @@ def python_to_tag(tag_struct): good = True if(tag_struct.has_key('key')): - if(isinstance(tag_struct['key'], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct['key'], pmt.swig_int_ptr)): tag.key = tag_struct['key'] good = True if(tag_struct.has_key('value')): - if(isinstance(tag_struct['value'], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct['value'], pmt.swig_int_ptr)): tag.value = tag_struct['value'] good = True if(tag_struct.has_key('srcid')): - if(isinstance(tag_struct['srcid'], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct['srcid'], pmt.swig_int_ptr)): tag.srcid = tag_struct['srcid'] good = True @@ -77,15 +77,15 @@ def python_to_tag(tag_struct): tag.offset = tag_struct[0] good = True - if(isinstance(tag_struct[1], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct[1], pmt.swig_int_ptr)): tag.key = tag_struct[1] good = True - if(isinstance(tag_struct[2], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct[2], pmt.swig_int_ptr)): tag.value = tag_struct[2] good = True - if(isinstance(tag_struct[3], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct[3], pmt.swig_int_ptr)): tag.srcid = tag_struct[3] good = True @@ -94,11 +94,11 @@ def python_to_tag(tag_struct): tag.offset = tag_struct[0] good = True - if(isinstance(tag_struct[1], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct[1], pmt.swig_int_ptr)): tag.key = tag_struct[1] good = True - if(isinstance(tag_struct[2], pmt.pmt_swig.swig_int_ptr)): + if(isinstance(tag_struct[2], pmt.swig_int_ptr)): tag.value = tag_struct[2] good = True diff --git a/gr-analog/lib/agc3_cc_impl.cc b/gr-analog/lib/agc3_cc_impl.cc index fddefd6710..9d34c7b84d 100644 --- a/gr-analog/lib/agc3_cc_impl.cc +++ b/gr-analog/lib/agc3_cc_impl.cc @@ -79,7 +79,7 @@ namespace gr { #else // Compute a linear average on reset (no expected) if(!d_reset) { - std::vector<float> mags(noutput_items); + _declspec(align(16)) std::vector<float> mags(noutput_items) ; volk_32fc_magnitude_32f(&mags[0], &in[0], noutput_items); #endif float mag(0.0); @@ -104,8 +104,8 @@ namespace gr { else { // Otherwise perform a normal iir update #ifdef _MSC_VER - std::vector<float> mag_sq(noutput_items/d_iir_update_decim); - std::vector<float> inv_mag(noutput_items/d_iir_update_decim); + __declspec(align(16)) std::vector<float> mag_sq(noutput_items/d_iir_update_decim) ; + __declspec(align(16)) std::vector<float> inv_mag(noutput_items/d_iir_update_decim) ; #else float mag_sq[noutput_items/d_iir_update_decim] __attribute__ ((aligned (16))); float inv_mag[noutput_items/d_iir_update_decim] __attribute__ ((aligned (16))); @@ -123,8 +123,8 @@ namespace gr { // apply updates for(int i=0; i<noutput_items/d_iir_update_decim; i++){ float magi = inv_mag[i]; -#ifdef _MSC_VER - if(!_finite(magi)){ +#if defined(_MSC_VER) && _MSC_VER < 1900 + if(!_finite(magi)){ #else if(std::isfinite(magi)){ #endif diff --git a/gr-blocks/examples/ctrlport/simple_copy.grc b/gr-blocks/examples/ctrlport/simple_copy.grc index 6e795d751b..a52c350ded 100644 --- a/gr-blocks/examples/ctrlport/simple_copy.grc +++ b/gr-blocks/examples/ctrlport/simple_copy.grc @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<?grc format='1' created='3.7.9'?> +<?grc format='1' created='3.7.11'?> <flow_graph> <timestamp>Sat Mar 16 22:03:14 2013</timestamp> <block> @@ -41,6 +41,10 @@ <value>qt_gui</value> </param> <param> + <key>hier_block_src_path</key> + <value>.:</value> + </param> + <param> <key>id</key> <value>simple_copy</value> </param> @@ -49,10 +53,18 @@ <value>0</value> </param> <param> + <key>qt_qss_theme</key> + <value></value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> <param> + <key>run_command</key> + <value>{python} -u {filename}</value> + </param> + <param> <key>run_options</key> <value>prompt</value> </param> @@ -381,12 +393,92 @@ to enable/disablethis block</value> </param> </block> <block> + <key>epy_block</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>_io_cache</key> + <value>('Null Msg Source', 'blk', [], [], [('fake_output', 'message', 1)], '', [])</value> + </param> + <param> + <key>_source_code</key> + <value># Block that doesn't do anything, just used to get a msg input port on another block exposed to ControlPort +from gnuradio import gr +import pmt +class blk(gr.basic_block): + def __init__(self): + gr.basic_block.__init__(self,name='Null Msg Source',in_sig=[],out_sig=[]) + self.message_port_register_out(pmt.intern("fake_output")) +</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(357, 218)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>epy_block_0</value> + </param> + </block> + <block> + <key>note</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value>Make sure to turn on ControlPort (edit ~/.gnuradio/config.conf) +and run the following script to toggle Copy block: +cd /src/gnuradio/gr-blocks/examples/ctrlport +python simple_copy_controller.py 127.0.0.1 <PORT> true</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(352, 13)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>note_0</value> + </param> + <param> + <key>note</key> + <value></value> + </param> + </block> + <block> <key>qtgui_time_sink_x</key> <param> <key>autoscale</key> <value>False</value> </param> <param> + <key>axislabels</key> + <value>True</value> + </param> + <param> <key>alias</key> <value></value> </param> @@ -769,4 +861,10 @@ to enable/disablethis block</value> <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>epy_block_0</source_block_id> + <sink_block_id>blocks_copy_0</sink_block_id> + <source_key>fake_output</source_key> + <sink_key>en</sink_key> + </connection> </flow_graph> diff --git a/gr-fft/lib/fft.cc b/gr-fft/lib/fft.cc index ef81583187..3b6d05c383 100644 --- a/gr-fft/lib/fft.cc +++ b/gr-fft/lib/fft.cc @@ -36,6 +36,10 @@ static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); } #define fftw_import_wisdom_from_file(f) fftw_import_wisdom(my_fftw_read_char, (void*) (f)) #define fftwf_import_wisdom_from_file(f) fftwf_import_wisdom(my_fftw_read_char, (void*) (f)) #define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f)) +#include <fcntl.h> +#include <io.h> +#define O_NOCTTY 0 +#define O_NONBLOCK 0 #endif //_MSC_VER #include <stdlib.h> @@ -52,6 +56,7 @@ namespace fs = boost::filesystem; namespace gr { namespace fft { static boost::mutex wisdom_thread_mutex; + boost::interprocess::file_lock wisdom_lock; gr_complex * malloc_complex(int size) @@ -96,23 +101,13 @@ namespace gr { static void lock_wisdom() { - const std::string wisdom_lock_file = wisdom_filename() + ".lock"; - int fd = open(wisdom_lock_file.c_str(), - O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, - 0666); - if (fd < 0){ - throw std::exception(); - } - boost::interprocess::file_lock wisdom_lock(wisdom_lock_file.c_str()); - wisdom_lock.lock(); - wisdom_thread_mutex.lock(); + wisdom_thread_mutex.lock(); + wisdom_lock.lock(); } static void unlock_wisdom() { - const std::string wisdom_lock_file = wisdom_filename() + ".lock"; - boost::interprocess::file_lock wisdom_lock(wisdom_lock_file.c_str()); wisdom_lock.unlock(); wisdom_thread_mutex.unlock(); } @@ -168,6 +163,15 @@ namespace gr { { // Hold global mutex during plan construction and destruction. planner::scoped_lock lock(planner::mutex()); + const std::string wisdom_lock_file = wisdom_filename() + ".lock"; + int fd = open(wisdom_lock_file.c_str(), + O_WRONLY | O_CREAT | O_NOCTTY | O_NONBLOCK, + 0666); + if (fd < 0) { + throw std::exception(); + } + close(fd); + wisdom_lock = boost::interprocess::file_lock(wisdom_lock_file.c_str()); assert (sizeof (fftwf_complex) == sizeof (gr_complex)); |