gr55xx_hal_pwr_mgmt.h File Reference

This file contains all the functions prototypes for the HAL module driver. More...

#include "gr55xx_hal_def.h"
#include <stdio.h>
#include <stdbool.h>
+ Include dependency graph for gr55xx_hal_pwr_mgmt.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALL_DEVICES_SLEEP   (0xFFFFFFFFU)
 All peripherals sleep
More...
 
#define ALL_DEVICES_BACKUP   (0x00000000U)
 All peripherals backed up. More...
 

Typedefs

typedef hal_status_t(* p_device_suspend_func) (void *p_dev_handle)
 Peripheral suspend callback definition. More...
 
typedef hal_status_t(* p_device_resume_func) (void *p_dev_handle)
 Peripheral resume callback definition. More...
 

Enumerations

enum  periph_device_number_t {
  PERIPH_DEVICE_NUM_DMA0 = 0, PERIPH_DEVICE_NUM_DMA1, PERIPH_DEVICE_NUM_ISO7816, PERIPH_DEVICE_NUM_PKC,
  PERIPH_DEVICE_NUM_QSPI0, PERIPH_DEVICE_NUM_QSPI1, PERIPH_DEVICE_NUM_QSPI2, PERIPH_DEVICE_NUM_SPIM,
  PERIPH_DEVICE_NUM_SPIS, PERIPH_DEVICE_NUM_DSPI, PERIPH_DEVICE_NUM_I2C0, PERIPH_DEVICE_NUM_I2C1,
  PERIPH_DEVICE_NUM_I2C2, PERIPH_DEVICE_NUM_I2C3, PERIPH_DEVICE_NUM_I2C4, PERIPH_DEVICE_NUM_I2C5,
  PERIPH_DEVICE_NUM_UART0, PERIPH_DEVICE_NUM_UART1, PERIPH_DEVICE_NUM_UART2, PERIPH_DEVICE_NUM_UART3,
  PERIPH_DEVICE_NUM_UART4, PERIPH_DEVICE_NUM_UART5, PERIPH_DEVICE_NUM_I2S_M, PERIPH_DEVICE_NUM_I2S_S,
  PERIPH_DEVICE_NUM_PDM, PERIPH_DEVICE_NUM_HMAC, PERIPH_DEVICE_NUM_RNG, PERIPH_DEVICE_NUM_AES,
  PERIPH_DEVICE_NUM_PWM0, PERIPH_DEVICE_NUM_PWM1, PERIPH_DEVICE_NUM_SNSADC, PERIPH_DEVICE_NUM_USB,
  MAX_PERIPH_DEVICE_NUM
}
 Peripheral Device ID definition NOTE:The order of enumeration is the order of recovery. More...
 
enum  extra_device_number_t {
  EXTRA_DEVICE_NUM_CLK_CALIB = 0, EXTRA_DEVICE_NUM_GPU, EXTRA_DEVICE_NUM_DC, EXTRA_DEVICE_NUM_OSPI,
  MAX_EXTRA_DEVICE_NUM
}
 Extra Device ID definition. More...
 
enum  periph_state_t { IDLE = 0, ACTIVE }
 Peripheral Device State definition. More...
 

Functions

void hal_pwr_mgmt_device_suspend_register (periph_device_number_t dev_num, p_device_suspend_func my_device_suspend_function)
 Set peripheral suspend function. More...
 
void hal_pwr_mgmt_device_suspend_release (periph_device_number_t dev_num)
 Release peripheral suspend function. More...
 
void hal_pwr_mgmt_device_resume_register (periph_device_number_t dev_num, p_device_resume_func my_device_resume_function)
 Set peripheral resume function. More...
 
void hal_pwr_mgmt_device_resume_release (periph_device_number_t dev_num)
 Release peripheral resume function. More...
 
void hal_pwr_mgmt_save_device_handle (periph_device_number_t dev_num, void *p_dev)
 Store the specified peripheral handle. More...
 
void hal_pwr_mgmt_clear_device_handle (periph_device_number_t dev_num)
 Clear the specified peripheral handle. More...
 
void hal_pwr_mgmt_set_device_state (periph_device_number_t dev_num, periph_state_t state)
 Store the specified peripheral state. More...
 
void hal_pwr_mgmt_set_device_renew_flag (periph_device_number_t dev_num)
 Store the specified peripheral backup flag. More...
 
void hal_pwr_mgmt_clear_device_sleep_flag (periph_device_number_t dev_num)
 Store the specified peripheral sleep flag. More...
 
void hal_pwr_mgmt_extra_device_suspend_register (extra_device_number_t dev_num, p_device_suspend_func my_device_suspend_function, void *p_dev_handle)
 Set extra device suspend function. More...
 
void hal_pwr_mgmt_extra_device_resume_register (extra_device_number_t dev_num, p_device_resume_func my_device_resume_function, void *p_dev_handle)
 Set extra resume function. More...
 
void hal_pwr_mgmt_set_extra_device_state (extra_device_number_t dev_num, periph_state_t state)
 set the specified extra device state More...
 
void hal_pwr_mgmt_set_extra_device_renew_flag (extra_device_number_t dev_num)
 set the specified extra device updata flag More...
 

Variables

volatile uint32_t g_devices_state
 All peripheral status.When all are idle, the system can sleep. More...
 
volatile uint32_t g_devices_renew
 Peripheral updata flag.If peripherals have been used, they need to be backed up. More...
 
volatile uint32_t g_devices_sleep
 Peripheral sleep flag.Go to sleep as 0xFFFFFFFF.The corresponding bit is cleared to 0 after wake-up recovery. More...
 
p_device_suspend_func devices_suspend_cb [MAX_PERIPH_DEVICE_NUM]
 Store the suspend function of all peripherals. More...
 
p_device_resume_func devices_resume_cb [MAX_PERIPH_DEVICE_NUM]
 Store the resume function of all peripherals. More...
 
void * devices_handle [MAX_PERIPH_DEVICE_NUM]
 Store the handle addresses of all peripheral instances. More...
 
volatile uint32_t g_extra_devices_state
 All extra devices status.When all are idle, the system can sleep. More...
 
volatile uint32_t g_extra_devices_renew
 Extra devices updata flag.If extra devices have been used, they need to be backed up. More...
 
p_device_suspend_func extra_devices_suspend_cb [MAX_EXTRA_DEVICE_NUM]
 Store the suspend function of all extra devices. More...
 
p_device_resume_func extra_devices_resume_cb [MAX_EXTRA_DEVICE_NUM]
 Store the resume function of all extra devices. More...
 
void * extra_devices_handle [MAX_EXTRA_DEVICE_NUM]
 Store the handle addresses of all extra devices instances. More...
 

Detailed Description

This file contains all the functions prototypes for the HAL module driver.

Author
BLE Driver Team
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_hal_pwr_mgmt.h.