1 /******************************************************************************
2 *  Filename:       hw_aon_batmon_h
3 *  Revised:        2015-11-12 13:07:02 +0100 (Thu, 12 Nov 2015)
4 *  Revision:       45056
5 *
6 * Copyright (c) 2015, Texas Instruments Incorporated
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1) Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *
15 * 2) Redistributions in binary form must reproduce the above copyright notice,
16 *    this list of conditions and the following disclaimer in the documentation
17 *    and/or other materials provided with the distribution.
18 *
19 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
20 *    be used to endorse or promote products derived from this software without
21 *    specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36 
37 #ifndef __HW_AON_BATMON_H__
38 #define __HW_AON_BATMON_H__
39 
40 //*****************************************************************************
41 //
42 // This section defines the register offsets of
43 // AON_BATMON component
44 //
45 //*****************************************************************************
46 // Internal
47 #define AON_BATMON_O_CTL                                            0x00000000
48 
49 // Internal
50 #define AON_BATMON_O_MEASCFG                                        0x00000004
51 
52 // Internal
53 #define AON_BATMON_O_TEMPP0                                         0x0000000C
54 
55 // Internal
56 #define AON_BATMON_O_TEMPP1                                         0x00000010
57 
58 // Internal
59 #define AON_BATMON_O_TEMPP2                                         0x00000014
60 
61 // Internal
62 #define AON_BATMON_O_BATMONP0                                       0x00000018
63 
64 // Internal
65 #define AON_BATMON_O_BATMONP1                                       0x0000001C
66 
67 // Internal
68 #define AON_BATMON_O_IOSTRP0                                        0x00000020
69 
70 // Internal
71 #define AON_BATMON_O_FLASHPUMPP0                                    0x00000024
72 
73 // Last Measured Battery Voltage
74 #define AON_BATMON_O_BAT                                            0x00000028
75 
76 // Battery Update
77 #define AON_BATMON_O_BATUPD                                         0x0000002C
78 
79 // Temperature
80 #define AON_BATMON_O_TEMP                                           0x00000030
81 
82 // Temperature Update
83 #define AON_BATMON_O_TEMPUPD                                        0x00000034
84 
85 //*****************************************************************************
86 //
87 // Register: AON_BATMON_O_CTL
88 //
89 //*****************************************************************************
90 // Field:     [1] CALC_EN
91 //
92 // Internal. Only to be used through TI provided API.
93 #define AON_BATMON_CTL_CALC_EN                                      0x00000002
94 #define AON_BATMON_CTL_CALC_EN_BITN                                          1
95 #define AON_BATMON_CTL_CALC_EN_M                                    0x00000002
96 #define AON_BATMON_CTL_CALC_EN_S                                             1
97 
98 // Field:     [0] MEAS_EN
99 //
100 // Internal. Only to be used through TI provided API.
101 #define AON_BATMON_CTL_MEAS_EN                                      0x00000001
102 #define AON_BATMON_CTL_MEAS_EN_BITN                                          0
103 #define AON_BATMON_CTL_MEAS_EN_M                                    0x00000001
104 #define AON_BATMON_CTL_MEAS_EN_S                                             0
105 
106 //*****************************************************************************
107 //
108 // Register: AON_BATMON_O_MEASCFG
109 //
110 //*****************************************************************************
111 // Field:   [1:0] PER
112 //
113 // Internal. Only to be used through TI provided API.
114 // ENUMs:
115 // 32CYC                    Internal. Only to be used through TI provided API.
116 // 16CYC                    Internal. Only to be used through TI provided API.
117 // 8CYC                     Internal. Only to be used through TI provided API.
118 // CONT                     Internal. Only to be used through TI provided API.
119 #define AON_BATMON_MEASCFG_PER_W                                             2
120 #define AON_BATMON_MEASCFG_PER_M                                    0x00000003
121 #define AON_BATMON_MEASCFG_PER_S                                             0
122 #define AON_BATMON_MEASCFG_PER_32CYC                                0x00000003
123 #define AON_BATMON_MEASCFG_PER_16CYC                                0x00000002
124 #define AON_BATMON_MEASCFG_PER_8CYC                                 0x00000001
125 #define AON_BATMON_MEASCFG_PER_CONT                                 0x00000000
126 
127 //*****************************************************************************
128 //
129 // Register: AON_BATMON_O_TEMPP0
130 //
131 //*****************************************************************************
132 // Field:   [7:0] CFG
133 //
134 // Internal. Only to be used through TI provided API.
135 #define AON_BATMON_TEMPP0_CFG_W                                              8
136 #define AON_BATMON_TEMPP0_CFG_M                                     0x000000FF
137 #define AON_BATMON_TEMPP0_CFG_S                                              0
138 
139 //*****************************************************************************
140 //
141 // Register: AON_BATMON_O_TEMPP1
142 //
143 //*****************************************************************************
144 // Field:   [5:0] CFG
145 //
146 // Internal. Only to be used through TI provided API.
147 #define AON_BATMON_TEMPP1_CFG_W                                              6
148 #define AON_BATMON_TEMPP1_CFG_M                                     0x0000003F
149 #define AON_BATMON_TEMPP1_CFG_S                                              0
150 
151 //*****************************************************************************
152 //
153 // Register: AON_BATMON_O_TEMPP2
154 //
155 //*****************************************************************************
156 // Field:   [4:0] CFG
157 //
158 // Internal. Only to be used through TI provided API.
159 #define AON_BATMON_TEMPP2_CFG_W                                              5
160 #define AON_BATMON_TEMPP2_CFG_M                                     0x0000001F
161 #define AON_BATMON_TEMPP2_CFG_S                                              0
162 
163 //*****************************************************************************
164 //
165 // Register: AON_BATMON_O_BATMONP0
166 //
167 //*****************************************************************************
168 // Field:   [5:0] CFG
169 //
170 // Internal. Only to be used through TI provided API.
171 #define AON_BATMON_BATMONP0_CFG_W                                            6
172 #define AON_BATMON_BATMONP0_CFG_M                                   0x0000003F
173 #define AON_BATMON_BATMONP0_CFG_S                                            0
174 
175 //*****************************************************************************
176 //
177 // Register: AON_BATMON_O_BATMONP1
178 //
179 //*****************************************************************************
180 // Field:   [5:0] CFG
181 //
182 // Internal. Only to be used through TI provided API.
183 #define AON_BATMON_BATMONP1_CFG_W                                            6
184 #define AON_BATMON_BATMONP1_CFG_M                                   0x0000003F
185 #define AON_BATMON_BATMONP1_CFG_S                                            0
186 
187 //*****************************************************************************
188 //
189 // Register: AON_BATMON_O_IOSTRP0
190 //
191 //*****************************************************************************
192 // Field:   [5:4] CFG2
193 //
194 // Internal. Only to be used through TI provided API.
195 #define AON_BATMON_IOSTRP0_CFG2_W                                            2
196 #define AON_BATMON_IOSTRP0_CFG2_M                                   0x00000030
197 #define AON_BATMON_IOSTRP0_CFG2_S                                            4
198 
199 // Field:   [3:0] CFG1
200 //
201 // Internal. Only to be used through TI provided API.
202 #define AON_BATMON_IOSTRP0_CFG1_W                                            4
203 #define AON_BATMON_IOSTRP0_CFG1_M                                   0x0000000F
204 #define AON_BATMON_IOSTRP0_CFG1_S                                            0
205 
206 //*****************************************************************************
207 //
208 // Register: AON_BATMON_O_FLASHPUMPP0
209 //
210 //*****************************************************************************
211 // Field:     [8] FALLB
212 //
213 // Internal. Only to be used through TI provided API.
214 #define AON_BATMON_FLASHPUMPP0_FALLB                                0x00000100
215 #define AON_BATMON_FLASHPUMPP0_FALLB_BITN                                    8
216 #define AON_BATMON_FLASHPUMPP0_FALLB_M                              0x00000100
217 #define AON_BATMON_FLASHPUMPP0_FALLB_S                                       8
218 
219 // Field:   [7:6] HIGHLIM
220 //
221 // Internal. Only to be used through TI provided API.
222 #define AON_BATMON_FLASHPUMPP0_HIGHLIM_W                                     2
223 #define AON_BATMON_FLASHPUMPP0_HIGHLIM_M                            0x000000C0
224 #define AON_BATMON_FLASHPUMPP0_HIGHLIM_S                                     6
225 
226 // Field:     [5] LOWLIM
227 //
228 // Internal. Only to be used through TI provided API.
229 #define AON_BATMON_FLASHPUMPP0_LOWLIM                               0x00000020
230 #define AON_BATMON_FLASHPUMPP0_LOWLIM_BITN                                   5
231 #define AON_BATMON_FLASHPUMPP0_LOWLIM_M                             0x00000020
232 #define AON_BATMON_FLASHPUMPP0_LOWLIM_S                                      5
233 
234 // Field:     [4] OVR
235 //
236 // Internal. Only to be used through TI provided API.
237 #define AON_BATMON_FLASHPUMPP0_OVR                                  0x00000010
238 #define AON_BATMON_FLASHPUMPP0_OVR_BITN                                      4
239 #define AON_BATMON_FLASHPUMPP0_OVR_M                                0x00000010
240 #define AON_BATMON_FLASHPUMPP0_OVR_S                                         4
241 
242 // Field:   [3:0] CFG
243 //
244 // Internal. Only to be used through TI provided API.
245 #define AON_BATMON_FLASHPUMPP0_CFG_W                                         4
246 #define AON_BATMON_FLASHPUMPP0_CFG_M                                0x0000000F
247 #define AON_BATMON_FLASHPUMPP0_CFG_S                                         0
248 
249 //*****************************************************************************
250 //
251 // Register: AON_BATMON_O_BAT
252 //
253 //*****************************************************************************
254 // Field:  [10:8] INT
255 //
256 // Integer part:
257 //
258 // 0x0: 0V + fractional part
259 // ...
260 // 0x3: 3V + fractional part
261 // 0x4: 4V + fractional part
262 #define AON_BATMON_BAT_INT_W                                                 3
263 #define AON_BATMON_BAT_INT_M                                        0x00000700
264 #define AON_BATMON_BAT_INT_S                                                 8
265 
266 // Field:   [7:0] FRAC
267 //
268 // Fractional part, standard binary fractional encoding.
269 //
270 // 0x00: .0V
271 // ...
272 // 0x20: 1/8 = .125V
273 // 0x40: 1/4 = .25V
274 // 0x80: 1/2 = .5V
275 // ...
276 // 0xA0: 1/2 + 1/8 = .625V
277 // ...
278 // 0xFF: Max
279 #define AON_BATMON_BAT_FRAC_W                                                8
280 #define AON_BATMON_BAT_FRAC_M                                       0x000000FF
281 #define AON_BATMON_BAT_FRAC_S                                                0
282 
283 //*****************************************************************************
284 //
285 // Register: AON_BATMON_O_BATUPD
286 //
287 //*****************************************************************************
288 // Field:     [0] STAT
289 //
290 //
291 // 0: No update since last clear
292 // 1: New battery voltage is present.
293 //
294 // Write 1 to clear the status.
295 #define AON_BATMON_BATUPD_STAT                                      0x00000001
296 #define AON_BATMON_BATUPD_STAT_BITN                                          0
297 #define AON_BATMON_BATUPD_STAT_M                                    0x00000001
298 #define AON_BATMON_BATUPD_STAT_S                                             0
299 
300 //*****************************************************************************
301 //
302 // Register: AON_BATMON_O_TEMP
303 //
304 //*****************************************************************************
305 // Field:  [16:8] INT
306 //
307 // Integer part (signed) of temperature value.
308 // Total value = INTEGER + FRACTIONAL
309 // 2's complement encoding
310 //
311 // 0x100: Min value
312 // 0x1D8: -40C
313 // 0x1FF: -1C
314 // 0x00: 0C
315 // 0x1B: 27C
316 // 0x55: 85C
317 // 0xFF: Max value
318 #define AON_BATMON_TEMP_INT_W                                                9
319 #define AON_BATMON_TEMP_INT_M                                       0x0001FF00
320 #define AON_BATMON_TEMP_INT_S                                                8
321 
322 //*****************************************************************************
323 //
324 // Register: AON_BATMON_O_TEMPUPD
325 //
326 //*****************************************************************************
327 // Field:     [0] STAT
328 //
329 //
330 // 0: No update since last clear
331 // 1: New temperature is present.
332 //
333 // Write 1 to clear the status.
334 #define AON_BATMON_TEMPUPD_STAT                                     0x00000001
335 #define AON_BATMON_TEMPUPD_STAT_BITN                                         0
336 #define AON_BATMON_TEMPUPD_STAT_M                                   0x00000001
337 #define AON_BATMON_TEMPUPD_STAT_S                                            0
338 
339 
340 #endif // __AON_BATMON__
341