gr533x_sys_sdk.h
Go to the documentation of this file.
1 /**
2  *******************************************************************************
3  *
4  * @file gr533x_sys.h
5  *
6  * @brief GR533X 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 __GR533X_SYS_SDK_H__
52 #define __GR533X_SYS_SDK_H__
53 
54 #include "gr533x_sys_cfg.h"
55 #include "gr533x_nvds.h"
56 #include "gr533x_pwr.h"
57 #include "gr5xx_fpb.h"
58 
59 #include <stdint.h>
60 #include <stdio.h>
61 #include <stdbool.h>
62 #include <stdarg.h>
63 
64 /** @addtogroup GR533X_SYS_DEFINES Defines
65  * @{
66  */
67 #define SYS_BOOT_SETTING_PATTERN 0x474F4F44
68 #define SYS_BOOT_SETTING_RSV_MAGIC 0xFFFFFFFF
69 #define SYS_BOOT_SETTING_SWD_ENABLE 0xFF
70 #define SYS_BOOT_SETTING_SWD_DISABLE 0xA5
71 #define SYS_SCA_SETTING_ADDR 0x0027F000
72 #define SYS_INVALID_TIMER_ID 0xFF /**< Invalid system Timer ID. */
73 #define SYS_BD_ADDR_LEN BLE_GAP_ADDR_LEN /**< Length of Bluetoth Device Address. */
74 #define SYS_CHIP_UID_LEN 0x10 /**< Length of Bluetoth Chip UID. */
75 #define SYS_SET_BD_ADDR(BD_ADDR_ARRAY) nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY) /**< NVDS put BD address. */
76 #define SYS_ROM_VERSION_ADDR ((uint32_t)(0x200)) /**< The rom version address. */
77 /** @} */
78 
79 /**
80  * @defgroup GR533X_SYS_TYPEDEF Typedefs
81  * @{
82  */
83 /**@brief The function pointers to register event callback. */
84 typedef void (*callback_t)(int);
85 
86 /** @brief Timer callback type. */
87 typedef void (*timer_callback_t)(uint8_t timer_id);
88 
89 /**@brief Printf callback type. */
90 typedef int (*vprintf_callback_t) (const char *fmt, va_list argp);
91 
92 /**@brief raw log callback type. */
93 typedef uint16_t (*raw_log_send_cb_t) (uint8_t *p_data, uint16_t length);
94 
95 /**@brief Low power clock update function type. */
96 typedef void (*void_func_t)(void);
97 
98 /**@brief Low power clock update function type. */
99 typedef int32_t (*int_func_t)(void);
100 
101 /**@brief Function type for saving user context before deep sleep. */
102 typedef void (*sys_context_func_t)(void);
103 
104 /**@brief Error assert callback type. */
105 typedef void (*assert_err_cb_t)(const char *expr, const char *file, int line);
106 
107 /**@brief Parameter assert callback type. */
108 typedef void (*assert_param_cb_t)(int param0, int param1, const char *file, int line);
109 
110 /**@brief Warning assert callback type. */
111 typedef void (*assert_warn_cb_t)(int param0, int param1, const char *file, int line);
112 /** @} */
113 
114 /** @addtogroup GR533X_SYS_ENUMERATIONS Enumerations
115 * @{*/
116 /**@brief Definition of Device SRAM Size Enumerations. */
117 typedef enum
118 {
119  SYS_DEV_SRAM_48K = 0x03, /**< Supported 48K SRAM. */
120  SYS_DEV_SRAM_64K = 0x02, /**< Supported 64K SRAM. */
121  SYS_DEV_SRAM_80K = 0x01, /**< Supported 80K SRAM. */
122  SYS_DEV_SRAM_96K = 0x00, /**< Supported 96K SRAM. */
123 } sram_size_t;
124 
125 /**@brief package type. */
126 typedef enum
127 {
128  PACKAGE_NONE = 0, /**< Package unused. */
129  PACKAGE_QFN48 = 0x0100, /**< QFN48 package. */
130  PACKAGE_QFN32 = 0x0200, /**< QFN32 package. */
132 
133 /**@brief package type. */
134 typedef enum
135 {
136  HW_VERSION_B2 = 0x4232, /**< hw version B2. */
137  HW_VERSION_B3 = 0x4233, /**< hw version B3. */
139 
140 /** @} */
141 
142 /** @addtogroup GR533X_SYS_STRUCTURES Structures
143  * @{ */
144 /**@brief SDK version definition. */
145 typedef struct
146 {
147  uint8_t major; /**< Major version. */
148  uint8_t minor; /**< Minor version. */
149  uint16_t build; /**< Build number. */
150  uint32_t commit_id; /**< commit ID. */
152 
153 /**@brief Assert callbacks.*/
154 typedef struct
155 {
156  assert_err_cb_t assert_err_cb; /**< Assert error type callback. */
157  assert_param_cb_t assert_param_cb; /**< Assert parameter error type callback. */
158  assert_warn_cb_t assert_warn_cb; /**< Assert warning type callback. */
160 
161 /**@brief RF trim parameter information definition. */
162 typedef struct
163 {
164  int8_t rssi_cali; /**< RSSI calibration. */
165  int8_t tx_power; /**< TX power. */
167 
168 /**@brief ADC trim parameter information definition. */
169 typedef struct
170 {
171  uint16_t adc_temp; /**< ADC TEMP. */
172  uint16_t adc_temp_ref; /**< ADC Reference temperature*/
173  uint16_t slope_int_0p8; /**< Internal reference 0.8v. */
174  uint16_t offset_int_0p8; /**< Internal reference 0.8v. */
175  uint16_t slope_int_1p2; /**< Internal reference 1.2v. */
176  uint16_t offset_int_1p2; /**< Internal reference 1.2v. */
177  uint16_t slope_int_1p6; /**< Internal reference 1.6v. */
178  uint16_t offset_int_1p6; /**< Internal reference 1.6v. */
179  uint16_t slope_int_2p0; /**< Internal reference 2.0v. */
180  uint16_t offset_int_2p0; /**< Internal reference 2.0v. */
181  uint16_t slope_ext_1p0; /**< External reference 1.0v. */
182  uint16_t offset_ext_1p0; /**< External reference 1.0v. */
184 
185 
186 
187 /**@brief PMU trim parameter information definition. */
188 typedef struct
189 {
190  uint8_t io_ldo_vout; /**< IO LDO Vout, trim step is about 13mV. */
191  uint8_t dig_ldo_1p05_coarse; /**< DIG LDO 64m Coarse Code, trim step is about 100mV. */
192  uint8_t dig_ldo_1p05_fine; /**< DIG LDO 64m Fine Code, trim step is about 30mV. */
193  uint8_t dig_ldo_0p9_coarse; /**< DIG LDO 16m Coarse Code, trim step is about 100mV. */
194  uint8_t dig_ldo_0p9_fine; /**< DIG LDO 16m Fine Code, trim step is about 30mV. */
195  uint8_t dcdc_vout1p15; /**< DCDC 64m Vout, trim step is about 25mV. */
196  uint8_t dcdc_vout1p05; /**< DCDC 16m Vout, trim step is about 25mV. */
197  uint8_t sys_ldo_1p15; /**< SYSLDO 64m Vout, Trim step is about 30mV. */
198  uint8_t sys_ldo_1p05; /**< SYSLDO 16m Vout, Trim step is about 30mV. */
200 
201 /**@brief Warm boot timing parameters(unit: us). */
202 typedef struct
203 {
204  uint16_t fast_ldo_prep; /**< Fast ldo prep. */
205  uint16_t hf_osc_prep; /**< HF Osc prep. */
206  uint16_t dcdc_prep; /**< DCDC prep. */
207  uint16_t dig_ldo_prep; /**< Dig ldo prep. */
208  uint16_t xo_prep; /**< XO prep. */
209  uint16_t pll_prep; /**< PLL prep. */
210  uint16_t pll_lock; /**< PLL lock. */
211  uint16_t pwr_sw_prep; /**< PWR sw prep. */
213 
214 typedef struct __attribute((packed))
215 {
216  uint32_t pattern;
217  uint32_t load_addr;
218  uint32_t run_addr;
219  uint32_t bin_size;
220  uint32_t fw_check_sum;
221  uint8_t check_image;
222  uint8_t boot_delay;
223  uint8_t swd_control;
224  uint8_t check_sec;
225  uint8_t pad_size;
226  uint8_t comments[20];
227  uint8_t reserved[15];
228  uint32_t setting_check_sum;
230 
231 /** @} */
232 
233 /** @addtogroup GR533X_SYS_FUNCTIONS Functions
234  * @{ */
235 /**
236  *****************************************************************************************
237  * @brief Malloc size memery.
238  *
239  * @param[in] size: memery size.
240  *****************************************************************************************
241  */
242 void *sys_malloc(uint32_t size);
243 
244 /**
245  *****************************************************************************************
246  * @brief free memery.
247  *
248  * @param[in] mem_ptr: memery to be free.
249  *****************************************************************************************
250  */
251 void sys_free(void *mem_ptr);
252 
253 
254 /**
255  *****************************************************************************************
256  * @brief Output debug logs.
257  *
258  * @param[in] format: Pointer to the log information.
259  *****************************************************************************************
260  */
261 void sys_app_printf(const char *format, ...);
262 
263 /**
264  *****************************************************************************************
265  * @brief Delay the function execution.
266  *
267  * @param[in] us: Microsecond.
268  *****************************************************************************************
269  */
270 void delay_us(uint32_t us);
271 
272 /**
273  *****************************************************************************************
274  * @brief Delay the function execution.
275  *
276  * @param[in] ms: Millisecond.
277  *****************************************************************************************
278  */
279 void delay_ms(uint32_t ms);
280 
281 /**
282  *****************************************************************************************
283  * @brief Register signal handler.
284  *
285  * @note This function is mainly used to register the upper-layer APP callback functions to the protocol layer,
286  * which will be invoked when there are event responses in the protocol layer.
287  *****************************************************************************************
288  */
290 
291 /**
292  *****************************************************************************************
293  * @brief Get SDK version.
294  *
295  * @note This function is mainly used to get the version of SDK.
296  *
297  * @param[out] p_version: The pointer to struct of @ref sdk_version_t.
298  *****************************************************************************************
299  */
301 
302 /**
303  *****************************************************************************************
304  * @brief Save system context.
305  *
306  * @note This function is used to save system context before the system goes to deep sleep.
307  * Boot codes will be used to restore system context in the wakeup procedure.
308  *****************************************************************************************
309  */
310 void sys_context_save(void);
311 
312 /**
313  *****************************************************************************************
314  * @brief Load system context.
315  *
316  * @note This function is used to load system context after the system goes to deep sleep.
317  *****************************************************************************************
318  */
320 
321 /**
322  *****************************************************************************************
323  * @brief Encrypt and decrypt data using Present.
324  *
325  * @note This function is only used to encrypt and decrypt data that needs to be stored in Flash.
326  *
327  * @param[in] addr: Operation address (Flash address minus Flash start address).
328  * @param[in] input: Data before encryption and decryption.
329  * @param[in] size: Data size.
330  * @param[out] output: Data after encryption and decryption.
331  *****************************************************************************************
332  */
333 void sys_security_data_use_present(uint32_t addr, uint8_t *input, uint32_t size, uint8_t *output);
334 
335 /**
336  *****************************************************************************************
337  * @brief Get the RF trim information.
338  *
339  * @param[out] p_rf_trim: The pointer to struct of @ref rf_trim_info_t.
340  *
341  * @return Result of get.
342  *****************************************************************************************
343  */
344 uint16_t sys_rf_trim_get(rf_trim_info_t *p_rf_trim);
345 
346 /**
347  *****************************************************************************************
348  * @brief Get the ADC trim information.
349  *
350  * @param[out] p_adc_trim: The pointer to struct of @ref adc_trim_info_t.
351  *
352  * @return Result of get.
353  *****************************************************************************************
354  */
355 uint16_t sys_adc_trim_get(adc_trim_info_t *p_adc_trim);
356 
357 /**
358  *****************************************************************************************
359  * @brief Get the PMU trim information.
360  *
361  * @param[out] p_pmu_trim: The pointer to struct of @ref pmu_trim_info_t.
362  *
363  * @return Result of get.
364  *****************************************************************************************
365  */
366 uint16_t sys_pmu_trim_get(pmu_trim_info_t *p_pmu_trim);
367 
368 /**
369  *****************************************************************************************
370  * @brief Get the crystal trim information.
371  *
372  * @param[out] p_crystal_trim: offset information for crystal.
373  *
374  * @return Result of get.
375  *****************************************************************************************
376  */
377 uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim);
378 
379 /**
380  *****************************************************************************************
381  * @brief Get the trim checksum.
382  *
383  * @param[out] p_trim_sum: The pointer to the buffer for trim checksum.
384  *
385  * @return Result of get.
386  *****************************************************************************************
387  */
388 uint16_t sys_trim_sum_get(uint16_t *p_trim_sum);
389 
390 /**
391  *****************************************************************************************
392  * @brief Get the device address information.
393  *
394  * @param[out] p_device_addr: Bluetooth address by default.
395  *
396  * @return Result of get.
397  *****************************************************************************************
398  */
399 uint16_t sys_device_addr_get(uint8_t *p_device_addr);
400 
401 /**
402  *****************************************************************************************
403  * @brief Get the HW version information.
404  *
405  * @param[out] p_hw_version: The pointer to the buffer for hw version.
406  *
407  * @return Result of get.
408  *****************************************************************************************
409  */
410 uint16_t sys_hw_version_get(hw_version_type_t *p_hw_version);
411 
412 /**
413  *****************************************************************************************
414  * @brief Get the device UID information.
415  *
416  * @param[out] p_device_uid: Device chip UID.
417  *
418  * @return Result of get.
419  *****************************************************************************************
420  */
421 uint16_t sys_device_uid_get(uint8_t *p_device_uid);
422 
423 /**
424  *****************************************************************************************
425  * @brief Get the LP gain offset 2M information.
426  *
427  * @param[out] p_offset: the offset of LP gain.
428  *
429  * @return Result of get.
430  *****************************************************************************************
431  */
432 uint16_t sys_device_lp_gain_offset_2m_get(uint8_t *p_offset);
433 
434 /**
435  *****************************************************************************************
436  * @brief Get the RAM size information.
437  *
438  * @param[out] p_sram_size: The pointer to enumeration of @ref sram_size_t.
439  *
440  * @return Result of get.
441  *****************************************************************************************
442  */
443 uint16_t sys_device_sram_get(sram_size_t *p_sram_size);
444 
445 /**
446  *****************************************************************************************
447  * @brief Get the chip's package type.
448  *
449  * @param[out] p_package_type: The pointer to enumeration of @ref package_type_t.
450  *
451  * @return Result of get.
452  *****************************************************************************************
453  */
454 uint16_t sys_device_package_get(package_type_t *p_package_type);
455 
456 /**
457  *****************************************************************************************
458  * @brief Set low power CLK frequency.
459  *
460  * @param[in] user_lpclk: CLK frequency.
461  *****************************************************************************************
462  */
463 void sys_lpclk_set(uint32_t user_lpclk);
464 
465 /**
466  ****************************************************************************************
467  * @brief Convert a duration in μs into a duration in lp cycles.
468  *
469  * The function converts a duration in μs into a duration in lp cycles, according to the
470  * low power clock frequency (32768Hz or 32000Hz).
471  *
472  * @param[in] us: Duration in μs.
473  *
474  * @return Duration in lpcycles.
475  ****************************************************************************************
476  */
477 uint32_t sys_us_2_lpcycles(uint32_t us);
478 
479 /**
480  ****************************************************************************************
481  * @brief Convert a duration in lp cycles into a duration in half μs.
482  *
483  * The function converts a duration in lp cycles into a duration in half μs, according to the
484  * low power clock frequency (32768Hz or 32000Hz).
485  * @param[in] lpcycles: Duration in lp cycles.
486  * @param[in,out] error_corr: Insert and retrieve error created by truncating the LP Cycle Time to a half μs (in half μs).
487  *
488  * @return Duration in half μs
489  ****************************************************************************************
490  */
491 uint32_t sys_lpcycles_2_hus(uint32_t lpcycles, uint32_t *error_corr);
492 
493 /**
494  *****************************************************************************************
495  * @brief Set BLE Sleep HeartBeat Period.
496  * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
497  *
498  * @param[in] period_hus: The wake up duration of BLE when BLE is IDEL.
499  * Range 0x00000000-0xFFFFFFFF (in unit of μs).
500  *
501  * @return Result of set.
502  *****************************************************************************************
503  */
504 uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus);
505 
506 
507 /**
508  *****************************************************************************************
509  * @brief Get BLE Sleep HeartBeat Period.
510  * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
511  *
512  * @param[in] p_period_hus: Pointer to the wake up duration.
513  * Range 0x00000000-0xFFFFFFFF (in unit of μs).
514  *
515  * @return Result of get.
516  *****************************************************************************************
517  */
518 uint16_t sys_ble_heartbeat_period_get(uint32_t* p_period_hus);
519 
520 /**
521  ****************************************************************************************
522  * @brief Set system maximum usage ratio of message heap.
523  *
524  * The function will used to set message ratio of message heap.
525  * Valid ratio range is 50 - 100 percent in full message size.
526  *
527  * @param[in] usage_ratio: Usage ratio of message heap size.
528  ****************************************************************************************
529  */
530 void sys_max_msg_usage_ratio_set(uint8_t usage_ratio);
531 
532 /**
533  ****************************************************************************************
534  * @brief Set system lld layer maximum usage ratio of message heap.
535  *
536  * The function will used to set message ratio of message heap.
537  * Valid ratio range is 50 - 100 percent in full message size.
538  *
539  * @param[in] usage_ratio: Usage ratio of message heap size.
540  ****************************************************************************************
541  */
542 void sys_lld_max_msg_usage_ratio_set(uint8_t usage_ratio);
543 
544 /**
545  ****************************************************************************************
546  * @brief Get system message heap usage ratio.
547  *
548  * The function will used to get message ratio of message heap.
549  * This ratio is heap used percent in full message size.
550  *
551  * @return current heap used percent.
552  ****************************************************************************************
553  */
555 
556 /**
557  ****************************************************************************************
558  * @brief Get system environment heap usage ratio.
559  *
560  * The function will used to get environment ratio of environment heap.
561  * This ratio is heap used percent in full environment size.
562  *
563  * @return current heap used percent.
564  ****************************************************************************************
565  */
567 
568 /**
569  ****************************************************************************************
570  * @brief Get system attriute database heap usage ratio.
571  *
572  * The function will used to get attriute database ratio of attriute database heap.
573  * This ratio is heap used percent in full attriute database size.
574  *
575  * @return current heap used percent.
576  ****************************************************************************************
577  */
579 
580 /**
581  ****************************************************************************************
582  * @brief Get system non retention heap usage ratio.
583  *
584  * The function will used to get non retention ratio of non retention heap.
585  * This ratio is heap used percent in full non retention size.
586  *
587  * @return current heap used percent.
588  ****************************************************************************************
589  */
591 
592 /**
593  ****************************************************************************************
594  * @brief Get low power CLK frequency.
595  *
596  * This function is used to get the low power clock frequency.
597  *
598  * @return Low power CLK frequency.
599  ****************************************************************************************
600  */
601 uint32_t sys_lpclk_get(void);
602 
603 /**
604  ****************************************************************************************
605  * @brief Get low power CLK period.
606  *
607  * This function is used to get the low power CLK period.
608  *
609  * @return Low power CLK period.
610  ****************************************************************************************
611  */
612 uint32_t sys_lpper_get(void);
613 
614 /**
615  *****************************************************************************************
616  * @brief Register assert callbacks.
617  *
618  * @param[in] p_assert_cb: Pointer to assert callbacks.
619  *****************************************************************************************
620  */
622 
623 /**
624  ****************************************************************************************
625  * @brief Get status of ke_event list
626  *
627  * @return true: ke_event not busy, false : ke_event busy.
628  ****************************************************************************************
629  */
631 
632 /**
633  ****************************************************************************************
634  * @brief Enable swd function
635  ****************************************************************************************
636  */
637 void sys_swd_enable(void);
638 
639 /**
640  ****************************************************************************************
641  * @brief Diable swd function
642  ****************************************************************************************
643  */
644 void sys_swd_disable(void);
645 
646 /**
647  ****************************************************************************************
648  * @brief Set g_io_ldo_use_3p3_v function
649  ****************************************************************************************
650  */
651 void set_io_ldo_use_3p3_v(bool flag);
652 
653 /**
654  ****************************************************************************************
655  * @brief Set ble exchange memory base address
656  * @param[in] address: base address of ble exchange memory buffer.
657  ****************************************************************************************
658  */
659 void ble_stack_em_base_init(uint32_t address);
660 
661 /**
662  ****************************************************************************************
663  * @brief Set ble exchange memory buffer address common offset
664  * @param[in] offset: Offset of ble exchange memory buffer.
665  ****************************************************************************************
666  */
667 void ble_em_addr_offset_set(uint16_t offset);
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 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 jump to app firmware.
686  *
687  * @param[in] fw_addr: Firmware run address
688  * @param[in] fw_bin_size: Firmware bin size
689  *****************************************************************************************
690  */
691 void sys_firmware_jump(uint32_t fw_addr, uint32_t fw_bin_size);
692 
693 /** @} */
694 #endif
695 
696 /** @} */
697 /** @} */
boot_timing_params_t::pwr_sw_prep
uint16_t pwr_sw_prep
Definition: gr533x_sys_sdk.h:211
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_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.
pmu_trim_info_t::sys_ldo_1p05
uint8_t sys_ldo_1p05
Definition: gr533x_sys_sdk.h:198
adc_trim_info_t::offset_int_1p2
uint16_t offset_int_1p2
Definition: gr533x_sys_sdk.h:176
pmu_trim_info_t::io_ldo_vout
uint8_t io_ldo_vout
Definition: gr533x_sys_sdk.h:190
sdk_version_t::major
uint8_t major
Definition: gr533x_sys_sdk.h:147
adc_trim_info_t::offset_int_2p0
uint16_t offset_int_2p0
Definition: gr533x_sys_sdk.h:180
adc_trim_info_t::slope_int_1p6
uint16_t slope_int_1p6
Definition: gr533x_sys_sdk.h:177
gr533x_pwr.h
GR533X Platform Power Manager Module API.
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.
sys_device_addr_get
uint16_t sys_device_addr_get(uint8_t *p_device_addr)
Get the device address information.
restore_sys_context
void restore_sys_context(void)
Load system context.
PACKAGE_NONE
@ PACKAGE_NONE
Definition: gr533x_sys_sdk.h:128
sys_app_printf
void sys_app_printf(const char *format,...)
Output debug logs.
sys_device_package_get
uint16_t sys_device_package_get(package_type_t *p_package_type)
Get the chip's package type.
rf_trim_info_t
RF trim parameter information definition.
Definition: gr533x_sys_sdk.h:163
sys_hw_version_get
uint16_t sys_hw_version_get(hw_version_type_t *p_hw_version)
Get the HW version information.
hw_version_type_t
hw_version_type_t
package type.
Definition: gr533x_sys_sdk.h:135
gr533x_sys_cfg.h
Define the chip configuration.
sdk_version_t::minor
uint8_t minor
Definition: gr533x_sys_sdk.h:148
sys_ble_heartbeat_period_set
uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus)
Set BLE Sleep HeartBeat Period.
sys_pmu_trim_get
uint16_t sys_pmu_trim_get(pmu_trim_info_t *p_pmu_trim)
Get the PMU trim information.
sys_nonret_usage_ratio_get
uint8_t sys_nonret_usage_ratio_get(void)
Get system non retention heap usage ratio.
adc_trim_info_t::offset_int_0p8
uint16_t offset_int_0p8
Definition: gr533x_sys_sdk.h:174
__attribute
struct __attribute((packed))
Definition: gr533x_sys_sdk.h:214
assert_err_cb_t
void(* assert_err_cb_t)(const char *expr, const char *file, int line)
Error assert callback type.
Definition: gr533x_sys_sdk.h:105
timer_callback_t
void(* timer_callback_t)(uint8_t timer_id)
Timer callback type.
Definition: gr533x_sys_sdk.h:87
adc_trim_info_t::slope_ext_1p0
uint16_t slope_ext_1p0
Definition: gr533x_sys_sdk.h:181
sys_trim_sum_get
uint16_t sys_trim_sum_get(uint16_t *p_trim_sum)
Get the trim checksum.
sys_lpper_get
uint32_t sys_lpper_get(void)
Get low power CLK period.
sys_device_uid_get
uint16_t sys_device_uid_get(uint8_t *p_device_uid)
Get the device UID information.
package_type_t
package_type_t
package type.
Definition: gr533x_sys_sdk.h:127
raw_log_send_cb_t
uint16_t(* raw_log_send_cb_t)(uint8_t *p_data, uint16_t length)
raw log callback type.
Definition: gr533x_sys_sdk.h:93
SYS_DEV_SRAM_48K
@ SYS_DEV_SRAM_48K
Definition: gr533x_sys_sdk.h:119
boot_timing_params_t
Warm boot timing parameters(unit: us).
Definition: gr533x_sys_sdk.h:203
sys_msg_usage_ratio_get
uint8_t sys_msg_usage_ratio_get(void)
Get system message heap usage ratio.
adc_trim_info_t::slope_int_0p8
uint16_t slope_int_0p8
Definition: gr533x_sys_sdk.h:173
boot_timing_params_t::dig_ldo_prep
uint16_t dig_ldo_prep
Definition: gr533x_sys_sdk.h:207
sys_assert_cb_t::assert_warn_cb
assert_warn_cb_t assert_warn_cb
Definition: gr533x_sys_sdk.h:158
sys_env_usage_ratio_get
uint8_t sys_env_usage_ratio_get(void)
Get system environment heap usage ratio.
SYS_DEV_SRAM_64K
@ SYS_DEV_SRAM_64K
Definition: gr533x_sys_sdk.h:120
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
PMU trim parameter information definition.
Definition: gr533x_sys_sdk.h:189
sdk_version_t
SDK version definition.
Definition: gr533x_sys_sdk.h:146
sys_device_sram_get
uint16_t sys_device_sram_get(sram_size_t *p_sram_size)
Get the RAM size information.
PACKAGE_QFN48
@ PACKAGE_QFN48
Definition: gr533x_sys_sdk.h:129
assert_param_cb_t
void(* assert_param_cb_t)(int param0, int param1, const char *file, int line)
Parameter assert callback type.
Definition: gr533x_sys_sdk.h:108
SYS_DEV_SRAM_96K
@ SYS_DEV_SRAM_96K
Definition: gr533x_sys_sdk.h:122
boot_timing_params_t::pll_lock
uint16_t pll_lock
Definition: gr533x_sys_sdk.h:210
SYS_DEV_SRAM_80K
@ SYS_DEV_SRAM_80K
Definition: gr533x_sys_sdk.h:121
pmu_trim_info_t::sys_ldo_1p15
uint8_t sys_ldo_1p15
Definition: gr533x_sys_sdk.h:197
sys_signal_handler_register
void sys_signal_handler_register(callback_t isr_handler)
Register signal handler.
adc_trim_info_t::slope_int_2p0
uint16_t slope_int_2p0
Definition: gr533x_sys_sdk.h:179
sys_swd_disable
void sys_swd_disable(void)
Diable swd function.
set_io_ldo_use_3p3_v
void set_io_ldo_use_3p3_v(bool flag)
Set g_io_ldo_use_3p3_v function.
sys_adc_trim_get
uint16_t sys_adc_trim_get(adc_trim_info_t *p_adc_trim)
Get the ADC trim information.
delay_us
void delay_us(uint32_t us)
Delay the function execution.
sys_firmware_jump
void sys_firmware_jump(uint32_t fw_addr, uint32_t fw_bin_size)
jump to app firmware.
sys_context_func_t
void(* sys_context_func_t)(void)
Function type for saving user context before deep sleep.
Definition: gr533x_sys_sdk.h:102
sys_sdk_verison_get
void sys_sdk_verison_get(sdk_version_t *p_version)
Get SDK version.
HW_VERSION_B2
@ HW_VERSION_B2
Definition: gr533x_sys_sdk.h:136
sram_size_t
sram_size_t
Definition of Device SRAM Size Enumerations.
Definition: gr533x_sys_sdk.h:118
adc_trim_info_t::adc_temp
uint16_t adc_temp
Definition: gr533x_sys_sdk.h:171
pmu_trim_info_t::dcdc_vout1p05
uint8_t dcdc_vout1p05
Definition: gr533x_sys_sdk.h:196
sys_free
void sys_free(void *mem_ptr)
free memery.
pmu_trim_info_t::dig_ldo_1p05_coarse
uint8_t dig_ldo_1p05_coarse
Definition: gr533x_sys_sdk.h:191
rf_trim_info_t::rssi_cali
int8_t rssi_cali
Definition: gr533x_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.
sys_swd_enable
void sys_swd_enable(void)
Enable swd function.
sys_context_save
void sys_context_save(void)
Save system context.
delay_ms
void delay_ms(uint32_t ms)
Delay the function execution.
sys_lpclk_set
void sys_lpclk_set(uint32_t user_lpclk)
Set low power CLK frequency.
int_func_t
int32_t(* int_func_t)(void)
Low power clock update function type.
Definition: gr533x_sys_sdk.h:99
sys_lpclk_get
uint32_t sys_lpclk_get(void)
Get low power CLK frequency.
pmu_trim_info_t::dig_ldo_1p05_fine
uint8_t dig_ldo_1p05_fine
Definition: gr533x_sys_sdk.h:192
PACKAGE_QFN32
@ PACKAGE_QFN32
Definition: gr533x_sys_sdk.h:130
adc_trim_info_t::offset_ext_1p0
uint16_t offset_ext_1p0
Definition: gr533x_sys_sdk.h:182
vprintf_callback_t
int(* vprintf_callback_t)(const char *fmt, va_list argp)
Printf callback type.
Definition: gr533x_sys_sdk.h:90
HW_VERSION_B3
@ HW_VERSION_B3
Definition: gr533x_sys_sdk.h:137
sys_assert_cb_register
void sys_assert_cb_register(sys_assert_cb_t *p_assert_cb)
Register assert callbacks.
sys_boot_setting_t
sys_boot_setting_t
Definition: gr533x_sys_sdk.h:229
boot_timing_params_t::hf_osc_prep
uint16_t hf_osc_prep
Definition: gr533x_sys_sdk.h:205
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.
sys_ke_sleep_check
bool sys_ke_sleep_check(void)
Get status of ke_event list.
sys_assert_cb_t::assert_param_cb
assert_param_cb_t assert_param_cb
Definition: gr533x_sys_sdk.h:157
void_func_t
void(* void_func_t)(void)
Low power clock update function type.
Definition: gr533x_sys_sdk.h:96
assert_warn_cb_t
void(* assert_warn_cb_t)(int param0, int param1, const char *file, int line)
Warning assert callback type.
Definition: gr533x_sys_sdk.h:111
adc_trim_info_t
ADC trim parameter information definition.
Definition: gr533x_sys_sdk.h:170
rf_trim_info_t::tx_power
int8_t tx_power
Definition: gr533x_sys_sdk.h:165
sdk_version_t::commit_id
uint32_t commit_id
Definition: gr533x_sys_sdk.h:150
pmu_trim_info_t::dig_ldo_0p9_fine
uint8_t dig_ldo_0p9_fine
Definition: gr533x_sys_sdk.h:194
boot_timing_params_t::xo_prep
uint16_t xo_prep
Definition: gr533x_sys_sdk.h:208
ble_em_addr_offset_set
void ble_em_addr_offset_set(uint16_t offset)
Set ble exchange memory buffer address common offset.
sdk_version_t::build
uint16_t build
Definition: gr533x_sys_sdk.h:149
adc_trim_info_t::slope_int_1p2
uint16_t slope_int_1p2
Definition: gr533x_sys_sdk.h:175
ble_stack_em_base_init
void ble_stack_em_base_init(uint32_t address)
Set ble exchange memory base address.
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.
pmu_trim_info_t::dig_ldo_0p9_coarse
uint8_t dig_ldo_0p9_coarse
Definition: gr533x_sys_sdk.h:193
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.
adc_trim_info_t::adc_temp_ref
uint16_t adc_temp_ref
Definition: gr533x_sys_sdk.h:172
sys_assert_cb_t
Assert callbacks.
Definition: gr533x_sys_sdk.h:155
sys_malloc
void * sys_malloc(uint32_t size)
Malloc size memery.
boot_timing_params_t::fast_ldo_prep
uint16_t fast_ldo_prep
Definition: gr533x_sys_sdk.h:204
boot_timing_params_t::pll_prep
uint16_t pll_prep
Definition: gr533x_sys_sdk.h:209
callback_t
void(* callback_t)(int)
The function pointers to register event callback.
Definition: gr533x_sys_sdk.h:84
sys_crystal_trim_get
uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim)
Get the crystal trim information.
gr533x_nvds.h
NVDS API.
sys_attdb_usage_ratio_get
uint8_t sys_attdb_usage_ratio_get(void)
Get system attriute database heap usage ratio.
adc_trim_info_t::offset_int_1p6
uint16_t offset_int_1p6
Definition: gr533x_sys_sdk.h:178
sys_assert_cb_t::assert_err_cb
assert_err_cb_t assert_err_cb
Definition: gr533x_sys_sdk.h:156
pmu_trim_info_t::dcdc_vout1p15
uint8_t dcdc_vout1p15
Definition: gr533x_sys_sdk.h:195
sys_ble_heartbeat_period_get
uint16_t sys_ble_heartbeat_period_get(uint32_t *p_period_hus)
Get BLE Sleep HeartBeat Period.
boot_timing_params_t::dcdc_prep
uint16_t dcdc_prep
Definition: gr533x_sys_sdk.h:206