summaryrefslogtreecommitdiffstats
path: root/src/phHciNfc_RFReader.h
blob: 751fbbb34146beeefc2d62e806f11c364c45659c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
/*
 * Copyright (C) 2010 NXP Semiconductors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*!
* =========================================================================== *
*                                                                             *
*                                                                             *
* \file  phHciNfc_RFReader.h                                                  *
* \brief HCI Header for the RF Reader Management Gate.                        *
*                                                                             *
*                                                                             *
* Project: NFC-FRI-1.1                                                        *
*                                                                             *
* $Date: Fri Aug 14 17:01:28 2009 $                                           *
* $Author: ing04880 $                                                         *
* $Revision: 1.17 $                                                            *
* $Aliases: 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 $                                                                *
*                                                                             *
* =========================================================================== *
*/


#ifndef PHHCINFC_RFREADER_H
#define PHHCINFC_RFREADER_H

/*@}*/


/**
 *  \name HCI
 *
 * File: \ref phHciNfc_RFReader.h
 *
 */
/*@{*/
#define PHHCINFC_RF_READER_FILEREVISION "$Revision: 1.17 $" /**< \ingroup grp_file_attributes */
#define PHHCINFC_RF_READER_FILEALIASES  "$Aliases: 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 */
/*@}*/

/*
***************************** Header File Inclusion ****************************
*/

#include <phHciNfc_Generic.h>

/*
****************************** Macro Definitions *******************************
*/
/* Events Requested by the Reader Application Gates */
#define EVT_READER_REQUESTED            0x10U
#define EVT_END_OPERATION               0x11U

/* Events Triggered by the Reader RF Gates */
#define EVT_TARGET_DISCOVERED           0x10U

/* Commands from ETSI HCI Specification */
#define WR_XCHGDATA                     0x10U

/* NXP Additional Commands apart from ETSI HCI Specification */
/* Command to Check the presence of the card */
#define NXP_WR_PRESCHECK                0x30U

/* Command to Activate the next card present in the field */
#define NXP_WR_ACTIVATE_NEXT            0x31U

/* Command to Activate a card with its UID */
#define NXP_WR_ACTIVATE_ID              0x32U

/* Command to Dispatch the card to UICC */
#define NXP_WR_DISPATCH_TO_UICC         0x33U

/* NXP Additional Events apart from ETSI HCI Specification */
/* Event to Release the Target and Restart The Wheel */
#define NXP_EVT_RELEASE_TARGET          0x35U


/* Type Macro to Update the  RF Reader Information */

#define HCI_RDR_ENABLE_TYPE             0x01U

#define UICC_CARD_ACTIVATION_SUCCESS    0x00U
#define UICC_CARD_ACTIVATION_ERROR      0x01U
#define UICC_RDR_NOT_INTERESTED         0x02U


/*
******************** Enumeration and Structure Definition **********************
*/



/*
*********************** Function Prototype Declaration *************************
*/

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Initialise function creates and the opens RF Reader 
 *  Management Gate 
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Reader RF Mgmt Gate Initialisation is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */
extern
NFCSTATUS
phHciNfc_ReaderMgmt_Initialise(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                         );
/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Release function closes the opened RF Reader pipes 
 *  between the Host Controller Device and the NFC Device.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Release of the Reader RF Management gate 
 *                                      resources are pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */
extern
NFCSTATUS
phHciNfc_ReaderMgmt_Release(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                     );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Update_Sequence function Resets/Updates the sequence 
 *  to the Specified RF Reader Sequence .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  reader_seq              reader_seq is the Type of sequence update
 *                                      required to reset .
 *
 *  \retval NFCSTATUS_SUCCESS           Updates/Resets the Sequence of the Reader
 *                                       RF Management gate Successsfully.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval 
 *   NFCSTATUS_INVALID_HCI_INFORMATION  The RF Reader Management information is
 *                                      invalid.
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Update_Sequence(
                                phHciNfc_sContext_t     *psHciContext,
                                phHciNfc_eSeqType_t     reader_seq
                             );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Enable_Discovery function Enables the RF Reader 
 *  Gates to discover the corresponding PICC Tags .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Enable of the Reader RF Management gate 
 *                                      Discovery is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Enable_Discovery(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                             );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Discovery function Enables/Disables/Restart/Continue
 *  the RF Reader Gates to discover the corresponding PICC Tags .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Enable of the Reader RF Management gate 
 *                                      Discovery is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */


/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Disable_Discovery function Disables the RF Reader 
 *  Gates discovery .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Disable of the Reader RF Management gate 
 *                                      Discovery is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Disable_Discovery(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                             );


/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Info_Sequence function Gets the information 
 *  of the Tag discovered .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Reception the information of the discoverd 
 *                                      tag is ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Info_Sequence(
                                   phHciNfc_sContext_t      *psHciContext,
                                   void                     *pHwRef
                               );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Select function connects the 
 *  the selected tag by performing certain operation.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  target_type             target_type is the type of the
 *                                      Target Device to be connected .
 *
 *  \retval NFCSTATUS_PENDING           The selected tag initialisation for
 *                                      transaction ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Select(
                                    phHciNfc_sContext_t     *psHciContext,
                                    void                    *pHwRef,
                                    phHal_eRemDevType_t     target_type
                );


/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Reactivate function reactivates the 
 *  the tag by performing reactivate operation.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  target_type             target_type is the type of the
 *                                      Target Device to be reactivated .
 *
 *  \retval NFCSTATUS_PENDING           The tag reactivation ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */


extern
NFCSTATUS
phHciNfc_ReaderMgmt_Reactivate(
                                    phHciNfc_sContext_t     *psHciContext,
                                    void                    *pHwRef,
                                    phHal_eRemDevType_t     target_type
                );

/**
* \ingroup grp_hci_nfc
*
*   The phHciNfc_ReaderMgmt_Presence_Check function performs presence on ISO 
*   cards.
*
*   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
*                                       context Structure.
*   \param[in]  pHwRef                  pHwRef is the Information of
*                                       the Device Interface Link .
*
*   \retval NFCSTATUS_PENDING           The presence check for tag is ongoing.
*   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
*                                       could not be interpreted properly.
*  \retval Other errors                Errors related to the other layers
*
*/

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Presence_Check(
                                  phHciNfc_sContext_t       *psHciContext,
                                  void                      *pHwRef
                                  );

/**
* \ingroup grp_hci_nfc
*
*   The phHciNfc_ReaderMgmt_Activate_Next function activates and selects next 
*   tag or target present in the RF Field .
*
*   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
*                                       context Structure.
*   \param[in]  pHwRef                  pHwRef is the Information of
*                                       the Device Interface Link .
*
*   \retval NFCSTATUS_PENDING           The activation of the next tag is ongoing.
*   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
*                                       could not be interpreted properly.
*  \retval Other errors                Errors related to the other layers
*
*/

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Activate_Next(
                                  phHciNfc_sContext_t       *psHciContext,
                                  void                  *pHwRef
                                  );


/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_UICC_Dispatch function de-activates the 
 *  the selected tag by de-selecting the tag and dispatch the Card to UICC.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  target_type             target_type is the type of the
 *                                      Target Device to be de-selected .
 *  \param[in]  re_poll                 If True: Start re-polling of the target
 *                                      after the Target Device is de-activated
 *                                      or else - continue discovery with next
 *                                      technology.
 *
 *
 *  \retval NFCSTATUS_PENDING           Dispatching the selected tag to UICC
 *                                      is ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_UICC_Dispatch(
                                    phHciNfc_sContext_t     *psHciContext,
                                    void                    *pHwRef,
                                    phHal_eRemDevType_t     target_type
                );


/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Deselect function de-activates the 
 *  the selected tag by de-selecting the tag and restarting the discovery.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  target_type             target_type is the type of the
 *                                      Target Device to be de-selected .
 *
 *  \retval NFCSTATUS_PENDING           Terminating the operations between selected
 *                                      tag is ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Deselect(
                                    phHciNfc_sContext_t     *psHciContext,
                                    void                    *pHwRef,
                                    phHal_eRemDevType_t     target_type,
                                    uint8_t                 re_poll
                );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_ReaderMgmt_Exchange_Data function exchanges the 
 *  data to/from the selected tag .
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  p_xchg_info             The tag exchange info contains the command type,
 *                                      addr and data to be sent to the connected
 *                                      remote target device.
 *
 *  \retval NFCSTATUS_PENDING           Exchange of the data between the selected 
 *                                      tag is ongoing.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_ReaderMgmt_Exchange_Data(
                                    phHciNfc_sContext_t     *psHciContext,
                                    void                    *pHwRef,
                                    phHciNfc_XchgInfo_t     *p_xchg_info
                );



/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_Send_RFReader_Command function sends the HCI Reader Gate
 *  Specific Commands to the HCI Controller device.
 *
 *  \param[in]  psHciContext            psHciContext is the context of
 *                                      the HCI Layer.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  pipe_id                 The Reader pipe to which the 
 *                                      command is being sent.
 *  \param[in]  cmd                     The HCI Reader Gate specific command
 *                                      sent to a Reader pipe .
 *                                      
 *
 *  \retval NFCSTATUS_PENDING           ETSI HCI RF Reader gate Command 
 *                                      to be sent is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
 phHciNfc_Send_RFReader_Command (
                                phHciNfc_sContext_t *psHciContext,
                                void                *pHwRef,
                                uint8_t             pipe_id,
                                uint8_t             cmd
                    );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_Send_RFReader_Event function sends the HCI Reader Gate
 *  Specific Events to the HCI Controller device.
 *
 *  \param[in]  psHciContext            psHciContext is the context of
 *                                      the HCI Layer.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  pipe_id                 The Reader pipe to which the 
 *                                      command is being sent.
 *  \param[in]  event                   The HCI Reader Gate specific event
 *                                      sent to a Reader pipe .
 *                                      
 *
 *  \retval NFCSTATUS_PENDING           ETSI HCI RF Reader gate Event
 *                                      to be sent is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
 phHciNfc_Send_RFReader_Event (
                                phHciNfc_sContext_t *psHciContext,
                                void                *pHwRef,
                                uint8_t             pipe_id,
                                uint8_t             event
                    );

#endif /* PHHCINFC_RFREADER_H */