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