From d029af43c3367a4611185ade70639cc6b7cc5e3d Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Mon, 18 Oct 2010 14:09:23 -0700
Subject: uhd: created multi usrp grc wrapper generator, removed mimo gen and
checked in its generated files
---
gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 211 ++++++++++++++++++++++++++++
1 file changed, 211 insertions(+)
create mode 100755 gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
(limited to 'gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py')
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
new file mode 100755
index 000000000..a4da53a18
--- /dev/null
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -0,0 +1,211 @@
+#!/usr/bin/env python
+"""
+Copyright 2010 Free Software Foundation, Inc.
+
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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
+"""
+
+MAIN_TMPL = """\
+
+
+ UHD: Multi USRP $sourk.title()
+ uhd_multi_usrp_$(sourk)
+ UHD
+ from gnuradio import uhd
+ uhd.multi_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan)
+self.\$(id).set_subdev_spec(\$sd_spec)
+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)
+self.\$(id).set_gain(\$gain$(n), $n)
+ \#if \$ant$(n)()
+self.\$(id).set_antenna(\$ant$(n), $n)
+ \#end if
+\#end if
+#end for
+
+ set_samp_rate(\$samp_rate)
+ #for $n in range($max_nchan)
+ set_center_freq(\$center_freq$(n), $n)
+ set_gain(\$gain$(n), $n)
+ set_antenna(\$ant$(n), $n)
+ #end for
+
+ Input Type
+ type
+ enum
+
+
+
+
+ Num Channels
+ nchan
+ 1
+ int
+ part
+
+
+
+
+
+ Device Addr
+ dev_addr
+ addr=192.168.10.2
+ string
+
+ \#if \$dev_addr()
+ none
+ \#else
+ part
+ \#end if
+
+
+
+ Subdev Spec
+ sd_spec
+
+ string
+
+ \#if \$sd_spec()
+ none
+ \#else
+ part
+ \#end if
+
+
+
+ Samp Rate (Sps)
+ samp_rate
+ samp_rate
+ real
+
+ $params
+ $max_nchan >= \$nchan
+ \$nchan >= 0
+ (len((\$sd_spec).split()) or 1) == \$nchan
+ <$sourk>
+ $direction
+ \$type
+ \$type.vlen
+ \$nchan
+ $sourk>
+
+The UHD Multi USRP $sourk.title() Block:
+
+Device Address:
+The device address is a delimited string used to locate UHD devices on your system. \\
+If left blank, the first UHD device found will be used. \\
+Used args to specify a specfic device.
+USRP2 Example: addr=192.168.10.2 192.168.10.3
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \\
+The UHD device driver will try its best to match the requested sample rate. \\
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Subdevice specification:
+Select the subdevice or subdevices for each channel using a markup string. \\
+The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
+If left blank, the UHD will try to select the first subdevice on your system. \\
+See the application notes for further details.
+Single channel example: A:AB
+Dual channel example: A:AB B:0
+
+Antenna:
+For subdevices/daughterboards with only one antenna, this may be left blank. \\
+Otherwise, the user should specify one of the possible antenna choices. \\
+See the daughterboard application notes for the possible antenna choices.
+
+
+"""
+
+PARAMS_TMPL = """
+
+ Ch$(n): Center Freq (Hz)
+ center_freq$(n)
+ 0
+ real
+ \#if \$nchan() > $n then 'none' else 'all'#
+
+
+ Ch$(n): Gain (dB)
+ gain$(n)
+ 0
+ real
+ \#if \$nchan() > $n then 'none' else 'all'#
+
+
+ Ch$(n): Antenna
+ ant$(n)
+
+ string
+
+ \#if not \$nchan() > $n
+ all
+ \#elif \$ant$(n)()
+ none
+ \#else
+ part
+ \#end if
+
+
+"""
+
+def parse_tmpl(_tmpl, **kwargs):
+ from Cheetah import Template
+ return str(Template.Template(_tmpl, kwargs))
+
+max_num_channels = 4
+
+if __name__ == '__main__':
+ import sys
+ for file in sys.argv[1:]:
+ if 'source' in file:
+ sourk = 'source'
+ direction = 'out'
+ elif 'sink' in file:
+ sourk = 'sink'
+ direction = 'in'
+ else: raise Exception, 'is %s a source or sink?'%file
+
+ params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
+ open(file, 'w').write(parse_tmpl(MAIN_TMPL,
+ max_nchan=max_num_channels,
+ params=params,
+ sourk=sourk,
+ direction=direction,
+ ))
--
cgit
From 1e5db4248e2488e0f1b44ac1405d78e16c2408d8 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Mon, 18 Oct 2010 16:13:10 -0700
Subject: uhd: work on multi usrp blocks, use block tree to categorize blocks,
deprecate mimo blocks
---
gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 101 ++++++++++++++++++++--------
1 file changed, 72 insertions(+), 29 deletions(-)
(limited to 'gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py')
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index a4da53a18..8de4408d5 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -24,10 +24,16 @@ MAIN_TMPL = """\
UHD: Multi USRP $sourk.title()uhd_multi_usrp_$(sourk)
- UHDfrom gnuradio import uhduhd.multi_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan)
-self.\$(id).set_subdev_spec(\$sd_spec)
+\#if \$sync()
+self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
+\#end if
+#for $m in range($max_mboards)
+\#if \$num_mboards() > $m
+self.\$(id).set_subdev_spec(\$sd_spec$(m), $m)
+\#end if
+#end for
self.\$(id).set_samp_rate(\$samp_rate)
#for $n in range($max_nchan)
\#if \$nchan() > $n
@@ -62,25 +68,6 @@ self.\$(id).set_antenna(\$ant$(n), $n)
vlen:2
-
- Num Channels
- nchan
- 1
- int
- part
-
-
-
-
Device Addrdev_addr
@@ -95,18 +82,61 @@ self.\$(id).set_antenna(\$ant$(n), $n)
- Subdev Spec
- sd_spec
+ Sync
+ sync
+ sync
+ enum
+ \#if \$sync() then 'none' else 'part'#
+
+
+
+
+ Num Mboards
+ num_mboards
+ 2
+ int
+ #for $m in range(1, $max_mboards)
+
+ #end for
+
+ #for $m in range($max_mboards)
+
+ Mb$(m): Subdev Spec
+ sd_spec$(m)string
- \#if \$sd_spec()
+ \#if not \$num_mboards() > $m
+ all
+ \#elif \$sd_spec$(m)()
none
\#else
part
\#end if
+ #end for
+
+ Num Channels
+ nchan
+ 2
+ int
+ #for $n in range(1, $max_nchan)
+
+ #end for
+
Samp Rate (Sps)samp_rate
@@ -115,8 +145,10 @@ self.\$(id).set_antenna(\$ant$(n), $n)
$params
$max_nchan >= \$nchan
- \$nchan >= 0
- (len((\$sd_spec).split()) or 1) == \$nchan
+ \$nchan > 0
+ $max_mboards >= \$num_mboards
+ \$num_mboards > 0
+ \$nchan >= \$num_mboards
<$sourk>
$direction\$type
@@ -132,18 +164,27 @@ If left blank, the first UHD device found will be used. \\
Used args to specify a specfic device.
USRP2 Example: addr=192.168.10.2 192.168.10.3
+Num Motherboards:
+Selects the number of USRP motherboards in this multi-USRP configuration.
+
+Num Channels:
+Selects the total number of channels in this multi-USRP configuration.
+Ex: 4 motherboards with 2 channels per board = 8 channels total
+
Sample rate:
The sample rate is the number of samples per second input by this block. \\
The UHD device driver will try its best to match the requested sample rate. \\
If the requested rate is not possible, the UHD block will print an error at runtime.
Subdevice specification:
+Each motherboard should have its own subdevice specification \\
+and all subdevice specifications should be the same length. \\
Select the subdevice or subdevices for each channel using a markup string. \\
The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
If left blank, the UHD will try to select the first subdevice on your system. \\
See the application notes for further details.
-Single channel example: A:AB
-Dual channel example: A:AB B:0
+Single channel example: :AB
+Dual channel example: :A :B
Antenna:
For subdevices/daughterboards with only one antenna, this may be left blank. \\
@@ -189,7 +230,8 @@ def parse_tmpl(_tmpl, **kwargs):
from Cheetah import Template
return str(Template.Template(_tmpl, kwargs))
-max_num_channels = 4
+max_num_mboards = 4
+max_num_channels = max_num_mboards*4
if __name__ == '__main__':
import sys
@@ -205,6 +247,7 @@ if __name__ == '__main__':
params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
max_nchan=max_num_channels,
+ max_mboards=max_num_mboards,
params=params,
sourk=sourk,
direction=direction,
--
cgit
From 7f46efca9cb0c87e9130c117ac41650f6e0c25cc Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Mon, 18 Oct 2010 16:49:08 -0700
Subject: uhd: renamed make function params, cleanup, clock config for multi
usrp
---
gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
(limited to 'gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py')
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index 8de4408d5..aa550157d 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -25,8 +25,17 @@ MAIN_TMPL = """\
UHD: Multi USRP $sourk.title()uhd_multi_usrp_$(sourk)from gnuradio import uhd
- uhd.multi_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan)
+ uhd.multi_usrp_$(sourk)(
+ device_addr=\$dev_addr,
+ io_type=uhd.io_type_t.\$type.type,
+ num_channels=\$nchan,
+)
\#if \$sync()
+clk_cfg = uhd.clock_config_t()
+clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(clk_cfg, ~0);
self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
\#end if
#for $m in range($max_mboards)
--
cgit
From 343cba5663d0eefdd3ee3918bef812dc1bd75508 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Mon, 18 Oct 2010 18:29:20 -0700
Subject: uhd: tweaked and tested multi usrp with a single channel
---
gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
(limited to 'gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py')
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index aa550157d..229716732 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -31,15 +31,15 @@ MAIN_TMPL = """\
num_channels=\$nchan,
)
\#if \$sync()
-clk_cfg = uhd.clock_config_t()
-clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
-clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
-clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
-self.\$(id).set_clock_config(clk_cfg, ~0);
+_clk_cfg = uhd.clock_config_t()
+_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(_clk_cfg, uhd.ALL_MBOARDS);
self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
\#end if
#for $m in range($max_mboards)
-\#if \$num_mboards() > $m
+\#if \$num_mboards() > $m and \$sd_spec$(m)()
self.\$(id).set_subdev_spec(\$sd_spec$(m), $m)
\#end if
#end for
@@ -110,7 +110,7 @@ self.\$(id).set_antenna(\$ant$(n), $n)
num_mboards2int
- #for $m in range(1, $max_mboards)
+ #for $m in range(1, $max_mboards+1)
@@ -59,6 +62,7 @@ self.\$(id).set_antenna(\$ant$(n), $n)
set_center_freq(\$center_freq$(n), $n)set_gain(\$gain$(n), $n)set_antenna(\$ant$(n), $n)
+ set_bandwidth(\$bw$(n), $n)
#end for
Input Type
@@ -196,9 +200,14 @@ Single channel example: :AB
Dual channel example: :A :B
Antenna:
-For subdevices/daughterboards with only one antenna, this may be left blank. \\
+For subdevices with only one antenna, this may be left blank. \\
Otherwise, the user should specify one of the possible antenna choices. \\
See the daughterboard application notes for the possible antenna choices.
+
+Bandwidth:
+To use the default bandwidth filter setting, this should be zero. \\
+Only certain subdevices have configurable bandwidth filters. \\
+See the daughterboard application notes for possible configurations.
"""
@@ -233,6 +242,21 @@ PARAMS_TMPL = """
\#end if
+
+ Ch$(n): Bandwidth (Hz)
+ bw$(n)
+ 0
+ real
+
+ \#if not \$nchan() > $n
+ all
+ \#elif \$bw$(n)()
+ none
+ \#else
+ part
+ \#end if
+
+
"""
def parse_tmpl(_tmpl, **kwargs):
--
cgit
From 3dab5d93a45928baa4fb23878d644751e06943a0 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Thu, 28 Oct 2010 13:24:23 -0700
Subject: uhd: make a tune_request_t that inherits from float for GRC, added
docs
---
gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
(limited to 'gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py')
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index ae40e551a..112d88159 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -180,15 +180,6 @@ USRP2 Example: addr=192.168.10.2 192.168.10.3
Num Motherboards:
Selects the number of USRP motherboards in this multi-USRP configuration.
-Num Channels:
-Selects the total number of channels in this multi-USRP configuration.
-Ex: 4 motherboards with 2 channels per board = 8 channels total
-
-Sample rate:
-The sample rate is the number of samples per second input by this block. \\
-The UHD device driver will try its best to match the requested sample rate. \\
-If the requested rate is not possible, the UHD block will print an error at runtime.
-
Subdevice specification:
Each motherboard should have its own subdevice specification \\
and all subdevice specifications should be the same length. \\
@@ -199,6 +190,21 @@ See the application notes for further details.
Single channel example: :AB
Dual channel example: :A :B
+Num Channels:
+Selects the total number of channels in this multi-USRP configuration.
+Ex: 4 motherboards with 2 channels per board = 8 channels total
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \\
+The UHD device driver will try its best to match the requested sample rate. \\
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Center frequency:
+The center frequency is the overall frequency of the RF chain. \\
+For greater control of how the UHD tunes elements in the RF chain, \\
+pass a tune_request_t object rather than a simple target frequency.
+Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off)
+
Antenna:
For subdevices with only one antenna, this may be left blank. \\
Otherwise, the user should specify one of the possible antenna choices. \\
--
cgit