11bd4fe43Sopenharmony_ci/* 21bd4fe43Sopenharmony_ci * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License. 51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at 61bd4fe43Sopenharmony_ci * 71bd4fe43Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 81bd4fe43Sopenharmony_ci * 91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and 131bd4fe43Sopenharmony_ci * limitations under the License. 141bd4fe43Sopenharmony_ci */ 151bd4fe43Sopenharmony_ci 161bd4fe43Sopenharmony_ci#ifndef __HI_ERRNO_H__ 171bd4fe43Sopenharmony_ci#define __HI_ERRNO_H__ 181bd4fe43Sopenharmony_ci 191bd4fe43Sopenharmony_ci#include "hi_debug.h" 201bd4fe43Sopenharmony_ci 211bd4fe43Sopenharmony_ci#ifdef __cplusplus 221bd4fe43Sopenharmony_ci#if __cplusplus 231bd4fe43Sopenharmony_ciextern "C" { 241bd4fe43Sopenharmony_ci#endif 251bd4fe43Sopenharmony_ci#endif /* End of #ifdef __cplusplus */ 261bd4fe43Sopenharmony_ci 271bd4fe43Sopenharmony_ci/* 1010 0000b 281bd4fe43Sopenharmony_ci * VTOP use APPID from 0~31 291bd4fe43Sopenharmony_ci * so, hisilicon use APPID based on 32 301bd4fe43Sopenharmony_ci */ 311bd4fe43Sopenharmony_ci#define HI_ERR_APPID (0x80000000U + 0x20000000U) 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_citypedef enum hiERR_LEVEL_E { 341bd4fe43Sopenharmony_ci EN_ERR_LEVEL_DEBUG = 0, /* debug-level */ 351bd4fe43Sopenharmony_ci EN_ERR_LEVEL_INFO = 1, /* informational */ 361bd4fe43Sopenharmony_ci EN_ERR_LEVEL_NOTICE = 2, /* normal but significant condition */ 371bd4fe43Sopenharmony_ci EN_ERR_LEVEL_WARNING = 3, /* warning conditions */ 381bd4fe43Sopenharmony_ci EN_ERR_LEVEL_ERROR = 4, /* error conditions */ 391bd4fe43Sopenharmony_ci EN_ERR_LEVEL_CRIT = 5, /* critical conditions */ 401bd4fe43Sopenharmony_ci EN_ERR_LEVEL_ALERT = 6, /* action must be taken immediately */ 411bd4fe43Sopenharmony_ci EN_ERR_LEVEL_FATAL = 7, /* just for compatibility with previous version */ 421bd4fe43Sopenharmony_ci EN_ERR_LEVEL_BUTT = 30, 431bd4fe43Sopenharmony_ci} ERR_LEVEL_E; 441bd4fe43Sopenharmony_ci 451bd4fe43Sopenharmony_ci/****************************************************************************** 461bd4fe43Sopenharmony_ci|----------------------------------------------------------------| 471bd4fe43Sopenharmony_ci| 1 | APP_ID | MOD_ID | ERR_LEVEL | ERR_ID | 481bd4fe43Sopenharmony_ci|----------------------------------------------------------------| 491bd4fe43Sopenharmony_ci|<--><--7bits----><----8bits---><--3bits---><------13bits------->| 501bd4fe43Sopenharmony_ci******************************************************************************/ 511bd4fe43Sopenharmony_ci 521bd4fe43Sopenharmony_ci#define HI_DEF_ERR(module, level, errid) \ 531bd4fe43Sopenharmony_ci ((HI_S32)((HI_ERR_APPID) | ((HI_U32)(module) << 16U) | ((HI_U32)(level) << 13U) | ((HI_U32)errid))) 541bd4fe43Sopenharmony_ci 551bd4fe43Sopenharmony_ci/* NOTE! the following defined all common error code, 561bd4fe43Sopenharmony_ci * all module must reserved 0~63 for their common error code 571bd4fe43Sopenharmony_ci */ 581bd4fe43Sopenharmony_citypedef enum hiEN_ERR_CODE_E { 591bd4fe43Sopenharmony_ci EN_ERR_INVALID_DEVID = 1, /* invlalid device ID */ 601bd4fe43Sopenharmony_ci EN_ERR_INVALID_CHNID = 2, /* invlalid channel ID */ 611bd4fe43Sopenharmony_ci EN_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal 621bd4fe43Sopenharmony_ci * eg, an illegal enumeration value */ 631bd4fe43Sopenharmony_ci EN_ERR_EXIST = 4, /* resource exists */ 641bd4fe43Sopenharmony_ci EN_ERR_UNEXIST = 5, /* resource unexists */ 651bd4fe43Sopenharmony_ci 661bd4fe43Sopenharmony_ci EN_ERR_NULL_PTR = 6, /* using a NULL point */ 671bd4fe43Sopenharmony_ci 681bd4fe43Sopenharmony_ci EN_ERR_NOT_CONFIG = 7, /* try to enable or initialize system, device 691bd4fe43Sopenharmony_ci * or channel, before configing attribute */ 701bd4fe43Sopenharmony_ci 711bd4fe43Sopenharmony_ci EN_ERR_NOT_SUPPORT = 8, /* operation or type is not supported by NOW */ 721bd4fe43Sopenharmony_ci EN_ERR_NOT_PERM = 9, /* operation is not permitted 731bd4fe43Sopenharmony_ci ** eg, try to change static attribute */ 741bd4fe43Sopenharmony_ci EN_ERR_INVALID_PIPEID = 10, /* invlalid pipe ID */ 751bd4fe43Sopenharmony_ci EN_ERR_INVALID_STITCHGRPID = 11, /* invlalid stitch group ID */ 761bd4fe43Sopenharmony_ci 771bd4fe43Sopenharmony_ci EN_ERR_NOMEM = 12, /* failure caused by malloc memory */ 781bd4fe43Sopenharmony_ci EN_ERR_NOBUF = 13, /* failure caused by malloc buffer */ 791bd4fe43Sopenharmony_ci 801bd4fe43Sopenharmony_ci EN_ERR_BUF_EMPTY = 14, /* no data in buffer */ 811bd4fe43Sopenharmony_ci EN_ERR_BUF_FULL = 15, /* no buffer for new data */ 821bd4fe43Sopenharmony_ci 831bd4fe43Sopenharmony_ci EN_ERR_SYS_NOTREADY = 16, /* System is not ready, maybe not initialed or 841bd4fe43Sopenharmony_ci * loaded. Returning the error code when opening 851bd4fe43Sopenharmony_ci * a device file failed. */ 861bd4fe43Sopenharmony_ci 871bd4fe43Sopenharmony_ci EN_ERR_BADADDR = 17, /* bad address, 881bd4fe43Sopenharmony_ci * eg. used for copy_from_user & copy_to_user */ 891bd4fe43Sopenharmony_ci 901bd4fe43Sopenharmony_ci EN_ERR_BUSY = 18, /* resource is busy, 911bd4fe43Sopenharmony_ci * eg. destroy a venc chn without unregister it */ 921bd4fe43Sopenharmony_ci EN_ERR_SIZE_NOT_ENOUGH = 19, /* buffer size is smaller than the actual size required */ 931bd4fe43Sopenharmony_ci 941bd4fe43Sopenharmony_ci EN_ERR_BUTT = 63, /* maximum code, private error code of all modules 951bd4fe43Sopenharmony_ci * must be greater than it */ 961bd4fe43Sopenharmony_ci} EN_ERR_CODE_E; 971bd4fe43Sopenharmony_ci 981bd4fe43Sopenharmony_ci#ifdef __cplusplus 991bd4fe43Sopenharmony_ci#if __cplusplus 1001bd4fe43Sopenharmony_ci} 1011bd4fe43Sopenharmony_ci#endif 1021bd4fe43Sopenharmony_ci#endif /* __cplusplus */ 1031bd4fe43Sopenharmony_ci 1041bd4fe43Sopenharmony_ci#endif /* __HI_ERRNO_H__ */ 1051bd4fe43Sopenharmony_ci 106