WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
debug_print.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2020-2022. All rights reserved.
3 * Description: Basic DEBUG print
4 * Author:
5 * Create: 2020-11-6
6 */
7#ifndef LIB_COMMON_HEADERS_DEBUG_PRINT_H
8#define LIB_COMMON_HEADERS_DEBUG_PRINT_H
9
10#include "core.h"
11#if defined(SW_RTT_DEBUG)
12#include "SEGGER_RTT.h"
13#endif
14#if defined(MULTIPLEXING_UART) && defined(TEST_SUITE)
15#include "test_suite_log.h"
16#endif
17
18#ifndef NEWLINE
19#define NEWLINE "\r\n"
20#endif
21#define PRINT_BT(fmt, arg...)
22#define uapi_at_printf(fmt, arg...)
23#if defined(SW_UART_DEBUG) || defined(FACTORY_TEST)
24void sw_debug_uart_init(uint32_t baud_rate);
26void print_str(const char *str, ...);
27void print_exc(const char *str, ...);
28
29#define print_init()
30#if defined(BUILD_APPLICATION_ROM)
31#if CORE == MASTER_BY_ALL
32 #define PRINT(fmt, arg...) print_str("ROM|" fmt, ##arg)
33#elif CORE == SECURITY
34 #define PRINT(fmt, arg...) print_str("SEC ROM|" fmt, ##arg)
35#endif
36
37#elif defined(BUILD_APPLICATION_SSB)
38#if CORE == MASTER_BY_ALL
39 #define PRINT(fmt, arg...) print_str("SSB|" fmt, ##arg)
40#elif CORE == SECURITY
41 #define PRINT(fmt, arg...) print_str("SEC SSB|" fmt, ##arg)
42#endif
43
44#elif defined(MULTIPLEXING_UART) && defined(TEST_SUITE)
45 #define PRINT(fmt, arg...) test_suite_uart_sendf("TESTSUITE|" fmt, ##arg)
46#elif defined(BUILD_APPLICATION_STANDARD) || defined(TEST_SUITE) || defined(UNIT_TEST)
47#if CORE == BT
48 #define PRINT(fmt, arg...) print_str("BT|" fmt, ##arg)
49#elif CORE == APPS
50 #define PRINT(fmt, arg...) print_str("APP|" fmt, ##arg)
51#elif CORE == SECURITY
52 #define PRINT(fmt, arg...) print_str("SEC|" fmt, ##arg)
53#elif CORE == GNSS
54 #define PRINT(fmt, arg...) print_str("GNSS|" fmt, ##arg)
55#elif CORE == CONTROL_CORE
56 void test_suite_uart_sendf(const char *str, ...);
57 #define PRINT(fmt, arg...) test_suite_uart_sendf(fmt, ##arg)
58#else
59 #define PRINT(fmt, arg...)
60#endif
61
62#elif CORE == WIFI
63 #define PRINT(fmt, arg...) print_str("WIFI|" fmt, ##arg)
64#elif CORE == CONTROL_CORE
65 #define PRINT(fmt, arg...) print_str("CCORE|" fmt, ##arg)
66#else
67 #define PRINT(fmt, arg...)
68#endif
69
70#elif BOOT_ROM_DFR_PRINT == YES
71void sw_debug_uart_init(uint32_t baud_rate);
72void print_str(const char *str, ...);
73#define PRINT(fmt, arg...) print_str("ROM|" fmt, ##arg)
74
75#elif defined(SW_RTT_DEBUG)
76#define LOG_PROTO(type, color, format, ...) \
77 SEGGER_RTT_printf(0, " %s%s"format"%s", \
78 color, \
79 type, \
80 ##__VA_ARGS__, \
81 RTT_CTRL_RESET)
82
83#define print_init() SEGGER_RTT_Init()
84#define PRINT(fmt, arg...) LOG_PROTO("", "", fmt, ##arg)
85
86#elif defined(TEST_SUITE)
87void test_suite_uart_sendf(const char *str, ...);
88#define print_init()
89#define PRINT(fmt, arg...) test_suite_uart_sendf(fmt, ##arg)
90
91#else
92#define print_init()
93#define PRINT(fmt, arg...)
94
95#endif
96#endif
void sw_debug_uart_deinit(void)
void print_str(const char *str,...)
Definition uart_porting.c:503
void print_exc(const char *str,...)
void sw_debug_uart_init(uint32_t baud_rate)
Definition uart_porting.c:354