2 * Copyright (C) 2010 NXP Semiconductors
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * =========================================================================== *
21 * \file phHciNfc_NfcIPMgmt.h *
22 * \brief HCI NFCIP-1 Management Routines. *
25 * Project: NFC-FRI-1.1 *
27 * $Date: Thu Jun 11 18:45:00 2009 $ *
28 * $Author: ing02260 $ *
30 * $Aliases: NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK926_R28_2,NFC_FRI1.1_WK926_R28_3,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_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 $ *
32 * =========================================================================== *
35 #ifndef PHHCINFC_NFCIPMGMT_H
36 #define PHHCINFC_NFCIPMGMT_H
44 * File: \ref phHciNfc_NfcIPMgmt.h
48 #define PHHCINFC_NFCIP1MGMT_FILEREVISION "$Revision: 1.14 $" /**< \ingroup grp_file_attributes */
49 #define PHHCINFC_NFCIP1MGMT_FILEALIASES "$Aliases: NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK926_R28_2,NFC_FRI1.1_WK926_R28_3,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_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 */
53 ***************************** Header File Inclusion ****************************
56 #include <phHciNfc_Generic.h>
59 ****************************** Macro Definitions *******************************
62 /* Commands exposed to the upper layer */
66 ******************** Enumeration and Structure Definition **********************
68 /* LENGTH definition */
69 #define NFCIP_ATR_MAX_LENGTH PHHAL_MAX_ATR_LENGTH
70 #define NFCIP_NFCID_LENGTH PHHAL_MAX_UID_LENGTH
73 typedef enum phHciNfc_eNfcIPType{
74 NFCIP_INVALID = 0x00U,
77 }phHciNfc_eNfcIPType_t;
79 typedef enum phHciNfc_NfcIP_Seq{
80 NFCIP_INVALID_SEQUENCE = 0x00U,
87 } phHciNfc_NfcIP_Seq_t;
89 typedef enum phHciNfc_eP2PSpeed{
90 NFCIP_SPEED_106 = 0x00U,
98 }phHciNfc_eP2PSpeed_t;
100 typedef enum phHciNfc_eNfcIPMode{
101 NFCIP_MODE_PAS_106 = 0x01U,
102 NFCIP_MODE_PAS_212 = 0x02U,
103 NFCIP_MODE_PAS_424 = 0x04U,
104 NFCIP_MODE_ACT_106 = 0x08U,
105 NFCIP_MODE_ACT_212 = 0x10U,
106 NFCIP_MODE_ACT_424 = 0x20U,
107 NFCIP_MODE_ALL = 0x3FU
108 }phHciNfc_eNfcIPMode_t;
110 typedef struct phHciNfc_NfcIP_Info
112 phHciNfc_NfcIP_Seq_t current_seq;
113 phHciNfc_NfcIP_Seq_t next_seq;
114 phHciNfc_eNfcIPType_t nfcip_type;
115 phHciNfc_Pipe_Info_t *p_init_pipe_info;
116 phHciNfc_Pipe_Info_t *p_tgt_pipe_info;
117 phHal_sRemoteDevInformation_t rem_nfcip_tgt_info;
118 /* ATR_RES = General bytes length, Max length = 48 bytes for
120 uint8_t atr_res_info[NFCIP_ATR_MAX_LENGTH];
121 uint8_t atr_res_length;
122 /* ATR_REQ = General bytes length, Max length = 48 bytes for
124 uint8_t atr_req_info[NFCIP_ATR_MAX_LENGTH];
125 uint8_t atr_req_length;
126 /* Contains the current status of the NFCIP-1 link
127 when communication has been set.
128 0x00 -> data is expected from the host
129 0x01 -> data is expected from the RF side */
131 /* Contains the random NFCID3I conveyed with the ATR_REQ.
132 always 10 bytes length */
133 uint8_t nfcid3i_length;
134 uint8_t nfcid3i[NFCIP_NFCID_LENGTH];
135 /* Contains the random NFCID3T conveyed with the ATR_RES.
136 always 10 bytes length */
137 uint8_t nfcid3t_length;
138 uint8_t nfcid3t[NFCIP_NFCID_LENGTH];
139 /* Contains the current parameters of the NFCIP-1 link when
140 communication has been set.
141 - bits 0 to 2: data rate target to initiator
142 - bits 3 to 5: data rate initiator to target
143 0 -> Divisor equal to 1
144 1 -> Divisor equal to 2
145 2 -> Divisor equal to 4
146 3 -> Divisor equal to 8
147 4 -> Divisor equal to 16
148 5 -> Divisor equal to 32
149 6 -> Divisor equal to 64
151 - bits 6 to 7: maximum frame length
156 phHciNfc_eP2PSpeed_t initiator_speed;
157 phHciNfc_eP2PSpeed_t target_speed;
158 uint16_t max_frame_len;
159 /* Supported modes */
166 uint8_t activation_mode;
167 }phHciNfc_NfcIP_Info_t;
171 *********************** Function Prototype Declaration *************************
174 * \brief Allocates the resources of NFCIP-1 initiator management gate.
176 * This function Allocates the resources of the NFCIP-1 initiator management
177 * gate Information Structure.
182 phHciNfc_Initiator_Init_Resources(
183 phHciNfc_sContext_t *psHciContext
187 * \ingroup grp_hci_nfc
189 * The phHciNfc_Initiator_Get_PipeID function gives the pipe id of the NFCIP-1
192 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
194 * \param[in] pHwRef pHwRef is the Information of
195 * the Device Interface Link
197 * \retval NFCSTATUS_SUCCESS Function execution is successful.
198 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
199 * could not be interpreted properly.
204 phHciNfc_Initiator_Get_PipeID(
205 phHciNfc_sContext_t *psHciContext,
210 * \ingroup grp_hci_nfc
212 * The phHciNfc_Initiator_Update_PipeInfo function updates the pipe_id of the NFCIP-1
213 * initiator gate management Structure.
215 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
217 * \param[in] pipeID pipeID of the NFCIP-1 initiator gate
218 * \param[in] pPipeInfo Update the pipe Information of the NFCIP-1
221 * \retval NFCSTATUS_SUCCESS Function execution is successful.
222 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
223 * could not be interpreted properly.
229 phHciNfc_Initiator_Update_PipeInfo(
230 phHciNfc_sContext_t *psHciContext,
232 phHciNfc_Pipe_Info_t *pPipeInfo
236 * \ingroup grp_hci_nfc
238 * The phHciNfc_Send_Initiator_Command function executes the command sent by the
239 * upper layer, depending on the commands defined.
241 * \param[in] psContext psContext is the pointer to HCI Layer
243 * \param[in] pHwRef pHwRef is the Information of
244 * the Device Interface Link
246 * \retval NFCSTATUS_SUCCESS Function execution is successful.
247 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
248 * could not be interpreted properly.
253 phHciNfc_NfcIP_Presence_Check(
254 phHciNfc_sContext_t *psContext,
259 * \brief Allocates the resources of NFCIP-1 target management gate.
261 * This function Allocates the resources of the NFCIP-1 target management
262 * gate Information Structure.
267 phHciNfc_Target_Init_Resources(
268 phHciNfc_sContext_t *psHciContext
272 * \ingroup grp_hci_nfc
274 * The phHciNfc_Target_Get_PipeID function gives the pipe id of the NFCIP-1
277 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
279 * \param[in] pHwRef pHwRef is the Information of
280 * the Device Interface Link
282 * \retval NFCSTATUS_SUCCESS Function execution is successful.
283 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
284 * could not be interpreted properly.
289 phHciNfc_Target_Get_PipeID(
290 phHciNfc_sContext_t *psHciContext,
295 * \ingroup grp_hci_nfc
297 * The phHciNfc_Target_Update_PipeInfo function updates the pipe_id of the NFCIP-1
298 * target gate management Structure.
300 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
302 * \param[in] pipeID pipeID of the NFCIP-1 target gate
303 * \param[in] pPipeInfo Update the pipe Information of the NFCIP-1
306 * \retval NFCSTATUS_SUCCESS Function execution is successful.
307 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
308 * could not be interpreted properly.
314 phHciNfc_Target_Update_PipeInfo(
315 phHciNfc_sContext_t *psHciContext,
317 phHciNfc_Pipe_Info_t *pPipeInfo
321 * \ingroup grp_hci_nfc
323 * The phHciNfc_NfcIP_Info_Sequence function executes the sequence of operations, to
324 * get ATR_RES, NFCID3I, NFCID3T, PARAMS etc.
326 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
328 * \param[in] pHwRef pHwRef is the Information of
329 * the Device Interface Link
330 * \param[in] notify_reqd if TRUE continue till END_SEQUENCE, else
333 * \retval NFCSTATUS_SUCCESS Function execution is successful.
334 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
335 * could not be interpreted properly.
340 phHciNfc_NfcIP_Info_Sequence (
341 phHciNfc_sContext_t *psHciContext,
346 #endif /* #ifdef NOTIFY_REQD */
350 * \ingroup grp_hci_nfc
352 * The phHciNfc_NfcIP_SetMode function sets the value for NFCIP-1 modes
354 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
356 * \param[in] pHwRef pHwRef is the Information of
357 * the Device Interface Link
358 * \param[in] nfciptype Specifies initiator or target
359 * \param[in] nfcip_mode nfcip_mode is the supported mode
362 * \retval NFCSTATUS_SUCCESS Function execution is successful.
363 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
364 * could not be interpreted properly.
369 phHciNfc_NfcIP_SetMode(
370 phHciNfc_sContext_t *psHciContext,
372 phHciNfc_eNfcIPType_t nfciptype,
377 * \ingroup grp_hci_nfc
379 * The phHciNfc_NfcIP_SetNAD function sets the NAD value
381 * \param[in] psHciContext pContext is the pointer to HCI Layer
383 * \param[in] pHwRef pHwRef is the Information of
384 * the Device Interface Link
385 * \param[in] nfciptype Specifies initiator or target
386 * \param[in] nad Node address, this will be used as
387 * logical address of the initiator (b4 to b7)
389 * \retval NFCSTATUS_SUCCESS Function execution is successful.
390 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
391 * could not be interpreted properly.
396 phHciNfc_NfcIP_SetNAD(
397 phHciNfc_sContext_t *psHciContext,
399 phHciNfc_eNfcIPType_t nfciptype,
404 * \ingroup grp_hci_nfc
406 * The phHciNfc_NfcIP_SetDID function sets the DID value for the initiator
408 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
410 * \param[in] pHwRef pHwRef is the Information of
411 * the Device Interface Link
412 * \param[in] did Device ID
414 * \retval NFCSTATUS_SUCCESS Function execution is successful.
415 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
416 * could not be interpreted properly.
421 phHciNfc_NfcIP_SetDID(
422 phHciNfc_sContext_t *psHciContext,
428 * \ingroup grp_hci_nfc
430 * The phHciNfc_NfcIP_SetOptions function sets the different options depending on
431 * the host type (initiator or target) like PSL, NAD and DID
433 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
435 * \param[in] pHwRef pHwRef is the Information of
436 * the Device Interface Link
437 * \param[in] nfciptype Specifies initiator or target
438 * \param[in] nfcip_options specifies enabled options PSL, NAD and DID
440 * \retval NFCSTATUS_SUCCESS Function execution is successful.
441 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
442 * could not be interpreted properly.
447 phHciNfc_NfcIP_SetOptions(
448 phHciNfc_sContext_t *psHciContext,
450 phHciNfc_eNfcIPType_t nfciptype,
451 uint8_t nfcip_options
455 * \ingroup grp_hci_nfc
457 * The phHciNfc_NfcIP_SetATRInfo function sets the general byte information
459 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
461 * \param[in] pHwRef pHwRef is the Information of
462 * the Device Interface Link
463 * \param[in] nfciptype Specifies initiator or target
464 * \param[in] atr_info contains the general bytes of the ATR_REQ
465 * (initiator) or ATR_RES (target) (max size =
468 * \retval NFCSTATUS_SUCCESS Function execution is successful.
469 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
470 * could not be interpreted properly.
475 phHciNfc_NfcIP_SetATRInfo(
476 phHciNfc_sContext_t *psHciContext,
478 phHciNfc_eNfcIPType_t nfciptype,
479 phHal_sNfcIPCfg_t *atr_info
483 * \ingroup grp_hci_nfc
485 * The phHciNfc_NfcIP_SetPSL1 function sets the BRS byte of PSL_REQ
487 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
489 * \param[in] pHwRef pHwRef is the Information of
490 * the Device Interface Link
491 * \param[in] psl1 specifies the BRS byte of PSL_REQ
493 * \retval NFCSTATUS_SUCCESS Function execution is successful.
494 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
495 * could not be interpreted properly.
500 phHciNfc_NfcIP_SetPSL1(
501 phHciNfc_sContext_t *psHciContext,
507 * \ingroup grp_hci_nfc
509 * The phHciNfc_NfcIP_SetPSL2 function sets the BRS byte of PSL_REQ
511 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
513 * \param[in] pHwRef pHwRef is the Information of
514 * the Device Interface Link
515 * \param[in] psl2 specifies the FSL byte of PSL_REQ
517 * \retval NFCSTATUS_SUCCESS Function execution is successful.
518 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
519 * could not be interpreted properly.
524 phHciNfc_NfcIP_SetPSL2(
525 phHciNfc_sContext_t *psHciContext,
531 * \ingroup grp_hci_nfc
533 * The phHciNfc_NfcIP_GetStatus function receives the present status of the
534 * NFCIP-1 link, when communication has been set.
535 * If 0x00 is the status, then it means data is expected from the host
536 * If 0x01 is the status, then it means data is expected from the RF side
537 * Other status values are error
539 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
541 * \param[in] pHwRef pHwRef is the Information of
542 * the Device Interface Link
543 * \param[in] nfciptype Specifies initiator or target
545 * \retval NFCSTATUS_SUCCESS Function execution is successful.
546 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
547 * could not be interpreted properly.
552 phHciNfc_NfcIP_GetStatus(
553 phHciNfc_sContext_t *psHciContext,
555 phHciNfc_eNfcIPType_t nfciptype
559 * \ingroup grp_hci_nfc
561 * The phHciNfc_NfcIP_GetStatus function receives the current parameters of the
562 * NFCIP-1 link, when communication has been set.
563 * - bits 0 to 2: data rate target to initiator
564 * - bits 3 to 5: data rate initiator to target
565 * 0 -> Divisor equal to 1
566 * 1 -> Divisor equal to 2
567 * 2 -> Divisor equal to 4
568 * 3 -> Divisor equal to 8
569 * 4 -> Divisor equal to 16
570 * 5 -> Divisor equal to 32
571 * 6 -> Divisor equal to 64
573 * - bits 6 to 7: maximum frame length
579 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
581 * \param[in] pHwRef pHwRef is the Information of
582 * the Device Interface Link
583 * \param[in] nfciptype Specifies initiator or target
585 * \retval NFCSTATUS_SUCCESS Function execution is successful.
586 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
587 * could not be interpreted properly.
592 phHciNfc_NfcIP_GetParam(
593 phHciNfc_sContext_t *psHciContext,
595 phHciNfc_eNfcIPType_t nfciptype
599 * \ingroup grp_hci_nfc
601 * The phHciNfc_NfcIP_Send_Data function sends data using the SEND_DATA event
603 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
605 * \param[in] pHwRef pHwRef is the Information of
606 * the Device Interface Link
607 * \param[in] sData Data to be sent to the lower layer
609 * \retval NFCSTATUS_SUCCESS Function execution is successful.
610 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
611 * could not be interpreted properly.
616 phHciNfc_NfcIP_Send_Data (
617 phHciNfc_sContext_t *psHciContext,
619 phHciNfc_XchgInfo_t *sData
623 * \ingroup grp_hci_nfc
625 * The phHciNfc_Initiator_Cont_Activate function to activate the NFCIP initiator
627 * \param[in] pContext pContext is the pointer to HCI Layer
629 * \param[in] pHwRef pHwRef is the Information of
630 * the Device Interface Link
632 * \retval NFCSTATUS_SUCCESS Function execution is successful.
633 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
634 * could not be interpreted properly.
639 phHciNfc_Initiator_Cont_Activate (
640 phHciNfc_sContext_t *psHciContext,
645 * \ingroup grp_hci_nfc
647 * The phHciNfc_NfcIP_GetATRInfo function is to get ATR information
649 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
651 * \param[in] pHwRef pHwRef is the Information of
652 * the Device Interface Link
653 * \param[in] nfciptype Specifies initiator or target
655 * \retval NFCSTATUS_SUCCESS Function execution is successful.
656 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
657 * could not be interpreted properly.
662 phHciNfc_NfcIP_GetATRInfo (
663 phHciNfc_sContext_t *psHciContext,
665 phHciNfc_eNfcIPType_t nfciptype
669 * \ingroup grp_hci_nfc
671 * The phHciNfc_NfcIP_SetMergeSak function is to indicate, if the NFCIP-1
672 * target feature must be merged with Type A RF card feature in order to
673 * present only one type A target (set of the related bit in SAK to
674 * reflect the ISO18092 compliancy).
677 * Others values are RFU : error code returned as NFCSTATUS_INVALID_PARAMETER
679 * \param[in] psHciContext psHciContext is the pointer to HCI Layer
681 * \param[in] pHwRef pHwRef is the Information of
682 * the Device Interface Link
683 * \param[in] sak_value Specifies initiator or target
685 * \retval NFCSTATUS_SUCCESS Function execution is successful.
686 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
687 * could not be interpreted properly.
692 phHciNfc_NfcIP_SetMergeSak(
693 phHciNfc_sContext_t *psHciContext,
697 #endif /* #ifndef PHHCINFC_NFCIPMGMT_H */