code update
[adaptation/devices/nfc-plugin-nxp.git] / inc / phNfcStatus.h
1 /*\r
2  * Copyright (C) 2010 NXP Semiconductors\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *      http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 /**\r
18  * \file  phNfcStatus.h\r
19  * \brief NFC Status Values - Function Return Codes\r
20  *\r
21  * Project: NFC MW / HAL\r
22  *\r
23  * $Date: Wed Apr 29 16:28:21 2009 $\r
24  * $Author: ing04880 $\r
25  * $Revision: 1.31 $\r
26  * $Aliases: NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $\r
27  *\r
28  */\r
29 \r
30 #ifndef PHNFCSTATUS_H /* */\r
31 #define PHNFCSTATUS_H/* */\r
32 \r
33 #ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */\r
34 \r
35 /**\r
36  *  \name NFC Status\r
37  *\r
38  * File: \ref phNfcStatus.h\r
39  *\r
40  *\defgroup grp_retval ERROR Status Codes\r
41  */\r
42 /*@{*/\r
43 #define PHNFCSTATUS_FILEREVISION "$Revision: 1.31 $" /**< \ingroup grp_file_attributes */\r
44 #define PHNFCSTATUS_FILEALIASES  "$Aliases: NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"      /**< \ingroup grp_file_attributes */\r
45 /*@}*/\r
46 \r
47 #endif /* PH_FRINFC_EXCLUDE_FROM_TESTFW */\r
48 \r
49 #include <phNfcTypes.h>\r
50 \r
51 /* Internally required by \ref PHNFCSTVAL. */\r
52 #define PHNFCSTSHL8                          (8U)\r
53 /* Required by \ref PHNFCSTVAL. */\r
54 #define PHNFCSTBLOWER                        ((NFCSTATUS)(0x00FFU))\r
55 \r
56 /**\r
57  *  \name NFC Status Composition Macro\r
58  *\r
59  *  This is the macro which must be used to compose status values.\r
60  *\r
61  *  \param[in] phNfcCompID Component ID, as defined in \ref phNfcCompId.h .\r
62  *  \param[in] phNfcStatus Status values, as defined in \ref phNfcStatus.h .\r
63  *\r
64  *  \note The macro is not required for the \ref NFCSTATUS_SUCCESS value. This is the only\r
65  *        return value to be used directly.\r
66  *        For all other values it shall be used in assigment and conditional statements e.g.:\r
67  *        - NFCSTATUS status = PHNFCSTVAL(phNfcCompID, phNfcStatus); ...\r
68  *        - if (status == PHNFCSTVAL(phNfcCompID, phNfcStatus)) ...\r
69  *\r
70  */\r
71 #define PHNFCSTVAL(phNfcCompID, phNfcStatus)                                \\r
72             ( ((phNfcStatus) == (NFCSTATUS_SUCCESS)) ? (NFCSTATUS_SUCCESS) :  \\r
73                 ( (((NFCSTATUS)(phNfcStatus)) & (PHNFCSTBLOWER)) |          \\r
74                     (((uint16_t)(phNfcCompID)) << (PHNFCSTSHL8)) ) )     /**< \ingroup grp_retval\r
75                                                                               Use this macro for return value composition. */\r
76 #define PHNFCSTATUS(phNfcStatus)  ((phNfcStatus) & 0x00FFU)\r
77 #define PHNFCCID(phNfcStatus)  (((phNfcStatus) & 0xFF00U)>>8)\r
78 \r
79 /**\r
80  *  \name Status Codes\r
81  *\r
82  *  Generic Status codes for the NFC components. Combined with the Component ID\r
83  *  they build the value (status) returned by each\r
84  *  function. Some Specific E.g.:\n\r
85  *  <UL>\r
86  *      <LI> \ref grp_comp_id "Component ID" -  e.g. 0x10, plus                 </LI>\r
87  *      <LI> status code as listed in this file - e.g. 0x03                     </LI>\r
88  *  </UL>\r
89  *  result in a status value of 0x0003.\r
90  *\r
91  *  \note The \ref grp_comp_id "Component ID" used for return codes\r
92      must not be \ref CID_NFC_NONE\r
93  *        except for the value \ref NFCSTATUS_SUCCESS.\r
94  */\r
95 /*@{*/\r
96 \r
97 /** \ingroup grp_retval\r
98     The function indicates successful completion. */\r
99 #define NFCSTATUS_SUCCESS                                       (0x0000)\r
100 \r
101 /** \ingroup grp_retval\r
102     At least one paramter could not be properly interpreted. */\r
103 #define NFCSTATUS_INVALID_PARAMETER                             (0x0001)\r
104 \r
105 /** \ingroup grp_retval\r
106     The buffer provided by the caller is too small. */\r
107 #define NFCSTATUS_BUFFER_TOO_SMALL                              (0x0003)\r
108 \r
109 /** \ingroup grp_retval\r
110     Device specifier/handle value is invalid for the operation. */\r
111 #define NFCSTATUS_INVALID_DEVICE                                (0x0006)\r
112 \r
113 /** \ingroup grp_retval\r
114     The function executed successfully but could have returned\r
115     more information than space provided by the caller. */\r
116 #define NFCSTATUS_MORE_INFORMATION                              (0x0008)\r
117 \r
118 /** \ingroup grp_retval\r
119     No response from the remote device received: Time-out.*/\r
120 #define NFCSTATUS_RF_TIMEOUT                                    (0x0009)\r
121 \r
122 /** \ingroup grp_retval\r
123     RF Error during data transaction with the remote device.*/\r
124 #define NFCSTATUS_RF_ERROR                                      (0x000A)\r
125 \r
126 /** \ingroup grp_retval\r
127     Not enough resources (e.g. allocation failed.). */\r
128 #define NFCSTATUS_INSUFFICIENT_RESOURCES                        (0x000C)\r
129 \r
130 /** \ingroup grp_retval\r
131     A non-blocking function returns this immediately to indicate\r
132     that an internal operation is in progress. */\r
133 #define NFCSTATUS_PENDING                                       (0x000D)\r
134 \r
135 /** \ingroup grp_retval\r
136     A board communication error occurred\r
137     (e.g. configuration went wrong). */\r
138 #define NFCSTATUS_BOARD_COMMUNICATION_ERROR                     (0x000F)\r
139 \r
140 /** \ingroup grp_retval\r
141     Invalid State of the particular state machine\r
142  */\r
143 #define NFCSTATUS_INVALID_STATE                                                                 (0x0011)\r
144 \r
145 \r
146 /** \ingroup grp_retval\r
147     This Layer is Not initialised, hence initialisation required.\r
148  */\r
149 #define NFCSTATUS_NOT_INITIALISED                                                               (0x0031)\r
150 \r
151 \r
152 /** \ingroup grp_retval\r
153     The Layer is already initialised, hence initialisation repeated.\r
154  */\r
155 #define NFCSTATUS_ALREADY_INITIALISED                                                   (0x0032)\r
156 \r
157 \r
158 /** \ingroup grp_retval\r
159     Feature not supported . */\r
160 #define NFCSTATUS_FEATURE_NOT_SUPPORTED                         (0x0033)\r
161 \r
162 /** \ingroup grp_retval\r
163     The Unregistration command has failed because the user wants to unregister on\r
164     an element for which he was not registered*/\r
165 #define NFCSTATUS_NOT_REGISTERED                                                                (0x0034)\r
166 \r
167 \r
168 /** \ingroup grp_retval\r
169     The Registration command has failed because the user wants to register on\r
170     an element for which he is already registered*/\r
171 #define NFCSTATUS_ALREADY_REGISTERED                                                    (0x0035)\r
172 \r
173 /** \ingroup grp_retval\r
174     Single Tag with Multiple\r
175         Protocol support detected. */\r
176 #define NFCSTATUS_MULTIPLE_PROTOCOLS                                (0x0036)\r
177 \r
178 /** \ingroup grp_retval\r
179     Feature not supported . */\r
180 #define NFCSTATUS_MULTIPLE_TAGS                                     (0x0037)\r
181 \r
182 /** \ingroup grp_retval\r
183     A DESELECT event has occurred. */\r
184 #define NFCSTATUS_DESELECTED                                    (0x0038)\r
185 \r
186 /** \ingroup grp_retval\r
187     A RELEASE event has occurred. */\r
188 #define NFCSTATUS_RELEASED                                      (0x0039)\r
189 \r
190 /** \ingroup grp_retval\r
191     The operation is currently not possible or not allowed */\r
192 #define NFCSTATUS_NOT_ALLOWED                                   (0x003A)\r
193 \r
194 /** \ingroup grp_retval\r
195      The sytem is busy with the previous operation.    \r
196 */\r
197 #define NFCSTATUS_BUSY                                                                                  (0x006F)\r
198 \r
199 \r
200 /* NDEF Mapping error codes */\r
201 \r
202 /** \ingroup grp_retval\r
203     The remote device (type) is not valid for this request. */\r
204 #define NFCSTATUS_INVALID_REMOTE_DEVICE                         (0x001D)\r
205 \r
206 /** \ingroup grp_retval\r
207     Smart tag functionality not supported */\r
208 #define NFCSTATUS_SMART_TAG_FUNC_NOT_SUPPORTED                  (0x0013)\r
209 \r
210 /** \ingroup grp_retval\r
211     Read operation failed */\r
212 #define NFCSTATUS_READ_FAILED                                   (0x0014)\r
213 \r
214 /** \ingroup grp_retval\r
215     Write operation failed */\r
216 #define NFCSTATUS_WRITE_FAILED                                  (0x0015)\r
217 \r
218 /** \ingroup grp_retval\r
219     Non Ndef Compliant */\r
220 #define NFCSTATUS_NO_NDEF_SUPPORT                               (0x0016)\r
221 \r
222 /** \ingroup grp_retval\r
223     Could not proceed further with the write operation: reached card EOF*/\r
224 #define NFCSTATUS_EOF_NDEF_CONTAINER_REACHED                    (0x001A)\r
225 \r
226 /** \ingroup grp_retval\r
227     Incorrect number of bytes received from the card*/\r
228 #define NFCSTATUS_INVALID_RECEIVE_LENGTH                        (0x001B)\r
229 \r
230 /** \ingroup grp_retval\r
231     The data format/composition is not understood/correct. */\r
232 #define NFCSTATUS_INVALID_FORMAT                                (0x001C)\r
233 \r
234 \r
235 /** \ingroup grp_retval\r
236     There is not sufficient storage available. */\r
237 #define NFCSTATUS_INSUFFICIENT_STORAGE                          (0x001F)\r
238 \r
239 /** \ingroup grp_retval\r
240     The Ndef Format procedure has failed. */\r
241 #define NFCSTATUS_FORMAT_ERROR                                  (0x0023)\r
242 \r
243 \r
244 /*\r
245  * Macros Required for FRI Stack\r
246 NFCSTATUS_INVALID_PARAMETER             \r
247 NFCSTATUS_CMD_ABORTED           \r
248 NFCSTATUS_FORMAT_STATUS         \r
249 NFSTATUS_SUCCESS                \r
250 NFCSTATUS_INVALID_REMOTE_DEVICE         \r
251 NFCSTATUS_PENDING               \r
252 NFCSTATUS_EOF_NDEF_CONTAINED_REACHED            \r
253 NFCSTATUS_NO_NDEF_SUPPORT               \r
254 NFCSTATUS_SMART_TAG_FUNC_NOT_SUPPORTED          \r
255 NFCSTATUS_READ_FAILED           \r
256 NFCSTATUS_WRITE_FAILED          \r
257 NFCSTATUS_INVALID_RECEIVE_LENGTH                \r
258 NFCSTATUS_BUFFER_TOO_SMALL              \r
259 NFCSTATUS_NODE_NOT_FOUND                \r
260 */\r
261 \r
262 \r
263 /* 0x70 to 0xCF Values are Component Specific Error Values */\r
264 \r
265 \r
266 /** \ingroup grp_retval\r
267     Max number of Status Codes*/\r
268 #define NFCSTATUS_FAILED                                                                                (0x00FF)\r
269 \r
270 /*@}*/\r
271 \r
272 #ifdef RFU_STATUS_CODES  /* To Be Removed later */\r
273 \r
274 /** \ingroup grp_retval\r
275     The function/command has been aborted. */\r
276 #define NFCSTATUS_CMD_ABORTED                                   (0x0002)\r
277 \r
278 /** \ingroup grp_retval\r
279  *  Repeated call of the connecting function is not allowed.\r
280  *   \if hal\r
281  *     \sa \ref phHalNfc_Connect\r
282  *   \endif */\r
283 #define NFCSTATUS_ALREADY_CONNECTED                             (0x0004)\r
284 \r
285 /** \ingroup grp_retval\r
286  *  Calling the polling function is not allowed when remote device\r
287  *  are allready connected.\r
288  *   \if hal\r
289  *     \sa \ref phHalNfc_Poll\r
290  *   \endif */\r
291 #define NFCSTATUS_MULTI_POLL_NOT_SUPPORTED                      (0x0005)\r
292 \r
293 \r
294 /** \ingroup grp_retval\r
295     No target found after poll.*/\r
296 #define NFCSTATUS_NO_DEVICE_FOUND                               (0x000A)\r
297 \r
298 /** \ingroup grp_retval\r
299     No target found after poll.*/\r
300 #define NFCSTATUS_NO_TARGET_FOUND                               (0x000A)\r
301 \r
302 /** \ingroup grp_retval\r
303     Attempt to disconnect a not connected remote device. */\r
304 #define NFCSTATUS_NO_DEVICE_CONNECTED                           (0x000B)\r
305 \r
306 /** \ingroup grp_retval\r
307     External RF field detected. */\r
308 #define NFCSTATUS_EXTERNAL_RF_DETECTED                          (0x000E)\r
309 \r
310 /** \ingroup grp_retval\r
311     Message is not allowed by the state machine\r
312     (e.g. configuration went wrong). */\r
313 #define NFCSTATUS_MSG_NOT_ALLOWED_BY_FSM                        (0x0010)\r
314 \r
315 /** \ingroup grp_retval\r
316     No access has been granted. */\r
317 #define NFCSTATUS_ACCESS_DENIED                                 (0x001E)\r
318 \r
319 /** \ingroup grp_retval\r
320     No registry node matches the specified input data. */\r
321 #define NFCSTATUS_NODE_NOT_FOUND                                (0x0017)\r
322 \r
323 /** \ingroup grp_retval\r
324     The current module is busy ; one might retry later */\r
325 #define NFCSTATUS_SMX_BAD_STATE                                                                 (0x00F0)\r
326 \r
327 \r
328 /** \ingroup grp_retval\r
329     The Abort mechanism has failed for unexpected reason: user can try again*/\r
330 #define NFCSTATUS_ABORT_FAILED                                                                  (0x00F2)\r
331 \r
332 \r
333 /** \ingroup grp_retval\r
334     The Registration command has failed because the user wants to register as target\r
335     on a operating mode not supported*/\r
336 #define NFCSTATUS_REG_OPMODE_NOT_SUPPORTED                                              (0x00F5)\r
337 \r
338 \r
339 #endif\r
340 \r
341 \r
342 #endif /* PHNFCSTATUS_H */\r
343 \r