fei.deng | b9a1a57 | 2023-09-13 01:33:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020 Amlogic, Inc. All rights reserved. |
| 3 | * |
| 4 | * This source code is subject to the terms and conditions defined in the |
| 5 | * file 'LICENSE' which is part of this source code package. |
| 6 | * |
| 7 | * Description: |
| 8 | */ |
| 9 | #ifndef _TOOLS_ERRORS_CODE_H_ |
| 10 | #define _TOOLS_ERRORS_CODE_H_ |
| 11 | |
| 12 | #include <sys/types.h> |
| 13 | #include <errno.h> |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | |
| 20 | enum ErrorCode { |
| 21 | NO_ERROR = 0, // No errors. |
| 22 | |
| 23 | ERROR_UNKNOWN = (-2147483647-1), // INT32_MIN value |
| 24 | |
| 25 | ERROR_NO_MEMORY = -ENOMEM, |
| 26 | ERROR_INVALID_OPERATION = -ENOSYS, |
| 27 | ERROR_BAD_VALUE = -EINVAL, |
| 28 | ERROR_BAD_TYPE = (ERROR_UNKNOWN + 1), |
| 29 | ERROR_NOT_FOUND = -ENOENT, |
| 30 | ERROR_PERMISSION_DENIED = -EPERM, |
| 31 | ERROR_NO_INIT = -ENODEV, |
| 32 | ERROR_ALREADY_EXISTS = -EEXIST, |
| 33 | ERROR_DEAD_OBJECT = -EPIPE, |
| 34 | ERROR_FAILED_TRANSACTION = (ERROR_UNKNOWN + 2), |
| 35 | |
| 36 | ERROR_BAD_INDEX = -E2BIG, |
| 37 | ERROR_NOT_ENOUGH_DATA = (ERROR_UNKNOWN + 3), |
| 38 | ERROR_WOULD_BLOCK = (ERROR_UNKNOWN + 4), |
fei.deng | d0da4e2 | 2024-07-04 11:29:13 +0800 | [diff] [blame] | 39 | ERROR_TIMED_OUT = -ETIMEDOUT, |
fei.deng | b9a1a57 | 2023-09-13 01:33:57 +0000 | [diff] [blame] | 40 | ERROR_UNKNOWN_TRANSACTION = (ERROR_UNKNOWN + 6), |
| 41 | |
| 42 | ERROR_FDS_NOT_ALLOWED = (ERROR_UNKNOWN + 7), |
| 43 | ERROR_UNEXPECTED_NULL = (ERROR_UNKNOWN + 8), |
| 44 | ERROR_OPEN_FAIL = (ERROR_UNKNOWN + 9), |
| 45 | ERROR_PARAM_NULL = (ERROR_UNKNOWN + 10), |
| 46 | ERROR_DESTROY_FAIL = (ERROR_UNKNOWN + 11), |
| 47 | ERROR_IOCTL_FAIL = (ERROR_UNKNOWN + 12), |
| 48 | }; |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | } |
| 52 | #endif |
| 53 | |
| 54 | #endif // _TOOLS_ERRORS_CODE_H_ |