errors.h 3.2 KB

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