pcm.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef __PCM_H__
33 #define __PCM_H__
34 
35 //*****************************************************************************
36 //
39 //
40 //*****************************************************************************
41 
42 //*****************************************************************************
43 //
44 // If building with a C++ compiler, make all of the definitions in this header
45 // have a C binding.
46 //
47 //*****************************************************************************
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53 #include <stdint.h>
54 #include <stdbool.h>
55 #include <ti/devices/msp432p4xx/inc/msp.h>
56 
57 //*****************************************************************************
58 //
59 // Control specific variables
60 //
61 //*****************************************************************************
62 #define PCM_KEY 0x695A0000
63 
64 /* Power Modes */
65 #define PCM_AM_LDO_VCORE0 0x00
66 #define PCM_AM_LDO_VCORE1 0x01
67 #define PCM_AM_DCDC_VCORE0 0x04
68 #define PCM_AM_DCDC_VCORE1 0x05
69 #define PCM_AM_LF_VCORE0 0x08
70 #define PCM_AM_LF_VCORE1 0x09
71 #define PCM_LPM0_LDO_VCORE0 0x10
72 #define PCM_LPM0_LDO_VCORE1 0x11
73 #define PCM_LPM0_DCDC_VCORE0 0x14
74 #define PCM_LPM0_DCDC_VCORE1 0x15
75 #define PCM_LPM0_LF_VCORE0 0x18
76 #define PCM_LPM0_LF_VCORE1 0x19
77 #define PCM_LPM3 0x20
78 #define PCM_LPM4 0x21
79 #define PCM_LPM35_VCORE0 0xC0
80 #define PCM_LPM45 0xA0
81 
82 #define PCM_VCORE0 0x00
83 #define PCM_VCORE1 0x01
84 #define PCM_VCORELPM3 0x02
85 
86 #define PCM_LDO_MODE 0x00
87 #define PCM_DCDC_MODE 0x01
88 #define PCM_LF_MODE 0x02
89 
90 #define PCM_SHUTDOWN_PARTIAL PCM_LPM35_VCORE0
91 #define PCM_SHUTDOWN_COMPLETE PCM_LPM45
92 
93 #define PCM_DCDCERROR PCM_IE_DCDC_ERROR_IE
94 #define PCM_AM_INVALIDTRANSITION PCM_IE_AM_INVALID_TR_IE
95 #define PCM_SM_INVALIDCLOCK PCM_IE_LPM_INVALID_CLK_IE
96 #define PCM_SM_INVALIDTRANSITION PCM_IE_LPM_INVALID_TR_IE
97 
98 //*****************************************************************************
99 //
100 // Prototypes for the APIs.
101 //
102 //*****************************************************************************
103 
104 //******************************************************************************
105 //
121 //
122 //******************************************************************************
123 extern bool PCM_setCoreVoltageLevel(uint_fast8_t voltageLevel);
124 
125 //******************************************************************************
126 //
137 //
138 //******************************************************************************
139 extern uint8_t PCM_getCoreVoltageLevel(void);
140 
141 //******************************************************************************
142 //
166 //
167 //******************************************************************************
168 extern bool PCM_setCoreVoltageLevelWithTimeout(uint_fast8_t voltageLevel,
169  uint32_t timeOut);
170 
171 //******************************************************************************
172 //
176 // and it is up to the user to ensure proper state transitions happen
190 //
191 //******************************************************************************
192 extern bool PCM_setCoreVoltageLevelNonBlocking(uint_fast8_t voltageLevel);
193 
194 //******************************************************************************
195 //
208 //
209 //******************************************************************************
210 extern bool PCM_setPowerMode(uint_fast8_t powerMode);
211 
212 //******************************************************************************
213 //
234 //
235 //******************************************************************************
236 extern bool PCM_setPowerModeWithTimeout(uint_fast8_t powerMode,
237  uint32_t timeOut);
238 
239 //******************************************************************************
240 //
244 // and it is up to the user to ensure proper state transitions happen
259 //
260 //******************************************************************************
261 extern bool PCM_setPowerModeNonBlocking(uint_fast8_t powerMode);
262 
263 //******************************************************************************
264 //
270 //
271 //******************************************************************************
272 extern uint8_t PCM_getPowerMode(void);
273 
274 //******************************************************************************
275 //
301 //
302 //******************************************************************************
303 extern bool PCM_setPowerState(uint_fast8_t powerState);
304 
305 //******************************************************************************
306 //
343 //
344 //******************************************************************************
345 extern bool PCM_setPowerStateWithTimeout(uint_fast8_t powerState,
346  uint32_t timeout);
347 
348 //******************************************************************************
349 //
356 //
357 //******************************************************************************
358 extern uint8_t PCM_getPowerState(void);
359 
360 //******************************************************************************
361 //
365 // and it is up to the user to ensure proper state transitions happen
392 //
393 //******************************************************************************
394 extern bool PCM_setPowerStateNonBlocking(uint_fast8_t powerState);
395 
396 //******************************************************************************
397 //
418 //
419 //******************************************************************************
420 extern bool PCM_shutdownDevice(uint32_t shutdownMode);
421 
422 //******************************************************************************
423 //
429 //
430 //******************************************************************************
431 extern bool PCM_gotoLPM0(void);
432 
433 //******************************************************************************
434 //
443 //
444 //******************************************************************************
445 extern bool PCM_gotoLPM3(void);
446 
447 //******************************************************************************
448 //
459 //
460 //******************************************************************************
461 extern bool PCM_gotoLPM0InterruptSafe(void);
462 
463 //******************************************************************************
464 //
478 //
479 //******************************************************************************
480 extern bool PCM_gotoLPM3InterruptSafe(void);
481 
482 //******************************************************************************
483 //
489 //
490 //******************************************************************************
491 extern bool PCM_gotoLPM4(void);
492 
493 //******************************************************************************
494 //
508 //
509 //******************************************************************************
510 extern bool PCM_gotoLPM4InterruptSafe(void);
511 
512 //******************************************************************************
513 //
520 //
521 //******************************************************************************
522 extern void PCM_enableRudeMode(void);
523 
524 //******************************************************************************
525 //
531 //
532 //******************************************************************************
533 extern void PCM_disableRudeMode(void);
534 
535 //*****************************************************************************
536 //
555 //
556 //*****************************************************************************
557 extern void PCM_enableInterrupt(uint32_t flags);
558 
559 //*****************************************************************************
560 //
579 //
580 //*****************************************************************************
581 extern void PCM_disableInterrupt(uint32_t flags);
582 
583 //*****************************************************************************
584 //
596 //
597 //*****************************************************************************
598 extern uint32_t PCM_getInterruptStatus(void);
599 
600 //*****************************************************************************
601 //
616 //
617 //*****************************************************************************
618 extern uint32_t PCM_getEnabledInterruptStatus(void);
619 
620 //*****************************************************************************
621 //
649 //
650 //*****************************************************************************
651 extern void PCM_clearInterruptFlag(uint32_t flags);
652 
653 //*****************************************************************************
654 //
670 //
671 //*****************************************************************************
672 extern void PCM_registerInterrupt(void (*intHandler)(void));
673 
674 //*****************************************************************************
675 //
686 //
687 //*****************************************************************************
688 extern void PCM_unregisterInterrupt(void);
689 
690 //*****************************************************************************
691 //
692 // Mark the end of the C bindings section for C++ compilers.
693 //
694 //*****************************************************************************
695 #ifdef __cplusplus
696 }
697 #endif
698 
699 //*****************************************************************************
700 //
701 // Close the Doxygen group.
703 //
704 //*****************************************************************************
705 
706 #endif // __PCM_H__
bool PCM_gotoLPM0(void)
Definition: pcm.c:453
void PCM_registerInterrupt(void(*intHandler)(void))
Definition: pcm.c:580
bool PCM_setPowerModeNonBlocking(uint_fast8_t powerMode)
Definition: pcm.c:287
bool PCM_setCoreVoltageLevelWithTimeout(uint_fast8_t voltageLevel, uint32_t timeOut)
Definition: pcm.c:120
bool PCM_shutdownDevice(uint32_t shutdownMode)
Definition: pcm.c:400
void PCM_disableInterrupt(uint32_t flags)
Definition: pcm.c:560
bool PCM_gotoLPM3(void)
Definition: pcm.c:485
bool PCM_setPowerStateNonBlocking(uint_fast8_t powerState)
Definition: pcm.c:395
bool PCM_setPowerState(uint_fast8_t powerState)
Definition: pcm.c:385
uint8_t PCM_getPowerMode(void)
Definition: pcm.c:131
bool PCM_gotoLPM0InterruptSafe(void)
Definition: pcm.c:466
bool PCM_setPowerStateWithTimeout(uint_fast8_t powerState, uint32_t timeout)
Definition: pcm.c:390
uint32_t PCM_getEnabledInterruptStatus(void)
Definition: pcm.c:570
void PCM_unregisterInterrupt(void)
Definition: pcm.c:593
bool PCM_setCoreVoltageLevelNonBlocking(uint_fast8_t voltageLevel)
Definition: pcm.c:126
bool PCM_gotoLPM3InterruptSafe(void)
Definition: pcm.c:518
bool PCM_gotoLPM4(void)
Definition: pcm.c:424
uint32_t PCM_getInterruptStatus(void)
Definition: pcm.c:565
bool PCM_gotoLPM4InterruptSafe(void)
Definition: pcm.c:434
void PCM_disableRudeMode(void)
Definition: pcm.c:549
uint8_t PCM_getCoreVoltageLevel(void)
Definition: pcm.c:161
bool PCM_setPowerModeWithTimeout(uint_fast8_t powerMode, uint32_t timeOut)
Definition: pcm.c:292
void PCM_enableRudeMode(void)
Definition: pcm.c:542
bool PCM_setPowerMode(uint_fast8_t powerMode)
Definition: pcm.c:282
uint8_t PCM_getPowerState(void)
Definition: pcm.c:537
bool PCM_setCoreVoltageLevel(uint_fast8_t voltageLevel)
Definition: pcm.c:115
void PCM_clearInterruptFlag(uint32_t flags)
Definition: pcm.c:575
void PCM_enableInterrupt(uint32_t flags)
Definition: pcm.c:555

Copyright 2018, Texas Instruments Incorporated