00001 /*---------------------------------------------------------------------------- 00002 * Copyright (c) <2013-2015>, <Huawei Technologies Co., Ltd> 00003 * All rights reserved. 00004 * Redistribution and use in source and binary forms, with or without modification, 00005 * are permitted provided that the following conditions are met: 00006 * 1. Redistributions of source code must retain the above copyright notice, this list of 00007 * conditions and the following disclaimer. 00008 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 00009 * of conditions and the following disclaimer in the documentation and/or other materials 00010 * provided with the distribution. 00011 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 00012 * to endorse or promote products derived from this software without specific prior written 00013 * permission. 00014 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00015 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00016 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00017 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00018 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00019 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00020 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00021 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00022 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00023 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00024 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 *---------------------------------------------------------------------------*/ 00026 /*---------------------------------------------------------------------------- 00027 * Notice of Export Control Law 00028 * =============================================== 00029 * Huawei LiteOS may be subject to applicable export control laws and regulations, which might 00030 * include those applicable to Huawei LiteOS of U.S. and the country in which you are located. 00031 * Import, export and usage of Huawei LiteOS in any manner by you shall be in compliance with such 00032 * applicable export control laws and regulations. 00033 *---------------------------------------------------------------------------*/ 00034 00035 /**@defgroup los_err Error handling 00036 * @ingroup kernel 00037 */ 00038 00039 #ifndef _LOS_ERR_H 00040 #define _LOS_ERR_H 00041 00042 #include "los_base.h" 00043 00044 #ifdef __cplusplus 00045 #if __cplusplus 00046 extern "C" { 00047 #endif /* __cplusplus */ 00048 #endif /* __cplusplus */ 00049 00050 00051 /** 00052 *@ingroup los_err 00053 *@brief Define the pointer to the error handling function. 00054 * 00055 *@par Description: 00056 *This API is used to define the pointer to the error handling function. 00057 *@attention 00058 *<ul> 00059 *<li>None.</li> 00060 *</ul> 00061 * 00062 *@param pcFileName [IN] Log file that stores error information. 00063 *@param uwLineNo [IN] Line number of the erroneous line. 00064 *@param uwErrorNo [IN] Error code. 00065 *@param uwParaLen [IN] Length of the input parameter pPara. 00066 *@param pPara [IN] User label of the error. 00067 * 00068 *@retval None. 00069 *@par Dependency: 00070 *<ul><li>los_err.h: the header file that contains the API declaration.</li></ul> 00071 *@see None. 00072 *@since Huawei LiteOS V100R001C00 00073 */ 00074 typedef VOID (*LOS_ERRORHANDLE_FUNC)(CHAR *pcFileName, 00075 UINT32 uwLineNo, /**< Line number of the erroneous line.*/ 00076 UINT32 uwErrorNo, /**< Error code. */ 00077 UINT32 uwParaLen, /**< Length of the input parameter pPara.*/ 00078 VOID *pPara); 00079 00080 /** 00081 *@ingroup los_err 00082 *@brief Error handling function. 00083 * 00084 *@par Description: 00085 *This API is used to perform different operations according to error types. 00086 *@attention 00087 *<ul> 00088 *<li>None</li> 00089 *</ul> 00090 * 00091 *@param pcFileName [IN] Log file that stores error information. 00092 *@param uwLineNo [IN] Line number of the erroneous line which should not be OS_ERR_MAGIC_WORD. 00093 *@param uwErrorNo [IN] Error code. 00094 *@param uwParaLen [IN] Length of the input parameter pPara. 00095 *@param pPara [IN] User label of the error. 00096 * 00097 *@retval LOS_OK The error is successfully processed. 00098 *@par Dependency: 00099 *<ul><li>los_err.h: the header file that contains the API declaration.</li></ul> 00100 *@see None 00101 *@since Huawei LiteOS V100R001C00 00102 */ 00103 extern UINT32 LOS_ErrHandle(CHAR *pcFileName, UINT32 uwLineNo, 00104 UINT32 uwErrorNo, UINT32 uwParaLen, 00105 VOID *pPara); 00106 00107 /** 00108 * @ingroup los_err 00109 * Error handling function structure. 00110 */ 00111 typedef struct tagUserErrFunc_S 00112 { 00113 LOS_ERRORHANDLE_FUNC pfnHook; /**< Hook function for error handling.*/ 00114 } USER_ERR_FUNC_S; 00115 00116 /** 00117 * @ingroup los_err 00118 * Error handling function. 00119 */ 00120 extern USER_ERR_FUNC_S g_stUserErrFunc; 00121 00122 enum LOS_MOUDLE_ID 00123 { 00124 LOS_MOD_SYS = 0x0, 00125 LOS_MOD_MEM = 0x1, 00126 LOS_MOD_TSK = 0x2, 00127 LOS_MOD_SWTMR = 0x3, 00128 LOS_MOD_TICK = 0x4, 00129 LOS_MOD_MSG = 0x5, 00130 LOS_MOD_QUE = 0x6, 00131 LOS_MOD_SEM = 0x7, 00132 LOS_MOD_MBOX = 0x8, 00133 LOS_MOD_HWI = 0x9, 00134 LOS_MOD_HWWDG = 0xa, 00135 LOS_MOD_CACHE = 0xb, 00136 LOS_MOD_HWTMR = 0xc, 00137 LOS_MOD_MMU = 0xd, 00138 00139 LOS_MOD_LOG = 0xe, 00140 LOS_MOD_ERR = 0xf, 00141 00142 LOS_MOD_EXC = 0x10, 00143 LOS_MOD_CSTK = 0x11, 00144 00145 LOS_MOD_MPU = 0x12, 00146 LOS_MOD_NMHWI = 0x13, 00147 LOS_MOD_TRACE = 0x14, 00148 LOS_MOD_KNLSTAT = 0x15, 00149 LOS_MOD_EVTTIME = 0x16, 00150 LOS_MOD_THRDCPUP = 0x17, 00151 LOS_MOD_IPC = 0x18, 00152 LOS_MOD_STKMON = 0x19, 00153 LOS_MOD_TIMER = 0x1a, 00154 LOS_MOD_RESLEAKMON = 0x1b, 00155 LOS_MOD_EVENT = 0x1c, 00156 LOS_MOD_MUX = 0X1d, 00157 LOS_MOD_CPUP = 0x1e, 00158 LOS_MOD_SHELL = 0x31, 00159 LOS_MOD_BUTT 00160 }; 00161 00162 00163 #ifdef __cplusplus 00164 #if __cplusplus 00165 } 00166 #endif /* __cplusplus */ 00167 #endif /* __cplusplus */ 00168 00169 #endif /* _LOS_ERR_H */