root / host / lib / ic_reg_maps / gen_tda18272hnm_regs.py @ a5aece05
History | View | Annotate | Download (24.9 KB)
| 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 |
) |