1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */ 2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */ 3 4 #ifndef INCLUDE_RT_MPI_RK_ERRNO_H_ 5 #define INCLUDE_RT_MPI_RK_ERRNO_H_ 6 #ifndef __BUILD_KO__ 7 #include <stdint.h> 8 #endif 9 #include "rk_type.h" 10 11 #ifdef __cplusplus 12 #if __cplusplus 13 extern "C" { 14 #endif 15 #endif /* __cplusplus */ 16 17 typedef enum rkERR_LEVEL_E { 18 RK_ERR_LEVEL_DEBUG = 0, /* debug-level */ 19 RK_ERR_LEVEL_INFO, /* informational */ 20 RK_ERR_LEVEL_NOTICE, /* normal but significant condition */ 21 RK_ERR_LEVEL_WARNING, /* warning conditions */ 22 RK_ERR_LEVEL_ERROR, /* error conditions */ 23 RK_ERR_LEVEL_CRIT, /* critical conditions */ 24 RK_ERR_LEVEL_ALERT, /* action must be taken immediately */ 25 RK_ERR_LEVEL_FATAL, /* just for compatibility with previous version */ 26 RK_ERR_LEVEL_BUTT 27 } ERR_LEVEL_E; 28 29 #define RK_ERR_APPID (0x80000000L + 0x20000000L) 30 31 /****************************************************************************** 32 |----------------------------------------------------------------| 33 | 1 | APP_ID | MOD_ID | ERR_LEVEL | ERR_ID | 34 |----------------------------------------------------------------| 35 |<--><--7bits----><----8bits---><--3bits---><------13bits------->| 36 ******************************************************************************/ 37 38 #define RK_DEF_ERR(module, level, errid) \ 39 ((RK_S32)((RK_ERR_APPID) | ((module) << 16 ) | ((level) << 13) | (errid))) 40 41 /* NOTE! the following defined all common error code, 42 ** all module must reserved 0~63 for their common error code 43 */ 44 typedef enum rkEN_ERR_CODE_E { 45 // invlalid device ID 46 RK_ERR_INVALID_DEVID = 1, 47 // invlalid channel ID 48 RK_ERR_INVALID_CHNID = 2, 49 /* 50 * at lease one parameter is illagal 51 * eg, an illegal enumeration value 52 */ 53 RK_ERR_ILLEGAL_PARAM = 3, 54 // resource exists 55 RK_ERR_EXIST = 4, 56 // resource unexists 57 RK_ERR_UNEXIST = 5, 58 // using a NULL point 59 RK_ERR_NULL_PTR = 6, 60 /* 61 * try to enable or initialize system, device 62 * or channel, before configing attribute 63 */ 64 RK_ERR_NOT_CONFIG = 7, 65 // operation or type is not supported by NOW 66 RK_ERR_NOT_SUPPORT = 8, 67 /* 68 * operation is not permitted 69 * eg, try to change static attribute 70 */ 71 RK_ERR_NOT_PERM = 9, 72 // invlalid pipe ID 73 RK_ERR_INVALID_PIPEID = 10, 74 // invlalid stitch group ID 75 RK_ERR_INVALID_STITCHGRPID = 11, 76 // failure caused by malloc memory 77 RK_ERR_NOMEM = 12, 78 // failure caused by malloc buffer 79 RK_ERR_NOBUF = 13, 80 // no data in buffer 81 RK_ERR_BUF_EMPTY = 14, 82 // no buffer for new data 83 RK_ERR_BUF_FULL = 15, 84 /* 85 * System is not ready,maybe not initialed or 86 * loaded. Returning the error code when opening 87 * a device file failed. 88 */ 89 RK_ERR_NOTREADY = 16, 90 /* 91 * bad address, 92 * eg. used for copy_from_user & copy_to_user 93 */ 94 RK_ERR_BADADDR = 17, 95 /* 96 * resource is busy, 97 * eg. destroy a venc chn without unregister it 98 */ 99 RK_ERR_BUSY = 18, 100 // buffer size is smaller than the actual size required 101 RK_ERR_SIZE_NOT_ENOUGH = 19, 102 /* 103 * maxium code, private error code of all modules 104 * must be greater than it 105 */ 106 RK_ERR_BUTT = 63, 107 }RK_ERR_CODE_E; 108 109 #ifdef __cplusplus 110 #if __cplusplus 111 } 112 #endif 113 #endif /* __cplusplus */ 114 115 #endif // INCLUDE_RT_MPI_RK_ERRNO_H_ 116