xref: /btstack/port/samv71-xplained-atwilc3000/ASF/sam/utils/status_codes.h (revision 1b2596b5303dd8caeea8565532c93cca8dab8cc4)
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) 2011-2015 Atmel Corporation. All rights reserved.
10  *
11  * \asf_license_start
12  *
13  * \page License
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright notice,
19  *    this list of conditions and the following disclaimer.
20  *
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.
24  *
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.
27  *
28  * 4. This software may only be redistributed and used in connection with an
29  *    Atmel microcontroller product.
30  *
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.
42  *
43  * \asf_license_stop
44  *
45  */
46 /*
47  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
48  */
49 
50 #ifndef STATUS_CODES_H_INCLUDED
51 #define STATUS_CODES_H_INCLUDED
52 
53 /* Note: this is a local workaround to avoid a pre-processor clash due to the
54  * lwIP macro ERR_TIMEOUT. */
55 #if defined(__LWIP_ERR_H__) && defined(ERR_TIMEOUT)
56 #if (ERR_TIMEOUT != -3)
57 
58 /* Internal check to make sure that the later restore of lwIP's ERR_TIMEOUT
59  * macro is set to the correct value. Note that it is highly improbable that
60  * this value ever changes in lwIP. */
61 #error ASF developers: check lwip err.h new value for ERR_TIMEOUT
62 #endif
63 #undef ERR_TIMEOUT
64 #endif
65 
66 /**
67  * Status code that may be returned by shell commands and protocol
68  * implementations.
69  *
70  * \note Any change to these status codes and the corresponding
71  * message strings is strictly forbidden. New codes can be added,
72  * however, but make sure that any message string tables are updated
73  * at the same time.
74  */
75 enum status_code {
76 	STATUS_OK               =  0, //!< Success
77 	STATUS_ERR_BUSY         =  0x19,
78 	STATUS_ERR_DENIED       =  0x1C,
79 	STATUS_ERR_TIMEOUT      =  0x12,
80 	ERR_IO_ERROR            =  -1, //!< I/O error
81 	ERR_FLUSHED             =  -2, //!< Request flushed from queue
82 	ERR_TIMEOUT             =  -3, //!< Operation timed out
83 	ERR_BAD_DATA            =  -4, //!< Data integrity check failed
84 	ERR_PROTOCOL            =  -5, //!< Protocol error
85 	ERR_UNSUPPORTED_DEV     =  -6, //!< Unsupported device
86 	ERR_NO_MEMORY           =  -7, //!< Insufficient memory
87 	ERR_INVALID_ARG         =  -8, //!< Invalid argument
88 	ERR_BAD_ADDRESS         =  -9, //!< Bad address
89 	ERR_BUSY                =  -10, //!< Resource is busy
90 	ERR_BAD_FORMAT          =  -11, //!< Data format not recognized
91 	ERR_NO_TIMER            =  -12, //!< No timer available
92 	ERR_TIMER_ALREADY_RUNNING   =  -13, //!< Timer already running
93 	ERR_TIMER_NOT_RUNNING   =  -14, //!< Timer not running
94 	ERR_ABORTED             =  -15, //!< Operation aborted by user
95 	/**
96 	 * \brief Operation in progress
97 	 *
98 	 * This status code is for driver-internal use when an operation
99 	 * is currently being performed.
100 	 *
101 	 * \note Drivers should never return this status code to any
102 	 * callers. It is strictly for internal use.
103 	 */
104 	OPERATION_IN_PROGRESS	= -128,
105 };
106 
107 typedef enum status_code status_code_t;
108 
109 #if defined(__LWIP_ERR_H__)
110 #define ERR_TIMEOUT -3
111 #endif
112 
113 #endif /* STATUS_CODES_H_INCLUDED */
114