comparison target-utils/include/abbdefs.h @ 389:e60aecf23970

target-utils: ABB operations implemented (ported from OsmocomBB), linked into pirexplore
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 11 Jun 2014 06:50:46 +0000
parents
children
comparison
equal deleted inserted replaced
388:821a26f90968 389:e60aecf23970
1 /* lifted from OsmocomBB */
2
3 #ifndef _TWL3025_H
4 #define _TWL3025_H
5
6 #define PAGE(n) (n << 7)
7 enum twl3025_reg {
8 VRPCCFG = PAGE(1) | 30,
9 VRPCDEV = PAGE(0) | 30,
10 VRPCMSK = PAGE(1) | 31,
11 VRPCMSKABB = PAGE(1) | 29,
12 VRPCSTS = PAGE(0) | 31,
13 /* Monitoring ADC Registers */
14 MADCTRL = PAGE(0) | 13,
15 MADCSTAT = PAGE(0) | 24,
16 VBATREG = PAGE(0) | 15,
17 VCHGREG = PAGE(0) | 16,
18 ICHGREG = PAGE(0) | 17,
19 VBKPREG = PAGE(0) | 18,
20 ADIN1REG = PAGE(0) | 19,
21 ADIN2REG = PAGE(0) | 20,
22 ADIN3REG = PAGE(0) | 21,
23 ADIN4REG = PAGE(0) | 22,
24 /* Clock Generator Registers */
25 TOGBR1 = PAGE(0) | 4,
26 TOGBR2 = PAGE(0) | 5,
27 PWDNRG = PAGE(1) | 9,
28 TAPCTRL = PAGE(1) | 19,
29 TAPREG = PAGE(1) | 20,
30 /* Automatic Frequency Control (AFC) Registers */
31 AUXAFC1 = PAGE(0) | 7,
32 AUXAFC2 = PAGE(0) | 8,
33 AFCCTLADD = PAGE(1) | 21,
34 AFCOUT = PAGE(1) | 22,
35 /* Automatic Power Control (APC) Registers */
36 APCDEL1 = PAGE(0) | 2,
37 APCDEL2 = PAGE(1) | 26,
38 AUXAPC = PAGE(0) | 9,
39 APCRAM = PAGE(0) | 10,
40 APCOFF = PAGE(0) | 11,
41 APCOUT = PAGE(1) | 12,
42 /* Auxiliary DAC Control Register */
43 AUXDAC = PAGE(0) | 12,
44 /* SimCard Control Register */
45 VRPCSIM = PAGE(1) | 23,
46 /* LED Driver Register */
47 AUXLED = PAGE(1) | 24,
48 /* Battery Charger Interface (BCI) Registers */
49 CHGREG = PAGE(0) | 25,
50 BCICTL1 = PAGE(0) | 28,
51 BCICTL2 = PAGE(0) | 29,
52 BCICONF = PAGE(1) | 13,
53 /* Interrupt and Bus Control (IBIC) Registers */
54 ITMASK = PAGE(0) | 28,
55 ITSTATREG = PAGE(0) | 27, /* both pages! */
56 PAGEREG = PAGE(0) | 1, /* both pages! */
57 /* Baseband Codec (BBC) Registers */
58 BULIOFF = PAGE(1) | 2,
59 BULQOFF = PAGE(1) | 3,
60 BULIDAC = PAGE(1) | 5,
61 BULQDAC = PAGE(1) | 4,
62 BULGCAL = PAGE(1) | 14,
63 BULDATA1 = PAGE(0) | 3, /* 16 words */
64 BBCTRL = PAGE(1) | 6,
65 /* Voiceband Codec (VBC) Registers */
66 VBCTRL1 = PAGE(1) | 8,
67 VBCTRL2 = PAGE(1) | 11,
68 VBPOP = PAGE(1) | 10,
69 VBUCTRL = PAGE(1) | 7,
70 VBDCTRL = PAGE(0) | 6,
71 };
72 #define BULDATA2 BULDATA1
73
74 /* available ADC inputs on IOTA */
75 enum twl3025_dac_inputs {/* === Signal ============================= */
76 MADC_VBAT=0, /* battery voltage / 4 */
77 MADC_VCHG=1, /* charger voltage / 5 */
78 MADC_ICHG=2, /* I-sense amp or CHGREG DAC output */
79 MADC_VBKP=3, /* backup battery voltage / 4 */
80 MADC_ADIN1=4, /* VADCID, sense battery type, not used */
81 MADC_ADIN2=5, /* Temperature sensor in Battery */
82 MADC_ADIN3=6, /* Mode_detect: sense 2.5mm jack insertion */
83 MADC_ADIN4=7, /* RITA: TEMP_SEN */
84 MADC_NUM_CHANNELS=8
85 };
86
87 enum madcstat_reg_bits { /* monitoring ADC status register */
88 ADCBUSY = 0x01 /* if set, a conversion is currently going on */
89 };
90
91 /* BCICTL1 register bits */
92 enum bcictl1_reg_bits {
93 MESBAT = 1<<0, /* connect resistive divider for bat voltage */
94 DACNBUF = 1<<1, /* bypass DAC buffer */
95 THSENS0 = 1<<3, /* thermal sensor bias current (ADIN2), bit 0 */
96 THSENS1 = 1<<4, /* "" bit 1 */
97 THSENS2 = 1<<5, /* "" bit 2 */
98 THEN = 1<<6, /* enable thermal sensor bias current (ADIN1) */
99 TYPEN = 1<<7 /* enable bias current for battery type reading */
100 };
101
102 /* BCICTL1 register bits */
103 enum bcictl2_reg_bits {
104 CHEN = 1<<0, /* enable charger */
105 CHIV = 1<<1, /* 1=constant current, 0=constant voltage */
106 CHBPASSPA=1<<2, /* full charging of the battery during pulse radio */
107 CLIB = 1<<3, /* calibrate I-to-V amp (short input pins) */
108 CHDISPA = 1<<4, /* disabel charging during pulse radio (???) */
109 LEDC = 1<<5, /* enable LED during charge */
110 CGAIN4 = 1<<6, /* if set, I-to-V amp gain is reduced from 10 to 4 */
111 PREOFF = 1<<7 /* disable battery precharge */
112 };
113
114 enum vrpcsts_reg_bits {
115 ONBSTS = 1<<0, /* button push switched on the mobile */
116 ONRSTS = 1<<1, /* RPWON terminal switched on the mobile */
117 ITWSTS = 1<<2, /* ITWAKEUP terminal switched on the mobile */
118 CHGSTS = 1<<3, /* plugging in charger has switched on the mobile */
119 ONREFLT= 1<<4, /* state of PWON terminal after debouncing */
120 ONMRFLT= 1<<5, /* state of RPWON terminal after debouncing */
121 CHGPRES= 1<<6 /* charger is connected */
122 };
123
124 enum togbr2_bits {
125 TOGBR2_KEEPR = (1 << 0), /* Clear KEEPON bit */
126 TOGBR2_KEEPS = (1 << 1), /* Set KEEPON bit */
127 TOGBR2_ACTR = (1 << 2), /* Dectivate MCLK */
128 TOGBR2_ACTS = (1 << 3), /* Activate MCLK */
129 TOGBR2_IBUFPTR1 = (1 << 4), /* Initialize pointer of burst buffer 1 */
130 TOGBR2_IBUFPTR2 = (1 << 5), /* Initialize pointer of burst buffer 2 */
131 TOGBR2_IAPCPTR = (1 << 6), /* Initialize pointer of APC RAM */
132 };
133
134 /* How a RAMP value is encoded */
135 #define ABB_RAMP_VAL(up, down) ( ((down & 0x1F) << 5) | (up & 0x1F) )
136
137 enum twl3025_unit {
138 TWL3025_UNIT_AFC,
139 TWL3025_UNIT_MAD,
140 TWL3025_UNIT_ADA,
141 TWL3025_UNIT_VDL,
142 TWL3025_UNIT_VUL,
143 };
144
145 enum twl3025_tsp_bits {
146 BULON = 0x80,
147 BULCAL = 0x40,
148 BULENA = 0x20,
149 BDLON = 0x10,
150 BDLCAL = 0x08,
151 BDLENA = 0x04,
152 STARTADC = 0x02,
153 };
154
155 #endif