gr55xx_sys_sdk.h File Reference
#include "gr55xx_sys_cfg.h"
#include "gr55xx_nvds.h"
#include "gr55xx_pwr.h"
#include "gr55xx_fpb.h"
#include "ble_error.h"
#include "gr55xx_hal_adc.h"
#include "gr55xx_hal_exflash.h"
#include <stdint.h>
#include <stdio.h>
#include <stdbool.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  comp_trim_t
 Comparator trim 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_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)
 

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_288K = 0x01,
  SYS_DEV_SRAM_512K = 0x00
}
 Definition of Device SRAM Size Enumerations. More...
 
enum  package_type_t {
  PACKAGE_NONE = 0,
  PACKAGE_GR5526VGBIP = 0x0100,
  PACKAGE_GR5526VGBI = 0x0101,
  PACKAGE_GR5526_DEBUG = 0x0102,
  PACKAGE_GR5526RGNIP = 0x0200,
  PACKAGE_GR5526RGNI = 0x0201,
  PACKAGE_GR5526RJNIP = 0x0202
}
 package type. More...
 

Functions

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_malloc (uint32_t size)
 Memory allocation. More...
 
void sys_free (void *p_mem)
 Free allocated memory. 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_regs_save (volatile uint32_t *p_address, uint32_t value)
 Save system registers. More...
 
void sys_context_checksum_gen (void)
 Generate checksum info for system context. More...
 
void sys_context_save_register (sys_context_func_t before, sys_context_func_t after, void *context_param)
 Register user-saved function. 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...
 
uint32_t sys_security_enable_status_check (void)
 Check the chip's security level. More...
 
uint8_t sys_security_calculate_hmac (void *data, uint32_t size, uint8_t *hmac)
 Calculate the HMAC code of the data. 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_flash_timing_get (exflash_timing_param_t *p_flash_timing)
 Get the Flash timing information. More...
 
uint16_t sys_comp_trim_get (comp_trim_t *p_comp_trim)
 Get the copmparator 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_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...
 
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...
 
uint32_t sys_reverse_word (uint32_t value)
 Reverse byte order (32 bit). For example, 0x12345678 becomes 0x78563412. More...
 
uint16_t sys_reverse_hword (uint16_t value)
 Reverse byte order (16 bit). For example, 0x1234 becomes 0x3412. More...