更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
shell_lk.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _HWLITEOS_SHELL_LK_H
33#define _HWLITEOS_SHELL_LK_H
34
35/**
36 * @defgroup shell_lk lk
37 * @ingroup shell
38 */
39#include "stdarg.h"
40#include "los_typedef.h"
41
42#ifdef __cplusplus
43#if __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46#endif /* __cplusplus */
47
48/**
49 * @ingroup shell_lk
50 * define sys default print level
51 */
52#define TRACE_DEFAULT PRINT_LEVEL
53
54/**
55 * @ingroup shell_lk
56 * @brief Define an printf handling function hook.
57 *
58 * @par Description:
59 * This API is used to define the printf handling function hook.
60 * @attention None.
61 *
62 * @param level [IN] print level.
63 * @param func [IN] means which func calls print func.
64 * @param line [IN] means which line calls print func.
65 * @param fmt [IN] other infomation by user define.
66 * @param ap [IN] the para list.
67 *
68 * @retval None.
69 *
70 * @par Dependency:
71 * shell_lk.h: the header file that contains the API declaration.
72 * @see None.
73 */
74typedef VOID (*LK_FUNC)(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, va_list ap);
75
76/**
77 * @ingroup shell_lk
78 * @brief print log.
79 *
80 * @par Description:
81 * <ul>
82 * <li>This API is used to LK print function.</li>
83 * </ul>
84 *
85 * @param level [IN] print level.
86 * @param func [IN] means which func calls print func.
87 * @param line [IN] means which line calls print func.
88 * @param fmt [IN] other infomation by user define
89 *
90 * @retval NONE
91 * @par Dependency:
92 * <ul><li>shell_lk.h: the header file that contains the API declaration.</li></ul>
93 */
94extern VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, ...);
95
96/**
97 * @ingroup shell_lk
98 * @brief register print func.
99 *
100 * @par Description:
101 * <ul>
102 * <li>This API is used to registe a hook function to LK.</li>
103 * </ul>
104 *
105 * @param LK_FUNC [IN] the print func.
106 *
107 * @retval NONE
108 * @par Dependency:
109 * <ul><li>shell_lk.h: the header file that contains the API declaration.</li></ul>
110 */
111extern VOID LOS_LkRegHook(LK_FUNC hook);
112
113#ifdef __cplusplus
114#if __cplusplus
115}
116#endif /* __cplusplus */
117#endif /* __cplusplus */
118
119#endif /* _HWLITEOS_SHELL_LK_H */
VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt,...)
print log.
Definition: los_printf.c:276
VOID(* LK_FUNC)(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, va_list ap)
Define an printf handling function hook.
Definition: shell_lk.h:74
VOID LOS_LkRegHook(LK_FUNC hook)
register print func.
Definition: shell_lk.c:228
signed int INT32
Definition: los_typedef.h:60
char CHAR
Definition: los_typedef.h:63