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