gr55xx_sys.h File Reference

GR55XX System API. More...

#include "gr55xx_sys_cfg.h"
#include "gr55xx_nvds.h"
#include "gr55xx_dfu.h"
#include "gr55xx_pwr.h"
#include "gr55xx_fpb.h"
#include "ble.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  link_rx_info_t
 Link RX information definition. 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...
 

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)
 
#define SYS_ROM_VERSION_ADDR   0x45000
 

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 void(* void_func_t) (void)
 Low power clock update function type. More...
 
typedef int(* int_func_t) (void)
 Low power clock update function type with resturn. 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_64K = 0x02,
  SYS_DEV_SRAM_128K = 0x01,
  SYS_DEV_SRAM_256K = 0x00
}
 Definition of Device SRAM Size Enumerations. More...
 
enum  package_type_t {
  PACKAGE_NONE = 0,
  PACKAGE_GR5515RGBD = 1,
  PACKAGE_GR5515GGBD = 2,
  PACKAGE_GR5515IGND = 3,
  PACKAGE_GR5515I0ND = 4,
  PACKAGE_GR5513BEND = 5,
  PACKAGE_GR5515BEND = 6,
  PACKAGE_GR5513BENDU = 7,
  PACKAGE_GR5515I0NDA = 8,
  PACKAGE_GR5515IENDU = 9
}
 package type. More...
 

Functions

void sys_app_printf (const char *format,...)
 Output debug logs. More...
 
void sys_delay_us (uint32_t us)
 Delay the function execution. More...
 
void sys_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_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...
 
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...
 
void app_boot_turn_on_encrypt_clock (void)
 app boot project turn on the encrypt clock. More...
 
void app_boot_security_clock_set (void)
 app boot project set the security clock. More...
 
void sys_firmware_jump (dfu_boot_info_t *p_boot_info)
 jump to app firmware. 69 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...
 
uint16_t sys_get_efuse_io_ldo (uint16_t *io_ldo)
 Get the chip's IO LDO voltage. 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 us 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 us. More...
 
void sys_ble_static_addr_policy_reverse (void)
 Reverse the policy for static address created by chip uuid . 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...
 
uint8_t sys_link_quality_get (uint8_t conn_idx, link_rx_info_t *rx_info)
 Get link quality info. More...
 
void sys_link_quality_clear (uint8_t conn_idx)
 Clear link quality info. More...
 
void sys_lpclk_update_func_register (void_func_t func_update_lpclk)
 Register low power clock update function. More...
 
void sys_lpclk_update_func_with_return_register (int_func_t func_update_lpclk)
 Register low power clock update function with int return. 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 rtc_calibration (void)
 RTC calibration function. More...
 
void rng_calibration (void)
 RNG calibration function. 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...
 

Detailed Description

GR55XX 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 gr55xx_sys.h.