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