更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_err.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/**
33 * @defgroup los_err Error handling
34 * @ingroup kernel
35 */
36
37#ifndef _LOS_ERR_H
38#define _LOS_ERR_H
39
40#include "los_typedef.h"
41
42#ifdef __cplusplus
43#if __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46#endif /* __cplusplus */
47/**
48 * @ingroup los_err
49 * @brief Define the pointer to the error handling function.
50 *
51 * @par Description:
52 * This API is used to define the pointer to the error handling function.
53 * @attention
54 * <ul>
55 * <li>None.</li>
56 * </ul>
57 *
58 * @param fileName [IN] Log file that stores error information.
59 * @param lineNo [IN] Line number of the erroneous line.
60 * @param errorNo [IN] Error code.
61 * @param paraLen [IN] Length of the input parameter pPara.
62 * @param para [IN] User label of the error.
63 *
64 * @retval None.
65 * @par Dependency:
66 * <ul><li>los_err.h: the header file that contains the API declaration.</li></ul>
67 * @see None.
68 */
69typedef VOID (*LOS_ERRORHANDLE_FUNC)(CHAR *fileName,
70 UINT32 lineNo,
71 UINT32 errorNo,
72 UINT32 paraLen,
73 VOID *para);
74
75/**
76 * @ingroup los_err
77 * @brief Error handling function.
78 *
79 * @par Description:
80 * This API is used to perform different operations according to error types.
81 * @attention
82 * <ul>
83 * <li>None</li>
84 * </ul>
85 *
86 * @param fileName [IN] Log file that stores error information.
87 * @param lineNo [IN] Line number of the erroneous line which should not be OS_ERR_MAGIC_WORD.
88 * @param errorNo [IN] Error code.
89 * @param paraLen [IN] Length of the input parameter pPara.
90 * @param para [IN] User label of the error.
91 *
92 * @retval LOS_OK The error is successfully processed.
93 * @par Dependency:
94 * <ul><li>los_err.h: the header file that contains the API declaration.</li></ul>
95 * @see None
96 */
97extern UINT32 LOS_ErrHandle(CHAR *fileName, UINT32 lineNo,
98 UINT32 errorNo, UINT32 paraLen,
99 VOID *para);
100
101/**
102 * @ingroup los_err
103 * @brief set Error handling function.
104 *
105 * @param fun [IN] the error handle function.
106 */
108
124
127
130
151
152#ifdef __cplusplus
153#if __cplusplus
154}
155#endif /* __cplusplus */
156#endif /* __cplusplus */
157
158#endif /* _LOS_ERR_H */
VOID(* LOS_ERRORHANDLE_FUNC)(CHAR *fileName, UINT32 lineNo, UINT32 errorNo, UINT32 paraLen, VOID *para)
Define the pointer to the error handling function.
Definition: los_err.h:69
VOID LOS_SetErrHandleHook(LOS_ERRORHANDLE_FUNC fun)
set Error handling function.
Definition: los_err.c:71
UINT32 LOS_ErrHandle(CHAR *fileName, UINT32 lineNo, UINT32 errorNo, UINT32 paraLen, VOID *para)
Error handling function.
Definition: los_err.c:61
LOS_MOUDLE_ID
Definition: los_err.h:109
@ LOS_MOD_ERR
Definition: los_err.h:126
@ LOS_MOD_MSG
Definition: los_err.h:115
@ LOS_MOD_THRDCPUP
Definition: los_err.h:136
@ LOS_MOD_STKMON
Definition: los_err.h:138
@ LOS_MOD_TSK
Definition: los_err.h:112
@ LOS_MOD_TRACE
Definition: los_err.h:133
@ LOS_MOD_EVTTIME
Definition: los_err.h:135
@ LOS_MOD_HWWDG
Definition: los_err.h:120
@ LOS_MOD_HWI
Definition: los_err.h:119
@ LOS_MOD_EXC
Definition: los_err.h:128
@ LOS_MOD_IPC
Definition: los_err.h:137
@ LOS_MOD_CPUP
Definition: los_err.h:143
@ LOS_MOD_TICK
Definition: los_err.h:114
@ LOS_MOD_PERF
Definition: los_err.h:145
@ LOS_MOD_SYS
Definition: los_err.h:110
@ LOS_MOD_QUE
Definition: los_err.h:116
@ LOS_MOD_BUTT
Definition: los_err.h:149
@ LOS_MOD_CACHE
Definition: los_err.h:121
@ LOS_MOD_SEM
Definition: los_err.h:117
@ LOS_MOD_KNLSTAT
Definition: los_err.h:134
@ LOS_MOD_MBOX
Definition: los_err.h:118
@ LOS_MOD_SHELL
Definition: los_err.h:147
@ LOS_MOD_SWTMR
Definition: los_err.h:113
@ LOS_MOD_PM
Definition: los_err.h:146
@ LOS_MOD_MPU
Definition: los_err.h:131
@ LOS_MOD_MEM
Definition: los_err.h:111
@ LOS_MOD_MMU
Definition: los_err.h:123
@ LOS_MOD_MUX
Definition: los_err.h:142
@ LOS_MOD_TIMER
Definition: los_err.h:139
@ LOS_MOD_NMHWI
Definition: los_err.h:132
@ LOS_MOD_RESLEAKMON
Definition: los_err.h:140
@ LOS_MOD_HWTMR
Definition: los_err.h:122
@ LOS_MOD_HOOK
Definition: los_err.h:144
@ LOS_MOD_DRIVER
Definition: los_err.h:148
@ LOS_MOD_EVENT
Definition: los_err.h:141
@ LOS_MOD_LOG
Definition: los_err.h:125
@ LOS_MOD_CSTK
Definition: los_err.h:129
unsigned int UINT32
Definition: los_typedef.h:57
char CHAR
Definition: los_typedef.h:63