drv_errno.h 3.3 KB

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