InPlay API
Platform power management and sleep timer

HAL_POWER. More...

Functions

int hal_pm_init (int slp_wup, int ble_wup, int bod_wup, int mix_wup, int trig_retn, uint32_t dm_retn, uint32_t em_retn)
 Power Management initialization function. More...
 
int hal_pm_reg_mod (struct pm_module *module)
 Register power module function. More...
 
int hal_pm_unreg_mod (struct pm_module *module)
 Unregister power module function. More...
 
uint32_t hal_pm_suspend_and_resume (uint32_t os_sleep)
 System shutdown and resume function. More...
 
int hal_pm_reg_ble_mod (struct pm_module *module)
 Register BLE power module function. More...
 
int hal_pm_unreg_ble_mod (struct pm_module *module)
 Unregister BLE power module function. More...
 
uint32_t hal_pm_get_wup_src (void)
 Read the wake up source. More...
 
void hal_pm_mix_sig_wup_enable (void)
 Enable/Disable mix signal (GPIO PORT 2) wake up. More...
 

Detailed Description

HAL_POWER.

Function Documentation

◆ hal_pm_get_wup_src()

uint32_t hal_pm_get_wup_src ( void  )

Read the wake up source.

Returns
The source of wake up,
See also
enum pm_ws

◆ hal_pm_init()

int hal_pm_init ( int  slp_wup,
int  ble_wup,
int  bod_wup,
int  mix_wup,
int  trig_retn,
uint32_t  dm_retn,
uint32_t  em_retn 
)

Power Management initialization function.

Parameters
[in]slp_wupSleep timer can wake up system from deep sleep; 1: yes, 0: no.
[in]ble_wupBLE can wake up system from deep slee; 1: yes, 0: no.
[in]bod_wupBrown out can wake up system from deep slee; 1: yes, 0: no.
[in]mix_wupMixed signal IO can wake up system from deep slee; 1: yes, 0: no.
[in]trig_retnTrigger memory retention flag; 1: yes, 0: no
[in]dm_retnData memory retention flag;
See also
enum dm_retn.
Parameters
[in]em_retnBLE memory retention flag;
See also
enum em_retn.
Returns
See also
enum pm_err

◆ hal_pm_mix_sig_wup_enable()

void hal_pm_mix_sig_wup_enable ( void  )

Enable/Disable mix signal (GPIO PORT 2) wake up.

Returns
No Return

◆ hal_pm_reg_ble_mod()

int hal_pm_reg_ble_mod ( struct pm_module *  module)

Register BLE power module function.

Parameters
[in]moduleA pointer to the PM module structure,
See also
struct pm_module
Returns
See also
enum pm_err

◆ hal_pm_reg_mod()

int hal_pm_reg_mod ( struct pm_module *  module)

Register power module function.

Parameters
[in]moduleA pointer to the PM module structure,
See also
struct pm_module
Returns
See also
enum pm_err

◆ hal_pm_suspend_and_resume()

uint32_t hal_pm_suspend_and_resume ( uint32_t  os_sleep)

System shutdown and resume function.

Note
This function is designed to be called by the OS idle routine. The shut down procedure are as follows:
  1. Mask all the interrupts,
  1. Call each driver or application's power state function to find the power state and sleep time,
  2. If power state is active, then unmask interrupt and return to OS,
  3. If power state is sleep, then call arm's WFI to shut down CPU clock. Once any interrupt happens, WFI will finish and this function will unmask interrupt and return the sleep time to OS,
  4. If power state is deep sleep, then save the context and ask HW to remove power,
  5. Once HW resume, boot ram will recover clock, XIP, then jump to this function, This function will call each driver and application register power up function to resume system and then it will unmask interrupt and return the deep sleep time to the OS.
Parameters
[in]os_sleepTime in millisecond that Os is idle
Returns
Final sleep time.

◆ hal_pm_unreg_ble_mod()

int hal_pm_unreg_ble_mod ( struct pm_module *  module)

Unregister BLE power module function.

Parameters
[in]moduleA pointer to the PM module structure,
See also
struct pm_module
Returns
See also
enum pm_err

◆ hal_pm_unreg_mod()

int hal_pm_unreg_mod ( struct pm_module *  module)

Unregister power module function.

Parameters
[in]moduleA pointer to the PM module structure,
See also
struct pm_module
Returns
See also
enum pm_err