1 /****************************************************************************** 2 * 3 * Copyright 2018 - 2019 NXP 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 /** 19 * \addtogroup ISO7816-3_protocol_lib_common 20 * 21 * @{ */ 22 23 #ifndef PHESESTATUS_H 24 #define PHESESTATUS_H 25 26 /*! Internally required by PHESESTVAL. */ 27 #define PHESESTSHL8 (8U) 28 29 /*! Required by PHESESTVAL. */ 30 #define PHESESTBLOWER ((ESESTATUS)(0x00FFU)) 31 32 /*! 33 * ESE Status Composition Macro 34 * 35 * This is the macro which must be used to compose status values. 36 * 37 * phEseCompID Component ID, as defined in phEseCompId.h . 38 * phEseStatus Status values, as defined in phEseStatus.h . 39 * 40 * The macro is not required for the ESESTATUS_SUCCESS value. 41 * This is the only return value to be used directly. 42 * For all other values it shall be used in assignment and conditional 43 *statements, e.g.: 44 * ESESTATUS status = PHESESTVAL(phEseCompID, phEseStatus); ... 45 * if (status == PHESESTVAL(phEseCompID, phEseStatus)) ... 46 */ 47 #define PHESESTVAL(phEseCompID, phEseStatus) \ 48 (((phEseStatus) == (ESESTATUS_SUCCESS)) \ 49 ? (ESESTATUS_SUCCESS) \ 50 : ((((ESESTATUS)(phEseStatus)) & (PHESESTBLOWER)) | \ 51 (((uint16_t)(phEseCompID)) << (PHESESTSHL8)))) 52 53 /*! 54 * PHESESTATUS 55 * Get grp_retval from Status Code 56 */ 57 #define PHESESTATUS(phEseStatus) ((phEseStatus)&0x00FFU) 58 59 /** 60 * \ingroup ISO7816-3_protocol_lib_common 61 * \brief Ese Channel mode 62 * 63 */ 64 typedef enum { 65 ESESTATUS_SUCCESS = (0x0000), 66 67 ESESTATUS_FAILED = (0x0001), 68 69 ESESTATUS_IOCTL_FAILED = -1, 70 71 ESESTATUS_INVALID_BUFFER = (0x0002), 72 73 ESESTATUS_BUFFER_TOO_SMALL = (0x0003), 74 75 ESESTATUS_INVALID_CLA = (0x0004), 76 77 ESESTATUS_INVALID_CPDU_TYPE = (0x0005), 78 79 ESESTATUS_INVALID_LE_TYPE = (0x0007), 80 81 ESESTATUS_INVALID_DEVICE = (0x0006), 82 83 ESESTATUS_MORE_FRAME = (0x0008), 84 85 ESESTATUS_LAST_FRAME = (0x0009), 86 87 ESESTATUS_CRC_ERROR = (0x000A), 88 89 ESESTATUS_SOF_ERROR = (0x000B), 90 91 ESESTATUS_INSUFFICIENT_RESOURCES = (0x000C), 92 93 ESESTATUS_PENDING = (0x000D), 94 95 ESESTATUS_BOARD_COMMUNICATION_ERROR = (0x000F), 96 97 ESESTATUS_INVALID_STATE = (0x0011), 98 99 ESESTATUS_NOT_INITIALISED = (0x0031), 100 101 ESESTATUS_ALREADY_INITIALISED = (0x0032), 102 103 ESESTATUS_FEATURE_NOT_SUPPORTED = (0x0033), 104 105 ESESTATUS_PARITY_ERROR = (0x0034), 106 107 ESESTATUS_ALREADY_REGISTERED = (0x0035), 108 109 ESESTATUS_CHAINED_FRAME = (0x0036), 110 111 ESESTATUS_SINGLE_FRAME = (0x0037), 112 113 ESESTATUS_DESELECTED = (0x0038), 114 115 ESESTATUS_RELEASED = (0x0039), 116 117 ESESTATUS_NOT_ALLOWED = (0x003A), 118 119 ESESTATUS_OTHER_ERROR = (0x003C), 120 121 ESESTATUS_DRIVER_BUSY = (0x006D), 122 123 ESESTATUS_DWNLD_BUSY = (0x006E), 124 125 ESESTATUS_BUSY = (0x006F), 126 127 ESESTATUS_INVALID_REMOTE_DEVICE = (0x001D), 128 129 ESESTATUS_READ_FAILED = (0x0014), 130 131 ESESTATUS_WRITE_FAILED = (0x0015), 132 133 ESESTATUS_NO_NDEF_SUPPORT = (0x0016), 134 135 ESESTATUS_RESET_SEQ_COUNTER_FRAME_RESEND = (0x001A), 136 137 ESESTATUS_INVALID_RECEIVE_LENGTH = (0x001B), 138 139 ESESTATUS_INVALID_FORMAT = (0x001C), 140 141 ESESTATUS_INSUFFICIENT_STORAGE = (0x001F), 142 143 ESESTATUS_FRAME_RESEND = (0x0023), 144 145 ESESTATUS_WRITE_TIMEOUT = (0x0024), 146 147 ESESTATUS_RESPONSE_TIMEOUT = (0x0025), 148 149 ESESTATUS_FRAME_RESEND_R_FRAME = (0x0026), 150 151 ESESTATUS_SEND_NEXT_FRAME = (0x0027), 152 153 ESESTATUS_RECOVERY_STARTED = (0x0028), 154 155 ESESTATUS_SEND_R_FRAME = (0x0029), 156 157 ESESTATUS_FRAME_RESEND_RNAK = (0x0030), 158 159 ESESTATUS_FRAME_SEND_R_FRAME = (0x003B), 160 161 ESESTATUS_UNKNOWN_ERROR = (0x00FE), 162 163 ESESTATUS_INVALID_PARAMETER = (0x00FF), 164 165 ESESTATUS_CMD_ABORTED = (0x0002), 166 167 ESESTATUS_NO_TARGET_FOUND = (0x000A), 168 169 ESESTATUS_NO_DEVICE_CONNECTED = (0x000B), 170 171 ESESTATUS_RESYNCH_REQ = (0x000E), 172 173 ESESTATUS_RESYNCH_RES = (0x0010), 174 175 ESESTATUS_IFS_REQ = (0x001E), 176 177 ESESTATUS_IFS_RES = (0x0017), 178 179 ESESTATUS_ABORT_REQ = (0x00F0), 180 181 ESESTATUS_ABORT_RES = (0x00F2), 182 183 ESESTATUS_WTX_REQ = (0x00F5), 184 185 ESESTATUS_WTX_RES = (0x00F6), 186 187 ESESTATUS_RESET_REQ = (0x00F7), 188 189 ESESTATUS_RESET_RES = (0x00F8), 190 191 ESESTATUS_END_APDU_REQ = (0x00F9), 192 193 ESESTATUS_END_APDU_RES = (0x00FA), 194 195 ESESTATUS_SHUTDOWN = (0x0091), 196 197 ESESTATUS_TARGET_LOST = (0x0092), 198 199 ESESTATUS_REJECTED = (0x0093), 200 201 ESESTATUS_TARGET_NOT_CONNECTED = (0x0094), 202 203 ESESTATUS_INVALID_HANDLE = (0x0095), 204 205 ESESTATUS_ABORTED = (0x0096), 206 207 ESESTATUS_COMMAND_NOT_SUPPORTED = (0x0097), 208 209 ESESTATUS_NON_NDEF_COMPLIANT = (0x0098), 210 211 ESESTATUS_NOT_ENOUGH_MEMORY = (0x001F), 212 213 ESESTATUS_INCOMING_CONNECTION = (0x0045), 214 215 ESESTATUS_CONNECTION_SUCCESS = (0x0046), 216 217 ESESTATUS_CONNECTION_FAILED = (0x0047), 218 219 ESESTATUS_TRANSCEIVE_FAILED = (0x0048), 220 } ESESTATUS; 221 #endif /* PHESESTATUS_H */ 222 /** @} */ 223