WE310F5  39.00.000
M2MB POWER MANAGEMENT

This section describes the M2MB API for power management module. More...

#define M2MB_SYSTEM_STABALIZE_TIME_MS   200
 
#define UNUSED(x)   ((void)(x))
 
typedef VOID(* M2MB_SLEEP_CB_T) (UINT32 expected_idle_time, void *param)
 
INT32 m2mb_pwr_mgmt_standby (UINT32 duration)
 m2mb_pwr_mgmt_standby puts the system to standby mode. More...
 
INT32 m2mb_pwr_mgmt_cfg_sleep (UINT32 enable, UINT32 duration)
 m2mb_pwr_mgmt_cfg_sleep configures the sleep mode. More...
 
INT32 m2mb_pwr_mgmt_cfg_sleep_cb (M2MB_SLEEP_CB_T after, M2MB_SLEEP_CB_T before)
 m2mb_pwr_mgmt_cfg_sleep_cb configures callback for the sleep mode. More...
 

Detailed Description

This section describes the M2MB API for power management module.

WE310F5_Power_Management.png
Power Management

The power management module provides APIs to the system to different power save mode. There are three power save mode, sleep, deep-sleep and standby mode.

Macro Definition Documentation

◆ M2MB_SYSTEM_STABALIZE_TIME_MS

#define M2MB_SYSTEM_STABALIZE_TIME_MS   200

Definition at line 54 of file m2mb_pwr_mgmt.h.

◆ UNUSED

#define UNUSED (   x)    ((void)(x))

Definition at line 56 of file m2mb_pwr_mgmt.h.

Typedef Documentation

◆ M2MB_SLEEP_CB_T

typedef VOID(* M2MB_SLEEP_CB_T) (UINT32 expected_idle_time, void *param)

Definition at line 60 of file m2mb_pwr_mgmt.h.

Function Documentation

◆ m2mb_pwr_mgmt_cfg_sleep()

INT32 m2mb_pwr_mgmt_cfg_sleep ( UINT32  enable,
UINT32  duration 
)

m2mb_pwr_mgmt_cfg_sleep configures the sleep mode.

m2mb_pwr_mgmt_cfg_sleep is used to enable or disable the sleep mode.

Parameters
[in]enableSet to one to enable sleep mode else set to zero to disable it.
[in]durationThis value is used only when enable is set to 1. If set to 0, by default it goes to sleep mode. If set to 0xFFFFFFFF it goes to deep sleep mode for infinite time and if set to other than this two value it goes to deep sleep for the duration mentioned. If user sets 0 as duration then after wakeup it automatically goes to sleep again. But if user sets other than 0, then to go to deep-sleep mode user has to agian call thi API.
Returns
returns 0 on success, or -ve value code on error
Note
To have better throughput the sleep mode should be disabled. To have better power number sleep mode should be enabled. Example
// Enables the sleep mode for 10 seconds
// Disables the sleep mode

◆ m2mb_pwr_mgmt_cfg_sleep_cb()

INT32 m2mb_pwr_mgmt_cfg_sleep_cb ( M2MB_SLEEP_CB_T  after,
M2MB_SLEEP_CB_T  before 
)

m2mb_pwr_mgmt_cfg_sleep_cb configures callback for the sleep mode.

m2mb_pwr_mgmt_cfg_sleep_cb is used to set the callback to be called before entering sleep mode and after coming out of sleep mode.

Parameters
[in]beforecallback API to be called before entering sleep mode.
[in]aftercallback API to be called after coming out of sleep mode.
[in]ctxContext to be passed in the above two APIs.
Returns
returns 0 on success, or -ve value code on error
Note

Example

◆ m2mb_pwr_mgmt_standby()

INT32 m2mb_pwr_mgmt_standby ( UINT32  duration)

m2mb_pwr_mgmt_standby puts the system to standby mode.

m2mb_pwr_mgmt_standby puts the system in standby mode.

Parameters
[in]durationDuration in msec.
Returns
Returns 0 on success, or -ve value code on error
Note
Once the system goes to power save mode, the state of the system is lost and once it comes out of the standby after the given duration, the system executes from the app_start again. Example
m2mb_pwr_mgmt_standby(10000); //Goes to standby for 10sec
//Code doesn't get executed if the standby processing successful