FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_power.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Common IO V1.0.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef _IOT_HAL_POWER_H_
32 #define _IOT_HAL_POWER_H_
33 
34 #include <stdbool.h>
35 #include <stdint.h>
36 
45 #define IOT_POWER_SUCCESS ( 0 )
46 #define IOT_POWER_INVALID_VALUE ( 1 )
47 #define IOT_POWER_NOT_INITIALIZED ( 2 )
48 #define IOT_POWER_GET_FAILED ( 3 )
49 #define IOT_POWER_SET_FAILED ( 4 )
50 #define IOT_POWER_FUNCTION_NOT_SUPPORTED ( 5 )
55 struct IotPowerDescriptor;
56 
62 typedef struct IotPowerDescriptor * IotPowerHandle_t;
63 
69 typedef enum
70 {
76 
80 typedef enum
81 {
90 
94 typedef struct IotPowerWakeupSources
95 {
96  uint8_t * pucWakeupSources;
98  uint16_t usLength;
101 
105 typedef enum IotPowerIoctlRequest
106 {
133 
146 typedef void ( * IotPowerCallback_t )( bool bIdleState,
147  void * pvUserContext );
148 
159 
178 int32_t iot_power_set_mode( IotPowerHandle_t const pxPowerHandle,
179  IotPowerMode_t xMode );
180 
211 int32_t iot_power_reset_mode( IotPowerHandle_t const pxPowerHandle );
212 
228 void iot_power_set_callback( IotPowerHandle_t const pxPowerHandle,
229  IotPowerCallback_t xCallback,
230  void * pvUserContext );
231 
249 int32_t iot_power_ioctl( IotPowerHandle_t const pxPowerHandle,
250  IotPowerIoctlRequest_t xRequest,
251  void * const pvBuffer );
264 int32_t iot_power_get_mode( IotPowerHandle_t const pxPowerHandle,
265  IotPowerMode_t * xMode );
266 
279 int32_t iot_power_close( IotPowerHandle_t const pxPowerHandle );
280 
285 #endif /* ifndef _IOT_HAL_POWER_H_ */
IotPowerIdleMode_t
Different Idle mode mappings to the threshold values set using the IOCTLs.
Definition: iot_power.h:80
Definition: iot_power.h:112
int32_t iot_power_ioctl(IotPowerHandle_t const pxPowerHandle, IotPowerIoctlRequest_t xRequest, void *const pvBuffer)
iot_power_ioctl is used to set power configuration and power properties like Wakeup time thresholds...
Definition: iot_power.h:73
uint16_t usLength
Definition: iot_power.h:98
int32_t iot_power_reset_mode(IotPowerHandle_t const pxPowerHandle)
iot_power_reset_mode is used to reset the mode (i,e remove the vote to set mode). When reset mode is ...
int32_t iot_power_set_mode(IotPowerHandle_t const pxPowerHandle, IotPowerMode_t xMode)
iot_power_set_mode is used to set or change the power mode to a specific mode. The actual changes mad...
struct IotPowerDescriptor * IotPowerHandle_t
IotPowerHandle_t type is the power handle returned by calling iot_power_open() this is initialized in...
Definition: iot_power.h:62
Definition: iot_power.h:71
IotPowerMode_t
Power modes supported by the driver. These power modes may perform different actions on different pla...
Definition: iot_power.h:69
Definition: iot_power.h:107
Definition: iot_power.h:113
Definition: iot_power.h:85
Wakeup source information.
Definition: iot_power.h:94
Definition: iot_power.h:82
int32_t iot_power_close(IotPowerHandle_t const pxPowerHandle)
iot_power_close is used to de-initialize power driver.
Definition: iot_power.h:128
Definition: iot_power.h:72
Definition: iot_power.h:83
Definition: iot_power.h:118
uint8_t * pucWakeupSources
Definition: iot_power.h:96
IotPowerHandle_t iot_power_open(void)
iot_power_open is used to Initialize the CPU power management driver. power_open sets up the default ...
void(* IotPowerCallback_t)(bool bIdleState, void *pvUserContext)
This callback type is used to set a callback for idle enter and exit notification callback type...
Definition: iot_power.h:146
Definition: iot_power.h:125
Definition: iot_power.h:123
int32_t iot_power_get_mode(IotPowerHandle_t const pxPowerHandle, IotPowerMode_t *xMode)
iot_power_get_mode is used to get the current power mode the target is in.
Definition: iot_power.h:130
void iot_power_set_callback(IotPowerHandle_t const pxPowerHandle, IotPowerCallback_t xCallback, void *pvUserContext)
iot_power_set_callback is used to set the callback to be called when the target is entering low power...
IotPowerIoctlRequest_t
Ioctl request types.
Definition: iot_power.h:105
Definition: iot_power.h:119
Definition: iot_power.h:87
Definition: iot_power.h:74