gr533x_pwr.h File Reference

GR533X Platform Power Manager Module API. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "system_gr533x.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...
 

Macros

#define PMR_MGMT_SUCCESS   0x0
 PMU error code. More...
 
#define PMR_MGMT_FAIL   0xFF
 
#define PWR_MGMT_BB_CHECK_FAIL   0xFE
 
#define PWR_MGMT_MODE_CHECK_FAIL   0xFD
 

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(* mem_check_proc_t) (void)
 mem check process type. More...
 
typedef uint8_t(* srpg_before_func_t) (void)
 SRPG before function 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  app_prevent_sleep {
  PMR_WAKE_UP_ONGOING = 0x0001,
  PMR_TL_TX_ONGOING = 0x0002,
  PMR_TL_RX_ONGOING = 0x0004,
  PMR_DEEP_SLEEP = 0x0008,
  PMR_CRYPT_ONGOING = 0x0010,
  PMR_CSB_NOT_LPO_ALLOWED = 0x0040,
  PMR_MWS_WLAN_EVENT_GENERATOR_ACTIVE = 0x0080,
  PMR_PLF_DEEP_SLEEP_DISABLED = 0x0100,
  PMR_BB_FRAME_ONGOING = 0x0200,
  PMR_HOP_CALC_ONGOING = 0x0400,
  PMR_BT_ACTIVE_MODE = 0x0800,
  PMR_BLE_ACTIVE_MODE = 0x1000
}
 Definition of the bits preventing the system from sleeping. 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  {
  BLE_GATT_COMMON_EVT_MTU_EXCHANGE = BLE_GATT_COMMON_EVT_BASE,
  BLE_GATT_COMMON_EVT_PRF_REGISTER,
  BLE_GATT_COMMON_EVT_MAX,
  ISO_GPIO_MASK_0 = 0x1,
  ISO_GPIO_MASK_1 = 0x2,
  ISO_GPIO_MASK_2 = 0x4,
  ISO_GPIO_MASK_3 = 0x8,
  ISO_GPIO_MASK_4 = 0x10,
  ISO_GPIO_MASK_5 = 0x20,
  ISO_GPIO_MASK_6 = 0x40,
  ISO_GPIO_MASK_7 = 0x80,
  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,
  EXFLASH_CONFIG_CACHE_MODE = 0x00,
  EXFLASH_CONFIG_READ_CMD = 0x01,
  EXFLASH_CONFIG_BAUD_RATE = 0x02,
  EXFLASH_CONFIG_CLOCK_MODE = 0x03,
  EXFLASH_CONFIG_CACHE_FLUSH = 0x04,
  EXFLASH_CONFIG_PAGE_TYPE = 0x05,
  DFU_CACHE_TYPE_CALL_STACK = 0x00,
  DFU_CACHE_TYPE_REG,
  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_REFUSE,
  TRC_PWR_BLE_TIMER_PASS,
  TRC_PWR_RTC_TIMER_REFUSE,
  TRC_PWR_RTC_TIMER_PASS,
  TRC_PWR_RTC1_TIMER_REFUSE,
  TRC_PWR_RTC1_TIMER_PASS,
  TRC_PWR_WDT_TIMER_REFUSE,
  TRC_PWR_WDT_TIMER_PASS
}
 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...
 
void pwr_mgmt_schedule (void)
 Sleep Policy Scheduling Function. 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...
 
void 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_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_save_context (void)
 Save context function. More...
 
void pwr_mgmt_load_context (void)
 Load context function. More...
 
uint8_t pwr_mgmt_sleep (void)
 shutdown power in rtos mode More...
 
void pwr_mgmt_register_trace_func (trace_func_t status_trace_func, trace_func_t sched_trace_func)
 Trace function register. More...
 

Variables

pwr_table_t pwr_table []
 pwr table. More...
 

Detailed Description

GR533X 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 gr533x_pwr.h.