status_codes.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * \file
  3. *
  4. * \brief Status code definitions.
  5. *
  6. * This file defines various status codes returned by functions,
  7. * indicating success or failure as well as what kind of failure.
  8. *
  9. * Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
  10. *
  11. * \asf_license_start
  12. *
  13. * \page License
  14. *
  15. * Subject to your compliance with these terms, you may use Microchip
  16. * software and any derivatives exclusively with Microchip products.
  17. * It is your responsibility to comply with third party license terms applicable
  18. * to your use of third party software (including open source software) that
  19. * may accompany Microchip software.
  20. *
  21. * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
  22. * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
  23. * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
  24. * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
  25. * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
  26. * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
  27. * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
  28. * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
  29. * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
  30. * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  31. * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
  32. *
  33. * \asf_license_stop
  34. *
  35. */
  36. /*
  37. * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
  38. */
  39. #ifndef STATUS_CODES_H_INCLUDED
  40. #define STATUS_CODES_H_INCLUDED
  41. /**
  42. * \defgroup group_avr32_utils_status_codes Status Codes
  43. *
  44. * \ingroup group_avr32_utils
  45. *
  46. * \{
  47. */
  48. /* Note: this is a local workaround to avoid a pre-processor clash due to the
  49. * lwIP macro ERR_TIMEOUT. */
  50. #if defined(__LWIP_ERR_H__) && defined(ERR_TIMEOUT)
  51. #if (ERR_TIMEOUT != -3)
  52. /* Internal check to make sure that the later restore of lwIP's ERR_TIMEOUT
  53. * macro is set to the correct value. Note that it is highly improbable that
  54. * this value ever changes in lwIP. */
  55. #error ASF developers: check lwip err.h new value for ERR_TIMEOUT
  56. #endif
  57. #undef ERR_TIMEOUT
  58. #endif
  59. /**
  60. * Status code that may be returned by shell commands and protocol
  61. * implementations.
  62. *
  63. * \note Any change to these status codes and the corresponding
  64. * message strings is strictly forbidden. New codes can be added,
  65. * however, but make sure that any message string tables are updated
  66. * at the same time.
  67. */
  68. enum status_code {
  69. STATUS_OK = 0, //!< Success
  70. ERR_IO_ERROR = -1, //!< I/O error
  71. ERR_FLUSHED = -2, //!< Request flushed from queue
  72. ERR_TIMEOUT = -3, //!< Operation timed out
  73. ERR_BAD_DATA = -4, //!< Data integrity check failed
  74. ERR_PROTOCOL = -5, //!< Protocol error
  75. ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device
  76. ERR_NO_MEMORY = -7, //!< Insufficient memory
  77. ERR_INVALID_ARG = -8, //!< Invalid argument
  78. ERR_BAD_ADDRESS = -9, //!< Bad address
  79. ERR_BUSY = -10, //!< Resource is busy
  80. ERR_BAD_FORMAT = -11, //!< Data format not recognized
  81. ERR_NO_TIMER = -12, //!< No timer available
  82. ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running
  83. ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running
  84. /**
  85. * \brief Operation in progress
  86. *
  87. * This status code is for driver-internal use when an operation
  88. * is currently being performed.
  89. *
  90. * \note Drivers should never return this status code to any
  91. * callers. It is strictly for internal use.
  92. */
  93. OPERATION_IN_PROGRESS = -128,
  94. };
  95. typedef enum status_code status_code_t;
  96. #if defined(__LWIP_ERR_H__)
  97. #define ERR_TIMEOUT -3
  98. #endif
  99. /**
  100. * \}
  101. */
  102. #endif /* STATUS_CODES_H_INCLUDED */