gr5405_sys_sdk.h File Reference

GR5405 System API. More...

#include "gr5405_sys_cfg.h"
#include "gr_nvds.h"
#include "gr5405_pwr.h"
#include "gr5xx_fpb.h"
#include "gr_common.h"
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdarg.h>

Go to the source code of this file.

Classes

struct  sdk_version_t
 SDK version definition. More...
 
struct  sys_assert_cb_t
 Assert callbacks. More...
 
struct  rf_trim_info_t
 RF trim parameter information definition. More...
 
struct  adc_trim_info_t
 ADC trim parameter information definition. More...
 
struct  pmu_trim_info_t
 PMU trim parameter information definition. More...
 
struct  ringo_trim_info_t
 Ringo trim information definition. More...
 
struct  boot_timing_params_t
 Warm boot timing parameters(unit: us). More...
 

Macros

#define SYS_BOOT_SETTING_PATTERN   0x474F4F44
 
#define SYS_BOOT_SETTING_RSV_MAGIC   0xFFFFFFFF
 
#define SYS_BOOT_SETTING_SWD_ENABLE   0xFF
 
#define SYS_BOOT_SETTING_SWD_DISABLE   0xA5
 
#define SYS_SCA_SETTING_ADDR   0x0027F000
 
#define SYS_INVALID_TIMER_ID   0xFF
 
#define SYS_BD_ADDR_LEN   BLE_GAP_ADDR_LEN
 
#define SYS_CHIP_UID_LEN   0x10
 
#define SYS_SET_BD_ADDR(BD_ADDR_ARRAY)   nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY)
 
#define SYS_ROM_VERSION_ADDR   ((uint32_t)(0x200))
 
#define CHECK_IS_ON_FPGA()   (MCU_SUB->FPGA_CTRL & MCU_SUB_FPGA_CTRL_REG_EXIST)
 

Typedefs

typedef void(* callback_t) (int)
 The function pointers to register event callback. More...
 
typedef void(* timer_callback_t) (uint8_t timer_id)
 Timer callback type. More...
 
typedef int(* vprintf_callback_t) (const char *fmt, va_list argp)
 Printf callback type. More...
 
typedef uint16_t(* raw_log_send_cb_t) (uint8_t *p_data, uint16_t length)
 raw log callback type. More...
 
typedef void(* void_func_t) (void)
 Low power clock update function type. More...
 
typedef int32_t(* int_func_t) (void)
 Low power clock update function type. More...
 
typedef void(* sys_context_func_t) (void)
 Function type for saving user context before deep sleep. More...
 
typedef void(* assert_err_cb_t) (const char *expr, const char *file, int line)
 Error assert callback type. More...
 
typedef void(* assert_param_cb_t) (int param0, int param1, const char *file, int line)
 Parameter assert callback type. More...
 
typedef void(* assert_warn_cb_t) (int param0, int param1, const char *file, int line)
 Warning assert callback type. More...
 

Enumerations

enum  sram_size_t {
  SYS_DEV_SRAM_48K = 0x30,
  SYS_DEV_SRAM_64K = 0x40,
  SYS_DEV_SRAM_80K = 0x50,
  SYS_DEV_SRAM_96K = 0x60
}
 Definition of Device SRAM Size Enumerations. More...
 
enum  package_type_t {
  PACKAGE_NONE = 0,
  PACKAGE_QFN48 = 0x0100,
  PACKAGE_QFN32 = 0x0200
}
 package type. More...
 
enum  hw_version_type_t {
  HW_VERSION_B2 = 0x4232,
  HW_VERSION_B3 = 0x4233
}
 package type. More...
 

Functions

struct __attribute ((packed))
 
void * sys_malloc (uint32_t size)
 Malloc size memory. More...
 
void * sys_malloc_db (uint32_t size)
 Malloc size memory prefer to use db heap. More...
 
void sys_free (void *mem_ptr)
 free memory. More...
 
void sys_app_heap_size_set (uint16_t max_size)
 Set max heap size used by app layer. More...
 
uint16_t sys_app_used_heap_size_get (void)
 Get used heap size by app layer. More...
 
void * sys_app_malloc (uint16_t buf_size)
 Allocate memory for app layer. More...
 
void sys_app_free (void *p_data)
 Free memory for app layer. More...
 
void sys_app_printf (const char *format,...)
 Output debug logs. More...
 
void delay_us (uint32_t us)
 Delay the function execution. More...
 
void delay_ms (uint32_t ms)
 Delay the function execution. More...
 
void sys_signal_handler_register (callback_t isr_handler)
 Register signal handler. More...
 
void sys_sdk_verison_get (sdk_version_t *p_version)
 Get SDK version. More...
 
void sys_context_save (void)
 Save system context. More...
 
void restore_sys_context (void)
 Load system context. More...
 
void sys_security_data_use_present (uint32_t addr, uint8_t *input, uint32_t size, uint8_t *output)
 Encrypt and decrypt data using Present. More...
 
uint16_t sys_rf_trim_get (rf_trim_info_t *p_rf_trim)
 Get the RF trim information. More...
 
uint16_t sys_adc_trim_get (adc_trim_info_t *p_adc_trim)
 Get the ADC trim information. More...
 
uint16_t sys_pmu_trim_get (pmu_trim_info_t *p_pmu_trim)
 Get the PMU trim information. More...
 
uint16_t sys_crystal_trim_get (uint16_t *p_crystal_trim)
 Get the crystal trim information. More...
 
uint16_t sys_trim_sum_get (uint16_t *p_trim_sum)
 Get the trim checksum. More...
 
uint16_t sys_device_addr_get (uint8_t *p_device_addr)
 Get the device address information. More...
 
uint16_t sys_hw_version_get (hw_version_type_t *p_hw_version)
 Get the HW version information. More...
 
uint16_t sys_device_uid_get (uint8_t *p_device_uid)
 Get the device UID information. More...
 
uint16_t sys_device_lp_gain_offset_2m_get (uint8_t *p_offset)
 Get the LP gain offset 2M information. More...
 
uint16_t sys_device_sram_get (sram_size_t *p_sram_size)
 Get the RAM size information. More...
 
uint16_t sys_device_package_get (package_type_t *p_package_type)
 Get the chip's package type. More...
 
uint16_t sys_ringo_trim_get (ringo_trim_info_t *p_ringo_trim)
 Get the chip ringo trim value. More...
 
void sys_lpclk_set (uint32_t user_lpclk)
 Set low power CLK frequency. More...
 
uint32_t sys_us_2_lpcycles (uint32_t us)
 Convert a duration in μs into a duration in lp cycles. More...
 
uint32_t sys_lpcycles_2_hus (uint32_t lpcycles, uint32_t *error_corr)
 Convert a duration in lp cycles into a duration in half μs. More...
 
uint16_t sys_ble_heartbeat_period_set (uint32_t period_hus)
 Set BLE Sleep HeartBeat Period. More...
 
uint16_t sys_ble_heartbeat_period_get (uint32_t *p_period_hus)
 Get BLE Sleep HeartBeat Period. More...
 
void sys_max_msg_usage_ratio_set (uint8_t usage_ratio)
 Set system maximum usage ratio of message heap. More...
 
void sys_lld_max_msg_usage_ratio_set (uint8_t usage_ratio)
 Set system lld layer maximum usage ratio of message heap. More...
 
uint8_t sys_msg_usage_ratio_get (void)
 Get system message heap usage ratio. More...
 
uint8_t sys_env_usage_ratio_get (void)
 Get system environment heap usage ratio. More...
 
uint8_t sys_attdb_usage_ratio_get (void)
 Get system attriute database heap usage ratio. More...
 
uint8_t sys_nonret_usage_ratio_get (void)
 Get system non retention heap usage ratio. More...
 
uint32_t sys_lpclk_get (void)
 Get low power CLK frequency. More...
 
uint32_t sys_lpper_get (void)
 Get low power CLK period. More...
 
void sys_assert_cb_register (sys_assert_cb_t *p_assert_cb)
 Register assert callbacks. More...
 
bool sys_ke_sleep_check (void)
 Get status of ke_event list. More...
 
void sys_swd_enable (void)
 Enable swd function. More...
 
void sys_swd_disable (void)
 Disable swd function. More...
 
uint32_t sys_swd_is_enabled (void)
 Check if swd function is enabled. More...
 
void set_io_ldo_use_3p3_v (bool flag)
 Set s_io_ldo_use_3p3_v function. More...
 
void ble_stack_em_base_init (uint32_t address)
 Set ble exchange memory base address. More...
 
void ble_em_addr_offset_set (uint16_t offset)
 Set ble exchange memory buffer address common offset. More...
 
uint8_t sys_sdk_ultra_conn_update (uint8_t conn_idx, uint16_t interval, uint16_t latency, uint16_t superv_to)
 Register the callback function of the extended llcp process. More...
 
void sys_firmware_jump (uint32_t fw_addr, uint32_t fw_bin_size)
 jump to app firmware. More...
 

Variables

 sys_boot_setting_t
 

Detailed Description

GR5405 System 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 gr5405_sys_sdk.h.