WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_printf.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2020. All rights reserved.
3 * Description: Los_printf HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2013-01-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
34#ifndef _LOS_PRINTF_H
35#define _LOS_PRINTF_H
36
37#include "stdarg.h"
38#include "los_config.h"
39#include "los_typedef.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44#ifdef LOSCFG_SHELL_LK
45extern void LOS_LkPrint(int level, const char *func, int line, const char *fmt, ...);
46#endif
47
52#define LOS_EMG_LEVEL 0
53
58#define LOS_COMMOM_LEVEL (LOS_EMG_LEVEL + 1)
59
64#define LOS_ERR_LEVEL (LOS_COMMOM_LEVEL + 1)
65
70#define LOS_WARN_LEVEL (LOS_ERR_LEVEL + 1)
71
76#define LOS_INFO_LEVEL (LOS_WARN_LEVEL + 1)
77
82#define LOS_DEBUG_LEVEL (LOS_INFO_LEVEL + 1)
83
91#ifdef LOSCFG_SHELL_LK
92#define PRINT_LEVEL LOS_DEBUG_LEVEL
93#else
94#define PRINT_LEVEL LOS_ERR_LEVEL
95#endif
96
97typedef VOID (*pf_OUTPUT)(const CHAR *fmt, ...);
98
117#ifdef LOSCFG_LIB_LIBC
118extern void dprintf(const char *fmt, ...);
119#else
120extern VOID LOS_Printf(const CHAR *fmt, ...);
121#endif
122#define diag_printf dprintf
123
144#ifndef PRINT_DEBUG
145#if PRINT_LEVEL < LOS_DEBUG_LEVEL
146#define PRINT_DEBUG(fmt, ...)
147#else
148#ifdef LOSCFG_SHELL_LK
149#define PRINT_DEBUG(fmt, ...) LOS_LkPrint(LOS_DEBUG_LEVEL, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
150#else
151#define PRINT_DEBUG(fmt, ...) do { \
152 (dprintf("[DEBUG] "), dprintf(fmt, ##__VA_ARGS__)); \
153} while (0)
154#endif
155#endif
156#endif
157
178#ifndef PRINT_INFO
179#if PRINT_LEVEL < LOS_INFO_LEVEL
180#define PRINT_INFO(fmt, ...)
181#else
182#ifdef LOSCFG_SHELL_LK
183#define PRINT_INFO(fmt, ...) LOS_LkPrint(LOS_INFO_LEVEL, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
184#else
185#define PRINT_INFO(fmt, ...) do { \
186 (dprintf("[INFO] "), dprintf(fmt, ##__VA_ARGS__)); \
187} while (0)
188#endif
189#endif
190#endif
191
212#ifndef PRINT_WARN
213#if PRINT_LEVEL < LOS_WARN_LEVEL
214#define PRINT_WARN(fmt, ...)
215#else
216#ifdef LOSCFG_SHELL_LK
217#define PRINT_WARN(fmt, ...) LOS_LkPrint(LOS_WARN_LEVEL, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
218#else
219#define PRINT_WARN(fmt, ...) do { \
220 (dprintf("[WARN] "), dprintf(fmt, ##__VA_ARGS__)); \
221} while (0)
222#endif
223#endif
224#endif
225
246#ifndef PRINT_ERR
247#if PRINT_LEVEL < LOS_ERR_LEVEL
248#define PRINT_ERR(fmt, ...)
249#else
250#ifdef LOSCFG_SHELL_LK
251#define PRINT_ERR(fmt, ...) LOS_LkPrint(LOS_ERR_LEVEL, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
252#else
253#define PRINT_ERR(fmt, ...) do { \
254 (dprintf("[ERR] "), dprintf(fmt, ##__VA_ARGS__)); \
255} while (0)
256#endif
257#endif
258#endif
259
280#ifndef PRINTK
281#if PRINT_LEVEL < LOS_COMMOM_LEVEL
282#define PRINTK(fmt, ...)
283#else
284#ifdef LOSCFG_SHELL_LK
285#define PRINTK(fmt, ...) LOS_LkPrint(LOS_COMMOM_LEVEL, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
286#else
287#define PRINTK(fmt, ...) dprintf(fmt, ##__VA_ARGS__)
288#endif
289#endif
290#endif
291
312#ifndef PRINT_EMG
313#if PRINT_LEVEL < LOS_EMG_LEVEL
314#define PRINT_EMG(fmt, ...)
315#else
316#define PRINT_EMG(fmt, ...) do { \
317 (dprintf("[EMG] "), dprintf(fmt, ##__VA_ARGS__)); \
318} while (0)
319#endif
320#endif
321
342#ifndef PRINT_RELEASE
343#define PRINT_RELEASE(fmt, ...) dprintf(fmt, ##__VA_ARGS__)
344#endif
345
346#ifdef __cplusplus
347}
348#endif /* __cplusplus */
349
350#endif /* _LOS_PRINTF_H */
void LOS_Printf(const CHAR *fmt,...)
Format and print data.
void(* pf_OUTPUT)(const CHAR *fmt,...)
Definition los_printf.h:97
#define VOID
Definition los_typedef.h:88
char CHAR
Definition los_typedef.h:58