MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.91.13.01
pmm.h
1 //*****************************************************************************
2 //
3 // pmm.h - Driver for the PMM Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_PMM_H__
8 #define __MSP430WARE_PMM_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_PMM_FRAM__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the mask parameter for
28 // functions: PMM_clearInterrupt(), and PMM_getInterruptStatus() as well as
29 // returned by the PMM_getInterruptStatus() function.
30 //
31 //*****************************************************************************
32 #define PMM_BOR_INTERRUPT PMMBORIFG
33 #define PMM_RST_INTERRUPT PMMRSTIFG
34 #define PMM_POR_INTERRUPT PMMPORIFG
35 #define PMM_SVSH_INTERRUPT SVSHIFG
36 #define PMM_LPM5_INTERRUPT PMMLPM5IFG
37 #define PMM_ALL (0xA7)
38 
39 //*****************************************************************************
40 //
41 // The following are values that can be passed toThe following are values that
42 // can be returned by the PMM_getBandgapMode() function.
43 //
44 //*****************************************************************************
45 #define PMM_STATICMODE (0x0)
46 #define PMM_SAMPLEMODE BGMODE
47 
48 //*****************************************************************************
49 //
50 // The following are values that can be passed toThe following are values that
51 // can be returned by the PMM_isBandgapActive() function.
52 //
53 //*****************************************************************************
54 #define PMM_REFBG_INACTIVE (0x0)
55 #define PMM_REFBG_ACTIVE REFBGACT
56 
57 //*****************************************************************************
58 //
59 // The following are values that can be passed toThe following are values that
60 // can be returned by the PMM_isRefGenActive() function.
61 //
62 //*****************************************************************************
63 #define PMM_REFGEN_INACTIVE (0x0)
64 #define PMM_REFGEN_ACTIVE REFGENACT
65 
66 //*****************************************************************************
67 //
68 // The following are values that can be passed toThe following are values that
69 // can be returned by the PMM_getBufferedBandgapVoltageStatus() function.
70 //
71 //*****************************************************************************
72 #define PMM_REFBG_NOTREADY (0x0)
73 #define PMM_REFBG_READY REFBGRDY
74 
75 //*****************************************************************************
76 //
77 // The following are values that can be passed toThe following are values that
78 // can be returned by the PMM_getVariableReferenceVoltageStatus() function.
79 //
80 //*****************************************************************************
81 #define PMM_REFGEN_NOTREADY (0x0)
82 #define PMM_REFGEN_READY REFGENRDY
83 
84 //*****************************************************************************
85 //
86 // The following are values that can be passed to the refV parameter for
87 // functions: PMM_selectVoltageReference().
88 //
89 //*****************************************************************************
90 #define PMM_REFVSEL_1_5V REFVSEL_0
91 #define PMM_REFVSEL_2_0V REFVSEL_1
92 #define PMM_REFVSEL_2_5V REFVSEL_2
93 
94 //*****************************************************************************
95 //
96 // Prototypes for the APIs.
97 //
98 //*****************************************************************************
99 
100 //*****************************************************************************
101 //
102 //! \brief Enables the high-side SVS circuitry
103 //!
104 //!
105 //! Modified bits of \b PMMCTL0 register.
106 //!
107 //! \return None
108 //
109 //*****************************************************************************
110 extern void PMM_enableSVSH(void);
111 
112 //*****************************************************************************
113 //
114 //! \brief Disables the high-side SVS circuitry
115 //!
116 //!
117 //! Modified bits of \b PMMCTL0 register.
118 //!
119 //! \return None
120 //
121 //*****************************************************************************
122 extern void PMM_disableSVSH(void);
123 
124 //*****************************************************************************
125 //
126 //! \brief Makes the low-dropout voltage regulator (LDO) remain ON when going
127 //! into LPM 3/4.
128 //!
129 //!
130 //! Modified bits of \b PMMCTL0 register.
131 //!
132 //! \return None
133 //
134 //*****************************************************************************
135 extern void PMM_turnOnRegulator(void);
136 
137 //*****************************************************************************
138 //
139 //! \brief Turns OFF the low-dropout voltage regulator (LDO) when going into
140 //! LPM3/4, thus the system will enter LPM3.5 or LPM4.5 respectively
141 //!
142 //!
143 //! Modified bits of \b PMMCTL0 register.
144 //!
145 //! \return None
146 //
147 //*****************************************************************************
148 extern void PMM_turnOffRegulator(void);
149 
150 //*****************************************************************************
151 //
152 //! \brief Calling this function will trigger a software Power On Reset (POR).
153 //!
154 //!
155 //! Modified bits of \b PMMCTL0 register.
156 //!
157 //! \return None
158 //
159 //*****************************************************************************
160 extern void PMM_trigPOR(void);
161 
162 //*****************************************************************************
163 //
164 //! \brief Calling this function will trigger a software Brown Out Rest (BOR).
165 //!
166 //!
167 //! Modified bits of \b PMMCTL0 register.
168 //!
169 //! \return None
170 //
171 //*****************************************************************************
172 extern void PMM_trigBOR(void);
173 
174 //*****************************************************************************
175 //
176 //! \brief Clears interrupt flags for the PMM
177 //!
178 //! \param mask is the mask for specifying the required flag
179 //! Mask value is the logical OR of any of the following:
180 //! - \b PMM_BOR_INTERRUPT - Software BOR interrupt
181 //! - \b PMM_RST_INTERRUPT - RESET pin interrupt
182 //! - \b PMM_POR_INTERRUPT - Software POR interrupt
183 //! - \b PMM_SVSH_INTERRUPT - SVS high side interrupt
184 //! - \b PMM_LPM5_INTERRUPT - LPM5 indication
185 //! - \b PMM_ALL - All interrupts
186 //!
187 //! Modified bits of \b PMMCTL0 register and bits of \b PMMIFG register.
188 //!
189 //! \return None
190 //
191 //*****************************************************************************
192 extern void PMM_clearInterrupt(uint16_t mask);
193 
194 //*****************************************************************************
195 //
196 //! \brief Returns interrupt status
197 //!
198 //! \param mask is the mask for specifying the required flag
199 //! Mask value is the logical OR of any of the following:
200 //! - \b PMM_BOR_INTERRUPT - Software BOR interrupt
201 //! - \b PMM_RST_INTERRUPT - RESET pin interrupt
202 //! - \b PMM_POR_INTERRUPT - Software POR interrupt
203 //! - \b PMM_SVSH_INTERRUPT - SVS high side interrupt
204 //! - \b PMM_LPM5_INTERRUPT - LPM5 indication
205 //! - \b PMM_ALL - All interrupts
206 //!
207 //! \return Logical OR of any of the following:
208 //! - \b PMM_BOR_INTERRUPT Software BOR interrupt
209 //! - \b PMM_RST_INTERRUPT RESET pin interrupt
210 //! - \b PMM_POR_INTERRUPT Software POR interrupt
211 //! - \b PMM_SVSH_INTERRUPT SVS high side interrupt
212 //! - \b PMM_LPM5_INTERRUPT LPM5 indication
213 //! - \b PMM_ALL All interrupts
214 //! \n indicating the status of the selected interrupt flags
215 //
216 //*****************************************************************************
217 extern uint16_t PMM_getInterruptStatus(uint16_t mask);
218 
219 //*****************************************************************************
220 //
221 //! \brief Unlock LPM5
222 //!
223 //! LPMx.5 configuration is not locked and defaults to its reset condition.
224 //! Disable the GPIO power-on default high-impedance mode to activate
225 //! previously configured port settings.
226 //!
227 //!
228 //! \return None
229 //
230 //*****************************************************************************
231 extern void PMM_unlockLPM5(void);
232 
233 //*****************************************************************************
234 //
235 //! \brief Returns the bandgap mode of the PMM module.
236 //!
237 //! This function is used to return the bandgap mode of the PMM module,
238 //! requested by the peripherals using the bandgap. If a peripheral requests
239 //! static mode, then the bandgap mode will be static for all modules, whereas
240 //! if all of the peripherals using the bandgap request sample mode, then that
241 //! will be the mode returned. Sample mode allows the bandgap to be active only
242 //! when necessary to save on power consumption, static mode requires the
243 //! bandgap to be active until no peripherals are using it anymore.
244 //!
245 //!
246 //! \return The bandgap mode of the PMM module:
247 //! Return Logical OR of any of the following:
248 //! - \b PMM_STATICMODE if the bandgap is operating in static mode
249 //! - \b PMM_SAMPLEMODE if the bandgap is operating in sample mode
250 //
251 //*****************************************************************************
252 extern uint16_t PMM_getBandgapMode(void);
253 
254 //*****************************************************************************
255 //
256 //! \brief Returns the active status of the bandgap in the PMM module.
257 //!
258 //! This function is used to return the active status of the bandgap in the PMM
259 //! module. If the bandgap is in use by a peripheral, then the status will be
260 //! seen as active.
261 //!
262 //!
263 //! \return The bandgap active status of the PMM module:
264 //! Return Logical OR of any of the following:
265 //! - \b PMM_REFBG_INACTIVE if the bandgap is not being used at the
266 //! time of query
267 //! - \b PMM_REFBG_ACTIVE if the bandgap is being used at the time of
268 //! query
269 //
270 //*****************************************************************************
271 extern uint16_t PMM_isBandgapActive(void);
272 
273 //*****************************************************************************
274 //
275 //! \brief Returns the active status of the reference generator in the PMM
276 //! module.
277 //!
278 //! This function is used to return the active status of the reference
279 //! generator in the PMM module. If the reference generator is on and ready to
280 //! use, then the status will be seen as active.
281 //!
282 //!
283 //! \return The reference generator active status of the PMM module:
284 //! Return Logical OR of any of the following:
285 //! - \b PMM_REFGEN_INACTIVE if the reference generator is off and not
286 //! operating
287 //! - \b PMM_REFGEN_ACTIVE if the reference generator is on and ready
288 //! to be used
289 //
290 //*****************************************************************************
291 extern uint16_t PMM_isRefGenActive(void);
292 
293 //*****************************************************************************
294 //
295 //! \brief Returns the active status of the reference generator in the PMM
296 //! module.
297 //!
298 //! This function is used to return the ready status of the buffered bandgap
299 //! voltage in the PMM module. If the buffered bandgap voltage is ready to use,
300 //! the ready status will be returned.
301 //!
302 //!
303 //! \return The buffered bandgap voltage ready status of the PMM module:
304 //! Return Logical OR of any of the following:
305 //! - \b PMM_REFBG_NOTREADY if buffered bandgap voltage is NOT ready to
306 //! be used
307 //! - \b PMM_REFBG_READY if buffered bandgap voltage ready to be used
308 //
309 //*****************************************************************************
310 extern uint16_t PMM_getBufferedBandgapVoltageStatus(void);
311 
312 //*****************************************************************************
313 //
314 //! \brief Returns the busy status of the variable reference voltage in the PMM
315 //! module.
316 //!
317 //! This function is used to return the ready status of the variable reference
318 //! voltage in the REFPMM module. If the reference generator is on and ready to
319 //! use, then the ready status will be returned.
320 //!
321 //!
322 //! \return The variable reference voltage active status of the PMM module:
323 //! Return Logical OR of any of the following:
324 //! - \b PMM_REFGEN_NOTREADY if variable reference voltage is NOT ready
325 //! to be used
326 //! - \b PMM_REFGEN_READY if variable reference voltage ready to be
327 //! used
328 //
329 //*****************************************************************************
330 extern uint16_t PMM_getVariableReferenceVoltageStatus(void);
331 
332 //*****************************************************************************
333 //
334 //! \brief Disables the internal temperature sensor to save power consumption.
335 //!
336 //! This function is used to turn off the internal temperature sensor to save
337 //! on power consumption. The temperature sensor is disabled by default.
338 //!
339 //!
340 //! Modified bits are \b TSENSOREN of \b PMMCTL2 register.
341 //!
342 //! \return None
343 //
344 //*****************************************************************************
345 extern void PMM_disableTempSensor(void);
346 
347 //*****************************************************************************
348 //
349 //! \brief Enables the internal temperature sensor.
350 //!
351 //! This function is used to turn on the internal temperature sensor to use by
352 //! other peripherals. The temperature sensor is disabled by default.
353 //!
354 //!
355 //! Modified bits are \b TSENSOREN of \b PMMCTL2 register.
356 //!
357 //! \return None
358 //
359 //*****************************************************************************
360 extern void PMM_enableTempSensor(void);
361 
362 //*****************************************************************************
363 //
364 //! \brief Disables the external reference output.
365 //!
366 //! This function is used to disable the external reference output. The
367 //! external reference is connected to a given external ADC channel. The
368 //! external reference is disabled by default.
369 //!
370 //!
371 //! Modified bits are \b EXTREFEN of \b PMMCTL2 register.
372 //!
373 //! \return None
374 //
375 //*****************************************************************************
376 extern void PMM_disableExternalReference(void);
377 
378 //*****************************************************************************
379 //
380 //! \brief Enables the external reference output.
381 //!
382 //! This function is used to enable the external reference output. The external
383 //! reference is connected to a given external ADC channel. The external
384 //! reference is disabled by default.
385 //!
386 //!
387 //! Modified bits are \b EXTREFEN of \b PMMCTL2 register.
388 //!
389 //! \return None
390 //
391 //*****************************************************************************
392 extern void PMM_enableExternalReference(void);
393 
394 //*****************************************************************************
395 //
396 //! \brief Disables the internal reference output.
397 //!
398 //! This function is used to disable the internal reference output. The
399 //! internal reference is internally connected to the ADC channel. The internal
400 //! reference is disabled by default.
401 //!
402 //!
403 //! Modified bits are \b INTREFEN of \b PMMCTL2 register.
404 //!
405 //! \return None
406 //
407 //*****************************************************************************
408 extern void PMM_disableInternalReference(void);
409 
410 //*****************************************************************************
411 //
412 //! \brief Enables the internal reference output.
413 //!
414 //! This function is used to enable the internal reference output. The internal
415 //! reference is internally connected to the ADC channel. The internal
416 //! reference is disabled by default.
417 //!
418 //!
419 //! Modified bits are \b INTREFEN of \b PMMCTL2 register.
420 //!
421 //! \return None
422 //
423 //*****************************************************************************
424 extern void PMM_enableInternalReference(void);
425 
426 //*****************************************************************************
427 //
428 //! \brief Selects reference voltage level.
429 //!
430 //! This function selects the reference voltage level.
431 //!
432 //! \param refV is the reference voltage
433 //! Valid values are:
434 //! - \b PMM_REFVSEL_1_5V [Default]
435 //! - \b PMM_REFVSEL_2_0V
436 //! - \b PMM_REFVSEL_2_5V
437 //!
438 //! Modified bits are \b REFVSEL of \b PMMCTL2 register.
439 //!
440 //! \return None
441 //
442 //*****************************************************************************
443 extern void PMM_selectVoltageReference(uint16_t refV);
444 
445 //*****************************************************************************
446 //
447 //! \brief Selects power supply in multi-power supply systems.
448 //!
449 //! This function selects power supply in multi power supply systems. A single
450 //! power supply system is not affected by the bits.
451 //!
452 //! \param mode is the power mode
453 //!
454 //! Modified bits are \b PWRMODE of \b PMMCTL2 register.
455 //!
456 //! \return None
457 //
458 //*****************************************************************************
459 extern void PMM_setPowerMode(uint8_t mode);
460 
461 //*****************************************************************************
462 //
463 // Mark the end of the C bindings section for C++ compilers.
464 //
465 //*****************************************************************************
466 #ifdef __cplusplus
467 }
468 #endif
469 
470 #endif
471 #endif // __MSP430WARE_PMM_H__
uint16_t PMM_getVariableReferenceVoltageStatus(void)
Returns the busy status of the variable reference voltage in the PMM module.
Definition: pmm.c:106
void PMM_clearInterrupt(uint16_t mask)
Clears interrupt flags for the PMM.
Definition: pmm.c:63
uint16_t PMM_isBandgapActive(void)
Returns the active status of the bandgap in the PMM module.
Definition: pmm.c:91
uint16_t PMM_getInterruptStatus(uint16_t mask)
Returns interrupt status.
Definition: pmm.c:70
uint16_t PMM_isRefGenActive(void)
Returns the active status of the reference generator in the PMM module.
Definition: pmm.c:96
void PMM_enableInternalReference(void)
Enables the internal reference output.
Definition: pmm.c:156
void PMM_disableSVSH(void)
Disables the high-side SVS circuitry.
Definition: pmm.c:28
void PMM_disableTempSensor(void)
Disables the internal temperature sensor to save power consumption.
Definition: pmm.c:111
void PMM_disableInternalReference(void)
Disables the internal reference output.
Definition: pmm.c:147
void PMM_enableTempSensor(void)
Enables the internal temperature sensor.
Definition: pmm.c:120
void PMM_enableSVSH(void)
Enables the high-side SVS circuitry.
Definition: pmm.c:21
void PMM_turnOnRegulator(void)
Makes the low-dropout voltage regulator (LDO) remain ON when going into LPM 3/4.
Definition: pmm.c:35
void PMM_setPowerMode(uint8_t mode)
Selects power supply in multi-power supply systems.
Definition: pmm.c:172
void PMM_trigBOR(void)
Calling this function will trigger a software Brown Out Rest (BOR).
Definition: pmm.c:56
uint16_t PMM_getBufferedBandgapVoltageStatus(void)
Returns the active status of the reference generator in the PMM module.
Definition: pmm.c:101
void PMM_turnOffRegulator(void)
Turns OFF the low-dropout voltage regulator (LDO) when going into LPM3/4, thus the system will enter ...
Definition: pmm.c:42
void PMM_trigPOR(void)
Calling this function will trigger a software Power On Reset (POR).
Definition: pmm.c:49
uint16_t PMM_getBandgapMode(void)
Returns the bandgap mode of the PMM module.
Definition: pmm.c:86
void PMM_unlockLPM5(void)
Unlock LPM5.
Definition: pmm.c:75
void PMM_enableExternalReference(void)
Enables the external reference output.
Definition: pmm.c:138
void PMM_disableExternalReference(void)
Disables the external reference output.
Definition: pmm.c:129
void PMM_selectVoltageReference(uint16_t refV)
Selects reference voltage level.
Definition: pmm.c:165

Copyright 2020, Texas Instruments Incorporated