• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
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_ERRNO_H__
17 #define __HI_ERRNO_H__
18 
19 #include "hi_debug.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif /* End of #ifdef __cplusplus */
26 
27 /* 1010 0000b
28  * VTOP use APPID from 0~31
29  * so, hisilicon use APPID based on 32
30  */
31 #define HI_ERR_APPID (0x80000000U + 0x20000000U)
32 
33 typedef enum hiERR_LEVEL_E {
34     EN_ERR_LEVEL_DEBUG   = 0,   /* debug-level                                  */
35     EN_ERR_LEVEL_INFO    = 1,   /* informational                                */
36     EN_ERR_LEVEL_NOTICE  = 2,   /* normal but significant condition             */
37     EN_ERR_LEVEL_WARNING = 3,   /* warning conditions                           */
38     EN_ERR_LEVEL_ERROR   = 4,   /* error conditions                             */
39     EN_ERR_LEVEL_CRIT    = 5,   /* critical conditions                          */
40     EN_ERR_LEVEL_ALERT   = 6,   /* action must be taken immediately             */
41     EN_ERR_LEVEL_FATAL   = 7,   /* just for compatibility with previous version */
42     EN_ERR_LEVEL_BUTT    = 30,
43 } ERR_LEVEL_E;
44 
45 /******************************************************************************
46 |----------------------------------------------------------------|
47 | 1 |   APP_ID   |   MOD_ID    | ERR_LEVEL |   ERR_ID            |
48 |----------------------------------------------------------------|
49 |<--><--7bits----><----8bits---><--3bits---><------13bits------->|
50 ******************************************************************************/
51 
52 #define HI_DEF_ERR(module, level, errid) \
53     ((HI_S32)((HI_ERR_APPID) | ((HI_U32)(module) << 16U) | ((HI_U32)(level) << 13U) | ((HI_U32)errid)))
54 
55 /* NOTE! the following defined all common error code,
56  * all module must reserved 0~63 for their common error code
57  */
58 typedef enum hiEN_ERR_CODE_E {
59     EN_ERR_INVALID_DEVID = 1, /* invlalid device ID                           */
60     EN_ERR_INVALID_CHNID = 2, /* invlalid channel ID                          */
61     EN_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal
62                                * eg, an illegal enumeration value             */
63     EN_ERR_EXIST         = 4, /* resource exists                              */
64     EN_ERR_UNEXIST       = 5, /* resource unexists                            */
65 
66     EN_ERR_NULL_PTR      = 6, /* using a NULL point                           */
67 
68     EN_ERR_NOT_CONFIG    = 7, /* try to enable or initialize system, device
69                                * or channel, before configing attribute       */
70 
71     EN_ERR_NOT_SUPPORT   = 8, /* operation or type is not supported by NOW    */
72     EN_ERR_NOT_PERM      = 9, /* operation is not permitted
73                               ** eg, try to change static attribute           */
74     EN_ERR_INVALID_PIPEID = 10, /* invlalid pipe ID                           */
75     EN_ERR_INVALID_STITCHGRPID  = 11, /* invlalid stitch group ID             */
76 
77     EN_ERR_NOMEM         = 12, /* failure caused by malloc memory              */
78     EN_ERR_NOBUF         = 13, /* failure caused by malloc buffer              */
79 
80     EN_ERR_BUF_EMPTY     = 14, /* no data in buffer                            */
81     EN_ERR_BUF_FULL      = 15, /* no buffer for new data                       */
82 
83     EN_ERR_SYS_NOTREADY  = 16, /* System is not ready, maybe not initialed or
84                                 * loaded. Returning the error code when opening
85                                 * a device file failed.                        */
86 
87     EN_ERR_BADADDR       = 17, /* bad address,
88                                 * eg. used for copy_from_user & copy_to_user   */
89 
90     EN_ERR_BUSY          = 18, /* resource is busy,
91                                 * eg. destroy a venc chn without unregister it */
92     EN_ERR_SIZE_NOT_ENOUGH = 19, /* buffer size is smaller than the actual size required */
93 
94     EN_ERR_BUTT          = 63, /* maximum code, private error code of all modules
95                                 * must be greater than it                      */
96 } EN_ERR_CODE_E;
97 
98 #ifdef __cplusplus
99 #if __cplusplus
100 }
101 #endif
102 #endif /* __cplusplus */
103 
104 #endif /* __HI_ERRNO_H__ */
105 
106