Revision a5aece05

b/host/README.txt
25 25
DBSRX
26 26
DBSRX2
27 27
TVRX
28
TVRX2
28 29
SBX
29 30

  
30 31
###############################################
b/host/docs/dboards.rst
258 258

  
259 259
Bandwidth: 6MHz
260 260

  
261
^^^^^^^^^^^^^^^^^^^^^^^^^^^
262
TVRX2
263
^^^^^^^^^^^^^^^^^^^^^^^^^^^
264
The TVRX2 board has 2 real-mode subdevices.
265
It is operated at a low IF.
266

  
267
Receive Subdevices:
268
* **Subdevice RX1:** real signal on antenna J100
269
* **Subdevice RX2:** real signal on antenna J140
270

  
271
Note: The TVRX2 has always-on AGC, the software controllable gain is the
272
final gain stage which controls the AGC set-point for output to ADC.
273

  
274
Receive Gains:
275

  
276
* **IF**, Range: 0.0-30.0dB
277

  
278
Bandwidth: 1.7MHz, 6MHz, 7MHz, 8MHz, 10MHz
279

  
280
Sensors:
281

  
282
* **lo_locked**: boolean for LO lock state
283
* **rssi**: float for measured RSSI in dBm
284
* **temperature**: float for measured temperature in degC
285

  
261 286
------------------------------------------------------------------------
262 287
Daughterboard Modifications
263 288
------------------------------------------------------------------------
b/host/lib/ic_reg_maps/CMakeLists.txt
92 92
    ${CMAKE_CURRENT_BINARY_DIR}/tuner_4937di5_regs.hpp
93 93
)
94 94

  
95
LIBUHD_PYTHON_GEN_SOURCE(
96
    ${CMAKE_CURRENT_SOURCE_DIR}/gen_tda18272hnm_regs.py
97
    ${CMAKE_CURRENT_BINARY_DIR}/tda18272hnm_regs.hpp
98
)
99

  
95 100
UNSET(LIBUHD_PYTHON_GEN_SOURCE_DEPS)
b/host/lib/ic_reg_maps/gen_tda18272hnm_regs.py
1
#!/usr/bin/env python
2
#
3
# Copyright 2010 Ettus Research LLC
4
#
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
#
18

  
19
########################################################################
20
# Template for raw text data describing write registers
21
# name addr[bit range inclusive] default optional enums
22
########################################################################
23
REGS_TMPL="""\
24
########################################################################
25
## Note: offsets given from perspective of data bits (excludes address)
26
########################################################################
27
##
28
########################################################################
29
##  ID_byte_1 (0x00) Read
30
########################################################################
31
##reserved as 1       0x00[7]       1
32
ident_14_8            0x00[0:6]     0
33
########################################################################
34
##  ID_byte_2 (0x01) Read
35
########################################################################
36
ident_7_0             0x01[0:7]     0
37
##~ident                ident_7_0, ident_14_8
38
########################################################################
39
##  ID_byte_3 (0x02) Read
40
########################################################################
41
major_rev             0x02[4:7]     0
42
minor_rev             0x02[0:3]     0
43
########################################################################
44
##  Thermo_byte_1 (0x03) Read
45
########################################################################
46
##reserved            0x03[7]       0
47
tm_d                  0x03[0:6]     0   ## 22-127deg C junction temp
48
########################################################################
49
##  Thermo_byte_2 (0x04) Write
50
########################################################################
51
##reserved            0x04[1:7]     0
52
tm_on                 0x04[0]       0   sensor_off, sensor_on
53
########################################################################
54
##  Power_state_byte_1 (0x05) Read
55
########################################################################
56
##reserved            0x05[2:7]     0
57
por                   0x05[1]       0   read, reset
58
lo_lock               0x05[0]       0   unlocked, locked
59
########################################################################
60
##  Power_state_byte_2 (0x06) Read/Write ## Standby modes
61
########################################################################
62
##reserved            0x06[4:7]     0
63
sm                    0x06[3]       0   normal, standby
64
sm_pll                0x06[2]       0   on, off
65
sm_lna                0x06[1]       0   on, off
66
##resevered as 0      0x06[0]       0
67
## (sm, sm_pll, sm_lna) only valid values are 000, 100, 110, and 111
68
########################################################################
69
##  Input_Power_Level_byte (0x07) Read
70
########################################################################
71
##reserved            0x07[7]       0
72
power_level           0x07[0:6]     0   ## 40dB_Vrms to 110dB_Vrms
73
## Trigger power level calculation with MSM_byte_1 and MSM_byte_2
74
########################################################################
75
##  IRQ_status (0x08) Read/Write
76
########################################################################
77
irq_status            0x08[7]       0   cleared, set
78
##reserved            0x08[6]       0
79
irq_xtalcal_end       0x08[5]       0   false, true
80
irq_rssi_end          0x08[4]       0   false, true
81
irq_localc_end        0x08[3]       0   false, true
82
irq_rfcal_end         0x08[2]       0   false, true
83
irq_ircal_end         0x08[1]       0   false, true
84
irq_rccal_end         0x08[0]       0   false, true
85
########################################################################
86
##  IRQ_enable (0x09) Read/Write
87
########################################################################
88
irq_enable            0x09[7]       1   false, true
89
##reserved            0x09[6]       0
90
irq_xtalcal_enable    0x09[5]       0   false, true
91
irq_rssi_enable       0x09[4]       0   false, true
92
irq_localc_enable     0x09[3]       0   false, true
93
irq_rfcal_enable      0x09[2]       0   false, true
94
irq_ircal_enable      0x09[1]       0   false, true
95
irq_rccal_enable      0x09[0]       0   false, true
96
########################################################################
97
##  IRQ_clear (0x0a) Read/Write
98
########################################################################
99
irq_clear             0x0a[7]       0   false, true
100
##reserved            0x0a[6]       0
101
irq_xtalcal_clear     0x0a[5]       0   false, true
102
irq_rssi_clear        0x0a[4]       0   false, true
103
irq_localc_clear      0x0a[3]       0   false, true
104
irq_rfcal_clear       0x0a[2]       0   false, true
105
irq_ircal_clear       0x0a[1]       0   false, true
106
irq_rccal_clear       0x0a[0]       0   false, true
107
########################################################################
108
##  IRQ_set (0x0b) Read
109
########################################################################
110
irq_set               0x0b[7]       0   false, true
111
##reserved            0x0b[6]       0
112
irq_xtalcal_set       0x0b[5]       0   false, true
113
irq_rssi_set          0x0b[4]       0   false, true
114
irq_localc_set        0x0b[3]       0   false, true
115
irq_rfcal_set         0x0b[2]       0   false, true
116
irq_ircal_set         0x0b[1]       0   false, true
117
irq_rccal_set         0x0b[0]       0   false, true
118
########################################################################
119
##  AGC1_byte_1 (0x0c) Read/Write
120
########################################################################
121
lt_enable             0x0c[7]       0
122
agc1_6_15db           0x0c[6]       1
123
##reserved            0x0c[4:5]     0
124
agc1_top              0x0c[0:3]     0
125
########################################################################
126
##  AGC2_byte_1 (0x0d) Read
127
########################################################################
128
##reserved            0x0d[5:7]     0
129
agc2_top              0x0d[0:4]     0xf
130
########################################################################
131
##  AGCK_byte_1 (0x0e) Read/Write
132
########################################################################
133
agcs_up_step_assym    0x0e[6:7]     3
134
agcs_up_step          0x0e[5]       1
135
pulse_shaper_disable  0x0e[4]       0   vsync_pulse, 500us_pulse
136
agck_step             0x0e[2:3]     0
137
agck_mode             0x0e[0:1]     1   analog_tv=1, digital_tv=2
138
########################################################################
139
##  RF_AGC_byte_1 (0x0f) Read/Write
140
########################################################################
141
pd_rfagc_adapt        0x0f[7]       0   on, off
142
rfagc_adapt_top       0x0f[5:6]     0
143
rfagc_low_bw          0x0f[4]       1
144
rf_atten_3db          0x0f[3]       0   0db, 3db ## FIXME
145
agc3_top              0x0f[0:2]     1
146
########################################################################
147
##  IR_MIXER_byte_1 (0x10) Read/Write
148
########################################################################
149
##reserved            0x10[4:7]     0
150
agc4_top              0x10[0:3]     1
151
########################################################################
152
##  AGC5_byte_1 (0x11) Read/Write
153
########################################################################
154
##reserved            0x11[7]       0
155
agcs_do_step_assym    0x11[5:6]     2
156
agc5_hpf              0x11[4]       1   off, on
157
agc5_top              0x11[0:3]     1
158
########################################################################
159
##  IF_AGC_byte (0x12) Read/Write
160
########################################################################
161
##reserved            0x12[3:7]     0
162
if_level              0x12[0:2]     0   0_5vpp=7, 0_6vpp=6, 0_7vpp=5, 0_85vpp=4, 0_8vpp=3, 1_0vpp=2, 1_25vpp=1, 2_0vpp=0
163
########################################################################
164
##  IF_byte_1 (0x13) Read/Write
165
########################################################################
166
if_hp_fc              0x13[6:7]     0   0_4mhz, 0_85mhz, 1_0mhz, 1_5mhz
167
if_atsc_notch         0x13[5]       0   off, on
168
lp_fc_offset          0x13[3:4]     0   0_percent, m4_percent, m8_percent, forbidden
169
lp_fc                 0x13[0:2]     3   1_7mhz=4, 6_0mhz=0, 7_0mhz=1, 8_0mhz=2, 10_0mhz=3
170
########################################################################
171
##  Reference_byte (0x14) Read/Write
172
########################################################################
173
i2c_clock_mode        0x14[7]       0
174
digital_clock         0x14[6]       1   spread_off, spread_on
175
##reserved            0x14[5]       0
176
xtalosc_anareg_en     0x14[4]       0
177
##reserved            0x14[2:3]     0
178
xtout                 0x14[0:1]     0   no=0, 16mhz=3
179
########################################################################
180
##  IF_Frequency_byte (0x15) Read/Write
181
########################################################################
182
if_freq               0x15[0:7]     0   ## IF frequency = if_freq*50 (kHz)
183
########################################################################
184
##  RF_Frequency_byte_1 (0x16) Read/Write
185
########################################################################
186
##reserved            0x16[4:7]     0
187
rf_freq_19_16         0x16[0:3]     0
188
########################################################################
189
##  RF_Frequency_byte_2 (0x17) Read/Write
190
########################################################################
191
rf_freq_15_8          0x17[0:7]     0
192
########################################################################
193
##  RF_Frequency_byte_3 (0x18) Read/Write
194
########################################################################
195
rf_freq_7_0           0x18[0:7]     0
196
~rf_freq              rf_freq_7_0, rf_freq_15_8, rf_freq_19_16
197
## RF Frequency = rf_freq (kHz)
198
########################################################################
199
##  MSM_byte_1 (0x19) Read/Write
200
########################################################################
201
rssi_meas             0x19[7]       0
202
rf_cal_av             0x19[6]       0
203
rf_cal                0x19[5]       0
204
ir_cal_loop           0x19[4]       0
205
ir_cal_image          0x19[3]       0
206
ir_cal_wanted         0x19[2]       0
207
rc_cal                0x19[1]       0
208
calc_pll              0x19[0]       0
209
########################################################################
210
##  MSM_byte_2 (0x1a) Read
211
########################################################################
212
##reserved            0x1a[2:7]     0
213
xtalcal_launch        0x1a[1]       0
214
msm_launch            0x1a[0]       0
215
########################################################################
216
##  PSM_byte_1 (0x1b) Read
217
########################################################################
218
psm_agc1              0x1b[6:7]     0
219
psm_stob              0x1b[5]       0
220
psmrfpoly             0x1b[4]       0
221
psm_mixer             0x1b[3]       0
222
psm_ifpoly            0x1b[2]       0
223
psm_lodriver          0x1b[0:1]     0
224
########################################################################
225
##  DCC_byte_1 (0x1c) Read
226
########################################################################
227
dcc_bypass            0x1c[7]       0
228
dcc_slow              0x1c[6]       0
229
dcc_psm               0x1c[5]       0
230
##reserved            0x1c[0:4]     0
231
########################################################################
232
##  FLO_Max_byte (0x1d) Read
233
########################################################################
234
##reserved            0x1d[6:7]     0
235
fmax_lo               0x1d[0:5]     0xA
236
########################################################################
237
##  IR_Cal_byte_1 (0x1e) Read
238
########################################################################
239
ir_loop               0x1e[6:7]     0
240
ir_target             0x1e[3:5]     0
241
ir_gstep              0x1e[0:2]     0
242
########################################################################
243
##  IR_Cal_byte_2 (0x1f) Read
244
########################################################################
245
ir_corr_boost         0x1f[7]       0
246
ir_freqlow_sel        0x1f[6]       0
247
ir_mode_ram_store     0x1f[5]       0
248
ir_freqlow            0x1f[0:4]     0
249
########################################################################
250
##  IR_Cal_byte_3 (0x20) Read
251
########################################################################
252
##reserved            0x20[5:7]     0
253
ir_freqmid            0x20[0:4]     0
254
########################################################################
255
##  IR_Cal_byte_4 (0x21) Read
256
########################################################################
257
##reserved            0x21[5:7]     0
258
coarse_ir_freqhigh    0x21[4]       0
259
ir_freqhigh           0x21[0:3]     0
260
########################################################################
261
##  Vsync_Mgt_byte (0x22) Read
262
########################################################################
263
pd_vsync_mgt          0x22[7]       0
264
pd_ovld               0x22[6]       0
265
pd_udld               0x22[5]       0
266
agc_ovld_top          0x22[2:4]     0
267
agc_ovld_timer        0x22[0:1]     0
268
########################################################################
269
##  IR_MIXER_byte_2 (0x23) Read/Write
270
########################################################################
271
ir_mixer_loop_off     0x23[7]       0
272
ir_mixer_do_step      0x23[5:6]     0
273
##reserved            0x23[2:4]     0
274
hi_pass               0x23[1]       0   disable, enable ## FIXME Logic Unclear
275
if_notch              0x23[0]       1   on, off
276
########################################################################
277
##  AGC1_byte_2 (0x24) Read
278
########################################################################
279
agc1_loop_off         0x24[7]       0
280
agc1_do_step          0x24[5:6]     2
281
force_agc1_gain       0x24[4]       0
282
agc1_gain             0x24[0:3]     8
283
########################################################################
284
##  AGC5_byte_2 (0x25) Read
285
########################################################################
286
agc5_loop_off         0x25[7]       0
287
agc5_do_step          0x25[5:6]     0
288
##reserved            0x25[4]       0
289
force_agc5_gain       0x25[3]       0
290
##reserved            0x25[2]       0
291
agc5_gain             0x25[0:1]     2
292
########################################################################
293
##  RF_Cal_byte_1 (0x26) Read
294
########################################################################
295
rfcal_offset_cprog0   0x26[6:7]     0
296
rfcal_freq0           0x26[4:5]     0
297
rfcal_offset_cprog1   0x26[2:3]     0
298
rfcal_freq1           0x26[0:1]     0
299
########################################################################
300
##  RF_Cal_byte_2 (0x27) Read
301
########################################################################
302
rfcal_offset_cprog2   0x27[6:7]     0
303
rfcal_freq2           0x27[4:5]     0
304
rfcal_offset_cprog3   0x27[2:3]     0
305
rfcal_freq3           0x27[0:1]     0
306
########################################################################
307
##  RF_Cal_byte_3 (0x28) Read
308
########################################################################
309
rfcal_offset_cprog4   0x28[6:7]     0
310
rfcal_freq4           0x28[4:5]     0
311
rfcal_offset_cprog5   0x28[2:3]     0
312
rfcal_freq5           0x28[0:1]     0
313
########################################################################
314
##  RF_Cal_byte_4 (0x29) Read
315
########################################################################
316
rfcal_offset_cprog6   0x29[6:7]     0
317
rfcal_freq6           0x29[4:5]     0
318
rfcal_offset_cprog7   0x29[2:3]     0
319
rfcal_freq7           0x29[0:1]     0
320
########################################################################
321
##  RF_Cal_byte_5 (0x2a) Read
322
########################################################################
323
rfcal_offset_cprog8   0x2a[6:7]     0
324
rfcal_freq8           0x2a[4:5]     0
325
rfcal_offset_cprog9   0x2a[2:3]     0
326
rfcal_freq9           0x2a[0:1]     0
327
########################################################################
328
##  RF_Cal_byte_6 (0x2b) Read
329
########################################################################
330
rfcal_offset_cprog10  0x2b[6:7]     0
331
rfcal_freq10          0x2b[4:5]     0
332
rfcal_offset_cprog11  0x2b[2:3]     0
333
rfcal_freq11          0x2b[0:1]     0
334
########################################################################
335
##  RF_Filter_byte_1 (0x2c) Read
336
########################################################################
337
rf_filter_bypass      0x2c[7]       0
338
##reserved as 0       0x2c[6]       0
339
agc2_loop_off         0x2c[5]       0
340
force_agc2_gain       0x2c[4]       0
341
rf_filter_gv          0x2c[2:3]     2
342
rf_filter_band        0x2c[0:1]     0
343
########################################################################
344
##  RF_Filter_byte_2 (0x2d) Read
345
########################################################################
346
rf_filter_cap         0x2d[0:7]     0
347
########################################################################
348
##  RF_Filter_byte_3 (0x2e) Read
349
########################################################################
350
agc2_do_step          0x2e[6:7]     2
351
gain_taper            0x2e[0:5]     0
352
########################################################################
353
##  RF_Band_Pass_Filter_byte (0x2f) Read
354
########################################################################
355
rf_bpf_bypass         0x2f[7]       0
356
##reserved            0x2f[3:6]     0
357
rf_bpf                0x2f[0:2]     0
358
########################################################################
359
##  CP_Current_byte (0x30) Read
360
########################################################################
361
##reserved            0x30[7]       0
362
n_cp_current          0x30[0:6]     0x68
363
########################################################################
364
##  AGC_Det_Out_byte (0x31) Read
365
########################################################################
366
up_agc5               0x31[7]       0
367
do_agc5               0x31[6]       0
368
up_agc4               0x31[5]       0
369
do_agc4               0x31[4]       0
370
up_agc2               0x31[3]       0
371
do_agc2               0x31[2]       0
372
up_agc1               0x31[1]       0
373
do_agc1               0x31[0]       0
374
########################################################################
375
##  RF_AGC_Gain_byte_1 (0x32) Read
376
########################################################################
377
#set $lna_gain_names = ', '.join(map(lambda x: {0: '', 1: 'm'}[3*x-12 < 0] + str(abs(3*x-12)) + 'db=' + str(x), range(0,10)))
378
##reserved            0x32[6:7]     0
379
agc2_gain_read        0x32[4:5]     3   m11db, m8db, m5db, m2db
380
agc1_gain_read        0x32[0:3]     9   $lna_gain_names
381
########################################################################
382
##  RF_AGC_Gain_byte_2 (0x33) Read
383
########################################################################
384
#set $top_agc3_read_names = ', '.join(map(lambda x: str(int(round(1.92*x+94))) + 'dbuvrms=' + str(x), range(0,8)))
385
##reserved            0x33[3:7]     0
386
top_agc3_read         0x33[0:2]     0   $top_agc3_read_names
387
########################################################################
388
##  IF_AGC_Gain_byte (0x34) Read
389
########################################################################
390
#set $lpf_gain_names = ', '.join(map(lambda x: str(3*x) + 'db=' + str(x), range(0,4)))
391
#set $ir_mixer_names = ', '.join(map(lambda x: str(3*x+2) + 'db=' + str(x), range(0,5)))
392
##reserved            0x34[5:7]     0
393
agc5_gain_read        0x34[3:4]     3   $lpf_gain_names
394
agc4_gain_read        0x34[0:2]     4   $ir_mixer_names
395
########################################################################
396
##  Power_byte_1 (0x35) Read
397
########################################################################
398
rssi                  0x35[0:7]     0
399
########################################################################
400
##  Power_byte_2 (0x36) Read
401
########################################################################
402
##reserved            0x36[6:7]     0
403
rssi_av               0x36[5]       0
404
##reserved            0x36[4]       0
405
rssi_cap_reset_en     0x36[3]       1
406
rssi_cap_val          0x36[2]       1
407
rssi_ck_speed         0x36[1]       0
408
rssi_dicho_not        0x36[0]       1
409
########################################################################
410
##  Misc_byte_1 (0x37) Read/Write
411
########################################################################
412
rfcal_phi2            0x37[6:7]     1
413
dds_polarity          0x37[5]       0
414
rfcal_deltagain       0x37[1:4]     1
415
irq_polarity          0x37[0]       0   raised_vcc, raised_low
416
########################################################################
417
##  rfcal_log_1 (0x38) Read
418
########################################################################
419
rfcal_log_1           0x38[0:7]     0
420
########################################################################
421
##  rfcal_log_2 (0x39) Read
422
########################################################################
423
rfcal_log_2           0x39[0:7]     0
424
########################################################################
425
##  rfcal_log_3 (0x3a) Read
426
########################################################################
427
rfcal_log_3           0x3a[0:7]     0
428
########################################################################
429
##  rfcal_log_4 (0x3b) Read
430
########################################################################
431
rfcal_log_4           0x3b[0:7]     0
432
########################################################################
433
##  rfcal_log_5 (0x3c) Read
434
########################################################################
435
rfcal_log_5           0x3c[0:7]     0
436
########################################################################
437
##  rfcal_log_6 (0x3d) Read
438
########################################################################
439
rfcal_log_6           0x3d[0:7]     0
440
########################################################################
441
##  rfcal_log_7 (0x3e) Read
442
########################################################################
443
rfcal_log_7           0x3e[0:7]     0
444
########################################################################
445
##  rfcal_log_8 (0x3f) Read
446
########################################################################
447
rfcal_log_8           0x3f[0:7]     0
448
########################################################################
449
##  rfcal_log_9 (0x40) Read
450
########################################################################
451
rfcal_log_9           0x40[0:7]     0
452
########################################################################
453
##  rfcal_log_10 (0x41) Read
454
########################################################################
455
rfcal_log_10          0x41[0:7]     0
456
########################################################################
457
##  rfcal_log_11 (0x42) Read
458
########################################################################
459
rfcal_log_11          0x42[0:7]     0
460
########################################################################
461
##  rfcal_log_12 (0x43) Read
462
########################################################################
463
rfcal_log_12          0x43[0:7]     0
464
##
465
##
466
########################################################################
467
## FORBIDDEN ACCESS to 0x50-0x67 and 0xFE-0xFF
468
########################################################################
469
########################################################################
470
##  xtal_cal_dac (0x65) Write
471
########################################################################
472
magic                 0x43[7]       1   untouched, xtal_cal_dac
473
"""
474

  
475
########################################################################
476
# Template for methods in the body of the struct
477
########################################################################
478
BODY_TMPL="""\
479
boost::uint8_t get_reg(boost::uint8_t addr){
480
    boost::uint8_t reg = 0;
481
    switch(addr){
482
    #for $addr in sorted(set(map(lambda r: r.get_addr(), $regs)))
483
    case $addr:
484
        #for $reg in filter(lambda r: r.get_addr() == addr, $regs)
485
        reg |= (boost::uint8_t($reg.get_name()) & $reg.get_mask()) << $reg.get_shift();
486
        #end for
487
        break;
488
    #end for
489
    }
490
    return boost::uint8_t(reg);
491
}
492

  
493
void set_reg(boost::uint8_t addr, boost::uint8_t reg){
494
    switch(addr){
495
    #for $addr in sorted(set(map(lambda r: r.get_addr(), $regs)))
496
    case $addr:
497
        #for $reg in filter(lambda r: r.get_addr() == addr, $regs)
498
        $reg.get_name() = $(reg.get_type())((reg >> $reg.get_shift()) & $reg.get_mask());
499
        #end for
500
        break;
501
    #end for
502
    }
503
}
504
"""
505

  
506
SPLIT_REGS_HELPER_TMPL="""\
507
#for $divname in ['n','f']
508
void set_$(divname)_divider(boost::uint32_t $divname){
509
    #for $regname in sorted(map(lambda r: r.get_name(), filter(lambda r: r.get_name().find(divname + '_divider') == 0, $regs)))
510
    #end for
511
}
512
#end for
513
"""
514

  
515
if __name__ == '__main__':
516
    import common; common.generate(
517
        name='tda18272hnm_regs',
518
        regs_tmpl=REGS_TMPL,
519
        body_tmpl=BODY_TMPL,
520
        file=__file__,
521
    )
b/host/lib/usrp/dboard/CMakeLists.txt
30 30
    ${CMAKE_CURRENT_SOURCE_DIR}/db_unknown.cpp
31 31
    ${CMAKE_CURRENT_SOURCE_DIR}/db_tvrx.cpp
32 32
    ${CMAKE_CURRENT_SOURCE_DIR}/db_dbsrx2.cpp
33
    ${CMAKE_CURRENT_SOURCE_DIR}/db_tvrx2.cpp
33 34
)
34 35

  
b/host/lib/usrp/dboard/db_tvrx2.cpp
1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

  
18
// Common IO Pins
19
#define REFCLOCK_DIV_MASK    ((1 << 8)|(1 << 9)|(1 << 10))    // Three GPIO lines to CPLD for Clock Divisor Selection
20
#define REFCLOCK_DIV8        ((1 << 8)|(1 << 9)|(1 << 10))    // GPIO to set clock div8 mode
21
#define REFCLOCK_DIV7        ((0 << 8)|(1 << 9)|(1 << 10))    // GPIO to set clock div7 mode
22
#define REFCLOCK_DIV6        ((1 << 8)|(0 << 9)|(1 << 10))    // GPIO to set clock div6 mode
23
#define REFCLOCK_DIV5        ((0 << 8)|(0 << 9)|(1 << 10))    // GPIO to set clock div5 mode
24
#define REFCLOCK_DIV4        ((1 << 8)|(1 <<9))               // GPIO to set clock div4 mode
25
#define REFCLOCK_DIV3        (1 <<9)                          // GPIO to set clock div3 mode
26
#define REFCLOCK_DIV2        (1 <<8)                          // GPIO to set clock div2 mode
27
#define REFCLOCK_DIV1        ((0 << 8)|(0 << 9)|(0 << 10))    // GPIO to set clock div1 mode
28

  
29
// RX1 IO Pins
30
#define RX1_MASTERSYNC  (1 << 3)                // MASTERSYNC Signal for Slave Tuner Coordination
31
#define RX1_FREEZE      (1 << 2)                // FREEZE Signal for Slave Tuner Coordination
32
#define RX1_IRQ         (1 << 1)                // IRQ Signals TDA18272HNM State Machine Completion
33
#define RX1_VSYNC       (1 << 0)                // VSYNC Pulse for AGC Holdoff
34

  
35
// RX2 IO Pins
36
#define RX2_MASTERSYNC  (1 << 7)                // MASTERSYNC Signal for Slave Tuner Coordination
37
#define RX2_FREEZE      (1 << 6)                // FREEZE Signal for Slave Tuner Coordination
38
#define RX2_IRQ         (1 << 5)                // IRQ Signals TDA18272HNM State Machine Completion
39
#define RX2_VSYNC       (1 << 4)                // VSYNC Pulse for AGC Holdoff
40

  
41
// Pin functions
42
#define RX1_OUTPUT_MASK (0)
43
#define RX1_INPUT_MASK  (RX1_VSYNC|RX1_MASTERSYNC|RX1_FREEZE|RX1_IRQ)
44

  
45
#define RX2_OUTPUT_MASK (0)
46
#define RX2_INPUT_MASK  (RX2_VSYNC|RX2_MASTERSYNC|RX2_FREEZE|RX2_IRQ)
47

  
48
#define OUTPUT_MASK     (RX1_OUTPUT_MASK|RX2_OUTPUT_MASK|REFCLOCK_DIV_MASK)
49
#define INPUT_MASK      (RX1_INPUT_MASK|RX2_INPUT_MASK)
50

  
51

  
52
#include "tda18272hnm_regs.hpp"
53
#include <uhd/utils/static.hpp>
54
#include <uhd/utils/log.hpp>
55
#include <uhd/utils/msg.hpp>
56
#include <uhd/utils/assert_has.hpp>
57
#include <uhd/utils/algorithm.hpp>
58
#include <uhd/types/ranges.hpp>
59
#include <uhd/types/sensors.hpp>
60
#include <uhd/types/dict.hpp>
61
#include <uhd/usrp/subdev_props.hpp>
62
#include <uhd/usrp/dboard_base.hpp>
63
#include <uhd/usrp/dboard_manager.hpp>
64
#include <boost/assign/list_of.hpp>
65
#include <boost/format.hpp>
66
#include <boost/thread.hpp>
67
#include <boost/array.hpp>
68
#include <boost/math/special_functions/round.hpp>
69
#include <utility>
70
#include <cmath>
71

  
72
using namespace uhd;
73
using namespace uhd::usrp;
74
using namespace boost::assign;
75

  
76
/***********************************************************************
77
 * The TVRX2 types
78
 **********************************************************************/
79
struct tvrx2_tda18272_rfcal_result_t {
80
    boost::int8_t    delta_c;
81
    boost::int8_t    c_offset;
82
    tvrx2_tda18272_rfcal_result_t(void): delta_c(0), c_offset(0){}
83
};
84

  
85
struct tvrx2_tda18272_rfcal_coeffs_t  {
86
    boost::uint8_t   cal_number;
87
    boost::int32_t   RF_A1;
88
    boost::int32_t   RF_B1;
89
    tvrx2_tda18272_rfcal_coeffs_t(void): cal_number(0), RF_A1(0), RF_B1(0) {}
90
    tvrx2_tda18272_rfcal_coeffs_t(boost::uint32_t num): RF_A1(0), RF_B1(0) { cal_number = num; }
91
};
92

  
93
struct tvrx2_tda18272_cal_map_t {
94
    boost::array<boost::uint32_t, 4>  cal_freq;
95
    boost::array<boost::uint8_t, 4>   c_offset;
96
    tvrx2_tda18272_cal_map_t(boost::array<boost::uint32_t, 4> freqs, boost::array<boost::uint8_t, 4> offsets)
97
        { cal_freq = freqs; c_offset = offsets; }
98
};
99

  
100
struct tvrx2_tda18272_freq_map_t {
101
    boost::uint32_t  rf_max;
102
    boost::uint8_t   c_prog;
103
    boost::uint8_t   gain_taper;
104
    boost::uint8_t   rf_band;
105
    tvrx2_tda18272_freq_map_t( boost::uint32_t max, boost::uint8_t c, boost::uint8_t taper, boost::uint8_t band)
106
        { rf_max = max; c_prog = c; gain_taper = taper; rf_band = band; }
107
};
108

  
109
/***********************************************************************
110
 * The TVRX2 constants
111
 **********************************************************************/
112

  
113
static const boost::array<freq_range_t, 4> tvrx2_tda18272_rf_bands = list_of
114
    ( freq_range_t(  44.056e6, 144.408e6) )
115
    ( freq_range_t( 145.432e6, 361.496e6) )
116
    ( freq_range_t( 365.592e6, 618.520e6) )
117
    ( freq_range_t( 619.544e6, 865.304e6) )
118
;
119

  
120
#define TVRX2_TDA18272_FREQ_MAP_ENTRIES (565)
121

  
122
static const uhd::dict<boost::uint32_t, tvrx2_tda18272_cal_map_t> tvrx2_tda18272_cal_map = map_list_of
123
    (  0, tvrx2_tda18272_cal_map_t( list_of( 44032000)( 48128000)( 52224000)( 56320000), list_of(15)( 0)(10)(17) ) )
124
    (  1, tvrx2_tda18272_cal_map_t( list_of( 84992000)( 89088000)( 93184000)( 97280000), list_of( 1)( 0)(-2)( 3) ) )
125
    (  2, tvrx2_tda18272_cal_map_t( list_of(106496000)(111616000)(115712000)(123904000), list_of( 0)(-1)( 1)( 2) ) )
126
    (  3, tvrx2_tda18272_cal_map_t( list_of(161792000)(165888000)(169984000)(174080000), list_of( 3)( 0)( 1)( 2) ) )
127
    (  4, tvrx2_tda18272_cal_map_t( list_of(224256000)(228352000)(232448000)(235520000), list_of( 3)( 0)( 1)( 2) ) )
128
    (  5, tvrx2_tda18272_cal_map_t( list_of(301056000)(312320000)(322560000)(335872000), list_of( 0)(-1)( 1)( 2) ) )
129
    (  6, tvrx2_tda18272_cal_map_t( list_of(389120000)(393216000)(397312000)(401408000), list_of(-2)( 0)(-1)( 1) ) )
130
    (  7, tvrx2_tda18272_cal_map_t( list_of(455680000)(460800000)(465920000)(471040000), list_of( 0)(-2)(-3)( 1) ) )
131
    (  8, tvrx2_tda18272_cal_map_t( list_of(555008000)(563200000)(570368000)(577536000), list_of(-1)( 0)(-3)(-2) ) )
132
    (  9, tvrx2_tda18272_cal_map_t( list_of(647168000)(652288000)(658432000)(662528000), list_of(-6)(-3)( 0)(-5) ) )
133
    ( 10, tvrx2_tda18272_cal_map_t( list_of(748544000)(755712000)(762880000)(770048000), list_of(-6)(-3)( 0)(-5) ) )
134
    ( 11, tvrx2_tda18272_cal_map_t( list_of(792576000)(801792000)(809984000)(818176000), list_of(-5)(-2)( 0)(-4) ) )
135
;
136

  
137
static const std::vector<tvrx2_tda18272_freq_map_t> tvrx2_tda18272_freq_map = list_of
138
    ( tvrx2_tda18272_freq_map_t( 39936000, 0xFF, 0x17, 0) )
139
    ( tvrx2_tda18272_freq_map_t( 40960000, 0xFD, 0x17, 0) )
140
    ( tvrx2_tda18272_freq_map_t( 41984000, 0xF1, 0x15, 0) )
141
    ( tvrx2_tda18272_freq_map_t( 43008000, 0xE5, 0x13, 0) )
142
    ( tvrx2_tda18272_freq_map_t( 44032000, 0xDB, 0x13, 0) )
143
    ( tvrx2_tda18272_freq_map_t( 45056000, 0xD1, 0x12, 0) )
144
    ( tvrx2_tda18272_freq_map_t( 46080000, 0xC7, 0x10, 0) )
145
    ( tvrx2_tda18272_freq_map_t( 47104000, 0xBE, 0x0F, 0) )
146
    ( tvrx2_tda18272_freq_map_t( 48128000, 0xB5, 0x0F, 0) )
147
    ( tvrx2_tda18272_freq_map_t( 49152000, 0xAD, 0x0F, 0) )
148
    ( tvrx2_tda18272_freq_map_t( 50176000, 0xA6, 0x0F, 0) )
149
    ( tvrx2_tda18272_freq_map_t( 51200000, 0x9F, 0x0F, 0) )
150
    ( tvrx2_tda18272_freq_map_t( 52224000, 0x98, 0x0F, 0) )
151
    ( tvrx2_tda18272_freq_map_t( 53248000, 0x91, 0x0F, 0) )
152
    ( tvrx2_tda18272_freq_map_t( 54272000, 0x8B, 0x0F, 0) )
153
    ( tvrx2_tda18272_freq_map_t( 55296000, 0x86, 0x0F, 0) )
154
    ( tvrx2_tda18272_freq_map_t( 56320000, 0x80, 0x0F, 0) )
155
    ( tvrx2_tda18272_freq_map_t( 57344000, 0x7B, 0x0E, 0) )
156
    ( tvrx2_tda18272_freq_map_t( 58368000, 0x76, 0x0E, 0) )
157
    ( tvrx2_tda18272_freq_map_t( 59392000, 0x72, 0x0D, 0) )
158
    ( tvrx2_tda18272_freq_map_t( 60416000, 0x6D, 0x0D, 0) )
159
    ( tvrx2_tda18272_freq_map_t( 61440000, 0x69, 0x0C, 0) )
160
    ( tvrx2_tda18272_freq_map_t( 62464000, 0x65, 0x0C, 0) )
161
    ( tvrx2_tda18272_freq_map_t( 63488000, 0x61, 0x0B, 0) )
162
    ( tvrx2_tda18272_freq_map_t( 64512000, 0x5E, 0x0B, 0) )
163
    ( tvrx2_tda18272_freq_map_t( 64512000, 0x5A, 0x0B, 0) )
164
    ( tvrx2_tda18272_freq_map_t( 65536000, 0x57, 0x0A, 0) )
165
    ( tvrx2_tda18272_freq_map_t( 66560000, 0x54, 0x0A, 0) )
166
    ( tvrx2_tda18272_freq_map_t( 67584000, 0x51, 0x09, 0) )
167
    ( tvrx2_tda18272_freq_map_t( 68608000, 0x4E, 0x09, 0) )
168
    ( tvrx2_tda18272_freq_map_t( 69632000, 0x4B, 0x09, 0) )
169
    ( tvrx2_tda18272_freq_map_t( 70656000, 0x49, 0x08, 0) )
170
    ( tvrx2_tda18272_freq_map_t( 71680000, 0x46, 0x08, 0) )
171
    ( tvrx2_tda18272_freq_map_t( 72704000, 0x44, 0x08, 0) )
172
    ( tvrx2_tda18272_freq_map_t( 73728000, 0x41, 0x07, 0) )
173
    ( tvrx2_tda18272_freq_map_t( 74752000, 0x3F, 0x07, 0) )
174
    ( tvrx2_tda18272_freq_map_t( 75776000, 0x3D, 0x07, 0) )
175
    ( tvrx2_tda18272_freq_map_t( 76800000, 0x3B, 0x07, 0) )
176
    ( tvrx2_tda18272_freq_map_t( 77824000, 0x39, 0x07, 0) )
177
    ( tvrx2_tda18272_freq_map_t( 78848000, 0x37, 0x07, 0) )
178
    ( tvrx2_tda18272_freq_map_t( 79872000, 0x35, 0x07, 0) )
179
    ( tvrx2_tda18272_freq_map_t( 80896000, 0x33, 0x07, 0) )
180
    ( tvrx2_tda18272_freq_map_t( 81920000, 0x32, 0x07, 0) )
181
    ( tvrx2_tda18272_freq_map_t( 82944000, 0x30, 0x07, 0) )
182
    ( tvrx2_tda18272_freq_map_t( 83968000, 0x2F, 0x07, 0) )
183
    ( tvrx2_tda18272_freq_map_t( 84992000, 0x2D, 0x07, 0) )
184
    ( tvrx2_tda18272_freq_map_t( 86016000, 0x2C, 0x07, 0) )
185
    ( tvrx2_tda18272_freq_map_t( 87040000, 0x2A, 0x07, 0) )
186
    ( tvrx2_tda18272_freq_map_t( 88064000, 0x29, 0x06, 0) )
187
    ( tvrx2_tda18272_freq_map_t( 89088000, 0x27, 0x06, 0) )
188
    ( tvrx2_tda18272_freq_map_t( 90112000, 0x26, 0x06, 0) )
189
    ( tvrx2_tda18272_freq_map_t( 91136000, 0x25, 0x06, 0) )
190
    ( tvrx2_tda18272_freq_map_t( 92160000, 0x24, 0x06, 0) )
191
    ( tvrx2_tda18272_freq_map_t( 93184000, 0x22, 0x05, 0) )
192
    ( tvrx2_tda18272_freq_map_t( 94208000, 0x21, 0x05, 0) )
193
    ( tvrx2_tda18272_freq_map_t( 95232000, 0x20, 0x05, 0) )
194
    ( tvrx2_tda18272_freq_map_t( 96256000, 0x1F, 0x05, 0) )
195
    ( tvrx2_tda18272_freq_map_t( 97280000, 0x1E, 0x05, 0) )
196
    ( tvrx2_tda18272_freq_map_t( 98304000, 0x1D, 0x05, 0) )
197
    ( tvrx2_tda18272_freq_map_t( 99328000, 0x1C, 0x04, 0) )
198
    ( tvrx2_tda18272_freq_map_t(100352000, 0x1B, 0x04, 0) )
199
    ( tvrx2_tda18272_freq_map_t(101376000, 0x1A, 0x04, 0) )
200
    ( tvrx2_tda18272_freq_map_t(103424000, 0x19, 0x04, 0) )
201
    ( tvrx2_tda18272_freq_map_t(104448000, 0x18, 0x04, 0) )
202
    ( tvrx2_tda18272_freq_map_t(105472000, 0x17, 0x04, 0) )
203
    ( tvrx2_tda18272_freq_map_t(106496000, 0x16, 0x03, 0) )
204
    ( tvrx2_tda18272_freq_map_t(106496000, 0x15, 0x03, 0) )
205
    ( tvrx2_tda18272_freq_map_t(108544000, 0x14, 0x03, 0) )
206
    ( tvrx2_tda18272_freq_map_t(109568000, 0x13, 0x03, 0) )
207
    ( tvrx2_tda18272_freq_map_t(111616000, 0x12, 0x03, 0) )
208
    ( tvrx2_tda18272_freq_map_t(112640000, 0x11, 0x03, 0) )
209
    ( tvrx2_tda18272_freq_map_t(113664000, 0x11, 0x07, 0) )
210
    ( tvrx2_tda18272_freq_map_t(114688000, 0x10, 0x07, 0) )
211
    ( tvrx2_tda18272_freq_map_t(115712000, 0x0F, 0x07, 0) )
212
    ( tvrx2_tda18272_freq_map_t(117760000, 0x0E, 0x07, 0) )
213
    ( tvrx2_tda18272_freq_map_t(119808000, 0x0D, 0x06, 0) )
214
    ( tvrx2_tda18272_freq_map_t(121856000, 0x0C, 0x06, 0) )
215
    ( tvrx2_tda18272_freq_map_t(123904000, 0x0B, 0x06, 0) )
216
    ( tvrx2_tda18272_freq_map_t(125952000, 0x0A, 0x05, 0) )
217
    ( tvrx2_tda18272_freq_map_t(128000000, 0x09, 0x05, 0) )
218
    ( tvrx2_tda18272_freq_map_t(130048000, 0x08, 0x05, 0) )
219
    ( tvrx2_tda18272_freq_map_t(133120000, 0x07, 0x04, 0) )
220
    ( tvrx2_tda18272_freq_map_t(135168000, 0x06, 0x04, 0) )
221
    ( tvrx2_tda18272_freq_map_t(138240000, 0x05, 0x04, 0) )
222
    ( tvrx2_tda18272_freq_map_t(141312000, 0x04, 0x04, 0) )
223
    ( tvrx2_tda18272_freq_map_t(144384000, 0x03, 0x03, 0) )
224
    ( tvrx2_tda18272_freq_map_t(145408000, 0xE0, 0x3F, 1) )
225
    ( tvrx2_tda18272_freq_map_t(147456000, 0xDC, 0x37, 1) )
226
    ( tvrx2_tda18272_freq_map_t(148480000, 0xD9, 0x32, 1) )
227
    ( tvrx2_tda18272_freq_map_t(149504000, 0xD6, 0x2F, 1) )
228
    ( tvrx2_tda18272_freq_map_t(149504000, 0xD2, 0x2F, 1) )
229
    ( tvrx2_tda18272_freq_map_t(150528000, 0xCF, 0x2F, 1) )
230
    ( tvrx2_tda18272_freq_map_t(151552000, 0xCC, 0x2B, 1) )
231
    ( tvrx2_tda18272_freq_map_t(152576000, 0xC9, 0x27, 1) )
232
    ( tvrx2_tda18272_freq_map_t(153600000, 0xC5, 0x27, 1) )
233
    ( tvrx2_tda18272_freq_map_t(154624000, 0xC2, 0x25, 1) )
234
    ( tvrx2_tda18272_freq_map_t(155648000, 0xBF, 0x23, 1) )
235
    ( tvrx2_tda18272_freq_map_t(156672000, 0xBD, 0x20, 1) )
236
    ( tvrx2_tda18272_freq_map_t(157696000, 0xBA, 0x1F, 1) )
237
    ( tvrx2_tda18272_freq_map_t(158720000, 0xB7, 0x1F, 1) )
238
    ( tvrx2_tda18272_freq_map_t(159744000, 0xB4, 0x1F, 1) )
239
    ( tvrx2_tda18272_freq_map_t(160768000, 0xB1, 0x1F, 1) )
240
    ( tvrx2_tda18272_freq_map_t(161792000, 0xAF, 0x1F, 1) )
241
    ( tvrx2_tda18272_freq_map_t(162816000, 0xAC, 0x1F, 1) )
242
    ( tvrx2_tda18272_freq_map_t(163840000, 0xAA, 0x1F, 1) )
243
    ( tvrx2_tda18272_freq_map_t(164864000, 0xA7, 0x1F, 1) )
244
    ( tvrx2_tda18272_freq_map_t(165888000, 0xA5, 0x1F, 1) )
245
    ( tvrx2_tda18272_freq_map_t(166912000, 0xA2, 0x1F, 1) )
246
    ( tvrx2_tda18272_freq_map_t(167936000, 0xA0, 0x1F, 1) )
247
    ( tvrx2_tda18272_freq_map_t(168960000, 0x9D, 0x1F, 1) )
248
    ( tvrx2_tda18272_freq_map_t(169984000, 0x9B, 0x1F, 1) )
249
    ( tvrx2_tda18272_freq_map_t(171008000, 0x99, 0x1F, 1) )
250
    ( tvrx2_tda18272_freq_map_t(172032000, 0x97, 0x1E, 1) )
251
    ( tvrx2_tda18272_freq_map_t(173056000, 0x95, 0x1D, 1) )
252
    ( tvrx2_tda18272_freq_map_t(174080000, 0x92, 0x1C, 1) )
253
    ( tvrx2_tda18272_freq_map_t(175104000, 0x90, 0x1B, 1) )
254
    ( tvrx2_tda18272_freq_map_t(176128000, 0x8E, 0x1A, 1) )
255
    ( tvrx2_tda18272_freq_map_t(177152000, 0x8C, 0x19, 1) )
256
    ( tvrx2_tda18272_freq_map_t(178176000, 0x8A, 0x18, 1) )
257
    ( tvrx2_tda18272_freq_map_t(179200000, 0x88, 0x17, 1) )
258
    ( tvrx2_tda18272_freq_map_t(180224000, 0x86, 0x17, 1) )
259
    ( tvrx2_tda18272_freq_map_t(181248000, 0x84, 0x17, 1) )
260
    ( tvrx2_tda18272_freq_map_t(182272000, 0x82, 0x17, 1) )
261
    ( tvrx2_tda18272_freq_map_t(183296000, 0x81, 0x17, 1) )
262
    ( tvrx2_tda18272_freq_map_t(184320000, 0x7F, 0x17, 1) )
263
    ( tvrx2_tda18272_freq_map_t(185344000, 0x7D, 0x16, 1) )
264
    ( tvrx2_tda18272_freq_map_t(186368000, 0x7B, 0x15, 1) )
265
    ( tvrx2_tda18272_freq_map_t(187392000, 0x7A, 0x14, 1) )
266
    ( tvrx2_tda18272_freq_map_t(188416000, 0x78, 0x14, 1) )
267
    ( tvrx2_tda18272_freq_map_t(189440000, 0x76, 0x13, 1) )
268
    ( tvrx2_tda18272_freq_map_t(190464000, 0x75, 0x13, 1) )
269
    ( tvrx2_tda18272_freq_map_t(191488000, 0x73, 0x13, 1) )
270
    ( tvrx2_tda18272_freq_map_t(192512000, 0x71, 0x12, 1) )
271
    ( tvrx2_tda18272_freq_map_t(192512000, 0x70, 0x11, 1) )
272
    ( tvrx2_tda18272_freq_map_t(193536000, 0x6E, 0x11, 1) )
273
    ( tvrx2_tda18272_freq_map_t(194560000, 0x6D, 0x10, 1) )
274
    ( tvrx2_tda18272_freq_map_t(195584000, 0x6B, 0x10, 1) )
275
    ( tvrx2_tda18272_freq_map_t(196608000, 0x6A, 0x0F, 1) )
276
    ( tvrx2_tda18272_freq_map_t(197632000, 0x68, 0x0F, 1) )
277
    ( tvrx2_tda18272_freq_map_t(198656000, 0x67, 0x0F, 1) )
278
    ( tvrx2_tda18272_freq_map_t(199680000, 0x65, 0x0F, 1) )
279
    ( tvrx2_tda18272_freq_map_t(200704000, 0x64, 0x0F, 1) )
280
    ( tvrx2_tda18272_freq_map_t(201728000, 0x63, 0x0F, 1) )
281
    ( tvrx2_tda18272_freq_map_t(202752000, 0x61, 0x0F, 1) )
282
    ( tvrx2_tda18272_freq_map_t(203776000, 0x60, 0x0F, 1) )
283
    ( tvrx2_tda18272_freq_map_t(204800000, 0x5F, 0x0F, 1) )
284
    ( tvrx2_tda18272_freq_map_t(205824000, 0x5D, 0x0F, 1) )
285
    ( tvrx2_tda18272_freq_map_t(206848000, 0x5C, 0x0F, 1) )
286
    ( tvrx2_tda18272_freq_map_t(207872000, 0x5B, 0x0F, 1) )
287
    ( tvrx2_tda18272_freq_map_t(208896000, 0x5A, 0x0F, 1) )
288
    ( tvrx2_tda18272_freq_map_t(209920000, 0x58, 0x0F, 1) )
289
    ( tvrx2_tda18272_freq_map_t(210944000, 0x57, 0x0F, 1) )
290
    ( tvrx2_tda18272_freq_map_t(211968000, 0x56, 0x0F, 1) )
291
    ( tvrx2_tda18272_freq_map_t(212992000, 0x55, 0x0F, 1) )
292
    ( tvrx2_tda18272_freq_map_t(214016000, 0x54, 0x0F, 1) )
293
    ( tvrx2_tda18272_freq_map_t(215040000, 0x53, 0x0F, 1) )
294
    ( tvrx2_tda18272_freq_map_t(216064000, 0x52, 0x0F, 1) )
295
    ( tvrx2_tda18272_freq_map_t(217088000, 0x50, 0x0F, 1) )
296
    ( tvrx2_tda18272_freq_map_t(218112000, 0x4F, 0x0F, 1) )
297
    ( tvrx2_tda18272_freq_map_t(219136000, 0x4E, 0x0F, 1) )
298
    ( tvrx2_tda18272_freq_map_t(220160000, 0x4D, 0x0E, 1) )
299
    ( tvrx2_tda18272_freq_map_t(221184000, 0x4C, 0x0E, 1) )
300
    ( tvrx2_tda18272_freq_map_t(222208000, 0x4B, 0x0E, 1) )
301
    ( tvrx2_tda18272_freq_map_t(223232000, 0x4A, 0x0E, 1) )
302
    ( tvrx2_tda18272_freq_map_t(224256000, 0x49, 0x0D, 1) )
303
    ( tvrx2_tda18272_freq_map_t(225280000, 0x48, 0x0D, 1) )
304
    ( tvrx2_tda18272_freq_map_t(226304000, 0x47, 0x0D, 1) )
305
    ( tvrx2_tda18272_freq_map_t(227328000, 0x46, 0x0D, 1) )
306
    ( tvrx2_tda18272_freq_map_t(228352000, 0x45, 0x0C, 1) )
307
    ( tvrx2_tda18272_freq_map_t(229376000, 0x44, 0x0C, 1) )
308
    ( tvrx2_tda18272_freq_map_t(230400000, 0x43, 0x0C, 1) )
309
    ( tvrx2_tda18272_freq_map_t(231424000, 0x42, 0x0C, 1) )
310
    ( tvrx2_tda18272_freq_map_t(232448000, 0x42, 0x0B, 1) )
311
    ( tvrx2_tda18272_freq_map_t(233472000, 0x41, 0x0B, 1) )
312
    ( tvrx2_tda18272_freq_map_t(234496000, 0x40, 0x0B, 1) )
313
    ( tvrx2_tda18272_freq_map_t(234496000, 0x3F, 0x0B, 1) )
314
    ( tvrx2_tda18272_freq_map_t(235520000, 0x3E, 0x0B, 1) )
315
    ( tvrx2_tda18272_freq_map_t(236544000, 0x3D, 0x0B, 1) )
316
    ( tvrx2_tda18272_freq_map_t(237568000, 0x3C, 0x0B, 1) )
317
    ( tvrx2_tda18272_freq_map_t(239616000, 0x3B, 0x0A, 1) )
318
    ( tvrx2_tda18272_freq_map_t(240640000, 0x3A, 0x0A, 1) )
319
    ( tvrx2_tda18272_freq_map_t(241664000, 0x39, 0x0A, 1) )
320
    ( tvrx2_tda18272_freq_map_t(242688000, 0x38, 0x0A, 1) )
321
    ( tvrx2_tda18272_freq_map_t(244736000, 0x37, 0x09, 1) )
322
    ( tvrx2_tda18272_freq_map_t(245760000, 0x36, 0x09, 1) )
323
    ( tvrx2_tda18272_freq_map_t(246784000, 0x35, 0x09, 1) )
324
    ( tvrx2_tda18272_freq_map_t(248832000, 0x34, 0x09, 1) )
325
    ( tvrx2_tda18272_freq_map_t(249856000, 0x33, 0x09, 1) )
326
    ( tvrx2_tda18272_freq_map_t(250880000, 0x32, 0x08, 1) )
327
    ( tvrx2_tda18272_freq_map_t(252928000, 0x31, 0x08, 1) )
328
    ( tvrx2_tda18272_freq_map_t(253952000, 0x30, 0x08, 1) )
329
    ( tvrx2_tda18272_freq_map_t(256000000, 0x2F, 0x08, 1) )
330
    ( tvrx2_tda18272_freq_map_t(257024000, 0x2E, 0x08, 1) )
331
    ( tvrx2_tda18272_freq_map_t(259072000, 0x2D, 0x07, 1) )
332
    ( tvrx2_tda18272_freq_map_t(260096000, 0x2C, 0x07, 1) )
333
    ( tvrx2_tda18272_freq_map_t(262144000, 0x2B, 0x07, 1) )
334
    ( tvrx2_tda18272_freq_map_t(264192000, 0x2A, 0x07, 1) )
335
    ( tvrx2_tda18272_freq_map_t(265216000, 0x29, 0x07, 1) )
336
    ( tvrx2_tda18272_freq_map_t(267264000, 0x28, 0x07, 1) )
337
    ( tvrx2_tda18272_freq_map_t(269312000, 0x27, 0x07, 1) )
338
    ( tvrx2_tda18272_freq_map_t(270336000, 0x26, 0x07, 1) )
339
    ( tvrx2_tda18272_freq_map_t(272384000, 0x25, 0x07, 1) )
340
    ( tvrx2_tda18272_freq_map_t(274432000, 0x24, 0x07, 1) )
341
    ( tvrx2_tda18272_freq_map_t(276480000, 0x23, 0x07, 1) )
342
    ( tvrx2_tda18272_freq_map_t(277504000, 0x22, 0x07, 1) )
343
    ( tvrx2_tda18272_freq_map_t(279552000, 0x21, 0x07, 1) )
344
    ( tvrx2_tda18272_freq_map_t(281600000, 0x20, 0x07, 1) )
345
    ( tvrx2_tda18272_freq_map_t(283648000, 0x1F, 0x07, 1) )
346
    ( tvrx2_tda18272_freq_map_t(285696000, 0x1E, 0x0F, 1) )
347
    ( tvrx2_tda18272_freq_map_t(287744000, 0x1D, 0x0F, 1) )
348
    ( tvrx2_tda18272_freq_map_t(289792000, 0x1C, 0x0E, 1) )
349
    ( tvrx2_tda18272_freq_map_t(291840000, 0x1B, 0x0E, 1) )
350
    ( tvrx2_tda18272_freq_map_t(293888000, 0x1A, 0x0D, 1) )
351
    ( tvrx2_tda18272_freq_map_t(296960000, 0x19, 0x0D, 1) )
352
    ( tvrx2_tda18272_freq_map_t(299008000, 0x18, 0x0C, 1) )
353
    ( tvrx2_tda18272_freq_map_t(301056000, 0x17, 0x0C, 1) )
354
    ( tvrx2_tda18272_freq_map_t(304128000, 0x16, 0x0C, 1) )
355
    ( tvrx2_tda18272_freq_map_t(306176000, 0x15, 0x0B, 1) )
356
    ( tvrx2_tda18272_freq_map_t(309248000, 0x14, 0x0B, 1) )
357
    ( tvrx2_tda18272_freq_map_t(312320000, 0x13, 0x0B, 1) )
358
    ( tvrx2_tda18272_freq_map_t(314368000, 0x12, 0x0B, 1) )
359
    ( tvrx2_tda18272_freq_map_t(317440000, 0x11, 0x0A, 1) )
360
    ( tvrx2_tda18272_freq_map_t(320512000, 0x10, 0x0A, 1) )
361
    ( tvrx2_tda18272_freq_map_t(322560000, 0x0F, 0x0A, 1) )
362
    ( tvrx2_tda18272_freq_map_t(325632000, 0x0E, 0x09, 1) )
363
    ( tvrx2_tda18272_freq_map_t(328704000, 0x0D, 0x09, 1) )
364
    ( tvrx2_tda18272_freq_map_t(331776000, 0x0C, 0x08, 1) )
365
    ( tvrx2_tda18272_freq_map_t(335872000, 0x0B, 0x08, 1) )
366
    ( tvrx2_tda18272_freq_map_t(338944000, 0x0A, 0x08, 1) )
367
    ( tvrx2_tda18272_freq_map_t(343040000, 0x09, 0x07, 1) )
368
    ( tvrx2_tda18272_freq_map_t(346112000, 0x08, 0x07, 1) )
369
    ( tvrx2_tda18272_freq_map_t(350208000, 0x07, 0x07, 1) )
370
    ( tvrx2_tda18272_freq_map_t(354304000, 0x06, 0x07, 1) )
371
    ( tvrx2_tda18272_freq_map_t(358400000, 0x05, 0x07, 1) )
372
    ( tvrx2_tda18272_freq_map_t(362496000, 0x04, 0x07, 1) )
373
    ( tvrx2_tda18272_freq_map_t(365568000, 0x04, 0x07, 1) )
374
    ( tvrx2_tda18272_freq_map_t(367616000, 0xDA, 0x2A, 2) )
375
    ( tvrx2_tda18272_freq_map_t(367616000, 0xD9, 0x27, 2) )
376
    ( tvrx2_tda18272_freq_map_t(368640000, 0xD8, 0x27, 2) )
377
    ( tvrx2_tda18272_freq_map_t(369664000, 0xD6, 0x27, 2) )
378
    ( tvrx2_tda18272_freq_map_t(370688000, 0xD5, 0x27, 2) )
379
    ( tvrx2_tda18272_freq_map_t(371712000, 0xD3, 0x25, 2) )
380
    ( tvrx2_tda18272_freq_map_t(372736000, 0xD2, 0x23, 2) )
381
    ( tvrx2_tda18272_freq_map_t(373760000, 0xD0, 0x23, 2) )
382
    ( tvrx2_tda18272_freq_map_t(374784000, 0xCF, 0x21, 2) )
383
    ( tvrx2_tda18272_freq_map_t(375808000, 0xCD, 0x1F, 2) )
384
    ( tvrx2_tda18272_freq_map_t(376832000, 0xCC, 0x1F, 2) )
385
    ( tvrx2_tda18272_freq_map_t(377856000, 0xCA, 0x1F, 2) )
386
    ( tvrx2_tda18272_freq_map_t(378880000, 0xC9, 0x1F, 2) )
387
    ( tvrx2_tda18272_freq_map_t(379904000, 0xC7, 0x1F, 2) )
388
    ( tvrx2_tda18272_freq_map_t(380928000, 0xC6, 0x1F, 2) )
389
    ( tvrx2_tda18272_freq_map_t(381952000, 0xC4, 0x1F, 2) )
390
    ( tvrx2_tda18272_freq_map_t(382976000, 0xC3, 0x1F, 2) )
391
    ( tvrx2_tda18272_freq_map_t(384000000, 0xC1, 0x1F, 2) )
392
    ( tvrx2_tda18272_freq_map_t(385024000, 0xC0, 0x1F, 2) )
393
    ( tvrx2_tda18272_freq_map_t(386048000, 0xBF, 0x1F, 2) )
394
    ( tvrx2_tda18272_freq_map_t(387072000, 0xBD, 0x1F, 2) )
395
    ( tvrx2_tda18272_freq_map_t(388096000, 0xBC, 0x1F, 2) )
396
    ( tvrx2_tda18272_freq_map_t(389120000, 0xBB, 0x1F, 2) )
397
    ( tvrx2_tda18272_freq_map_t(390144000, 0xB9, 0x1F, 2) )
398
    ( tvrx2_tda18272_freq_map_t(391168000, 0xB8, 0x1F, 2) )
399
    ( tvrx2_tda18272_freq_map_t(392192000, 0xB7, 0x1F, 2) )
400
    ( tvrx2_tda18272_freq_map_t(393216000, 0xB5, 0x1F, 2) )
401
    ( tvrx2_tda18272_freq_map_t(394240000, 0xB4, 0x1F, 2) )
402
    ( tvrx2_tda18272_freq_map_t(395264000, 0xB3, 0x1F, 2) )
403
    ( tvrx2_tda18272_freq_map_t(396288000, 0xB1, 0x1F, 2) )
404
    ( tvrx2_tda18272_freq_map_t(397312000, 0xB0, 0x1F, 2) )
405
    ( tvrx2_tda18272_freq_map_t(398336000, 0xAF, 0x1F, 2) )
406
    ( tvrx2_tda18272_freq_map_t(399360000, 0xAD, 0x1F, 2) )
407
    ( tvrx2_tda18272_freq_map_t(400384000, 0xAC, 0x1F, 2) )
408
    ( tvrx2_tda18272_freq_map_t(401408000, 0xAB, 0x1F, 2) )
409
    ( tvrx2_tda18272_freq_map_t(402432000, 0xAA, 0x1F, 2) )
410
    ( tvrx2_tda18272_freq_map_t(403456000, 0xA8, 0x1E, 2) )
411
    ( tvrx2_tda18272_freq_map_t(404480000, 0xA7, 0x1D, 2) )
412
    ( tvrx2_tda18272_freq_map_t(405504000, 0xA6, 0x1D, 2) )
413
    ( tvrx2_tda18272_freq_map_t(405504000, 0xA5, 0x1C, 2) )
414
    ( tvrx2_tda18272_freq_map_t(406528000, 0xA3, 0x1C, 2) )
415
    ( tvrx2_tda18272_freq_map_t(407552000, 0xA2, 0x1B, 2) )
416
    ( tvrx2_tda18272_freq_map_t(408576000, 0xA1, 0x1B, 2) )
417
    ( tvrx2_tda18272_freq_map_t(409600000, 0xA0, 0x1B, 2) )
418
    ( tvrx2_tda18272_freq_map_t(410624000, 0x9F, 0x1A, 2) )
419
    ( tvrx2_tda18272_freq_map_t(411648000, 0x9D, 0x1A, 2) )
420
    ( tvrx2_tda18272_freq_map_t(412672000, 0x9C, 0x19, 2) )
421
    ( tvrx2_tda18272_freq_map_t(413696000, 0x9B, 0x18, 2) )
422
    ( tvrx2_tda18272_freq_map_t(414720000, 0x9A, 0x18, 2) )
423
    ( tvrx2_tda18272_freq_map_t(415744000, 0x99, 0x17, 2) )
424
    ( tvrx2_tda18272_freq_map_t(416768000, 0x98, 0x17, 2) )
425
    ( tvrx2_tda18272_freq_map_t(417792000, 0x97, 0x17, 2) )
426
    ( tvrx2_tda18272_freq_map_t(418816000, 0x95, 0x17, 2) )
427
    ( tvrx2_tda18272_freq_map_t(419840000, 0x94, 0x17, 2) )
428
    ( tvrx2_tda18272_freq_map_t(420864000, 0x93, 0x17, 2) )
429
    ( tvrx2_tda18272_freq_map_t(421888000, 0x92, 0x17, 2) )
430
    ( tvrx2_tda18272_freq_map_t(422912000, 0x91, 0x17, 2) )
431
    ( tvrx2_tda18272_freq_map_t(423936000, 0x90, 0x17, 2) )
432
    ( tvrx2_tda18272_freq_map_t(424960000, 0x8F, 0x17, 2) )
433
    ( tvrx2_tda18272_freq_map_t(425984000, 0x8E, 0x16, 2) )
434
    ( tvrx2_tda18272_freq_map_t(427008000, 0x8D, 0x16, 2) )
435
    ( tvrx2_tda18272_freq_map_t(428032000, 0x8C, 0x15, 2) )
436
    ( tvrx2_tda18272_freq_map_t(429056000, 0x8B, 0x15, 2) )
437
    ( tvrx2_tda18272_freq_map_t(430080000, 0x8A, 0x15, 2) )
438
    ( tvrx2_tda18272_freq_map_t(431104000, 0x88, 0x14, 2) )
439
    ( tvrx2_tda18272_freq_map_t(432128000, 0x87, 0x14, 2) )
440
    ( tvrx2_tda18272_freq_map_t(433152000, 0x86, 0x14, 2) )
441
    ( tvrx2_tda18272_freq_map_t(434176000, 0x85, 0x13, 2) )
442
    ( tvrx2_tda18272_freq_map_t(435200000, 0x84, 0x13, 2) )
443
    ( tvrx2_tda18272_freq_map_t(436224000, 0x83, 0x13, 2) )
444
    ( tvrx2_tda18272_freq_map_t(437248000, 0x82, 0x13, 2) )
445
    ( tvrx2_tda18272_freq_map_t(438272000, 0x81, 0x13, 2) )
446
    ( tvrx2_tda18272_freq_map_t(439296000, 0x80, 0x12, 2) )
447
    ( tvrx2_tda18272_freq_map_t(440320000, 0x7F, 0x12, 2) )
448
    ( tvrx2_tda18272_freq_map_t(441344000, 0x7E, 0x12, 2) )
449
    ( tvrx2_tda18272_freq_map_t(442368000, 0x7D, 0x11, 2) )
450
    ( tvrx2_tda18272_freq_map_t(444416000, 0x7C, 0x11, 2) )
451
    ( tvrx2_tda18272_freq_map_t(445440000, 0x7B, 0x10, 2) )
452
    ( tvrx2_tda18272_freq_map_t(446464000, 0x7A, 0x10, 2) )
453
    ( tvrx2_tda18272_freq_map_t(447488000, 0x79, 0x10, 2) )
454
    ( tvrx2_tda18272_freq_map_t(448512000, 0x78, 0x10, 2) )
455
    ( tvrx2_tda18272_freq_map_t(448512000, 0x77, 0x0F, 2) )
456
    ( tvrx2_tda18272_freq_map_t(449536000, 0x76, 0x0F, 2) )
457
    ( tvrx2_tda18272_freq_map_t(450560000, 0x75, 0x0F, 2) )
458
    ( tvrx2_tda18272_freq_map_t(451584000, 0x74, 0x0F, 2) )
459
    ( tvrx2_tda18272_freq_map_t(452608000, 0x73, 0x0F, 2) )
460
    ( tvrx2_tda18272_freq_map_t(453632000, 0x72, 0x0F, 2) )
461
    ( tvrx2_tda18272_freq_map_t(454656000, 0x71, 0x0F, 2) )
462
    ( tvrx2_tda18272_freq_map_t(455680000, 0x70, 0x0F, 2) )
463
    ( tvrx2_tda18272_freq_map_t(457728000, 0x6F, 0x0F, 2) )
464
    ( tvrx2_tda18272_freq_map_t(458752000, 0x6E, 0x0F, 2) )
465
    ( tvrx2_tda18272_freq_map_t(459776000, 0x6D, 0x0F, 2) )
466
    ( tvrx2_tda18272_freq_map_t(460800000, 0x6C, 0x0F, 2) )
467
    ( tvrx2_tda18272_freq_map_t(461824000, 0x6B, 0x0F, 2) )
468
    ( tvrx2_tda18272_freq_map_t(462848000, 0x6A, 0x0F, 2) )
469
    ( tvrx2_tda18272_freq_map_t(464896000, 0x69, 0x0F, 2) )
470
    ( tvrx2_tda18272_freq_map_t(465920000, 0x68, 0x0F, 2) )
471
    ( tvrx2_tda18272_freq_map_t(466944000, 0x67, 0x0F, 2) )
472
    ( tvrx2_tda18272_freq_map_t(467968000, 0x66, 0x0F, 2) )
473
    ( tvrx2_tda18272_freq_map_t(468992000, 0x65, 0x0F, 2) )
474
    ( tvrx2_tda18272_freq_map_t(471040000, 0x64, 0x0F, 2) )
475
    ( tvrx2_tda18272_freq_map_t(472064000, 0x63, 0x0F, 2) )
476
    ( tvrx2_tda18272_freq_map_t(473088000, 0x62, 0x0F, 2) )
477
    ( tvrx2_tda18272_freq_map_t(474112000, 0x61, 0x0F, 2) )
478
    ( tvrx2_tda18272_freq_map_t(476160000, 0x60, 0x0F, 2) )
479
    ( tvrx2_tda18272_freq_map_t(477184000, 0x5F, 0x0F, 2) )
480
    ( tvrx2_tda18272_freq_map_t(478208000, 0x5E, 0x0F, 2) )
481
    ( tvrx2_tda18272_freq_map_t(479232000, 0x5D, 0x0F, 2) )
482
    ( tvrx2_tda18272_freq_map_t(481280000, 0x5C, 0x0F, 2) )
483
    ( tvrx2_tda18272_freq_map_t(482304000, 0x5B, 0x0F, 2) )
484
    ( tvrx2_tda18272_freq_map_t(483328000, 0x5A, 0x0F, 2) )
485
    ( tvrx2_tda18272_freq_map_t(485376000, 0x59, 0x0F, 2) )
486
    ( tvrx2_tda18272_freq_map_t(486400000, 0x58, 0x0F, 2) )
487
    ( tvrx2_tda18272_freq_map_t(487424000, 0x57, 0x0F, 2) )
488
    ( tvrx2_tda18272_freq_map_t(489472000, 0x56, 0x0F, 2) )
489
    ( tvrx2_tda18272_freq_map_t(490496000, 0x55, 0x0F, 2) )
490
    ( tvrx2_tda18272_freq_map_t(490496000, 0x54, 0x0F, 2) )
491
    ( tvrx2_tda18272_freq_map_t(492544000, 0x53, 0x0E, 2) )
492
    ( tvrx2_tda18272_freq_map_t(493568000, 0x52, 0x0E, 2) )
493
    ( tvrx2_tda18272_freq_map_t(495616000, 0x51, 0x0E, 2) )
494
    ( tvrx2_tda18272_freq_map_t(496640000, 0x50, 0x0E, 2) )
495
    ( tvrx2_tda18272_freq_map_t(497664000, 0x4F, 0x0E, 2) )
496
    ( tvrx2_tda18272_freq_map_t(499712000, 0x4E, 0x0D, 2) )
497
    ( tvrx2_tda18272_freq_map_t(500736000, 0x4D, 0x0D, 2) )
498
    ( tvrx2_tda18272_freq_map_t(502784000, 0x4C, 0x0D, 2) )
499
    ( tvrx2_tda18272_freq_map_t(503808000, 0x4B, 0x0D, 2) )
500
    ( tvrx2_tda18272_freq_map_t(505856000, 0x4A, 0x0C, 2) )
501
    ( tvrx2_tda18272_freq_map_t(506880000, 0x49, 0x0C, 2) )
502
    ( tvrx2_tda18272_freq_map_t(508928000, 0x48, 0x0C, 2) )
503
    ( tvrx2_tda18272_freq_map_t(509952000, 0x47, 0x0C, 2) )
504
    ( tvrx2_tda18272_freq_map_t(512000000, 0x46, 0x0C, 2) )
505
    ( tvrx2_tda18272_freq_map_t(513024000, 0x45, 0x0B, 2) )
506
    ( tvrx2_tda18272_freq_map_t(515072000, 0x44, 0x0B, 2) )
507
    ( tvrx2_tda18272_freq_map_t(517120000, 0x43, 0x0B, 2) )
508
    ( tvrx2_tda18272_freq_map_t(518144000, 0x42, 0x0B, 2) )
509
    ( tvrx2_tda18272_freq_map_t(520192000, 0x41, 0x0B, 2) )
510
    ( tvrx2_tda18272_freq_map_t(521216000, 0x40, 0x0B, 2) )
511
    ( tvrx2_tda18272_freq_map_t(523264000, 0x3F, 0x0B, 2) )
512
    ( tvrx2_tda18272_freq_map_t(525312000, 0x3E, 0x0B, 2) )
513
    ( tvrx2_tda18272_freq_map_t(526336000, 0x3D, 0x0B, 2) )
514
    ( tvrx2_tda18272_freq_map_t(528384000, 0x3C, 0x0A, 2) )
515
    ( tvrx2_tda18272_freq_map_t(530432000, 0x3B, 0x0A, 2) )
516
    ( tvrx2_tda18272_freq_map_t(531456000, 0x3A, 0x0A, 2) )
517
    ( tvrx2_tda18272_freq_map_t(533504000, 0x39, 0x0A, 2) )
518
    ( tvrx2_tda18272_freq_map_t(534528000, 0x38, 0x0A, 2) )
519
    ( tvrx2_tda18272_freq_map_t(536576000, 0x37, 0x0A, 2) )
520
    ( tvrx2_tda18272_freq_map_t(537600000, 0x36, 0x09, 2) )
521
    ( tvrx2_tda18272_freq_map_t(539648000, 0x35, 0x09, 2) )
522
    ( tvrx2_tda18272_freq_map_t(541696000, 0x34, 0x09, 2) )
523
    ( tvrx2_tda18272_freq_map_t(543744000, 0x33, 0x09, 2) )
524
    ( tvrx2_tda18272_freq_map_t(544768000, 0x32, 0x09, 2) )
525
    ( tvrx2_tda18272_freq_map_t(546816000, 0x31, 0x09, 2) )
526
    ( tvrx2_tda18272_freq_map_t(548864000, 0x30, 0x08, 2) )
527
    ( tvrx2_tda18272_freq_map_t(550912000, 0x2F, 0x08, 2) )
528
    ( tvrx2_tda18272_freq_map_t(552960000, 0x2E, 0x08, 2) )
529
    ( tvrx2_tda18272_freq_map_t(555008000, 0x2D, 0x08, 2) )
530
    ( tvrx2_tda18272_freq_map_t(557056000, 0x2C, 0x08, 2) )
531
    ( tvrx2_tda18272_freq_map_t(559104000, 0x2B, 0x08, 2) )
532
    ( tvrx2_tda18272_freq_map_t(561152000, 0x2A, 0x07, 2) )
533
    ( tvrx2_tda18272_freq_map_t(563200000, 0x29, 0x07, 2) )
534
    ( tvrx2_tda18272_freq_map_t(565248000, 0x28, 0x07, 2) )
535
    ( tvrx2_tda18272_freq_map_t(567296000, 0x27, 0x07, 2) )
536
    ( tvrx2_tda18272_freq_map_t(569344000, 0x26, 0x07, 2) )
537
    ( tvrx2_tda18272_freq_map_t(570368000, 0x26, 0x07, 2) )
538
    ( tvrx2_tda18272_freq_map_t(571392000, 0x25, 0x07, 2) )
539
    ( tvrx2_tda18272_freq_map_t(573440000, 0x24, 0x07, 2) )
540
    ( tvrx2_tda18272_freq_map_t(575488000, 0x23, 0x07, 2) )
541
    ( tvrx2_tda18272_freq_map_t(577536000, 0x22, 0x0F, 2) )
542
    ( tvrx2_tda18272_freq_map_t(578560000, 0x21, 0x0F, 2) )
543
    ( tvrx2_tda18272_freq_map_t(580608000, 0x20, 0x0F, 2) )
544
    ( tvrx2_tda18272_freq_map_t(583680000, 0x1F, 0x0F, 2) )
545
    ( tvrx2_tda18272_freq_map_t(585728000, 0x1E, 0x0F, 2) )
546
    ( tvrx2_tda18272_freq_map_t(587776000, 0x1D, 0x0F, 2) )
547
    ( tvrx2_tda18272_freq_map_t(589824000, 0x1C, 0x0F, 2) )
548
    ( tvrx2_tda18272_freq_map_t(592896000, 0x1B, 0x0F, 2) )
549
    ( tvrx2_tda18272_freq_map_t(594944000, 0x1A, 0x0F, 2) )
550
    ( tvrx2_tda18272_freq_map_t(596992000, 0x19, 0x0F, 2) )
551
    ( tvrx2_tda18272_freq_map_t(600064000, 0x18, 0x0F, 2) )
552
    ( tvrx2_tda18272_freq_map_t(602112000, 0x17, 0x0F, 2) )
553
    ( tvrx2_tda18272_freq_map_t(604160000, 0x16, 0x0F, 2) )
554
    ( tvrx2_tda18272_freq_map_t(607232000, 0x15, 0x0F, 2) )
555
    ( tvrx2_tda18272_freq_map_t(609280000, 0x14, 0x0F, 2) )
556
    ( tvrx2_tda18272_freq_map_t(612352000, 0x13, 0x0F, 2) )
557
    ( tvrx2_tda18272_freq_map_t(615424000, 0x12, 0x0F, 2) )
558
    ( tvrx2_tda18272_freq_map_t(617472000, 0x11, 0x0F, 2) )
559
    ( tvrx2_tda18272_freq_map_t(619520000, 0x10, 0x0E, 2) )
560
    ( tvrx2_tda18272_freq_map_t(621568000, 0x0F, 0x0E, 2) )
561
    ( tvrx2_tda18272_freq_map_t(623616000, 0x0F, 0x0E, 2) )
562
    ( tvrx2_tda18272_freq_map_t(624640000, 0xA3, 0x1F, 3) )
563
    ( tvrx2_tda18272_freq_map_t(625664000, 0xA2, 0x1F, 3) )
564
    ( tvrx2_tda18272_freq_map_t(626688000, 0xA1, 0x1F, 3) )
565
    ( tvrx2_tda18272_freq_map_t(627712000, 0xA0, 0x1F, 3) )
566
    ( tvrx2_tda18272_freq_map_t(628736000, 0x9F, 0x1F, 3) )
567
    ( tvrx2_tda18272_freq_map_t(630784000, 0x9E, 0x1F, 3) )
568
    ( tvrx2_tda18272_freq_map_t(631808000, 0x9D, 0x1F, 3) )
569
    ( tvrx2_tda18272_freq_map_t(632832000, 0x9C, 0x1F, 3) )
570
    ( tvrx2_tda18272_freq_map_t(633856000, 0x9B, 0x1F, 3) )
571
    ( tvrx2_tda18272_freq_map_t(635904000, 0x9A, 0x1F, 3) )
572
    ( tvrx2_tda18272_freq_map_t(636928000, 0x99, 0x1F, 3) )
573
    ( tvrx2_tda18272_freq_map_t(637952000, 0x98, 0x1F, 3) )
574
    ( tvrx2_tda18272_freq_map_t(638976000, 0x97, 0x1F, 3) )
575
    ( tvrx2_tda18272_freq_map_t(641024000, 0x96, 0x1E, 3) )
576
    ( tvrx2_tda18272_freq_map_t(642048000, 0x95, 0x1E, 3) )
577
    ( tvrx2_tda18272_freq_map_t(643072000, 0x94, 0x1E, 3) )
578
    ( tvrx2_tda18272_freq_map_t(644096000, 0x93, 0x1D, 3) )
579
    ( tvrx2_tda18272_freq_map_t(646144000, 0x92, 0x1D, 3) )
580
    ( tvrx2_tda18272_freq_map_t(647168000, 0x91, 0x1C, 3) )
581
    ( tvrx2_tda18272_freq_map_t(648192000, 0x90, 0x1C, 3) )
582
    ( tvrx2_tda18272_freq_map_t(650240000, 0x8F, 0x1B, 3) )
583
    ( tvrx2_tda18272_freq_map_t(651264000, 0x8E, 0x1B, 3) )
584
    ( tvrx2_tda18272_freq_map_t(652288000, 0x8D, 0x1B, 3) )
585
    ( tvrx2_tda18272_freq_map_t(654336000, 0x8C, 0x1B, 3) )
586
    ( tvrx2_tda18272_freq_map_t(655360000, 0x8B, 0x1B, 3) )
587
    ( tvrx2_tda18272_freq_map_t(656384000, 0x8A, 0x1B, 3) )
588
    ( tvrx2_tda18272_freq_map_t(658432000, 0x89, 0x1A, 3) )
589
    ( tvrx2_tda18272_freq_map_t(659456000, 0x88, 0x1A, 3) )
590
    ( tvrx2_tda18272_freq_map_t(660480000, 0x87, 0x1A, 3) )
591
    ( tvrx2_tda18272_freq_map_t(661504000, 0x86, 0x19, 3) )
592
    ( tvrx2_tda18272_freq_map_t(662528000, 0x85, 0x19, 3) )
593
    ( tvrx2_tda18272_freq_map_t(664576000, 0x84, 0x18, 3) )
594
    ( tvrx2_tda18272_freq_map_t(665600000, 0x83, 0x18, 3) )
595
    ( tvrx2_tda18272_freq_map_t(666624000, 0x82, 0x18, 3) )
596
    ( tvrx2_tda18272_freq_map_t(668672000, 0x81, 0x18, 3) )
597
    ( tvrx2_tda18272_freq_map_t(669696000, 0x80, 0x17, 3) )
598
    ( tvrx2_tda18272_freq_map_t(671744000, 0x7F, 0x17, 3) )
599
    ( tvrx2_tda18272_freq_map_t(672768000, 0x7E, 0x17, 3) )
600
    ( tvrx2_tda18272_freq_map_t(674816000, 0x7D, 0x17, 3) )
601
    ( tvrx2_tda18272_freq_map_t(675840000, 0x7C, 0x17, 3) )
602
    ( tvrx2_tda18272_freq_map_t(676864000, 0x7B, 0x17, 3) )
603
    ( tvrx2_tda18272_freq_map_t(678912000, 0x7A, 0x17, 3) )
604
    ( tvrx2_tda18272_freq_map_t(679936000, 0x79, 0x17, 3) )
605
    ( tvrx2_tda18272_freq_map_t(681984000, 0x78, 0x17, 3) )
606
    ( tvrx2_tda18272_freq_map_t(683008000, 0x77, 0x17, 3) )
607
    ( tvrx2_tda18272_freq_map_t(685056000, 0x76, 0x17, 3) )
608
    ( tvrx2_tda18272_freq_map_t(686080000, 0x75, 0x17, 3) )
609
    ( tvrx2_tda18272_freq_map_t(688128000, 0x74, 0x17, 3) )
610
    ( tvrx2_tda18272_freq_map_t(689152000, 0x73, 0x17, 3) )
611
    ( tvrx2_tda18272_freq_map_t(691200000, 0x72, 0x16, 3) )
612
    ( tvrx2_tda18272_freq_map_t(693248000, 0x71, 0x16, 3) )
613
    ( tvrx2_tda18272_freq_map_t(694272000, 0x70, 0x16, 3) )
614
    ( tvrx2_tda18272_freq_map_t(696320000, 0x6F, 0x15, 3) )
615
    ( tvrx2_tda18272_freq_map_t(697344000, 0x6E, 0x15, 3) )
616
    ( tvrx2_tda18272_freq_map_t(699392000, 0x6D, 0x15, 3) )
617
    ( tvrx2_tda18272_freq_map_t(700416000, 0x6C, 0x15, 3) )
618
    ( tvrx2_tda18272_freq_map_t(702464000, 0x6B, 0x14, 3) )
619
    ( tvrx2_tda18272_freq_map_t(704512000, 0x6A, 0x14, 3) )
620
    ( tvrx2_tda18272_freq_map_t(704512000, 0x69, 0x14, 3) )
621
    ( tvrx2_tda18272_freq_map_t(706560000, 0x68, 0x14, 3) )
622
    ( tvrx2_tda18272_freq_map_t(707584000, 0x67, 0x13, 3) )
623
    ( tvrx2_tda18272_freq_map_t(709632000, 0x66, 0x13, 3) )
624
    ( tvrx2_tda18272_freq_map_t(711680000, 0x65, 0x13, 3) )
625
    ( tvrx2_tda18272_freq_map_t(712704000, 0x64, 0x13, 3) )
626
    ( tvrx2_tda18272_freq_map_t(714752000, 0x63, 0x13, 3) )
627
    ( tvrx2_tda18272_freq_map_t(716800000, 0x62, 0x13, 3) )
628
    ( tvrx2_tda18272_freq_map_t(717824000, 0x61, 0x13, 3) )
629
    ( tvrx2_tda18272_freq_map_t(719872000, 0x60, 0x13, 3) )
630
    ( tvrx2_tda18272_freq_map_t(721920000, 0x5F, 0x12, 3) )
631
    ( tvrx2_tda18272_freq_map_t(723968000, 0x5E, 0x12, 3) )
632
    ( tvrx2_tda18272_freq_map_t(724992000, 0x5D, 0x12, 3) )
633
    ( tvrx2_tda18272_freq_map_t(727040000, 0x5C, 0x12, 3) )
634
    ( tvrx2_tda18272_freq_map_t(729088000, 0x5B, 0x11, 3) )
635
    ( tvrx2_tda18272_freq_map_t(731136000, 0x5A, 0x11, 3) )
636
    ( tvrx2_tda18272_freq_map_t(732160000, 0x59, 0x11, 3) )
637
    ( tvrx2_tda18272_freq_map_t(734208000, 0x58, 0x11, 3) )
638
    ( tvrx2_tda18272_freq_map_t(736256000, 0x57, 0x10, 3) )
639
    ( tvrx2_tda18272_freq_map_t(738304000, 0x56, 0x10, 3) )
640
    ( tvrx2_tda18272_freq_map_t(740352000, 0x55, 0x10, 3) )
641
    ( tvrx2_tda18272_freq_map_t(741376000, 0x54, 0x10, 3) )
642
    ( tvrx2_tda18272_freq_map_t(743424000, 0x53, 0x10, 3) )
643
    ( tvrx2_tda18272_freq_map_t(745472000, 0x52, 0x0F, 3) )
644
    ( tvrx2_tda18272_freq_map_t(746496000, 0x51, 0x0F, 3) )
645
    ( tvrx2_tda18272_freq_map_t(748544000, 0x50, 0x0F, 3) )
646
    ( tvrx2_tda18272_freq_map_t(750592000, 0x4F, 0x0F, 3) )
647
    ( tvrx2_tda18272_freq_map_t(752640000, 0x4E, 0x0F, 3) )
648
    ( tvrx2_tda18272_freq_map_t(753664000, 0x4D, 0x0F, 3) )
649
    ( tvrx2_tda18272_freq_map_t(755712000, 0x4C, 0x0F, 3) )
650
    ( tvrx2_tda18272_freq_map_t(757760000, 0x4B, 0x0F, 3) )
651
    ( tvrx2_tda18272_freq_map_t(759808000, 0x4A, 0x0F, 3) )
652
    ( tvrx2_tda18272_freq_map_t(761856000, 0x49, 0x0F, 3) )
653
    ( tvrx2_tda18272_freq_map_t(762880000, 0x49, 0x0F, 3) )
654
    ( tvrx2_tda18272_freq_map_t(763904000, 0x48, 0x0F, 3) )
655
    ( tvrx2_tda18272_freq_map_t(765952000, 0x47, 0x0F, 3) )
656
    ( tvrx2_tda18272_freq_map_t(768000000, 0x46, 0x0F, 3) )
657
    ( tvrx2_tda18272_freq_map_t(770048000, 0x45, 0x0F, 3) )
658
    ( tvrx2_tda18272_freq_map_t(772096000, 0x44, 0x0F, 3) )
659
    ( tvrx2_tda18272_freq_map_t(774144000, 0x43, 0x0F, 3) )
660
    ( tvrx2_tda18272_freq_map_t(776192000, 0x42, 0x0F, 3) )
661
    ( tvrx2_tda18272_freq_map_t(778240000, 0x41, 0x0F, 3) )
662
    ( tvrx2_tda18272_freq_map_t(780288000, 0x40, 0x0F, 3) )
663
    ( tvrx2_tda18272_freq_map_t(783360000, 0x3F, 0x0F, 3) )
664
    ( tvrx2_tda18272_freq_map_t(785408000, 0x3E, 0x0F, 3) )
665
    ( tvrx2_tda18272_freq_map_t(787456000, 0x3D, 0x0F, 3) )
666
    ( tvrx2_tda18272_freq_map_t(789504000, 0x3C, 0x0F, 3) )
667
    ( tvrx2_tda18272_freq_map_t(790528000, 0x3B, 0x0F, 3) )
668
    ( tvrx2_tda18272_freq_map_t(792576000, 0x3A, 0x0F, 3) )
669
    ( tvrx2_tda18272_freq_map_t(794624000, 0x39, 0x0F, 3) )
670
    ( tvrx2_tda18272_freq_map_t(797696000, 0x38, 0x0F, 3) )
671
    ( tvrx2_tda18272_freq_map_t(799744000, 0x37, 0x0F, 3) )
672
    ( tvrx2_tda18272_freq_map_t(801792000, 0x36, 0x0F, 3) )
673
    ( tvrx2_tda18272_freq_map_t(803840000, 0x35, 0x0F, 3) )
674
    ( tvrx2_tda18272_freq_map_t(806912000, 0x34, 0x0F, 3) )
675
    ( tvrx2_tda18272_freq_map_t(808960000, 0x33, 0x0F, 3) )
676
    ( tvrx2_tda18272_freq_map_t(809984000, 0x33, 0x0F, 3) )
677
    ( tvrx2_tda18272_freq_map_t(811008000, 0x32, 0x0F, 3) )
678
    ( tvrx2_tda18272_freq_map_t(813056000, 0x31, 0x0F, 3) )
679
    ( tvrx2_tda18272_freq_map_t(816128000, 0x30, 0x0F, 3) )
680
    ( tvrx2_tda18272_freq_map_t(818176000, 0x2F, 0x0F, 3) )
681
    ( tvrx2_tda18272_freq_map_t(820224000, 0x2E, 0x0F, 3) )
682
    ( tvrx2_tda18272_freq_map_t(823296000, 0x2D, 0x0F, 3) )
683
    ( tvrx2_tda18272_freq_map_t(825344000, 0x2C, 0x0F, 3) )
684
    ( tvrx2_tda18272_freq_map_t(828416000, 0x2B, 0x0F, 3) )
685
    ( tvrx2_tda18272_freq_map_t(830464000, 0x2A, 0x0F, 3) )
686
    ( tvrx2_tda18272_freq_map_t(832512000, 0x29, 0x0F, 3) )
687
    ( tvrx2_tda18272_freq_map_t(834560000, 0x28, 0x0F, 3) )
688
    ( tvrx2_tda18272_freq_map_t(836608000, 0x27, 0x0F, 3) )
689
    ( tvrx2_tda18272_freq_map_t(839680000, 0x26, 0x0F, 3) )
690
    ( tvrx2_tda18272_freq_map_t(841728000, 0x25, 0x0F, 3) )
691
    ( tvrx2_tda18272_freq_map_t(844800000, 0x24, 0x0F, 3) )
692
    ( tvrx2_tda18272_freq_map_t(847872000, 0x23, 0x0F, 3) )
693
    ( tvrx2_tda18272_freq_map_t(849920000, 0x22, 0x0F, 3) )
694
    ( tvrx2_tda18272_freq_map_t(852992000, 0x21, 0x0E, 3) )
695
    ( tvrx2_tda18272_freq_map_t(855040000, 0x20, 0x0E, 3) )
696
    ( tvrx2_tda18272_freq_map_t(858112000, 0x1F, 0x0E, 3) )
697
    ( tvrx2_tda18272_freq_map_t(861184000, 0x1E, 0x0E, 3) )
698
    ( tvrx2_tda18272_freq_map_t(863232000, 0x1D, 0x0E, 3) )
699
    ( tvrx2_tda18272_freq_map_t(866304000, 0x1C, 0x0E, 3) )
700
    ( tvrx2_tda18272_freq_map_t(900096000, 0x10, 0x0C, 3) )
701
    ( tvrx2_tda18272_freq_map_t(929792000, 0x07, 0x0B, 3) )
702
    ( tvrx2_tda18272_freq_map_t(969728000, 0x00, 0x0A, 3) )
703
;
704

  
705
static const freq_range_t tvrx2_freq_range(42e6, 870e6);
706

  
707
static const uhd::dict<std::string, std::string> tvrx2_sd_name_to_antennas = map_list_of
708
    ("RX1", "J100")
709
    ("RX2", "J140")
710
;
711

  
712
static const uhd::dict<std::string, subdev_conn_t> tvrx2_sd_name_to_conn = map_list_of
713
    ("RX1",  SUBDEV_CONN_REAL_Q)
714
    ("RX2",  SUBDEV_CONN_REAL_I)
715
;
716

  
717
static const uhd::dict<std::string, boost::uint8_t> tvrx2_sd_name_to_i2c_addr = map_list_of
718
    ("RX1", 0x63)
719
    ("RX2", 0x60)
720
;
721

  
722
static const uhd::dict<std::string, boost::uint8_t> tvrx2_sd_name_to_irq_io = map_list_of
723
    ("RX1", (RX1_IRQ))
724
    ("RX2", (RX2_IRQ))
725
;
726

  
727
static const uhd::dict<std::string, dboard_iface::aux_dac_t> tvrx2_sd_name_to_dac = map_list_of
728
    ("RX1", dboard_iface::AUX_DAC_A)
729
    ("RX2", dboard_iface::AUX_DAC_B)
730
;
731

  
732
static const uhd::dict<std::string, gain_range_t> tvrx2_gain_ranges = map_list_of
733
//    ("LNA", gain_range_t(-12, 15, 3))
734
//    ("RF_FILTER", gain_range_t(-11, -2, 3))
735
//    ("IR_MIXER", gain_range_t(2, 14, 3))
736
//    ("LPF", gain_range_t(0, 9, 3))
737
    ("IF", gain_range_t(0, 30, 0.5))
738
;
739

  
740
/***********************************************************************
741
 * The TVRX2 dboard class
742
 **********************************************************************/
743
class tvrx2 : public rx_dboard_base{
744
public:
745
    tvrx2(ctor_args_t args);
746
    ~tvrx2(void);
747

  
748
    void rx_get(const wax::obj &key, wax::obj &val);
749
    void rx_set(const wax::obj &key, const wax::obj &val);
750

  
751
private:
752
    double _freq_scalar;
753
    double _lo_freq;
754
    double _if_freq;
755
    double _bandwidth;
756
    uhd::dict<std::string, double> _gains;
757
    tda18272hnm_regs_t _tda18272hnm_regs;
758
    uhd::dict<boost::uint32_t, tvrx2_tda18272_rfcal_result_t> _rfcal_results;
759
    uhd::dict<boost::uint32_t, tvrx2_tda18272_rfcal_coeffs_t> _rfcal_coeffs;
760

  
761
    bool _enabled;
762

  
763
    void set_enabled(void);
764
    void set_disabled(void);
765

  
766
    void set_lo_freq(double target_freq);
767
    void set_gain(double gain, const std::string &name);
768
    void set_bandwidth(double bandwidth);
769

  
770
    void set_scaled_rf_freq(double rf_freq);
771
    double get_scaled_rf_freq(void);
772
    void set_scaled_if_freq(double if_freq);
773
    double get_scaled_if_freq(void);
774
    void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg);
775
    void read_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg);
776

  
777
    freq_range_t get_tda18272_rfcal_result_freq_range(boost::uint32_t result);
778
    void tvrx2_tda18272_init_rfcal(void);
779
    void tvrx2_tda18272_tune_rf_filter(boost::uint32_t uRF);
780
    void soft_calibration(void);
781
    void transition_0(void);
782
    void transition_1(void);
783
    void transition_2(int rf_freq);
784
    void transition_3(void);
785
    void transition_4(int rf_freq);
786
    void wait_irq(void);
787
    void test_rf_filter_robustness(void);
788

  
789
/***********************************************************************
790
 * The TVRX2 class helper functions
791
 **********************************************************************/
792
    /*!
793
     * Is the IRQ set or cleared?
794
     * \return true for set
795
     */
796
    bool get_irq(void){
797
        read_reg(0x8, 0x8);
798

  
799
        //return irq status
800
        bool irq = _tda18272hnm_regs.irq_status == tda18272hnm_regs_t::IRQ_STATUS_SET;
801

  
802
        UHD_LOGV(often) << boost::format(
803
            "TVRX2 (%s): IRQ %d"
804
        ) % (get_subdev_name()) % irq << std::endl;
805

  
806
        return irq;
807
    }
808

  
809
    /*!
810
     * In Power-On Reset State?
811
     *      Check POR logic for reset state (causes POR to clear)
812
     * \return true for reset
813
     */
814
    bool get_power_reset(void){
815
        read_reg(0x5, 0x5);
816

  
817
        //return POR state
818
        bool por = _tda18272hnm_regs.por == tda18272hnm_regs_t::POR_RESET;
819

  
820
        UHD_LOGV(often) << boost::format(
821
            "TVRX2 (%s): POR %d"
822
        ) % (get_subdev_name()) % int(_tda18272hnm_regs.por) << std::endl;
823

  
824
        return por;
825
    }
826

  
827
    /*!
828
     * Is the LO locked?
829
     * \return true for locked
830
     */
831
    bool get_locked(void){
832
        read_reg(0x5, 0x5);
833

  
834
        //return lock detect
835
        bool locked = _tda18272hnm_regs.lo_lock == tda18272hnm_regs_t::LO_LOCK_LOCKED;
836

  
837
        UHD_LOGV(often) << boost::format(
838
            "TVRX2 (%s): locked %d"
839
        ) % (get_subdev_name()) % locked << std::endl;
840

  
841
        return locked;
842
    }
843

  
844
    /*!
845
     * Read the RSSI from the registers
846
     * \return the rssi in dB(m?) FIXME
847
     */
848
    double get_rssi(void){
849
        //Launch RSSI calculation with MSM statemachine
850
        _tda18272hnm_regs.set_reg(0x19, 0x80); //set MSM_byte_1 for rssi calculation
851
        _tda18272hnm_regs.set_reg(0x1A, 0x01); //set MSM_byte_2 for launching rssi calculation
852

  
853
        send_reg(0x19, 0x1A);
854

  
855
        wait_irq();
856

  
857
        //read rssi in dBuV
858
        read_reg(0x7, 0x7);
859

  
860
        //calculate the rssi from the voltage
861
        double rssi_dBuV = 40.0 + double(((110.0 - 40.0)/128.0) * _tda18272hnm_regs.get_reg(0x7));
862
        return rssi_dBuV - 107.0; //convert to dBm in 50ohm environment ( -108.8 if 75ohm ) FIXME
863
    }
864

  
865
    /*!
866
     * Read the Temperature from the registers
867
     * \return the temp in degC
868
     */
869
    double get_temp(void){
870
        //Enable Temperature reading
871
        _tda18272hnm_regs.tm_on = tda18272hnm_regs_t::TM_ON_SENSOR_ON;
872
        send_reg(0x4, 0x4);
873

  
874
        //read temp in degC
875
        read_reg(0x3, 0x3);
876

  
877
        UHD_LOGV(often) << boost::format(
878
            "TVRX2 (%s): Temperature %f C"
879
        ) % (get_subdev_name()) % (double(_tda18272hnm_regs.tm_d)) << std::endl;
880

  
881
        //Disable Temperature reading
882
        _tda18272hnm_regs.tm_on = tda18272hnm_regs_t::TM_ON_SENSOR_OFF;
883
        send_reg(0x4, 0x4);
884

  
885
        return (double(_tda18272hnm_regs.tm_d));
886
    }
887
};
888

  
889
/***********************************************************************
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff