S32 SDK
power_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016 Freescale Semiconductor, Inc.
3  * Copyright 2016 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 
24 /*
25  * Include the chip specific HAL API header files.
26  */
27 #if defined (S32K144_SERIES)
28  /* Power manager implemented with SMC */
29  #include "smc_hal.h"
30 #elif defined (S32V234_SERIES)
31  /* Power manager implemented with MC_ME */
32  #include "mc_me_hal.h"
33 #else
34  #error "No valid CPU defined!"
35 #endif
36 
79 /*******************************************************************************
80  * Definitions
81  ******************************************************************************/
82 
94 typedef enum
95 {
99 
109 typedef enum
110 {
115 
125 typedef enum
126 {
131 
141 
165 typedef struct
166 {
172 
197 );
198 
212 typedef struct
213 {
218 
228 typedef struct
229 {
231  uint8_t configsNumber;
232  power_manager_callback_user_config_t *(* staticCallbacks)[];
235  uint8_t currentConfig;
237 
238 /*******************************************************************************
239  * API
240  ******************************************************************************/
241 
242 #if defined(__cplusplus)
243 extern "C" {
244 #endif
245 
269  uint8_t configsNumber,
270  power_manager_callback_user_config_t *(* callbacksPtr)[],
271  uint8_t callbacksNumber);
272 
279 
315 status_t POWER_SYS_SetMode(uint8_t powerModeIndex, power_manager_policy_t policy);
316 
329 status_t POWER_SYS_GetLastMode(uint8_t* powerModeIndexPtr);
330 
343 
352 
363 uint8_t POWER_SYS_GetErrorCallbackIndex(void);
364 
375 
376 #if defined(__cplusplus)
377 }
378 #endif
379 
382 #endif /* POWER_MANAGER_H */
383 /*******************************************************************************
384  * EOF
385  ******************************************************************************/
386 
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.
power_manager_policy_t
Power manager policies.
Definition: power_manager.h:94
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:31
power_manager_callback_data_t * callbackData
power_manager_modes_t POWER_SYS_GetCurrentMode(void)
This function returns currently running power mode.
power_manager_modes_t
Power modes enumeration.
Definition: smc_hal.h:76
Power mode user configuration structure.
Power mode user configuration structure.
Definition: smc_hal.h:114
power_manager_notify_t
The PM notification type. Used to notify registered callbacks. Callback notifications can be invoked ...
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...
void power_manager_callback_data_t
Callback-specific data.