Infineon Logo AIROC BTSDK v3.3 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
wiced_power_save.h File Reference

Wiced Low Power Mode Utilities. More...

Data Structures

struct  wiced_pmu_callbacks_t
 
struct  wiced_sleep_config_t
 Sleep configuration parameters. More...
 

Typedefs

typedef uint32_t(* wiced_sleep_allow_check_callback )(wiced_sleep_poll_type_t type)
 Application implements call back of this type to allow or disallow the chip to go to sleep. More...
 
typedef void( wiced_bt_wake_app_cb_t )(void *data)
 
typedef void wiced_power_save_cback_t (void)
 Power Save callback. More...
 

Enumerations

enum  wiced_ptu_clock_bits_t {
  TPORT_CLK_ENABLE_BIT =( 1 << 0 ), TPORT_AUX_CLK_ENABLE_BIT =( 1 << 1 ), FM_FORCE_ON_BIT =( 1 << 2 ), FM_KEEP_ON_BIT =( 1 << 3 ),
  GATE_ON_SDIO_CLK_BIT =( 1 << 4 ), GATE_ON_DBG_UART_CLK_BIT =( 1 << 5 ), PCM_CLK_EN_BIT =( 1 << 6 ), GATE_UART_CLK_EN_BIT =( 1 << 10 ),
  GATE_UART_CLK_WAKE_BIT =( 1 << 11 ), GATE_ON_SDIO_HOST_CLK_BIT =( 1 << 16 )
}
 PTU clock enable bit masks. More...
 
enum  wiced_ptu_aux_clock_bits_t {
  PCM_DEV_CLK_EN_BIT =( 1 << 1 ), ABURST_CLK_EN_BIT =( 1 << 2 ), SPIFFY2_TPORT_CLK_EN_BIT =( 1 << 3 ), SPIFFY2_HCLK_CLK_EN_BIT =( 1 << 4 ),
  UART2_CLK_EN_BIT =( 1 << 5 )
}
 PTU aux clock enable bit masks. More...
 
enum  wiced_wake_source_t { WICED_WAKE_SOURCE_GPIO = 0x01, WICED_WAKE_SOURCE_TIMEOUT = 0x02, WICED_WAKE_SOURCE_ALL = WICED_WAKE_SOURCE_GPIO|WICED_WAKE_SOURCE_TIMEOUT }
 Wake Up Sources .Used when calling wiced_start_power_save. More...
 
enum  wiced_wake_gpio_mode_t { WICED_WAKE_GPIO_ACTIVE_LOW = 0x00, WICED_WAKE_GPIO_ACTIVE_HIGH = 0x01 }
 
enum  wiced_sleep_mode_type_t { WICED_SLEEP_MODE_NO_TRANSPORT, WICED_SLEEP_MODE_TRANSPORT }
 Sleep modes. More...
 
enum  wiced_sleep_wake_type_t { WICED_SLEEP_WAKE_ACTIVE_LOW, WICED_SLEEP_WAKE_ACTIVE_HIGH }
 Active interrupt level for Wake through GPIO. More...
 
enum  wiced_sleep_poll_type_t { WICED_SLEEP_POLL_TIME_TO_SLEEP, WICED_SLEEP_POLL_SLEEP_PERMISSION }
 Sleep poll type. More...
 
enum  wiced_sleep_permission_type_t { WICED_SLEEP_NOT_ALLOWED, WICED_SLEEP_ALLOWED }
 Sleep permission Note : In WICED_SLEEP_MODE_NO_TRANSPORT case, application will be restarted on exiting out of the power shutdown sleep. More...
 

Functions

void wiced_power_save_start (wiced_wake_source_t wake_source, uint32_t timeout_ms)
 Function wiced_power_save_start. More...
 
void wiced_power_save_stop (void)
 Function wiced_power_save_stop. More...
 
void wiced_power_save_register_enter_cback (wiced_power_save_cback_t *p_cback)
 Function wiced_power_save_register_enter_cback. More...
 
void wiced_power_save_register_abort_cback (wiced_power_save_cback_t *p_cback)
 Function wiced_power_save_register_abort_cback. More...
 
void wiced_power_save_store_state (uint16_t value)
 Function wiced_power_save_store_state. More...
 
uint16_t wiced_power_save_retrieve_state (void)
 Function wiced_power_save_retrieve_state. More...
 
wiced_result_t wiced_sleep_configure (wiced_sleep_config_t *p_sleep_config)
 API to configure sleep mode parameters. More...
 
void wiced_sleep_config (wiced_bool_t enable, wiced_wake_gpio_mode_t bt_wake, wiced_wake_gpio_mode_t host_wake)
 Function wiced_sleep_config. More...
 
void wiced_ptu_clock_enable (wiced_ptu_clock_bits_t ptu_clock_bits, wiced_ptu_aux_clock_bits_t ptu_aux_clock_bits)
 Function wiced_ptu_clock_enable. More...
 
void wiced_ptu_clock_disable (wiced_ptu_clock_bits_t ptu_clock_bits, wiced_ptu_aux_clock_bits_t ptu_aux_clock_bits)
 Function wiced_ptu_clock_disable. More...
 
void wiced_bt_register_pmu_callbacks (wiced_pmu_callbacks_t *pmu_cb)
 Function wiced_bt_register_pmu_callbacks. More...
 
void wiced_bt_coex_enable (void)
 Function wiced_bt_coex_enable. More...
 
void wiced_bt_coex_disable (void)
 Function wiced_bt_coex_disable. More...
 
void wiced_allow_sleep (wiced_bool_t allow)
 Function wiced_allow_sleep. More...
 

Detailed Description

Wiced Low Power Mode Utilities.

Typedef Documentation

typedef void wiced_power_save_cback_t(void)

Power Save callback.

Callback to the application on entering to power save mode or if entering to the power save mode is aborted Registered using wiced_power_save_register_enter_cback() and wiced_power_save_register_abort_cback()

Returns
void
typedef uint32_t(* wiced_sleep_allow_check_callback)(wiced_sleep_poll_type_t type)

Application implements call back of this type to allow or disallow the chip to go to sleep.

Parameters
[in]typePoll type (see wiced_sleep_poll_type_t)
Returns
if type == WICED_SLEEP_POLL_TIME_TO_SLEEP, application should return the maximum time allowed to sleep in micro seconds. WICED_SLEEP_MAX_TIME_TO_SLEEP allows the Firmware to determine the duration it can sleep. if type == WICED_SLEEP_POLL_SLEEP_PERMISSION, application should return one of the values in wiced_sleep_permission_type_t

Enumeration Type Documentation

PTU aux clock enable bit masks.

PTU clock enable bit masks.

Sleep modes.

Enumerator
WICED_SLEEP_MODE_NO_TRANSPORT 

Used for HID use cases.

When a transport is connected behavior is undefined.

WICED_SLEEP_MODE_TRANSPORT 

This mode allows PDS sleep when transport is connected and uses device wake line to wake up.

Sleep permission Note : In WICED_SLEEP_MODE_NO_TRANSPORT case, application will be restarted on exiting out of the power shutdown sleep.

Application MUST NOT allow sleep, when any BT activity is involved. If the application desires to save any state (16 bits of data) before going to power save it can do so by using wiced_power_save_store_state() and retrieve the state on coming back from power save by using wiced_power_save_retrieve_state(). To prevent FW from putting the chip in Shutdown/PDS sleep mode, select WICED_SLEEP_NOT_ALLOWED.

Enumerator
WICED_SLEEP_NOT_ALLOWED 

Sleep is not allowed.

WICED_SLEEP_ALLOWED 

Allow PDS/HIDD OFF sleep.

PDS in case of WICED_SLEEP_MODE_TRANSPORT mode and HIDD OFF in case of WICED_SLEEP_MODE_NO_TRANSPORT mode.

Sleep poll type.

Enumerator
WICED_SLEEP_POLL_TIME_TO_SLEEP 

Polling for maximum allowed sleep duration.

WICED_SLEEP_POLL_SLEEP_PERMISSION 

Polling for permission to sleep.

Active interrupt level for Wake through GPIO.

Enumerator
WICED_SLEEP_WAKE_ACTIVE_LOW 

Active low interrupt wakes the chip.

WICED_SLEEP_WAKE_ACTIVE_HIGH 

Active high interrupt wakes the chip.

Enumerator
WICED_WAKE_GPIO_ACTIVE_LOW 

Wake with GPIO set to low.

WICED_WAKE_GPIO_ACTIVE_HIGH 

Wake with GPIO set to high.

Wake Up Sources .Used when calling wiced_start_power_save.

Enumerator
WICED_WAKE_SOURCE_GPIO 

Wake from GPIO.

WICED_WAKE_SOURCE_TIMEOUT 

Wake on timeout, Value of 0 means infinite timeout.

Function Documentation

void wiced_allow_sleep ( wiced_bool_t  allow)

Function wiced_allow_sleep.

Application can invoke this function to allow/disallow sleep for debugging purpose

Parameters
[in]allow: Allow or Disallow sleep. TRUE - allow sleep FALSE - disallow sleep
Returns
void
void wiced_bt_coex_disable ( void  )

Function wiced_bt_coex_disable.

Application can invoke this function to disable the coex functionality

Returns
void
void wiced_bt_coex_enable ( void  )

Function wiced_bt_coex_enable.

Application can invoke this function to enable the coex functionality

Returns
void
void wiced_bt_register_pmu_callbacks ( wiced_pmu_callbacks_t pmu_cb)

Function wiced_bt_register_pmu_callbacks.

Application can invoke this function to register callbacks to follow the pmu state

Parameters
[in]pmu_functions: Application registered pmu functions.
Returns
void
void wiced_power_save_register_abort_cback ( wiced_power_save_cback_t p_cback)

Function wiced_power_save_register_abort_cback.

Registers the callback function which will be invoked if transition to the power save mode is aborted. Power save mode can be re-requested with a new call to wiced_power_save_start().

Parameters
[in]p_cback: callback function which will be invoked if transition to the power save mode is aborted
Returns
void
void wiced_power_save_register_enter_cback ( wiced_power_save_cback_t p_cback)

Function wiced_power_save_register_enter_cback.

Registers the callback function which will be invoked just before device enters the power save mode. Power save mode cannot be stopped at this point.

Parameters
[in]p_cback: callback function which will be invoked just before device enters the power save mode
Returns
void
uint16_t wiced_power_save_retrieve_state ( void  )

Function wiced_power_save_retrieve_state.

Application can invoke this function to retrieve any saved state values on waking from power save mode

Returns
the saved value
void wiced_power_save_start ( wiced_wake_source_t  wake_source,
uint32_t  timeout_ms 
)

Function wiced_power_save_start.

To start the power save mode of operation. This is the most efficient power save option available. Be cautious on using this power save mode. Application will be restarted on exiting out of the power save mode. If the application desires to save any state before going to power save it can do so by using wiced_power_save_store_state() and retrieve the state on coming back from power save by using wiced_power_save_retrieve_state(). The power save mode request can be cancelled with a call to wiced_power_save_stop().

Parameters
[in]wake_source: Bit mask of sources to wake the device from power save mode
[in]timeout_ms: Timeout in milliseconds to wake the device from power save mode. Used when WICED_WAKE_SOURCE_TIMEOUT or WICED_WAKE_SOURCE_ALL is specified as wake source
Returns
void
void wiced_power_save_stop ( void  )

Function wiced_power_save_stop.

Stops a previous request to enter the power save mode of operation started by wiced_power_save_start(). Can be called any time after that call up until execution of the callback registered with wiced_power_register_enter_cback().

Returns
void
void wiced_power_save_store_state ( uint16_t  value)

Function wiced_power_save_store_state.

Application can invoke this function to store any state values before going to power save mode. Should be called on receipt of the callback registered with wiced_power_save_register_enter_cback().

Parameters
[in]value: Value to be saved.
Returns
void
void wiced_ptu_clock_disable ( wiced_ptu_clock_bits_t  ptu_clock_bits,
wiced_ptu_aux_clock_bits_t  ptu_aux_clock_bits 
)

Function wiced_ptu_clock_disable.

Application can invoke this function to disable ptu clocks required for the application.

Parameters
[in]ptu_clock_bits: Bit mask of clocks which need to be disabled as described in wiced_ptu_clock_bits_t
[in]wiced_ptu_aux_clock_bits_t: List of clocks which need to be disabled as described in wiced_ptu_aux_clock_bits_t
Returns
void
void wiced_ptu_clock_enable ( wiced_ptu_clock_bits_t  ptu_clock_bits,
wiced_ptu_aux_clock_bits_t  ptu_aux_clock_bits 
)

Function wiced_ptu_clock_enable.

Application can invoke this function to enable ptu clocks required for the application.

Parameters
[in]ptu_clock_bits: Bit mask of clocks which need to be enabled as described in wiced_ptu_clock_bits_t
[in]wiced_ptu_aux_clock_bits_t: List of clocks which need to be enabled as described in wiced_ptu_aux_clock_bits_t
Returns
void
void wiced_sleep_config ( wiced_bool_t  enable,
wiced_wake_gpio_mode_t  bt_wake,
wiced_wake_gpio_mode_t  host_wake 
)

Function wiced_sleep_config.

Application can invoke this function to enable/disable low power mode of operation. In this mode, the device achieves power savings by suspending the application and allowing the device to sleep btween BLE advertising intervals. Enabling sleep mode with this API does not immediately put the device in low power mode, it simply enables the device to transition to low power when idle. The application is suspended and resumed transparently by the device when it enters and exits sleep. Device wakeup can be triggered by any ativity on an active peripheral, GPIO, the BT radio, or an interrupt from a timer started by the application.

The bt_wake and host_wake parameters are not needed for embedded SoC applications, and should be set to NULL. They are only used in external MCU scenaraios where BT_DEV_WAKE and BT_HOST_WAKE GPIOs are used by external MCU and device to wake each other.

Parameters
[in]enable: Enable or disable the sleep mode
[in]bt_wake: not used, should be NULL
[in]host_wake: not used, should be NULL
Returns
void
wiced_result_t wiced_sleep_configure ( wiced_sleep_config_t p_sleep_config)

API to configure sleep mode parameters.

Parameters
[in]p_sleep_configsee
Returns
WICED_SUCCESS or WICED_ERROR