Diego Ostuni / ST25R3911
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers st_errno.h Source File

st_errno.h

Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003   * @attention
00004   *
00005   * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
00006   *
00007   * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
00008   * You may not use this file except in compliance with the License.
00009   * You may obtain a copy of the License at:
00010   *
00011   *        http://www.st.com/myliberty
00012   *
00013   * Unless required by applicable law or agreed to in writing, software
00014   * distributed under the License is distributed on an "AS IS" BASIS,
00015   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
00016   * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
00017   * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
00018   * See the License for the specific language governing permissions and
00019   * limitations under the License.
00020   *
00021 ******************************************************************************/
00022 
00023 
00024 /*
00025  *      PROJECT:   STxxxx firmware
00026  *      LANGUAGE:  ISO C99
00027  */
00028 
00029 /*! \file st_errno.h
00030  *
00031  *  \author
00032  *
00033  *  \brief Main error codes
00034  *
00035  */
00036 
00037 #ifndef ST_ERRNO_H
00038 #define ST_ERRNO_H
00039 
00040 /*
00041 ******************************************************************************
00042 * INCLUDES
00043 ******************************************************************************
00044 */
00045 
00046 #include "mbed.h"
00047 
00048 /*
00049 ******************************************************************************
00050 * GLOBAL DATA TYPES
00051 ******************************************************************************
00052 */
00053 
00054 typedef uint16_t      ReturnCode ; /*!< Standard Return Code type from function. */
00055 
00056 /*
00057 ******************************************************************************
00058 * DEFINES
00059 ******************************************************************************
00060 */
00061 
00062 
00063 /*
00064  * Error codes to be used within the application.
00065  * They are represented by an uint8_t
00066  */
00067 enum {
00068     ERR_NONE                               =  0, /*!< no error occurred */
00069     ERR_NOMEM                              =  1, /*!< not enough memory to perform the requested operation */
00070     ERR_BUSY                               =  2, /*!< device or resource busy */
00071     ERR_IO                                 =  3, /*!< generic IO error */
00072     ERR_TIMEOUT                            =  4, /*!< error due to timeout */
00073     ERR_REQUEST                            =  5, /*!< invalid request or requested function can't be executed at the moment */
00074     ERR_NOMSG                              =  6, /*!< No message of desired type */
00075     ERR_PARAM                              =  7, /*!< Parameter error */
00076     ERR_SYSTEM                             =  8, /*!< System error */
00077     ERR_FRAMING                            =  9, /*!< Framing error */
00078     ERR_OVERRUN                            = 10, /*!< lost one or more received bytes */
00079     ERR_PROTO                              = 11, /*!< protocol error */
00080     ERR_INTERNAL                           = 12, /*!< Internal Error */
00081     ERR_AGAIN                              = 13, /*!< Call again */
00082     ERR_MEM_CORRUPT                        = 14, /*!< memory corruption */
00083     ERR_NOT_IMPLEMENTED                    = 15, /*!< not implemented */
00084     ERR_PC_CORRUPT                         = 16, /*!< Program Counter has been manipulated or spike/noise trigger illegal operation */
00085     ERR_SEND                               = 17, /*!< error sending*/
00086     ERR_IGNORE                             = 18, /*!< indicates error detected but to be ignored */
00087     ERR_SEMANTIC                           = 19, /*!< indicates error in state machine (unexpected cmd) */
00088     ERR_SYNTAX                             = 20, /*!< indicates error in state machine (unknown cmd) */
00089     ERR_CRC                                = 21, /*!< crc error */
00090     ERR_NOTFOUND                           = 22, /*!< transponder not found */
00091     ERR_NOTUNIQUE                          = 23, /*!< transponder not unique - more than one transponder in field */
00092     ERR_NOTSUPP                            = 24, /*!< requested operation not supported */
00093     ERR_WRITE                              = 25, /*!< write error */
00094     ERR_FIFO                               = 26, /*!< fifo over or underflow error */
00095     ERR_PAR                                = 27, /*!< parity error */
00096     ERR_DONE                               = 28, /*!< transfer has already finished */
00097     ERR_RF_COLLISION                       = 29, /*!< collision error (Bit Collision or during RF Collision avoidance ) */
00098     ERR_HW_OVERRUN                         = 30, /*!< lost one or more received bytes */
00099     ERR_RELEASE_REQ                        = 31, /*!< device requested release */
00100     ERR_SLEEP_REQ                          = 32, /*!< device requested sleep */
00101     ERR_WRONG_STATE                        = 33, /*!< incorrent state for requested operation */
00102     ERR_MAX_RERUNS                         = 34, /*!< blocking procedure reached maximum runs */
00103     ERR_DISABLED                           = 35, /*!< operation aborted due to disabled configuration */
00104     ERR_HW_MISMATCH                        = 36, /*!< expected hw do not match  */
00105     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 */
00106     ERR_INVALID_HANDLE                     = 38, /*!< invalid or not initalized device handle */
00107 
00108     ERR_INCOMPLETE_BYTE                    = 40, /*!< Incomplete byte rcvd         */
00109     ERR_INCOMPLETE_BYTE_01                 = 41, /*!< Incomplete byte rcvd - 1 bit */
00110     ERR_INCOMPLETE_BYTE_02                 = 42, /*!< Incomplete byte rcvd - 2 bit */
00111     ERR_INCOMPLETE_BYTE_03                 = 43, /*!< Incomplete byte rcvd - 3 bit */
00112     ERR_INCOMPLETE_BYTE_04                 = 44, /*!< Incomplete byte rcvd - 4 bit */
00113     ERR_INCOMPLETE_BYTE_05                 = 45, /*!< Incomplete byte rcvd - 5 bit */
00114     ERR_INCOMPLETE_BYTE_06                 = 46, /*!< Incomplete byte rcvd - 6 bit */
00115     ERR_INCOMPLETE_BYTE_07                 = 47  /*!< Incomplete byte rcvd - 7 bit */
00116 };
00117 
00118 
00119 /* General Sub-category number */
00120 #define ERR_GENERIC_GRP                     (0x0000)  /*!< Reserved value for generic error no */
00121 #define ERR_WARN_GRP                        (0x0100)  /*!< Errors which are not expected in normal operation */
00122 #define ERR_PROCESS_GRP                     (0x0200)  /*!< Processes management errors */
00123 #define ERR_SIO_GRP                         (0x0800)  /*!< SIO errors due to logging */
00124 #define ERR_RINGBUF_GRP                     (0x0900)  /*!< Ring Buffer errors */
00125 #define ERR_MQ_GRP                          (0x0A00)  /*!< MQ errors */
00126 #define ERR_TIMER_GRP                       (0x0B00)  /*!< Timer errors */
00127 #define ERR_RFAL_GRP                        (0x0C00)  /*!< RFAL errors */
00128 #define ERR_UART_GRP                        (0x0D00)  /*!< UART errors */
00129 #define ERR_SPI_GRP                         (0x0E00)  /*!< SPI errors */
00130 #define ERR_I2C_GRP                         (0x0F00)  /*!< I2c errors */
00131 
00132 
00133 #define ERR_INSERT_SIO_GRP(x)               (ERR_SIO_GRP     | x)  /*!< Insert the SIO grp */
00134 #define ERR_INSERT_RINGBUF_GRP(x)           (ERR_RINGBUF_GRP | x)  /*!< Insert the Ring Buffer grp */
00135 #define ERR_INSERT_RFAL_GRP(x)              (ERR_RFAL_GRP  | x)    /*!< Insert the RFAL grp */
00136 #define ERR_INSERT_SPI_GRP(x)               (ERR_SPI_GRP     | x)  /*!< Insert the spi grp */
00137 #define ERR_INSERT_I2C_GRP(x)               (ERR_I2C_GRP     | x)  /*!< Insert the i2c grp */
00138 #define ERR_INSERT_UART_GRP(x)              (ERR_UART_GRP    | x)  /*!< Insert the uart grp */
00139 #define ERR_INSERT_TIMER_GRP(x)             (ERR_TIMER_GRP   | x)  /*!< Insert the timer grp */
00140 #define ERR_INSERT_MQ_GRP(x)                (ERR_MQ_GRP      | x)  /*!< Insert the mq grp */
00141 #define ERR_INSERT_PROCESS_GRP(x)           (ERR_PROCESS_GRP | x)  /*!< Insert the process grp */
00142 #define ERR_INSERT_WARN_GRP(x)              (ERR_WARN_GRP    | x)  /*!< Insert the i2c grp */
00143 #define ERR_INSERT_GENERIC_GRP(x)           (ERR_GENERIC_GRP | x)  /*!< Insert the generic grp */
00144 
00145 
00146 /*
00147 ******************************************************************************
00148 * GLOBAL MACROS
00149 ******************************************************************************
00150 */
00151 
00152 #define ERR_NO_MASK(x)                      (x & 0x00FF)    /*!< Mask the error number */
00153 
00154 
00155 
00156 /*! Common code to exit a function with the error if function f return error */
00157 #define EXIT_ON_ERR(r, f)     \
00158     if (ERR_NONE != (r = f))  \
00159     {                         \
00160         return r;             \
00161     }
00162 
00163 #endif /* ST_ERRNO_H */
00164