1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __HI_ERROR_DEF_H__ 17 #define __HI_ERROR_DEF_H__ 18 19 #ifdef __cplusplus 20 #if __cplusplus 21 extern "C" { 22 #endif 23 #endif /* __cplusplus */ 24 25 /** error level */ 26 typedef enum { 27 APP_ERR_LEVEL_DEBUG = 0, /* debug-level */ 28 APP_ERR_LEVEL_INFO, /* informational */ 29 APP_ERR_LEVEL_NOTICE, /* normal but significant condition */ 30 APP_ERR_LEVEL_WARNING, /* warning conditions */ 31 APP_ERR_LEVEL_ERROR, /* error conditions */ 32 APP_ERR_LEVEL_CRIT, /* critical conditions */ 33 APP_ERR_LEVEL_ALERT, /* action must be taken immediately */ 34 APP_ERR_LEVEL_FATAL, /* just for compatibility with previous version */ 35 APP_ERR_LEVEL_BUTT 36 } APP_ERR_LEVEL_E; 37 38 /** common error code 0x01~0x11,module private error code define from 0x40 */ 39 typedef enum { 40 APP_ERR_ILLEGAL_PARAM = 0x01, /* at lease one parameter is illegal 41 * eg, an illegal enumeration value */ 42 APP_ERR_NULL_PTR = 0x02, /* using a NULL point */ 43 APP_ERR_PARAM_OVERRANGE = 0x03, /* param out of range */ 44 APP_ERR_NOT_SUPPORT = 0x04, /* operation or type is not supported by NOW */ 45 APP_ERR_NOT_CONFIG = 0x05, /* try to enable or initialize system, device 46 ** or channel, before configuring attribute */ 47 APP_ERR_NOT_PERM = 0x06, /* operation is not permitted 48 ** eg, try to change static attribute */ 49 APP_ERR_NOMEM = 0x07, /* failure caused by malloc memory */ 50 APP_ERR_SYS_NOTREADY = 0x08, /* System is not ready, maybe not initialed or 51 ** loaded. Returning the error code when opening 52 ** a device file failed. */ 53 APP_ERR_BADADDR = 0x09, /* bad address, 54 ** eg. used for copy_from_user & copy_to_user */ 55 APP_ERR_BUSY = 0x10, /* resource is busy, 56 ** eg. destroy a venc chn without unregister it */ 57 APP_ERR_BUTT = 0x11, /* maximum code, private error code of all modules 58 ** must be greater than it */ 59 } APP_ERR_CODE_E; 60 61 #define HI_ERR_APP_APPID (0x80000000L + 0x21000000L) 62 #define HI_ERR_EXT_APP_APPID (0x80000000L + 0x22000000L) 63 64 #define HI_APP_DEF_ERR(module, level, errid) \ 65 ((int32_t)((HI_ERR_APP_APPID) | ((module) << 16) | ((level) << 13) | (errid))) 66 67 68 #ifdef __cplusplus 69 #if __cplusplus 70 } 71 #endif 72 #endif /* __cplusplus */ 73 #endif // __HI_ERROR_DEF_H__ 74