1 /*
2  * Copyright (C) 2017-2019 Alibaba Group Holding Limited
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2020-08-20     zx.chen      header file for error num
9  */
10 
11 
12 #ifndef _DRV_ERRNO_H_
13 #define _DRV_ERRNO_H_
14 
15 #include <errno.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #define ERRNO_DRV_START 0X80
22 
23 /* driver General error codes */
24 typedef enum
25 {
26     DRV_ERROR = ERRNO_DRV_START,   ///< Unspecified error
27     DRV_ERROR_BUSY,                ///< Driver is busy
28     DRV_ERROR_TIMEOUT,             ///< Timeout occurred
29     DRV_ERROR_UNSUPPORTED,         ///< Operation not supported
30     DRV_ERROR_PARAMETER,           ///< Parameter error
31     DRV_ERROR_SPECIFIC             ///< Start of driver specific errors
32 } drv_err_e;
33 
34 
35 /** Get error type */
36 #define GET_ERROR_TYPE(errno) \
37     (error & 0xFF000000 >> 24)
38 /** Get error module */
39 #define GET_ERROR_MODULE(error) \
40     (error & 0x00FF0000 >> 16)
41 /** Get error API */
42 #define GET_ERROR_API(error) \
43     (error & 0x0000FF00 >> 8)
44 /** Get errno */
45 #define GET_ERROR_NUM(error) \
46     (error & 0x000000FF)
47 
48 #ifndef CSI_DRV_ERRNO_BASE
49 #define CSI_DRV_ERRNO_BASE                  0x81000000
50 #endif
51 
52 /** driver module id definition*/
53 #define CSI_DRV_ERRNO_GPIO_BASE             0x81010000
54 #define CSI_DRV_ERRNO_USART_BASE            0x81020000
55 #define CSI_DRV_ERRNO_SPI_BASE              0x81030000
56 #define CSI_DRV_ERRNO_IIC_BASE              0x81040000
57 #define CSI_DRV_ERRNO_PWM_BASE              0x81050000
58 #define CSI_DRV_ERRNO_RTC_BASE              0x81060000
59 #define CSI_DRV_ERRNO_TIMER_BASE            0x81070000
60 #define CSI_DRV_ERRNO_WDT_BASE              0x81080000
61 #define CSI_DRV_ERRNO_AES_BASE              0x81090000
62 #define CSI_DRV_ERRNO_CRC_BASE              0x810A0000
63 #define CSI_DRV_ERRNO_RSA_BASE              0x810B0000
64 #define CSI_DRV_ERRNO_SHA_BASE              0x810C0000
65 #define CSI_DRV_ERRNO_TRNG_BASE             0x810D0000
66 #define CSI_DRV_ERRNO_EFLASH_BASE           0x810E0000
67 #define CSI_DRV_ERRNO_DMA_BASE              0x810F0000
68 #define CSI_DRV_ERRNO_NORFLASH_BASE         0x81100000
69 #define CSI_DRV_ERRNO_INTC_BASE             0x81110000
70 #define CSI_DRV_ERRNO_SPU_BASE              0x81120000
71 #define CSI_DRV_ERRNO_ADC_BASE              0x81130000
72 #define CSI_DRV_ERRNO_PMU_BASE              0x81140000
73 #define CSI_DRV_ERRNO_BMU_BASE              0x81150000
74 #define CSI_DRV_ERRNO_ETB_BASE              0x81160000
75 #define CSI_DRV_ERRNO_I2S_BASE              0x81170000
76 #define CSI_DRV_ERRNO_USI_BASE              0x81180000
77 #define CSI_DRV_ERRNO_SPIFLASH_BASE         0x81190000
78 #define CSI_DRV_ERRNO_ACMP_BASE             0x811A0000
79 #define CSI_DRV_ERRNO_MAILBOX_BASE          0x811B0000
80 #define CSI_DRV_ERRNO_EFUSEC_BASE           0x811C0000
81 #define CSI_DRV_ERRNO_CODEC_BASE            0x811D0000
82 #define CSI_DRV_ERRNO_DPU_BASE              0x811E0000
83 #define CSI_DRV_ERRNO_VPU_BASE              0x811F0000
84 #define CSI_DRV_ERRNO_CAMERA_BASE           0x81200000
85 #define CSI_DRV_ERRNO_MIPI_CSI_BASE         0x81210000
86 #define CSI_DRV_ERRNO_MIPI_CSI_READER_BASE  0x81220000
87 #define CSI_DRV_ERRNO_GMAC_BASE             0x81230000
88 #define CSI_DRV_ERRNO_ETHPHY_BASE           0x81240000
89 #define CSI_DRV_ERRNO_QW_EFUSE_BASE         0x81250000
90 #define CSI_DRV_ERRNO_RESET_BASE            0x81260000
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* CSI_DRV_ERRNO_H */
97