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