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