diff options
28 files changed, 3361 insertions, 800 deletions
diff --git a/configure.ac b/configure.ac index fbb8bb52e..3ba5bb387 100644 --- a/configure.ac +++ b/configure.ac @@ -338,7 +338,7 @@ GRC_USRP2 GRC_VRT GRC_GR_USRP dnl this must come after GRC_USRP GRC_GR_USRP2 -GRC_GR_VRT +dnl GRC_GR_VRT GRC_GR_GCELL dnl this must come after GRC_GCELL and GRC_GNURADIO_CORE GRC_GR_MSDD6000 GRC_GR_AUDIO_ALSA diff --git a/gr-gpio/src/python/gpio_usrp_fft.py b/gr-gpio/src/python/gpio_usrp_fft.py index 40b1c54d4..c9ecb032d 100755 --- a/gr-gpio/src/python/gpio_usrp_fft.py +++ b/gr-gpio/src/python/gpio_usrp_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -279,7 +279,7 @@ class app_top_block(stdgui2.std_top_block): self.myform['baseband'].set_value(r.baseband_freq) self.myform['ddc'].set_value(r.dxc_freq) if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.set_baseband_freq(target_freq) + self.scope.set_baseband_freq(target_freq) return True return False diff --git a/gr-msdd6000/src/Makefile.am b/gr-msdd6000/src/Makefile.am index 9ae4efb0a..7744395f3 100644 --- a/gr-msdd6000/src/Makefile.am +++ b/gr-msdd6000/src/Makefile.am @@ -70,7 +70,7 @@ TOP_SWIG_IFILES = \ msdd_pythondir_category = \ gnuradio -msdd_rs_pythondir_category = \ +msdd_rs_pythondir_category = \ gnuradio # additional libraries for linking with the SWIG-generated library diff --git a/gr-msdd6000/src/python-examples/new_msdd_fft.py b/gr-msdd6000/src/python-examples/new_msdd_fft.py index 0b31a00d9..782ecb66e 100755 --- a/gr-msdd6000/src/python-examples/new_msdd_fft.py +++ b/gr-msdd6000/src/python-examples/new_msdd_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -245,7 +245,7 @@ class app_top_block(stdgui2.std_top_block): # self.myform['baseband'].set_value(r.baseband_freq) # self.myform['ddc'].set_value(r.dxc_freq) if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.set_baseband_freq(target_freq) + self.scope.set_baseband_freq(target_freq) return True return False diff --git a/gr-noaa/apps/Makefile.am b/gr-noaa/apps/Makefile.am index e246ba76a..8fb6fbef8 100644 --- a/gr-noaa/apps/Makefile.am +++ b/gr-noaa/apps/Makefile.am @@ -27,6 +27,7 @@ dist_bin_SCRIPTS = \ hrpt_decode.py \ hrpt_demod.py \ file_rx_hrpt.py \ + file_rx_lrit.py \ usrp_rx_hrpt.py \ usrp_rx_hrpt_nogui.py \ usrp_rx_lrit.py @@ -35,6 +36,7 @@ EXTRA_DIST = \ hrpt_decode.grc \ hrpt_demod.grc \ file_rx_hrpt.grc \ + file_rx_lrit.grc \ usrp_rx_hrpt.grc \ usrp_rx_hrpt_nogui.grc \ usrp_rx_lrit.grc diff --git a/gr-noaa/apps/file_rx_lrit.grc b/gr-noaa/apps/file_rx_lrit.grc new file mode 100644 index 000000000..ee6da2a31 --- /dev/null +++ b/gr-noaa/apps/file_rx_lrit.grc @@ -0,0 +1,1372 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Wed Dec 16 09:14:28 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>file_rx_lrit</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>LRIT Receiver (from capture file)</value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>4095, 4095</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>symbol_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>293e3</value> + </param> + <param> + <key>_coordinate</key> + <value>(347, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>sample_rate/symbol_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(445, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>config_filename</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> + </param> + <param> + <key>_coordinate</key> + <value>(11, 136)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>import</key> + <param> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import os</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 82)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sample_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>64e6/decim</value> + </param> + <param> + <key>_coordinate</key> + <value>(249, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>rx_spectrum</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Baseband Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>5</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>50</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 0</value> + </param> + <param> + <key>_coordinate</key> + <value>(267, 556)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_file_source</key> + <param> + <key>id</key> + <value>gr_file_source_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>file</key> + <value>lrit.dat</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>repeat</key> + <value>False</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(79, 729)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samples_per_second</key> + <value>sample_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(60, 824)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>rx_waveform</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Baseband Waveform</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>20.0/sample_rate</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 0</value> + </param> + <param> + <key>_coordinate</key> + <value>(267, 915)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>gain_mu</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Gain Mu</value> + </param> + <param> + <key>value</key> + <value>saved_gain_mu</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>0.5</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 1, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(478, 91)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>costas_spectrum</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>PLL Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>-15</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>window.hanning</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 2</value> + </param> + <param> + <key>_coordinate</key> + <value>(916, 535)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_clock_recovery_mm_xx</key> + <param> + <key>id</key> + <value>gr_clock_recovery_mm_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>omega</key> + <value>sps</value> + </param> + <param> + <key>gain_omega</key> + <value>(gain_mu**2)/4.0</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>gain_mu</key> + <value>gain_mu</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>50e-6</value> + </param> + <param> + <key>_coordinate</key> + <value>(915, 789)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>costas_spectrum_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Bit Sync Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>symbol_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>-15</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>window.hanning</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 3</value> + </param> + <param> + <key>_coordinate</key> + <value>(1160, 539)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>notebook</key> + <param> + <key>id</key> + <value>displays</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>style</key> + <value>wx.NB_TOP</value> + </param> + <param> + <key>labels</key> + <value>['USRP RX', 'RRC Filter', 'PLL', 'MM']</value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 2</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(15, 206)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>costas_alpha</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Costas Alpha</value> + </param> + <param> + <key>value</key> + <value>saved_costas_alpha</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>0.5</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(338, 90)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>costas_waveform</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>PLL Waveform</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>20.0/sample_rate</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 2</value> + </param> + <param> + <key>_coordinate</key> + <value>(915, 928)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>mm_waveform</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Constellation</value> + </param> + <param> + <key>samp_rate</key> + <value>symbol_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>20.0/symbol_rate</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 3</value> + </param> + <param> + <key>_coordinate</key> + <value>(1160, 922)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_costas_alpha</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>0.2</value> + </param> + <param> + <key>type</key> + <value>real</value> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp_rx_lrit'</value> + </param> + <param> + <key>option</key> + <value>'costas_alpha'</value> + </param> + <param> + <key>writeback</key> + <value>costas_alpha</value> + </param> + <param> + <key>_coordinate</key> + <value>(251, 244)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_gain_mu</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>0.2</value> + </param> + <param> + <key>type</key> + <value>real</value> + </param> + <param> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp_rx_lrit'</value> + </param> + <param> + <key>option</key> + <value>'gain_mu'</value> + </param> + <param> + <key>writeback</key> + <value>gain_mu</value> + </param> + <param> + <key>_coordinate</key> + <value>(411, 242)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>parameter</key> + <param> + <key>id</key> + <value>decim</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Decim</value> + </param> + <param> + <key>value</key> + <value>160</value> + </param> + <param> + <key>type</key> + <value>intx</value> + </param> + <param> + <key>short_id</key> + <value>d</value> + </param> + <param> + <key>_coordinate</key> + <value>(249, 90)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>rrc_spectrum</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>RRC Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>-15</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>True</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>window.hanning</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> + </param> + <param> + <key>_coordinate</key> + <value>(705, 534)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_agc_xx</key> + <param> + <key>id</key> + <value>gr_agc_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>rate</key> + <value>1e-6</value> + </param> + <param> + <key>reference</key> + <value>1.0</value> + </param> + <param> + <key>gain</key> + <value>1.0/32767.0</value> + </param> + <param> + <key>max_gain</key> + <value>1.0</value> + </param> + <param> + <key>_coordinate</key> + <value>(273, 800)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>rx_waveform_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>RRC Waveform</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>20.0/sample_rate</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> + </param> + <param> + <key>_coordinate</key> + <value>(706, 927)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_costas_loop_cc</key> + <param> + <key>id</key> + <value>costas</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>alpha</key> + <value>costas_alpha</value> + </param> + <param> + <key>beta</key> + <value>(costas_alpha**2)/4.0</value> + </param> + <param> + <key>max_freq</key> + <value>50e-6*sps</value> + </param> + <param> + <key>min_freq</key> + <value>-50e-6*sps</value> + </param> + <param> + <key>order</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(706, 792)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>root_raised_cosine_filter</key> + <param> + <key>id</key> + <value>rrc</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>fir_filter_ccf</value> + </param> + <param> + <key>decim</key> + <value>1</value> + </param> + <param> + <key>interp</key> + <value>1</value> + </param> + <param> + <key>gain</key> + <value>1</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>sym_rate</key> + <value>symbol_rate</value> + </param> + <param> + <key>alpha</key> + <value>0.25</value> + </param> + <param> + <key>ntaps</key> + <value>int(11*sample_rate/symbol_rate)</value> + </param> + <param> + <key>_coordinate</key> + <value>(448, 784)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>rrc</source_block_id> + <sink_block_id>rx_waveform_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>rrc</source_block_id> + <sink_block_id>rrc_spectrum</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_agc_xx_0</source_block_id> + <sink_block_id>rrc</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>rx_waveform</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>rx_spectrum</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_agc_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_file_source_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>rrc</source_block_id> + <sink_block_id>costas</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>costas</source_block_id> + <sink_block_id>costas_spectrum</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>costas</source_block_id> + <sink_block_id>costas_waveform</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>costas</source_block_id> + <sink_block_id>gr_clock_recovery_mm_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>costas_spectrum_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_clock_recovery_mm_xx_0</source_block_id> + <sink_block_id>mm_waveform</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-noaa/apps/file_rx_lrit.py b/gr-noaa/apps/file_rx_lrit.py new file mode 100755 index 000000000..9a50631f7 --- /dev/null +++ b/gr-noaa/apps/file_rx_lrit.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: LRIT Receiver (from capture file) +# Generated: Wed Dec 16 09:16:13 2009 +################################################## + +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio import window +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from gnuradio.wxgui import fftsink2 +from gnuradio.wxgui import forms +from gnuradio.wxgui import scopesink2 +from grc_gnuradio import wxgui as grc_wxgui +from optparse import OptionParser +import ConfigParser +import os +import wx + +class file_rx_lrit(grc_wxgui.top_block_gui): + + def __init__(self, decim=160): + grc_wxgui.top_block_gui.__init__(self, title="LRIT Receiver (from capture file)") + + ################################################## + # Parameters + ################################################## + self.decim = decim + + ################################################## + # Variables + ################################################## + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' + self.symbol_rate = symbol_rate = 293e3 + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(config_filename) + try: saved_gain_mu = self._saved_gain_mu_config.getfloat('usrp_rx_lrit', 'gain_mu') + except: saved_gain_mu = 0.2 + self.saved_gain_mu = saved_gain_mu + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(config_filename) + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat('usrp_rx_lrit', 'costas_alpha') + except: saved_costas_alpha = 0.2 + self.saved_costas_alpha = saved_costas_alpha + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/symbol_rate + self.gain_mu = gain_mu = saved_gain_mu + self.costas_alpha = costas_alpha = saved_costas_alpha + + ################################################## + # Notebooks + ################################################## + self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) + self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RRC Filter") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "MM") + self.GridAdd(self.displays, 1, 0, 1, 2) + + ################################################## + # Controls + ################################################## + _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) + self._gain_mu_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + label="Gain Mu", + converter=forms.float_converter(), + proportion=0, + ) + self._gain_mu_slider = forms.slider( + parent=self.GetWin(), + sizer=_gain_mu_sizer, + value=self.gain_mu, + callback=self.set_gain_mu, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_gain_mu_sizer, 0, 1, 1, 1) + _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) + self._costas_alpha_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + label="Costas Alpha", + converter=forms.float_converter(), + proportion=0, + ) + self._costas_alpha_slider = forms.slider( + parent=self.GetWin(), + sizer=_costas_alpha_sizer, + value=self.costas_alpha, + callback=self.set_costas_alpha, + minimum=0, + maximum=0.5, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_costas_alpha_sizer, 0, 0, 1, 1) + + ################################################## + # Blocks + ################################################## + self.costas = gr.costas_loop_cc(costas_alpha, (costas_alpha**2)/4.0, 50e-6*sps, -50e-6*sps, 2) + self.costas_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(2).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="PLL Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(2).GridAdd(self.costas_spectrum.win, 0, 0, 1, 1) + self.costas_spectrum_0 = fftsink2.fft_sink_c( + self.displays.GetPage(3).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=symbol_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="Bit Sync Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(3).GridAdd(self.costas_spectrum_0.win, 0, 0, 1, 1) + self.costas_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="PLL Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.costas_waveform.win, 1, 0, 1, 1) + self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) + self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_cc(sps, (gain_mu**2)/4.0, 0.5, gain_mu, 50e-6) + self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) + self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, sample_rate) + self.mm_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(3).GetWin(), + title="Constellation", + sample_rate=symbol_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/symbol_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, + ) + self.displays.GetPage(3).GridAdd(self.mm_waveform.win, 1, 0, 1, 1) + self.rrc = gr.fir_filter_ccf(1, firdes.root_raised_cosine( + 1, sample_rate, symbol_rate, 0.25, int(11*sample_rate/symbol_rate))) + self.rrc_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(1).GetWin(), + baseband_freq=0, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=True, + avg_alpha=None, + title="RRC Spectrum", + peak_hold=False, + win=window.hanning, + ) + self.displays.GetPage(1).GridAdd(self.rrc_spectrum.win, 0, 0, 1, 1) + self.rx_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=0, + y_per_div=5, + y_divs=10, + ref_level=50, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, + average=True, + avg_alpha=None, + title="Baseband Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_spectrum.win, 0, 0, 1, 1) + self.rx_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="Baseband Waveform", + sample_rate=sample_rate, + v_scale=0, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(0).GridAdd(self.rx_waveform.win, 1, 0, 1, 1) + self.rx_waveform_0 = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="RRC Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(1).GridAdd(self.rx_waveform_0.win, 1, 0, 1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.rrc, 0), (self.rx_waveform_0, 0)) + self.connect((self.rrc, 0), (self.rrc_spectrum, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.rrc, 0)) + self.connect((self.gr_throttle_0, 0), (self.rx_waveform, 0)) + self.connect((self.gr_throttle_0, 0), (self.rx_spectrum, 0)) + self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) + self.connect((self.rrc, 0), (self.costas, 0)) + self.connect((self.costas, 0), (self.costas_spectrum, 0)) + self.connect((self.costas, 0), (self.costas_waveform, 0)) + self.connect((self.costas, 0), (self.gr_clock_recovery_mm_xx_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.costas_spectrum_0, 0)) + self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.mm_waveform, 0)) + + def set_decim(self, decim): + self.decim = decim + self.set_sample_rate(64e6/self.decim) + + def set_config_filename(self, config_filename): + self.config_filename = config_filename + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_symbol_rate(self, symbol_rate): + self.symbol_rate = symbol_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.costas_spectrum_0.set_sample_rate(self.symbol_rate) + self.mm_waveform.set_sample_rate(self.symbol_rate) + self.rrc.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + + def set_saved_gain_mu(self, saved_gain_mu): + self.saved_gain_mu = saved_gain_mu + self.set_gain_mu(self.saved_gain_mu) + + def set_saved_costas_alpha(self, saved_costas_alpha): + self.saved_costas_alpha = saved_costas_alpha + self.set_costas_alpha(self.saved_costas_alpha) + + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.rx_spectrum.set_sample_rate(self.sample_rate) + self.rx_waveform.set_sample_rate(self.sample_rate) + self.costas_spectrum.set_sample_rate(self.sample_rate) + self.costas_waveform.set_sample_rate(self.sample_rate) + self.rrc_spectrum.set_sample_rate(self.sample_rate) + self.rx_waveform_0.set_sample_rate(self.sample_rate) + self.rrc.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + + def set_sps(self, sps): + self.sps = sps + self.gr_clock_recovery_mm_xx_0.set_omega(self.sps) + + def set_gain_mu(self, gain_mu): + self.gain_mu = gain_mu + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) + self.gr_clock_recovery_mm_xx_0.set_gain_omega((self.gain_mu**2)/4.0) + self.gr_clock_recovery_mm_xx_0.set_gain_mu(self.gain_mu) + self._saved_gain_mu_config = ConfigParser.ConfigParser() + self._saved_gain_mu_config.read(self.config_filename) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) + self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + + def set_costas_alpha(self, costas_alpha): + self.costas_alpha = costas_alpha + self._costas_alpha_slider.set_value(self.costas_alpha) + self._costas_alpha_text_box.set_value(self.costas_alpha) + self._saved_costas_alpha_config = ConfigParser.ConfigParser() + self._saved_costas_alpha_config.read(self.config_filename) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) + self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self.costas.set_alpha(self.costas_alpha) + self.costas.set_beta((self.costas_alpha**2)/4.0) + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-d", "--decim", dest="decim", type="intx", default=160, + help="Set Decim [default=%default]") + (options, args) = parser.parse_args() + tb = file_rx_lrit(decim=options.decim) + tb.Run(True) + diff --git a/gr-noaa/apps/usrp_rx_lrit.grc b/gr-noaa/apps/usrp_rx_lrit.grc index 55fe39787..aca10039a 100644 --- a/gr-noaa/apps/usrp_rx_lrit.grc +++ b/gr-noaa/apps/usrp_rx_lrit.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Aug 29 11:26:03 2009</timestamp> + <timestamp>Wed Dec 16 09:47:16 2009</timestamp> <block> <key>options</key> <param> @@ -36,6 +36,10 @@ <value>Custom</value> </param> <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> <key>run</key> <value>True</value> </param> @@ -56,7 +60,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>sample_rate</value> </param> <param> <key>_enabled</key> @@ -68,7 +72,7 @@ </param> <param> <key>_coordinate</key> - <value>(10, 81)</value> + <value>(245, 9)</value> </param> <param> <key>_rotation</key> @@ -91,7 +95,7 @@ </param> <param> <key>_coordinate</key> - <value>(11, 148)</value> + <value>(351, 9)</value> </param> <param> <key>_rotation</key> @@ -110,11 +114,57 @@ </param> <param> <key>value</key> - <value>samp_rate/symbol_rate</value> + <value>sample_rate/symbol_rate</value> + </param> + <param> + <key>_coordinate</key> + <value>(456, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>import</key> + <param> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import os</value> + </param> + <param> + <key>_coordinate</key> + <value>(9, 83)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>config_filename</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>os.environ['HOME']+'/.gnuradio/config.conf'</value> </param> <param> <key>_coordinate</key> - <value>(12, 214)</value> + <value>(10, 142)</value> </param> <param> <key>_rotation</key> @@ -125,7 +175,7 @@ <key>variable_text_box</key> <param> <key>id</key> - <value>decim</value> + <value>freq</value> </param> <param> <key>_enabled</key> @@ -133,15 +183,15 @@ </param> <param> <key>label</key> - <value>Decim</value> + <value>Frequency</value> </param> <param> <key>value</key> - <value>saved_decim</value> + <value>saved_freq</value> </param> <param> <key>converver</key> - <value>int_converter</value> + <value>float_converter</value> </param> <param> <key>formatter</key> @@ -157,7 +207,7 @@ </param> <param> <key>_coordinate</key> - <value>(243, 13)</value> + <value>(247, 149)</value> </param> <param> <key>_rotation</key> @@ -165,58 +215,85 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>variable_config</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>saved_freq</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>value</key> + <value>1691e6</value> + </param> + <param> <key>type</key> - <value>complex</value> + <value>real</value> </param> <param> - <key>title</key> - <value>Waveform</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>section</key> + <value>'usrp_rx_lrit'</value> </param> <param> - <key>v_scale</key> - <value>0.5</value> + <key>option</key> + <value>'freq'</value> </param> <param> - <key>t_scale</key> - <value>20.0/samp_rate</value> + <key>writeback</key> + <value>freq</value> </param> <param> - <key>ac_couple</key> - <value>False</value> + <key>_coordinate</key> + <value>(246, 299)</value> </param> <param> - <key>xy_mode</key> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_offset</value> + </param> + <param> + <key>_enabled</key> <value>True</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>value</key> + <value>0</value> </param> <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> + <key>type</key> + <value>real</value> </param> <param> - <key>notebook</key> - <value>displays, 0</value> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp_rx_lrit'</value> + </param> + <param> + <key>option</key> + <value>'offset'</value> + </param> + <param> + <key>writeback</key> + <value>offset</value> </param> <param> <key>_coordinate</key> - <value>(434, 551)</value> + <value>(406, 300)</value> </param> <param> <key>_rotation</key> @@ -224,38 +301,54 @@ </param> </block> <block> - <key>gr_agc_xx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_agc_xx_0</value> + <value>offset</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value>Offset</value> </param> <param> - <key>rate</key> - <value>1e-6</value> + <key>value</key> + <value>saved_offset</value> </param> <param> - <key>reference</key> - <value>1.0</value> + <key>min</key> + <value>-50e3</value> </param> <param> - <key>gain</key> - <value>1.0/32767.0</value> + <key>max</key> + <value>50e3</value> </param> <param> - <key>max_gain</key> - <value>1.0</value> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 1, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(261, 493)</value> + <value>(390, 149)</value> </param> <param> <key>_rotation</key> @@ -263,50 +356,54 @@ </param> </block> <block> - <key>root_raised_cosine_filter</key> + <key>variable_slider</key> <param> <key>id</key> - <value>root_raised_cosine_filter_0</value> + <value>costas_alpha</value> </param> <param> <key>_enabled</key> - <value>False</value> + <value>True</value> </param> <param> - <key>type</key> - <value>fir_filter_ccf</value> + <key>label</key> + <value>Costas Alpha</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>value</key> + <value>saved_costas_alpha</value> </param> <param> - <key>interp</key> - <value>1</value> + <key>min</key> + <value>0</value> </param> <param> - <key>gain</key> - <value>1</value> + <key>max</key> + <value>0.5</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>sym_rate</key> - <value>symbol_rate</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>alpha</key> - <value>0.5</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>ntaps</key> - <value>50</value> + <key>grid_pos</key> + <value>1, 1, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(618, 373)</value> + <value>(813, 152)</value> </param> <param> <key>_rotation</key> @@ -314,58 +411,54 @@ </param> </block> <block> - <key>usrp_simple_source_x</key> + <key>variable_slider</key> <param> <key>id</key> - <value>usrp_simple_source_x_0</value> + <value>gain_mu</value> </param> <param> <key>_enabled</key> - <value>False</value> + <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value>Gain Mu</value> </param> <param> - <key>format</key> - <value></value> + <key>value</key> + <value>saved_gain_mu</value> </param> <param> - <key>which</key> + <key>min</key> <value>0</value> </param> <param> - <key>decimation</key> - <value>decim</value> - </param> - <param> - <key>frequency</key> - <value>freq</value> + <key>max</key> + <value>0.5</value> </param> <param> - <key>lo_offset</key> - <value>float('inf')</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>gain</key> - <value>gain</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>side</key> - <value>B</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>rx_ant</key> - <value>RXA</value> + <key>grid_pos</key> + <value>1, 2, 1, 1</value> </param> <param> - <key>hb_filters</key> + <key>notebook</key> <value></value> </param> <param> <key>_coordinate</key> - <value>(11, 477)</value> + <value>(957, 151)</value> </param> <param> <key>_rotation</key> @@ -373,74 +466,85 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>variable_config</key> <param> <key>id</key> - <value>wxgui_fftsink2_0</value> + <value>saved_gain</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>value</key> + <value>33</value> + </param> + <param> <key>type</key> - <value>complex</value> + <value>real</value> </param> <param> - <key>title</key> - <value>Spectrum</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>section</key> + <value>'usrp_rx_lrit'</value> </param> <param> - <key>baseband_freq</key> - <value>freq</value> + <key>option</key> + <value>'gain'</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>writeback</key> + <value>gain</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>_coordinate</key> + <value>(565, 300)</value> </param> <param> - <key>ref_level</key> - <value>50</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable_config</key> <param> - <key>fft_size</key> - <value>1024</value> + <key>id</key> + <value>saved_decim</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>value</key> + <value>160</value> </param> <param> - <key>average</key> - <value>False</value> + <key>type</key> + <value>int</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>section</key> + <value>'usrp_rx_lrit'</value> </param> <param> - <key>notebook</key> - <value>displays, 0</value> + <key>option</key> + <value>'decim'</value> + </param> + <param> + <key>writeback</key> + <value>decim</value> </param> <param> <key>_coordinate</key> - <value>(434, 337)</value> + <value>(725, 300)</value> </param> <param> <key>_rotation</key> @@ -448,30 +552,42 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>variable_text_box</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>decim</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value>Decim</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>value</key> + <value>saved_decim</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>converver</key> + <value>int_converter</value> + </param> + <param> + <key>formatter</key> + <value>None</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 2, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(181, 663)</value> + <value>(672, 151)</value> </param> <param> <key>_rotation</key> @@ -479,58 +595,85 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>variable_config</key> <param> <key>id</key> - <value>wxgui_scopesink2_1</value> + <value>saved_costas_alpha</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>value</key> + <value>0.005</value> + </param> + <param> <key>type</key> - <value>complex</value> + <value>real</value> </param> <param> - <key>title</key> - <value>Scope Plot</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>section</key> + <value>'usrp_rx_lrit'</value> </param> <param> - <key>v_scale</key> - <value>0.4</value> + <key>option</key> + <value>'costas_alpha'</value> </param> <param> - <key>t_scale</key> - <value>20.0/samp_rate</value> + <key>writeback</key> + <value>costas_alpha</value> </param> <param> - <key>ac_couple</key> - <value>False</value> + <key>_coordinate</key> + <value>(885, 298)</value> </param> <param> - <key>xy_mode</key> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_config</key> + <param> + <key>id</key> + <value>saved_gain_mu</value> + </param> + <param> + <key>_enabled</key> <value>True</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>value</key> + <value>0.005</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>type</key> + <value>real</value> </param> <param> - <key>notebook</key> - <value>displays, 1</value> + <key>config_file</key> + <value>config_filename</value> + </param> + <param> + <key>section</key> + <value>'usrp_rx_lrit'</value> + </param> + <param> + <key>option</key> + <value>'gain_mu'</value> + </param> + <param> + <key>writeback</key> + <value>gain_mu</value> </param> <param> <key>_coordinate</key> - <value>(1126, 251)</value> + <value>(1046, 298)</value> </param> <param> <key>_rotation</key> @@ -538,30 +681,42 @@ </param> </block> <block> - <key>gr_probe_mpsk_snr_c</key> + <key>variable_config</key> <param> <key>id</key> - <value>gr_probe_mpsk_snr_c_0</value> + <value>side</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>value</key> + <value>'A'</value> + </param> + <param> <key>type</key> - <value>snr</value> + <value>string</value> </param> <param> - <key>alpha</key> - <value>0.0001</value> + <key>config_file</key> + <value>config_filename</value> </param> <param> - <key>probe_rate</key> - <value>10</value> + <key>section</key> + <value>'usrp_rx_lrit'</value> + </param> + <param> + <key>option</key> + <value>'side'</value> + </param> + <param> + <key>writeback</key> + <value>side</value> </param> <param> <key>_coordinate</key> - <value>(1126, 723)</value> + <value>(1102, 152)</value> </param> <param> <key>_rotation</key> @@ -569,10 +724,10 @@ </param> </block> <block> - <key>wxgui_numbersink2</key> + <key>gr_agc_xx</key> <param> <key>id</key> - <value>wxgui_numbersink2_0</value> + <value>gr_agc_xx_0</value> </param> <param> <key>_enabled</key> @@ -580,71 +735,94 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>title</key> - <value>SNR</value> + <key>rate</key> + <value>1e-6</value> + </param> + <param> + <key>reference</key> + <value>1.0</value> </param> <param> - <key>units</key> - <value>dB</value> + <key>gain</key> + <value>1.0/32767.0</value> </param> <param> - <key>samp_rate</key> - <value>10</value> + <key>max_gain</key> + <value>1.0</value> </param> <param> - <key>min_value</key> + <key>_coordinate</key> + <value>(286, 729)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>wxgui_scopesink2</key> <param> - <key>max_value</key> - <value>30</value> + <key>id</key> + <value>rx_waveform</value> </param> <param> - <key>factor</key> - <value>1.0</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>decimal_places</key> - <value>1</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>ref_level</key> + <key>title</key> + <value>RX Waveform</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> <value>0</value> </param> <param> - <key>number_rate</key> - <value>10</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>peak_hold</key> + <key>t_scale</key> + <value>20.0/sample_rate</value> + </param> + <param> + <key>ac_couple</key> <value>False</value> </param> <param> - <key>average</key> + <key>xy_mode</key> <value>False</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>show_gauge</key> - <value>True</value> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> - <value>2, 0, 1, 1</value> + <value>1, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value>displays, 1</value> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(1335, 651)</value> + <value>(281, 862)</value> </param> <param> <key>_rotation</key> @@ -652,62 +830,86 @@ </param> </block> <block> - <key>gr_mpsk_receiver_cc</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>gr_mpsk_receiver_cc_0</value> + <value>rx_spectrum</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>M</key> - <value>2</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>theta</key> - <value>0</value> + <key>title</key> + <value>RX Spectrum</value> </param> <param> - <key>alpha</key> - <value>costas_alpha</value> + <key>samp_rate</key> + <value>sample_rate</value> </param> <param> - <key>beta</key> - <value>costas_alpha*costas_alpha/4.0</value> + <key>baseband_freq</key> + <value>freq</value> </param> <param> - <key>fmin</key> - <value>-0.05</value> + <key>y_per_div</key> + <value>10</value> </param> <param> - <key>fmax</key> - <value>0.05</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>mu</key> - <value>0.5</value> + <key>ref_level</key> + <value>50</value> </param> <param> - <key>gain_mu</key> - <value>gain_mu</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>omega</key> - <value>sps</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>gain_omega</key> - <value>gain_mu*gain_mu/4.0</value> + <key>fft_rate</key> + <value>30</value> </param> <param> - <key>omega_relative_limit</key> - <value>0.05</value> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 0</value> </param> <param> <key>_coordinate</key> - <value>(881, 437)</value> + <value>(280, 468)</value> </param> <param> <key>_rotation</key> @@ -715,22 +917,50 @@ </param> </block> <block> - <key>gr_complex_to_real</key> + <key>root_raised_cosine_filter</key> <param> <key>id</key> - <value>gr_complex_to_real_0</value> + <value>root_raised_cosine_filter_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>vlen</key> + <key>type</key> + <value>fir_filter_ccf</value> + </param> + <param> + <key>decim</key> <value>1</value> </param> <param> + <key>interp</key> + <value>1</value> + </param> + <param> + <key>gain</key> + <value>1</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>sym_rate</key> + <value>symbol_rate</value> + </param> + <param> + <key>alpha</key> + <value>0.25</value> + </param> + <param> + <key>ntaps</key> + <value>int(11*sample_rate/symbol_rate)</value> + </param> + <param> <key>_coordinate</key> - <value>(1133, 521)</value> + <value>(472, 713)</value> </param> <param> <key>_rotation</key> @@ -738,37 +968,66 @@ </param> </block> <block> - <key>gr_char_to_float</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_char_to_float_0</value> + <value>rrc_waveform</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1523, 521)</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>_rotation</key> + <key>title</key> + <value>RRC Waveform</value> + </param> + <param> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> <value>0</value> </param> - </block> - <block> - <key>gr_binary_slicer_fb</key> <param> - <key>id</key> - <value>gr_binary_slicer_fb_0</value> + <key>t_scale</key> + <value>20.0/sample_rate</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(1343, 521)</value> + <value>(768, 866)</value> </param> <param> <key>_rotation</key> @@ -776,10 +1035,10 @@ </param> </block> <block> - <key>gr_add_const_vxx</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>gr_add_const_vxx_0</value> + <value>rrc_spectrum</value> </param> <param> <key>_enabled</key> @@ -787,38 +1046,75 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>const</key> - <value>48.0</value> + <key>title</key> + <value>RRC Spectrum</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>sample_rate</value> </param> <param> - <key>_coordinate</key> - <value>(1707, 517)</value> + <key>baseband_freq</key> + <value>freq+offset</value> </param> <param> - <key>_rotation</key> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>-15</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> <value>0</value> </param> - </block> - <block> - <key>gr_float_to_char</key> <param> - <key>id</key> - <value>gr_float_to_char_0</value> + <key>win</key> + <value>None</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> </param> <param> <key>_coordinate</key> - <value>(1878, 521)</value> + <value>(767, 499)</value> </param> <param> <key>_rotation</key> @@ -826,30 +1122,38 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>gr_costas_loop_cc</key> <param> <key>id</key> - <value>gr_file_sink_0</value> + <value>costas</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>file</key> - <value>bits.dat</value> + <key>alpha</key> + <value>costas_alpha</value> </param> <param> - <key>type</key> - <value>byte</value> + <key>beta</key> + <value>(costas_alpha**2.0)/4.0</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>max_freq</key> + <value>50e-6*sps</value> + </param> + <param> + <key>min_freq</key> + <value>-50e-6*sps</value> + </param> + <param> + <key>order</key> + <value>2</value> </param> <param> <key>_coordinate</key> - <value>(2059, 517)</value> + <value>(767, 721)</value> </param> <param> <key>_rotation</key> @@ -857,69 +1161,86 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>gr_file_source_0</value> + <value>costas_spectrum</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>file</key> - <value>lrit.dat</value> - </param> - <param> <key>type</key> <value>complex</value> </param> <param> - <key>repeat</key> - <value>False</value> + <key>title</key> + <value>PLL Spectrum</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>sample_rate</value> </param> <param> - <key>_coordinate</key> - <value>(11, 655)</value> + <key>baseband_freq</key> + <value>freq+offset</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>y_per_div</key> + <value>10</value> </param> - </block> - <block> - <key>notebook</key> <param> - <key>id</key> - <value>displays</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ref_level</key> + <value>-15</value> </param> <param> - <key>style</key> - <value>wx.NB_TOP</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>labels</key> - <value>['USRP RX', 'Costas Output']</value> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> - <value>2, 0, 1, 3</value> + <value>0, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 2</value> </param> <param> <key>_coordinate</key> - <value>(14, 351)</value> + <value>(969, 502)</value> </param> <param> <key>_rotation</key> @@ -927,42 +1248,86 @@ </param> </block> <block> - <key>variable_config</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>saved_decim</value> + <value>mm_spectrum</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>160</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>type</key> - <value>int</value> + <key>title</key> + <value>Bit Sync Spectrum</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>samp_rate</key> + <value>symbol_rate</value> </param> <param> - <key>section</key> - <value>main</value> + <key>baseband_freq</key> + <value>0</value> </param> <param> - <key>option</key> - <value>decim</value> + <key>y_per_div</key> + <value>10</value> </param> <param> - <key>writeback</key> - <value>decim</value> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>-15</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>15</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 3</value> </param> <param> <key>_coordinate</key> - <value>(246, 172)</value> + <value>(1225, 503)</value> </param> <param> <key>_rotation</key> @@ -970,54 +1335,66 @@ </param> </block> <block> - <key>variable_slider</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gain</value> + <value>costas_waveform</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Gain</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>saved_gain</value> + <key>title</key> + <value>PLL Waveform</value> </param> <param> - <key>min</key> + <key>samp_rate</key> + <value>sample_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0.5</value> + </param> + <param> + <key>v_offset</key> <value>0</value> </param> <param> - <key>max</key> - <value>115</value> + <key>t_scale</key> + <value>20.0/sample_rate</value> </param> <param> - <key>num_steps</key> - <value>115</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> - <value>0, 1, 1, 1</value> + <value>1, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 2</value> </param> <param> <key>_coordinate</key> - <value>(411, 11)</value> + <value>(968, 852)</value> </param> <param> <key>_rotation</key> @@ -1025,42 +1402,42 @@ </param> </block> <block> - <key>variable_config</key> + <key>gr_clock_recovery_mm_xx</key> <param> <key>id</key> - <value>saved_gain</value> + <value>mm_sync</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>33</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>type</key> - <value>real</value> + <key>omega</key> + <value>sps</value> </param> <param> - <key>config_file</key> - <value>config_filename</value> + <key>gain_omega</key> + <value>(gain_mu**2)/4.0</value> </param> <param> - <key>section</key> - <value>main</value> + <key>mu</key> + <value>0.5</value> </param> <param> - <key>option</key> - <value>gain</value> + <key>gain_mu</key> + <value>gain_mu</value> </param> <param> - <key>writeback</key> - <value>gain</value> + <key>omega_relative_limit</key> + <value>50e-6*sps</value> </param> <param> <key>_coordinate</key> - <value>(412, 172)</value> + <value>(969, 722)</value> </param> <param> <key>_rotation</key> @@ -1068,54 +1445,66 @@ </param> </block> <block> - <key>variable_slider</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>freq</value> + <value>mm_const</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Frequency</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>saved_freq</value> + <key>title</key> + <value>Constellation</value> </param> <param> - <key>min</key> - <value>135e6</value> + <key>samp_rate</key> + <value>symbol_rate</value> </param> <param> - <key>max</key> - <value>139e6</value> + <key>v_scale</key> + <value>0.5</value> </param> <param> - <key>num_steps</key> - <value>400</value> + <key>v_offset</key> + <value>0</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>t_scale</key> + <value>20.0/symbol_rate</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> - <value>0, 2, 1, 1</value> + <value>1, 0, 1, 1</value> </param> <param> <key>notebook</key> - <value></value> + <value>displays, 3</value> </param> <param> <key>_coordinate</key> - <value>(574, 12)</value> + <value>(1225, 859)</value> </param> <param> <key>_rotation</key> @@ -1123,42 +1512,34 @@ </param> </block> <block> - <key>variable_config</key> + <key>notebook</key> <param> <key>id</key> - <value>saved_freq</value> + <value>displays</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>137e6</value> - </param> - <param> - <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> + <key>style</key> + <value>wx.NB_TOP</value> </param> <param> - <key>section</key> - <value>main</value> + <key>labels</key> + <value>['USRP RX','RRC','PLL','Const']</value> </param> <param> - <key>option</key> - <value>freq</value> + <key>grid_pos</key> + <value>2, 0, 1, 3</value> </param> <param> - <key>writeback</key> - <value>freq</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(576, 170)</value> + <value>(10, 228)</value> </param> <param> <key>_rotation</key> @@ -1169,7 +1550,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>costas_alpha</value> + <value>gain</value> </param> <param> <key>_enabled</key> @@ -1177,11 +1558,11 @@ </param> <param> <key>label</key> - <value>Costas Alpha</value> + <value>Gain</value> </param> <param> <key>value</key> - <value>saved_costas_alpha</value> + <value>saved_gain</value> </param> <param> <key>min</key> @@ -1189,11 +1570,11 @@ </param> <param> <key>max</key> - <value>0.5</value> + <value>115</value> </param> <param> <key>num_steps</key> - <value>100</value> + <value>115</value> </param> <param> <key>style</key> @@ -1213,7 +1594,7 @@ </param> <param> <key>_coordinate</key> - <value>(738, 13)</value> + <value>(532, 150)</value> </param> <param> <key>_rotation</key> @@ -1221,42 +1602,30 @@ </param> </block> <block> - <key>variable_config</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>saved_costas_alpha</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.005</value> + <value>False</value> </param> <param> <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>main</value> + <value>complex</value> </param> <param> - <key>option</key> - <value>costas_alpha</value> + <key>samples_per_second</key> + <value>sample_rate</value> </param> <param> - <key>writeback</key> - <value>costas_alpha</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(739, 170)</value> + <value>(63, 859)</value> </param> <param> <key>_rotation</key> @@ -1264,42 +1633,34 @@ </param> </block> <block> - <key>variable_config</key> + <key>gr_file_source</key> <param> <key>id</key> - <value>saved_gain_mu</value> + <value>gr_file_source_0</value> </param> <param> <key>_enabled</key> - <value>True</value> + <value>False</value> </param> <param> - <key>value</key> - <value>0.005</value> + <key>file</key> + <value>lrit.dat</value> </param> <param> <key>type</key> - <value>real</value> - </param> - <param> - <key>config_file</key> - <value>config_filename</value> - </param> - <param> - <key>section</key> - <value>main</value> + <value>complex</value> </param> <param> - <key>option</key> - <value>gain_mu</value> + <key>repeat</key> + <value>False</value> </param> <param> - <key>writeback</key> - <value>gain_mu</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(900, 170)</value> + <value>(36, 943)</value> </param> <param> <key>_rotation</key> @@ -1307,77 +1668,58 @@ </param> </block> <block> - <key>variable_slider</key> + <key>usrp_simple_source_x</key> <param> <key>id</key> - <value>gain_mu</value> + <value>usrp_simple_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Gain Mu</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>saved_gain_mu</value> + <key>format</key> + <value></value> </param> <param> - <key>min</key> + <key>which</key> <value>0</value> </param> <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> + <key>decimation</key> + <value>decim</value> </param> <param> - <key>grid_pos</key> - <value>1, 1, 1, 1</value> + <key>frequency</key> + <value>freq+offset</value> </param> <param> - <key>notebook</key> - <value></value> + <key>lo_offset</key> + <value>float('inf')</value> </param> <param> - <key>_coordinate</key> - <value>(902, 13)</value> + <key>gain</key> + <value>gain</value> </param> <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>config_filename</value> + <key>side</key> + <value>side</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>rx_ant</key> + <value>RXA</value> </param> <param> - <key>value</key> - <value>"usrp_rx_lrit.cfg"</value> + <key>hb_filters</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(13, 283)</value> + <value>(19, 713)</value> </param> <param> <key>_rotation</key> @@ -1385,14 +1727,14 @@ </param> </block> <connection> - <source_block_id>usrp_simple_source_x_0</source_block_id> - <sink_block_id>gr_agc_xx_0</sink_block_id> + <source_block_id>gr_agc_xx_0</source_block_id> + <sink_block_id>root_raised_cosine_filter_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_agc_xx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_agc_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -1403,74 +1745,80 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>usrp_simple_source_x_0</source_block_id> <sink_block_id>gr_agc_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_probe_mpsk_snr_c_0</source_block_id> - <sink_block_id>wxgui_numbersink2_0</sink_block_id> + <source_block_id>usrp_simple_source_x_0</source_block_id> + <sink_block_id>rx_spectrum</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_mpsk_receiver_cc_0</source_block_id> - <sink_block_id>gr_probe_mpsk_snr_c_0</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>rx_spectrum</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_agc_xx_0</source_block_id> - <sink_block_id>gr_mpsk_receiver_cc_0</sink_block_id> + <source_block_id>usrp_simple_source_x_0</source_block_id> + <sink_block_id>rx_waveform</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_mpsk_receiver_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_1</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>rx_waveform</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_agc_xx_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> + <source_block_id>root_raised_cosine_filter_0</source_block_id> + <sink_block_id>rrc_waveform</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>root_raised_cosine_filter_0</source_block_id> + <sink_block_id>rrc_spectrum</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_mpsk_receiver_cc_0</source_block_id> - <sink_block_id>gr_complex_to_real_0</sink_block_id> + <source_block_id>root_raised_cosine_filter_0</source_block_id> + <sink_block_id>costas</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_complex_to_real_0</source_block_id> - <sink_block_id>gr_binary_slicer_fb_0</sink_block_id> + <source_block_id>costas</source_block_id> + <sink_block_id>costas_spectrum</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_binary_slicer_fb_0</source_block_id> - <sink_block_id>gr_char_to_float_0</sink_block_id> + <source_block_id>costas</source_block_id> + <sink_block_id>costas_waveform</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_char_to_float_0</source_block_id> - <sink_block_id>gr_add_const_vxx_0</sink_block_id> + <source_block_id>costas</source_block_id> + <sink_block_id>mm_sync</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_const_vxx_0</source_block_id> - <sink_block_id>gr_float_to_char_0</sink_block_id> + <source_block_id>mm_sync</source_block_id> + <sink_block_id>mm_spectrum</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_float_to_char_0</source_block_id> - <sink_block_id>gr_file_sink_0</sink_block_id> + <source_block_id>mm_sync</source_block_id> + <sink_block_id>mm_const</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/apps/usrp_rx_lrit.py b/gr-noaa/apps/usrp_rx_lrit.py index bc313e3af..9a3d70200 100755 --- a/gr-noaa/apps/usrp_rx_lrit.py +++ b/gr-noaa/apps/usrp_rx_lrit.py @@ -2,19 +2,22 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP LRIT Receiver -# Generated: Sat Aug 29 11:26:03 2009 +# Generated: Wed Dec 16 09:49:15 2009 ################################################## +from gnuradio import eng_notation from gnuradio import gr +from gnuradio import window from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import forms -from gnuradio.wxgui import numbersink2 from gnuradio.wxgui import scopesink2 -from grc_gnuradio import blks2 as grc_blks2 +from grc_gnuradio import usrp as grc_usrp from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import ConfigParser +import os import wx class usrp_rx_lrit(grc_wxgui.top_block_gui): @@ -25,36 +28,47 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): ################################################## # Variables ################################################## - self.config_filename = config_filename = "usrp_rx_lrit.cfg" + self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/config.conf' self._saved_decim_config = ConfigParser.ConfigParser() self._saved_decim_config.read(config_filename) - try: saved_decim = self._saved_decim_config.getint("main", "decim") + try: saved_decim = self._saved_decim_config.getint('usrp_rx_lrit', 'decim') except: saved_decim = 160 self.saved_decim = saved_decim self.decim = decim = saved_decim self.symbol_rate = symbol_rate = 293e3 + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(config_filename) + try: saved_offset = self._saved_offset_config.getfloat('usrp_rx_lrit', 'offset') + except: saved_offset = 0 + self.saved_offset = saved_offset self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(config_filename) - try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu") + try: saved_gain_mu = self._saved_gain_mu_config.getfloat('usrp_rx_lrit', 'gain_mu') except: saved_gain_mu = 0.005 self.saved_gain_mu = saved_gain_mu self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(config_filename) - try: saved_gain = self._saved_gain_config.getfloat("main", "gain") + try: saved_gain = self._saved_gain_config.getfloat('usrp_rx_lrit', 'gain') except: saved_gain = 33 self.saved_gain = saved_gain self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(config_filename) - try: saved_freq = self._saved_freq_config.getfloat("main", "freq") - except: saved_freq = 137e6 + try: saved_freq = self._saved_freq_config.getfloat('usrp_rx_lrit', 'freq') + except: saved_freq = 1691e6 self.saved_freq = saved_freq self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(config_filename) - try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha") + try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat('usrp_rx_lrit', 'costas_alpha') except: saved_costas_alpha = 0.005 self.saved_costas_alpha = saved_costas_alpha - self.samp_rate = samp_rate = 64e6/decim - self.sps = sps = samp_rate/symbol_rate + self.sample_rate = sample_rate = 64e6/decim + self.sps = sps = sample_rate/symbol_rate + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(config_filename) + try: side = self._side_config.get('usrp_rx_lrit', 'side') + except: side = 'A' + self.side = side + self.offset = offset = saved_offset self.gain_mu = gain_mu = saved_gain_mu self.gain = gain = saved_gain self.freq = freq = saved_freq @@ -65,7 +79,9 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): ################################################## self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP) self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX") - self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "RRC") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "PLL") + self.displays.AddPage(grc_wxgui.Panel(self.displays), "Const") self.GridAdd(self.displays, 2, 0, 1, 3) ################################################## @@ -78,7 +94,30 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): label="Decim", converter=forms.int_converter(), ) - self.GridAdd(self._decim_text_box, 0, 0, 1, 1) + self.GridAdd(self._decim_text_box, 0, 2, 1, 1) + _offset_sizer = wx.BoxSizer(wx.VERTICAL) + self._offset_text_box = forms.text_box( + parent=self.GetWin(), + sizer=_offset_sizer, + value=self.offset, + callback=self.set_offset, + label="Offset", + converter=forms.float_converter(), + proportion=0, + ) + self._offset_slider = forms.slider( + parent=self.GetWin(), + sizer=_offset_sizer, + value=self.offset, + callback=self.set_offset, + minimum=-50e3, + maximum=50e3, + num_steps=100, + style=wx.SL_HORIZONTAL, + cast=float, + proportion=1, + ) + self.GridAdd(_offset_sizer, 0, 1, 1, 1) _gain_mu_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_mu_text_box = forms.text_box( parent=self.GetWin(), @@ -101,7 +140,7 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1) + self.GridAdd(_gain_mu_sizer, 1, 2, 1, 1) _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), @@ -124,30 +163,15 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_gain_sizer, 0, 1, 1, 1) - _freq_sizer = wx.BoxSizer(wx.VERTICAL) + self.GridAdd(_gain_sizer, 1, 0, 1, 1) self._freq_text_box = forms.text_box( parent=self.GetWin(), - sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label="Frequency", converter=forms.float_converter(), - proportion=0, ) - self._freq_slider = forms.slider( - parent=self.GetWin(), - sizer=_freq_sizer, - value=self.freq, - callback=self.set_freq, - minimum=135e6, - maximum=139e6, - num_steps=400, - style=wx.SL_HORIZONTAL, - cast=float, - proportion=1, - ) - self.GridAdd(_freq_sizer, 0, 2, 1, 1) + self.GridAdd(self._freq_text_box, 0, 0, 1, 1) _costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL) self._costas_alpha_text_box = forms.text_box( parent=self.GetWin(), @@ -170,131 +194,193 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): cast=float, proportion=1, ) - self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1) + self.GridAdd(_costas_alpha_sizer, 1, 1, 1, 1) ################################################## # Blocks ################################################## - self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, )) + self.costas = gr.costas_loop_cc(costas_alpha, (costas_alpha**2.0)/4.0, 50e-6*sps, -50e-6*sps, 2) + self.costas_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(2).GetWin(), + baseband_freq=freq+offset, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, + average=False, + avg_alpha=None, + title="PLL Spectrum", + peak_hold=False, + ) + self.displays.GetPage(2).GridAdd(self.costas_spectrum.win, 0, 0, 1, 1) + self.costas_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(2).GetWin(), + title="PLL Waveform", + sample_rate=sample_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/sample_rate, + ac_couple=False, + xy_mode=False, + num_inputs=1, + ) + self.displays.GetPage(2).GridAdd(self.costas_waveform.win, 1, 0, 1, 1) self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0) - self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb() - self.gr_char_to_float_0 = gr.char_to_float() - self.gr_complex_to_real_0 = gr.complex_to_real(1) - self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat") - self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False) - self.gr_float_to_char_0 = gr.float_to_char() - self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05) - self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c( - type='snr', - alpha=0.0001, - probe_rate=10, + self.mm_const = scopesink2.scope_sink_c( + self.displays.GetPage(3).GetWin(), + title="Constellation", + sample_rate=symbol_rate, + v_scale=0.5, + v_offset=0, + t_scale=20.0/symbol_rate, + ac_couple=False, + xy_mode=True, + num_inputs=1, ) - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) - self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( - self.displays.GetPage(0).GetWin(), - baseband_freq=freq, + self.displays.GetPage(3).GridAdd(self.mm_const.win, 1, 0, 1, 1) + self.mm_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(3).GetWin(), + baseband_freq=0, y_per_div=10, y_divs=10, - ref_level=50, - sample_rate=samp_rate, + ref_level=-15, + ref_scale=2.0, + sample_rate=symbol_rate, fft_size=1024, - fft_rate=30, + fft_rate=15, average=False, avg_alpha=None, - title="Spectrum", + title="Bit Sync Spectrum", peak_hold=False, ) - self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1) - self.wxgui_numbersink2_0 = numbersink2.number_sink_f( + self.displays.GetPage(3).GridAdd(self.mm_spectrum.win, 0, 0, 1, 1) + self.mm_sync = gr.clock_recovery_mm_cc(sps, (gain_mu**2)/4.0, 0.5, gain_mu, 50e-6*sps) + self.root_raised_cosine_filter_0 = gr.fir_filter_ccf(1, firdes.root_raised_cosine( + 1, sample_rate, symbol_rate, 0.25, int(11*sample_rate/symbol_rate))) + self.rrc_spectrum = fftsink2.fft_sink_c( self.displays.GetPage(1).GetWin(), - unit="dB", - minval=0, - maxval=30, - factor=1.0, - decimal_places=1, - ref_level=0, - sample_rate=10, - number_rate=10, + baseband_freq=freq+offset, + y_per_div=10, + y_divs=10, + ref_level=-15, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=15, average=False, avg_alpha=None, - label="SNR", + title="RRC Spectrum", peak_hold=False, - show_gauge=True, ) - self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1) - self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( - self.displays.GetPage(0).GetWin(), - title="Waveform", - sample_rate=samp_rate, + self.displays.GetPage(1).GridAdd(self.rrc_spectrum.win, 0, 0, 1, 1) + self.rrc_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(1).GetWin(), + title="RRC Waveform", + sample_rate=sample_rate, v_scale=0.5, - t_scale=20.0/samp_rate, + v_offset=0, + t_scale=20.0/sample_rate, ac_couple=False, - xy_mode=True, + xy_mode=False, num_inputs=1, ) - self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1) - self.wxgui_scopesink2_1 = scopesink2.scope_sink_c( - self.displays.GetPage(1).GetWin(), - title="Scope Plot", - sample_rate=samp_rate, - v_scale=0.4, - t_scale=20.0/samp_rate, + self.displays.GetPage(1).GridAdd(self.rrc_waveform.win, 1, 0, 1, 1) + self.rx_spectrum = fftsink2.fft_sink_c( + self.displays.GetPage(0).GetWin(), + baseband_freq=freq, + y_per_div=10, + y_divs=10, + ref_level=50, + ref_scale=2.0, + sample_rate=sample_rate, + fft_size=1024, + fft_rate=30, + average=False, + avg_alpha=None, + title="RX Spectrum", + peak_hold=False, + ) + self.displays.GetPage(0).GridAdd(self.rx_spectrum.win, 0, 0, 1, 1) + self.rx_waveform = scopesink2.scope_sink_c( + self.displays.GetPage(0).GetWin(), + title="RX Waveform", + sample_rate=sample_rate, + v_scale=0, + v_offset=0, + t_scale=20.0/sample_rate, ac_couple=False, - xy_mode=True, + xy_mode=False, num_inputs=1, ) - self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1) + self.displays.GetPage(0).GridAdd(self.rx_waveform.win, 1, 0, 1, 1) + self.usrp_simple_source_x_0 = grc_usrp.simple_source_c(which=0, side=side, rx_ant="RXA") + self.usrp_simple_source_x_0.set_decim_rate(decim) + self.usrp_simple_source_x_0.set_frequency(freq+offset, verbose=True) + self.usrp_simple_source_x_0.set_gain(gain) ################################################## # Connections ################################################## - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0)) - self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0)) - self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0)) - self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0)) - self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0)) - self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0)) - self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0)) - self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0)) - self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0)) - self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0)) + self.connect((self.gr_agc_xx_0, 0), (self.root_raised_cosine_filter_0, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.gr_agc_xx_0, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.rx_spectrum, 0)) + self.connect((self.usrp_simple_source_x_0, 0), (self.rx_waveform, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.rrc_waveform, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.rrc_spectrum, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.costas, 0)) + self.connect((self.costas, 0), (self.costas_spectrum, 0)) + self.connect((self.costas, 0), (self.costas_waveform, 0)) + self.connect((self.costas, 0), (self.mm_sync, 0)) + self.connect((self.mm_sync, 0), (self.mm_spectrum, 0)) + self.connect((self.mm_sync, 0), (self.mm_const, 0)) def set_config_filename(self, config_filename): self.config_filename = config_filename - self._saved_decim_config = ConfigParser.ConfigParser() - self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) - self._saved_decim_config.write(open(self.config_filename, 'w')) - self._saved_gain_config = ConfigParser.ConfigParser() - self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "gain", str(self.gain)) - self._saved_gain_config.write(open(self.config_filename, 'w')) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_lrit'): + self._saved_freq_config.add_section('usrp_rx_lrit') + self._saved_freq_config.set('usrp_rx_lrit', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(self.config_filename) + if not self._saved_offset_config.has_section('usrp_rx_lrit'): + self._saved_offset_config.add_section('usrp_rx_lrit') + self._saved_offset_config.set('usrp_rx_lrit', 'offset', str(self.offset)) + self._saved_offset_config.write(open(self.config_filename, 'w')) + self._saved_gain_config = ConfigParser.ConfigParser() + self._saved_gain_config.read(self.config_filename) + if not self._saved_gain_config.has_section('usrp_rx_lrit'): + self._saved_gain_config.add_section('usrp_rx_lrit') + self._saved_gain_config.set('usrp_rx_lrit', 'gain', str(self.gain)) + self._saved_gain_config.write(open(self.config_filename, 'w')) + self._saved_decim_config = ConfigParser.ConfigParser() + self._saved_decim_config.read(self.config_filename) + if not self._saved_decim_config.has_section('usrp_rx_lrit'): + self._saved_decim_config.add_section('usrp_rx_lrit') + self._saved_decim_config.set('usrp_rx_lrit', 'decim', str(self.decim)) + self._saved_decim_config.write(open(self.config_filename, 'w')) self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) self._saved_gain_mu_config.write(open(self.config_filename, 'w')) + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_lrit'): + self._side_config.add_section('usrp_rx_lrit') + self._side_config.set('usrp_rx_lrit', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) def set_saved_decim(self, saved_decim): self.saved_decim = saved_decim @@ -302,18 +388,26 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): def set_decim(self, decim): self.decim = decim - self.set_samp_rate(64e6/self.decim) - self._decim_text_box.set_value(self.decim) + self.set_sample_rate(64e6/self.decim) self._saved_decim_config = ConfigParser.ConfigParser() self._saved_decim_config.read(self.config_filename) - if not self._saved_decim_config.has_section("main"): - self._saved_decim_config.add_section("main") - self._saved_decim_config.set("main", "decim", str(self.decim)) + if not self._saved_decim_config.has_section('usrp_rx_lrit'): + self._saved_decim_config.add_section('usrp_rx_lrit') + self._saved_decim_config.set('usrp_rx_lrit', 'decim', str(self.decim)) self._saved_decim_config.write(open(self.config_filename, 'w')) + self._decim_text_box.set_value(self.decim) + self.usrp_simple_source_x_0.set_decim_rate(self.decim) def set_symbol_rate(self, symbol_rate): self.symbol_rate = symbol_rate - self.set_sps(self.samp_rate/self.symbol_rate) + self.set_sps(self.sample_rate/self.symbol_rate) + self.root_raised_cosine_filter_0.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + self.mm_spectrum.set_sample_rate(self.symbol_rate) + self.mm_const.set_sample_rate(self.symbol_rate) + + def set_saved_offset(self, saved_offset): + self.saved_offset = saved_offset + self.set_offset(self.saved_offset) def set_saved_gain_mu(self, saved_gain_mu): self.saved_gain_mu = saved_gain_mu @@ -331,65 +425,95 @@ class usrp_rx_lrit(grc_wxgui.top_block_gui): self.saved_costas_alpha = saved_costas_alpha self.set_costas_alpha(self.saved_costas_alpha) - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.set_sps(self.samp_rate/self.symbol_rate) - self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) - self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) - self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate) + def set_sample_rate(self, sample_rate): + self.sample_rate = sample_rate + self.set_sps(self.sample_rate/self.symbol_rate) + self.rx_waveform.set_sample_rate(self.sample_rate) + self.rx_spectrum.set_sample_rate(self.sample_rate) + self.root_raised_cosine_filter_0.set_taps(firdes.root_raised_cosine(1, self.sample_rate, self.symbol_rate, 0.25, int(11*self.sample_rate/self.symbol_rate))) + self.rrc_waveform.set_sample_rate(self.sample_rate) + self.rrc_spectrum.set_sample_rate(self.sample_rate) + self.costas_spectrum.set_sample_rate(self.sample_rate) + self.costas_waveform.set_sample_rate(self.sample_rate) def set_sps(self, sps): self.sps = sps - self.gr_mpsk_receiver_cc_0.set_omega(self.sps) + self.mm_sync.set_omega(self.sps) + + def set_side(self, side): + self.side = side + self._side_config = ConfigParser.ConfigParser() + self._side_config.read(self.config_filename) + if not self._side_config.has_section('usrp_rx_lrit'): + self._side_config.add_section('usrp_rx_lrit') + self._side_config.set('usrp_rx_lrit', 'side', str(self.side)) + self._side_config.write(open(self.config_filename, 'w')) + + def set_offset(self, offset): + self.offset = offset + self._saved_offset_config = ConfigParser.ConfigParser() + self._saved_offset_config.read(self.config_filename) + if not self._saved_offset_config.has_section('usrp_rx_lrit'): + self._saved_offset_config.add_section('usrp_rx_lrit') + self._saved_offset_config.set('usrp_rx_lrit', 'offset', str(self.offset)) + self._saved_offset_config.write(open(self.config_filename, 'w')) + self._offset_slider.set_value(self.offset) + self._offset_text_box.set_value(self.offset) + self.rrc_spectrum.set_baseband_freq(self.freq+self.offset) + self.costas_spectrum.set_baseband_freq(self.freq+self.offset) + self.usrp_simple_source_x_0.set_frequency(self.freq+self.offset) def set_gain_mu(self, gain_mu): self.gain_mu = gain_mu - self.gr_mpsk_receiver_cc_0.set_gain_mu(self.gain_mu) - self.gr_mpsk_receiver_cc_0.set_gain_omega(self.gain_mu*self.gain_mu/4.0) + self._gain_mu_slider.set_value(self.gain_mu) + self._gain_mu_text_box.set_value(self.gain_mu) self._saved_gain_mu_config = ConfigParser.ConfigParser() self._saved_gain_mu_config.read(self.config_filename) - if not self._saved_gain_mu_config.has_section("main"): - self._saved_gain_mu_config.add_section("main") - self._saved_gain_mu_config.set("main", "gain_mu", str(self.gain_mu)) + if not self._saved_gain_mu_config.has_section('usrp_rx_lrit'): + self._saved_gain_mu_config.add_section('usrp_rx_lrit') + self._saved_gain_mu_config.set('usrp_rx_lrit', 'gain_mu', str(self.gain_mu)) self._saved_gain_mu_config.write(open(self.config_filename, 'w')) - self._gain_mu_slider.set_value(self.gain_mu) - self._gain_mu_text_box.set_value(self.gain_mu) + self.mm_sync.set_gain_omega((self.gain_mu**2)/4.0) + self.mm_sync.set_gain_mu(self.gain_mu) def set_gain(self, gain): self.gain = gain - self._gain_slider.set_value(self.gain) - self._gain_text_box.set_value(self.gain) self._saved_gain_config = ConfigParser.ConfigParser() self._saved_gain_config.read(self.config_filename) - if not self._saved_gain_config.has_section("main"): - self._saved_gain_config.add_section("main") - self._saved_gain_config.set("main", "gain", str(self.gain)) + if not self._saved_gain_config.has_section('usrp_rx_lrit'): + self._saved_gain_config.add_section('usrp_rx_lrit') + self._saved_gain_config.set('usrp_rx_lrit', 'gain', str(self.gain)) self._saved_gain_config.write(open(self.config_filename, 'w')) + self._gain_slider.set_value(self.gain) + self._gain_text_box.set_value(self.gain) + self.usrp_simple_source_x_0.set_gain(self.gain) def set_freq(self, freq): self.freq = freq - self.wxgui_fftsink2_0.set_baseband_freq(self.freq) - self._freq_slider.set_value(self.freq) self._freq_text_box.set_value(self.freq) self._saved_freq_config = ConfigParser.ConfigParser() self._saved_freq_config.read(self.config_filename) - if not self._saved_freq_config.has_section("main"): - self._saved_freq_config.add_section("main") - self._saved_freq_config.set("main", "freq", str(self.freq)) + if not self._saved_freq_config.has_section('usrp_rx_lrit'): + self._saved_freq_config.add_section('usrp_rx_lrit') + self._saved_freq_config.set('usrp_rx_lrit', 'freq', str(self.freq)) self._saved_freq_config.write(open(self.config_filename, 'w')) + self.rx_spectrum.set_baseband_freq(self.freq) + self.rrc_spectrum.set_baseband_freq(self.freq+self.offset) + self.costas_spectrum.set_baseband_freq(self.freq+self.offset) + self.usrp_simple_source_x_0.set_frequency(self.freq+self.offset) def set_costas_alpha(self, costas_alpha): self.costas_alpha = costas_alpha - self.gr_mpsk_receiver_cc_0.set_alpha(self.costas_alpha) - self.gr_mpsk_receiver_cc_0.set_beta(self.costas_alpha*self.costas_alpha/4.0) self._costas_alpha_slider.set_value(self.costas_alpha) self._costas_alpha_text_box.set_value(self.costas_alpha) self._saved_costas_alpha_config = ConfigParser.ConfigParser() self._saved_costas_alpha_config.read(self.config_filename) - if not self._saved_costas_alpha_config.has_section("main"): - self._saved_costas_alpha_config.add_section("main") - self._saved_costas_alpha_config.set("main", "costas_alpha", str(self.costas_alpha)) + if not self._saved_costas_alpha_config.has_section('usrp_rx_lrit'): + self._saved_costas_alpha_config.add_section('usrp_rx_lrit') + self._saved_costas_alpha_config.set('usrp_rx_lrit', 'costas_alpha', str(self.costas_alpha)) self._saved_costas_alpha_config.write(open(self.config_filename, 'w')) + self.costas.set_alpha(self.costas_alpha) + self.costas.set_beta((self.costas_alpha**2.0)/4.0) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") diff --git a/gr-pager/grc/.gitignore b/gr-pager/grc/.gitignore index 70845e08e..3dda72986 100644 --- a/gr-pager/grc/.gitignore +++ b/gr-pager/grc/.gitignore @@ -1 +1,2 @@ Makefile.in +Makefile diff --git a/gr-pager/python/.gitignore b/gr-pager/python/.gitignore index b336cc7ce..604b402c5 100644 --- a/gr-pager/python/.gitignore +++ b/gr-pager/python/.gitignore @@ -1,2 +1,3 @@ /Makefile /Makefile.in +/run_tests diff --git a/gr-utils/src/python/usrp2_fft.py b/gr-utils/src/python/usrp2_fft.py index 1e8cf89ea..4276e389a 100755 --- a/gr-utils/src/python/usrp2_fft.py +++ b/gr-utils/src/python/usrp2_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -218,7 +218,7 @@ class app_top_block(stdgui2.std_top_block): self.myform['baseband'].set_value(r.baseband_freq) self.myform['ddc'].set_value(r.dxc_freq) if not self.options.oscilloscope: - self.scope.win.set_baseband_freq(target_freq) + self.scope.set_baseband_freq(target_freq) return True return False diff --git a/gr-utils/src/python/usrp_fft.py b/gr-utils/src/python/usrp_fft.py index 4aa70adab..ab7fb4462 100755 --- a/gr-utils/src/python/usrp_fft.py +++ b/gr-utils/src/python/usrp_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -255,7 +255,7 @@ class app_top_block(stdgui2.std_top_block): self.myform['baseband'].set_value(r.baseband_freq) self.myform['ddc'].set_value(r.dxc_freq) if not self.options.oscilloscope: - self.scope.win.set_baseband_freq(target_freq) + self.scope.set_baseband_freq(target_freq) return True return False diff --git a/gr-wxgui/src/python/plotter/waterfall_plotter.py b/gr-wxgui/src/python/plotter/waterfall_plotter.py index d32b0ca0a..0af64b826 100644 --- a/gr-wxgui/src/python/plotter/waterfall_plotter.py +++ b/gr-wxgui/src/python/plotter/waterfall_plotter.py @@ -1,5 +1,5 @@ # -# Copyright 2008, 2009 Free Software Foundation, Inc. +# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,6 +26,7 @@ import common import numpy import gltext import math +import struct LEGEND_LEFT_PAD = 7 LEGEND_NUM_BLOCKS = 256 @@ -37,6 +38,9 @@ MIN_PADDING = 0, 60, 0, 0 #top, right, bottom, left ceil_log2 = lambda x: 2**int(math.ceil(math.log(x)/math.log(2))) +pack_color = lambda x: struct.unpack('I', struct.pack('BBBB', *x))[0] +unpack_color = lambda x: struct.unpack('BBBB', struct.pack('I', int(x))) + def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]): """ Get an array of 256 rgba values where each index maps to a color. @@ -53,11 +57,10 @@ def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]): #linear interpolation if x <= x2: return float(y1 - y2)/(x1 - x2)*(x - x1) + y1 raise Exception - return [numpy.array(map( - lambda pw: int(255*_fcn(i/255.0, pw)), - (red_pts, green_pts, blue_pts, alpha_pts), - ), numpy.uint8).tostring() for i in range(0, 256) - ] + return numpy.array([pack_color(map( + lambda pw: int(255*_fcn(i/255.0, pw)), + (red_pts, green_pts, blue_pts, alpha_pts), + )) for i in range(0, 256)], numpy.uint32) COLORS = { 'rgb1': _get_rbga( #http://www.ks.uiuc.edu/Research/vmd/vmd-1.7.1/ug/img47.gif @@ -179,8 +182,8 @@ class waterfall_plotter(grid_plotter_base): block_height = float(legend_height)/LEGEND_NUM_BLOCKS x = self.width - self.padding_right + LEGEND_LEFT_PAD for i in range(LEGEND_NUM_BLOCKS): - color = COLORS[self._color_mode][int(255*i/float(LEGEND_NUM_BLOCKS-1))] - GL.glColor4f(*map(lambda c: ord(c)/255.0, color)) + color = unpack_color(COLORS[self._color_mode][int(255*i/float(LEGEND_NUM_BLOCKS-1))]) + GL.glColor4f(*numpy.array(color)/255.0) y = self.height - (i+1)*block_height - self.padding_bottom self._draw_rect(x, y, LEGEND_WIDTH, block_height) #draw rectangle around color scale border @@ -261,7 +264,7 @@ class waterfall_plotter(grid_plotter_base): samples = numpy.clip(samples, 0, 255) #clip samples = numpy.array(samples, numpy.uint8) #convert the samples to RGBA data - data = numpy.choose(samples, COLORS[self._color_mode]).tostring() + data = COLORS[self._color_mode][samples].tostring() self._buffer.append(data) self._waterfall_cache.changed(True) self.unlock() diff --git a/grc/blocks/gr_sample_and_hold_xx.xml b/grc/blocks/gr_sample_and_hold_xx.xml index bfe66bb00..2a036c3fd 100644 --- a/grc/blocks/gr_sample_and_hold_xx.xml +++ b/grc/blocks/gr_sample_and_hold_xx.xml @@ -40,7 +40,7 @@ </sink> <sink> <name>ctrl</name> - <type>$type</type> + <type>byte</type> </sink> <source> <name>out</name> diff --git a/usrp/host/lib/db_wbxng.cc b/usrp/host/lib/db_wbxng.cc index 56a8486ce..b35a9cb35 100644 --- a/usrp/host/lib/db_wbxng.cc +++ b/usrp/host/lib/db_wbxng.cc @@ -31,8 +31,10 @@ // Tx and Rx have shared defs, but different i/o regs #define ENABLE_5 (1 << 7) // enables 5.0V power supply #define ENABLE_33 (1 << 6) // enables 3.3V supply -#define RX_TXN (1 << 5) // Tx only: T/R antenna switch for TX/RX port -#define RX2_RX1N (1 << 5) // Rx only: antenna switch between RX2 and TX/RX port +//#define RX_TXN (1 << 15) // Tx only: T/R antenna switch for TX/RX port +//#define RX2_RX1N (1 << 15) // Rx only: antenna switch between RX2 and TX/RX port +#define RX_TXN ((1 << 5)|(1 << 15)) // Tx only: T/R antenna switch for TX/RX port +#define RX2_RX1N ((1 << 5)|(1 << 15)) // Rx only: antenna switch between RX2 and TX/RX port #define RXBB_EN (1 << 4) #define TXMOD_EN (1 << 4) #define PLL_CE (1 << 3) @@ -89,8 +91,8 @@ wbxng_base::set_freq(double freq) t.tv_nsec = 10000000; nanosleep(&t, NULL); - fprintf(stderr,"Setting WBXNG frequency, requested %d, obtained %f, lock_detect %d\n", - int_freq, freq_result, d_common->_get_locked()); + //fprintf(stderr,"Setting WBXNG frequency, requested %d, obtained %f, lock_detect %d\n", + // int_freq, freq_result, d_common->_get_locked()); // FIXME // Offsetting the LO helps get the Tx carrier leakage out of the way. @@ -159,11 +161,13 @@ wbxng_base_tx::wbxng_base_tx(usrp_basic_sptr _usrp, int which, int _power_on) d_common = new adf4350(_usrp, d_which, d_spi_enable); - // FIXME: power up the transmit side, but don't enable the mixer + // power up the transmit side, but don't enable the mixer usrp()->_write_oe(d_which,(RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5)); - usrp()->write_io(d_which, (power_on()|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5)); - fprintf(stderr,"Setting WBXNG TXMOD on"); + usrp()->write_io(d_which, (power_on()|RX_TXN|ENABLE_33|ENABLE_5), (RX_TXN|ENABLE_33|ENABLE_5)); //set_lo_offset(4e6); + + // Disable VCO/PLL + d_common->_enable(true); set_gain((gain_min() + gain_max()) / 2.0); // initialize gain } @@ -183,11 +187,12 @@ wbxng_base_tx::shutdown() d_is_shutdown = true; // do whatever there is to do to shutdown + // Disable VCO/PLL + d_common->_enable(false); + // Power down and leave the T/R switch in the R position usrp()->write_io(d_which, (power_off()|RX_TXN), (RX_TXN|ENABLE_33|ENABLE_5)); - // Power down VCO/PLL - d_common->_enable(false); /* _write_control(_compute_control_reg()); @@ -202,9 +207,9 @@ wbxng_base_tx::set_auto_tr(bool on) { bool ok = true; if(on) { - ok &= set_atr_mask (RX_TXN | ENABLE_33 | ENABLE_5); - ok &= set_atr_txval(0 | ENABLE_33 | ENABLE_5); - ok &= set_atr_rxval(RX_TXN | 0); + ok &= set_atr_mask (RX_TXN | TXMOD_EN); + ok &= set_atr_txval(0 | TXMOD_EN); + ok &= set_atr_rxval(RX_TXN); } else { ok &= set_atr_mask (0); @@ -222,12 +227,16 @@ wbxng_base_tx::set_enable(bool on) */ int v; - int mask = RX_TXN | ENABLE_5 | ENABLE_33; + int mask = RX_TXN | TXMOD_EN; if(on) { - v = ENABLE_5 | ENABLE_33; + v = TXMOD_EN; + // Enable VCO/PLL + //d_common->_enable(true); } else { v = RX_TXN; + // Disable VCO/PLL + //d_common->_enable(false); } return usrp()->write_io(d_which, v, mask); } @@ -235,19 +244,19 @@ wbxng_base_tx::set_enable(bool on) float wbxng_base_tx::gain_min() { - return usrp()->pga_max(); + return 0.0; } float wbxng_base_tx::gain_max() { - return usrp()->pga_max() + 25.0; + return 25.0; } float wbxng_base_tx::gain_db_per_step() { - return 1; + return gain_max()/(1+(1.4-0.5)*4096/3.3); } bool @@ -266,28 +275,22 @@ wbxng_base_tx::set_gain(float gain) float pga_gain, agc_gain; float V_maxgain, V_mingain, V_fullscale, dac_value; - float maxgain = gain_max() - usrp()->pga_max(); + float maxgain = gain_max(); float mingain = gain_min(); - if(gain > maxgain) { - pga_gain = gain-maxgain; - assert(pga_gain <= usrp()->pga_max()); - agc_gain = maxgain; - } - else { - pga_gain = 0; - agc_gain = gain; - } + pga_gain = 0; + agc_gain = gain; - V_maxgain = 0.7; + V_maxgain = 0.5; V_mingain = 1.4; V_fullscale = 3.3; dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale; - fprintf(stderr, "TXGAIN: %f dB, Dac Code: %d, Voltage: %f\n", gain, int(dac_value), float((dac_value/4096.0)*V_fullscale)); + //fprintf(stderr, "TXGAIN: %f dB, Dac Code: %d, Voltage: %f\n", gain, int(dac_value), float((dac_value/4096.0)*V_fullscale)); assert(dac_value>=0 && dac_value<4096); return (usrp()->write_aux_dac(d_which, 0, int(dac_value)) - && _set_pga(int(pga_gain))); + && _set_pga(usrp()->pga_max())); + } @@ -310,10 +313,13 @@ wbxng_base_rx::wbxng_base_rx(usrp_basic_sptr _usrp, int which, int _power_on) } d_common = new adf4350(_usrp, d_which, d_spi_enable); + + // Disable VCO/PLL + d_common->_enable(true); usrp()->_write_oe(d_which, (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); usrp()->write_io(d_which, (power_on()|RX2_RX1N|RXBB_EN|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); - fprintf(stderr,"Setting WBXNG RXBB on"); + //fprintf(stderr,"Setting WBXNG RXBB on"); // set up for RX on TX/RX port select_rx_antenna("TX/RX"); @@ -339,9 +345,6 @@ wbxng_base_rx::shutdown() d_is_shutdown = true; // do whatever there is to do to shutdown - // Power down - usrp()->common_write_io(C_RX, d_which, power_off(), (ENABLE_33|ENABLE_5)); - // Power down VCO/PLL d_common->_enable(false); @@ -354,6 +357,9 @@ wbxng_base_rx::shutdown() // fprintf(stderr, "wbxng_base_rx::shutdown before set_auto_tr\n"); set_auto_tr(false); + // Power down + usrp()->write_io(d_which, power_off(), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); + // fprintf(stderr, "wbxng_base_rx::shutdown after set_auto_tr\n"); } } @@ -363,9 +369,9 @@ wbxng_base_rx::set_auto_tr(bool on) { bool ok = true; if(on) { - ok &= set_atr_mask (ENABLE_33|ENABLE_5); - ok &= set_atr_txval( 0); - ok &= set_atr_rxval(ENABLE_33|ENABLE_5); + ok &= set_atr_mask (RXBB_EN|RX2_RX1N); + ok &= set_atr_txval( 0|RX2_RX1N); + ok &= set_atr_rxval(RXBB_EN| 0); } else { ok &= set_atr_mask (0); @@ -452,7 +458,7 @@ wbxng_base_rx::_set_attn(float attn) { int attn_code = int(floor(attn/0.5)); unsigned int iobits = (~attn_code) << ATTN_SHIFT; - fprintf(stderr, "Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x \n", attn, attn_code, iobits & ATTN_MASK, ATTN_MASK); + //fprintf(stderr, "Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x \n", attn, attn_code, iobits & ATTN_MASK, ATTN_MASK); return usrp()->write_io(d_which, iobits, ATTN_MASK); } diff --git a/usrp/host/lib/db_wbxng_adf4350.cc b/usrp/host/lib/db_wbxng_adf4350.cc index 2cec972b0..c17e8d670 100644 --- a/usrp/host/lib/db_wbxng_adf4350.cc +++ b/usrp/host/lib/db_wbxng_adf4350.cc @@ -26,9 +26,9 @@ #include <db_base_impl.h> #include <stdio.h> +#define FREQ_C(freq) uint64_t(freq) #define INPUT_REF_FREQ FREQ_C(64e6) #define DIV_ROUND(num, denom) (((num) + ((denom)/2))/(denom)) -#define FREQ_C(freq) uint64_t(freq) #define INPUT_REF_FREQ_2X (2*INPUT_REF_FREQ) /* input ref freq with doubler turned on */ #define MIN_INT_DIV uint16_t(23) /* minimum int divider, prescaler 4/5 only */ #define MAX_RF_DIV uint8_t(16) /* max rf divider, divides rf output */ @@ -55,7 +55,7 @@ adf4350::adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable) /* Outputs */ d_usrp->_write_oe(d_which, (CE_PIN | PDB_RF_PIN), (CE_PIN | PDB_RF_PIN)); - d_usrp->write_io(d_which, (0), (CE_PIN | PDB_RF_PIN)); + d_usrp->write_io(d_which, (CE_PIN), (CE_PIN | PDB_RF_PIN)); /* Initialize the pin levels. */ _enable(true); @@ -70,6 +70,7 @@ adf4350::adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable) adf4350::~adf4350() { + d_usrp->write_io(d_which, (0), (CE_PIN | PDB_RF_PIN)); delete d_regs; } @@ -95,9 +96,9 @@ void adf4350::_enable(bool enable) { if (enable){ /* chip enable */ - d_usrp->write_io(d_which, (CE_PIN | PDB_RF_PIN), (CE_PIN | PDB_RF_PIN)); + d_usrp->write_io(d_which, (PDB_RF_PIN), (PDB_RF_PIN)); }else{ - d_usrp->write_io(d_which, 0, (CE_PIN | PDB_RF_PIN)); + d_usrp->write_io(d_which, 0, (PDB_RF_PIN)); } } diff --git a/usrp/host/lib/db_wbxng_adf4350_regs.cc b/usrp/host/lib/db_wbxng_adf4350_regs.cc index 696b7c1d4..bc859158e 100644 --- a/usrp/host/lib/db_wbxng_adf4350_regs.cc +++ b/usrp/host/lib/db_wbxng_adf4350_regs.cc @@ -11,7 +11,7 @@ /* reg 1 */ const uint16_t adf4350_regs::s_phase = 0; /* reg 2 */ -const uint8_t adf4350_regs::s_low_noise_and_low_spur_modes = 0; +const uint8_t adf4350_regs::s_low_noise_and_low_spur_modes = 3; const uint8_t adf4350_regs::s_muxout = 6; const uint8_t adf4350_regs::s_reference_doubler = 0; const uint8_t adf4350_regs::s_rdiv2 = 0; diff --git a/usrp2/host/apps/stdin_int32_fft.py b/usrp2/host/apps/stdin_int32_fft.py index 5391863a5..1596fa00d 100755 --- a/usrp2/host/apps/stdin_int32_fft.py +++ b/usrp2/host/apps/stdin_int32_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -152,7 +152,7 @@ class app_top_block(stdgui2.std_top_block): if True: self.myform['freq'].set_value(target_freq) # update displayed value if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.set_baseband_freq(target_freq) + self.scope.set_baseband_freq(target_freq) return True return False diff --git a/vrt/include/vrt/expanded_header.h b/vrt/include/vrt/expanded_header.h index 0cfca04a1..b3333a72e 100644 --- a/vrt/include/vrt/expanded_header.h +++ b/vrt/include/vrt/expanded_header.h @@ -27,6 +27,9 @@ namespace vrt { + static const size_t HEADER_MAX_N32_BIT_WORDS = 7; + static const size_t TRAILER_MAX_N32_BIT_WORDS = 1; + /*! * \brief All headers and trailer for VRT IF-Data, Extension-Data, * IF-Context and Extension-Context packets. @@ -73,7 +76,17 @@ namespace vrt { bool trailer_p() const { return (header & VRTH_HAS_TRAILER) != 0 && data_p(); } - // parser + /*! + * \brief unparse expanded header, fill-in the words of a vrt packet header and trailer + * This method is only intended to fill the buffers with header and trailer information. + * The actual handling of the separate header, payload, trailer buffers is up to the caller. + */ + static void unparse(const expanded_header *hdr, // in + size_t n32_bit_words_payload, // in + uint32_t *header, // out + size_t *n32_bit_words_header, // out + uint32_t *trailer, // out + size_t *n32_bit_words_trailer);// out /*! * \brief parse packet, fill-in expanded header, start of payload and len of payload diff --git a/vrt/lib/Makefile.am b/vrt/lib/Makefile.am index 3a758eeac..303384c6e 100644 --- a/vrt/lib/Makefile.am +++ b/vrt/lib/Makefile.am @@ -41,10 +41,10 @@ libvrt_la_LIBADD = # Private headers not needed for above the API development noinst_HEADERS = \ data_handler.h \ - expanded_header_cw_tables.h \ - expanded_header_switch_body.h \ + expanded_header_parse_switch_body.h \ + expanded_header_unparse_switch_body.h \ socket_rx_buffer.h EXTRA_DIST = \ - gen_cw_tables.py \ - gen_switch_body.py + gen_parse_switch_body.py \ + gen_unparse_switch_body.py diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc index bd1d92e53..8b22fb925 100644 --- a/vrt/lib/expanded_header.cc +++ b/vrt/lib/expanded_header.cc @@ -57,8 +57,6 @@ namespace vrt { static const int HAS_FRACTIONAL_SECS = 1 << 3; static const int HAS_TRAILER = 1 << 4; -#include "expanded_header_cw_tables.h" - static int compute_codeword(const expanded_header &h) { @@ -71,6 +69,22 @@ namespace vrt { return cw; } + void expanded_header::unparse(const expanded_header *h, // in + size_t n32_bit_words_payload, // in + uint32_t *header, // out + size_t *n32_bit_words_header, // out + uint32_t *trailer, // out + size_t *n32_bit_words_trailer){// out + int cw = compute_codeword(*h); + //fills in the header (except word0), header length, trailer, trailer length + switch (cw & 0x1f){ +#include "expanded_header_unparse_switch_body.h" + } + //fill in the header word 0 with the calculated length + size_t n32_bit_words_packet = *n32_bit_words_header + n32_bit_words_payload + *n32_bit_words_trailer; + header[0] = htonl((h->header & ~VRTH_PKT_SIZE_MASK) | (n32_bit_words_packet & VRTH_PKT_SIZE_MASK)); + } + bool expanded_header::parse(const uint32_t *packet, // in size_t n32_bit_words_packet, // in @@ -78,6 +92,8 @@ namespace vrt { const uint32_t **payload, // out size_t *n32_bit_words_payload) // out { + size_t n32_bit_words_header = 0; + size_t n32_bit_words_trailer = 0; size_t len = n32_bit_words_packet; const uint32_t *p = packet; @@ -99,18 +115,18 @@ namespace vrt { len = h->pkt_size(); // valid length of packet int cw = compute_codeword(*h); - if (cw_header_len(cw) + cw_trailer_len(cw) > len) - return false; // negative payload len + switch (cw & 0x1f){ +#include "expanded_header_parse_switch_body.h" + } - *payload = p + cw_header_len(cw); - *n32_bit_words_payload = len - (cw_header_len(cw) + cw_trailer_len(cw)); + if (n32_bit_words_header + n32_bit_words_trailer > len) + return false; // negative payload len - // printf("parse: hdr = 0x%08x, cw = 0x%02x, cw_header_len(cw) = %d, cw_trailer_len(cw) = %d\n", - // h->header, cw, cw_header_len(cw), cw_trailer_len(cw)); + *payload = p + n32_bit_words_header; + *n32_bit_words_payload = len - (n32_bit_words_header + n32_bit_words_trailer); - switch (cw & 0x1f){ -#include "expanded_header_switch_body.h" - } + // printf("parse: hdr = 0x%08x, cw = 0x%02x, n32_bit_words_header = %d, n32_bit_words_trailer = %d\n", + // h->header, cw, n32_bit_words_header, n32_bit_words_trailer); return true; } diff --git a/vrt/lib/expanded_header_cw_tables.h b/vrt/lib/expanded_header_cw_tables.h deleted file mode 100644 index fbb9c6b81..000000000 --- a/vrt/lib/expanded_header_cw_tables.h +++ /dev/null @@ -1,14 +0,0 @@ -inline static size_t cw_header_len(int cw){ - static const size_t s_cw_header_len[32] = { - 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, - }; - return s_cw_header_len[cw]; -} - -inline static size_t cw_trailer_len(int cw){ - static const size_t s_cw_trailer_len[32] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - }; - return s_cw_trailer_len[cw]; -} - diff --git a/vrt/lib/expanded_header_switch_body.h b/vrt/lib/expanded_header_parse_switch_body.h index 40e575c2c..6bfaf3799 100644 --- a/vrt/lib/expanded_header_switch_body.h +++ b/vrt/lib/expanded_header_parse_switch_body.h @@ -3,7 +3,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 1; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 1: @@ -11,7 +13,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 2; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 2: @@ -19,7 +23,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 3; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 3: @@ -27,7 +33,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 4; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 4: @@ -35,7 +43,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[1]); h->fractional_secs = 0; + n32_bit_words_header = 2; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 5: @@ -43,7 +53,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[2]); h->fractional_secs = 0; + n32_bit_words_header = 3; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 6: @@ -51,7 +63,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = ntohl(p[3]); h->fractional_secs = 0; + n32_bit_words_header = 4; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 7: @@ -59,7 +73,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = ntohl(p[4]); h->fractional_secs = 0; + n32_bit_words_header = 5; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 8: @@ -67,7 +83,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); + n32_bit_words_header = 3; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 9: @@ -75,7 +93,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); + n32_bit_words_header = 4; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 10: @@ -83,7 +103,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); + n32_bit_words_header = 5; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 11: @@ -91,7 +113,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); + n32_bit_words_header = 6; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 12: @@ -99,7 +123,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[1]); h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); + n32_bit_words_header = 4; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 13: @@ -107,7 +133,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[2]); h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); + n32_bit_words_header = 5; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 14: @@ -115,7 +143,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = ntohl(p[3]); h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); + n32_bit_words_header = 6; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 15: @@ -123,7 +153,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = ntohl(p[4]); h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]); + n32_bit_words_header = 7; h->trailer = 0; + n32_bit_words_trailer = 0; break; case 16: @@ -131,7 +163,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 1; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 17: @@ -139,7 +173,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 2; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 18: @@ -147,7 +183,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 3; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 19: @@ -155,7 +193,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = 0; h->fractional_secs = 0; + n32_bit_words_header = 4; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 20: @@ -163,7 +203,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[1]); h->fractional_secs = 0; + n32_bit_words_header = 2; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 21: @@ -171,7 +213,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[2]); h->fractional_secs = 0; + n32_bit_words_header = 3; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 22: @@ -179,7 +223,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = ntohl(p[3]); h->fractional_secs = 0; + n32_bit_words_header = 4; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 23: @@ -187,7 +233,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = ntohl(p[4]); h->fractional_secs = 0; + n32_bit_words_header = 5; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 24: @@ -195,7 +243,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); + n32_bit_words_header = 3; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 25: @@ -203,7 +253,9 @@ h->class_id = 0; h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); + n32_bit_words_header = 4; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 26: @@ -211,7 +263,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); + n32_bit_words_header = 5; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 27: @@ -219,7 +273,9 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = 0; h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); + n32_bit_words_header = 6; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 28: @@ -227,7 +283,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[1]); h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); + n32_bit_words_header = 4; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 29: @@ -235,7 +293,9 @@ h->class_id = 0; h->integer_secs = ntohl(p[2]); h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]); + n32_bit_words_header = 5; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 30: @@ -243,7 +303,9 @@ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]); h->integer_secs = ntohl(p[3]); h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]); + n32_bit_words_header = 6; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; case 31: @@ -251,6 +313,8 @@ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]); h->integer_secs = ntohl(p[4]); h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]); + n32_bit_words_header = 7; h->trailer = ntohl(p[len-1]); + n32_bit_words_trailer = 1; break; diff --git a/vrt/lib/expanded_header_unparse_switch_body.h b/vrt/lib/expanded_header_unparse_switch_body.h new file mode 100644 index 000000000..ca6e14989 --- /dev/null +++ b/vrt/lib/expanded_header_unparse_switch_body.h @@ -0,0 +1,272 @@ + case 0: + *n32_bit_words_header = 1; + *n32_bit_words_trailer = 0; + break; + + case 1: + header[1] = htonl(h->stream_id); + *n32_bit_words_header = 2; + *n32_bit_words_trailer = 0; + break; + + case 2: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + *n32_bit_words_header = 3; + *n32_bit_words_trailer = 0; + break; + + case 3: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + *n32_bit_words_trailer = 0; + break; + + case 4: + header[1] = htonl(h->integer_secs); + *n32_bit_words_header = 2; + *n32_bit_words_trailer = 0; + break; + + case 5: + header[1] = htonl(h->stream_id); + header[2] = htonl(h->integer_secs); + *n32_bit_words_header = 3; + *n32_bit_words_trailer = 0; + break; + + case 6: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl(h->integer_secs); + *n32_bit_words_header = 4; + *n32_bit_words_trailer = 0; + break; + + case 7: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl(h->integer_secs); + *n32_bit_words_header = 5; + *n32_bit_words_trailer = 0; + break; + + case 8: + header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 3; + *n32_bit_words_trailer = 0; + break; + + case 9: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + *n32_bit_words_trailer = 0; + break; + + case 10: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 5; + *n32_bit_words_trailer = 0; + break; + + case 11: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 6; + *n32_bit_words_trailer = 0; + break; + + case 12: + header[1] = htonl(h->integer_secs); + header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + *n32_bit_words_trailer = 0; + break; + + case 13: + header[1] = htonl(h->stream_id); + header[2] = htonl(h->integer_secs); + header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 5; + *n32_bit_words_trailer = 0; + break; + + case 14: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl(h->integer_secs); + header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 6; + *n32_bit_words_trailer = 0; + break; + + case 15: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl(h->integer_secs); + header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[6] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 7; + *n32_bit_words_trailer = 0; + break; + + case 16: + *n32_bit_words_header = 1; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 17: + header[1] = htonl(h->stream_id); + *n32_bit_words_header = 2; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 18: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + *n32_bit_words_header = 3; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 19: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 20: + header[1] = htonl(h->integer_secs); + *n32_bit_words_header = 2; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 21: + header[1] = htonl(h->stream_id); + header[2] = htonl(h->integer_secs); + *n32_bit_words_header = 3; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 22: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl(h->integer_secs); + *n32_bit_words_header = 4; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 23: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl(h->integer_secs); + *n32_bit_words_header = 5; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 24: + header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 3; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 25: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 26: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 5; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 27: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 6; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 28: + header[1] = htonl(h->integer_secs); + header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 4; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 29: + header[1] = htonl(h->stream_id); + header[2] = htonl(h->integer_secs); + header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[4] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 5; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 30: + header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[2] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[3] = htonl(h->integer_secs); + header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[5] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 6; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + + case 31: + header[1] = htonl(h->stream_id); + header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff)); + header[3] = htonl((uint32_t)((h->class_id >> 0) & 0xffffffff)); + header[4] = htonl(h->integer_secs); + header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff)); + header[6] = htonl((uint32_t)((h->fractional_secs >> 0) & 0xffffffff)); + *n32_bit_words_header = 7; + trailer[0] = htonl(h->trailer); + *n32_bit_words_trailer = 1; + break; + diff --git a/vrt/lib/gen_cw_tables.py b/vrt/lib/gen_cw_tables.py deleted file mode 100755 index 803a392e8..000000000 --- a/vrt/lib/gen_cw_tables.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -import sys - -# dispatch codeword bits -HAS_STREAM_ID = 1 << 0; -HAS_CLASS_ID = 1 << 1; -HAS_INTEGER_SECS = 1 << 2; -HAS_FRACTIONAL_SECS = 1 << 3; -HAS_TRAILER = 1 << 4; - -def main(): - f = sys.stdout - header_len = 32 * [0] - trailer_len = 32 * [0] - - for cw in range(32): - t = 0 - if cw & HAS_TRAILER: t += 1 - trailer_len[cw] = t - - t = 1 - if cw & HAS_STREAM_ID: t += 1 - if cw & HAS_CLASS_ID: t += 2 - if cw & HAS_INTEGER_SECS: t += 1 - if cw & HAS_FRACTIONAL_SECS: t += 2 - header_len[cw] = t - - write_table(f, "cw_header_len", header_len) - write_table(f, "cw_trailer_len", trailer_len) - -def write_table(f, name, table): - f.write("inline static size_t ") - f.write(name) - f.write("(int cw){\n") - - f.write(" static const size_t s_") - f.write(name) - f.write("[32] = {\n ") - for t in table: - f.write("%d, " % (t,)) - f.write("\n };\n") - - f.write(" return s_") - f.write(name) - f.write("[cw];\n}\n\n") - - -if __name__ == '__main__': - main() diff --git a/vrt/lib/gen_switch_body.py b/vrt/lib/gen_parse_switch_body.py index 105fa76a7..d13e490b7 100755 --- a/vrt/lib/gen_switch_body.py +++ b/vrt/lib/gen_parse_switch_body.py @@ -48,13 +48,17 @@ def do_case(f, cw): f.write("h->%s = 0;\n" % (name,)) return 0 + def dolength(index): + f.write(" n32_bit_words_header = %d;\n"%index) + def dotrailer(name, mask): - f.write(" ") if cw & mask: - f.write("h->%s = ntohl(p[len-1]);\n" % (name,)) + f.write(" h->%s = ntohl(p[len-1]);\n" % (name,)) + f.write(" n32_bit_words_trailer = 1;\n") return 1 else: - f.write("h->%s = 0;\n" % (name,)) + f.write(" h->%s = 0;\n" % (name,)) + f.write(" n32_bit_words_trailer = 0;\n") return 0 f.write(" case %d:\n" % (cw,)) @@ -64,6 +68,7 @@ def do_case(f, cw): index += do64("class_id", HAS_CLASS_ID, index) index += do32("integer_secs", HAS_INTEGER_SECS, index) index += do64("fractional_secs", HAS_FRACTIONAL_SECS, index) + dolength(index) dotrailer("trailer", HAS_TRAILER) f.write(" break;\n\n") diff --git a/vrt/lib/gen_unparse_switch_body.py b/vrt/lib/gen_unparse_switch_body.py new file mode 100755 index 000000000..6c7cd01b3 --- /dev/null +++ b/vrt/lib/gen_unparse_switch_body.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import sys + +# dispatch codeword bits +HAS_STREAM_ID = 1 << 0; +HAS_CLASS_ID = 1 << 1; +HAS_INTEGER_SECS = 1 << 2; +HAS_FRACTIONAL_SECS = 1 << 3; +HAS_TRAILER = 1 << 4; + +def do_case(f, cw): + + def do32(name, mask, index): + if cw & mask: + f.write(" header[%d] = htonl(h->%s);\n" % (index, name)) + return 1 + return 0 + + def do64(name, mask, index): + if cw & mask: + f.write(" header[%d] = htonl((uint32_t)((h->%s >> 32) & 0xffffffff));\n" % (index, name)) + f.write(" header[%d] = htonl((uint32_t)((h->%s >> 0) & 0xffffffff));\n" % (index+1, name)) + return 2 + return 0 + + def dolength(index): + f.write(" *n32_bit_words_header = %d;\n"%index) + + def dotrailer(name, mask): + if cw & mask: + f.write(" trailer[%d] = htonl(h->%s);\n" % (0, name)) + f.write(" *n32_bit_words_trailer = 1;\n") + return 1 + else: + f.write(" *n32_bit_words_trailer = 0;\n") + return 0 + + f.write(" case %d:\n" % (cw,)) + + index = 1 + index += do32("stream_id", HAS_STREAM_ID, index) + index += do64("class_id", HAS_CLASS_ID, index) + index += do32("integer_secs", HAS_INTEGER_SECS, index) + index += do64("fractional_secs", HAS_FRACTIONAL_SECS, index) + dolength(index) + dotrailer("trailer", HAS_TRAILER) + + f.write(" break;\n\n") + + +def main(): + f = sys.stdout + + for cw in range(32): + do_case(f, cw) + + +if __name__ == '__main__': + main() |