gr533x_sys_sdk.h File Reference
#include "gr533x_sys_cfg.h"
#include "gr533x_nvds.h"
#include "gr533x_pwr.h"
#include "gr5xx_fpb.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  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))
 

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 = 0x03,
  SYS_DEV_SRAM_64K = 0x02,
  SYS_DEV_SRAM_80K = 0x01,
  SYS_DEV_SRAM_96K = 0x00
}
 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 memery. More...
 
void sys_free (void *mem_ptr)
 free memery. 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...
 
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)
 Diable swd function. More...
 
void set_io_ldo_use_3p3_v (bool flag)
 Set g_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