FreeCalypso > hg > freecalypso-citrine
comparison bsp/abb+spi/abb.h @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /******************************************************************************/ | |
2 /* TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION */ | |
3 /* */ | |
4 /* Property of Texas Instruments -- For Unrestricted Internal Use Only */ | |
5 /* Unauthorized reproduction and/or distribution is strictly prohibited. This*/ | |
6 /* product is protected under copyright law and trade secret law as an*/ | |
7 /* unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All*/ | |
8 /* rights reserved. */ | |
9 /* */ | |
10 /* */ | |
11 /* Filename : abb.h */ | |
12 /* */ | |
13 /* Description : Analog BaseBand registers and bits definition. */ | |
14 /* Functions to drive the ABB device. */ | |
15 /* The Serial Port Interface is used to connect the TI */ | |
16 /* Analog BaseBand (ABB). */ | |
17 /* It is assumed that the ABB is connected as the SPI */ | |
18 /* device 0. */ | |
19 /* */ | |
20 /* Author : Pascal PUEL */ | |
21 /* */ | |
22 /* Version number : 1.3 */ | |
23 /* */ | |
24 /* Date and time : 08/22/03 */ | |
25 /* */ | |
26 /* Previous delta : Creation */ | |
27 /* */ | |
28 /******************************************************************************/ | |
29 | |
30 #ifndef __ABB_H__ | |
31 #define __ABB_H__ | |
32 | |
33 #include "../../include/config.h" | |
34 #include "../../include/sys_types.h" | |
35 | |
36 #ifndef _WINDOWS | |
37 | |
38 /*------------------------------------*/ | |
39 /* SYREN PG Definition */ | |
40 /*------------------------------------*/ | |
41 | |
42 #if (ANALOG == 3) // SYREN | |
43 #define S_PG_10 1 | |
44 #define S_PG_20 2 | |
45 #endif // (ANALOG == 3) | |
46 | |
47 | |
48 | |
49 // DEFINITIONS FOR OMEGA/NAUSICA | |
50 #if (ANALOG == 1) | |
51 // ABB PAGE | |
52 #define PAGE0 0x0001 | |
53 #define PAGE1 0x0002 | |
54 | |
55 // ABB REGISTERS | |
56 //=== PAGE 0 ======= | |
57 #define PAGEREG (1 << 1) | |
58 #define APCDEL1 (2 << 1) | |
59 #define BULDATA1_2 (3 << 1) | |
60 #define TOGBR1 (4 << 1) | |
61 #define TOGBR2 (5 << 1) | |
62 #define VBDCTRL (6 << 1) | |
63 #define AUXAFC1 (7 << 1) | |
64 #define AUXAFC2 (8 << 1) | |
65 #define AUXAPC (9 << 1) | |
66 #define APCRAM (10 << 1) | |
67 #define APCOFF (11 << 1) | |
68 #define AUXDAC (12 << 1) | |
69 #define MADCCTRL1 (13 << 1) | |
70 #define MADCCTRL2 (14 << 1) | |
71 #define VBATREG (15 << 1) | |
72 #define VCHGREG (16 << 1) | |
73 #define ICHGREG (17 << 1) | |
74 #define VBKPREG (18 << 1) | |
75 #define ADIN1REG (19 << 1) | |
76 #define ADIN2REG (20 << 1) | |
77 #define ADIN3REG (21 << 1) | |
78 #define ADIN4XREG (22 << 1) | |
79 #define ADIN5YREG (23 << 1) | |
80 #define MADCSTAT (24 << 1) | |
81 #define CHGREG (25 << 1) | |
82 #define ITMASK (26 << 1) | |
83 #define ITSTATREG (27 << 1) | |
84 #define BCICTL1 (28 << 1) | |
85 #define BCICTL2 (29 << 1) | |
86 #define VRPCCTL2 (30 << 1) | |
87 #define VRPCSTS (31 << 1) | |
88 | |
89 //=== PAGE 1 ======= | |
90 #define PAGEREG (1 << 1) | |
91 #define BULIOFF (2 << 1) | |
92 #define BULQOFF (3 << 1) | |
93 #define BULQDAC (4 << 1) | |
94 #define BULIDAC (5 << 1) | |
95 #define BBCTRL (6 << 1) | |
96 #define VBUCTRL (7 << 1) | |
97 #define VBCTRL (8 << 1) | |
98 #define PWDNRG (9 << 1) | |
99 #define TSC_TIMER (10 << 1) | |
100 #define VRPCCTRL3 (11 << 1) | |
101 #define APCOUT (12 << 1) | |
102 #define VRPCBGT (18 << 1) | |
103 #define TAPCTRL (19 << 1) | |
104 #define TAPREG (20 << 1) | |
105 #define AFCCTLADD (21 << 1) | |
106 #define AFCOUT (22 << 1) | |
107 #define VRPCCTRL1 (23 << 1) | |
108 #define VRPCCTRL4 (24 << 1) | |
109 #define APCDEL2 (26 << 1) | |
110 #define ITSTATREG (27 << 1) | |
111 | |
112 // Registers bit definitions | |
113 // ABB device bits definition of register VBCTRL | |
114 #define VDLAUX 0x001 | |
115 #define VDLEAR 0x002 | |
116 #define VBUZ 0x004 | |
117 #define VULSWITCH 0x008 | |
118 #define MICBIAS 0x010 | |
119 #define VALOOP 0x020 | |
120 #define VCLKMODE 0x040 | |
121 #define VSYNC 0x080 | |
122 #define VBDFAUXG 0x100 | |
123 #define VFBYP 0x200 | |
124 | |
125 // ABB device bits definition of register VBUCTRL | |
126 #define DXEN 0x200 | |
127 | |
128 // ABB device bits definition of register VRPCSTS | |
129 #define ONBSTS 0x01 // ON Button push flag | |
130 #define ONRSTS 0x02 // Remote ON flag | |
131 #define ITWSTS 0x04 // Wake-up IT flag | |
132 #define CHGSTS 0x08 // Charger plug flag | |
133 #define ONREFLT 0x10 // ON Button current state | |
134 #define ORMRFLT 0x20 // Remote ON current state | |
135 #define CHGPRES 0x40 // Charger plug current state | |
136 | |
137 // ABB device bits definition of register ITSTATREG | |
138 #define REMOT_IT_STS 0x02 | |
139 #define PUSHOFF_IT_STS 0x04 | |
140 #define CHARGER_IT_STS 0x08 | |
141 #define ADCEND_IT_STS 0x20 | |
142 | |
143 // On Nausica, if the PWR key is pressed, the bit is set, and cleared when released | |
144 #define PWR_OFF_KEY_PRESSED (ONREFLT) | |
145 | |
146 // ABB ADC Interrupts | |
147 #define EOC_INTENA 0x03DF | |
148 #define EOC_INTMASK 0x0020 | |
149 | |
150 // ABB ADC CHANNELS | |
151 #define VBATCV 0x0001 | |
152 #define VCHGCV 0x0002 | |
153 #define ICHGCV 0x0004 | |
154 #define VBKPCV 0x0008 | |
155 #define ADIN1CV 0x0010 | |
156 #define ADIN2CV 0x0020 | |
157 #define ADIN3CV 0x0040 | |
158 #define vADIN4XCV 0x0080 | |
159 #define ADIN5XCV 0x0100 | |
160 #define ALL 0x01FF | |
161 #define NONE 0x0000 | |
162 | |
163 // ABB MODULES | |
164 #define MADC 0x8000 | |
165 #define AFC 0x2000 | |
166 #define ADAC 0x0800 | |
167 #define DCDC 0x0080 | |
168 #define ALLOFF 0x0000 | |
169 | |
170 // Definitions of OMEGA test modes for baseband windows | |
171 #define TSPTEST1 0x001d | |
172 #define TSPTEST2 0x001e | |
173 #define AFCTEST 0x0010 | |
174 #define AFCNORM 0x0000 | |
175 | |
176 | |
177 // DEFINITIONS FOR IOTA | |
178 #elif (ANALOG == 2) | |
179 // ABB PAGE | |
180 #define PAGE0 0x0001 | |
181 #define PAGE1 0x0002 | |
182 #define PAGE2 0x0010 | |
183 | |
184 // ABB REGISTERS | |
185 //=== PAGE 0 ======= | |
186 #define PAGEREG (1 << 1) | |
187 #define APCDEL1 (2 << 1) | |
188 #define BULDATA1_2 (3 << 1) | |
189 #define TOGBR1 (4 << 1) | |
190 #define TOGBR2 (5 << 1) | |
191 #define VBDCTRL (6 << 1) | |
192 #define AUXAFC1 (7 << 1) | |
193 #define AUXAFC2 (8 << 1) | |
194 #define AUXAPC (9 << 1) | |
195 #define APCRAM (10 << 1) | |
196 #define APCOFF (11 << 1) | |
197 #define AUXDAC (12 << 1) | |
198 #define MADCCTRL (13 << 1) | |
199 #define VBATREG (15 << 1) | |
200 #define VCHGREG (16 << 1) | |
201 #define ICHGREG (17 << 1) | |
202 #define VBKPREG (18 << 1) | |
203 #define ADIN1REG (19 << 1) | |
204 #define ADIN2REG (20 << 1) | |
205 #define ADIN3REG (21 << 1) | |
206 #define ADIN4REG (22 << 1) | |
207 #define MADCSTAT (24 << 1) | |
208 #define CHGREG (25 << 1) | |
209 #define ITMASK (26 << 1) | |
210 #define ITSTATREG (27 << 1) | |
211 #define BCICTL1 (28 << 1) | |
212 #define BCICTL2 (29 << 1) | |
213 #define VRPCDEV (30 << 1) | |
214 #define VRPCSTS (31 << 1) | |
215 | |
216 //=== PAGE 1 ======= | |
217 #define PAGEREG (1 << 1) | |
218 #define BULIOFF (2 << 1) | |
219 #define BULQOFF (3 << 1) | |
220 #define BULQDAC (4 << 1) | |
221 #define BULIDAC (5 << 1) | |
222 #define BBCTRL (6 << 1) | |
223 #define VBUCTRL (7 << 1) | |
224 #define VBCTRL1 (8 << 1) | |
225 #define PWDNRG (9 << 1) | |
226 #define VBPOP (10 << 1) | |
227 #define VBCTRL2 (11 << 1) | |
228 #define APCOUT (12 << 1) | |
229 #define BCICONF (13 << 1) | |
230 #define BULGCAL (14 << 1) | |
231 #define TAPCTRL (19 << 1) | |
232 #define TAPREG (20 << 1) | |
233 #define AFCCTLADD (21 << 1) | |
234 #define AFCOUT (22 << 1) | |
235 #define VRPCSIM (23 << 1) | |
236 #define AUXLED (24 << 1) | |
237 #define APCDEL2 (26 << 1) | |
238 #define ITSTATREG (27 << 1) | |
239 #define VRPCMSKABB (29 << 1) | |
240 #define VRPCCFG (30 << 1) | |
241 #define VRPCMSK (31 << 1) | |
242 | |
243 // Registers bit definitions | |
244 // ABB device bits definition of register VBCTRL1 | |
245 #define VDLAUX 0x001 | |
246 #define VDLEAR 0x002 | |
247 #define VBUZ 0x004 | |
248 #define VULSWITCH 0x008 | |
249 #define MICBIAS 0x010 | |
250 #define VALOOP 0x020 | |
251 #define VCLKMODE 0x040 | |
252 #define VSYNC 0x080 | |
253 #define VBDFAUXG 0x100 | |
254 #define VFBYP 0x200 | |
255 | |
256 // ABB device bits definition of register VBCTRL2 | |
257 #define MICBIASEL 0x001 | |
258 #define VDLHSO 0x002 | |
259 #define MICNAUX 0x004 | |
260 | |
261 // ABB device bits definition of register VBUCTRL | |
262 #define DXEN 0x200 | |
263 | |
264 // ABB device bits definition of register VBPOP | |
265 #define HSODIS 0x001 | |
266 #define HSOCHG 0x002 | |
267 #define HSOAUTO 0x004 | |
268 #define EARDIS 0x008 | |
269 #define EARCHG 0x010 | |
270 #define EARAUTO 0x020 | |
271 #define AUXDIS 0x040 | |
272 #define AUXCHG 0x080 | |
273 #define AUXAUTO 0x100 | |
274 | |
275 // ABB device bits definition of register VRPCSTS | |
276 #define ONBSTS 0x01 // ON Button push flag | |
277 #define ONRSTS 0x02 // Remote ON flag | |
278 #define ITWSTS 0x04 // Wake-up IT flag | |
279 #define CHGSTS 0x08 // Charger plug flag | |
280 #define ONREFLT 0x10 // ON Button current state | |
281 #define ORMRFLT 0x20 // Remote ON current state | |
282 #define CHGPRES 0x40 // Charger plug current state | |
283 | |
284 // ABB device bits definition of register ITSTATREG | |
285 #define REMOT_IT_STS 0x02 | |
286 #define PUSHOFF_IT_STS 0x04 | |
287 #define CHARGER_IT_STS 0x08 | |
288 #define ADCEND_IT_STS 0x20 | |
289 | |
290 // On Iota, the bit is set when the key is released and set when the key is pressed | |
291 #define PWR_OFF_KEY_PRESSED (0) | |
292 | |
293 // ABB ADC Interrupts | |
294 #define EOC_INTENA 0x03DF | |
295 #define EOC_INTMASK 0x0020 | |
296 | |
297 // ABB ADC CHANNELS | |
298 #define VBATCV 0x0001 | |
299 #define VCHGCV 0x0002 | |
300 #define ICHGCV 0x0004 | |
301 #define VBKPCV 0x0008 | |
302 #define ADIN1CV 0x0010 | |
303 #define ADIN2CV 0x0020 | |
304 #define ADIN3CV 0x0040 | |
305 #define ADIN4CV 0x0080 | |
306 #define ALL 0x00FF | |
307 #define NONE 0x0000 | |
308 | |
309 // ABB MODULES | |
310 #define MADC 0x8000 | |
311 #define AFC 0x2000 | |
312 #define ADAC 0x0800 | |
313 #define DCDC 0x0080 | |
314 #define ALLOFF 0x0000 | |
315 | |
316 // Definitions of IOTA test modes | |
317 #define TSPTEST1 0x001d | |
318 #define TSPTEST2 0x001e | |
319 #define AFCTEST 0x0010 | |
320 #define AFCNORM 0x0000 | |
321 | |
322 // Definition for IOTA test modes | |
323 #define TSPEN 0x001a | |
324 #define MADCTEST 0x0012 | |
325 #define TSPADC 0x0015 | |
326 #define TSPUP 0x0017 | |
327 #define TSPDN 0x0018 | |
328 | |
329 // Definition for IOTA Power Management | |
330 | |
331 //The duration of the SLPDLY counter must be greater than the process execution time: | |
332 //DBB deep sleep routine included the IT check = DBB sleep routine and IT check | |
333 //+ the seven 32Khz clock cycle interval needed to ABB in order to make effective the sleep abort write access in VRPCDEV ++ // register -> 7*T32Khz = = ABB IBIC propagation delay | |
334 //+ 150us of short asynchronous wake-up time (approximately 4*T32Khz) = ULPD short sleep where Syren/IOTA aborts sleep and | |
335 // write DEVSLEEP = 0 | |
336 | |
337 | |
338 | |
339 | |
340 #define SLPDLY 0x001F // delay to set IOTA in sleep mode (unit: 20*T32Khz) | |
341 #define MASK_SLEEP_MODE 0x0000 // set the regulators in low consumption in sleep mode | |
342 | |
343 | |
344 // DEFINITIONS FOR SYREN | |
345 #elif (ANALOG == 3) | |
346 | |
347 // ABB PAGE | |
348 #define PAGE0 0x0001 | |
349 #define PAGE1 0x0002 | |
350 #define PAGE2 0x0010 | |
351 | |
352 // ABB REGISTERS | |
353 //=== PAGE 0 ======= | |
354 #define PAGEREG (1 << 1) | |
355 #define APCDEL1 (2 << 1) | |
356 #define BULDATA1_2 (3 << 1) | |
357 #define TOGBR1 (4 << 1) | |
358 #define TOGBR2 (5 << 1) | |
359 #define VBDCTRL (6 << 1) | |
360 #define AUXAFC1 (7 << 1) | |
361 #define AUXAFC2 (8 << 1) | |
362 #define AUXAPC (9 << 1) | |
363 #define APCRAM (10 << 1) | |
364 #define APCOFF (11 << 1) | |
365 #define AUXDAC (12 << 1) | |
366 #define MADCCTRL (13 << 1) | |
367 #define CHGIREG (14 << 1) | |
368 #define VBATREG (15 << 1) | |
369 #define VCHGREG (16 << 1) | |
370 #define ICHGREG (17 << 1) | |
371 #define VBKPREG (18 << 1) | |
372 #define ADIN1REG (19 << 1) | |
373 #define ADIN2REG (20 << 1) | |
374 #define ADIN3REG (21 << 1) | |
375 #define ADIN4REG (22 << 1) | |
376 #define ADIN5REG (23 << 1) | |
377 #define MADCSTAT (24 << 1) | |
378 #define CHGVREG (25 << 1) | |
379 #define ITMASK (26 << 1) | |
380 #define ITSTATREG (27 << 1) | |
381 #define BCICTL1 (28 << 1) | |
382 #define BCICTL2 (29 << 1) | |
383 #define VRPCDEV (30 << 1) | |
384 #define VRPCSTS (31 << 1) | |
385 | |
386 //=== PAGE 1 ======= | |
387 #define PAGEREG (1 << 1) | |
388 #define BULIOFF (2 << 1) | |
389 #define BULQOFF (3 << 1) | |
390 #define BULQDAC (4 << 1) | |
391 #define BULIDAC (5 << 1) | |
392 #define BBCTRL (6 << 1) | |
393 #define VBUCTRL (7 << 1) | |
394 #define VBCTRL1 (8 << 1) | |
395 #define PWDNRG (9 << 1) | |
396 #define VBPOP (10 << 1) | |
397 #define VBCTRL2 (11 << 1) | |
398 #define APCOUT (12 << 1) | |
399 #define BCICONF (13 << 1) | |
400 #define BULGCAL (14 << 1) | |
401 #define VAUDCTRL (15 << 1) | |
402 #define VAUSCTRL (16 << 1) | |
403 #define VAUOCTRL (17 << 1) | |
404 #define VAUDPLL (18 << 1) | |
405 #define TAPCTRL (19 << 1) | |
406 #define TAPREG (20 << 1) | |
407 #define AFCCTLADD (21 << 1) | |
408 #define AFCOUT (22 << 1) | |
409 #define VRPCSIMR (23 << 1) | |
410 #define BCIWDOG (24 << 1) | |
411 #define NONE8 (25 << 1) | |
412 #define APCDEL2 (26 << 1) | |
413 #define ITSTATREG (27 << 1) | |
414 | |
415 #if (ANLG_PG == S_PG_20) // SYREN PG2.0 ON EVACONSO | |
416 #define BBCFG (28 << 1) | |
417 #else | |
418 #define NONE9 (28 << 1) | |
419 #endif | |
420 | |
421 #define VRPCMSKOFF (29 << 1) | |
422 #define VRPCCFG (30 << 1) | |
423 #define VRPCMSKSLP (31 << 1) | |
424 | |
425 //=== PAGE 2 ======= | |
426 | |
427 #if (ANLG_PG == S_PG_10) // SYREN PG1.0 ON ESAMPLE | |
428 #define BBCFG (5 << 1) | |
429 #endif | |
430 | |
431 #define VRPCABBTST (25 << 1) | |
432 #define VRPCAUX (30 << 1) | |
433 #define VRPCLDO (31 << 1) | |
434 | |
435 /* INSERT HERE OTHER DEVICES REGISTERS */ | |
436 | |
437 | |
438 // Registers bit definitions | |
439 /*** SYREN internal control bits ***/ | |
440 | |
441 /** For reg. VBCTRL1 **/ | |
442 #define VULSWITCH 0x008 | |
443 #define MICBIAS 0x010 | |
444 #define VALOOP 0x020 | |
445 #define VCLKMODE 0x040 | |
446 #define VSYNC 0x080 | |
447 #define VBDFAUXG 0x100 | |
448 #define VFBYP 0x200 | |
449 | |
450 /** For reg. VBCTRL2 **/ | |
451 #define HSMICSEL 0x001 | |
452 #define MICBIASEL 0x004 | |
453 #define SPKG 0x008 | |
454 #define HSOVMID 0x010 | |
455 #define HSDIF 0x020 | |
456 | |
457 /** For reg. VBUCTRL **/ | |
458 #define DXEN 0x200 | |
459 | |
460 /** For reg. VBPOP **/ | |
461 #define HSODIS 0x001 | |
462 #define HSOCHG 0x002 | |
463 #define HSOAUTO 0x004 | |
464 #define EARDIS 0x008 | |
465 #define EARCHG 0x010 | |
466 #define EARAUTO 0x020 | |
467 #define AUXFDIS 0x040 | |
468 #define AUXAUTO 0x080 | |
469 #define AUXFBYP 0x200 | |
470 | |
471 // ABB device bits definition of register VRPCCFG | |
472 #define PWOND 0x20 // ON Button current state | |
473 #define CHGPRES 0x40 | |
474 | |
475 // ABB device bits definition of register ITSTATREG | |
476 #define REMOT_IT_STS 0x02 | |
477 #define PUSHOFF_IT_STS 0x04 | |
478 #define CHARGER_IT_STS 0x08 | |
479 #define ADCEND_IT_STS 0x20 | |
480 | |
481 // ABB device bits definition of register VRPCSTS | |
482 #define ITWSTS 0x10 // Wake-up IT flag | |
483 #define PWONBSTS 0x20 // ON Button push flag | |
484 #define CHGSTS 0x40 // Charger plug flag | |
485 #define RPSTS 0x100 // Remote ON flag | |
486 | |
487 // ABB ADC Interrupts | |
488 #define EOC_INTENA 0x03DF | |
489 #define EOC_INTMASK 0x0020 | |
490 | |
491 // ABB ADC CHANNELS (reg. MADCCTRL) | |
492 #define VBATCV 0x0001 | |
493 #define VCHGCV 0x0002 | |
494 #define ICHGCV 0x0004 | |
495 #define VBKPCV 0x0008 | |
496 #define ADIN1CV 0x0010 | |
497 #define ADIN2CV 0x0020 | |
498 #define ADIN3CV 0x0040 | |
499 #define ADIN4CV 0x0080 | |
500 #define ADIN5CV 0x0100 | |
501 #define ALL 0x01FF | |
502 #define NONE 0x0000 | |
503 | |
504 // ABB MODULES | |
505 #define MADC 0x8000 | |
506 #define AFC 0x2000 | |
507 #define ADAC 0x0800 | |
508 #define DCDC 0x0080 | |
509 #define ALLOFF 0x0000 | |
510 | |
511 // Definitions of SYREN test modes | |
512 #define TSPTEST1 0x001d | |
513 #define TSPTEST2 0x001e | |
514 #define AFCTEST 0x0010 | |
515 #define AFCNORM 0x0000 | |
516 | |
517 #define TSPEN 0x001a | |
518 #define MADCTEST 0x0012 | |
519 #define TSPADC 0x0015 | |
520 #define TSPUP 0x0017 | |
521 #define TSPDN 0x0018 | |
522 | |
523 // Definition for SYREN Power Management | |
524 | |
525 //The duration of the SLPDLY counter must be greater than the process execution time: | |
526 //DBB deep sleep routine included the IT check = DBB sleep routine and IT check | |
527 //+ the seven 32Khz clock cycle interval needed to ABB in order to make effective the sleep abort write access in VRPCDEV ++ // register -> 7*T32Khz = = ABB IBIC propagation delay | |
528 //+ 150us of short asynchronous wake-up time (approximately 4*T32Khz) = ULPD short sleep where Syren/IOTA aborts sleep and | |
529 // write DEVSLEEP = 0 | |
530 | |
531 #define SLPDLY 0x001F // delay to set SYREN in sleep mode (unit: 20*T32Khz) | |
532 #define MASK_SLEEP_MODE 0x0000 // set the regulators in low consumption in sleep mode | |
533 | |
534 #define LOCORE_SLEEP 0x01 | |
535 #define NORMAL_SLEEP 0x00 | |
536 | |
537 #define MAIN_BG 0x01, | |
538 #define SLEEP_BG 0x00 | |
539 | |
540 #endif // ANALOG == 1,2,3 | |
541 | |
542 | |
543 // Define the level of semaphore protection for all accesses to the ABB | |
544 // 0 for no protection | |
545 // 1 for protection low | |
546 // 2 for protection medium | |
547 // 3 for protection high | |
548 #if (OP_L1_STANDALONE == 1) | |
549 #define ABB_SEMAPHORE_PROTECTION (0) | |
550 #else | |
551 #define ABB_SEMAPHORE_PROTECTION (1) | |
552 #endif | |
553 | |
554 | |
555 | |
556 // PROTOTYPES | |
557 #if (ABB_SEMAPHORE_PROTECTION) | |
558 void ABB_Sem_Create(void); | |
559 #endif | |
560 void ABB_Wait_IBIC_Access(void); | |
561 void ABB_Write_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id, SYS_UWORD16 value); | |
562 SYS_UWORD16 ABB_Read_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id); | |
563 void ABB_free_13M(void); | |
564 void ABB_stop_13M(void); | |
565 SYS_UWORD16 ABB_Read_Status(void); | |
566 void ABB_Conf_ADC(SYS_UWORD16 Channels, SYS_UWORD16 ItVal); | |
567 void ABB_Read_ADC(SYS_UWORD16 *Buff); | |
568 void ABB_on(SYS_UWORD16 modules, SYS_UWORD8 bRecoveryFlag); | |
569 SYS_UWORD32 ABB_sleep(SYS_UWORD8 sleep_performed, SYS_WORD16 afc); | |
570 void ABB_wakeup(SYS_UWORD8 sleep_performed, SYS_WORD16 afc); | |
571 void ABB_wa_VRPC(SYS_UWORD16 value); | |
572 void ABB_Write_Uplink_Data(SYS_UWORD16 *TM_ul_data); | |
573 #if (OP_L1_STANDALONE == 0) | |
574 void ABB_Power_Off(void); | |
575 #endif | |
576 #if (ANALOG ==3) | |
577 void Syren_Sleep_Config(SYS_UWORD16 sleep_type,SYS_UWORD16 bg_select, SYS_UWORD16 sleep_delay); | |
578 #endif | |
579 | |
580 #else // _WINDOWS | |
581 // DEFINITIONS FOR IOTA | |
582 // ABB PAGE | |
583 #define PAGE0 0x0001 | |
584 #define PAGE1 0x0002 | |
585 #define PAGE2 0x0010 | |
586 | |
587 // ABB REGISTERS | |
588 //=== PAGE 0 ======= | |
589 #define PAGEREG (1 << 1) | |
590 #define APCDEL1 (2 << 1) | |
591 #define BULDATA1_2 (3 << 1) | |
592 #define TOGBR1 (4 << 1) | |
593 #define TOGBR2 (5 << 1) | |
594 #define VBDCTRL (6 << 1) | |
595 #define AUXAFC1 (7 << 1) | |
596 #define AUXAFC2 (8 << 1) | |
597 #define AUXAPC (9 << 1) | |
598 #define APCRAM (10 << 1) | |
599 #define APCOFF (11 << 1) | |
600 #define AUXDAC (12 << 1) | |
601 #define MADCCTRL (13 << 1) | |
602 #define VBATREG (15 << 1) | |
603 #define VCHGREG (16 << 1) | |
604 #define ICHGREG (17 << 1) | |
605 #define VBKPREG (18 << 1) | |
606 #define ADIN1REG (19 << 1) | |
607 #define ADIN2REG (20 << 1) | |
608 #define ADIN3REG (21 << 1) | |
609 #define ADIN4REG (22 << 1) | |
610 #define MADCSTAT (24 << 1) | |
611 #define CHGREG (25 << 1) | |
612 #define ITMASK (26 << 1) | |
613 #define ITSTATREG (27 << 1) | |
614 #define BCICTL1 (28 << 1) | |
615 #define BCICTL2 (29 << 1) | |
616 #define VRPCDEV (30 << 1) | |
617 #define VRPCSTS (31 << 1) | |
618 | |
619 //=== PAGE 1 ======= | |
620 #define PAGEREG (1 << 1) | |
621 #define BULIOFF (2 << 1) | |
622 #define BULQOFF (3 << 1) | |
623 #define BULQDAC (4 << 1) | |
624 #define BULIDAC (5 << 1) | |
625 #define BBCTRL (6 << 1) | |
626 #define VBUCTRL (7 << 1) | |
627 #define VBCTRL1 (8 << 1) | |
628 #define PWDNRG (9 << 1) | |
629 #define VBPOP (10 << 1) | |
630 #define VBCTRL2 (11 << 1) | |
631 #define APCOUT (12 << 1) | |
632 #define BCICONF (13 << 1) | |
633 #define BULGCAL (14 << 1) | |
634 #define TAPCTRL (19 << 1) | |
635 #define TAPREG (20 << 1) | |
636 #define AFCCTLADD (21 << 1) | |
637 #define AFCOUT (22 << 1) | |
638 #define VRPCSIM (23 << 1) | |
639 #define AUXLED (24 << 1) | |
640 #define APCDEL2 (26 << 1) | |
641 #define ITSTATREG (27 << 1) | |
642 #define VRPCMSKABB (29 << 1) | |
643 #define VRPCCFG (30 << 1) | |
644 #define VRPCMSK (31 << 1) | |
645 | |
646 // ABB device bits definition of register VBUCTRL | |
647 #define DXEN 0x200 | |
648 | |
649 // ABB device bits definition of register VRPCSTS | |
650 #define ONBSTS 0x01 // ON Button push flag | |
651 #define ONRSTS 0x02 // Remote ON flag | |
652 #define ITWSTS 0x04 // Wake-up IT flag | |
653 #define CHGSTS 0x08 // Charger plug flag | |
654 #define ONREFLT 0x10 // ON Button current state | |
655 #define ORMRFLT 0x20 // Remote ON current state | |
656 #define CHGPRES 0x40 // Charger plug current state | |
657 | |
658 // ABB device bits definition of register ITSTATREG | |
659 #define REMOT_IT_STS 0x02 | |
660 #define PUSHOFF_IT_STS 0x04 | |
661 #define CHARGER_IT_STS 0x08 | |
662 #define ADCEND_IT_STS 0x20 | |
663 | |
664 | |
665 // PROTOTYPES | |
666 void ABB_Write_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id, SYS_UWORD32 value); | |
667 SYS_UWORD16 ABB_Read_Register_on_page(SYS_UWORD16 page, SYS_UWORD16 reg_id); | |
668 SYS_UWORD16 ABB_Read_Status(void); | |
669 void ABB_Conf_ADC(SYS_UWORD16 Channels, SYS_UWORD16 ItVal); | |
670 void ABB_Read_ADC(SYS_UWORD16 *Buff); | |
671 | |
672 #endif // _WINDOWS | |
673 | |
674 #endif // __ABB_H__ |