errors.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**************************************************************************/
  2. /*!
  3. @file errors.h
  4. @author hathach (tinyusb.org)
  5. @section LICENSE
  6. Software License Agreement (BSD License)
  7. Copyright (c) 2013, hathach (tinyusb.org)
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. 1. Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. 2. Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. 3. Neither the name of the copyright holders nor the
  17. names of its contributors may be used to endorse or promote products
  18. derived from this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
  20. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
  23. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. This file is part of the tinyusb stack.
  30. */
  31. /**************************************************************************/
  32. /** \file
  33. * \brief Error Header
  34. *
  35. * \note TBD
  36. */
  37. /** \ingroup Group_Common
  38. * \defgroup Group_Error Error Codes
  39. * @{
  40. */
  41. #ifndef _TUSB_ERRORS_H_
  42. #define _TUSB_ERRORS_H_
  43. #include "tusb_option.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. #define ERROR_ENUM(x) x,
  48. #define ERROR_STRING(x) #x,
  49. #define ERROR_TABLE(ENTRY) \
  50. ENTRY(TUSB_ERROR_NONE )\
  51. ENTRY(TUSB_ERROR_INVALID_PARA )\
  52. ENTRY(TUSB_ERROR_DEVICE_NOT_READY )\
  53. ENTRY(TUSB_ERROR_INTERFACE_IS_BUSY )\
  54. ENTRY(TUSB_ERROR_HCD_FAILED )\
  55. ENTRY(TUSB_ERROR_HCD_OPEN_PIPE_FAILED )\
  56. ENTRY(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND )\
  57. ENTRY(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG )\
  58. ENTRY(TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED )\
  59. ENTRY(TUSB_ERROR_OSAL_TIMEOUT )\
  60. ENTRY(TUSB_ERROR_OSAL_WAITING ) /* only used by OSAL_NONE in the subtask */ \
  61. ENTRY(TUSB_ERROR_OSAL_TASK_FAILED )\
  62. ENTRY(TUSB_ERROR_OSAL_TASK_CREATE_FAILED )\
  63. ENTRY(TUSB_ERROR_OSAL_QUEUE_FAILED )\
  64. ENTRY(TUSB_ERROR_OSAL_SEMAPHORE_FAILED )\
  65. ENTRY(TUSB_ERROR_OSAL_MUTEX_FAILED )\
  66. ENTRY(TUSB_ERROR_EHCI_NOT_ENOUGH_QTD )\
  67. ENTRY(TUSB_ERROR_USBD_DESCRIPTOR_STRING )\
  68. ENTRY(TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE )\
  69. ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL )\
  70. ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS )\
  71. ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_SUBCLASS )\
  72. ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_PROTOCOL )\
  73. ENTRY(TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED )\
  74. ENTRY(TUSB_ERROR_MSCH_UNSUPPORTED_PROTOCOL )\
  75. ENTRY(TUSB_ERROR_MSCH_UNKNOWN_SCSI_COMMAND )\
  76. ENTRY(TUSB_ERROR_MSCH_DEVICE_NOT_MOUNTED )\
  77. ENTRY(TUSB_ERROR_NOT_SUPPORTED_YET )\
  78. ENTRY(TUSB_ERROR_FAILED )\
  79. /** \enum tusb_error_t
  80. * \brief Error Code returned
  81. */
  82. typedef enum {
  83. ERROR_TABLE(ERROR_ENUM)
  84. TUSB_ERROR_COUNT
  85. }tusb_error_t;
  86. #if TUSB_CFG_DEBUG == 3
  87. /// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
  88. extern char const* const TUSB_ErrorStr[];
  89. #endif
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /* _TUSB_ERRORS_H_ */
  94. /** @} */