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 #ifndef __GR55XX_SYS_H__
50 #define __GR55XX_SYS_H__
51
52 #include "gr55xx_sys_cfg.h"
53 #include "gr55xx_nvds.h"
54 #include "gr55xx_pwr.h"
55 #include "gr55xx_fpb.h"
56 #include "ble.h"
57
58 #include <stdint.h>
59 #include <stdio.h>
60 #include <stdbool.h>
61 #include <stdarg.h>
62
63 /** @addtogroup GR55XX_SYS_DEFINES Defines
64 * @{
65 */
66 #define SYS_INVALID_TIMER_ID 0xFF /**< Invalid system Timer ID. */
67 #define SYS_BD_ADDR_LEN GAP_ADDR_LEN /**< Length of Bluetoth Device Address. */
68 #define SYS_CHIP_UID_LEN 0x10 /**< Length of Bluetoth Chip UID. */
69
ble_sys_set_bd_addr(uint8_t * BD_ADDR_ARRAY)70 static inline uint8_t ble_sys_set_bd_addr(uint8_t *BD_ADDR_ARRAY)
71 {
72 return nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY);
73 }
74
75 #define SYS_SET_BD_ADDR(BD_ADDR_ARRAY) ble_sys_set_bd_addr(BD_ADDR_ARRAY) /**< NVDS put BD address. */
76 /** @} */
77
78 /**
79 * @defgroup GR55XX_SYS_TYPEDEF Typedefs
80 * @{
81 */
82 /** @brief The function pointers to register event callback. */
83 typedef void (*callback_t)(int);
84
85 /** @brief Timer callback type. */
86 typedef void (*timer_callback_t)(uint8_t timer_id);
87
88 /** @brief Printf callback type. */
89 typedef int (*vprintf_callback_t) (const char *fmt, va_list argp);
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 with resturn. */
95 typedef int (*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 */
113 /** @brief Definition of Device SRAM Size Enumerations. */
114 typedef enum {
115 SYS_DEV_SRAM_64K = 0x02, /**< Supported 64K SRAM. */
116 SYS_DEV_SRAM_128K = 0x01, /**< Supported 128K SRAM. */
117 SYS_DEV_SRAM_256K = 0x00, /**< Supported 256K SRAM. */
118 } sram_size_t;
119
120 /** @brief package type. */
121 typedef enum {
122 PACKAGE_NONE = 0, /**< Package unused. */
123 PACKAGE_GR5515RGBD = 1, /**< BGA68 package. */
124 PACKAGE_GR5515GGBD = 2, /**< BGA55 package. */
125 PACKAGE_GR5515IGND = 3, /**< QFN56 + 1024K flash package. */
126 PACKAGE_GR5515I0ND = 4, /**< QFN56 + no flash package, support external high voltage flash only */
127 PACKAGE_GR5513BEND = 5, /**< QFN40 + 128KB RAM + 512KB flash packet. */
128 PACKAGE_GR5515BEND = 6, /**< QFN40 + 256KB RAM + 512KB flash packet. */
129 PACKAGE_GR5513BENDU = 7, /**< QFN40 + 256KB RAM + 512KB flash packet @1.7V ~ 3.6V. */
130 PACKAGE_GR5515I0NDA = 8, /**< QFN56 + no flash package, support external high/low voltage flash */
131 } package_type_t;
132 /** @} */
133
134 /** @addtogroup GR55XX_SYS_STRUCTURES Structures
135 * @{
136 */
137 /** @brief SDK version definition. */
138 typedef struct {
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. */
143 } sdk_version_t;
144
145 /** @brief Assert callbacks.*/
146 typedef struct {
147 assert_err_cb_t assert_err_cb; /**< Assert error type callback. */
148 assert_param_cb_t assert_param_cb; /**< Assert parameter error type callback. */
149 assert_warn_cb_t assert_warn_cb; /**< Assert warning type callback. */
150 } sys_assert_cb_t;
151
152 /** @brief Link RX information definition. */
153 typedef struct {
154 uint32_t rx_total_cnt; /**< Counts of RX times. */
155 uint32_t rx_sync_err_cnt; /**< Counts of RX sync error times. */
156 uint32_t rx_crc_err_cnt; /**< Counts of RX crc error times. */
157 uint32_t rx_other_err_cnt; /**< Counts of RX other error times. */
158 uint32_t rx_sn_err_cnt; /**< Counts of sn CRC error times. */
159 uint32_t rx_mic_err_cnt; /**< Counts of mic CRC error times. */
160 uint32_t rx_normal_cnt; /**< Counts of RX normal times. */
161 } link_rx_info_t;
162
163 /** @brief RF trim parameter information definition. */
164 typedef struct {
165 int8_t rssi_cali; /**< RSSI calibration. */
166 int8_t tx_power; /**< TX power. */
167 } rf_trim_info_t;
168
169 /** @brief ADC trim parameter information definition. */
170 typedef struct {
171 uint16_t adc_temp; /** < ADC TEMP. */
172 uint16_t slope_int_0p8; /** < Internal reference 0.8v. */
173 uint16_t offset_int_0p8; /** < Internal reference 0.8v. */
174 uint16_t slope_int_1p2; /** < Internal reference 1.2v. */
175 uint16_t offset_int_1p2; /** < Internal reference 1.2v. */
176 uint16_t slope_int_1p6; /** < Internal reference 1.6v. */
177 uint16_t offset_int_1p6; /** < Internal reference 1.6v. */
178 uint16_t slope_int_2p0; /** < Internal reference 2.0v. */
179 uint16_t offset_int_2p0; /** < Internal reference 2.0v. */
180 uint16_t slope_ext_1p0; /** < External reference 1.0v. */
181 uint16_t offset_ext_1p0; /** < External reference 1.0v. */
182 } adc_trim_info_t;
183
184 /** @brief PMU trim parameter information definition. */
185 typedef struct {
186 uint8_t io_ldo_bypass; /** < IO LDO bypass */
187 uint8_t io_ldo_vout; /** < IO LDO Vout. */
188 uint8_t dig_ldo_64m; /** < DIG LDO 64m. */
189 uint8_t dig_ldo_16m; /** < DIG LDO 16m */
190 uint8_t dcdc_vout; /** < DCDC Vout */
191 } pmu_trim_info_t;
192
193 /** @} */
194
195 /** @addtogroup GR55XX_SYS_FUNCTIONS Functions
196 * @{
197 */
198 /**
199 *****************************************************************************************
200 * @brief Output debug logs.
201 *
202 * @param[in] format: Pointer to the log information.
203 *****************************************************************************************
204 */
205 void sys_app_printf(const char *format, ...);
206
207 /**
208 *****************************************************************************************
209 * @brief Delay the function execution.
210 *
211 * @param[in] us: Microsecond.
212 *****************************************************************************************
213 */
214 void sys_delay_us(uint32_t us);
215
216 /**
217 *****************************************************************************************
218 * @brief Delay the function execution.
219 *
220 * @param[in] ms: Millisecond.
221 *****************************************************************************************
222 */
223 void sys_delay_ms(uint32_t ms);
224
225 /**
226 *****************************************************************************************
227 * @brief Memory allocation.
228 *
229 * @param[in] size: Requested memory size.
230 *
231 * @return Valid memory location if successful, else null.
232 *****************************************************************************************
233 */
234 void *sys_malloc(uint32_t size);
235
236 /**
237 *****************************************************************************************
238 * @brief Free allocated memory.
239 *
240 * @param[in] p_mem: Pointer to memory block.
241 *****************************************************************************************
242 */
243 void sys_free(uint8_t *p_mem);
244
245 /**
246 *****************************************************************************************
247 * @brief Register signal handler.
248 *
249 * @note This function is mainly used to register the upper-layer APP callback functions to the protocol layer,
250 * which will be invoked when there are event responses in the protocol layer.
251 *
252 * @param[in] isr_handler: callback function which to be registered.
253 *****************************************************************************************
254 */
255 void sys_signal_handler_register(callback_t isr_handler);
256
257 /**
258 *****************************************************************************************
259 * @brief Get SDK version.
260 *
261 * @note This function is mainly used to get the version of SDK.
262 *
263 * @param[out] p_version: The pointer to struct of @ref sdk_version_t.
264 *****************************************************************************************
265 */
266 void sys_sdk_verison_get(sdk_version_t *p_version);
267
268 /**
269 *****************************************************************************************
270 * @brief Save system context.
271 *
272 * @note This function is used to save system context before the system goes to deep sleep.
273 * Boot codes will be used to restore system context in the wakeup procedure.
274 *****************************************************************************************
275 */
276 void sys_context_save(void);
277
278 /**
279 *****************************************************************************************
280 * @brief Load system context.
281 *
282 * @note This function is used to load system context after the system goes to deep sleep.
283 *****************************************************************************************
284 */
285 void restore_sys_context(void);
286
287 /**
288 *****************************************************************************************
289 * @brief Save system registers.
290 *
291 * @note This function is used to save system register before the system goes to deep sleep.
292 *
293 * @param[in] p_address: The pointer to register address.
294 * @param[in] value: The register value to be saved, it will be restored when system wakes up.
295 *****************************************************************************************
296 */
297 void sys_regs_save(volatile uint32_t *p_address, uint32_t value);
298
299 /**
300 *****************************************************************************************
301 * @brief Generate checksum info for system context.
302 *
303 * @note This function is used to generate checksum for system context, it will be called
304 * before deep sleep in power management module.
305 *****************************************************************************************
306 */
307 void sys_context_checksum_gen(void);
308
309 /**
310 *****************************************************************************************
311 * @brief Encrypt and decrypt data using Present.
312 *
313 * @note This function is only used to encrypt and decrypt data that needs to be stored in Flash.
314 *
315 * @param[in] addr: Operation address (Flash address minus Flash start address).
316 * @param[in] input: Data before encryption and decryption.
317 * @param[in] size: Data size.
318 * @param[out] output: Data after encryption and decryption.
319 *****************************************************************************************
320 */
321 void sys_security_data_use_present(uint32_t addr, uint8_t *input, uint32_t size, uint8_t *output);
322
323 /**
324 *****************************************************************************************
325 * @brief Check the chip's security level.
326 *
327 * @return 0: Security is not supported.
328 * 1: Security is supported.
329 *****************************************************************************************
330 */
331 uint32_t sys_security_enable_status_check(void);
332
333 /**
334 *****************************************************************************************
335 * @brief Get the RF trim information.
336 *
337 * @param[out] p_rf_trim: The pointer to struct of @ref rf_trim_info_t.
338 * @return 0: Operation is OK.
339 * 1: the chip's parameter is incorrect.
340 *****************************************************************************************
341 */
342 uint16_t sys_rf_trim_get(rf_trim_info_t *p_rf_trim);
343
344 /**
345 *****************************************************************************************
346 * @brief Get the ADC trim information.
347 *
348 * @param[out] p_adc_trim: The pointer to struct of @ref adc_trim_info_t.
349 * @return 0: Operation is OK.
350 * 1: the chip's parameter is incorrect.
351 *****************************************************************************************
352 */
353 uint16_t sys_adc_trim_get(adc_trim_info_t *p_adc_trim);
354
355 /**
356 *****************************************************************************************
357 * @brief Get the PMU trim information.
358 *
359 * @param[out] p_pmu_trim: The pointer to struct of @ref pmu_trim_info_t.
360 * @return 0: Operation is OK.
361 * 1: the chip's parameter is incorrect.
362 *****************************************************************************************
363 */
364 uint16_t sys_pmu_trim_get(pmu_trim_info_t *p_pmu_trim);
365
366 /**
367 *****************************************************************************************
368 * @brief Get the crystal trim information.
369 *
370 * @param[out] p_crystal_trim: offset information for crystal.
371 * @return 0: Operation is OK.
372 * 1: the chip's parameter is incorrect.
373 *****************************************************************************************
374 */
375 uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim);
376
377 /**
378 *****************************************************************************************
379 * @brief Jump to firmware and run.
380 *
381 * @param[in] fw_addr: Firmware run address.
382 *****************************************************************************************
383 */
384 void sys_firmware_jump(uint32_t fw_addr);
385
386 /**
387 *****************************************************************************************
388 * @brief Get the trim checksum.
389 *
390 * @param[out] p_trim_sum: The pointer to the buffer for trim checksum.
391 * @return 0: Operation is OK.
392 * 1: the chip's parameter is incorrect.
393 *****************************************************************************************
394 */
395 uint16_t sys_trim_sum_get(uint16_t *p_trim_sum);
396
397 /**
398 *****************************************************************************************
399 * @brief Get the device address information.
400 *
401 * @param[out] p_device_addr: Bluetooth address by default.
402 * @return 0: Operation is OK.
403 * 1: the chip's parameter is incorrect.
404 *****************************************************************************************
405 */
406 uint16_t sys_device_addr_get(uint8_t *p_device_addr);
407
408 /**
409 *****************************************************************************************
410 * @brief Get the device UID information.
411 *
412 * @param[out] p_device_uid: Device chip UID.
413 * @return 0: Operation is OK.
414 * 1: the chip's parameter is incorrect.
415 *****************************************************************************************
416 */
417 uint16_t sys_device_uid_get(uint8_t *p_device_uid);
418
419 /**
420 *****************************************************************************************
421 * @brief Get the LP gain offset 2M information.
422 *
423 * @param[out] p_offset: the offset of LP gain.
424 * @return 0: Operation is OK.
425 * 1: the chip's parameter is incorrect.
426 *****************************************************************************************
427 */
428 uint16_t sys_device_lp_gain_offset_2m_get(uint8_t *p_offset);
429
430 /**
431 *****************************************************************************************
432 * @brief Get the RAM size information.
433 *
434 * @param[out] p_sram_size: The pointer to enumeration of @ref sram_size_t.
435 * @return 0: Operation is OK.
436 * 1: the chip's parameter is incorrect.
437 *****************************************************************************************
438 */
439 uint16_t sys_device_sram_get(sram_size_t *p_sram_size);
440
441 /**
442 *****************************************************************************************
443 * @brief Get the chip's package type.
444 *
445 * @param[out] p_package_type: The pointer to enumeration of @ref package_type_t.
446 * @return 0: Operation is OK.
447 * 1: the chip's parameter is incorrect.
448 *****************************************************************************************
449 */
450 uint16_t sys_device_package_get(package_type_t *p_package_type);
451
452
453 #if defined(GR5515_D)
454
455 /**
456 *****************************************************************************************
457 * @brief Get the chip's IO LDO voltage.
458 *
459 * This function is an API interface for special users.
460 *
461 * @param[out] io_ldo: The IO LDO voltage.
462 * @return 0: Operation is OK.
463 * 1: the chip's parameter is incorrect.
464 *****************************************************************************************
465 */
466 uint16_t sys_get_efuse_io_ldo(uint16_t *io_ldo);
467
468 #endif
469
470 /**
471 *****************************************************************************************
472 * @brief Set low power CLK frequency.
473 *
474 * @param[in] user_lpclk: CLK frequency.
475 *****************************************************************************************
476 */
477 void sys_lpclk_set(uint32_t user_lpclk);
478
479 /**
480 ****************************************************************************************
481 * @brief Convert a duration in μs into a duration in lp cycles.
482 *
483 * The function converts a duration in μs into a duration in lp cycles, according to the
484 * low power clock frequency (32768Hz or 32000Hz).
485 *
486 * @param[in] us: Duration in μs.
487 *
488 * @return Duration in lpcycles.
489 ****************************************************************************************
490 */
491 uint32_t sys_us_2_lpcycles(uint32_t us);
492
493 /**
494 ****************************************************************************************
495 * @brief Convert a duration in lp cycles into a duration in half μs.
496 *
497 * The function converts a duration in lp cycles into a duration in half μs, according to the
498 * low power clock frequency (32768Hz or 32000Hz).
499 * @param[in] lpcycles: Duration in lp cycles.
500 * @param[in,out] error_corr: Insert and retrieve error created by truncating the LP Cycle
501 * Time to a half μs (in half μs).
502 *
503 * @return Duration in half μs
504 ****************************************************************************************
505 */
506 uint32_t sys_lpcycles_2_hus(uint32_t lpcycles, uint32_t *error_corr);
507
508 /**
509 *****************************************************************************************
510 * @brief Set BLE Sleep HeartBeat Period.
511 * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
512 *
513 * @param[in] period_hus: The wake up duration of BLE when BLE is IDEL.
514 * Range 0x00000000-0xFFFFFFFF (in unit of μs).
515 *
516 * @retval SDK_SUCCESS: Operation is Success.
517 *****************************************************************************************
518 */
519 uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus);
520
521 /**
522 *****************************************************************************************
523 * @brief Get BLE Sleep HeartBeat Period.
524 * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE.
525 *
526 * @param[in] p_period_hus: Pointer to the wake up duration.
527 * Range 0x00000000-0xFFFFFFFF (in unit of μs).
528 *
529 * @retval SDK_SUCCESS: Operation is Success.
530 *****************************************************************************************
531 */
532 uint16_t sys_ble_heartbeat_period_get(uint32_t* p_period_hus);
533
534 /**
535 ****************************************************************************************
536 * @brief Set system maximum usage ratio of message heap.
537 *
538 * The function will used to set message ratio of message heap.
539 * Valid ratio range is 50 - 100 percent in full message size.
540 *
541 * @param[in] usage_ratio: Usage ratio of message heap size.
542 *
543 ****************************************************************************************
544 */
545 void sys_max_msg_usage_ratio_set(uint8_t usage_ratio);
546
547 /**
548 ****************************************************************************************
549 * @brief Set system lld layer maximum usage ratio of message heap.
550 *
551 * The function will used to set message ratio of message heap.
552 * Valid ratio range is 50 - 100 percent in full message size.
553 *
554 * @param[in] usage_ratio: Usage ratio of message heap size.
555 *
556 ****************************************************************************************
557 */
558 void sys_lld_max_msg_usage_ratio_set(uint8_t usage_ratio);
559
560 /**
561 ****************************************************************************************
562 * @brief Get system message heap usage ratio.
563 *
564 * The function will used to get message ratio of message heap.
565 * This ratio is heap used percent in full message size.
566 *
567 * @return current heap used percent.
568 ****************************************************************************************
569 */
570 uint8_t sys_msg_usage_ratio_get(void);
571
572 /**
573 ****************************************************************************************
574 * @brief Get system environment heap usage ratio.
575 *
576 * The function will used to get environment ratio of environment heap.
577 * This ratio is heap used percent in full environment size.
578 *
579 * @return current heap used percent.
580 ****************************************************************************************
581 */
582 uint8_t sys_env_usage_ratio_get(void);
583
584 /**
585 ****************************************************************************************
586 * @brief Get system attriute database heap usage ratio.
587 *
588 * The function will used to get attriute database ratio of attriute database heap.
589 * This ratio is heap used percent in full attriute database size.
590 *
591 * @return current heap used percent.
592 ****************************************************************************************
593 */
594 uint8_t sys_attdb_usage_ratio_get(void);
595
596 /**
597 ****************************************************************************************
598 * @brief Get system non retention heap usage ratio.
599 *
600 * The function will used to get non retention ratio of non retention heap.
601 * This ratio is heap used percent in full non retention size.
602 *
603 * @return current heap used percent.
604 ****************************************************************************************
605 */
606 uint8_t sys_nonret_usage_ratio_get(void);
607
608 /**
609 ****************************************************************************************
610 * @brief Get link quality info
611 *
612 * @param[in] conn_idx: Connect index.
613 * @param[in,out] rx_info: RX detailed information.
614 *
615 * @return Current connect index link quality.
616 ****************************************************************************************
617 */
618 uint8_t sys_link_quality_get(uint8_t conn_idx, link_rx_info_t* rx_info);
619
620 /**
621 ****************************************************************************************
622 * @brief Clear link quality info.
623 *
624 * @param[in] conn_idx: Connect index.
625 ****************************************************************************************
626 */
627 void sys_link_quality_clear(uint8_t conn_idx);
628
629 /**
630 ****************************************************************************************
631 * @brief Register low power clock update function.
632 *
633 * @param[in] func_update_lpclk: function pointer to update_lpclk.
634 ****************************************************************************************
635 */
636 void sys_lpclk_update_func_register(void_func_t func_update_lpclk);
637
638 /**
639 ****************************************************************************************
640 * @brief Register low power clock update function with int return.
641 *
642 * @param[in] func_update_lpclk: function pointer to update_lpclk.
643 ****************************************************************************************
644 */
645 void sys_lpclk_update_func_with_return_register(int_func_t func_update_lpclk);
646
647 /**
648 ****************************************************************************************
649 * @brief Get low power CLK frequency.
650 *
651 * This function is used to get the low power clock frequency.
652 *
653 * @return Low power CLK frequency.
654 ****************************************************************************************
655 */
656 uint32_t sys_lpclk_get(void);
657
658 /**
659 ****************************************************************************************
660 * @brief Get low power CLK period.
661 *
662 * This function is used to get the low power CLK period.
663 *
664 * @return Low power CLK period.
665 ****************************************************************************************
666 */
667 uint32_t sys_lpper_get(void);
668
669 /**
670 *****************************************************************************************
671 * @brief Register assert callbacks.
672 *
673 * @param[in] p_assert_cb: Pointer to assert callbacks.
674 *****************************************************************************************
675 */
676 void sys_assert_cb_register(sys_assert_cb_t *p_assert_cb);
677
678 /**
679 ****************************************************************************************
680 * @brief Get status of ke_event list
681 * @return true: ke_event not busy, false : ke_event busy.
682 ****************************************************************************************
683 */
684 bool sys_ke_sleep_check(void);
685
686 /**
687 ****************************************************************************************
688 * @brief Enable swd function
689 ****************************************************************************************
690 */
691 void sys_swd_enable(void);
692
693 /**
694 ****************************************************************************************
695 * @brief Diable swd function
696 ****************************************************************************************
697 */
698 void sys_swd_disable(void);
699
700 /**
701 ****************************************************************************************
702 * @brief RTC calibration function.
703 * @retval : void
704 ****************************************************************************************
705 */
706 void rtc_calibration(void);
707
708 /**
709 ****************************************************************************************
710 * @brief RNG calibration function.
711 * @note The function will call between platform_init_push and platform_init_pop.
712 * @retval : void
713 ****************************************************************************************
714 */
715 void rng_calibration(void);
716
717 /**
718 ****************************************************************************************
719 * @brief Reverse byte order (32 bit). For example, 0x12345678 becomes 0x78563412.
720 * @retval : Reversed value
721 ****************************************************************************************
722 */
723 uint32_t sys_reverse_word(uint32_t value);
724
725 /**
726 ****************************************************************************************
727 * @brief Reverse byte order (16 bit). For example, 0x1234 becomes 0x3412.
728 * @retval : Reversed value
729 ****************************************************************************************
730 */
731 uint16_t sys_reverse_hword(uint16_t value);
732
733 /** @} */
734 #endif
735
736 /** @} */
737 /** @} */
738