Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
ca821x_error.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
40 #ifndef CA821X_API_INCLUDE_CA821X_ERROR_H_
41 #define CA821X_API_INCLUDE_CA821X_ERROR_H_
42 
43 #include "ca821x_toolchain.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
50 typedef enum ca_error
51 {
52  /*General Errors*/
54  CA_ERROR_FAIL = 0x01,
59  CA_ERROR_BUSY = 0x06,
67  /* SPI Errors*/
73 
79 const char *ca_error_str(ca_error aError);
80 
82 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L || __cpp_static_assert >= 200410
83 #define ca_static_assert(x) static_assert(x, #x)
84 #elif !defined(__cplusplus) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && \
85  (__STDC_VERSION__ > 199901L)
86 #define ca_static_assert(x) _Static_assert(x, #x)
87 #else
88 #define ca_static_assert(x) typedef char static_assertion[(x) ? 1 : -1]
89 #endif
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
99 #endif /* CA821X_API_INCLUDE_CA821X_ERROR_H_ */
Preprocessor defines for coping with different toolchains.
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
const char * ca_error_str(ca_error aError)
Return a string representation of a ca_error.
Definition: ca821x_error.c:31
@ CA_ERROR_TIMEOUT
Operation timed out.
Definition: ca821x_error.h:64
@ CA_ERROR_SPI_SEND_EXCHANGE_FAIL
SPI Message failed to send.
Definition: ca821x_error.h:71
@ CA_ERROR_BUSY
Busy, try again.
Definition: ca821x_error.h:59
@ CA_ERROR_NO_BUFFER
No buffers currently available.
Definition: ca821x_error.h:63
@ CA_ERROR_ALREADY
Operation already executed.
Definition: ca821x_error.h:65
@ CA_ERROR_NOT_HANDLED
Request has not been handled.
Definition: ca821x_error.h:61
@ CA_ERROR_INVALID_ARGS
Invalid arguments.
Definition: ca821x_error.h:60
@ CA_ERROR_SPI_NACK_TIMEOUT
SPI NACKing for too long.
Definition: ca821x_error.h:69
@ CA_ERROR_NOT_FOUND
Requested resource not found.
Definition: ca821x_error.h:62
@ CA_ERROR_INVALID
Invalid request.
Definition: ca821x_error.h:56
@ CA_ERROR_FAIL
Failed for miscellaneous reason.
Definition: ca821x_error.h:54
@ CA_ERROR_SUCCESS
Success.
Definition: ca821x_error.h:53
@ CA_ERROR_INVALID_STATE
Request cannot be processed in current state.
Definition: ca821x_error.h:58
@ CA_ERROR_NO_ACCESS
Cannot access requested resource.
Definition: ca821x_error.h:57
@ CA_ERROR_SPI_WAIT_TIMEOUT
SPI Wait timed out.
Definition: ca821x_error.h:68
@ CA_ERROR_UNKNOWN
Request for unknown data.
Definition: ca821x_error.h:55
@ CA_ERROR_SPI_SCAN_IN_PROGRESS
CA-821x is scanning and cannot be used.
Definition: ca821x_error.h:70
@ CA_ERROR_NOT_IMPLEMENTED
Functionality not implemented.
Definition: ca821x_error.h:66