Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_power.h
Go to the documentation of this file.
1/*
2 * Common IO - basic V1.0.0
3 * Copyright (C) 2020 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 )
55struct IotPowerDescriptor;
56
62typedef struct IotPowerDescriptor * IotPowerHandle_t;
63
69typedef enum
70{
74 eUnknownPowerMode = 0xFFFF
76
80typedef enum
81{
90
94typedef struct IotPowerWakeupSources
95{
96 uint8_t * pucWakeupSources;
98 uint16_t usLength;
100
104typedef enum IotPowerIoctlRequest
105{
132
145typedef void ( * IotPowerCallback_t )( bool bIdleState,
146 void * pvUserContext );
147
158
177int32_t iot_power_set_mode( IotPowerHandle_t const pxPowerHandle,
178 IotPowerMode_t xMode );
179
210int32_t iot_power_reset_mode( IotPowerHandle_t const pxPowerHandle );
211
227void iot_power_set_callback( IotPowerHandle_t const pxPowerHandle,
228 IotPowerCallback_t xCallback,
229 void * pvUserContext );
230
248int32_t iot_power_ioctl( IotPowerHandle_t const pxPowerHandle,
249 IotPowerIoctlRequest_t xRequest,
250 void * const pvBuffer );
251
264int32_t iot_power_get_mode( IotPowerHandle_t const pxPowerHandle,
265 IotPowerMode_t * xMode );
266
279int32_t iot_power_close( IotPowerHandle_t const pxPowerHandle );
280
285#endif /* ifndef _IOT_HAL_POWER_H_ */
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:145
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....
IotPowerIdleMode_t
Different Idle mode mappings to the threshold values set using the IOCTLs.
Definition: iot_power.h:81
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...
IotPowerMode_t
Power modes supported by the driver. These power modes may perform different actions on different pla...
Definition: iot_power.h:70
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 ...
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
int32_t iot_power_close(IotPowerHandle_t const pxPowerHandle)
iot_power_close is used to de-initialize power driver.
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.
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 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
@ eIdleClkSrcOffModeMode
Definition: iot_power.h:85
@ eIdlePCMode
Definition: iot_power.h:83
@ eIdleVddOffMode
Definition: iot_power.h:87
@ eIdleNoneMode
Definition: iot_power.h:82
@ eNormalPowerPerfMode
Definition: iot_power.h:72
@ eHighPowerPerfMode
Definition: iot_power.h:71
@ eLowPowerPerfMode
Definition: iot_power.h:73
@ eUnknownPowerMode
Definition: iot_power.h:74
@ eSetPCWakeThreshold
Definition: iot_power.h:106
@ eGetVddOffWakeThreshold
Definition: iot_power.h:122
@ eGetLastIdleMode
Definition: iot_power.h:129
@ eSetVddOffWakeThreshold
Definition: iot_power.h:118
@ eGetClkSrcOffWakeThreshold
Definition: iot_power.h:117
@ eGetPCWakeThreshold
Definition: iot_power.h:111
@ eSetClkSrcOffWakeThreshold
Definition: iot_power.h:112
@ eGetWakeupSources
Definition: iot_power.h:127
@ eSetWakeupSources
Definition: iot_power.h:124
Wakeup source information.
Definition: iot_power.h:95
uint16_t usLength
Definition: iot_power.h:98
uint8_t * pucWakeupSources
Definition: iot_power.h:96