Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
111:4336505e4b1c
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 111:4336505e4b1c 1 #ifndef STATUS_CODES_H_INCLUDED
Kojto 111:4336505e4b1c 2 #define STATUS_CODES_H_INCLUDED
Kojto 111:4336505e4b1c 3
Kojto 111:4336505e4b1c 4 #include <stdint.h>
Kojto 111:4336505e4b1c 5
Kojto 111:4336505e4b1c 6 /**
Kojto 111:4336505e4b1c 7 * \defgroup group_sam0_utils_status_codes Status Codes
Kojto 111:4336505e4b1c 8 *
Kojto 111:4336505e4b1c 9 * \ingroup group_sam0_utils
Kojto 111:4336505e4b1c 10 *
Kojto 111:4336505e4b1c 11 * @{
Kojto 111:4336505e4b1c 12 */
Kojto 111:4336505e4b1c 13
Kojto 111:4336505e4b1c 14 /** Mask to retrieve the error category of a status code. */
Kojto 111:4336505e4b1c 15 #define STATUS_CATEGORY_MASK 0xF0
Kojto 111:4336505e4b1c 16
Kojto 111:4336505e4b1c 17 /** Mask to retrieve the error code within the category of a status code. */
Kojto 111:4336505e4b1c 18 #define STATUS_ERROR_MASK 0x0F
Kojto 111:4336505e4b1c 19
Kojto 111:4336505e4b1c 20 /** Status code error categories. */
Kojto 111:4336505e4b1c 21 enum status_categories {
Kojto 111:4336505e4b1c 22 STATUS_CATEGORY_OK = 0x00,
Kojto 111:4336505e4b1c 23 STATUS_CATEGORY_COMMON = 0x10,
Kojto 111:4336505e4b1c 24 STATUS_CATEGORY_ANALOG = 0x30,
Kojto 111:4336505e4b1c 25 STATUS_CATEGORY_COM = 0x40,
Kojto 111:4336505e4b1c 26 STATUS_CATEGORY_IO = 0x50,
Kojto 111:4336505e4b1c 27 };
Kojto 111:4336505e4b1c 28
Kojto 111:4336505e4b1c 29 /**
Kojto 111:4336505e4b1c 30 * Status code that may be returned by shell commands and protocol
Kojto 111:4336505e4b1c 31 * implementations.
Kojto 111:4336505e4b1c 32 *
Kojto 111:4336505e4b1c 33 * \note Any change to these status codes and the corresponding
Kojto 111:4336505e4b1c 34 * message strings is strictly forbidden. New codes can be added,
Kojto 111:4336505e4b1c 35 * however, but make sure that any message string tables are updated
Kojto 111:4336505e4b1c 36 * at the same time.
Kojto 111:4336505e4b1c 37 */
Kojto 111:4336505e4b1c 38 enum status_code {
Kojto 111:4336505e4b1c 39 STATUS_OK = STATUS_CATEGORY_OK | 0x00,
Kojto 111:4336505e4b1c 40 STATUS_VALID_DATA = STATUS_CATEGORY_OK | 0x01,
Kojto 111:4336505e4b1c 41 STATUS_NO_CHANGE = STATUS_CATEGORY_OK | 0x02,
Kojto 111:4336505e4b1c 42 STATUS_ABORTED = STATUS_CATEGORY_OK | 0x04,
Kojto 111:4336505e4b1c 43 STATUS_BUSY = STATUS_CATEGORY_OK | 0x05,
Kojto 111:4336505e4b1c 44 STATUS_SUSPEND = STATUS_CATEGORY_OK | 0x06,
Kojto 111:4336505e4b1c 45
Kojto 111:4336505e4b1c 46 STATUS_ERR_IO = STATUS_CATEGORY_COMMON | 0x00,
Kojto 111:4336505e4b1c 47 STATUS_ERR_REQ_FLUSHED = STATUS_CATEGORY_COMMON | 0x01,
Kojto 111:4336505e4b1c 48 STATUS_ERR_TIMEOUT = STATUS_CATEGORY_COMMON | 0x02,
Kojto 111:4336505e4b1c 49 STATUS_ERR_BAD_DATA = STATUS_CATEGORY_COMMON | 0x03,
Kojto 111:4336505e4b1c 50 STATUS_ERR_NOT_FOUND = STATUS_CATEGORY_COMMON | 0x04,
Kojto 111:4336505e4b1c 51 STATUS_ERR_UNSUPPORTED_DEV = STATUS_CATEGORY_COMMON | 0x05,
Kojto 111:4336505e4b1c 52 STATUS_ERR_NO_MEMORY = STATUS_CATEGORY_COMMON | 0x06,
Kojto 111:4336505e4b1c 53 STATUS_ERR_INVALID_ARG = STATUS_CATEGORY_COMMON | 0x07,
Kojto 111:4336505e4b1c 54 STATUS_ERR_BAD_ADDRESS = STATUS_CATEGORY_COMMON | 0x08,
Kojto 111:4336505e4b1c 55 STATUS_ERR_BAD_FORMAT = STATUS_CATEGORY_COMMON | 0x0A,
Kojto 111:4336505e4b1c 56 STATUS_ERR_BAD_FRQ = STATUS_CATEGORY_COMMON | 0x0B,
Kojto 111:4336505e4b1c 57 STATUS_ERR_DENIED = STATUS_CATEGORY_COMMON | 0x0c,
Kojto 111:4336505e4b1c 58 STATUS_ERR_ALREADY_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0d,
Kojto 111:4336505e4b1c 59 STATUS_ERR_OVERFLOW = STATUS_CATEGORY_COMMON | 0x0e,
Kojto 111:4336505e4b1c 60 STATUS_ERR_NOT_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0f,
Kojto 111:4336505e4b1c 61
Kojto 111:4336505e4b1c 62 STATUS_ERR_SAMPLERATE_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x00,
Kojto 111:4336505e4b1c 63 STATUS_ERR_RESOLUTION_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x01,
Kojto 111:4336505e4b1c 64
Kojto 111:4336505e4b1c 65 STATUS_ERR_BAUDRATE_UNAVAILABLE = STATUS_CATEGORY_COM | 0x00,
Kojto 111:4336505e4b1c 66 STATUS_ERR_PACKET_COLLISION = STATUS_CATEGORY_COM | 0x01,
Kojto 111:4336505e4b1c 67 STATUS_ERR_PROTOCOL = STATUS_CATEGORY_COM | 0x02,
Kojto 111:4336505e4b1c 68
Kojto 111:4336505e4b1c 69 STATUS_ERR_PIN_MUX_INVALID = STATUS_CATEGORY_IO | 0x00,
Kojto 111:4336505e4b1c 70 };
Kojto 111:4336505e4b1c 71 typedef enum status_code status_code_genare_t;
Kojto 111:4336505e4b1c 72
Kojto 111:4336505e4b1c 73 /**
Kojto 111:4336505e4b1c 74 Status codes used by MAC stack.
Kojto 111:4336505e4b1c 75 */
Kojto 111:4336505e4b1c 76 enum status_code_wireless {
Kojto 111:4336505e4b1c 77 //STATUS_OK = 0, //!< Success
Kojto 111:4336505e4b1c 78 ERR_IO_ERROR = -1, //!< I/O error
Kojto 111:4336505e4b1c 79 ERR_FLUSHED = -2, //!< Request flushed from queue
Kojto 111:4336505e4b1c 80 ERR_TIMEOUT = -3, //!< Operation timed out
Kojto 111:4336505e4b1c 81 ERR_BAD_DATA = -4, //!< Data integrity check failed
Kojto 111:4336505e4b1c 82 ERR_PROTOCOL = -5, //!< Protocol error
Kojto 111:4336505e4b1c 83 ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device
Kojto 111:4336505e4b1c 84 ERR_NO_MEMORY = -7, //!< Insufficient memory
Kojto 111:4336505e4b1c 85 ERR_INVALID_ARG = -8, //!< Invalid argument
Kojto 111:4336505e4b1c 86 ERR_BAD_ADDRESS = -9, //!< Bad address
Kojto 111:4336505e4b1c 87 ERR_BUSY = -10, //!< Resource is busy
Kojto 111:4336505e4b1c 88 ERR_BAD_FORMAT = -11, //!< Data format not recognized
Kojto 111:4336505e4b1c 89 ERR_NO_TIMER = -12, //!< No timer available
Kojto 111:4336505e4b1c 90 ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running
Kojto 111:4336505e4b1c 91 ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running
Kojto 111:4336505e4b1c 92
Kojto 111:4336505e4b1c 93 /**
Kojto 111:4336505e4b1c 94 * \brief Operation in progress
Kojto 111:4336505e4b1c 95 *
Kojto 111:4336505e4b1c 96 * This status code is for driver-internal use when an operation
Kojto 111:4336505e4b1c 97 * is currently being performed.
Kojto 111:4336505e4b1c 98 *
Kojto 111:4336505e4b1c 99 * \note Drivers should never return this status code to any
Kojto 111:4336505e4b1c 100 * callers. It is strictly for internal use.
Kojto 111:4336505e4b1c 101 */
Kojto 111:4336505e4b1c 102 OPERATION_IN_PROGRESS = -128,
Kojto 111:4336505e4b1c 103 };
Kojto 111:4336505e4b1c 104
Kojto 111:4336505e4b1c 105 typedef enum status_code_wireless status_code_t;
Kojto 111:4336505e4b1c 106
Kojto 111:4336505e4b1c 107 /** @} */
Kojto 111:4336505e4b1c 108
Kojto 111:4336505e4b1c 109 #endif /* STATUS_CODES_H_INCLUDED */