MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.91.13.01
uups.h
1 //*****************************************************************************
2 //
3 // uups.h - Driver for the UUPS Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_UUPS_H__
8 #define __MSP430WARE_UUPS_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_UUPS__
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: UUPS_clearInterrupt(), UUPS_enableInterrupt() and
29 // UUPS_disableInterrupt() well as returned by the UUPS_getInterruptStatus()
30 // function.
31 //
32 //*****************************************************************************
33 #define UUPS_POWER_REQUEST_IGNORE_INTERRUPT PREQIG
34 #define UUPS_POWER_UP_TIMEOUT_INTERRUPT PTMOUT
35 
36 //*****************************************************************************
37 //
38 // The following are values that can be passed to the powerMode parameter for
39 // functions: UUPS_gotoPowerMode() as well as returned by the
40 // UUPS_getPowerModeStatus() function.
41 //
42 //*****************************************************************************
43 #define UUPS_POWERMODE_OFF UPSTATE_0
44 #define UUPS_POWERMODE_STANDBY UPSTATE_1
45 #define UUPS_POWERMODE_TRANSITION UPSTATE_2
46 #define UUPS_POWERMODE_READY UPSTATE_3
47 
48 //*****************************************************************************
49 //
50 // The following are values that can be passed to the triggerSource parameter for
51 // functions: UUPS_turnOnPower().
52 //
53 //*****************************************************************************
54 #define UUPS_POWERUP_TRIGGER_SOURCE_USSPWRUP USSPWRUPSEL_0
55 #define UUPS_POWERUP_TRIGGER_SOURCE_RTC USSPWRUPSEL_1
56 #define UUPS_POWERUP_TRIGGER_SOURCE_TIMER USSPWRUPSEL_2
57 #define UUPS_POWERUP_TRIGGER_SOURCE_EXTERNAL USSPWRUPSEL_3
58 
59 //*****************************************************************************
60 //
61 // The following are values that can be returned by the UUPS_isBusy() function.
62 //
63 //*****************************************************************************
64 #define UUPS_BUSY USS_BUSY
65 #define UUPS_NOT_BUSY 0x0
66 
67 //*****************************************************************************
68 //
69 // The following are values that can be returned by the UUPS_isLDOReady() function.
70 //
71 //*****************************************************************************
72 #define UUPS_LDO_READY LDORDY
73 #define UUPS_LDO_NOT_READY 0x0
74 
75 //*****************************************************************************
76 //
77 // The following are values that can be passed to the holdOffDelay parameter for functions: UUPS_setLowPowerBiasHoldOffDelay().
78 //
79 //*****************************************************************************
80 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_NONE LBHDEL_0
81 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_512_REFCLKS LBHDEL_1
82 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_1024_REFCLKS LBHDEL_2
83 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_1536_REFCLKS LBHDEL_3
84 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_100_US LBHDEL_1
85 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_200_US LBHDEL_2
86 #define UUPS_HOLD_OFF_DELAY_ADDITIONAL_300_US LBHDEL_3
87 
88 //*****************************************************************************
89 //
90 // Prototypes for the APIs.
91 //
92 //*****************************************************************************
93 
94 //*****************************************************************************
95 //
96 //! \brief Clears UUPS interrupts.
97 //!
98 //! The UUPS interrupt source is cleared, so that it no longer asserts. If the
99 //! interrupt is not enabled, the corresponding bit in the RIS register bit will
100 //! be cleared. If the interrupt is enabled, the corresponding bit both MIS and
101 //! RIS registers will be both cleared.
102 //!
103 //! \param baseAddress is the base address of the UUPS module.
104 //! \param mask is the logical OR of any of the following:
105 //! - \b UUPS_POWER_REQUEST_IGNORE_INTERRUPT - UUPS power request ignored interrupt
106 //! - \b UUPS_POWER_UP_TIMEOUT_INTERRUPT - UUPS power up time out interrupt
107 //!
108 //! \return None
109 //
110 //*****************************************************************************
111 extern void UUPS_clearInterrupt(uint16_t baseAddress, uint8_t mask);
112 
113 //*****************************************************************************
114 //
115 //! \brief Enables UUPS interrupts.
116 //!
117 //! Enables the indicated UUPS interrupt sources. Only the sources that are
118 //! enabled can be reflected to the processor interrupt; disabled sources have
119 //! no effect on the processor. <b>Does not clear interrupt flags.</b>
120 //!
121 //! \param baseAddress is the base address of the UUPS module.
122 //! \param mask is the logical OR of any of the following:
123 //! - \b UUPS_POWER_REQUEST_IGNORE_INTERRUPT - UUPS power request ignored interrupt
124 //! - \b UUPS_POWER_UP_TIMEOUT_INTERRUPT - UUPS power up time out interrupt
125 //!
126 //! \return None
127 //
128 //*****************************************************************************
129 extern void UUPS_enableInterrupt(uint16_t baseAddress, uint8_t mask);
130 
131 //*****************************************************************************
132 //
133 //! \brief Disables selected UUPS interrupt sources.
134 //!
135 //! Disables the indicated UUPS interrupt sources. Only the sources that are
136 //! enabled can be reflected to the processor interrupt; disabled sources have
137 //! no effect on the processor.
138 //!
139 //! \param baseAddress is the base address of the UUPS module.
140 //! \param mask is the logical OR of any of the following:
141 //! - \b UUPS_POWER_REQUEST_IGNORE_INTERRUPT - UUPS power request ignored interrupt
142 //! - \b UUPS_POWER_UP_TIMEOUT_INTERRUPT - UUPS power up time out interrupt
143 //!
144 //! \return None
145 //
146 //*****************************************************************************
147 extern void UUPS_disableInterrupt(uint16_t baseAddress, uint8_t mask);
148 
149 //*****************************************************************************
150 //
151 //! \brief Gets the current UUPS interrupt status.
152 //!
153 //! This returns the interrupt status for the UUPS module based on which flag
154 //! is passed.
155 //!
156 //! \param baseAddress is the base address of the UUPS module.
157 //! \param mask is the logical OR of any of the following:
158 //! - \b UUPS_POWER_REQUEST_IGNORE_INTERRUPT - UUPS power request ignored interrupt
159 //! - \b UUPS_POWER_UP_TIMEOUT_INTERRUPT - UUPS power up time out interrupt
160 //!
161 //! \return Logical OR of any of the following:
162 //! - \b UUPS_POWER_REQUEST_IGNORE_INTERRUPT - UUPS power request ignored interrupt
163 //! - \b UUPS_POWER_UP_TIMEOUT_INTERRUPT - UUPS power up time out interrupt
164 //
165 //*****************************************************************************
166 extern uint8_t UUPS_getInterruptStatus(uint16_t baseAddress, uint16_t mask);
167 
168 //*****************************************************************************
169 //
170 //! \brief Stops USS measurement.
171 //!
172 //! This stops the USS current measurement.
173 //!
174 //! \param baseAddress is the base address of the UUPS module.
175 //!
176 //! \return None
177 //
178 //*****************************************************************************
179 extern void UUPS_stopMeasurement(uint16_t baseAddress);
180 
181 //*****************************************************************************
182 //
183 //! \brief Turns down USS power.
184 //!
185 //! This stops the current measurement and turn off USS module.
186 //!
187 //! \param baseAddress is the base address of the UUPS module.
188 //!
189 //! \return None
190 //
191 //*****************************************************************************
192 extern void UUPS_turnOffPower(uint16_t baseAddress);
193 
194 //*****************************************************************************
195 //
196 //! \brief Turns on USS power and PLL.
197 //!
198 //! This turns on USS power and PLL with specified power-up trigger source. When
199 //! an external trigger source is selected, this function has no effect.
200 //!
201 //! \param baseAddress is the base address of the UUPS module.
202 //! \param triggerSource is the specified power-up trigger source.
203 //! Valid values are:
204 //! - \b UUPS_POWERUP_TRIGGER_SOURCE_USSPWRUP
205 //! - \b UUPS_POWERUP_TRIGGER_SOURCE_RTC
206 //! - \b UUPS_POWERUP_TRIGGER_SOURCE_TIMER
207 //! - \b UUPS_POWERUP_TRIGGER_SOURCE_EXTERNAL
208 //!
209 //! \return None
210 //
211 //*****************************************************************************
212 extern void UUPS_turnOnPower(uint16_t baseAddress, uint16_t triggerSource);
213 
214 //*****************************************************************************
215 //
216 //! \brief Enables USS acquistion sequencer (ASQ).
217 //!
218 //! This enable the USS acquistion sequencer (ASQ). ASQ must be enabled before
219 //! applying a USS_PWRREQ signal.
220 //!
221 //! \param baseAddress is the base address of the UUPS module.
222 //!
223 //! \return None
224 //
225 //*****************************************************************************
226 extern void UUPS_enableASQ(uint16_t baseAddress);
227 
228 //*****************************************************************************
229 //
230 //! \brief Goes to the specified power mode.
231 //!
232 //! This function makes USS go to the specified power mode.
233 //!
234 //! \param baseAddress is the base address of the UUPS module.
235 //! \param powerMode is the desired power mode to go to.
236 //!
237 //! \return None
238 //
239 //*****************************************************************************
240 //extern void UUPS_gotoPowerMode(uint8_t powerMode);
241 
242 //*****************************************************************************
243 //
244 //! \brief Gets current USS power mode status.
245 //!
246 //! This gets current USS power mode status.
247 //!
248 //! \param baseAddress is the base address of the UUPS module.
249 //!
250 //! \return Any of the following:
251 //! - \b UUPS_POWERMODE_OFF
252 //! - \b UUPS_POWERMODE_READY
253 //! - \b UUPS_POWERMODE_STANDBY
254 //! - \b UUPS_POWERMODE_TIMEOUT
255 //
256 //*****************************************************************************
257 extern uint8_t UUPS_getPowerModeStatus(uint16_t baseAddress);
258 
259 //*****************************************************************************
260 //
261 //! \brief Returns current USS busy status.
262 //!
263 //! This returns current USS busy status depending on whether USS is performing
264 //! a measurement.
265 //!
266 //! \param baseAddress is the base address of the UUPS module.
267 //!
268 //! \return UUPS_BUSY or UUPS_NOT_BUSY
269 //
270 //*****************************************************************************
271 extern uint8_t UUPS_isBusy(uint16_t baseAddress);
272 
273 //*****************************************************************************
274 //
275 //! \brief Returns whether USS LDO is ready.
276 //!
277 //! This returns USS LDO ready status.
278 //!
279 //! \param baseAddress is the base address of the UUPS module.
280 //!
281 //! \return UUPS_LDO_READY or UUPS_LDO_NOT_READY
282 //
283 //*****************************************************************************
284 extern uint8_t UUPS_isLDOReady(uint16_t baseAddress);
285 
286 //*****************************************************************************
287 //
288 //! \brief Sets the low power bias hold off delay.
289 //!
290 //! Defines the duration of the hold off delay for low power bias mode. Low power bias mode can be enabled from SAPH module.
291 //! The hold off delay is inserted from "OFF state" to "READY state" and from "STANDBY state" to "READY state".
292 //! Affects extra delay in Register Mode and Auto Mode.
293 //! Reset type: PUC
294 //!
295 //! \param baseAddress is the base address of the UUPS module.
296 //! \param holdOffDelay is the desired amount of additional hold off delay. 512 REFCLKS = ~100us, 1024 REFCLKS = ~200us, 1536 REFCLKS = ~300us. They map to the same values.
297 //! Valid values are:
298 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_NONE
299 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_512_REFCLKS
300 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_1024_REFCLKS
301 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_1536_REFCLKS
302 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_100_US
303 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_200_US
304 //! - \b UUPS_HOLD_OFF_DELAY_ADDITIONAL_300_US
305 //!
306 //! \return None
307 //
308 //*****************************************************************************
309 extern void UUPS_setLowPowerBiasHoldOffDelay(uint16_t baseAddress, uint16_t holdOffDelay);
310 
311 //*****************************************************************************
312 //
313 //! \brief Hold USS (and sub modules) logic in reset state.
314 //!
315 //! Useful if HSPLL gets stuck. Cycle USS into reset state with this function, and then release from reset state with UUPS_releaseUSSFromResetState.
316 //! USS is default released from reset, and ready for operation (still required to be powered up).
317 //!
318 //! \param baseAddress is the base address of the UUPS module.
319 //!
320 //! \return None
321 //
322 //*****************************************************************************
323 extern void UUPS_holdUSSInResetState(uint16_t baseAddress);
324 
325 //*****************************************************************************
326 //
327 //! \brief Release USS (and sub modules) from reset state for operation.
328 //!
329 //! Useful if HSPLL gets stuck. Cycle USS into reset state with this UUPS_holdUSSInResetState, and then release from reset state with this function.
330 //! USS is default released from reset, and ready for operation (still required to be powered up).
331 //!
332 //! \param baseAddress is the base address of the UUPS module.
333 //!
334 //! \return None
335 //
336 //*****************************************************************************
337 extern void UUPS_releaseUSSFromResetState(uint16_t baseAddress);
338 
339 //*****************************************************************************
340 //
341 // Mark the end of the C bindings section for C++ compilers.
342 //
343 //*****************************************************************************
344 #ifdef __cplusplus
345 }
346 #endif
347 
348 #endif
349 #endif // __MSP430WARE_UUPS_H__
350 
uint8_t UUPS_isBusy(uint16_t baseAddress)
Returns current USS busy status.
Definition: uups.c:66
void UUPS_clearInterrupt(uint16_t baseAddress, uint8_t mask)
Clears UUPS interrupts.
Definition: uups.c:21
uint8_t UUPS_isLDOReady(uint16_t baseAddress)
Returns whether USS LDO is ready.
Definition: uups.c:71
uint8_t UUPS_getPowerModeStatus(uint16_t baseAddress)
Goes to the specified power mode.
Definition: uups.c:61
void UUPS_turnOnPower(uint16_t baseAddress, uint16_t triggerSource)
Turns on USS power and PLL.
Definition: uups.c:51
void UUPS_turnOffPower(uint16_t baseAddress)
Turns down USS power.
Definition: uups.c:46
uint8_t UUPS_getInterruptStatus(uint16_t baseAddress, uint16_t mask)
Gets the current UUPS interrupt status.
Definition: uups.c:36
void UUPS_enableInterrupt(uint16_t baseAddress, uint8_t mask)
Enables UUPS interrupts.
Definition: uups.c:26
void UUPS_disableInterrupt(uint16_t baseAddress, uint8_t mask)
Disables selected UUPS interrupt sources.
Definition: uups.c:31
void UUPS_enableASQ(uint16_t baseAddress)
Enables USS acquistion sequencer (ASQ).
Definition: uups.c:56
void UUPS_holdUSSInResetState(uint16_t baseAddress)
Hold USS (and sub modules) logic in reset state.
Definition: uups.c:82
void UUPS_stopMeasurement(uint16_t baseAddress)
Stops USS measurement.
Definition: uups.c:41
void UUPS_setLowPowerBiasHoldOffDelay(uint16_t baseAddress, uint16_t holdOffDelay)
Sets the low power bias hold off delay.
Definition: uups.c:76
void UUPS_releaseUSSFromResetState(uint16_t baseAddress)
Release USS (and sub modules) from reset state for operation.
Definition: uups.c:87

Copyright 2020, Texas Instruments Incorporated