gr55xx_sys_sdk.h
Go to the documentation of this file.
1 /**
2  *******************************************************************************
3  *
4  * @file gr55xx_sys_sdk.h
5  *
6  * @brief GR55XX System API
7  *
8  *******************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  *****************************************************************************************
36  */
37 
38 /**
39  @addtogroup SYSTEM
40  @{
41  */
42 
43 /**
44  * @addtogroup SYS System SDK
45  * @{
46  * @brief Definitions and prototypes for the system SDK interface.
47 */
48 
49 
50 
51 #ifndef __GR55XX_SYS_SDK_H__
52 #define __GR55XX_SYS_SDK_H__
53 
54 #include "gr55xx_sys_cfg.h"
55 #include "gr55xx_nvds.h"
56 #include "gr55xx_pwr.h"
57 #include "gr5xx_fpb.h"
58 #include "ble_error.h"
59 #include "gr55xx_hal_adc.h"
60 #include "gr55xx_hal_exflash.h"
61 #include <stdint.h>
62 #include <stdio.h>
63 #include <stdbool.h>
64 #include <stdarg.h>
65 
66 /** @addtogroup GR55XX_SYS_DEFINES Defines
67  * @{
68  */
69 #define SYS_INVALID_TIMER_ID 0xFF /**< Invalid system Timer ID. */
70 #define SYS_BD_ADDR_LEN BLE_GAP_ADDR_LEN /**< Length of Bluetoth Device Address. */
71 #define SYS_CHIP_UID_LEN 0x10 /**< Length of Bluetoth Chip UID. */
72 #define SYS_SET_BD_ADDR(BD_ADDR_ARRAY) nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY) /**< NVDS put BD address. */
73 /** @} */
74 
75 /**
76  * @defgroup GR55XX_SYS_TYPEDEF Typedefs
77  * @{
78  */
79 /**@brief The function pointers to register event callback. */
80 typedef void (*callback_t)(int);
81 
82 /** @brief Timer callback type. */
83 typedef void (*timer_callback_t)(uint8_t timer_id);
84 
85 /**@brief Printf callback type. */
86 typedef int (*vprintf_callback_t) (const char *fmt, va_list argp);
87 
88 /**@brief raw log callback type. */
89 typedef uint16_t (*raw_log_send_cb_t) (uint8_t *p_data, uint16_t length);
90 
91 /**@brief Low power clock update function type. */
92 typedef void (*void_func_t)(void);
93 
94 /**@brief Low power clock update function type. */
95 typedef int32_t (*int_func_t)(void);
96 
97 /**@brief Function type for saving user context before deep sleep. */
98 typedef void (*sys_context_func_t)(void);
99 
100 /**@brief Error assert callback type. */
101 typedef void (*assert_err_cb_t)(const char *expr, const char *file, int line);
102 
103 /**@brief Parameter assert callback type. */
104 typedef void (*assert_param_cb_t)(int param0, int param1, const char *file, int line);
105 
106 /**@brief Warning assert callback type. */
107 typedef void (*assert_warn_cb_t)(int param0, int param1, const char *file, int line);
108 /** @} */
109 
110 /** @addtogroup GR55XX_SYS_ENUMERATIONS Enumerations
111 * @{*/
112 /**@brief Definition of Device SRAM Size Enumerations. */
113 typedef enum
114 {
115  SYS_DEV_SRAM_256K = 0x00, /**< Supported 256K SRAM. */
116  SYS_DEV_SRAM_192K = 0x01, /**< Supported 192K SRAM. */
117  SYS_DEV_SRAM_128K = 0x02, /**< Supported 128K SRAM. */
118 } sram_size_t;
119 
120 /**@brief package type. */
121 typedef enum
122 {
123  PACKAGE_NONE = 0, /**< Package unused. */
124  PACKAGE_BGA55 = 0x1000, /**< BGA55 package. */
125  PACKAGE_QFN56 = 0x2000, /**< QFN56 package. */
126  PACKAGE_QFN68 = 0x2100, /**< QFN68 package. */
128 
129 /** @} */
130 
131 /** @addtogroup GR55XX_SYS_STRUCTURES Structures
132  * @{ */
133 /**@brief SDK version definition. */
134 typedef struct
135 {
136  uint8_t major; /**< Major version. */
137  uint8_t minor; /**< Minor version. */
138  uint16_t build; /**< Build number. */
139  uint32_t commit_id; /**< commit ID. */
141 
142 /**@brief Assert callbacks.*/
143 typedef struct
144 {
145  assert_err_cb_t assert_err_cb; /**< Assert error type callback. */
146  assert_param_cb_t assert_param_cb; /**< Assert parameter error type callback. */
147  assert_warn_cb_t assert_warn_cb; /**< Assert warning type callback. */
149 
150 /**@brief RF trim parameter information definition. */
151 typedef struct
152 {
153  int8_t rssi_cali; /**< RSSI calibration. */
154  int8_t tx_power; /**< TX power. */
156 
157 /**@brief Comparator trim information definition. */
158 typedef struct
159 {
160  uint16_t slope_int_no1;
161  uint16_t slope_int_no2;
162 } comp_trim_t;
163 
164 /**@brief PMU trim parameter information definition. */
165 typedef struct
166 {
167  uint8_t io_ldo_bypass; /**< IO LDO bypass */
168  uint8_t io_ldo_vout; /**< IO LDO Vout. */
169  uint8_t dig_ldo_64m; /**< DIG LDO 64m. */
170  uint8_t dig_ldo_16m; /**< DIG LDO 16m */
171  uint8_t dcdc_vout1p15; /**< DCDC Vout 1.15V */
172  uint8_t dcdc_vout1p05; /**< DCDC Vout 1.05V */
173  uint8_t stb_io_ldo_vout; /**< STB IO LDO Vout*/
175 
176 /**@brief Warm boot timing parameters(unit: us). */
177 typedef struct
178 {
179  uint16_t fast_ldo_prep; /**< Fast ldo prep. */
180  uint16_t hf_osc_prep; /**< HF Osc prep. */
181  uint16_t dcdc_prep; /**< DCDC prep. */
182  uint16_t dig_ldo_prep; /**< Dig ldo prep. */
183  uint16_t xo_prep; /**< XO prep. */
184  uint16_t pll_prep; /**< PLL prep. */
185  uint16_t pll_lock; /**< PLL lock. */
186  uint16_t pwr_sw_prep; /**< PWR sw prep. */
188 
189 /** @} */
190 
191 /** @addtogroup GR55XX_SYS_FUNCTIONS Functions
192  * @{ */
193 /**
194  *****************************************************************************************
195  * @brief Output debug logs.
196  *
197  * @param[in] format: Pointer to the log information.
198  *****************************************************************************************
199  */
200 void sys_app_printf(const char *format, ...);
201 
202 /**
203  *****************************************************************************************
204  * @brief Delay the function execution.
205  *
206  * @param[in] us: Microsecond.
207  *****************************************************************************************
208  */
209 void delay_us(uint32_t us);
210 
211 /**
212  *****************************************************************************************
213  * @brief Delay the function execution.
214  *
215  * @param[in] ms: Millisecond.
216  *****************************************************************************************
217  */
218 void delay_ms(uint32_t ms);
219 
220 /**
221  *****************************************************************************************
222  * @brief Memory allocation.
223  *
224  * @param[in] size: Requested memory size.
225  *
226  * @return Valid memory location if successful, else null.
227  *****************************************************************************************
228  */
229 void *sys_malloc(uint32_t size);
230 
231 /**
232  *****************************************************************************************
233  * @brief Free allocated memory.
234  *
235  * @param[in] p_mem: Pointer to memory block.
236  *****************************************************************************************
237  */
238 void sys_free(void *p_mem);
239 
240 /**
241  *****************************************************************************************
242  * @brief Register signal handler.
243  *
244  * @note This function is mainly used to register the upper-layer APP callback functions to the protocol layer,
245  * which will be invoked when there are event responses in the protocol layer.
246  *****************************************************************************************
247  */
249 
250 /**
251  *****************************************************************************************
252  * @brief Get SDK version.
253  *
254  * @note This function is mainly used to get the version of SDK.
255  *
256  * @param[out] p_version: The pointer to struct of @ref sdk_version_t.
257  *****************************************************************************************
258  */
260 
261 /**
262  *****************************************************************************************
263  * @brief Save system context.
264  *
265  * @note This function is used to save system context before the system goes to deep sleep.
266  * Boot codes will be used to restore system context in the wakeup procedure.
267  *****************************************************************************************
268  */
269 void sys_context_save(void);
270 
271 /**
272  *****************************************************************************************
273  * @brief Load system context.
274  *
275  * @note This function is used to load system context after the system goes to deep sleep.
276  *****************************************************************************************
277  */
279 
280 /**
281  *****************************************************************************************
282  * @brief Save system registers.
283  *
284  * @note This function is used to save system register before the system goes to deep sleep.
285  *
286  * @param[in] p_address: The pointer to register address.
287  * @param[in] value: The register value to be saved, it will be restored when system wakes up.
288  *****************************************************************************************
289  */
290 void sys_regs_save(volatile uint32_t *p_address, uint32_t value);
291 
292 /**
293  *****************************************************************************************
294  * @brief Generate checksum info for system context.
295  *
296  * @note This function is used to generate checksum for system context, it will be called
297  * before deep sleep in power management module.
298  *****************************************************************************************
299  */
301 
302 /**
303  *****************************************************************************************
304  * @brief Register user-saved function.
305  *
306  * @note This function is used to register user-level saved function, which will be executed
307  * before deep sleep in power management module.
308  *****************************************************************************************
309  */
310 void sys_context_save_register(sys_context_func_t before, sys_context_func_t after, void *context_param);
311 
312 /**
313  *****************************************************************************************
314  * @brief Encrypt and decrypt data using Present.
315  *
316  * @note This function is only used to encrypt and decrypt data that needs to be stored in Flash.
317  *
318  * @param[in] addr: Operation address (Flash address minus Flash start address).
319  * @param[in] input: Data before encryption and decryption.
320  * @param[in] size: Data size.
321  * @param[out] output: Data after encryption and decryption.
322  *****************************************************************************************
323  */
324 void sys_security_data_use_present(uint32_t addr, uint8_t *input, uint32_t size, uint8_t *output);
325 
326 /**
327  *****************************************************************************************
328  * @brief Check the chip's security level.
329  *
330  * @return 0: Security is not supported.
331  * 1: Security is supported.
332  *****************************************************************************************
333  */
335 
336 /**
337  *****************************************************************************************
338  * @brief Calculate the HMAC code of the data.
339  *
340  * @param[in] data: Calculate the raw data of HMAC.
341  * @param[in] size: Data size.
342  * @param[out] hmac: Calculate the result of HMAC.
343  *****************************************************************************************
344  */
345 uint8_t sys_security_calculate_hmac(void *data, uint32_t size, uint8_t *hmac);
346 
347 /**
348  *****************************************************************************************
349  * @brief Get the RF trim information.
350  *
351  * @param[out] p_rf_trim: The pointer to struct of @ref rf_trim_info_t.
352  * @return 0: Operation is OK.
353  * 1: the chip's parameter is incorrect.
354  *****************************************************************************************
355  */
356 uint16_t sys_rf_trim_get(rf_trim_info_t *p_rf_trim);
357 
358 /**
359  *****************************************************************************************
360  * @brief Get the ADC trim information.
361  *
362  * @param[out] p_adc_trim: The pointer to struct of adc_trim_info_t.
363  * @return 0: Operation is OK.
364  * 1: the chip's parameter is incorrect.
365  *****************************************************************************************
366  */
367 uint16_t sys_adc_trim_get(adc_trim_info_t *p_adc_trim);
368 
369 /**
370  *****************************************************************************************
371  * @brief Get the Flash timing information.
372  *
373  * @param[out] p_flash_timing: The pointer to struct of exflash_timing_param_t.
374  * @return 0: Operation is OK.
375  * 1: the chip's parameter is incorrect.
376  *****************************************************************************************
377  */
379 
380 /**
381  *****************************************************************************************
382  * @brief Get the copmparator trim information.
383  *
384  * @param[out] p_comp_trim: The pointer to struct of @ref comp_trim_t.
385  * @return 0: Operation is OK.
386  * 1: the chip's parameter is incorrect.
387  *****************************************************************************************
388  */
389 uint16_t sys_comp_trim_get(comp_trim_t *p_comp_trim);
390 
391 /**
392  *****************************************************************************************
393  * @brief Get the PMU trim information.
394  *
395  * @param[out] p_pmu_trim: The pointer to struct of @ref pmu_trim_info_t.
396  * @return 0: Operation is OK.
397  * 1: the chip's parameter is incorrect.
398  *****************************************************************************************
399  */
400 uint16_t sys_pmu_trim_get(pmu_trim_info_t *p_pmu_trim);
401 
402 /**
403  *****************************************************************************************
404  * @brief Get the crystal trim information.
405  *
406  * @param[out] p_crystal_trim: offset information for crystal.
407  * @return 0: Operation is OK.
408  * 1: the chip's parameter is incorrect.
409  *****************************************************************************************
410  */
411 uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim);
412 
413 /**
414  *****************************************************************************************
415  * @brief Get the trim checksum.
416  *
417  * @param[out] p_trim_sum: The pointer to the buffer for trim checksum.
418  * @return 0: Operation is OK.
419  * 1: the chip's parameter is incorrect.
420  *****************************************************************************************
421  */
422 uint16_t sys_trim_sum_get(uint16_t *p_trim_sum);
423 
424 /**
425  *****************************************************************************************
426  * @brief Get the device address information.
427  *
428  * @param[out] p_device_addr: Bluetooth address by default.
429  * @return 0: Operation is OK.
430  * 1: the chip's parameter is incorrect.
431  *****************************************************************************************
432  */
433 uint16_t sys_device_addr_get(uint8_t *p_device_addr);
434 
435 /**
436  *****************************************************************************************
437  * @brief Get the device UID information.
438  *
439  * @param[out] p_device_uid: Device chip UID.
440  * @return 0: Operation is OK.
441  * 1: the chip's parameter is incorrect.
442  *****************************************************************************************
443  */
444 uint16_t sys_device_uid_get(uint8_t *p_device_uid);
445 
446 /**
447  *****************************************************************************************
448  * @brief Get the LP gain offset 2M information.
449  *
450  * @param[out] p_offset: the offset of LP gain.
451  * @return 0: Operation is OK.
452  * 1: the chip's parameter is incorrect.
453  *****************************************************************************************
454  */
455 uint16_t sys_device_lp_gain_offset_2m_get(uint8_t *p_offset);
456 
457 /**
458  *****************************************************************************************
459  * @brief Get the RAM size information.
460  *
461  * @param[out] p_sram_size: The pointer to enumeration of @ref sram_size_t.
462  * @return 0: Operation is OK.
463  * 1: the chip's parameter is incorrect.
464  *****************************************************************************************
465  */
466 uint16_t sys_device_sram_get(sram_size_t *p_sram_size);
467 
468 /**
469  *****************************************************************************************
470  * @brief Get the chip's package type.
471  *
472  * @param[out] p_package_type: The pointer to enumeration of @ref package_type_t.
473  * @return 0: Operation is OK.
474  * 1: the chip's parameter is incorrect.
475  *****************************************************************************************
476  */
477 uint16_t sys_device_package_get(package_type_t *p_package_type);
478 
479 /**
480  *****************************************************************************************
481  * @brief Set low power CLK frequency.
482  *
483  * @param[in] user_lpclk: CLK frequency.
484  *****************************************************************************************
485  */
486 void sys_lpclk_set(uint32_t user_lpclk);
487 
488 /**
489  ****************************************************************************************
490  * @brief Convert a duration in μs into a duration in lp cycles.
491  *
492  * The function converts a duration in μs into a duration in lp cycles, according to the
493  * low power clock frequency (32768Hz or 32000Hz).
494  *
495  * @param[in] us: Duration in μs.
496  *
497  * @return Duration in lpcycles.
498  ****************************************************************************************
499  */
500 uint32_t sys_us_2_lpcycles(uint32_t us);
501 
502 /**
503  ****************************************************************************************
504  * @brief Convert a duration in lp cycles into a duration in half μs.
505  *
506  * The function converts a duration in lp cycles into a duration in half μs, according to the
507  * low power clock frequency (32768Hz or 32000Hz).
508  * @param[in] lpcycles: Duration in lp cycles.
509  * @param[in,out] error_corr: Insert and retrieve error created by truncating the LP Cycle Time to a half μs (in half μs).
510  *
511  * @return Duration in half μs
512  ****************************************************************************************
513  */
514 uint32_t sys_lpcycles_2_hus(uint32_t lpcycles, uint32_t *error_corr);
515 
516 /**
517  *****************************************************************************************
518  * @brief Set BLE Sleep HeartBeat Period.
519  * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
520  *
521  * @param[in] period_hus: The wake up duration of BLE when BLE is IDEL.
522  * Range 0x00000000-0xFFFFFFFF (in unit of μs).
523  *
524  * @retval ::SDK_SUCCESS: Operation is Success.
525  *****************************************************************************************
526  */
527 uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus);
528 
529 
530 /**
531  *****************************************************************************************
532  * @brief Get BLE Sleep HeartBeat Period.
533  * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
534  *
535  * @param[in] p_period_hus: Pointer to the wake up duration.
536  * Range 0x00000000-0xFFFFFFFF (in unit of μs).
537  *
538  * @retval ::SDK_SUCCESS: Operation is Success.
539  *****************************************************************************************
540  */
541 uint16_t sys_ble_heartbeat_period_get(uint32_t* p_period_hus);
542 
543 /**
544  ****************************************************************************************
545  * @brief Set system maximum usage ratio of message heap.
546  *
547  * The function will used to set message ratio of message heap.
548  * Valid ratio range is 50 - 100 percent in full message size.
549  *
550  * @param[in] usage_ratio: Usage ratio of message heap size.
551  *
552  ****************************************************************************************
553  */
554 void sys_max_msg_usage_ratio_set(uint8_t usage_ratio);
555 
556 /**
557  ****************************************************************************************
558  * @brief Set system lld layer maximum usage ratio of message heap.
559  *
560  * The function will used to set message ratio of message heap.
561  * Valid ratio range is 50 - 100 percent in full message size.
562  *
563  * @param[in] usage_ratio: Usage ratio of message heap size.
564  *
565  ****************************************************************************************
566  */
567 void sys_lld_max_msg_usage_ratio_set(uint8_t usage_ratio);
568 
569 /**
570  ****************************************************************************************
571  * @brief Get system message heap usage ratio.
572  *
573  * The function will used to get message ratio of message heap.
574  * This ratio is heap used percent in full message size.
575  *
576  * @return current heap used percent.
577  ****************************************************************************************
578  */
580 
581 /**
582  ****************************************************************************************
583  * @brief Get system environment heap usage ratio.
584  *
585  * The function will used to get environment ratio of environment heap.
586  * This ratio is heap used percent in full environment size.
587  *
588  * @return current heap used percent.
589  ****************************************************************************************
590  */
592 
593 /**
594  ****************************************************************************************
595  * @brief Get system attriute database heap usage ratio.
596  *
597  * The function will used to get attriute database ratio of attriute database heap.
598  * This ratio is heap used percent in full attriute database size.
599  *
600  * @return current heap used percent.
601  ****************************************************************************************
602  */
604 
605 /**
606  ****************************************************************************************
607  * @brief Get system non retention heap usage ratio.
608  *
609  * The function will used to get non retention ratio of non retention heap.
610  * This ratio is heap used percent in full non retention size.
611  *
612  * @return current heap used percent.
613  ****************************************************************************************
614  */
616 
617 /**
618  ****************************************************************************************
619  * @brief Get low power CLK frequency.
620  *
621  * This function is used to get the low power clock frequency.
622  *
623  * @return Low power CLK frequency.
624  ****************************************************************************************
625  */
626 uint32_t sys_lpclk_get(void);
627 
628 /**
629  ****************************************************************************************
630  * @brief Get low power CLK period.
631  *
632  * This function is used to get the low power CLK period.
633  *
634  * @return Low power CLK period.
635  ****************************************************************************************
636  */
637 uint32_t sys_lpper_get(void);
638 
639 /**
640  *****************************************************************************************
641  * @brief Register assert callbacks.
642  *
643  * @param[in] p_assert_cb: Pointer to assert callbacks.
644  *****************************************************************************************
645  */
647 
648 /**
649  ****************************************************************************************
650  * @brief Get status of ke_event list
651  * @return true: ke_event not busy, false : ke_event busy.
652  ****************************************************************************************
653  */
655 
656 /**
657  ****************************************************************************************
658  * @brief Enable swd function
659  ****************************************************************************************
660  */
661 void sys_swd_enable(void);
662 
663 /**
664  ****************************************************************************************
665  * @brief Diable swd function
666  ****************************************************************************************
667  */
668 void sys_swd_disable(void);
669 
670 /**
671  ****************************************************************************************
672  * @brief Register the callback function of the extended llcp process
673  *
674  * @param[in] conn_idx Connect index.
675  * @param[in] interval Connect interval (unit: 312.5 us)
676  * @param[in] latency Connect latency (unit of connection event)
677  * @param[in] superv_to Link supervision timeout (unit of 10 ms)
678  *
679  * @return status Error status
680  ****************************************************************************************
681  */
682 uint8_t sys_sdk_ultra_conn_update(uint8_t conn_idx, uint16_t interval, uint16_t latency, uint16_t superv_to);
683 
684 /**
685  ****************************************************************************************
686  * @brief Reverse byte order (32 bit). For example, 0x12345678 becomes 0x78563412.
687  * @retval : Reversed value
688  ****************************************************************************************
689  */
690 uint32_t sys_reverse_word(uint32_t value);
691 
692 /**
693  ****************************************************************************************
694  * @brief Reverse byte order (16 bit). For example, 0x1234 becomes 0x3412.
695  * @retval : Reversed value
696  ****************************************************************************************
697  */
698 uint16_t sys_reverse_hword(uint16_t value);
699 
700 
701 
702 /** @} */
703 #endif
704 
705 /** @} */
706 /** @} */
sys_lpcycles_2_hus
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.
boot_timing_params_t::pwr_sw_prep
uint16_t pwr_sw_prep
Definition: gr55xx_sys_sdk.h:186
sram_size_t
sram_size_t
Definition of Device SRAM Size Enumerations.
Definition: gr55xx_sys_sdk.h:114
assert_warn_cb_t
void(* assert_warn_cb_t)(int param0, int param1, const char *file, int line)
Warning assert callback type.
Definition: gr55xx_sys_sdk.h:107
callback_t
void(* callback_t)(int)
The function pointers to register event callback.
Definition: gr55xx_sys_sdk.h:80
vprintf_callback_t
int(* vprintf_callback_t)(const char *fmt, va_list argp)
Printf callback type.
Definition: gr55xx_sys_sdk.h:86
pmu_trim_info_t::io_ldo_vout
uint8_t io_ldo_vout
Definition: gr55xx_sys_sdk.h:168
sdk_version_t::major
uint8_t major
Definition: gr55xx_sys_sdk.h:136
PACKAGE_BGA55
@ PACKAGE_BGA55
Definition: gr55xx_sys_sdk.h:124
int_func_t
int32_t(* int_func_t)(void)
Low power clock update function type.
Definition: gr55xx_sys_sdk.h:95
assert_err_cb_t
void(* assert_err_cb_t)(const char *expr, const char *file, int line)
Error assert callback type.
Definition: gr55xx_sys_sdk.h:101
sys_lld_max_msg_usage_ratio_set
void sys_lld_max_msg_usage_ratio_set(uint8_t usage_ratio)
Set system lld layer maximum usage ratio of message heap.
sys_reverse_word
uint32_t sys_reverse_word(uint32_t value)
Reverse byte order (32 bit). For example, 0x12345678 becomes 0x78563412.
sys_context_checksum_gen
void sys_context_checksum_gen(void)
Generate checksum info for system context.
sys_rf_trim_get
uint16_t sys_rf_trim_get(rf_trim_info_t *p_rf_trim)
Get the RF trim information.
pmu_trim_info_t::stb_io_ldo_vout
uint8_t stb_io_ldo_vout
Definition: gr55xx_sys_sdk.h:173
sys_security_calculate_hmac
uint8_t sys_security_calculate_hmac(void *data, uint32_t size, uint8_t *hmac)
Calculate the HMAC code of the data.
sys_lpclk_get
uint32_t sys_lpclk_get(void)
Get low power CLK frequency.
rf_trim_info_t
RF trim parameter information definition.
Definition: gr55xx_sys_sdk.h:152
PACKAGE_QFN68
@ PACKAGE_QFN68
Definition: gr55xx_sys_sdk.h:126
sys_sdk_ultra_conn_update
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.
sdk_version_t::minor
uint8_t minor
Definition: gr55xx_sys_sdk.h:137
sys_attdb_usage_ratio_get
uint8_t sys_attdb_usage_ratio_get(void)
Get system attriute database heap usage ratio.
sys_max_msg_usage_ratio_set
void sys_max_msg_usage_ratio_set(uint8_t usage_ratio)
Set system maximum usage ratio of message heap.
PACKAGE_QFN56
@ PACKAGE_QFN56
Definition: gr55xx_sys_sdk.h:125
PACKAGE_NONE
@ PACKAGE_NONE
Definition: gr55xx_sys_sdk.h:123
sys_device_addr_get
uint16_t sys_device_addr_get(uint8_t *p_device_addr)
Get the device address information.
sys_signal_handler_register
void sys_signal_handler_register(callback_t isr_handler)
Register signal handler.
timer_callback_t
void(* timer_callback_t)(uint8_t timer_id)
Timer callback type.
Definition: gr55xx_sys_sdk.h:83
raw_log_send_cb_t
uint16_t(* raw_log_send_cb_t)(uint8_t *p_data, uint16_t length)
raw log callback type.
Definition: gr55xx_sys_sdk.h:89
SYS_DEV_SRAM_192K
@ SYS_DEV_SRAM_192K
Definition: gr55xx_sys_sdk.h:116
sys_context_func_t
void(* sys_context_func_t)(void)
Function type for saving user context before deep sleep.
Definition: gr55xx_sys_sdk.h:98
boot_timing_params_t
Warm boot timing parameters(unit: us).
Definition: gr55xx_sys_sdk.h:178
boot_timing_params_t::dig_ldo_prep
uint16_t dig_ldo_prep
Definition: gr55xx_sys_sdk.h:182
sys_assert_cb_t::assert_warn_cb
assert_warn_cb_t assert_warn_cb
Definition: gr55xx_sys_sdk.h:147
pmu_trim_info_t
PMU trim parameter information definition.
Definition: gr55xx_sys_sdk.h:166
SYS_DEV_SRAM_128K
@ SYS_DEV_SRAM_128K
Definition: gr55xx_sys_sdk.h:117
sdk_version_t
SDK version definition.
Definition: gr55xx_sys_sdk.h:135
sys_free
void sys_free(void *p_mem)
Free allocated memory.
sys_context_save_register
void sys_context_save_register(sys_context_func_t before, sys_context_func_t after, void *context_param)
Register user-saved function.
sys_app_printf
void sys_app_printf(const char *format,...)
Output debug logs.
boot_timing_params_t::pll_lock
uint16_t pll_lock
Definition: gr55xx_sys_sdk.h:185
assert_param_cb_t
void(* assert_param_cb_t)(int param0, int param1, const char *file, int line)
Parameter assert callback type.
Definition: gr55xx_sys_sdk.h:104
gr55xx_sys_cfg.h
Define the chip configuration.
restore_sys_context
void restore_sys_context(void)
Load system context.
void_func_t
void(* void_func_t)(void)
Low power clock update function type.
Definition: gr55xx_sys_sdk.h:92
sys_device_package_get
uint16_t sys_device_package_get(package_type_t *p_package_type)
Get the chip's package type.
delay_ms
void delay_ms(uint32_t ms)
Delay the function execution.
sys_msg_usage_ratio_get
uint8_t sys_msg_usage_ratio_get(void)
Get system message heap usage ratio.
sys_crystal_trim_get
uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim)
Get the crystal trim information.
gr55xx_nvds.h
NVDS API.
sys_context_save
void sys_context_save(void)
Save system context.
ble_error.h
File that contains error codes.
gr55xx_pwr.h
GR55XX Platform Power Manager Module API.
sys_security_data_use_present
void sys_security_data_use_present(uint32_t addr, uint8_t *input, uint32_t size, uint8_t *output)
Encrypt and decrypt data using Present.
sys_env_usage_ratio_get
uint8_t sys_env_usage_ratio_get(void)
Get system environment heap usage ratio.
_exflash_timing_param
exFlash AC characteristics
Definition: gr55xx_hal_exflash.h:138
pmu_trim_info_t::dcdc_vout1p05
uint8_t dcdc_vout1p05
Definition: gr55xx_sys_sdk.h:172
sys_ble_heartbeat_period_set
uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus)
Set BLE Sleep HeartBeat Period.
gr55xx_hal_adc.h
Header file containing functions prototypes of ADC HAL library.
gr55xx_hal_exflash.h
Header file containing functions prototypes of EXFLASH HAL library.
package_type_t
package_type_t
package type.
Definition: gr55xx_sys_sdk.h:122
sys_pmu_trim_get
uint16_t sys_pmu_trim_get(pmu_trim_info_t *p_pmu_trim)
Get the PMU trim information.
pmu_trim_info_t::io_ldo_bypass
uint8_t io_ldo_bypass
Definition: gr55xx_sys_sdk.h:167
sys_device_uid_get
uint16_t sys_device_uid_get(uint8_t *p_device_uid)
Get the device UID information.
rf_trim_info_t::rssi_cali
int8_t rssi_cali
Definition: gr55xx_sys_sdk.h:153
sys_swd_disable
void sys_swd_disable(void)
Diable swd function.
comp_trim_t::slope_int_no1
uint16_t slope_int_no1
Definition: gr55xx_sys_sdk.h:160
sys_adc_trim_get
uint16_t sys_adc_trim_get(adc_trim_info_t *p_adc_trim)
Get the ADC trim information.
sys_flash_timing_get
uint16_t sys_flash_timing_get(exflash_timing_param_t *p_flash_timing)
Get the Flash timing information.
sys_sdk_verison_get
void sys_sdk_verison_get(sdk_version_t *p_version)
Get SDK version.
sys_device_lp_gain_offset_2m_get
uint16_t sys_device_lp_gain_offset_2m_get(uint8_t *p_offset)
Get the LP gain offset 2M information.
sys_trim_sum_get
uint16_t sys_trim_sum_get(uint16_t *p_trim_sum)
Get the trim checksum.
sys_device_sram_get
uint16_t sys_device_sram_get(sram_size_t *p_sram_size)
Get the RAM size information.
boot_timing_params_t::hf_osc_prep
uint16_t hf_osc_prep
Definition: gr55xx_sys_sdk.h:180
sys_assert_cb_t::assert_param_cb
assert_param_cb_t assert_param_cb
Definition: gr55xx_sys_sdk.h:146
comp_trim_t
Comparator trim information definition.
Definition: gr55xx_sys_sdk.h:159
sys_swd_enable
void sys_swd_enable(void)
Enable swd function.
sys_nonret_usage_ratio_get
uint8_t sys_nonret_usage_ratio_get(void)
Get system non retention heap usage ratio.
adc_trim_info_t
ADC trim parameter information definition.
Definition: gr55xx_hal_adc.h:98
rf_trim_info_t::tx_power
int8_t tx_power
Definition: gr55xx_sys_sdk.h:154
sdk_version_t::commit_id
uint32_t commit_id
Definition: gr55xx_sys_sdk.h:139
boot_timing_params_t::xo_prep
uint16_t xo_prep
Definition: gr55xx_sys_sdk.h:183
sdk_version_t::build
uint16_t build
Definition: gr55xx_sys_sdk.h:138
sys_lpclk_set
void sys_lpclk_set(uint32_t user_lpclk)
Set low power CLK frequency.
SYS_DEV_SRAM_256K
@ SYS_DEV_SRAM_256K
Definition: gr55xx_sys_sdk.h:115
sys_assert_cb_t
Assert callbacks.
Definition: gr55xx_sys_sdk.h:144
pmu_trim_info_t::dig_ldo_64m
uint8_t dig_ldo_64m
Definition: gr55xx_sys_sdk.h:169
sys_assert_cb_register
void sys_assert_cb_register(sys_assert_cb_t *p_assert_cb)
Register assert callbacks.
sys_reverse_hword
uint16_t sys_reverse_hword(uint16_t value)
Reverse byte order (16 bit). For example, 0x1234 becomes 0x3412.
sys_regs_save
void sys_regs_save(volatile uint32_t *p_address, uint32_t value)
Save system registers.
sys_ble_heartbeat_period_get
uint16_t sys_ble_heartbeat_period_get(uint32_t *p_period_hus)
Get BLE Sleep HeartBeat Period.
sys_comp_trim_get
uint16_t sys_comp_trim_get(comp_trim_t *p_comp_trim)
Get the copmparator trim information.
boot_timing_params_t::fast_ldo_prep
uint16_t fast_ldo_prep
Definition: gr55xx_sys_sdk.h:179
sys_malloc
void * sys_malloc(uint32_t size)
Memory allocation.
sys_security_enable_status_check
uint32_t sys_security_enable_status_check(void)
Check the chip's security level.
boot_timing_params_t::pll_prep
uint16_t pll_prep
Definition: gr55xx_sys_sdk.h:184
sys_lpper_get
uint32_t sys_lpper_get(void)
Get low power CLK period.
comp_trim_t::slope_int_no2
uint16_t slope_int_no2
Definition: gr55xx_sys_sdk.h:161
sys_us_2_lpcycles
uint32_t sys_us_2_lpcycles(uint32_t us)
Convert a duration in μs into a duration in lp cycles.
pmu_trim_info_t::dig_ldo_16m
uint8_t dig_ldo_16m
Definition: gr55xx_sys_sdk.h:170
sys_assert_cb_t::assert_err_cb
assert_err_cb_t assert_err_cb
Definition: gr55xx_sys_sdk.h:145
pmu_trim_info_t::dcdc_vout1p15
uint8_t dcdc_vout1p15
Definition: gr55xx_sys_sdk.h:171
delay_us
void delay_us(uint32_t us)
Delay the function execution.
boot_timing_params_t::dcdc_prep
uint16_t dcdc_prep
Definition: gr55xx_sys_sdk.h:181
sys_ke_sleep_check
bool sys_ke_sleep_check(void)
Get status of ke_event list.