4 * \brief Status code definitions.
6 * This file defines various status codes returned by functions,
7 * indicating success or failure as well as what kind of failure.
9 * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are met:
18 * 1. Redistributions of source code must retain the above copyright notice,
19 * this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright notice,
22 * this list of conditions and the following disclaimer in the documentation
23 * and/or other materials provided with the distribution.
25 * 3. The name of Atmel may not be used to endorse or promote products derived
26 * from this software without specific prior written permission.
28 * 4. This software may only be redistributed and used in connection with an
29 * Atmel microcontroller product.
31 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
32 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
34 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
35 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
40 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGE.
47 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
50 #ifndef STATUS_CODES_H_INCLUDED
51 #define STATUS_CODES_H_INCLUDED
56 * \defgroup group_sam0_utils_status_codes Status Codes
58 * \ingroup group_sam0_utils
63 /** Mask to retrieve the error category of a status code. */
64 #define STATUS_CATEGORY_MASK 0xF0
66 /** Mask to retrieve the error code within the category of a status code. */
67 #define STATUS_ERROR_MASK 0x0F
69 /** Status code error categories. */
70 enum status_categories {
71 STATUS_CATEGORY_OK = 0x00,
72 STATUS_CATEGORY_COMMON = 0x10,
73 STATUS_CATEGORY_ANALOG = 0x30,
74 STATUS_CATEGORY_COM = 0x40,
75 STATUS_CATEGORY_IO = 0x50,
79 * Status code that may be returned by shell commands and protocol
82 * \note Any change to these status codes and the corresponding
83 * message strings is strictly forbidden. New codes can be added,
84 * however, but make sure that any message string tables are updated
88 STATUS_OK = STATUS_CATEGORY_OK | 0x00,
89 STATUS_VALID_DATA = STATUS_CATEGORY_OK | 0x01,
90 STATUS_NO_CHANGE = STATUS_CATEGORY_OK | 0x02,
91 STATUS_ABORTED = STATUS_CATEGORY_OK | 0x04,
92 STATUS_BUSY = STATUS_CATEGORY_OK | 0x05,
93 STATUS_SUSPEND = STATUS_CATEGORY_OK | 0x06,
95 STATUS_ERR_IO = STATUS_CATEGORY_COMMON | 0x00,
96 STATUS_ERR_REQ_FLUSHED = STATUS_CATEGORY_COMMON | 0x01,
97 STATUS_ERR_TIMEOUT = STATUS_CATEGORY_COMMON | 0x02,
98 STATUS_ERR_BAD_DATA = STATUS_CATEGORY_COMMON | 0x03,
99 STATUS_ERR_NOT_FOUND = STATUS_CATEGORY_COMMON | 0x04,
100 STATUS_ERR_UNSUPPORTED_DEV = STATUS_CATEGORY_COMMON | 0x05,
101 STATUS_ERR_NO_MEMORY = STATUS_CATEGORY_COMMON | 0x06,
102 STATUS_ERR_INVALID_ARG = STATUS_CATEGORY_COMMON | 0x07,
103 STATUS_ERR_BAD_ADDRESS = STATUS_CATEGORY_COMMON | 0x08,
104 STATUS_ERR_BAD_FORMAT = STATUS_CATEGORY_COMMON | 0x0A,
105 STATUS_ERR_BAD_FRQ = STATUS_CATEGORY_COMMON | 0x0B,
106 STATUS_ERR_DENIED = STATUS_CATEGORY_COMMON | 0x0c,
107 STATUS_ERR_ALREADY_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0d,
108 STATUS_ERR_OVERFLOW = STATUS_CATEGORY_COMMON | 0x0e,
109 STATUS_ERR_NOT_INITIALIZED = STATUS_CATEGORY_COMMON | 0x0f,
111 STATUS_ERR_SAMPLERATE_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x00,
112 STATUS_ERR_RESOLUTION_UNAVAILABLE = STATUS_CATEGORY_ANALOG | 0x01,
114 STATUS_ERR_BAUDRATE_UNAVAILABLE = STATUS_CATEGORY_COM | 0x00,
115 STATUS_ERR_PACKET_COLLISION = STATUS_CATEGORY_COM | 0x01,
116 STATUS_ERR_PROTOCOL = STATUS_CATEGORY_COM | 0x02,
118 STATUS_ERR_PIN_MUX_INVALID = STATUS_CATEGORY_IO | 0x00,
120 typedef enum status_code status_code_genare_t;
123 Status codes used by MAC stack.
125 enum status_code_wireless {
126 //STATUS_OK = 0, //!< Success
127 ERR_IO_ERROR = -1, //!< I/O error
128 ERR_FLUSHED = -2, //!< Request flushed from queue
129 ERR_TIMEOUT = -3, //!< Operation timed out
130 ERR_BAD_DATA = -4, //!< Data integrity check failed
131 ERR_PROTOCOL = -5, //!< Protocol error
132 ERR_UNSUPPORTED_DEV = -6, //!< Unsupported device
133 ERR_NO_MEMORY = -7, //!< Insufficient memory
134 ERR_INVALID_ARG = -8, //!< Invalid argument
135 ERR_BAD_ADDRESS = -9, //!< Bad address
136 ERR_BUSY = -10, //!< Resource is busy
137 ERR_BAD_FORMAT = -11, //!< Data format not recognized
138 ERR_NO_TIMER = -12, //!< No timer available
139 ERR_TIMER_ALREADY_RUNNING = -13, //!< Timer already running
140 ERR_TIMER_NOT_RUNNING = -14, //!< Timer not running
143 * \brief Operation in progress
145 * This status code is for driver-internal use when an operation
146 * is currently being performed.
148 * \note Drivers should never return this status code to any
149 * callers. It is strictly for internal use.
151 OPERATION_IN_PROGRESS = -128,
154 typedef enum status_code_wireless status_code_t;
158 #endif /* STATUS_CODES_H_INCLUDED */