1 /* 2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /****************************************************************************** 17 * @file drv_errno.h 18 * @brief header file for error num 19 * @version V1.0 20 * @date 02. June 2017 21 ******************************************************************************/ 22 23 #ifndef _DRV_ERRNO_H_ 24 #define _DRV_ERRNO_H_ 25 26 27 #include <errno.h> 28 29 #define ERRNO_DRV_START 0X80 30 31 /* driver General error codes */ 32 typedef enum { 33 DRV_ERROR = ERRNO_DRV_START, ///< Unspecified error 34 DRV_ERROR_BUSY, ///< Driver is busy 35 DRV_ERROR_TIMEOUT, ///< Timeout occurred 36 DRV_ERROR_UNSUPPORTED, ///< Operation not supported 37 DRV_ERROR_PARAMETER, ///< Parameter error 38 DRV_ERROR_SPECIFIC ///< Start of driver specific errors 39 } drv_err_e; 40 41 42 /** Get error type */ 43 #define GET_ERROR_TYPE(errno) \ 44 (error & 0xFF000000 >> 24) 45 /** Get error module */ 46 #define GET_ERROR_MODULE(error) \ 47 (error & 0x00FF0000 >> 16) 48 /** Get error API */ 49 #define GET_ERROR_API(error) \ 50 (error & 0x0000FF00 >> 8) 51 /** Get errno */ 52 #define GET_ERROR_NUM(error) \ 53 (error & 0x000000FF) 54 55 #ifndef CSI_DRV_ERRNO_BASE 56 #define CSI_DRV_ERRNO_BASE 0x81000000 57 #endif 58 59 /** driver module id definition*/ 60 #define CSI_DRV_ERRNO_GPIO_BASE 0x81010000 61 #define CSI_DRV_ERRNO_USART_BASE 0x81020000 62 #define CSI_DRV_ERRNO_SPI_BASE 0x81030000 63 #define CSI_DRV_ERRNO_IIC_BASE 0x81040000 64 #define CSI_DRV_ERRNO_PWM_BASE 0x81050000 65 #define CSI_DRV_ERRNO_RTC_BASE 0x81060000 66 #define CSI_DRV_ERRNO_TIMER_BASE 0x81070000 67 #define CSI_DRV_ERRNO_WDT_BASE 0x81080000 68 #define CSI_DRV_ERRNO_AES_BASE 0x81090000 69 #define CSI_DRV_ERRNO_CRC_BASE 0x810A0000 70 #define CSI_DRV_ERRNO_RSA_BASE 0x810B0000 71 #define CSI_DRV_ERRNO_SHA_BASE 0x810C0000 72 #define CSI_DRV_ERRNO_TRNG_BASE 0x810D0000 73 #define CSI_DRV_ERRNO_EFLASH_BASE 0x810E0000 74 #define CSI_DRV_ERRNO_DMA_BASE 0x811F0000 75 #define CSI_DRV_ERRNO_NORFLASH_BASE 0x81100000 76 #define CSI_DRV_ERRNO_INTC_BASE 0x81110000 77 #define CSI_DRV_ERRNO_SPU_BASE 0x81120000 78 #define CSI_DRV_ERRNO_ADC_BASE 0x81130000 79 #define CSI_DRV_ERRNO_PMU_BASE 0x81140000 80 #define CSI_DRV_ERRNO_BMU_BASE 0x81150000 81 #define CSI_DRV_ERRNO_ETB_BASE 0x81160000 82 #define CSI_DRV_ERRNO_I2S_BASE 0x81170000 83 #define CSI_DRV_ERRNO_USI_BASE 0x81180000 84 #define CSI_DRV_ERRNO_SPIFLASH_BASE 0x81190000 85 #define CSI_DRV_ERRNO_ACMP_BASE 0x811A0000 86 87 #endif /* CSI_DRV_ERRNO_H */ 88