SimpleLink MCU SDK Driver APIs  tidrivers_msp43x_3_01_01_03
PowerMSP432.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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  */
48 #ifndef ti_drivers_power_PowerMSP432__include
49 #define ti_drivers_power_PowerMSP432__include
50 
51 #include <stdint.h>
52 #include <ti/drivers/utils/List.h>
53 #include <ti/drivers/Power.h>
54 
55 /* driverlib header files */
56 #include <ti/devices/msp432p4xx/driverlib/pcm.h>
57 #include <ti/devices/msp432p4xx/driverlib/cs.h>
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /* latency times in microseconds (derived from device datasheet) */
64 
66 #define PowerMSP432_RESUMETIMESLEEP 32
67 
69 #define PowerMSP432_TOTALTIMESLEEP 40
70 
72 #define PowerMSP432_RESUMETIMEDEEPSLEEP_0 16
73 
75 #define PowerMSP432_TOTALTIMEDEEPSLEEP_0 40
76 
78 #define PowerMSP432_RESUMETIMEDEEPSLEEP_1 16
79 
81 #define PowerMSP432_TOTALTIMEDEEPSLEEP_1 40
82 
83 /* Power resources (for declaring dependencies) */
84 #define PowerMSP432_PERIPH_ADC14 0
85 
87 #define PowerMSP432_PERIPH_DMA 1
88 
90 #define PowerMSP432_PERIPH_EUSCI_A0 2
91 
93 #define PowerMSP432_PERIPH_EUSCI_A1 3
94 
96 #define PowerMSP432_PERIPH_EUSCI_A2 4
97 
99 #define PowerMSP432_PERIPH_EUSCI_A3 5
100 
102 #define PowerMSP432_PERIPH_EUSCI_B0 6
103 
105 #define PowerMSP432_PERIPH_EUSCI_B1 7
106 
108 #define PowerMSP432_PERIPH_EUSCI_B2 8
109 
111 #define PowerMSP432_PERIPH_EUSCI_B3 9
112 
114 #define PowerMSP432_PERIPH_TIMER_A0 10
115 
117 #define PowerMSP432_PERIPH_TIMER_A1 11
118 
120 #define PowerMSP432_PERIPH_TIMER_A2 12
121 
123 #define PowerMSP432_PERIPH_TIMER_A3 13
124 
126 #define PowerMSP432_PERIPH_TIMER_T32 14
127 
130 /* Power constraints */
131 #define PowerMSP432_DISALLOW_SLEEP 0
132 
134 #define PowerMSP432_DISALLOW_DEEPSLEEP_0 1
135 
137 #define PowerMSP432_DISALLOW_DEEPSLEEP_1 2
138 
140 #define PowerMSP432_DISALLOW_SHUTDOWN_0 3
141 
143 #define PowerMSP432_DISALLOW_SHUTDOWN_1 4
144 
146 #define PowerMSP432_DISALLOW_PERFLEVEL_0 5
147 
149 #define PowerMSP432_DISALLOW_PERFLEVEL_1 6
150 
152 #define PowerMSP432_DISALLOW_PERFLEVEL_2 7
153 
155 #define PowerMSP432_DISALLOW_PERFLEVEL_3 8
156 
158 #define PowerMSP432_DISALLOW_PERFLEVEL_4 9
159 
161 #define PowerMSP432_DISALLOW_PERF_CHANGES 10
162 
164 /* \cond */
165 #define PowerMSP432_NUMCONSTRAINTS 11
166 /* \endcond */
167 
168 /*
169  * Power events
170  *
171  * Each event ID must be a power of two and sequential without any gaps
172  */
173 #define PowerMSP432_ENTERING_SLEEP 0x1
174 
176 #define PowerMSP432_ENTERING_DEEPSLEEP 0x2
177 
179 #define PowerMSP432_ENTERING_SHUTDOWN 0x4
180 
182 #define PowerMSP432_AWAKE_SLEEP 0x8
183 
185 #define PowerMSP432_AWAKE_DEEPSLEEP 0x10
186 
188 #define PowerMSP432_START_CHANGE_PERF_LEVEL 0x20
189 
191 #define PowerMSP432_DONE_CHANGE_PERF_LEVEL 0x40
192 
194 /* \cond */
195 #define PowerMSP432_NUMEVENTS 7
196 /* \endcond */
197 
198 /* Power sleep states */
199 #define PowerMSP432_SLEEP 0x1
200 #define PowerMSP432_DEEPSLEEP_0 0x2
201 #define PowerMSP432_DEEPSLEEP_1 0x4
203 /* Power shutdown states */
204 #define PowerMSP432_SHUTDOWN_0 0x0
205 #define PowerMSP432_SHUTDOWN_1 0x1
211 typedef struct PowerMSP432_PerfLevel {
212  unsigned int activeState; /* device active state */
213  unsigned int VCORE; /* VCORE level */
214  unsigned int clockSource; /* clock source */
215  unsigned int DCORESEL; /* DCO select bits */
216  unsigned int DIVM; /* MCLK divider */
217  unsigned int DIVHS; /* HSMLK divider */
218  unsigned int DIVS; /* SMCLK divider */
219  unsigned int flashWaitStates; /* flash wait states */
220  bool enableFlashBuffer; /* enable flash read buffers? */
221  unsigned int MCLK; /* resulting MCLK frequency */
222  unsigned int HSMCLK; /* resulting HSMCLK frequency */
223  unsigned int SMCLK; /* resulting SMCLK frequency */
224  unsigned int ACLK; /* resulting ACLK frequency */
225 } PowerMSP432_PerfLevel;
229 typedef struct PowerMSP432_Freqs {
230  unsigned int MCLK;
231  unsigned int HSMCLK;
232  unsigned int SMCLK;
233  unsigned int ACLK;
235 
237 typedef struct PowerMSP432_ConfigV1 {
279  unsigned int initialPerfLevel;
303  bool enablePerf; /* enables performance level control */
375  bool enableParking; /* enables automatic pin parking during LPM3 and LPM4 */
377 
382 typedef struct PowerMSP432_ModuleState {
383  List_List notifyList;
384  uint32_t constraintMask;
385  unsigned int state;
386  unsigned int currentPerfLevel;
387  bool enablePolicy;
388  bool perfInitialized;
389  bool initialized;
390  uint8_t constraintCounts[PowerMSP432_NUMCONSTRAINTS];
391  Power_PolicyFxn policyFxn;
392 } PowerMSP432_ModuleState;
401 void PowerMSP432_initPolicy(void);
402 
418 void PowerMSP432_sleepPolicy(void);
419 
439 void PowerMSP432_deepSleepPolicy(void);
440 
447 void PowerMSP432_updateFreqs(PowerMSP432_Freqs *freqs);
448 
454 void PowerMSP432_schedulerDisable(void);
455 
461 void PowerMSP432_schedulerRestore(void);
462 
463 /* function to get the number of performance levels */
464 uint_fast16_t PowerMSP432_getNumPerfLevels(void);
465 
466 /* function to get the frequencies for a specific performance level */
467 int_fast16_t PowerMSP432_getFreqs(uint_fast16_t level,
468  PowerMSP432_Freqs * freqs);
469 
470 /*
471  * On MSP432 peripheral clocks are managed automatically by the device; there
472  * is no need for software control. Use #defines for the dependency APIs to
473  * eliminate any footprint.
474  */
475 /* \cond */
476 #define Power_getDependencyCount(resourceId) Power_EINVALIDINPUT
477 #define Power_releaseDependency(resourceId) Power_EINVALIDINPUT
478 #define Power_setDependency(resourceId) Power_EINVALIDINPUT
479 /* \endcond */
480 
481 #ifdef __cplusplus
482 }
483 #endif
484 
485 #endif /* ti_drivers_PowerMSP432_PowerMSP432__include */
bool enablePerf
Boolean specifying if performance scaling is enabled.
Definition: PowerMSP432.h:303
Structure holding device frequencies (in Hz)
Definition: PowerMSP432.h:229
void PowerMSP432_sleepPolicy(void)
The SLEEP Power Policy.
Definition: List.h:131
unsigned int MCLK
Definition: PowerMSP432.h:230
struct PowerMSP432_ConfigV1 PowerMSP432_ConfigV1
Power global configuration (MSP432-specific)
unsigned int HSMCLK
Definition: PowerMSP432.h:231
void(* Power_PolicyInitFxn)(void)
Power policy initialization function pointer.
Definition: Power.h:92
Power manager interface.
struct PowerMSP432_Freqs PowerMSP432_Freqs
Structure holding device frequencies (in Hz)
void PowerMSP432_initPolicy(void)
The Power Policy initialization function.
void(* Power_PolicyFxn)(void)
Power policy function pointer.
Definition: Power.h:97
Power global configuration (MSP432-specific)
Definition: PowerMSP432.h:237
bool enableParking
Boolean specifying if pull resistors should be automatically applied to input pins during PowerMSP432...
Definition: PowerMSP432.h:375
bool enablePolicy
Boolean specifying if the Power Policy function is enabled.
Definition: PowerMSP432.h:292
void PowerMSP432_deepSleepPolicy(void)
The DEEPSLEEP Power Policy.
Power_PolicyFxn policyFxn
The Power Policy function.
Definition: PowerMSP432.h:267
unsigned int ACLK
Definition: PowerMSP432.h:233
Power_PolicyInitFxn policyInitFxn
The Power Policy's initialization function.
Definition: PowerMSP432.h:244
unsigned int SMCLK
Definition: PowerMSP432.h:232
unsigned int initialPerfLevel
The initial performance level to be established during Power Manager initialization.
Definition: PowerMSP432.h:279
Linked List interface for use in drivers.
Copyright 2016, Texas Instruments Incorporated