gr55xx_pwr.h File Reference

GR55XX Platform Power Manager Module API. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "system_gr55xx.h"

Go to the source code of this file.

Classes

struct  pwr_mgmt_var_box_t
 power manager setting parameter. Use pwr_mgmt_var_set to transfer the parameters in the structure to PMU, and then the pwr_mgmt_mode_set function will use the new parameters for power management. Note that this is an advanced API, the wrong setting of parameters may lead to abnormal power management, so please use it carefully. More...
 
struct  pwr_table_t
 parameter configuration table. More...
 

Typedefs

typedef void(* trace_func_t) (uint8_t)
 Trace function type. More...
 
typedef void(* periph_func_t) (void)
 Peripheral function type. More...
 
typedef void(* pwr_before_sleep_func_t) (void)
 Before sleep function type. More...
 
typedef pwr_mgmt_dev_state_t(* pwr_dev_check_func_t) (void)
 Device check function type. More...
 
typedef void(* io_dump_func_t) (void)
 function registered to dump io configuration. More...
 
typedef void(* mem_check_proc_t) (void)
 mem check process type. More...
 

Enumerations

enum  boot_mode_t {
  COLD_BOOT = 0,
  WARM_BOOT
}
 power manager boot type. More...
 
enum  pwr_mgmt_mode_t {
  PMR_MGMT_ACTIVE_MODE = 0x0,
  PMR_MGMT_IDLE_MODE,
  PMR_MGMT_SLEEP_MODE
}
 power manager model. More...
 
enum  pwr_mgmt_dev_state_t {
  DEVICE_BUSY = 0x0,
  DEVICE_IDLE
}
 power manager device work state. More...
 
enum  notify_timer_event_t {
  EVENT_APP_TIMER_START = 0,
  EVENT_APP_TIMER_STOP
}
 power manager app timer work state. More...
 
enum  {
  AMS_PLAYER_ATTR_ID_NAME,
  AMS_PLAYER_ATTR_ID_PLAYBACK_INFO,
  AMS_PLAYER_ATTR_ID_VOLUME,
  IAS_ALERT_NONE,
  IAS_ALERT_MILD,
  IAS_ALERT_HIGH,
  TRC_PWR_WFE_MODE = 0,
  TRC_PWR_DSLEEP_MODE,
  TRC_PWR_ACTIVE_MODE,
  TRC_PWR_BLE_RET_DSLEEP,
  TRC_PWR_APP_TIMER_REFUSE,
  TRC_PWR_APP_TIMER_PASS,
  TRC_PWR_BLE_TIMER_PASS,
  BIT_HCI_SEND_2_CONTROLLER,
  BIT_HAL_XQSPI_SET_XIP_PRESENT_STATUS,
  BIT_LL_XQSPI_INIT,
  BIT_HAL_EXFLASH_WRITE,
  BIT_HAL_EXFLASH_ERASE,
  BIT_HAL_EXFLASH_READ,
  BIT_BLE_BM_SET_SEC_INFO,
  BIT_KE_TASK_SCHEDULE
}
 PMU Tracking. More...
 

Functions

pwr_mgmt_mode_t pwr_mgmt_shutdown (void)
 This function allows ARM to enter deep sleep mode, but users should not use this function directly. Note that this function is only available in environments where non-RTOS is used, and that users can only execute it while in main.c. More...
 
boot_mode_t pwr_mgmt_get_wakeup_flag (void)
 Get the current boot mode. More...
 
void pwr_mgmt_set_wakeup_flag (boot_mode_t boot_mode)
 Mark the mode of next boot, cold boot or warm boot. More...
 
void pwr_mgmt_mode_set (pwr_mgmt_mode_t pm_mode)
 Set the specified sleep mode. When the setting is completed, the system will automatically enter the specified sleep mode through the strategy. More...
 
pwr_mgmt_mode_t pwr_mgmt_mode_get (void)
 Get the specified sleep mode. More...
 
pwr_mgmt_mode_t pwr_mgmt_baseband_state_get (void)
 Get the power state of baseband. More...
 
pwr_mgmt_mode_t pwr_mgmt_check_ext_timer (void)
 Get the state of extenal timer. More...
 
void pwr_mgmt_schedule (void)
 Sleep Policy Scheduling Function. Note that: 1. This function shall only be used in non-RTOS environments; 2. This function shall only be used in main function; 3. Local variables shall not be used in main function when this api used. More...
 
bool pwr_mgmt_ble_wakeup (void)
 Wake the BLE core via an external request. More...
 
void pwr_mgmt_check_ble_event (void)
 Check whether there are ble events in the queue, and if so, handle them immediately. More...
 
void pwr_mgmt_notify_timer_event (notify_timer_event_t timer_event)
 This function is used to push startup information in app timer. This information will optimize power management strategy. Note that this function is an advanced API and users should not use it directly. More...
 
pwr_mgmt_mode_t pwr_mgmt_get_sleep_mode (void)
 Query the sleep mode that the current system can access. More...
 
void pwr_mgmt_update_wkup_param (void)
 Update wakeup param. More...
 
void pwr_mgmt_wfe_sleep (void)
 Execution of this function allows ARM to enter the WFE state and exit the WFE state when an event or interrupt occurs. More...
 
void pwr_mgmt_ultra_sleep (uint32_t time_ms)
 Execution of this function allows ARM to enter the ultra sleep state and wakeup the chip when an event occurs. More...
 
void pwr_mgmt_init (pwr_table_t *p_pwr_table, mcu_clock_type_t sys_clk)
 PMU Initialization Function. More...
 
void pwr_mgmt_dev_init (periph_func_t p_periph_init)
 Peripheral Controller Initialization Register interface. More...
 
void pwr_mgmt_dev_resume (void)
 Device config resume interface. More...
 
pwr_mgmt_dev_state_t pwr_mgmt_dev_suspend (void)
 Device config suspend interface. More...
 
void pwr_mgmt_mem_ctl_set (uint32_t mem_sleep_state, uint32_t mem_work_state)
 Mem state control under deep sleep & work state. More...
 
void pwr_mgmt_set_callback (pwr_dev_check_func_t dev_check_fun, pwr_before_sleep_func_t before_sleep_fun)
 Set PMU callback function. More...
 
void pwr_mgmt_wakeup_source_setup (uint32_t wakeup_source)
 Set the wakeup source. More...
 
void pwr_mgmt_wakeup_source_clear (uint32_t wakeup_source)
 Clear the wakeup source. More...
 
void pwr_mgmt_save_context (void)
 Save context function. More...
 
void pwr_mgmt_load_context (void)
 Load context function. More...
 
void pwr_mgmt_disable_nvic_irq (void)
 Disable nvic irq. More...
 
void pwr_mgmt_enable_nvic_irq (void)
 Enable nvic irq. More...
 
bool pwr_mgmt_check_pend_irq (void)
 Check nvic irq. More...
 
void pwr_mgmt_register_trace_func (trace_func_t trace_func)
 Trace function register. More...
 
void pwr_mgmt_register_io_dump_func (io_dump_func_t dump_func)
 function registered to dump io configuration. More...
 

Variables

pwr_table_t pwr_table []
 pwr table. More...
 

Detailed Description

GR55XX Platform Power Manager Module API.

Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_pwr.h.