[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/03: uhd: Normalized gain ranges
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/03: uhd: Normalized gain ranges |
Date: |
Fri, 30 Jan 2015 00:34:24 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 339396411d866cea375134a10698c9f8edcb78a0
Author: Martin Braun <address@hidden>
Date: Thu Jan 15 18:00:44 2015 +0100
uhd: Normalized gain ranges
---
gr-uhd/examples/grc/.gitignore | 1 +
gr-uhd/examples/grc/uhd_normalized_gain.grc | 1104 +++++++++++++++++++++++++++
gr-uhd/grc/gen_uhd_usrp_blocks.py | 40 +-
gr-uhd/include/gnuradio/uhd/usrp_sink.h | 33 +-
gr-uhd/include/gnuradio/uhd/usrp_source.h | 33 +-
gr-uhd/lib/usrp_sink_impl.cc | 23 +
gr-uhd/lib/usrp_sink_impl.h | 2 +
gr-uhd/lib/usrp_source_impl.cc | 23 +
gr-uhd/lib/usrp_source_impl.h | 2 +
9 files changed, 1256 insertions(+), 5 deletions(-)
diff --git a/gr-uhd/examples/grc/.gitignore b/gr-uhd/examples/grc/.gitignore
new file mode 100644
index 0000000..f104652
--- /dev/null
+++ b/gr-uhd/examples/grc/.gitignore
@@ -0,0 +1 @@
+*.py
diff --git a/gr-uhd/examples/grc/uhd_normalized_gain.grc
b/gr-uhd/examples/grc/uhd_normalized_gain.grc
new file mode 100644
index 0000000..55235c8
--- /dev/null
+++ b/gr-uhd/examples/grc/uhd_normalized_gain.grc
@@ -0,0 +1,1104 @@
+<?xml version='1.0' encoding='ASCII'?>
+<?grc format='1' created='3.7.7'?>
+<flow_graph>
+ <timestamp>Mon Jan 26 15:44:21 2015</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>uhd_normalized_gain</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Example to showcase absolute vs. relative gain settings</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value>Works with any device and gain range!</value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_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>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-8, -4)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1e6</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(0, 92)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_label</key>
+ <param>
+ <key>id</key>
+ <value>variable_qtgui_label_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Absolute Gain</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>real</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>abs_gain</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(320, -4)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_null_sink</key>
+ <param>
+ <key>id</key>
+ <value>blocks_null_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>bus_conns</key>
+ <value>[[0,],]</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(504, 176)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>uhd_usrp_source</key>
+ <param>
+ <key>id</key>
+ <value>uhd_usrp_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>fc32</value>
+ </param>
+ <param>
+ <key>otw</key>
+ <value></value>
+ </param>
+ <param>
+ <key>stream_args</key>
+ <value></value>
+ </param>
+ <param>
+ <key>stream_chans</key>
+ <value>[]</value>
+ </param>
+ <param>
+ <key>dev_addr</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>dev_args</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>sync</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_rate</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>num_mboards</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>clock_source0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>nchan</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>center_freq0</key>
+ <value>1e9</value>
+ </param>
+ <param>
+ <key>gain0</key>
+ <value>gain</value>
+ </param>
+ <param>
+ <key>norm_gain0</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>ant0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw0</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain1</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain2</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain3</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain4</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain5</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain6</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain7</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain8</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain9</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain10</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant10</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain11</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant11</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain12</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant12</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain13</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant13</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain14</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant14</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain15</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant15</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain16</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant16</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain17</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant17</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain18</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant18</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain19</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant19</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain20</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant20</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain21</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant21</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain22</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant22</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain23</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant23</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain24</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant24</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain25</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant25</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain26</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant26</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain27</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant27</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain28</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant28</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain29</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant29</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain30</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant30</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>norm_gain31</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ant31</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(248, 149)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>gain</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Normalized Gain</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>.5</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>.02</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-8, 165)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_function_probe</key>
+ <param>
+ <key>id</key>
+ <value>abs_gain</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>5</value>
+ </param>
+ <param>
+ <key>block_id</key>
+ <value>uhd_usrp_source_0</value>
+ </param>
+ <param>
+ <key>function_name</key>
+ <value>get_gain</value>
+ </param>
+ <param>
+ <key>function_args</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>poll_rate</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>alias</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(160, -10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>uhd_usrp_source_0</source_block_id>
+ <sink_block_id>blocks_null_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py
b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index c31ee13..fda1b9d 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -70,7 +70,11 @@ self.\$(id).set_samp_rate(\$samp_rate)
#for $n in range($max_nchan)
\#if \$nchan() > $n
self.\$(id).set_center_freq(\$center_freq$(n), $n)
+\#if \$norm_gain${n}()
+self.\$(id).set_normalized_gain(\$gain$(n), $n)
+\#else
self.\$(id).set_gain(\$gain$(n), $n)
+\#end if
\#if \$ant$(n)()
self.\$(id).set_antenna(\$ant$(n), $n)
\#end if
@@ -83,7 +87,12 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
<callback>set_samp_rate(\$samp_rate)</callback>
#for $n in range($max_nchan)
<callback>set_center_freq(\$center_freq$(n), $n)</callback>
- <callback>set_gain(\$gain$(n), $n)</callback>
+ <callback>\#if \$norm_gain${n}()
+self.\$(id).set_normalized_gain(\$gain$(n), $n)
+\#else
+self.\$(id).set_gain(\$gain$(n), $n)
+\#end if
+</callback>
<callback>set_antenna(\$ant$(n), $n)</callback>
<callback>set_bandwidth(\$bw$(n), $n)</callback>
#end for
@@ -312,6 +321,9 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
<check>\$num_mboards > 0</check>
<check>\$nchan >= \$num_mboards</check>
<check>(not \$stream_chans()) or (\$nchan ==
len(\$stream_chans))</check>
+ #for $n in range($max_nchan)
+ <check>(\$norm_gain${n} and \$gain${n} >= 0 and \$gain${n} <= 1)
or not \$norm_gain${n}</check>
+ #end for
<sink>
<name>command</name>
<type>message</type>
@@ -410,13 +422,34 @@ PARAMS_TMPL = """
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
- <name>Ch$(n): Gain (dB)</name>
+ <name>Ch$(n): Gain Value</name>
<key>gain$(n)</key>
<value>0</value>
- <type>real</type>
+ <type>float</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
</param>
<param>
+ <name>Ch$(n): Gain Type</name>
+ <key>norm_gain$(n)</key>
+ <value>False</value>
+ <type>bool</type>
+ <hide>\#if \$nchan() <= $n
+ all
+ \#elif bool(\$norm_gain${n}())
+ none
+ \#else
+ part
+ \#end if</hide>
+ <option>
+ <name>Absolute (dB)</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>Normalized</name>
+ <key>True</key>
+ </option>
+ </param>
+ <param>
<name>Ch$(n): Antenna</name>
<key>ant$(n)</key>
<value></value>
@@ -453,6 +486,7 @@ LENTAG_PARAM = """ <param>
<key>len_tag_name</key>
<value></value>
<type>string</type>
+ <hide>\#if len(str(\$len_tag_name())) then 'none' else
'part'#</hide>
</param>"""
LENTAG_ARG = """
diff --git a/gr-uhd/include/gnuradio/uhd/usrp_sink.h
b/gr-uhd/include/gnuradio/uhd/usrp_sink.h
index ce8b18b..affdfbf 100644
--- a/gr-uhd/include/gnuradio/uhd/usrp_sink.h
+++ b/gr-uhd/include/gnuradio/uhd/usrp_sink.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010-2014 Free Software Foundation, Inc.
+ * Copyright 2010-2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -244,6 +244,24 @@ namespace gr {
size_t chan = 0) = 0;
/*!
+ * Set the normalized gain.
+ *
+ * The normalized gain is always in [0, 1], regardless of the device.
+ * 0 corresponds to minimum gain (usually 0 dB, but make sure to read
the device
+ * notes in the UHD manual) and 1 corresponds to maximum gain.
+ * This will work for any UHD device. Use get_gain() to see which dB
value
+ * the normalized gain value corresponds to.
+ *
+ * Note that it is not possible to specify a gain name for this function.
+ *
+ * \throws A runtime_error if \p norm_gain is not within the valid range.
+ *
+ * \param norm_gain the gain in fractions of the gain range (must be 0
<= norm_gain <= 1)
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_normalized_gain(double norm_gain, size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
@@ -260,6 +278,19 @@ namespace gr {
size_t chan = 0) = 0;
/*!
+ * Returns the normalized gain.
+ *
+ * The normalized gain is always in [0, 1], regardless of the device.
+ * See also set_normalized_gain().
+ *
+ * Note that it is not possible to specify a gain name for this function,
+ * the result is over the entire gain chain.
+ *
+ * \param chan the channel index 0 to N-1
+ */
+ virtual double get_normalized_gain(size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting of named stage.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
diff --git a/gr-uhd/include/gnuradio/uhd/usrp_source.h
b/gr-uhd/include/gnuradio/uhd/usrp_source.h
index 75e8f8b..478c875 100644
--- a/gr-uhd/include/gnuradio/uhd/usrp_source.h
+++ b/gr-uhd/include/gnuradio/uhd/usrp_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010-2014 Free Software Foundation, Inc.
+ * Copyright 2010-2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -223,6 +223,24 @@ namespace gr {
size_t chan = 0) = 0;
/*!
+ * Set the normalized gain.
+ *
+ * The normalized gain is always in [0, 1], regardless of the device.
+ * 0 corresponds to minimum gain (usually 0 dB, but make sure to read
the device
+ * notes in the UHD manual) and 1 corresponds to maximum gain.
+ * This will work for any UHD device. Use get_gain() to see which dB
value
+ * the normalized gain value corresponds to.
+ *
+ * Note that it is not possible to specify a gain name for this function.
+ *
+ * \throws A runtime_error if \p norm_gain is not within the valid range.
+ *
+ * \param norm_gain the gain in fractions of the gain range (must be 0
<= norm_gain <= 1)
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_normalized_gain(double norm_gain, size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
@@ -239,6 +257,19 @@ namespace gr {
size_t chan = 0) = 0;
/*!
+ * Returns the normalized gain.
+ *
+ * The normalized gain is always in [0, 1], regardless of the device.
+ * See also set_normalized_gain().
+ *
+ * Note that it is not possible to specify a gain name for this function,
+ * the result is over the entire gain chain.
+ *
+ * \param chan the channel index 0 to N-1
+ */
+ virtual double get_normalized_gain(size_t chan = 0) = 0;
+
+ /*!
* Get the actual dboard gain setting of named stage.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc
index c184f0a..dccab65 100644
--- a/gr-uhd/lib/usrp_sink_impl.cc
+++ b/gr-uhd/lib/usrp_sink_impl.cc
@@ -235,6 +235,16 @@ namespace gr {
return _dev->set_tx_gain(gain, name, chan);
}
+ void usrp_sink_impl::set_normalized_gain(double norm_gain, size_t chan)
+ {
+ if (norm_gain > 1.0 || norm_gain < 0.0) {
+ throw std::runtime_error("Normalized gain out of range, must be in [0,
1].");
+ }
+ ::uhd::gain_range_t gain_range = get_gain_range(chan);
+ double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start()))
+ gain_range.start();
+ set_gain(abs_gain, chan);
+ }
+
double
usrp_sink_impl::get_gain(size_t chan)
{
@@ -249,6 +259,19 @@ namespace gr {
return _dev->get_tx_gain(name, chan);
}
+ double
+ usrp_sink_impl::get_normalized_gain(size_t chan)
+ {
+ ::uhd::gain_range_t gain_range = get_gain_range(chan);
+ double norm_gain =
+ (get_gain(chan) - gain_range.start()) /
+ (gain_range.stop() - gain_range.start());
+ // Avoid rounding errors:
+ if (norm_gain > 1.0) return 1.0;
+ if (norm_gain < 0.0) return 0.0;
+ return norm_gain;
+ }
+
std::vector<std::string>
usrp_sink_impl::get_gain_names(size_t chan)
{
diff --git a/gr-uhd/lib/usrp_sink_impl.h b/gr-uhd/lib/usrp_sink_impl.h
index 21bb991..0cc7f59 100644
--- a/gr-uhd/lib/usrp_sink_impl.h
+++ b/gr-uhd/lib/usrp_sink_impl.h
@@ -69,6 +69,7 @@ namespace gr {
::uhd::freq_range_t get_freq_range(size_t chan);
double get_gain(size_t chan);
double get_gain(const std::string &name, size_t chan);
+ double get_normalized_gain(size_t chan);
std::vector<std::string> get_gain_names(size_t chan);
::uhd::gain_range_t get_gain_range(size_t chan);
::uhd::gain_range_t get_gain_range(const std::string &name, size_t chan);
@@ -95,6 +96,7 @@ namespace gr {
size_t chan);
void set_gain(double gain, size_t chan);
void set_gain(double gain, const std::string &name, size_t chan);
+ void set_normalized_gain(double gain, size_t chan);
void set_antenna(const std::string &ant, size_t chan);
void set_bandwidth(double bandwidth, size_t chan);
double get_bandwidth(size_t chan);
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index 3142627..c3b6753 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -203,6 +203,16 @@ namespace gr {
return _dev->set_rx_gain(gain, name, chan);
}
+ void usrp_source_impl::set_normalized_gain(double norm_gain, size_t chan)
+ {
+ if (norm_gain > 1.0 || norm_gain < 0.0) {
+ throw std::runtime_error("Normalized gain out of range, must be in [0,
1].");
+ }
+ ::uhd::gain_range_t gain_range = get_gain_range(chan);
+ double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start()))
+ gain_range.start();
+ set_gain(abs_gain, chan);
+ }
+
double
usrp_source_impl::get_gain(size_t chan)
{
@@ -217,6 +227,19 @@ namespace gr {
return _dev->get_rx_gain(name, chan);
}
+ double
+ usrp_source_impl::get_normalized_gain(size_t chan)
+ {
+ ::uhd::gain_range_t gain_range = get_gain_range(chan);
+ double norm_gain =
+ (get_gain(chan) - gain_range.start()) /
+ (gain_range.stop() - gain_range.start());
+ // Avoid rounding errors:
+ if (norm_gain > 1.0) return 1.0;
+ if (norm_gain < 0.0) return 0.0;
+ return norm_gain;
+ }
+
std::vector<std::string>
usrp_source_impl::get_gain_names(size_t chan)
{
diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h
index 6de4c9c..c4a96aa 100644
--- a/gr-uhd/lib/usrp_source_impl.h
+++ b/gr-uhd/lib/usrp_source_impl.h
@@ -69,6 +69,7 @@ namespace gr {
::uhd::freq_range_t get_freq_range(size_t chan);
double get_gain(size_t chan);
double get_gain(const std::string &name, size_t chan);
+ double get_normalized_gain(size_t chan);
std::vector<std::string> get_gain_names(size_t chan);
::uhd::gain_range_t get_gain_range(size_t chan);
::uhd::gain_range_t get_gain_range(const std::string &name, size_t chan);
@@ -95,6 +96,7 @@ namespace gr {
size_t chan);
void set_gain(double gain, size_t chan);
void set_gain(double gain, const std::string &name, size_t chan);
+ void set_normalized_gain(double gain, size_t chan);
void set_antenna(const std::string &ant, size_t chan);
void set_bandwidth(double bandwidth, size_t chan);
double get_bandwidth(size_t chan);