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/Makefile.am | 1 + gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py | 101 +++++++++++++++++++-------- gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py | 3 +- gr-uhd/grc/uhd_block_tree.xml | 23 ++++++ gr-uhd/grc/uhd_mimo_sink.xml | 3 +- gr-uhd/grc/uhd_mimo_source.xml | 3 +- gr-uhd/grc/uhd_simple_sink.xml | 1 - gr-uhd/grc/uhd_simple_source.xml | 1 - 8 files changed, 99 insertions(+), 37 deletions(-) create mode 100644 gr-uhd/grc/uhd_block_tree.xml diff --git a/gr-uhd/grc/Makefile.am b/gr-uhd/grc/Makefile.am index 04b7dca36..d424ca709 100644 --- a/gr-uhd/grc/Makefile.am +++ b/gr-uhd/grc/Makefile.am @@ -36,6 +36,7 @@ BUILT_SOURCES = \ $(generated_uhd_single_usrp_blocks) dist_grcblocks_DATA = \ + uhd_block_tree.xml \ $(BUILT_SOURCES) # add the deprecated files 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) - 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) +\#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 Addr dev_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, diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py index 5b3cb5b5a..5b87719e5 100755 --- a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py +++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py @@ -24,7 +24,6 @@ MAIN_TMPL = """\ UHD: Single USRP $sourk.title() uhd_single_usrp_$(sourk) - UHD from gnuradio import uhd uhd.single_usrp_$(sourk)(\$dev_addr, uhd.io_type_t.\$type.type, \$nchan) self.\$(id).set_subdev_spec(\$sd_spec) @@ -115,7 +114,7 @@ self.\$(id).set_antenna(\$ant$(n), $n) $params $max_nchan >= \$nchan - \$nchan >= 0 + \$nchan > 0 (len((\$sd_spec).split()) or 1) == \$nchan <$sourk> $direction diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml new file mode 100644 index 000000000..e8c4f069d --- /dev/null +++ b/gr-uhd/grc/uhd_block_tree.xml @@ -0,0 +1,23 @@ + + + + + + UHD + uhd_single_usrp_source + uhd_single_usrp_sink + uhd_multi_usrp_source + uhd_multi_usrp_sink + + + UHD (DEPRECATED) + uhd_simple_source + uhd_simple_sink + uhd_mimo_source + uhd_mimo_sink + + diff --git a/gr-uhd/grc/uhd_mimo_sink.xml b/gr-uhd/grc/uhd_mimo_sink.xml index 2f5f2011f..13865c913 100644 --- a/gr-uhd/grc/uhd_mimo_sink.xml +++ b/gr-uhd/grc/uhd_mimo_sink.xml @@ -1,8 +1,7 @@ - UHD MIMO Sink + UHD MIMO Sink (DEPRECATED) uhd_mimo_sink - UHD from gnuradio import uhd uhd.mimo_sink($nchan, $args, uhd.io_type_t.$type.type) self.$(id).set_samp_rate_all($samp_rate) diff --git a/gr-uhd/grc/uhd_mimo_source.xml b/gr-uhd/grc/uhd_mimo_source.xml index d8f4e6d66..6167838b0 100644 --- a/gr-uhd/grc/uhd_mimo_source.xml +++ b/gr-uhd/grc/uhd_mimo_source.xml @@ -1,8 +1,7 @@ - UHD MIMO Source + UHD MIMO Source (DEPRECATED) uhd_mimo_source - UHD from gnuradio import uhd uhd.mimo_source($nchan, $args, uhd.io_type_t.$type.type) self.$(id).set_samp_rate_all($samp_rate) diff --git a/gr-uhd/grc/uhd_simple_sink.xml b/gr-uhd/grc/uhd_simple_sink.xml index 66dc5bf14..ee6051432 100644 --- a/gr-uhd/grc/uhd_simple_sink.xml +++ b/gr-uhd/grc/uhd_simple_sink.xml @@ -7,7 +7,6 @@ UHD Simple Sink (DEPRECATED) uhd_simple_sink - UHD from gnuradio import uhd uhd.simple_sink($args, uhd.io_type_t.$type.type) self.$(id).set_subdev_spec($sd_spec) diff --git a/gr-uhd/grc/uhd_simple_source.xml b/gr-uhd/grc/uhd_simple_source.xml index 00c60f41d..825981d66 100644 --- a/gr-uhd/grc/uhd_simple_source.xml +++ b/gr-uhd/grc/uhd_simple_source.xml @@ -7,7 +7,6 @@ UHD Simple Source (DEPRECATED) uhd_simple_source - UHD from gnuradio import uhd uhd.simple_source($args, uhd.io_type_t.$type.type) self.$(id).set_subdev_spec($sd_spec) -- cgit