S32 SDK
power_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016 Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #ifndef POWER_MANAGER_H
20 #define POWER_MANAGER_H
21 
22 #include "device_registers.h"
23 #include "status.h"
24 
25 /*
26  * Include the cpu API header files.
27  */
28 #if (defined(S32K14x_SERIES))
29 /* S32K144 power management API header file */
30 #include "../src/power/S32K1xx/power_manager_S32K1xx.h"
31 #elif (defined(S32V234_SERIES))
32 /* S32V234 Power Management Level API header file */
33 #include "../src/power/S32V234/power_manager_S32V234.h"
34 #elif (defined(MPC574x_SERIES))
35 /* MPC5748G Power Management Level API header file */
36 #include "../src/power/MPC57xx/power_manager_MPC57xx.h"
37 #else
38 #error "No valid CPU defined!"
39 #endif
40 
57 /*******************************************************************************
58  * Definitions
59  ******************************************************************************/
60 
72 typedef enum
73 {
77 
87 typedef enum
88 {
93 
103 typedef enum
104 {
109 
119 
143 typedef struct
144 {
150 
174 
188 typedef struct
189 {
194 
204 typedef struct
205 {
207  uint8_t configsNumber;
208  power_manager_callback_user_config_t * (*staticCallbacks)[];
211  uint8_t currentConfig;
213 
214 /*******************************************************************************
215  * API
216  ******************************************************************************/
217 
218 #if defined(__cplusplus)
219 extern "C" {
220 #endif
221 
245  uint8_t configsNumber,
246  power_manager_callback_user_config_t * (*callbacksPtr)[],
247  uint8_t callbacksNumber);
248 
255 
291 status_t POWER_SYS_SetMode(uint8_t powerModeIndex,
292  power_manager_policy_t policy);
293 
306 status_t POWER_SYS_GetLastMode(uint8_t * powerModeIndexPtr);
307 
320 
329 
340 uint8_t POWER_SYS_GetErrorCallbackIndex(void);
341 
352 
353 #if defined(__cplusplus)
354 }
355 #endif
356 
359 #endif /* POWER_MANAGER_H */
360 /*******************************************************************************
361  * EOF
362  ******************************************************************************/
status_t POWER_SYS_GetLastMode(uint8_t *powerModeIndexPtr)
This function returns the last successfully set power mode.
status_t POWER_SYS_SetMode(uint8_t powerModeIndex, power_manager_policy_t policy)
This function configures the power mode.
status_t POWER_SYS_Deinit(void)
This function deinitializes the Power manager.
status_t POWER_SYS_Init(power_manager_user_config_t *(*powerConfigsPtr)[], uint8_t configsNumber, power_manager_callback_user_config_t *(*callbacksPtr)[], uint8_t callbacksNumber)
Power manager initialization for operation.
Definition: power_manager.c:80
power_manager_policy_t
Power manager policies.
Definition: power_manager.h:72
uint8_t POWER_SYS_GetErrorCallbackIndex(void)
This function returns the last failed notification callback.
power_manager_notify_t notifyType
power_manager_callback_type_t
The callback type indicates when a callback will be invoked.
status_t(* power_manager_callback_t)(power_manager_notify_struct_t *notify, power_manager_callback_data_t *dataPtr)
Callback prototype.
power_manager_callback_user_config_t * POWER_SYS_GetErrorCallback(void)
This function returns the callback configuration structure for the last failed notification.
power_manager_callback_t callbackFunction
callback configuration structure
power_manager_user_config_t * targetPowerConfigPtr
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
power_manager_callback_data_t * callbackData
power_manager_modes_t POWER_SYS_GetCurrentMode(void)
This function returns currently running power mode.
Power mode user configuration structure.
Power mode user configuration structure.
power_manager_notify_t
The PM notification type. Used to notify registered callbacks. Callback notifications can be invoked ...
Definition: power_manager.h:87
Power manager internal state structure.
power_manager_policy_t policy
power_manager_callback_type_t callbackType
status_t POWER_SYS_GetLastModeConfig(power_manager_user_config_t **powerModePtr)
This function returns the user configuration structure of the last successfully set power mode...
power_manager_modes_t
Power modes enumeration.
void power_manager_callback_data_t
Callback-specific data.