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 * =========================================================================== *
22 * \brief HCI Header for the Generic HCI Management. *
25 * Project: NFC-FRI-1.1 *
27 * $Date: Mon Apr 5 14:37:06 2010 $ *
28 * $Author: ing04880 $ *
30 * $Aliases: 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 * =========================================================================== *
45 * File: \ref phHciNfc.h
49 #define PH_HCINFC_FILEREVISION "$Revision: 1.39 $" /**< \ingroup grp_file_attributes */
50 #define PH_HCINFC_FILEALIASES "$Aliases: 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 */
54 ################################################################################
55 ***************************** Header File Inclusion ****************************
56 ################################################################################
59 #include <phNfcStatus.h>
60 #include <phNfcInterface.h>
66 ################################################################################
67 ****************************** Macro Definitions *******************************
68 ################################################################################
73 ################################################################################
74 ******************** Enumeration and Structure Definition **********************
75 ################################################################################
78 typedef enum phHciNfc_Init
86 /** \ingroup grp_hal_hci
89 * \brief HCI Tag Exchange Information
94 * The <em> Tag Exchange Info Structure </em> holds the exchange information to
97 * \note All members of this structure are in parameters [in].
101 typedef struct phHciNfc_Tag_XchgInfo
103 /** \internal RF Reader Command Type */
105 /** \internal Address Field required for only Mifare
106 * Family Proprietary Cards.
107 * The Address Size is Valid only upto 255 Blocks limit
111 }phHciNfc_Tag_XchgInfo_t;
113 /** \ingroup grp_hal_hci
116 * \brief HCI NFC-IP Exchange Information
118 * \brief HCI-Specific
121 * The <em> NFC-IP Exchange Info Structure </em> holds the exchange information to
122 * the connected NFC-IP target .
124 * \note All members of this structure are in parameters [in].
128 typedef struct phHciNfc_NfcIP_XchgInfo
130 /** \internal NFC-IP DEP Meta Chining Information */
133 }phHciNfc_NfcIP_XchgInfo_t;
135 /** \ingroup grp_hal_hci
138 * \brief HCI Target Exchange Information
140 * \brief HCI-Specific
143 * The <em> Target Exchange Info Structure </em> holds all the exchange information to
144 * the connected target .
146 * \note All members of this structure are in parameters [in].
151 typedef struct phHciNfc_XchgInfo
153 /** \internal Exchange Data/NFC-IP DEP
156 /** \internal Exchange Data/NFC-IP DEP
157 * Exchange Buffer Length*/
162 phHciNfc_Tag_XchgInfo_t tag_info;
163 phHciNfc_NfcIP_XchgInfo_t nfc_info;
166 }phHciNfc_XchgInfo_t;
171 ################################################################################
172 *********************** Function Prototype Declaration *************************
173 ################################################################################
177 * \ingroup grp_hci_nfc
179 * The phHciNfc_Initialise function initialises the HCI context and all other
180 * resources used in the HCI Layer for the corresponding interface link.
182 * \param[in,out] psHciHandle psHciHandle is the handle or the context
184 * \param[in] pHwRef pHwRef is the Information of
185 * the Device Interface Link .
186 * \param[in] init_mode init_mode specifies the kind of the
187 * Initialisation for the HCI layer .
188 * \param[in] pHwConfig pHwConfig is the Information required
189 * to configure the parameters of the
191 * \param[in] pHalNotify Upper layer Notification function
193 * \param[in] psContext psContext is the context of
195 * \param[in] psHciLayerCfg Pointer to the HCI Layer configuration
198 * \retval NFCSTATUS_PENDING Initialisation of HCI Layer is in Progress.
199 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
200 * could not be interpreted properly.
201 * \retval Other errors Errors related to the other layers
207 phHciNfc_Initialise (
210 phHciNfc_Init_t init_mode,
211 phHal_sHwConfig_t *pHwConfig,
212 pphNfcIF_Notification_CB_t pHalNotify,
214 phNfcLayer_sCfg_t *psHciLayerCfg
218 * \ingroup grp_hci_nfc
220 * The phHciNfc_Release function releases all the resources used in the HCI
221 * Layer for the corresponding interface link, described by the HCI handle.
223 * \param[in] psHciHandle psHciHandle is the handle or the context
225 * \param[in] pHwRef pHwRef is the Information of
226 * the Device Interface Link .
227 * \param[in] pHalReleaseCB Upper layer release callback function
229 * \param[in] psContext psContext is the context of
232 * \retval NFCSTATUS_PENDING Releasing of HCI Resources are in Progress.
233 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
234 * could not be interpreted properly.
235 * \retval Other errors Errors related to the other layers
244 pphNfcIF_Notification_CB_t pHalReleaseCB,
251 phHciNfc_Config_Discovery (
254 phHal_sADD_Cfg_t *pPollConfig
259 * \ingroup grp_hci_nfc
261 * The phHciNfc_Restart_Discovery function restarts the Polling Wheel.
263 * \param[in] psHciHandle psHciHandle is the handle or the context
265 * \param[in] pHwRef pHwRef is the Information of
266 * the Device Interface Link .
267 * \param[in] discovery_type If True: Start re-polling of the target
268 * after the Target Device is de-activated
269 * or else - continue discovery with next
271 * \retval NFCSTATUS_PENDING The Discovery Wheel retarted.
272 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
273 * could not be interpreted properly.
274 * \retval Other errors Errors related to the other layers
280 phHciNfc_Restart_Discovery (
283 uint8_t discovery_type
288 * \ingroup grp_hci_nfc
290 * The phHciNfc_Start_Discovery function Starts the Polling Wheel.
292 * \param[in] psHciHandle psHciHandle is the handle or the context
294 * \param[in] pHwRef pHwRef is the Information of
295 * the Device Interface Link .
296 * \retval NFCSTATUS_PENDING The Discovery Wheel Started.
297 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
298 * could not be interpreted properly.
299 * \retval Other errors Errors related to the other layers
305 phHciNfc_Start_Discovery (
312 * \ingroup grp_hci_nfc
314 * The phHciNfc_Stop_Discovery function Stops the Polling Wheel.
316 * \param[in] psHciHandle psHciHandle is the handle or the context
318 * \param[in] pHwRef pHwRef is the Information of
319 * the Device Interface Link .
320 * \retval NFCSTATUS_PENDING The Discovery Wheel Stopped.
321 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
322 * could not be interpreted properly.
323 * \retval Other errors Errors related to the other layers
329 phHciNfc_Stop_Discovery (
336 * \ingroup grp_hci_nfc
338 * The phHciNfc_Configure function Configures Configures the Polling Wheel to
339 * select the kind of Tags to be polled. This also allows to enable/disable
340 * the Tag Emulation. This also configures the Secure elements the UICC, WI and
341 * Target to Emulate the Tag or Target.
344 * \param[in] psHciHandle psHciHandle is the handle or the context
346 * \param[in] pHwRef pHwRef is the Information of
347 * the Device Interface Link .
348 * \param[in] config_type config_type specifies the type of the
349 * Parameter configuration.
350 * \param[in] pConfig pConfig is the Information for
351 * Configuring the Device.
352 * \retval NFCSTATUS_PENDING The Emulation configuration pending.
353 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
354 * could not be interpreted properly.
355 * \retval Other errors Errors related to the other layers
364 phHal_eConfigType_t config_type,
365 phHal_uConfig_t *pConfig
369 * \ingroup grp_hci_nfc
371 * The phHciNfc_Switch_SmxMode function Switches the WI(S2C) interface
372 * from Wired/Virtual to vice versa.
375 * \param[in] psHciHandle psHciHandle is the handle or the context
377 * \param[in] pHwRef pHwRef is the Information of
378 * the Device Interface Link .
379 * \param[in] smx_mode smx_mode specifies the type of the switch
381 * \param[in] pPollConfig pPollConfig is the Information for
382 * polling the SmartMX Device.
383 * \retval NFCSTATUS_PENDING The SmartMX Mode Switch pending.
384 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
385 * could not be interpreted properly.
386 * \retval Other errors Errors related to the other layers
391 phHciNfc_Switch_SmxMode (
394 phHal_eSmartMX_Mode_t smx_mode,
395 phHal_sADD_Cfg_t *pPollConfig
400 * \ingroup grp_hci_nfc
402 * The phHciNfc_Switch_SwpMode function Switches the SWP Link
403 * from On/Off to vice versa.
406 * \param[in] psHciHandle psHciHandle is the handle or the context
408 * \param[in] pHwRef pHwRef is the Information of
409 * the Device Interface Link .
410 * \param[in] swp_mode swp_mode specifies to switch on/off the
412 * \retval NFCSTATUS_PENDING The SWP Mode Switch pending.
413 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
414 * could not be interpreted properly.
415 * \retval Other errors Errors related to the other layers
420 phHciNfc_Switch_SwpMode (
423 phHal_eSWP_Mode_t swp_mode /* ,
430 * \ingroup grp_hci_nfc
432 * The phHciNfc_Connect function selects the discovered target to
433 * perform the transactions on it.
436 * \param[in] psHciHandle psHciHandle is the handle or the context
438 * \param[in] pHwRef pHwRef is the Information of
439 * the Device Interface Link .
440 * \param[in] p_remote_dev_info p_remote_dev_info is the information
441 * of the Target Device to be connected .
442 * \retval NFCSTATUS_PENDING To select the remote target pending.
443 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
444 * could not be interpreted properly.
445 * \retval Other errors Errors related to the other layers
454 phHal_sRemoteDevInformation_t *p_remote_dev_info
459 * \ingroup grp_hci_nfc
461 * The phHciNfc_Reactiavte function reactivates the discovered target to
462 * and selects that target perform the transactions on it.
465 * \param[in] psHciHandle psHciHandle is the handle or the context
467 * \param[in] pHwRef pHwRef is the Information of
468 * the Device Interface Link .
469 * \param[in] p_remote_dev_info p_remote_dev_info is the information
470 * of the Target Device to be reactivated .
471 * \retval NFCSTATUS_PENDING To reactivate the remote target pending.
472 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
473 * could not be interpreted properly.
474 * \retval Other errors Errors related to the other layers
481 phHciNfc_Reactivate (
484 phHal_sRemoteDevInformation_t *p_target_info
489 * \ingroup grp_hci_nfc
491 * The phHciNfc_Disconnect function de-selects the selected target and
492 * any ongoing transactions .
495 * \param[in] psHciHandle psHciHandle is the handle or the context
497 * \param[in] pHwRef pHwRef is the Information of
498 * the Device Interface Link .
499 * \param[in] discovery_type If NFC_RF_DISCOVERY_REPOLL: Start re-polling of
500 * the target after the Target Device is
501 * de-activatedor if NFC_RF_DISCOVERY_CONTINUE -
502 * continue discovery with next technology or
503 * stop the discovery wheel.
505 * \retval NFCSTATUS_PENDING To De-select the remote target pending.
506 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
507 * could not be interpreted properly.
508 * \retval Other errors Errors related to the other layers
514 phHciNfc_Disconnect (
517 uint8_t discovery_type
522 * \ingroup grp_hci_nfc
524 * The phHciNfc_Presence_Check function checks for the presence of the target
525 * selected in the vicinity of the Reader's RF Field .
528 * \param[in] psHciHandle psHciHandle is the handle or the context
530 * \param[in] pHwRef pHwRef is the Information of
531 * the Device Interface Link .
532 * \retval NFCSTATUS_PENDING Presence Check of the remote target
534 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
535 * could not be interpreted properly.
536 * \retval Other errors Errors related to the other layers
542 phHciNfc_Presence_Check (
549 * \ingroup grp_hci_nfc
551 * The phHciNfc_Select_Next_Target function selects and activates the
552 * next target present in the the Reader's RF Field .
555 * \param[in] psHciHandle psHciHandle is the handle or the
556 * context of the HCI Layer.
557 * \param[in] pHwRef pHwRef is the Information of
558 * the Device Interface Link .
559 * \retval NFCSTATUS_PENDING selection and activation of the next
560 * remote target pending.
561 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
562 * could not be interpreted properly.
563 * \retval Other errors Errors related to the other layers
569 phHciNfc_Select_Next_Target (
576 * \ingroup grp_hci_nfc
578 * The phHciNfc_Exchange_Data function exchanges the data
579 * to/from the selected remote target device.
582 * \param[in] psHciHandle psHciHandle is the handle or the context
584 * \param[in] pHwRef pHwRef is the Information of
585 * the Device Interface Link .
586 * \param[in] p_remote_dev_info p_remote_dev_info is the information of the
587 * selected target to which data
589 * \param[in] p_xchg_info The exchange info contains the command type,
590 * addr and data to be sent to the connected
591 * remote target device.
592 * \retval NFCSTATUS_PENDING Data to remote target pending.
593 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
594 * could not be interpreted properly.
595 * \retval Other errors Errors related to the other layers
601 phHciNfc_Exchange_Data (
604 phHal_sRemoteDevInformation_t *p_remote_dev_info,
605 phHciNfc_XchgInfo_t *p_xchg_info
609 * \ingroup grp_hci_nfc
611 * The phHciNfc_Send_Data function Sends the data provided
612 * to the appropriate remote target device.
615 * \param[in] psHciHandle psHciHandle is the handle or the context
617 * \param[in] pHwRef pHwRef is the Information of
618 * the Device Interface Link .
619 * \param[in] p_remote_dev_info p_remote_dev_info is the information
620 * of the selected target to which data
622 * \param[in] p_send_param The send param contains the
623 * data to be sent to the
625 * \retval NFCSTATUS_PENDING Data to remote device pending.
626 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
627 * could not be interpreted properly.
628 * \retval Other errors Errors related to the other layers
637 phHal_sRemoteDevInformation_t *p_remote_dev_info,
638 phHciNfc_XchgInfo_t *p_send_param
642 * \ingroup grp_hci_nfc
644 * The phHciNfc_System_Test function performs the System Management Tests
645 * provided by the NFC Peripheral device.
647 * \param[in] psContext psContext is the pointer to HCI Layer
649 * \param[in] pHwRef pHwRef is the Information of
650 * the Device Interface Link .
651 * \param[in] test_type test_type is the type of the Self Test
652 * that needs to be performed on the device.
653 * \param[in] test_param test_param is the parameter for the Self Test
654 * that needs to be performed on the device.
657 * \retval NFCSTATUS_PENDING System Test on the System Management
659 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
660 * could not be interpreted properly.
661 * \retval Other errors Errors related to the other layers
667 phHciNfc_System_Test(
671 phNfc_sData_t *test_param
675 * \ingroup grp_hci_nfc
677 * The phHciNfc_System_Configure function performs the System Management
678 * Configuration with the value provided.
680 * \param[in] psContext psContext is the pointer to HCI Layer
682 * \param[in] pHwRef pHwRef is the Information of
683 * the Device Interface Link .
684 * \param[in] config_type config_type is the type of the configuration
685 * that needs to be performed on the device.
686 * \param[in] config_value config_value is the value for the configuring
687 * that needs to be performed on the device.
690 * \retval NFCSTATUS_PENDING Configuration of the provided information to
692 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
693 * could not be interpreted properly.
694 * \retval Other errors Errors related to the other layers
699 phHciNfc_System_Configure (
702 uint32_t config_type,
707 * \ingroup grp_hci_nfc
709 * The phHciNfc_System_Get_Info function obtains the System Management
710 * information from the address provided.
712 * \param[in] psContext psContext is the pointer to HCI Layer
714 * \param[in] pHwRef pHwRef is the Information of
715 * the Device Interface Link .
716 * \param[in] info_type info_type is the type of the Information
717 * that needs to be obtained from the device.
718 * \param[in,out] p_val p_val is the pointer to which the
719 * information need to be updated.
722 * \retval NFCSTATUS_PENDING Get information from the NFC Device
724 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
725 * could not be interpreted properly.
726 * \retval Other errors Errors related to the other layers
731 phHciNfc_System_Get_Info(
744 phNfc_sData_t *test_param
750 phHciNfc_Receive_Data (