1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License as published by the 6 * Free Software Foundation; either version 2 of the License, or (at your 7 * 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, see <http://www.gnu.org/licenses/>. 16 * 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 #define HI_ERR_APP_ID (0x80000000L + 0x20000000L) 31 32 #define HI_DEFINE_ERR(mod, level, err_id) \ 33 ((hi_s32)((HI_ERR_APP_ID) | ((mod) << 16) | ((level) << 13) | (err_id))) 34 35 typedef enum { 36 HI_ERR_LEVEL_DEBUG = 0, /* debug-level */ 37 HI_ERR_LEVEL_INFO, /* informational */ 38 HI_ERR_LEVEL_NOTICE, /* normal but significant condition */ 39 HI_ERR_LEVEL_WARNING, /* warning conditions */ 40 HI_ERR_LEVEL_ERROR, /* error conditions */ 41 HI_ERR_LEVEL_CRIT, /* critical conditions */ 42 HI_ERR_LEVEL_ALERT, /* action must be taken immediately */ 43 HI_ERR_LEVEL_FATAL, /* just for compatibility with previous version */ 44 HI_ERR_LEVEL_BUTT 45 } hi_err_level; 46 47 typedef enum { 48 HI_ERR_INVALID_DEV_ID = 0x1, /* invlalid device ID */ 49 HI_ERR_INVALID_PIPE_ID = 0x2, /* invlalid pipe ID */ 50 HI_ERR_INVALID_CHN_ID = 0x3, /* invlalid channel ID */ 51 HI_ERR_INVALID_LAYER_ID = 0x4, /* invlalid channel ID */ 52 53 HI_ERR_ILLEGAL_PARAM = 0x7, /* at lease one parameter is illagal 54 * eg, an illegal enumeration value */ 55 HI_ERR_EXIST = 0x8, /* resource exists */ 56 HI_ERR_UNEXIST = 0x9, /* resource unexists */ 57 HI_ERR_NULL_PTR = 0xa, /* using a NULL point */ 58 HI_ERR_NOT_CFG = 0xb, /* try to enable or initialize system, device 59 ** or channel, before configing attribute */ 60 HI_ERR_NOT_SUPPORT = 0xc, /* operation or type is not supported by NOW */ 61 HI_ERR_NOT_PERM = 0xd, /* operation is not permitted 62 ** eg, try to change static attribute */ 63 HI_ERR_NOT_ENABLE = 0x10, 64 HI_ERR_NOT_DISABLE = 0x11, 65 HI_ERR_NOT_START = 0x12, 66 HI_ERR_NOT_STOP = 0x13, 67 HI_ERR_NO_MEM = 0x14, /* failure caused by malloc memory */ 68 HI_ERR_NO_BUF = 0x15, /* failure caused by malloc buffer */ 69 HI_ERR_BUF_EMPTY = 0x16, /* no data in buffer */ 70 HI_ERR_BUF_FULL = 0x17, /* no buffer for new data */ 71 HI_ERR_NOT_READY = 0x18, /* System is not ready, maybe not initialed or 72 ** loaded. Returning the error code when opening 73 ** a device file failed. */ 74 HI_ERR_TIMEOUT = 0x20, 75 HI_ERR_BAD_ADDR = 0x21, /* bad address, 76 ** eg. used for copy_from_user & copy_to_user */ 77 HI_ERR_BUSY = 0x22, /* resource is busy, 78 ** eg. destroy a venc chn without unregister it */ 79 HI_ERR_SIZE_NOT_ENOUGH = 0x23, /* buffer size is smaller than the actual size required */ 80 81 HI_ERR_NOT_BINDED = 0x24, 82 HI_ERR_BINDED = 0x25, 83 HI_ERR_BUTT = 0x3f, /* maxium code, private error code of all modules 84 ** must be greater than it */ 85 } hi_errno; 86 87 #ifdef __cplusplus 88 #if __cplusplus 89 } 90 #endif 91 #endif /* __cplusplus */ 92 93 #endif /* __HI_ERRNO_H__ */ 94