ST25R3911 library for the STMicroelectronics X-NUCLEO-NFC05A1

Dependents:   mbed-os-nfc05a1

Committer:
DiegoOstuni
Date:
Thu Nov 14 14:36:52 2019 +0000
Revision:
0:98fcd1266df0
Fork of the GitHub

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DiegoOstuni 0:98fcd1266df0 1
DiegoOstuni 0:98fcd1266df0 2 /******************************************************************************
DiegoOstuni 0:98fcd1266df0 3 * @attention
DiegoOstuni 0:98fcd1266df0 4 *
DiegoOstuni 0:98fcd1266df0 5 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
DiegoOstuni 0:98fcd1266df0 6 *
DiegoOstuni 0:98fcd1266df0 7 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
DiegoOstuni 0:98fcd1266df0 8 * You may not use this file except in compliance with the License.
DiegoOstuni 0:98fcd1266df0 9 * You may obtain a copy of the License at:
DiegoOstuni 0:98fcd1266df0 10 *
DiegoOstuni 0:98fcd1266df0 11 * http://www.st.com/myliberty
DiegoOstuni 0:98fcd1266df0 12 *
DiegoOstuni 0:98fcd1266df0 13 * Unless required by applicable law or agreed to in writing, software
DiegoOstuni 0:98fcd1266df0 14 * distributed under the License is distributed on an "AS IS" BASIS,
DiegoOstuni 0:98fcd1266df0 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
DiegoOstuni 0:98fcd1266df0 16 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
DiegoOstuni 0:98fcd1266df0 17 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
DiegoOstuni 0:98fcd1266df0 18 * See the License for the specific language governing permissions and
DiegoOstuni 0:98fcd1266df0 19 * limitations under the License.
DiegoOstuni 0:98fcd1266df0 20 *
DiegoOstuni 0:98fcd1266df0 21 ******************************************************************************/
DiegoOstuni 0:98fcd1266df0 22
DiegoOstuni 0:98fcd1266df0 23
DiegoOstuni 0:98fcd1266df0 24 /*
DiegoOstuni 0:98fcd1266df0 25 * PROJECT: STxxxx firmware
DiegoOstuni 0:98fcd1266df0 26 * LANGUAGE: ISO C99
DiegoOstuni 0:98fcd1266df0 27 */
DiegoOstuni 0:98fcd1266df0 28
DiegoOstuni 0:98fcd1266df0 29 /*! \file st_errno.h
DiegoOstuni 0:98fcd1266df0 30 *
DiegoOstuni 0:98fcd1266df0 31 * \author
DiegoOstuni 0:98fcd1266df0 32 *
DiegoOstuni 0:98fcd1266df0 33 * \brief Main error codes
DiegoOstuni 0:98fcd1266df0 34 *
DiegoOstuni 0:98fcd1266df0 35 */
DiegoOstuni 0:98fcd1266df0 36
DiegoOstuni 0:98fcd1266df0 37 #ifndef ST_ERRNO_H
DiegoOstuni 0:98fcd1266df0 38 #define ST_ERRNO_H
DiegoOstuni 0:98fcd1266df0 39
DiegoOstuni 0:98fcd1266df0 40 /*
DiegoOstuni 0:98fcd1266df0 41 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 42 * INCLUDES
DiegoOstuni 0:98fcd1266df0 43 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 44 */
DiegoOstuni 0:98fcd1266df0 45
DiegoOstuni 0:98fcd1266df0 46 #include "mbed.h"
DiegoOstuni 0:98fcd1266df0 47
DiegoOstuni 0:98fcd1266df0 48 /*
DiegoOstuni 0:98fcd1266df0 49 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 50 * GLOBAL DATA TYPES
DiegoOstuni 0:98fcd1266df0 51 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 52 */
DiegoOstuni 0:98fcd1266df0 53
DiegoOstuni 0:98fcd1266df0 54 typedef uint16_t ReturnCode; /*!< Standard Return Code type from function. */
DiegoOstuni 0:98fcd1266df0 55
DiegoOstuni 0:98fcd1266df0 56 /*
DiegoOstuni 0:98fcd1266df0 57 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 58 * DEFINES
DiegoOstuni 0:98fcd1266df0 59 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 60 */
DiegoOstuni 0:98fcd1266df0 61
DiegoOstuni 0:98fcd1266df0 62
DiegoOstuni 0:98fcd1266df0 63 /*
DiegoOstuni 0:98fcd1266df0 64 * Error codes to be used within the application.
DiegoOstuni 0:98fcd1266df0 65 * They are represented by an uint8_t
DiegoOstuni 0:98fcd1266df0 66 */
DiegoOstuni 0:98fcd1266df0 67 enum {
DiegoOstuni 0:98fcd1266df0 68 ERR_NONE = 0, /*!< no error occurred */
DiegoOstuni 0:98fcd1266df0 69 ERR_NOMEM = 1, /*!< not enough memory to perform the requested operation */
DiegoOstuni 0:98fcd1266df0 70 ERR_BUSY = 2, /*!< device or resource busy */
DiegoOstuni 0:98fcd1266df0 71 ERR_IO = 3, /*!< generic IO error */
DiegoOstuni 0:98fcd1266df0 72 ERR_TIMEOUT = 4, /*!< error due to timeout */
DiegoOstuni 0:98fcd1266df0 73 ERR_REQUEST = 5, /*!< invalid request or requested function can't be executed at the moment */
DiegoOstuni 0:98fcd1266df0 74 ERR_NOMSG = 6, /*!< No message of desired type */
DiegoOstuni 0:98fcd1266df0 75 ERR_PARAM = 7, /*!< Parameter error */
DiegoOstuni 0:98fcd1266df0 76 ERR_SYSTEM = 8, /*!< System error */
DiegoOstuni 0:98fcd1266df0 77 ERR_FRAMING = 9, /*!< Framing error */
DiegoOstuni 0:98fcd1266df0 78 ERR_OVERRUN = 10, /*!< lost one or more received bytes */
DiegoOstuni 0:98fcd1266df0 79 ERR_PROTO = 11, /*!< protocol error */
DiegoOstuni 0:98fcd1266df0 80 ERR_INTERNAL = 12, /*!< Internal Error */
DiegoOstuni 0:98fcd1266df0 81 ERR_AGAIN = 13, /*!< Call again */
DiegoOstuni 0:98fcd1266df0 82 ERR_MEM_CORRUPT = 14, /*!< memory corruption */
DiegoOstuni 0:98fcd1266df0 83 ERR_NOT_IMPLEMENTED = 15, /*!< not implemented */
DiegoOstuni 0:98fcd1266df0 84 ERR_PC_CORRUPT = 16, /*!< Program Counter has been manipulated or spike/noise trigger illegal operation */
DiegoOstuni 0:98fcd1266df0 85 ERR_SEND = 17, /*!< error sending*/
DiegoOstuni 0:98fcd1266df0 86 ERR_IGNORE = 18, /*!< indicates error detected but to be ignored */
DiegoOstuni 0:98fcd1266df0 87 ERR_SEMANTIC = 19, /*!< indicates error in state machine (unexpected cmd) */
DiegoOstuni 0:98fcd1266df0 88 ERR_SYNTAX = 20, /*!< indicates error in state machine (unknown cmd) */
DiegoOstuni 0:98fcd1266df0 89 ERR_CRC = 21, /*!< crc error */
DiegoOstuni 0:98fcd1266df0 90 ERR_NOTFOUND = 22, /*!< transponder not found */
DiegoOstuni 0:98fcd1266df0 91 ERR_NOTUNIQUE = 23, /*!< transponder not unique - more than one transponder in field */
DiegoOstuni 0:98fcd1266df0 92 ERR_NOTSUPP = 24, /*!< requested operation not supported */
DiegoOstuni 0:98fcd1266df0 93 ERR_WRITE = 25, /*!< write error */
DiegoOstuni 0:98fcd1266df0 94 ERR_FIFO = 26, /*!< fifo over or underflow error */
DiegoOstuni 0:98fcd1266df0 95 ERR_PAR = 27, /*!< parity error */
DiegoOstuni 0:98fcd1266df0 96 ERR_DONE = 28, /*!< transfer has already finished */
DiegoOstuni 0:98fcd1266df0 97 ERR_RF_COLLISION = 29, /*!< collision error (Bit Collision or during RF Collision avoidance ) */
DiegoOstuni 0:98fcd1266df0 98 ERR_HW_OVERRUN = 30, /*!< lost one or more received bytes */
DiegoOstuni 0:98fcd1266df0 99 ERR_RELEASE_REQ = 31, /*!< device requested release */
DiegoOstuni 0:98fcd1266df0 100 ERR_SLEEP_REQ = 32, /*!< device requested sleep */
DiegoOstuni 0:98fcd1266df0 101 ERR_WRONG_STATE = 33, /*!< incorrent state for requested operation */
DiegoOstuni 0:98fcd1266df0 102 ERR_MAX_RERUNS = 34, /*!< blocking procedure reached maximum runs */
DiegoOstuni 0:98fcd1266df0 103 ERR_DISABLED = 35, /*!< operation aborted due to disabled configuration */
DiegoOstuni 0:98fcd1266df0 104 ERR_HW_MISMATCH = 36, /*!< expected hw do not match */
DiegoOstuni 0:98fcd1266df0 105 ERR_LINK_LOSS = 37, /*!< Other device's field didn't behave as expected: turned off by Initiator in Passive mode, or AP2P did not turn on field */
DiegoOstuni 0:98fcd1266df0 106 ERR_INVALID_HANDLE = 38, /*!< invalid or not initalized device handle */
DiegoOstuni 0:98fcd1266df0 107
DiegoOstuni 0:98fcd1266df0 108 ERR_INCOMPLETE_BYTE = 40, /*!< Incomplete byte rcvd */
DiegoOstuni 0:98fcd1266df0 109 ERR_INCOMPLETE_BYTE_01 = 41, /*!< Incomplete byte rcvd - 1 bit */
DiegoOstuni 0:98fcd1266df0 110 ERR_INCOMPLETE_BYTE_02 = 42, /*!< Incomplete byte rcvd - 2 bit */
DiegoOstuni 0:98fcd1266df0 111 ERR_INCOMPLETE_BYTE_03 = 43, /*!< Incomplete byte rcvd - 3 bit */
DiegoOstuni 0:98fcd1266df0 112 ERR_INCOMPLETE_BYTE_04 = 44, /*!< Incomplete byte rcvd - 4 bit */
DiegoOstuni 0:98fcd1266df0 113 ERR_INCOMPLETE_BYTE_05 = 45, /*!< Incomplete byte rcvd - 5 bit */
DiegoOstuni 0:98fcd1266df0 114 ERR_INCOMPLETE_BYTE_06 = 46, /*!< Incomplete byte rcvd - 6 bit */
DiegoOstuni 0:98fcd1266df0 115 ERR_INCOMPLETE_BYTE_07 = 47 /*!< Incomplete byte rcvd - 7 bit */
DiegoOstuni 0:98fcd1266df0 116 };
DiegoOstuni 0:98fcd1266df0 117
DiegoOstuni 0:98fcd1266df0 118
DiegoOstuni 0:98fcd1266df0 119 /* General Sub-category number */
DiegoOstuni 0:98fcd1266df0 120 #define ERR_GENERIC_GRP (0x0000) /*!< Reserved value for generic error no */
DiegoOstuni 0:98fcd1266df0 121 #define ERR_WARN_GRP (0x0100) /*!< Errors which are not expected in normal operation */
DiegoOstuni 0:98fcd1266df0 122 #define ERR_PROCESS_GRP (0x0200) /*!< Processes management errors */
DiegoOstuni 0:98fcd1266df0 123 #define ERR_SIO_GRP (0x0800) /*!< SIO errors due to logging */
DiegoOstuni 0:98fcd1266df0 124 #define ERR_RINGBUF_GRP (0x0900) /*!< Ring Buffer errors */
DiegoOstuni 0:98fcd1266df0 125 #define ERR_MQ_GRP (0x0A00) /*!< MQ errors */
DiegoOstuni 0:98fcd1266df0 126 #define ERR_TIMER_GRP (0x0B00) /*!< Timer errors */
DiegoOstuni 0:98fcd1266df0 127 #define ERR_RFAL_GRP (0x0C00) /*!< RFAL errors */
DiegoOstuni 0:98fcd1266df0 128 #define ERR_UART_GRP (0x0D00) /*!< UART errors */
DiegoOstuni 0:98fcd1266df0 129 #define ERR_SPI_GRP (0x0E00) /*!< SPI errors */
DiegoOstuni 0:98fcd1266df0 130 #define ERR_I2C_GRP (0x0F00) /*!< I2c errors */
DiegoOstuni 0:98fcd1266df0 131
DiegoOstuni 0:98fcd1266df0 132
DiegoOstuni 0:98fcd1266df0 133 #define ERR_INSERT_SIO_GRP(x) (ERR_SIO_GRP | x) /*!< Insert the SIO grp */
DiegoOstuni 0:98fcd1266df0 134 #define ERR_INSERT_RINGBUF_GRP(x) (ERR_RINGBUF_GRP | x) /*!< Insert the Ring Buffer grp */
DiegoOstuni 0:98fcd1266df0 135 #define ERR_INSERT_RFAL_GRP(x) (ERR_RFAL_GRP | x) /*!< Insert the RFAL grp */
DiegoOstuni 0:98fcd1266df0 136 #define ERR_INSERT_SPI_GRP(x) (ERR_SPI_GRP | x) /*!< Insert the spi grp */
DiegoOstuni 0:98fcd1266df0 137 #define ERR_INSERT_I2C_GRP(x) (ERR_I2C_GRP | x) /*!< Insert the i2c grp */
DiegoOstuni 0:98fcd1266df0 138 #define ERR_INSERT_UART_GRP(x) (ERR_UART_GRP | x) /*!< Insert the uart grp */
DiegoOstuni 0:98fcd1266df0 139 #define ERR_INSERT_TIMER_GRP(x) (ERR_TIMER_GRP | x) /*!< Insert the timer grp */
DiegoOstuni 0:98fcd1266df0 140 #define ERR_INSERT_MQ_GRP(x) (ERR_MQ_GRP | x) /*!< Insert the mq grp */
DiegoOstuni 0:98fcd1266df0 141 #define ERR_INSERT_PROCESS_GRP(x) (ERR_PROCESS_GRP | x) /*!< Insert the process grp */
DiegoOstuni 0:98fcd1266df0 142 #define ERR_INSERT_WARN_GRP(x) (ERR_WARN_GRP | x) /*!< Insert the i2c grp */
DiegoOstuni 0:98fcd1266df0 143 #define ERR_INSERT_GENERIC_GRP(x) (ERR_GENERIC_GRP | x) /*!< Insert the generic grp */
DiegoOstuni 0:98fcd1266df0 144
DiegoOstuni 0:98fcd1266df0 145
DiegoOstuni 0:98fcd1266df0 146 /*
DiegoOstuni 0:98fcd1266df0 147 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 148 * GLOBAL MACROS
DiegoOstuni 0:98fcd1266df0 149 ******************************************************************************
DiegoOstuni 0:98fcd1266df0 150 */
DiegoOstuni 0:98fcd1266df0 151
DiegoOstuni 0:98fcd1266df0 152 #define ERR_NO_MASK(x) (x & 0x00FF) /*!< Mask the error number */
DiegoOstuni 0:98fcd1266df0 153
DiegoOstuni 0:98fcd1266df0 154
DiegoOstuni 0:98fcd1266df0 155
DiegoOstuni 0:98fcd1266df0 156 /*! Common code to exit a function with the error if function f return error */
DiegoOstuni 0:98fcd1266df0 157 #define EXIT_ON_ERR(r, f) \
DiegoOstuni 0:98fcd1266df0 158 if (ERR_NONE != (r = f)) \
DiegoOstuni 0:98fcd1266df0 159 { \
DiegoOstuni 0:98fcd1266df0 160 return r; \
DiegoOstuni 0:98fcd1266df0 161 }
DiegoOstuni 0:98fcd1266df0 162
DiegoOstuni 0:98fcd1266df0 163 #endif /* ST_ERRNO_H */
DiegoOstuni 0:98fcd1266df0 164