1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HI_ERRNO_H__ 20 #define __HI_ERRNO_H__ 21 22 #include "hi_debug.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif /* End of #ifdef __cplusplus */ 29 30 /* 1010 0000b 31 * VTOP use APPID from 0~31 32 * so, hisilicon use APPID based on 32 33 */ 34 #define HI_ERR_APPID (0x80000000U + 0x20000000U) 35 36 typedef enum hiERR_LEVEL_E { 37 EN_ERR_LEVEL_DEBUG = 0, /* debug-level */ 38 EN_ERR_LEVEL_INFO = 1, /* informational */ 39 EN_ERR_LEVEL_NOTICE = 2, /* normal but significant condition */ 40 EN_ERR_LEVEL_WARNING = 3, /* warning conditions */ 41 EN_ERR_LEVEL_ERROR = 4, /* error conditions */ 42 EN_ERR_LEVEL_CRIT = 5, /* critical conditions */ 43 EN_ERR_LEVEL_ALERT = 6, /* action must be taken immediately */ 44 EN_ERR_LEVEL_FATAL = 7, /* just for compatibility with previous version */ 45 EN_ERR_LEVEL_BUTT = 30, 46 } ERR_LEVEL_E; 47 48 /****************************************************************************** 49 |----------------------------------------------------------------| 50 | 1 | APP_ID | MOD_ID | ERR_LEVEL | ERR_ID | 51 |----------------------------------------------------------------| 52 |<--><--7bits----><----8bits---><--3bits---><------13bits------->| 53 ******************************************************************************/ 54 55 #define HI_DEF_ERR(module, level, errid) \ 56 ((HI_S32)((HI_ERR_APPID) | ((HI_U32)(module) << 16U) | ((HI_U32)(level) << 13U) | ((HI_U32)errid))) 57 58 /* NOTE! the following defined all common error code, 59 * all module must reserved 0~63 for their common error code 60 */ 61 typedef enum hiEN_ERR_CODE_E { 62 EN_ERR_INVALID_DEVID = 1, /* invlalid device ID */ 63 EN_ERR_INVALID_CHNID = 2, /* invlalid channel ID */ 64 EN_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal 65 * eg, an illegal enumeration value */ 66 EN_ERR_EXIST = 4, /* resource exists */ 67 EN_ERR_UNEXIST = 5, /* resource unexists */ 68 69 EN_ERR_NULL_PTR = 6, /* using a NULL point */ 70 71 EN_ERR_NOT_CONFIG = 7, /* try to enable or initialize system, device 72 * or channel, before configing attribute */ 73 74 EN_ERR_NOT_SUPPORT = 8, /* operation or type is not supported by NOW */ 75 EN_ERR_NOT_PERM = 9, /* operation is not permitted 76 ** eg, try to change static attribute */ 77 EN_ERR_INVALID_PIPEID = 10, /* invlalid pipe ID */ 78 EN_ERR_INVALID_STITCHGRPID = 11, /* invlalid stitch group ID */ 79 80 EN_ERR_NOMEM = 12, /* failure caused by malloc memory */ 81 EN_ERR_NOBUF = 13, /* failure caused by malloc buffer */ 82 83 EN_ERR_BUF_EMPTY = 14, /* no data in buffer */ 84 EN_ERR_BUF_FULL = 15, /* no buffer for new data */ 85 86 EN_ERR_SYS_NOTREADY = 16, /* System is not ready, maybe not initialed or 87 * loaded. Returning the error code when opening 88 * a device file failed. */ 89 90 EN_ERR_BADADDR = 17, /* bad address, 91 * eg. used for copy_from_user & copy_to_user */ 92 93 EN_ERR_BUSY = 18, /* resource is busy, 94 * eg. destroy a venc chn without unregister it */ 95 EN_ERR_SIZE_NOT_ENOUGH = 19, /* buffer size is smaller than the actual size required */ 96 97 EN_ERR_BUTT = 63, /* maximum code, private error code of all modules 98 * must be greater than it */ 99 } EN_ERR_CODE_E; 100 101 #ifdef __cplusplus 102 #if __cplusplus 103 } 104 #endif 105 #endif /* __cplusplus */ 106 107 #endif /* __HI_ERRNO_H__ */ 108 109