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 /**
43  * \defgroup group_avr32_utils_status_codes Status Codes
44  *
45  * \ingroup group_avr32_utils
46  *
47  * \{
48  */
49 
50 /* Note: this is a local workaround to avoid a pre-processor clash due to the
51  * lwIP macro ERR_TIMEOUT. */
52 #if defined(__LWIP_ERR_H__) && defined(ERR_TIMEOUT)
53 #if (ERR_TIMEOUT != -3)
54 
55 /* Internal check to make sure that the later restore of lwIP's ERR_TIMEOUT
56  * macro is set to the correct value. Note that it is highly improbable that
57  * this value ever changes in lwIP. */
58 #error ASF developers: check lwip err.h new value for ERR_TIMEOUT
59 #endif
60 #undef ERR_TIMEOUT
61 #endif
62 
63 /**
64  * Status code that may be returned by shell commands and protocol
65  * implementations.
66  *
67  * \note Any change to these status codes and the corresponding
68  * message strings is strictly forbidden. New codes can be added,
69  * however, but make sure that any message string tables are updated
70  * at the same time.
71  */
72 enum status_code {
73 	STATUS_OK               =  0, //!< Success
74 	ERR_IO_ERROR            =  -1, //!< I/O error
75 	ERR_FLUSHED             =  -2, //!< Request flushed from queue
76 	ERR_TIMEOUT             =  -3, //!< Operation timed out
77 	ERR_BAD_DATA            =  -4, //!< Data integrity check failed
78 	ERR_PROTOCOL            =  -5, //!< Protocol error
79 	ERR_UNSUPPORTED_DEV     =  -6, //!< Unsupported device
80 	ERR_NO_MEMORY           =  -7, //!< Insufficient memory
81 	ERR_INVALID_ARG         =  -8, //!< Invalid argument
82 	ERR_BAD_ADDRESS         =  -9, //!< Bad address
83 	ERR_BUSY                =  -10, //!< Resource is busy
84 	ERR_BAD_FORMAT          =  -11, //!< Data format not recognized
85 	ERR_NO_TIMER            =  -12, //!< No timer available
86 	ERR_TIMER_ALREADY_RUNNING   =  -13, //!< Timer already running
87 	ERR_TIMER_NOT_RUNNING   =  -14, //!< Timer not running
88 
89 	/**
90 	 * \brief Operation in progress
91 	 *
92 	 * This status code is for driver-internal use when an operation
93 	 * is currently being performed.
94 	 *
95 	 * \note Drivers should never return this status code to any
96 	 * callers. It is strictly for internal use.
97 	 */
98 	OPERATION_IN_PROGRESS	= -128,
99 };
100 
101 typedef enum status_code status_code_t;
102 
103 #if defined(__LWIP_ERR_H__)
104 #define ERR_TIMEOUT -3
105 #endif
106 
107 /**
108  * \}
109  */
110 
111 #endif /* STATUS_CODES_H_INCLUDED */
112