2
Copyright 2011 Free Software Foundation, Inc.
4
This file is part of GNU Radio
6
GNU Radio Companion is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public License
8
as published by the Free Software Foundation; either version 2
9
of the License, or (at your option) any later version.
11
GNU Radio Companion is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24
<name>SHD: SMINI $sourk.title()</name>
25
<key>shd_smini_$(sourk)</key>
26
<import>from gnuradio import shd</import>
27
<make>shd.smini_$(sourk)(
28
device_addr=\$dev_addr,
29
io_type=shd.io_type.\$type.type,
33
self.\$(id).set_clock_rate(\$clock_rate, shd.ALL_MBOARDS)
35
#for $m in range($max_mboards)
36
########################################################################
37
\#if \$num_mboards() > $m and \$ref_source$(m)() == 'external'
38
self.\$(id).set_clock_config(shd.clock_config.external(), $m)
40
########################################################################
41
\#if \$num_mboards() > $m and \$ref_source$(m)() == 'internal'
42
self.\$(id).set_clock_config(shd.clock_config.internal(), $m)
44
########################################################################
45
\#if \$num_mboards() > $m and \$ref_source$(m)() == 'mimo'
46
_config = shd.clock_config()
47
_config.ref_source = shd.clock_config.REF_MIMO
48
_config.pps_source = shd.clock_config.PPS_MIMO
49
self.\$(id).set_clock_config(_config, $m)
51
########################################################################
52
\#if \$num_mboards() > $m and \$sd_spec$(m)()
53
self.\$(id).set_subdev_spec(\$sd_spec$(m), $m)
55
########################################################################
58
self.\$(id).set_time_unknown_pps(shd.time_spec())
60
self.\$(id).set_samp_rate(\$samp_rate)
61
#for $n in range($max_nchan)
63
self.\$(id).set_center_freq(\$center_freq$(n), $n)
64
self.\$(id).set_gain(\$gain$(n), $n)
68
<callback>set_samp_rate(\$samp_rate)</callback>
69
#for $n in range($max_nchan)
70
<callback>set_center_freq(\$center_freq$(n), $n)</callback>
71
<callback>set_gain(\$gain$(n), $n)</callback>
74
<name>$(direction.title())put Type</name>
80
<opt>type:COMPLEX_FLOAT32</opt>
86
<opt>type:COMPLEX_INT16</opt>
91
<name>Device Addr</name>
108
<hide>\#if \$sync() then 'none' else 'part'#</hide>
110
<name>unknown PPS</name>
114
<name>don't sync</name>
119
<name>Clock Rate (Hz)</name>
120
<key>clock_rate</key>
123
<hide>\#if \$clock_rate() then 'none' else 'part'#</hide>
130
<name>Num Mboards</name>
131
<key>num_mboards</key>
135
#for $m in range(1, $max_mboards+1)
142
#for $m in range($max_mboards)
144
<name>Mb$(m): Ref Source</name>
145
<key>ref_source$(m)</key>
149
\#if not \$num_mboards() > $m
151
\#elif \$ref_source$(m)()
157
<option><name>Default</name><key></key></option>
158
<option><name>Internal</name><key>internal</key></option>
159
<option><name>External</name><key>external</key></option>
160
<option><name>MIMO Cable</name><key>mimo</key></option>
163
<name>Mb$(m): Subdev Spec</name>
164
<key>sd_spec$(m)</key>
168
\#if not \$num_mboards() > $m
170
\#elif \$sd_spec$(m)()
179
<name>Num Channels</name>
183
#for $n in range(1, $max_nchan+1)
191
<name>Samp Rate (Sps)</name>
193
<value>samp_rate</value>
197
<check>$max_nchan >= \$nchan</check>
198
<check>\$nchan > 0</check>
199
<check>$max_mboards >= \$num_mboards</check>
200
<check>\$num_mboards > 0</check>
201
<check>\$nchan >= \$num_mboards</check>
203
<name>$direction</name>
205
<vlen>\$type.vlen</vlen>
206
<nports>\$nchan</nports>
209
The SHD SMINI $sourk.title() Block:
212
The device address is a delimited string used to locate SHD devices on your system. \\
213
If left blank, the first SHD device found will be used. \\
214
Use the device address to specify a specific device or list of devices.
215
SMINI1 Example: serial=12345678
216
SMINI2 Example: type=xmini
219
Selects the number of SMINI motherboards in this device configuration.
222
Where the motherboard should sync its time and clock references.
223
If source and sink blocks reference the same device,
224
it is only necessary to set the reference source on one of the blocks.
226
Subdevice specification:
227
Each motherboard should have its own subdevice specification \\
228
and all subdevice specifications should be the same length. \\
229
Select the subdevice or subdevices for each channel using a markup string. \\
230
The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
231
If left blank, the SHD will try to select the first subdevice on your system. \\
232
See the application notes for further details.
233
Single channel example: :AB
234
Dual channel example: :A :B
237
Selects the total number of channels in this multi-SMINI configuration.
238
Ex: 4 motherboards with 2 channels per board = 8 channels total
241
The sample rate is the number of samples per second input by this block. \\
242
The SHD device driver will try its best to match the requested sample rate. \\
243
If the requested rate is not possible, the SHD block will print an error at runtime.
246
The center frequency is the overall frequency of the RF chain. \\
247
For greater control of how the SHD tunes elements in the RF chain, \\
248
pass a tune_request object rather than a simple target frequency.
249
Tuning with an LO offset example: shd.tune_request(freq, lo_off)
257
<name>Ch$(n): Center Freq (Hz)</name>
258
<key>center_freq$(n)</key>
261
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
264
<name>Ch$(n): Gain (dB)</name>
268
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
272
def parse_tmpl(_tmpl, **kwargs):
273
from Cheetah import Template
274
return str(Template.Template(_tmpl, kwargs))
277
max_num_channels = max_num_mboards*4
279
if __name__ == '__main__':
281
for file in sys.argv[1:]:
288
else: raise Exception, 'is %s a source or sink?'%file
290
params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
291
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
292
max_nchan=max_num_channels,
293
max_mboards=max_num_mboards,