1 /*
2  * Copyright 2021-2023 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 #ifndef _FSL_PM_CORE_H_
8 #define _FSL_PM_CORE_H_
9 
10 #include "fsl_common.h"
11 #include "fsl_component_generic_list.h"
12 
13 #include "fsl_pm_config.h"
14 
15 /*!
16  * @defgroup PM Framework: Power Manager Framework
17  * @details This document consists of sections titled with <b>Framework Overview</b>, <b>Data Structures</b>,
18  *          <b>Enumerations</b>, <b>Functions</b>, etc., each with an overview list and detailed documentation.
19  *          It is recommended to read the <b>Framework Overview</b> first for it includes a comprehensive description
20  *          of the framework. Other sections give detailed information for APIs, enums, macros, etc., for your further
21  *          reference.
22  * @{
23  */
24 
25 /*******************************************************************************
26  * Introducation of power manager framework
27  ******************************************************************************/
28 /*!
29  * Framework Overview
30  * ==================
31  * The power manager framework manages the transition of both active-to-sleep and sleep-to-active states of the MCU. It
32  * provides the upper layer software the ability to set and release constraints of the hardware basic
33  * resources(such as clock, power, ram, etc.) and the ability to register callback
34  * functions to be invoked before entering/after exiting the sleep mode. In addition, the upper layer software
35  * can register the wakeup source service function to be executed if related wakeup source occurs.
36  *
37  *              +-----------------------------------------------------------------+
38  *              |                       Application Software                      |
39  *              +-----------------------------------------------------------------+
40  *              +-----------------------------------------------------------------+
41  *              |                       Stacks and Components                     |
42  *              +-----------------------------------------------------------------+
43  *              +-----------------------------------------------------------------+
44  *              |                       Power Manager Framework                   |
45  *              +-----------------------------------------------------------------+
46  *              +---------------+    +---------------+    +-----------------------+
47  *              | Power Drivers |    | Clock Drivers |    | Wakeup Source Drivers |
48  *              +---------------+    +---------------+    +-----------------------+
49  *
50  * As shown above, the power manager framework safely manages the transitions to and from power saving states by using
51  * MCUXpresso SDK drivers, and the upper layer software only need to use the APIs of power manager framework. Different
52  * MCUs have the same top-level APIs, concepts and conventions.
53  *
54  * Definitions and Terms:
55  * ======================
56  *  - \b Constraint\n
57  *      A system-level declaration that asks the power manager to prevent a specific action. For
58  *      example, if the application sets the constraint as that the ARM PLL should not be turned off, then the power
59  * manager framework will compute the deepest power state with the ARM PLL being turned on. Otherwise, a decision might
60  * be made to transit to a sleep state with ARM PLL being turned off.
61  *
62  *  - \b Notification\n
63  *      A callback mechanism that allows the upper layer software to be notified of specific power
64  *      transitions. Some hardware peripherals may need several steps to enter into or exit the low power mode, so
65  * multiple callbacks are necessary to avoid undesired waiting loop. To address this problem, there are 3 groups of
66  * notification set in the power manager framework. The power manager will execute registered notification callback
67  * functions from group0 to group2 before entering into low power mode while from group2 to group0 after exiting from
68  * low power mode.
69  *
70  *  - \b Wakeup \b Source\n
71  *      Structure that contains the wakeup source Id and its service functions. The upper layer software
72  *      can create the wakeup source object by invoking PM_RegisterWakeupSource() function. The parameter \b wsId is
73  *      the MCU wakeup source definition available. If the MCU exits from the low power mode based on the registered
74  *      wakeup source, the function PM_TriggerWakeSourceService() should be invoked to execute wakeup source service
75  *      function.
76  *
77  * Power Manager Framework Architecture:
78  * =====================================
79  *  The power manager framework consists of four modules: policy module, sequencer module, wakeup source
80  *  manager module, and notification module.
81  *  - The policy module can gather all the constraints from the whole system and then compute the deepest allowed power
82  *  state.
83  *  - The sequencer module is in charge of the power mode entry and exit sequences.
84  *  - The wakeup source manager module is in charge of configuring wakeup sources in low power entry and processing
85  *  registered wakeup source handler callback.
86  *  - The notification module is in charge of notifying the upper layer software of speciic power transitions and
87  * events.
88  *
89  *  To make the power manager framework adapts to different MCU families, the power manager framework adopts a
90  * layer-designed idea, extracting common parts as the pm_core level, and separating device-related parts as the
91  * pm_device level. In details, the pm_core level contains policy module, wakeup source manager module, and notification
92  * module. The pm_device level contains sequencer module.
93  */
94 
95 /*******************************************************************************
96  * Definitions
97  ******************************************************************************/
98 
99 #if (defined(FSL_PM_SUPPORT_ALWAYS_ON_SECTION) && FSL_PM_SUPPORT_ALWAYS_ON_SECTION)
100 /*! @name Always On Region */
101 #if (defined(__ICCARM__))
102 #define AT_ALWAYS_ON_DATA(var)      var @"AlwaysOnData"
103 #define AT_ALWAYS_ON_DATA_INIT(var) var @"AlwaysOnData.init"
104 #elif (defined(__CC_ARM) || defined(__ARMCC_VERSION))
105 #define AT_ALWAYS_ON_DATA(var)      __attribute__((section("AlwaysOnData"), zero_init)) var
106 #define AT_ALWAYS_ON_DATA_INIT(var) __attribute__((section("AlwaysOnData.init"))) var
107 #elif (defined(__GNUC__))
108 #define AT_ALWAYS_ON_DATA(var)      __attribute__((section("AlwaysOnData"))) var
109 #define AT_ALWAYS_ON_DATA_INIT(var) __attribute__((section("AlwaysOnData.init"))) var
110 #else
111 #error Toolchain not supported.
112 #endif /* defined(__ICCARM__) */
113 #else
114 #define AT_ALWAYS_ON_DATA(var)      var
115 #define AT_ALWAYS_ON_DATA_INIT(var) var
116 /*! @} */
117 #endif /* FSL_PM_SUPPORT_ALWAYS_ON_SECTION */
118 
119 /*!
120  * @brief Power manager status.
121  * @anchor _pm_status
122  */
123 enum
124 {
125     kStatus_PMSuccess                  = kStatus_Success,
126     kStatus_PMFail                     = kStatus_Fail,
127     kStatus_PMWakeupSourceEnableError  = MAKE_STATUS(kStatusGroup_POWER_MANAGER, 1U),
128     kStatus_PMWakeupSourceDisableError = MAKE_STATUS(kStatusGroup_POWER_MANAGER, 2U),
129     kStatus_PMWakeupSourceServiceBusy  = MAKE_STATUS(kStatusGroup_POWER_MANAGER, 3U),
130     kStatus_PMPowerStateNotAllowed     = MAKE_STATUS(kStatusGroup_POWER_MANAGER, 4U),
131     kStatus_PMNotifyEventError         = MAKE_STATUS(kStatusGroup_POWER_MANAGER, 5U),
132 };
133 
134 #if (defined(FSL_PM_SUPPORT_NOTIFICATION) && FSL_PM_SUPPORT_NOTIFICATION)
135 /*!
136  * @brief Power manager event type, used in notification module to inform the upper layer software
137  * of the power transition event.
138  */
139 typedef enum _pm_event_type
140 {
141     kPM_EventEnteringSleep = 0U, /*!< Entering a sleep state. */
142     kPM_EventExitingSleep,       /*!< Exiting a sleep state. */
143 } pm_event_type_t;
144 
145 /*!
146  * @brief The enumeration of notification group.
147  */
148 typedef enum _pm_notify_group
149 {
150     kPM_NotifyGroup0 =
151         0U,           /*!< Notify group0, before entering power state the notifiers in group0 are executed firstly. */
152     kPM_NotifyGroup1, /*!< Notify group1. */
153     kPM_NotifyGroup2, /*!< Notify group2, after exiting power state the notifiers in group2 are executed firstly. */
154 } pm_notify_group_t;
155 
156 /*!
157  * @brief Power manager notify callback function used with the PM_RegisterNotify() API.
158  *
159  * @param eventType Identify the type of power event.
160  * @param powerState The power state which will enter into, actually it is the index of states array
161  * in @ref pm_device_option_t structure.
162  * @param data      Pointer to a custom argument.
163  */
164 typedef status_t (*pm_notify_callback_func_t)(pm_event_type_t eventType, uint8_t powerState, void *data);
165 
166 /*!
167  * @brief Power manager notify object structure.
168  */
169 typedef struct _pm_notify_element
170 {
171     list_element_t link;                      /*!< For placing on the notify list. */
172     pm_notify_callback_func_t notifyCallback; /*!< Registered notification callback function.  */
173     void *data;                               /*!< Pointer to a custom argument. */
174 } pm_notify_element_t;
175 
176 #endif /* FSL_PM_SUPPORT_NOTIFICATION */
177 
178 #if (defined(FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER) && FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER)
179 /*!
180  * @brief Wakeup source service function used with PM_RegisterWakeupSource() function.
181  */
182 typedef void (*pm_wake_up_source_service_func_t)(void);
183 
184 /*!
185  * @brief Wakeup source object structure.
186  *
187  * In PM_RegisterWakeupSource(), the wakeup source object in this structure type is allocated from the heap.
188  * In PM_UnregisterWakeupSource(), the wakeup source object in this structure type is destoried from the heap.
189  */
190 typedef struct _pm_wakeup_source
191 {
192     list_element_t link; /*!< For placing on the wake up source list. */
193     uint32_t wsId; /*!< The wakeup source id that the MCU supports, this value is used to config wakeup source manager
194                       hardware peripheral. NXP will provided wakeup source id for each specific MCU. */
195     pm_wake_up_source_service_func_t service; /*! Wakeup source service function that should be executed if the
196                                     corresponding wakeup event occurred. */
197     bool enabled : 1U;                        /*!< Enable/disable wakeup source. */
198     bool active : 1U;                         /*!< Indicate whether the corresponding wakeup event occurs. */
199 } pm_wakeup_source_t;
200 #endif /* FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER */
201 
202 /*!
203  * @brief The definition of Power manager resource constraint group, the group contains the operation mode of each
204  * constraint.
205  */
206 typedef struct _pm_resc_group
207 {
208     uint32_t groupSlice[PM_RESC_GROUP_ARRAY_SIZE];  /*!< The resource constraint group. */
209 } pm_resc_group_t;
210 
211 /*!
212  * @brief The definition of power manager resource constraint mask.
213  */
214 typedef struct _pm_resc_mask
215 {
216     uint32_t rescMask[PM_RESC_MASK_ARRAY_SIZE]; /*!< The resource constraint mask. */
217 } pm_resc_mask_t;
218 
219 /*!
220  * @brief The abstraction of MCU power state.
221  */
222 typedef struct _pm_state
223 {
224     uint32_t exitLatency;              /*!< The latency that the power state need to exit, in us */
225     pm_resc_mask_t fixConstraintsMask; /*!< Some constraints that must be satisfied in the power state. */
226     pm_resc_mask_t varConstraintsMask; /*!< Some optional and configurable constraints. */
227 } pm_state_t;
228 
229 /*!
230  * @brief Device power related options., including power states array, power state counts.
231  *
232  */
233 typedef struct _pm_device_option
234 {
235     pm_state_t states[PM_LP_STATE_COUNT]; /*!< The array of device's power state, states array must be ordered in
236                                             decreasing power consumption. */
237     uint8_t stateCount;                    /*!< The counts of device's power state. */
238     void (*prepare)(void);                 /*!< prepare for power state transition */
239     void (*enter)(uint8_t powerState, pm_resc_mask_t *pSoftRescMask, pm_resc_group_t *pSysRescGroup);   /*!< enter power state */
240     void (*clean)(void);                  /*!< clean after power state transition */
241 
242 #if (defined(FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER) && FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER)
243     status_t (*manageWakeupSource)(pm_wakeup_source_t *ws, bool enable); /*!< The function used to enable/disable
244                                                                              wakeup source, this function is
245                                                                              implemented in pm_device level. */
246     bool (*isWakeupSource)(
247         pm_wakeup_source_t *ws); /*!< Used to know if the wake up source triggered the last wake up. */
248 #endif                           /* FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER */
249 } pm_device_option_t;
250 
251 #if (defined(FSL_PM_SUPPORT_LP_TIMER_CONTROLLER) && FSL_PM_SUPPORT_LP_TIMER_CONTROLLER)
252 typedef void (*pm_low_power_timer_start_func_t)(uint64_t timeout);
253 typedef void (*pm_low_power_timer_stop_func_t)(void);
254 typedef uint64_t (*pm_low_power_timer_get_timestamp_func_t)(void);
255 typedef uint64_t (*pm_low_power_timer_get_duration_func_t)(uint64_t entryTimestamp, uint64_t exitTimestamp);
256 #endif /* FSL_PM_SUPPORT_LP_TIMER_CONTROLLER */
257 
258 typedef void (*pm_enter_critical)(void);
259 typedef void (*pm_exit_critical)(void);
260 
261 /*!
262  * @brief Handle structure for power manager.
263  *
264  */
265 typedef struct _pm_handle
266 {
267     bool enable;                      /*!< Enable/disable power manager. */
268     int8_t disableCount;              /*!< Used to support nested call to PM_EnablePowerManager. */
269     pm_device_option_t *deviceOption; /*!< Pointer to device specific power option. */
270     uint8_t targetState;              /*!< The target power state computed by the policy, actually it is the
271                                            index in device states array. */
272 
273     pm_resc_mask_t resConstraintMask;                /*!< Current system's resource constraint mask. */
274     pm_resc_mask_t softConstraints;                  /*!< Current system's optional resource constraint mask. */
275     uint8_t resConstraintCount[PM_CONSTRAINT_COUNT]; /*!< The count of each resource constraint, if the constraint's
276                                                     count is 0, it means the system has removed that contraint. */
277 
278     pm_resc_group_t sysRescGroup; /*!< Current system's resource constraint group. */
279 
280     uint8_t powerModeConstraint;                         /*!< Used to store system allowed lowest power mode. */
281     uint8_t powerModeConstraintCount[PM_LP_STATE_COUNT]; /*!< The count of each power mode constraint. */
282 
283 #if (defined(FSL_PM_SUPPORT_NOTIFICATION) && FSL_PM_SUPPORT_NOTIFICATION)
284     list_label_t notifyList[3U];           /*!< The header of 3 group notification. */
285     pm_notify_group_t curNotifyGroup;      /*!< Store current notification group. */
286     pm_notify_element_t *curNotifyElement; /*!< Store current notification element. */
287 #endif                                     /* FSL_PM_SUPPORT_NOTIFICATION */
288 
289 #if (defined(FSL_PM_SUPPORT_LP_TIMER_CONTROLLER) && FSL_PM_SUPPORT_LP_TIMER_CONTROLLER)
290     pm_low_power_timer_start_func_t timerStart; /*!< If RTOS supports tickless, start low power timer before entering
291                                                      low power mode. */
292     pm_low_power_timer_stop_func_t timerStop; /*!< If RTOS supports tickless, stop low power timer after waking up from
293                                                    low power mode. */
294     pm_low_power_timer_get_timestamp_func_t getTimestamp; /*!< This function is used to get a timestamp before and after
295                                                                low power mode to be able to compute the duration */
296     pm_low_power_timer_get_duration_func_t getTimerDuration; /*!< This function can be used to retrun the actual
297                                                                   low power duration based on the entry/exit timestamps */
298     uint64_t entryTimestamp;
299     uint64_t exitTimestamp;
300 #endif                                                 /* FSL_PM_SUPPORT_LP_TIMER_CONTROLLER */
301 
302 #if (defined(FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER) && FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER)
303     list_label_t wakeupSourceList;
304 #endif /* FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER */
305 
306     pm_enter_critical enterCritical; /* Power manager critical entry function, default set as NULL. */
307     pm_exit_critical exitCritical;   /* Power manager critical exit function, default set as NULL. */
308 } pm_handle_t;
309 
310 #if defined(__cplusplus)
311 extern "C" {
312 #endif
313 
314 /*******************************************************************************
315  * API
316  ******************************************************************************/
317 
318 /*!
319  * @name Power Manager Policy
320  * @{
321  */
322 
323 /*!
324  * @brief Initialize the power manager handle, this function should be invoked before using other power manager
325  * APIs.
326  *
327  * @note In default, the power manager is disabled.
328  *
329  * @param handle Pointer to the @ref pm_handle_t structure, upper layer software should pre-allocate the handle global
330  * variable.
331  */
332 void PM_CreateHandle(pm_handle_t *handle);
333 
334 /*!
335  * @brief Enable/disable power manager functions.
336  *
337  * @param enable Used to enable/disable power manager functions.
338  */
339 void PM_EnablePowerManager(bool enable);
340 
341 /*!
342  * @brief Power manager core API, this API should be used on RTOS's IDLE task.
343  *
344  * This function contains several steps:
345  * 1. Compute target power state based on the policy module.
346  * 2. Notify upper layer software of the power mode entering.
347  * 3. Enter into target power state.
348  * 4. Exit from low power state, if wakeup event occurred.
349  * 5. Notify upper layer software of the power mode exiting.
350  *
351  * The target power state is determined based on two factors:
352  *   a. The input parameter should be larger than state's exitLatency attribution.
353  *   b. resConstraintsMask logical AND state's lossFeature should equal to 0, because constraint can be understand as
354  * some features can not loss.
355  *
356  * @param duration The time in low power mode, this value is calculate from RTOS API.
357  */
358 void PM_EnterLowPower(uint64_t duration);
359 
360 #if (defined(FSL_PM_SUPPORT_LP_TIMER_CONTROLLER) && FSL_PM_SUPPORT_LP_TIMER_CONTROLLER)
361 /*!
362  * @brief Register timer controller related functions to power manager.
363  *
364  * If low power timer is the wakeup source, please remember to register it into power manager by using
365  * PM_RegisterWakeupSource() function.
366  *
367  * @param handle Pointer to the @ref pm_handle_t structure
368  * @param timerStart Low power timer start function, this parameter can be NULL, and it means low power timer is not set
369  *  as the wakeup source.
370  * @param timerStop Low power timer stop function, this parameter can also be set as NULL.
371  * @param timerSync Low power timer sync function, this parameter can also be set as NULL.
372  * @param getTimestamp Low power timestamp function, this parameter can also be set as NULL.
373  * @param getTimerDuration Get timer duration function. this parameter can also be set as NULL.
374  */
375 void PM_RegisterTimerController(pm_handle_t *handle,
376                                 pm_low_power_timer_start_func_t timerStart,
377                                 pm_low_power_timer_stop_func_t timerStop,
378                                 pm_low_power_timer_get_timestamp_func_t getTimestamp,
379                                 pm_low_power_timer_get_duration_func_t getTimerDuration);
380 
381 /*!
382  * @brief Get the actual low power state duration.
383  */
384 uint64_t PM_GetLastLowPowerDuration(void);
385 #endif /* FSL_PM_SUPPORT_LP_TIMER_CONTROLLER */
386 
387 /*!
388  * @brief Register critical region related functions to power manager.
389  *
390  * @note There are multiple-methods to implement critical region(E.g. interrupt controller, locker, semaphore).
391  *
392  * @param handle Pointer to the @ref pm_handle_t structure
393  * @param criticalEntry Enter critical function to register.
394  * @param criticalExit  Exit critical function to register.
395  */
396 void PM_RegisterCriticalRegionController(pm_handle_t *handle,
397                                          pm_enter_critical criticalEntry,
398                                          pm_exit_critical criticalExit);
399 
400 /*! @} */
401 
402 #if (defined(FSL_PM_SUPPORT_NOTIFICATION) && FSL_PM_SUPPORT_NOTIFICATION)
403 /*!
404  * @name Notification Module Interfaces
405  * @{
406  */
407 
408 /*!
409  * @brief Register notify element into the selected group.
410  *
411  * @param groupId The group of the notify list, this will affect the execution sequence.
412  * @param notifyElement The pointer to @ref pm_notify_element_t.
413  * @return status_t The status of register notify object behavior.
414  */
415 status_t PM_RegisterNotify(pm_notify_group_t groupId, pm_notify_element_t *notifyElement);
416 
417 /*!
418  * @brief Update notify element's callback function and application data.
419  *
420  * @param notifyElement The pointer to the notify element to update.
421  * @param callback The callback function to be updated.
422  * @param data Pointer to the callback function private data.
423  */
424 void PM_UpdateNotify(void *notifyElement, pm_notify_callback_func_t callback, void *data);
425 
426 /*!
427  * @brief Remove notify element from its notify group.
428  *
429  * @param notifyElement The pointer to the notify element to remove.
430  */
431 status_t PM_UnregisterNotify(void *notifyElement);
432 
433 /* @} */
434 #endif /* FSL_PM_SUPPORT_NOTIFICATION */
435 
436 #if (defined(FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER) && FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER)
437 /*!
438  * @name Wakeup Source Manager Interfaces
439  * @{
440  */
441 
442 /*!
443  * @brief Initialize the wakeup source object.
444  *
445  * @param ws    Pointer to the @ref pm_wakeup_source_t variable.
446  * @param wsId  Used to select the wakeup source, the wsId of each wakeup source can be found in fsl_pm_device.h
447  * @param service The function to be invoked when wake up source asserted.
448  * @param enable Used to enable/disable the selected wakeup source.
449  */
450 void PM_InitWakeupSource(pm_wakeup_source_t *ws, uint32_t wsId, pm_wake_up_source_service_func_t service, bool enable);
451 
452 /*!
453  * @brief Enable wakeup source.
454  *
455  * @param ws Pointer to the wakeup source object to be enabled.
456  * @return status_t The status of enable wakeup source behavior.
457  */
458 status_t PM_EnableWakeupSource(pm_wakeup_source_t *ws);
459 
460 /*!
461  * @brief Disable wakeup source
462  *
463  * @param ws Pointer to the wakeup source object to be disabled.
464  * @return status_t The status of disable wakeup source behavior.
465  */
466 status_t PM_DisableWakeupSource(pm_wakeup_source_t *ws);
467 
468 /*!
469  * @brief Checks if any enabled wake up source is responsible for last wake up
470  *       event. In such case, it will call the wake up source callback if it
471  *       has been registered. Likely to be called from Wake Up Unit IRQ Handler.
472  *
473  * @return status_t The status of handling the wake up event.
474  */
475 status_t PM_HandleWakeUpEvent(void);
476 
477 /*!
478  * @brief If the specfic wakeup event occurs, invoke this API to execute its service function.
479  *
480  * @param ws Pointer to the wakeup source object.
481  * @return status_t The status of trigger wakeup source behavior.
482  */
483 status_t PM_TriggerWakeSourceService(pm_wakeup_source_t *ws);
484 /*! @} */
485 #endif /* FSL_PM_SUPPORT_WAKEUP_SOURCE_MANAGER */
486 
487 /*!
488  * @name Constraints Interfaces
489  * @{
490  */
491 
492 /*!
493  * @brief Used to set constraints(including power mode constraint and resource constraints)
494  *
495  * For example, if the device support 3 resource constraints: PM_RESC_1, PM_RESC_2, PM_RESC3
496  *  @code
497  *      PM_SetConstraints(Sleep_Mode, 3, PM_RESC_1, PM_RESC_2, PM_RESC_3);
498  *  @endcode
499  *
500  * @param powerModeConstraint The lowest power mode allowed, the power mode constraint macros
501  *                            can be found in fsl_pm_device.h
502  * @param rescNum The number of resource constraints to be set.
503  * @return status_t The status of set constraints behavior.
504  */
505 status_t PM_SetConstraints(uint8_t powerModeConstraint, int32_t rescNum, ...);
506 
507 /*!
508  * @brief Used to release constraints(including power mode constraint and resource constraints)
509  *
510  * For example, if the device support 3 resource constraints: PM_RESC_1, PM_RESC_2, PM_RESC3
511  *  @code
512  *      PM_ReleaseConstraints(Sleep_Mode, 1, PM_RESC_1);
513  *  @endcode
514  *
515  * @param powerModeConstraint The lowest power mode allowed, the power mode constraint macros
516  *                            can be found in fsl_pm_device.h
517  * @param rescNum The number of resource constraints to be released.
518  * @return status_t The status of set constraints behavior.
519  */
520 status_t PM_ReleaseConstraints(uint8_t powerModeConstraint, int32_t rescNum, ...);
521 
522 /*!
523  * @brief Get current system resource constraints.
524  *
525  * @return Current system constraints.
526  */
527 pm_resc_mask_t PM_GetResourceConstraintsMask(void);
528 
529 /*!
530  * @brief Get current system allowed power mode.
531  *
532  * @return Allowed lowest power mode.
533  */
534 uint8_t PM_GetAllowedLowestPowerMode(void);
535 
536 /* @} */
537 
538 #if defined(__cplusplus)
539 }
540 #endif
541 /*!
542  * @}
543  */
544 
545 #endif /* _FSL_PM_CORE_H_ */
546