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_RFReader.c *
22 * \brief HCI RF Reader Management Gate Routines. *
25 * Project: NFC-FRI-1.1 *
27 * $Date: Wed Apr 21 12:21:15 2010 $ *
28 * $Author: ing07385 $ *
30 * $Aliases: NFC_FRI1.1_WK1007_R33_6 $ *
32 * =========================================================================== *
36 ***************************** Header File Inclusion ****************************
38 #include <phNfcConfig.h>
39 #include <phNfcCompId.h>
40 #include <phHciNfc_Pipe.h>
41 #include <phHciNfc_RFReader.h>
42 #include <phHciNfc_RFReaderA.h>
44 #include <phHciNfc_RFReaderB.h>
47 #include <phHciNfc_NfcIPMgmt.h>
50 #include <phHciNfc_Felica.h>
53 #include <phHciNfc_Jewel.h>
56 #include <phHciNfc_ISO15693.h>
57 #endif /* #ifdef TYPE_ISO15693 */
58 #include <phOsalNfc.h>
61 ****************************** Macro Definitions *******************************
64 #define NFCIP_ACTIVATE_DELAY 0x05U
66 uint8_t nxp_nfc_isoxchg_timeout = NXP_ISO_XCHG_TIMEOUT;
68 *************************** Structure and Enumeration ***************************
72 /** \defgroup grp_hci_nfc HCI Reader RF Management Component
78 typedef enum phHciNfc_ReaderMgmt_Seq{
79 READERA_PIPE_OPEN = 0x00U,
81 FELICA_PROP_PIPE_OPEN,
83 ISO15693_PROP_PIPE_OPEN,
84 NFCIP1_INITIATOR_PIPE_OPEN,
85 NFCIP1_INITIATOR_MODE_CONFIG,
86 NFCIP1_INITIATOR_PSL1_CONFIG,
87 NFCIP1_INITIATOR_PSL2_CONFIG,
88 READERA_DISABLE_AUTO_ACTIVATE,
93 FELICA_PROP_PIPE_CLOSE,
94 JEWEL_PROP_PIPE_CLOSE,
95 ISO15693_PROP_PIPE_CLOSE,
96 NFCIP1_INITIATOR_PIPE_CLOSE,
98 } phHciNfc_ReaderMgmt_Seq_t;
100 typedef struct phHciNfc_ReaderMgmt_Info{
101 phHciNfc_ReaderMgmt_Seq_t rf_gate_cur_seq;
102 phHciNfc_ReaderMgmt_Seq_t rf_gate_next_seq;
103 } phHciNfc_ReaderMgmt_Info_t;
107 *************************** Static Function Declaration **************************
111 phHciNfc_ReaderMgmt_End_Discovery(
112 phHciNfc_sContext_t *psHciContext,
114 uint8_t reader_pipe_id
119 phHciNfc_ReaderMgmt_Initiate_Discovery(
120 phHciNfc_sContext_t *psHciContext,
122 uint8_t reader_pipe_id
126 *************************** Function Definitions ***************************
131 * \brief Allocates the resources of RF Reader Managment Gate.
133 * This function Allocates the resources of the RF Reader Management
134 * gate Information Structure.
139 phHciNfc_ReaderMgmt_Init_Resources(
140 phHciNfc_sContext_t *psHciContext
143 NFCSTATUS status = NFCSTATUS_SUCCESS;
144 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
145 if( NULL == psHciContext )
147 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
151 if( ( NULL == psHciContext->p_reader_mgmt_info )
152 && (phHciNfc_Allocate_Resource((void **)(&p_reader_mgmt_info),
153 sizeof(phHciNfc_ReaderMgmt_Info_t))== NFCSTATUS_SUCCESS)
156 psHciContext->p_reader_mgmt_info = p_reader_mgmt_info;
157 p_reader_mgmt_info->rf_gate_cur_seq = READERA_PIPE_OPEN;
158 p_reader_mgmt_info->rf_gate_next_seq = END_READER_SEQUENCE;
162 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES);
171 * \brief Updates the Sequence of RF Reader Managment Gate.
173 * This function Resets/Updates the sequence of the RF Reader Management
179 phHciNfc_ReaderMgmt_Update_Sequence(
180 phHciNfc_sContext_t *psHciContext,
181 phHciNfc_eSeqType_t reader_seq
184 NFCSTATUS status = NFCSTATUS_SUCCESS;
185 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info = NULL;
186 if( NULL == psHciContext )
188 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
192 if( NULL == psHciContext->p_reader_mgmt_info )
194 status = PHNFCSTVAL(CID_NFC_HCI,
195 NFCSTATUS_INVALID_HCI_INFORMATION);
199 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
200 psHciContext->p_reader_mgmt_info ;
206 p_reader_mgmt_info->rf_gate_cur_seq = READERA_PIPE_OPEN;
207 p_reader_mgmt_info->rf_gate_next_seq = END_READER_SEQUENCE;
212 p_reader_mgmt_info->rf_gate_cur_seq =
213 p_reader_mgmt_info->rf_gate_next_seq;
218 status = phHciNfc_ReaderA_Update_Info(psHciContext,
219 HCI_READER_A_INFO_SEQ, NULL);
220 #if defined( TYPE_B )
221 status = phHciNfc_ReaderB_Update_Info(psHciContext,
222 HCI_READER_B_INFO_SEQ, NULL);
223 #endif /* end of #if defined(TYPE_B) */
224 #if defined( TYPE_FELICA )
225 status = phHciNfc_Felica_Update_Info(psHciContext,
226 HCI_FELICA_INFO_SEQ, NULL);
227 #endif /* end of #if defined(TYPE_FELICA) */
228 #if defined( TYPE_JEWEL )
229 status = phHciNfc_Jewel_Update_Info(psHciContext,
230 HCI_JEWEL_INFO_SEQ, NULL);
231 #endif /* end of #if defined(TYPE_JEWEL) */
232 #if defined( TYPE_ISO15693 )
233 status = phHciNfc_ISO15693_Update_Info(psHciContext,
234 HCI_ISO_15693_INFO_SEQ, NULL);
235 #endif /* end of #if defined(TYPE_ISO15693) */
240 p_reader_mgmt_info->rf_gate_cur_seq = READERA_PIPE_CLOSE;
241 p_reader_mgmt_info->rf_gate_next_seq = END_READER_SEQUENCE;
258 * \brief Initialisation of RF Reader Managment Gate.
260 * This function initialses the RF Reader Management gate and
261 * populates the Reader Management Information Structure
266 phHciNfc_ReaderMgmt_Initialise(
267 phHciNfc_sContext_t *psHciContext,
271 NFCSTATUS status = NFCSTATUS_SUCCESS;
272 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
273 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
275 if( NULL == psHciContext )
277 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
282 if( ( NULL == psHciContext->p_reader_mgmt_info )
283 && (phHciNfc_Allocate_Resource((void **)(&p_reader_mgmt_info),
284 sizeof(phHciNfc_ReaderMgmt_Info_t))== NFCSTATUS_SUCCESS)
287 psHciContext->p_reader_mgmt_info = p_reader_mgmt_info;
288 p_reader_mgmt_info->rf_gate_cur_seq = READERA_PIPE_OPEN;
289 p_reader_mgmt_info->rf_gate_next_seq = END_READER_SEQUENCE;
293 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
294 psHciContext->p_reader_mgmt_info ;
297 if( NULL == psHciContext->p_reader_mgmt_info )
299 status = PHNFCSTVAL(CID_NFC_HCI,
300 NFCSTATUS_INSUFFICIENT_RESOURCES);
302 #ifdef ESTABLISH_SESSION
303 else if( hciMode_Session == psHciContext->hci_mode )
305 status = NFCSTATUS_SUCCESS;
310 switch(p_reader_mgmt_info->rf_gate_cur_seq )
312 /* Reader A pipe open sequence */
313 case READERA_PIPE_OPEN:
315 p_pipe_info = ((phHciNfc_ReaderA_Info_t *)
316 psHciContext->p_reader_a_info)->p_pipe_info;
317 if(NULL == p_pipe_info )
319 status = PHNFCSTVAL(CID_NFC_HCI,
320 NFCSTATUS_INVALID_HCI_SEQUENCE);
324 status = phHciNfc_Open_Pipe( psHciContext,
325 pHwRef, p_pipe_info );
326 if(status == NFCSTATUS_SUCCESS)
328 uint8_t rdr_enable = TRUE;
329 status = phHciNfc_ReaderA_Update_Info(
330 psHciContext, HCI_READER_A_ENABLE,
332 #if defined( TYPE_B ) && defined ( ENABLE_AUTO_ACTIVATE )
333 p_reader_mgmt_info->rf_gate_next_seq =
335 status = NFCSTATUS_PENDING;
336 /* end of #ifdef TYPE_B */
337 #elif !defined( ENABLE_AUTO_ACTIVATE )
338 p_reader_mgmt_info->rf_gate_next_seq =
339 READERA_DISABLE_AUTO_ACTIVATE;
340 status = NFCSTATUS_PENDING;
341 /* #ifdef ENABLE_AUTO_ACTIVATE */
342 #elif defined( ENABLE_P2P )
343 p_reader_mgmt_info->rf_gate_next_seq =
344 NFCIP1_INITIATOR_PIPE_OPEN;
345 status = NFCSTATUS_PENDING;
346 /* #ifdef ENABLE_P2P */
348 p_reader_mgmt_info->rf_gate_next_seq =
350 /* status = NFCSTATUS_PENDING; */
356 /* Reader A Auto Activate Disable */
357 case READERA_DISABLE_AUTO_ACTIVATE:
359 uint8_t activate_enable = FALSE;
360 p_pipe_info = ((phHciNfc_ReaderA_Info_t *)
361 psHciContext->p_reader_a_info)->p_pipe_info;
362 if(NULL == p_pipe_info )
364 status = PHNFCSTVAL(CID_NFC_HCI,
365 NFCSTATUS_INVALID_HCI_SEQUENCE);
370 status = phHciNfc_ReaderA_Auto_Activate( psHciContext,
371 pHwRef, activate_enable );
372 if(status == NFCSTATUS_SUCCESS)
375 p_reader_mgmt_info->rf_gate_next_seq =
377 status = NFCSTATUS_PENDING;
378 /* end of #ifdef TYPE_B */
379 #elif defined(TYPE_FELICA)
380 p_reader_mgmt_info->rf_gate_next_seq =
381 FELICA_PROP_PIPE_OPEN;
382 status = NFCSTATUS_PENDING;
383 /* end of #elif defined(TYPE_FELICA) */
384 #elif defined(TYPE_JEWEL)
385 p_reader_mgmt_info->rf_gate_next_seq =
386 JEWEL_PROP_PIPE_OPEN;
387 status = NFCSTATUS_PENDING;
388 /* end of #elif defined(TYPE_JEWEL) */
389 #elif defined (TYPE_ISO15693)
390 p_reader_mgmt_info->rf_gate_next_seq =
391 ISO15693_PROP_PIPE_OPEN;
392 status = NFCSTATUS_PENDING;
393 /* end of #elif defined(TYPE_ISO15693) */
394 #elif defined(ENABLE_P2P)
395 p_reader_mgmt_info->rf_gate_next_seq =
396 NFCIP1_INITIATOR_PIPE_OPEN;
397 status = NFCSTATUS_PENDING;
398 /* end of #ifdef ENABLE_P2P */
400 p_reader_mgmt_info->rf_gate_next_seq =
402 /* status = NFCSTATUS_PENDING; */
403 #endif /* #if !defined(ENABLE_P2P) && !defined(TYPE_B)*/
409 /* Reader B pipe open sequence */
410 case READERB_PIPE_OPEN:
412 p_pipe_info = ((phHciNfc_ReaderB_Info_t *)
413 psHciContext->p_reader_b_info)->p_pipe_info;
414 if(NULL == p_pipe_info )
416 status = PHNFCSTVAL(CID_NFC_HCI,
417 NFCSTATUS_INVALID_HCI_SEQUENCE);
421 status = phHciNfc_Open_Pipe( psHciContext,
422 pHwRef, p_pipe_info );
423 if(status == NFCSTATUS_SUCCESS)
425 #if defined(TYPE_FELICA)
426 p_reader_mgmt_info->rf_gate_next_seq =
427 FELICA_PROP_PIPE_OPEN;
428 status = NFCSTATUS_PENDING;
429 /* end of #ifdef TYPE_FELICA */
430 #elif defined(TYPE_JEWEL)
431 p_reader_mgmt_info->rf_gate_next_seq =
432 JEWEL_PROP_PIPE_OPEN;
433 status = NFCSTATUS_PENDING;
434 /* end of #elif defined(TYPE_JEWEL) */
435 #elif defined (TYPE_ISO15693)
436 p_reader_mgmt_info->rf_gate_next_seq =
437 ISO15693_PROP_PIPE_OPEN;
438 status = NFCSTATUS_PENDING;
439 /* end of #elif defined(TYPE_ISO15693) */
440 #elif defined(ENABLE_P2P)
441 p_reader_mgmt_info->rf_gate_next_seq =
442 NFCIP1_INITIATOR_PIPE_OPEN;
443 status = NFCSTATUS_PENDING;
444 /* end of #ifdef ENABLE_P2P */
446 p_reader_mgmt_info->rf_gate_next_seq =
448 /* status = NFCSTATUS_PENDING; */
449 #endif /* #if !defined(ENABLE_P2P) && !defined(TYPE_FELICA)*/
454 #endif /* #ifdef TYPE_B */
456 /* Felica Reader pipe open sequence */
457 case FELICA_PROP_PIPE_OPEN:
459 p_pipe_info = ((phHciNfc_Felica_Info_t *)
460 psHciContext->p_felica_info)->p_pipe_info;
461 if(NULL == p_pipe_info )
463 status = PHNFCSTVAL(CID_NFC_HCI,
464 NFCSTATUS_INVALID_HCI_SEQUENCE);
468 status = phHciNfc_Open_Pipe( psHciContext,
469 pHwRef, p_pipe_info );
470 if(status == NFCSTATUS_SUCCESS)
472 #if defined(TYPE_JEWEL)
473 p_reader_mgmt_info->rf_gate_next_seq =
474 JEWEL_PROP_PIPE_OPEN;
475 status = NFCSTATUS_PENDING;
476 /* end of #if defined(TYPE_JEWEL) */
477 #elif defined (TYPE_ISO15693)
478 p_reader_mgmt_info->rf_gate_next_seq =
479 ISO15693_PROP_PIPE_OPEN;
480 status = NFCSTATUS_PENDING;
481 /* end of #elif defined(TYPE_ISO15693) */
482 #elif defined(ENABLE_P2P)
483 p_reader_mgmt_info->rf_gate_next_seq =
484 NFCIP1_INITIATOR_PIPE_OPEN;
485 status = NFCSTATUS_PENDING;
486 /* end of #ifdef ENABLE_P2P */
488 p_reader_mgmt_info->rf_gate_next_seq =
490 /* status = NFCSTATUS_PENDING; */
491 #endif /* #if !defined(ENABLE_P2P) */
498 /* Jewel Reader pipe open sequence */
499 case JEWEL_PROP_PIPE_OPEN:
501 p_pipe_info = ((phHciNfc_Jewel_Info_t *)
502 psHciContext->p_jewel_info)->p_pipe_info;
503 if(NULL == p_pipe_info )
505 status = PHNFCSTVAL(CID_NFC_HCI,
506 NFCSTATUS_INVALID_HCI_SEQUENCE);
510 status = phHciNfc_Open_Pipe( psHciContext,
511 pHwRef, p_pipe_info );
512 if(status == NFCSTATUS_SUCCESS)
514 #if defined (TYPE_ISO15693)
515 p_reader_mgmt_info->rf_gate_next_seq =
516 ISO15693_PROP_PIPE_OPEN;
517 status = NFCSTATUS_PENDING;
518 /* end of #if defined(TYPE_ISO15693) */
519 #elif defined (ENABLE_P2P)
520 p_reader_mgmt_info->rf_gate_next_seq =
521 NFCIP1_INITIATOR_PIPE_OPEN;
522 status = NFCSTATUS_PENDING;
523 /* end of #ifdef ENABLE_P2P */
525 p_reader_mgmt_info->rf_gate_next_seq =
527 /* status = NFCSTATUS_PENDING; */
528 #endif /* #if !defined(ENABLE_P2P) */
536 /* ISO15693 Reader pipe open sequence */
537 case ISO15693_PROP_PIPE_OPEN:
539 p_pipe_info = ((phHciNfc_ISO15693_Info_t *)
540 psHciContext->p_iso_15693_info)->ps_15693_pipe_info;
541 if(NULL == p_pipe_info )
543 status = PHNFCSTVAL(CID_NFC_HCI,
544 NFCSTATUS_INVALID_HCI_SEQUENCE);
548 status = phHciNfc_Open_Pipe( psHciContext,
549 pHwRef, p_pipe_info );
550 if(status == NFCSTATUS_SUCCESS)
553 p_reader_mgmt_info->rf_gate_next_seq =
554 NFCIP1_INITIATOR_PIPE_OPEN;
555 status = NFCSTATUS_PENDING;
556 /* end of #ifdef ENABLE_P2P */
558 p_reader_mgmt_info->rf_gate_next_seq =
560 /* status = NFCSTATUS_PENDING; */
561 #endif /* #if !defined(ENABLE_P2P) */
570 /* NFC-IP1 Initiator pipe open sequence */
571 case NFCIP1_INITIATOR_PIPE_OPEN:
574 ((phHciNfc_NfcIP_Info_t *)psHciContext->
575 p_nfcip_info)->p_init_pipe_info;
576 if(NULL == p_pipe_info )
578 status = PHNFCSTVAL(CID_NFC_HCI,
579 NFCSTATUS_INVALID_HCI_SEQUENCE);
583 status = phHciNfc_Open_Pipe( psHciContext,
584 pHwRef, p_pipe_info );
585 if(status == NFCSTATUS_SUCCESS)
587 p_reader_mgmt_info->rf_gate_next_seq =
588 NFCIP1_INITIATOR_MODE_CONFIG;
589 status = NFCSTATUS_PENDING;
594 case NFCIP1_INITIATOR_MODE_CONFIG:
596 uint8_t mode = DEFAULT_NFCIP_INITIATOR_MODE_SUPPORT;
597 status = phHciNfc_NfcIP_SetMode( psHciContext, pHwRef,
598 NFCIP_INITIATOR, mode);
599 if(status == NFCSTATUS_PENDING )
601 p_reader_mgmt_info->rf_gate_next_seq =
602 NFCIP1_INITIATOR_PSL1_CONFIG;
603 /* status = NFCSTATUS_SUCCESS; */
607 case NFCIP1_INITIATOR_PSL1_CONFIG:
609 uint8_t psl_config = NXP_NFCIP_PSL_BRS_DEFAULT;
610 status = phHciNfc_NfcIP_SetPSL1( psHciContext, pHwRef,
612 if(status == NFCSTATUS_PENDING )
614 p_reader_mgmt_info->rf_gate_next_seq =
616 status = NFCSTATUS_SUCCESS;
623 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE);
627 }/* End of the Sequence Switch */
629 }/* End of the Reader Info Memory Check */
631 } /* End of Null Context Check */
638 * \brief Initiate the Discovery for the RF Reader .
640 * This function starts the Polling Loop and initiates the discovery
646 phHciNfc_ReaderMgmt_Initiate_Discovery(
647 phHciNfc_sContext_t *psHciContext,
649 uint8_t reader_pipe_id
652 NFCSTATUS status = NFCSTATUS_SUCCESS;
654 if( ( NULL == psHciContext )
655 || ( NULL == pHwRef )
656 || ( HCI_UNKNOWN_PIPE_ID == reader_pipe_id)
659 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
664 status = phHciNfc_Send_RFReader_Event ( psHciContext, pHwRef,
665 reader_pipe_id,(uint8_t) EVT_READER_REQUESTED );
666 status = ( (status == NFCSTATUS_PENDING)?
667 NFCSTATUS_SUCCESS : status);
674 * \brief End the Discovery of the RF Reader .
676 * This function stops the Polling Loop and ends the discovery
682 phHciNfc_ReaderMgmt_End_Discovery(
683 phHciNfc_sContext_t *psHciContext,
685 uint8_t reader_pipe_id
688 NFCSTATUS status = NFCSTATUS_SUCCESS;
690 if( ( NULL == psHciContext )
691 || ( NULL == pHwRef )
692 || ( HCI_UNKNOWN_PIPE_ID == reader_pipe_id)
695 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
700 status = phHciNfc_Send_RFReader_Event ( psHciContext, pHwRef,
701 reader_pipe_id,(uint8_t) EVT_END_OPERATION );
702 status = ( (status == NFCSTATUS_PENDING)?
703 NFCSTATUS_SUCCESS : status);
710 * \brief Enable the Discovery of RF Reader Managment Gate.
712 * This function Enable the discovery of the RF Reader Management
719 phHciNfc_ReaderMgmt_Enable_Discovery(
720 phHciNfc_sContext_t *psHciContext,
724 NFCSTATUS status = NFCSTATUS_SUCCESS;
725 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
726 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
727 /* phHal_sADD_Cfg_t *p_poll_config = (phHal_sADD_Cfg_t * )
728 psHciContext->p_config_params; */
729 PHNFC_UNUSED_VARIABLE(p_reader_mgmt_info);
730 if( NULL != psHciContext->p_reader_mgmt_info )
732 uint8_t rdr_enable = FALSE;
733 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
734 psHciContext->p_reader_mgmt_info ;
736 if ( (NULL != psHciContext->p_reader_b_info )
737 /* && (FALSE == rdr_enable) */
740 /* Get the Reader B Pipe ID */
741 status = phHciNfc_ReaderB_Get_PipeID
742 (psHciContext, &reader_pipe_id);
744 if( NFCSTATUS_SUCCESS == status )
746 rdr_enable = (uint8_t)TRUE;
747 /* rdr_enable = (uint8_t)
748 p_poll_config->PollDevInfo.PollCfgInfo.EnableIso14443B; */
749 status = phHciNfc_ReaderB_Update_Info(psHciContext,
750 HCI_RDR_ENABLE_TYPE, &rdr_enable);
755 if ( (NULL != psHciContext->p_felica_info )
756 /* && (FALSE == rdr_enable) */
759 /* Get the Reader F Pipe ID */
760 status = phHciNfc_Felica_Get_PipeID
761 (psHciContext, &reader_pipe_id);
763 if( NFCSTATUS_SUCCESS == status )
765 rdr_enable = (uint8_t)TRUE;
766 /* rdr_enable = (uint8_t)
767 ( p_poll_config->PollDevInfo.PollCfgInfo.EnableFelica212
768 || p_poll_config->PollDevInfo.PollCfgInfo.EnableFelica424 ); */
769 status = phHciNfc_Felica_Update_Info(psHciContext,
770 HCI_RDR_ENABLE_TYPE, &rdr_enable);
775 if ( (NULL != psHciContext->p_jewel_info )
776 /* && (FALSE == rdr_enable) */
779 /* Get the Reader F Pipe ID */
780 status = phHciNfc_Jewel_Get_PipeID
781 (psHciContext, &reader_pipe_id);
783 if( NFCSTATUS_SUCCESS == status )
785 rdr_enable = (uint8_t)TRUE;
786 status = phHciNfc_Jewel_Update_Info(psHciContext,
787 HCI_RDR_ENABLE_TYPE, &rdr_enable);
790 #endif /* #ifdef TYPE_JEWEL */
791 #if defined(TYPE_ISO15693)
792 if ( (NULL != psHciContext->p_iso_15693_info )
793 /* && (FALSE == rdr_enable) */
796 /* Get the Reader F Pipe ID */
797 status = phHciNfc_ISO15693_Get_PipeID
798 (psHciContext, &reader_pipe_id);
800 if( NFCSTATUS_SUCCESS == status )
802 rdr_enable = (uint8_t)TRUE;
803 status = phHciNfc_ISO15693_Update_Info(psHciContext,
804 HCI_RDR_ENABLE_TYPE, &rdr_enable);
808 /* end of #elif defined(TYPE_ISO15693) */
811 if(NULL != psHciContext->p_reader_a_info)
813 /* Get the Reader A Pipe ID */
814 status = phHciNfc_ReaderA_Get_PipeID
815 (psHciContext, &reader_pipe_id);
817 if( NFCSTATUS_SUCCESS == status )
819 rdr_enable = (uint8_t)TRUE;
820 status = phHciNfc_ReaderA_Update_Info(psHciContext,
821 HCI_RDR_ENABLE_TYPE, &rdr_enable);
825 if( ( NFCSTATUS_SUCCESS == status )
826 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
829 status = phHciNfc_ReaderMgmt_Initiate_Discovery( psHciContext,
830 pHwRef, reader_pipe_id);
833 }/* End of the Reader Info Memory Check */
839 * \brief Disable the Discovery of RF Reader Managment Gate.
841 * This function Disable the discovery of the RF Reader Management
847 phHciNfc_ReaderMgmt_Disable_Discovery(
848 phHciNfc_sContext_t *psHciContext,
852 NFCSTATUS status = NFCSTATUS_FAILED;
853 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
854 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
855 /* phHal_sADD_Cfg_t *p_poll_config = (phHal_sADD_Cfg_t * )
856 psHciContext->p_config_params; */
857 PHNFC_UNUSED_VARIABLE(p_reader_mgmt_info);
858 if( NULL != psHciContext->p_reader_mgmt_info )
860 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
861 psHciContext->p_reader_mgmt_info ;
862 if(NULL != psHciContext->p_reader_a_info)
864 /* Get the Reader A Pipe ID */
865 status = phHciNfc_ReaderA_Get_PipeID
866 (psHciContext, &reader_pipe_id);
868 if( NFCSTATUS_SUCCESS == status )
870 uint8_t rdr_enable = (uint8_t) FALSE;
871 status = phHciNfc_ReaderA_Update_Info(psHciContext,
872 HCI_RDR_ENABLE_TYPE, &rdr_enable);
878 else if((NULL != psHciContext->p_reader_b_info )
879 /* && (NFCSTATUS_SUCCESS != status) */
882 /* Get the Reader B Pipe ID */
883 status = phHciNfc_ReaderB_Get_PipeID
884 (psHciContext, &reader_pipe_id);
888 else if((NULL != psHciContext->p_felica_info )
889 /* && (NFCSTATUS_SUCCESS != status) */
892 /* Get the Reader B Pipe ID */
893 status = phHciNfc_Felica_Get_PipeID
894 (psHciContext, &reader_pipe_id);
898 else if((NULL != psHciContext->p_jewel_info )
899 /* && (NFCSTATUS_SUCCESS != status) */
902 /* Get the Reader B Pipe ID */
903 status = phHciNfc_Jewel_Get_PipeID
904 (psHciContext, &reader_pipe_id);
906 #endif /* #ifdef TYPE_JEWEL */
908 else if((NULL != psHciContext->p_iso_15693_info )
909 /* && (NFCSTATUS_SUCCESS != status) */
912 /* Get the Reader B Pipe ID */
913 status = phHciNfc_ISO15693_Get_PipeID
914 (psHciContext, &reader_pipe_id);
916 #endif /* #ifdef TYPE_ISO15693 */
920 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_NOT_ALLOWED);
923 if( (NFCSTATUS_SUCCESS == status)
924 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
927 status = phHciNfc_ReaderMgmt_End_Discovery( psHciContext,
928 pHwRef, reader_pipe_id);
931 }/* End of the Reader Info Memory Check */
940 * \brief Updates the Sequence of RF Reader Managment Gate.
942 * This function Resets/Updates the sequence of the RF Reader Management
948 phHciNfc_ReaderMgmt_Info_Sequence(
949 phHciNfc_sContext_t *psHciContext,
953 #if defined(NXP_NFCIP_ACTIVATE_DELAY)
954 static uint8_t nfc_atr_retry = 0;
956 NFCSTATUS status = NFCSTATUS_SUCCESS;
957 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
959 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
960 phHal_eRemDevType_t target_type = phHal_eUnknown_DevType;
964 PHNFC_UNUSED_VARIABLE(p_reader_mgmt_info);
965 if( NULL == psHciContext )
967 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
971 if( NULL != psHciContext->p_reader_mgmt_info )
973 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
974 psHciContext->p_reader_mgmt_info ;
975 switch( psHciContext->host_rf_type )
978 case phHal_eISO14443_A_PCD:
980 /* If the Target Info is updated then the Target
983 if(NULL == psHciContext->p_target_info)
985 #if defined(NXP_NFCIP_ACTIVATE_DELAY)
988 status = phHciNfc_ReaderA_Info_Sequence(
989 psHciContext, pHwRef );
993 status = phHciNfc_ReaderA_App_Data(
994 psHciContext, pHwRef );
995 status = ((NFCSTATUS_PENDING == status )?
996 NFCSTATUS_SUCCESS : status);
1001 case phHal_eNfcIP1_Initiator:
1003 /* If the Target Info is updated then the Target
1007 if(NULL == psHciContext->p_target_info)
1010 status = phHciNfc_NfcIP_Info_Sequence(
1011 psHciContext, pHwRef
1013 ,(NULL == psHciContext->p_target_info)
1014 #endif /* #ifdef NOTIFY_REQD */
1020 status = phHciNfc_NfcIP_GetATRInfo(
1021 psHciContext, pHwRef, NFCIP_INITIATOR );
1022 #if defined(NXP_NFCIP_ACTIVATE_DELAY)
1024 (NFCSTATUS_PENDING == status)
1025 && ( NFCIP_ACTIVATE_DELAY <= nfc_atr_retry)
1029 status = NFCSTATUS_SUCCESS;
1036 status = ((NFCSTATUS_PENDING == status )?
1037 NFCSTATUS_SUCCESS : status);
1045 case phHal_eISO14443_B_PCD:
1047 if(NULL == psHciContext->p_target_info)
1049 status = phHciNfc_ReaderB_Info_Sequence(
1050 psHciContext, pHwRef );
1054 #endif /* #ifdef TYPE_B */
1056 case phHal_eFelica_PCD:
1058 if(NULL == psHciContext->p_target_info)
1060 #if defined(NXP_NFCIP_ACTIVATE_DELAY)
1063 status = phHciNfc_Felica_Info_Sequence(
1064 psHciContext, pHwRef );
1068 #endif /* #ifdef TYPE_FELICA */
1070 case phHal_eJewel_PCD:
1072 if(NULL == psHciContext->p_target_info)
1074 status = phHciNfc_Jewel_Info_Sequence(
1075 psHciContext, pHwRef );
1079 #endif /* #ifdef TYPE_JEWEL */
1080 #if defined(TYPE_ISO15693)
1081 case phHal_eISO15693_PCD:
1083 if(NULL == psHciContext->p_target_info)
1085 status = phHciNfc_ISO15693_Info_Sequence(
1086 psHciContext, pHwRef );
1097 }/* End of the Reader Info Memory Check */
1099 } /* End of Null Context Check */
1107 * \brief Connects the the selected tag via RF Reader Gates.
1109 * This function connects the selected tags via RF Reader Gate.
1110 * This function uses the RF Reader gate based on the type of the
1116 phHciNfc_ReaderMgmt_Select(
1117 phHciNfc_sContext_t *psHciContext,
1119 phHal_eRemDevType_t target_type
1122 NFCSTATUS status = NFCSTATUS_SUCCESS;
1123 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1125 if( (NULL == psHciContext) || (NULL == pHwRef) )
1127 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1131 switch (target_type)
1133 case phHal_eMifare_PICC:
1134 case phHal_eISO14443_3A_PICC:
1136 /* Get the Reader A Pipe ID */
1137 status = phHciNfc_ReaderA_Get_PipeID
1138 (psHciContext, &reader_pipe_id);
1140 if( (NFCSTATUS_SUCCESS == status)
1141 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1144 status = phHciNfc_ReaderMgmt_Reactivate(
1145 psHciContext, pHwRef, target_type );
1149 case phHal_eISO14443_A_PICC:
1150 case phHal_eISO14443_4A_PICC:
1152 #ifdef ENABLE_AUTO_ACTIVATE
1153 /* Get the Reader A Pipe ID */
1154 status = phHciNfc_ReaderA_Get_PipeID
1155 (psHciContext, &reader_pipe_id);
1157 if( (NFCSTATUS_SUCCESS == status)
1158 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1161 status = phHciNfc_Send_RFReader_Command (psHciContext,
1162 pHwRef, reader_pipe_id, NXP_WR_PRESCHECK );
1165 status = phHciNfc_ReaderA_Cont_Activate(
1166 psHciContext, pHwRef);
1167 #endif /* #ifdef ENABLE_AUTO_ACTIVATE */
1171 case phHal_eISO14443_B_PICC:
1172 case phHal_eISO14443_4B_PICC:
1174 /* Get the Reader B Pipe ID */
1175 status = phHciNfc_ReaderB_Get_PipeID
1176 (psHciContext, &reader_pipe_id);
1178 if( (NFCSTATUS_SUCCESS == status)
1179 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1182 status = phHciNfc_Send_RFReader_Command (psHciContext,
1183 pHwRef, reader_pipe_id, NXP_WR_PRESCHECK );
1184 /* status = phHciNfc_ReaderA_Set_DataRateMax(
1185 psHciContext, pHwRef,
1186 DATA_RATE_MAX_DEFAULT_VALUE ); */
1187 /* status = phHciNfc_ReaderMgmt_Reactivate(
1188 psHciContext, pHwRef, target_type ); */
1192 #endif /* #ifdef TYPE_B */
1194 case phHal_eFelica_PICC:
1196 status = phHciNfc_Felica_Get_PipeID
1197 (psHciContext, &reader_pipe_id);
1199 if( (NFCSTATUS_SUCCESS == status)
1200 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1203 /* Get the Reader Felica Pipe ID */
1204 /* status = phHciNfc_ReaderA_Set_DataRateMax(
1205 psHciContext, pHwRef,
1206 DATA_RATE_MAX_DEFAULT_VALUE ); */
1207 status = phHciNfc_ReaderMgmt_Reactivate(
1208 psHciContext, pHwRef, target_type );
1212 #endif /* #ifdef TYPE_FELICA */
1214 case phHal_eJewel_PICC:
1216 /* Get the Reader jewel Pipe ID */
1217 status = phHciNfc_Jewel_Get_PipeID
1218 (psHciContext, &reader_pipe_id);
1220 if( (NFCSTATUS_SUCCESS == status)
1221 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1224 status = phHciNfc_Jewel_GetRID(
1225 psHciContext, pHwRef);
1229 #endif /* #ifdef TYPE_JEWEL */
1230 #ifdef TYPE_ISO15693
1231 case phHal_eISO15693_PICC:
1233 /* Get the Reader ISO 15693 Pipe ID */
1234 status = phHciNfc_ISO15693_Get_PipeID
1235 (psHciContext, &reader_pipe_id);
1237 if( (NFCSTATUS_SUCCESS == status)
1238 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1242 status = phHciNfc_ReaderA_Set_DataRateMax(
1243 psHciContext, pHwRef,
1244 DATA_RATE_MAX_DEFAULT_VALUE );
1248 #endif /* #ifdef TYPE_ISO15693 */
1250 case phHal_eNfcIP1_Target:
1252 if ( (phHal_eISO14443_A_PCD ==
1253 psHciContext->host_rf_type )
1254 || (phHal_eFelica_PCD ==
1255 psHciContext->host_rf_type )
1258 status = phHciNfc_Initiator_Cont_Activate(
1259 psHciContext, pHwRef);
1263 status = phHciNfc_NfcIP_Presence_Check (psHciContext, pHwRef);
1269 case phHal_eNfcIP1_Initiator:
1277 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
1281 } /* End of the tag_type Switch */
1288 phHciNfc_ReaderMgmt_UICC_Dispatch(
1289 phHciNfc_sContext_t *psHciContext,
1291 phHal_eRemDevType_t target_type
1294 NFCSTATUS status = NFCSTATUS_SUCCESS;
1295 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1296 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
1299 if( (NULL == psHciContext) || (NULL == pHwRef) )
1301 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1303 else if (NULL == psHciContext->p_target_info)
1305 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION);
1309 switch (target_type)
1311 case phHal_eISO14443_A_PICC:
1312 case phHal_eISO14443_4A_PICC:
1314 /* Get the Reader A Pipe ID */
1315 status = phHciNfc_ReaderA_Get_PipeID(
1316 psHciContext, &reader_pipe_id);
1317 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1318 p_pipe_info->param_info = &psHciContext->p_target_info->
1319 RemoteDevInfo.Iso14443A_Info.Uid;
1320 p_pipe_info->param_length = psHciContext->p_target_info->
1321 RemoteDevInfo.Iso14443A_Info.UidLength;
1326 case phHal_eISO14443_B_PICC:
1327 case phHal_eISO14443_4B_PICC:
1329 /* Get the Reader B Pipe ID */
1330 status = phHciNfc_ReaderB_Get_PipeID
1331 (psHciContext, &reader_pipe_id);
1333 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1334 p_pipe_info->param_info = &psHciContext->p_target_info->
1335 RemoteDevInfo.Iso14443B_Info.AtqB.AtqResInfo.Pupi;
1336 p_pipe_info->param_length = PHHAL_PUPI_LENGTH;
1339 #endif /* #ifdef TYPE_B */
1340 case phHal_eMifare_PICC:
1341 case phHal_eISO14443_3A_PICC:
1344 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
1348 } /* End of the tag_type Switch */
1350 if( (NFCSTATUS_SUCCESS == status)
1351 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1354 status = phHciNfc_Send_RFReader_Command (psHciContext,
1355 pHwRef, reader_pipe_id, NXP_WR_DISPATCH_TO_UICC );
1363 phHciNfc_ReaderMgmt_Reactivate(
1364 phHciNfc_sContext_t *psHciContext,
1366 phHal_eRemDevType_t target_type
1369 NFCSTATUS status = NFCSTATUS_SUCCESS;
1370 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1371 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
1374 if( (NULL == psHciContext) || (NULL == pHwRef) )
1376 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1378 else if (NULL == psHciContext->p_target_info)
1380 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION);
1384 switch (target_type)
1386 case phHal_eISO14443_A_PICC:
1387 case phHal_eMifare_PICC:
1388 case phHal_eISO14443_4A_PICC:
1389 case phHal_eISO14443_3A_PICC:
1391 /* Get the Reader A Pipe ID */
1392 status = phHciNfc_ReaderA_Get_PipeID(
1393 psHciContext, &reader_pipe_id);
1394 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1395 p_pipe_info->param_info = &psHciContext->p_target_info->
1396 RemoteDevInfo.Iso14443A_Info.Uid;
1397 p_pipe_info->param_length = psHciContext->p_target_info->
1398 RemoteDevInfo.Iso14443A_Info.UidLength;
1403 case phHal_eISO14443_B_PICC:
1404 case phHal_eISO14443_4B_PICC:
1406 /* Get the Reader B Pipe ID */
1407 status = phHciNfc_ReaderB_Get_PipeID
1408 (psHciContext, &reader_pipe_id);
1410 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1411 p_pipe_info->param_info = &psHciContext->p_target_info->
1412 RemoteDevInfo.Iso14443B_Info.AtqB.AtqResInfo.Pupi;
1413 p_pipe_info->param_length = PHHAL_PUPI_LENGTH;
1416 #endif /* #ifdef TYPE_B */
1418 case phHal_eFelica_PICC:
1420 /* Get the Felica Reader Pipe ID */
1421 status = phHciNfc_Felica_Get_PipeID
1422 (psHciContext, &reader_pipe_id);
1424 if( (NFCSTATUS_SUCCESS == status)
1425 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1428 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1429 p_pipe_info->param_info = &psHciContext->p_target_info->
1430 RemoteDevInfo.Felica_Info.IDm;
1431 p_pipe_info->param_length = PHHAL_FEL_ID_LEN;
1435 #endif /* #ifdef TYPE_FELICA */
1437 case phHal_eNfcIP1_Target:
1439 /* Get the Initiator Pipe ID */
1440 status = phHciNfc_Initiator_Get_PipeID(
1441 psHciContext, &reader_pipe_id);
1442 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1443 p_pipe_info->param_info = &psHciContext->p_target_info->
1444 RemoteDevInfo.NfcIP_Info.NFCID;
1445 p_pipe_info->param_length = psHciContext->p_target_info->
1446 RemoteDevInfo.NfcIP_Info.NFCID_Length;
1449 case phHal_eNfcIP1_Initiator:
1451 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
1454 #endif /* #ifdef ENABLE_P2P */
1457 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
1461 } /* End of the tag_type Switch */
1463 if( (NFCSTATUS_SUCCESS == status)
1464 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1467 status = phHciNfc_Send_RFReader_Command (psHciContext,
1468 pHwRef, reader_pipe_id, NXP_WR_ACTIVATE_ID );
1476 * \brief Activates the next Remote Target in the field.
1478 * This function selects and activates the next tag present in the field.
1483 phHciNfc_ReaderMgmt_Activate_Next(
1484 phHciNfc_sContext_t *psHciContext,
1488 NFCSTATUS status = NFCSTATUS_SUCCESS;
1489 /* phHciNfc_Pipe_Info_t *p_pipe_info = NULL; */
1490 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1492 if( (NULL == psHciContext) || (NULL == pHwRef) )
1494 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1498 switch ( psHciContext->host_rf_type )
1500 case phHal_eISO14443_A_PCD:
1502 /* Get the Reader A Pipe ID */
1503 status = phHciNfc_ReaderA_Get_PipeID
1504 (psHciContext, &reader_pipe_id);
1509 case phHal_eISO14443_B_PCD:
1511 /* Get the Reader B Pipe ID */
1512 status = phHciNfc_ReaderB_Get_PipeID
1513 (psHciContext, &reader_pipe_id);
1517 #endif /* #ifdef TYPE_B */
1519 case phHal_eFelica_PCD:
1521 /* Get the Felica Reader Pipe ID */
1522 status = phHciNfc_Felica_Get_PipeID
1523 (psHciContext, &reader_pipe_id);
1527 #endif /* #ifdef TYPE_FELICA */
1528 #ifdef TYPE_ISO15693
1529 case phHal_eISO15693_PCD:
1531 /* Get the ISO 15693 Reader Pipe ID */
1532 status = phHciNfc_ISO15693_Get_PipeID
1533 (psHciContext, &reader_pipe_id);
1537 #endif /* #ifdef TYPE_ISO15693 */
1540 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
1544 } /* End of the reader_type Switch */
1545 if( (NFCSTATUS_SUCCESS == status)
1546 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1549 status = phHciNfc_Send_RFReader_Command (psHciContext,
1550 pHwRef, reader_pipe_id, NXP_WR_ACTIVATE_NEXT );
1560 * \brief Checks the presence of the Remote Target in the field.
1562 * This function checks the presence of the tag present in the field.
1567 phHciNfc_ReaderMgmt_Presence_Check(
1568 phHciNfc_sContext_t *psHciContext,
1572 NFCSTATUS status = NFCSTATUS_SUCCESS;
1573 /* phHciNfc_Pipe_Info_t *p_pipe_info = NULL; */
1574 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1575 phHal_eRemDevType_t target_type = phHal_eUnknown_DevType;
1577 if( (NULL == psHciContext) || (NULL == pHwRef) )
1579 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1583 target_type = psHciContext->p_target_info->RemDevType;
1584 switch (target_type)
1586 case phHal_eMifare_PICC:
1587 case phHal_eISO14443_3A_PICC:
1589 /* Get the Reader A Pipe ID */
1590 status = phHciNfc_ReaderA_Get_PipeID
1591 (psHciContext, &reader_pipe_id);
1593 if( (NFCSTATUS_SUCCESS == status)
1594 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1597 status = phHciNfc_ReaderMgmt_Reactivate(
1598 psHciContext, pHwRef, target_type );
1602 case phHal_eISO14443_A_PICC:
1603 case phHal_eISO14443_4A_PICC:
1605 /* Get the Reader A Pipe ID */
1606 status = phHciNfc_ReaderA_Get_PipeID
1607 (psHciContext, &reader_pipe_id);
1609 if( (NFCSTATUS_SUCCESS == status)
1610 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1613 status = phHciNfc_Send_RFReader_Command (psHciContext,
1614 pHwRef, reader_pipe_id, NXP_WR_PRESCHECK );
1619 case phHal_eNfcIP1_Target:
1621 status = phHciNfc_NfcIP_Presence_Check (psHciContext, pHwRef);
1626 case phHal_eISO14443_B_PICC:
1627 case phHal_eISO14443_4B_PICC:
1629 /* Get the Reader B Pipe ID */
1630 status = phHciNfc_ReaderB_Get_PipeID
1631 (psHciContext, &reader_pipe_id);
1633 if( (NFCSTATUS_SUCCESS == status)
1634 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1637 status = phHciNfc_Send_RFReader_Command (psHciContext,
1638 pHwRef, reader_pipe_id, NXP_WR_PRESCHECK );
1642 #endif /* #ifdef TYPE_B */
1644 case phHal_eFelica_PICC:
1646 /* Get the Felica Reader Pipe ID */
1647 status = phHciNfc_Felica_Get_PipeID
1648 (psHciContext, &reader_pipe_id);
1650 if( (NFCSTATUS_SUCCESS == status)
1651 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1654 status = phHciNfc_Felica_Request_Mode(psHciContext, pHwRef);
1658 #endif /* #ifdef TYPE_FELICA */
1660 case phHal_eJewel_PICC:
1662 /* Get the Jewel Reader Pipe ID */
1663 status = phHciNfc_Jewel_Get_PipeID
1664 (psHciContext, &reader_pipe_id);
1666 if( (NFCSTATUS_SUCCESS == status)
1667 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1670 /* status = PHNFCSTVAL(CID_NFC_HCI,
1671 NFCSTATUS_FEATURE_NOT_SUPPORTED); */
1672 status = phHciNfc_Jewel_GetRID(
1673 psHciContext, pHwRef);
1677 #endif /* #ifdef TYPE_JEWEL */
1678 #ifdef TYPE_ISO15693
1679 case phHal_eISO15693_PICC:
1681 /* Get the Reader ISO 15693 Pipe ID */
1682 status = phHciNfc_ISO15693_Get_PipeID
1683 (psHciContext, &reader_pipe_id);
1685 if( (NFCSTATUS_SUCCESS == status)
1686 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1690 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
1691 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1692 p_pipe_info->param_info = &cmd;
1693 p_pipe_info->param_length = 11;
1694 // masked inventory command:
1695 // set #slots to 1 to use mask without padding,
1696 // need to set inventory flag to enable setting #slots
1697 cmd[0] = 0x04 | 0x20; // FLAG_INVENTORY | FLAG_SLOTS
1698 cmd[1] = 0x01; // CMD_INVENTORY
1699 cmd[2] = 64; // mask bit-length
1700 memcpy(cmd + 3, &(psHciContext->p_target_info->RemoteDevInfo.Iso15693_Info.Uid), 8);
1701 status = phHciNfc_Send_ISO15693_Command(
1702 psHciContext, pHwRef
1703 ,reader_pipe_id, NXP_ISO15693_CMD );
1708 #endif /* #ifdef TYPE_ISO15693 */
1711 status = PHNFCSTVAL(CID_NFC_HCI,
1712 NFCSTATUS_FEATURE_NOT_SUPPORTED);
1716 } /* End of the tag_type Switch */
1725 * \brief Disconnects the the selected tag.
1727 * This function disconnects the selected tags via RF Reader Gate.
1728 * This function uses the RF Reader gate based on the type of the
1734 phHciNfc_ReaderMgmt_Deselect(
1735 phHciNfc_sContext_t *psHciContext,
1737 phHal_eRemDevType_t target_type,
1741 static uint8_t rls_param = FALSE;
1742 NFCSTATUS status = NFCSTATUS_SUCCESS;
1743 uint8_t reader_pipe_id =
1744 (uint8_t) HCI_UNKNOWN_PIPE_ID;
1745 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
1749 if( (NULL == psHciContext)
1753 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1757 rls_param = re_poll;
1759 switch (target_type)
1761 case phHal_eMifare_PICC:
1762 case phHal_eISO14443_A_PICC:
1763 case phHal_eISO14443_3A_PICC:
1764 case phHal_eISO14443_4A_PICC:
1766 /* Get the Reader A Pipe ID */
1767 status = phHciNfc_ReaderA_Get_PipeID
1768 (psHciContext, &reader_pipe_id);
1772 case phHal_eISO14443_B_PICC:
1773 case phHal_eISO14443_4B_PICC:
1775 /* Get the Reader B Pipe ID */
1776 status = phHciNfc_ReaderB_Get_PipeID
1777 (psHciContext, &reader_pipe_id);
1781 #endif /* #ifdef TYPE_B */
1783 case phHal_eFelica_PICC:
1785 /* Get the Felica Pipe ID */
1786 status = phHciNfc_Felica_Get_PipeID
1787 (psHciContext, &reader_pipe_id);
1791 #endif /* #ifdef TYPE_FELICA */
1793 case phHal_eJewel_PICC:
1795 /* Get the Jewel Pipe ID */
1796 status = phHciNfc_Jewel_Get_PipeID
1797 (psHciContext, &reader_pipe_id);
1801 #endif /* #ifdef TYPE_JEWEL */
1802 #ifdef TYPE_ISO15693
1803 case phHal_eISO15693_PICC:
1805 /* Get the ISO 15693 Pipe ID */
1806 status = phHciNfc_ISO15693_Get_PipeID
1807 (psHciContext, &reader_pipe_id);
1811 #endif /* #ifdef TYPE_ISO15693 */
1813 case phHal_eNfcIP1_Target:
1815 /* Get the Reader A Pipe ID */
1816 status = phHciNfc_Initiator_Get_PipeID
1817 (psHciContext, &reader_pipe_id);
1824 status = PHNFCSTVAL(CID_NFC_HCI,
1825 NFCSTATUS_FEATURE_NOT_SUPPORTED);
1829 } /* End of the tag_type Switch */
1830 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1831 if( (NFCSTATUS_SUCCESS == status)
1832 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1833 && ( NULL != p_pipe_info ) )
1835 if (TRUE == rls_param)
1837 p_pipe_info->param_info = &rls_param;
1838 p_pipe_info->param_length = sizeof(rls_param);
1840 status = phHciNfc_Send_RFReader_Event ( psHciContext, pHwRef,
1841 reader_pipe_id,(uint8_t) NXP_EVT_RELEASE_TARGET );
1850 * \brief Exchanges the data to/from the selected tags via RF Reader Gates.
1852 * This function Exchanges the data to/from the selected tags
1853 * via RF Reader Gates. This function uses the RF Reader gate based on the
1854 * type of the selected tag and the type of the Reader gate specified.
1859 phHciNfc_ReaderMgmt_Exchange_Data(
1860 phHciNfc_sContext_t *psHciContext,
1862 phHciNfc_XchgInfo_t *p_xchg_info
1865 NFCSTATUS status = NFCSTATUS_SUCCESS;
1866 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
1867 uint8_t reader_pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
1868 phHal_eRemDevType_t target_type = phHal_eUnknown_DevType;
1870 if( (NULL == psHciContext) || (NULL == pHwRef) )
1872 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
1874 else if (NULL == psHciContext->p_xchg_info)
1876 status = PHNFCSTVAL(CID_NFC_HCI,
1877 NFCSTATUS_INVALID_HCI_INFORMATION);
1882 switch (psHciContext->host_rf_type)
1884 case phHal_eISO14443_A_PCD:
1886 /* Get the Reader A Pipe ID */
1887 status = phHciNfc_ReaderA_Get_PipeID
1888 (psHciContext, &reader_pipe_id);
1890 if( (NFCSTATUS_SUCCESS == status)
1891 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1894 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1895 p_pipe_info->param_info = p_xchg_info->tx_buffer;
1896 p_pipe_info->param_length = p_xchg_info->tx_length;
1897 target_type = psHciContext->p_target_info->RemDevType;
1898 switch (target_type)
1900 case phHal_eMifare_PICC:
1901 case phHal_eISO14443_3A_PICC:
1903 if ((uint8_t)phHal_eMifareRaw ==
1904 p_xchg_info->params.tag_info.cmd_type)
1906 status = phHciNfc_Send_ReaderA_Command(
1907 psHciContext, pHwRef
1908 ,reader_pipe_id, NXP_MIFARE_RAW );
1912 status = phHciNfc_Send_ReaderA_Command(
1913 psHciContext, pHwRef,
1914 reader_pipe_id, NXP_MIFARE_CMD );
1918 case phHal_eISO14443_A_PICC:
1919 case phHal_eISO14443_4A_PICC:
1921 status = phHciNfc_Send_RFReader_Command(
1922 psHciContext, pHwRef,
1923 reader_pipe_id, WR_XCHGDATA );
1928 status = PHNFCSTVAL(CID_NFC_HCI,
1929 NFCSTATUS_FEATURE_NOT_SUPPORTED);
1932 } /* End of the tag_type Switch */
1933 } /* End of Pipe ID Check */
1937 case phHal_eISO14443_B_PCD:
1939 /* Get the Reader B Pipe ID */
1940 status = phHciNfc_ReaderB_Get_PipeID
1941 (psHciContext, &reader_pipe_id);
1943 if( (NFCSTATUS_SUCCESS == status)
1944 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1947 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1948 p_pipe_info->param_info = p_xchg_info->tx_buffer;
1949 p_pipe_info->param_length = p_xchg_info->tx_length;
1950 status = phHciNfc_Send_RFReader_Command(
1951 psHciContext, pHwRef,
1952 reader_pipe_id, WR_XCHGDATA );
1956 #endif /* #ifdef TYPE_B */
1958 case phHal_eFelica_PCD:
1960 /* Get the Felica Reader Pipe ID */
1961 status = phHciNfc_Felica_Get_PipeID
1962 (psHciContext, &reader_pipe_id);
1964 if( (NFCSTATUS_SUCCESS == status)
1965 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1968 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
1969 p_pipe_info->param_info = p_xchg_info->tx_buffer;
1970 p_pipe_info->param_length = p_xchg_info->tx_length;
1971 if ((uint8_t)phHal_eFelica_Raw ==
1972 p_xchg_info->params.tag_info.cmd_type)
1974 status = phHciNfc_Send_Felica_Command(
1975 psHciContext, pHwRef
1976 ,reader_pipe_id, NXP_FELICA_RAW );
1980 status = phHciNfc_Send_Felica_Command(
1981 psHciContext, pHwRef,
1982 reader_pipe_id, NXP_FELICA_CMD );
1987 #endif /* #ifdef TYPE_FELICA */
1988 #if defined(TYPE_ISO15693)
1989 case phHal_eISO15693_PCD:
1991 /* Get the ISO15693 Reader Pipe ID */
1992 status = phHciNfc_ISO15693_Get_PipeID
1993 (psHciContext, &reader_pipe_id);
1995 if( (NFCSTATUS_SUCCESS == status)
1996 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
1999 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
2000 p_pipe_info->param_info = p_xchg_info->tx_buffer;
2001 p_pipe_info->param_length = p_xchg_info->tx_length;
2002 if (((uint8_t)phHal_eIso15693_Cmd ==
2003 p_xchg_info->params.tag_info.cmd_type)
2004 #if defined(SUPPORT_ISO15693_RAW)
2005 || ((uint8_t) phHal_eIso15693_Raw ==
2006 p_xchg_info->params.tag_info.cmd_type)
2010 status = phHciNfc_Send_ISO15693_Command(
2011 psHciContext, pHwRef
2012 ,reader_pipe_id, NXP_ISO15693_CMD );
2016 status = PHNFCSTVAL(CID_NFC_HCI,
2017 NFCSTATUS_INVALID_PARAMETER);
2024 case phHal_eJewel_PCD:
2026 /* Get the Jewel Reader Pipe ID */
2027 status = phHciNfc_Jewel_Get_PipeID
2028 (psHciContext, &reader_pipe_id);
2030 if( (NFCSTATUS_SUCCESS == status)
2031 && (reader_pipe_id != HCI_UNKNOWN_PIPE_ID )
2034 uint8_t transact_type = 0;
2035 p_pipe_info = psHciContext->p_pipe_list[reader_pipe_id];
2036 p_pipe_info->param_info = p_xchg_info->tx_buffer;
2037 p_pipe_info->param_length = p_xchg_info->tx_length;
2038 switch(p_xchg_info->params.tag_info.cmd_type)
2040 case phHal_eJewel_Raw:
2042 transact_type = NXP_JEWEL_RAW;
2045 case phHal_eJewel_Invalid:
2048 status = PHNFCSTVAL(CID_NFC_HCI,
2049 NFCSTATUS_INVALID_PARAMETER);
2053 if(0 != transact_type)
2055 status = phHciNfc_Send_Jewel_Command(
2056 psHciContext, pHwRef,
2057 reader_pipe_id, transact_type );
2062 #endif /* #ifdef TYPE_JEWEL */
2065 status = PHNFCSTVAL(CID_NFC_HCI,
2066 NFCSTATUS_FEATURE_NOT_SUPPORTED);
2069 }/* End of Reader Type Switch */
2078 * \brief Releases the resources allocated the RF Reader Management.
2080 * This function Releases the resources allocated the RF Reader Management.
2084 phHciNfc_ReaderMgmt_Release(
2085 phHciNfc_sContext_t *psHciContext,
2089 NFCSTATUS status = NFCSTATUS_SUCCESS;
2090 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
2091 phHciNfc_ReaderMgmt_Info_t *p_reader_mgmt_info=NULL;
2093 if( (NULL == psHciContext) || (NULL == pHwRef) )
2095 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
2099 if( NULL != psHciContext->p_reader_mgmt_info )
2101 p_reader_mgmt_info = (phHciNfc_ReaderMgmt_Info_t *)
2102 psHciContext->p_reader_mgmt_info ;
2103 switch(p_reader_mgmt_info->rf_gate_cur_seq)
2105 /* Reader A pipe close sequence */
2106 case READERA_PIPE_CLOSE:
2108 p_pipe_info = ((phHciNfc_ReaderA_Info_t *)
2109 psHciContext->p_reader_a_info)->p_pipe_info;
2111 status = phHciNfc_Close_Pipe( psHciContext,
2112 pHwRef, p_pipe_info );
2113 if(status == NFCSTATUS_SUCCESS)
2115 p_reader_mgmt_info->rf_gate_next_seq =
2117 /* status = NFCSTATUS_PENDING; */
2122 /* Reader B pipe close sequence */
2123 case READERB_PIPE_CLOSE:
2125 p_pipe_info = ((phHciNfc_ReaderB_Info_t *)
2126 psHciContext->p_reader_b_info)->p_pipe_info;
2128 status = phHciNfc_Close_Pipe( psHciContext,
2129 pHwRef, p_pipe_info );
2130 if(status == NFCSTATUS_SUCCESS)
2132 p_reader_mgmt_info->rf_gate_next_seq =
2133 FELICA_PROP_PIPE_CLOSE;
2134 status = NFCSTATUS_PENDING;
2138 #endif /* #ifdef TYPE_B */
2140 /* Felica Reader pipe close sequence */
2141 case FELICA_PROP_PIPE_CLOSE:
2143 p_pipe_info = ((phHciNfc_Felica_Info_t *)
2144 psHciContext->p_felica_info)->p_pipe_info;
2146 status = phHciNfc_Close_Pipe( psHciContext,
2147 pHwRef, p_pipe_info );
2148 if(status == NFCSTATUS_SUCCESS)
2150 p_reader_mgmt_info->rf_gate_next_seq =
2151 NFCIP1_INITIATOR_PIPE_CLOSE;
2152 /* status = NFCSTATUS_PENDING; */
2156 #endif /* #ifdef TYPE_FELICA */
2158 /* NFC-IP1 Initiator pipe Close sequence */
2159 case NFCIP1_INITIATOR_PIPE_CLOSE:
2162 ((phHciNfc_NfcIP_Info_t *)psHciContext->
2163 p_nfcip_info)->p_init_pipe_info;
2164 if(NULL == p_pipe_info )
2166 status = PHNFCSTVAL(CID_NFC_HCI,
2167 NFCSTATUS_INVALID_HCI_SEQUENCE);
2171 status = phHciNfc_Open_Pipe( psHciContext,
2172 pHwRef, p_pipe_info );
2173 if(status == NFCSTATUS_SUCCESS)
2175 p_reader_mgmt_info->rf_gate_next_seq = READERA_PIPE_CLOSE;
2176 status = NFCSTATUS_PENDING;
2181 #endif /* #ifdef ENABLE_P2P */
2184 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE);
2188 }/* End of the Sequence Switch */
2190 }/* End of the Reader Info Memory Check */
2192 } /* End of Null Context Check */
2199 * \brief Sends the RF Reader HCI Events to the connected reader device.
2201 * This function Sends the RF Reader HCI Event frames in the HCP packet format to the
2202 * connected reader device.
2206 phHciNfc_Send_RFReader_Event (
2207 phHciNfc_sContext_t *psHciContext,
2213 phHciNfc_HCP_Packet_t *hcp_packet = NULL;
2214 phHciNfc_HCP_Message_t *hcp_message = NULL;
2215 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
2218 NFCSTATUS status = NFCSTATUS_SUCCESS;
2220 if( (NULL == psHciContext)
2221 || ( pipe_id > PHHCINFC_MAX_PIPE)
2222 ||(NULL == psHciContext->p_pipe_list[pipe_id])
2225 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
2226 HCI_DEBUG("%s: Invalid Arguments passed \n",
2227 "phHciNfc_Send_RFReader_Event");
2231 p_pipe_info = (phHciNfc_Pipe_Info_t *)
2232 psHciContext->p_pipe_list[pipe_id];
2233 psHciContext->tx_total = 0 ;
2234 length += HCP_HEADER_LEN ;
2237 case EVT_READER_REQUESTED:
2238 case EVT_END_OPERATION:
2241 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
2242 /* Construct the HCP Frame */
2243 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
2244 (uint8_t) pipe_id, HCP_MSG_TYPE_EVENT, event);
2247 case NXP_EVT_RELEASE_TARGET:
2249 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
2250 /* Construct the HCP Frame */
2251 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
2252 (uint8_t) pipe_id, HCP_MSG_TYPE_EVENT, event);
2253 hcp_message = &(hcp_packet->msg.message);
2254 phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
2255 i, p_pipe_info->param_info,
2256 p_pipe_info->param_length);
2257 length =(uint16_t)(length + i + p_pipe_info->param_length);
2262 status = PHNFCSTVAL( CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED );
2263 HCI_DEBUG("%s: Statement Should Not Occur \n",
2264 "phHciNfc_Send_RFReader_Event");
2268 if( NFCSTATUS_SUCCESS == status )
2270 p_pipe_info->sent_msg_type = HCP_MSG_TYPE_EVENT ;
2271 p_pipe_info->prev_msg = event ;
2272 psHciContext->tx_total = length;
2274 /* Send the Constructed HCP packet to the lower layer */
2275 status = phHciNfc_Send_HCP( psHciContext, pHwRef );
2276 p_pipe_info->prev_status = NFCSTATUS_PENDING;
2284 * \brief Sends the RF Reader HCI Additonal Commands to the connected
2287 * This function Sends the RF Reader HCI Command frames in the HCP packet
2288 * format to the connected reader device.
2292 phHciNfc_Send_RFReader_Command (
2293 phHciNfc_sContext_t *psHciContext,
2299 phHciNfc_HCP_Packet_t *hcp_packet = NULL;
2300 phHciNfc_HCP_Message_t *hcp_message = NULL;
2301 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
2304 NFCSTATUS status = NFCSTATUS_SUCCESS;
2306 if( (NULL == psHciContext)
2307 || ( pipe_id > PHHCINFC_MAX_PIPE)
2308 ||(NULL == psHciContext->p_pipe_list[pipe_id])
2311 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
2312 HCI_DEBUG("%s: Invalid Arguments passed \n",
2313 "phHciNfc_Send_RFReader_Command");
2317 p_pipe_info = (phHciNfc_Pipe_Info_t *)
2318 psHciContext->p_pipe_list[pipe_id];
2319 psHciContext->tx_total = 0 ;
2320 length += HCP_HEADER_LEN ;
2326 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
2327 /* Construct the HCP Frame */
2328 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
2329 (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
2330 hcp_message = &(hcp_packet->msg.message);
2331 /* Frame Wait Timeout */
2332 hcp_message->payload[i++] = nxp_nfc_isoxchg_timeout ;
2333 phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
2334 i, p_pipe_info->param_info,
2335 p_pipe_info->param_length);
2336 length =(uint16_t)(length + i + p_pipe_info->param_length);
2339 case NXP_WR_PRESCHECK:
2340 case NXP_WR_ACTIVATE_NEXT:
2343 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
2344 /* Construct the HCP Frame */
2345 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
2346 (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
2349 case NXP_WR_DISPATCH_TO_UICC:
2350 case NXP_WR_ACTIVATE_ID:
2353 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
2354 /* Construct the HCP Frame */
2355 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
2356 (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
2357 hcp_message = &(hcp_packet->msg.message);
2358 /* UID of the Card */
2359 phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
2360 i, p_pipe_info->param_info,
2361 p_pipe_info->param_length);
2362 length =(uint16_t)(length + i + p_pipe_info->param_length);
2367 status = PHNFCSTVAL( CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED );
2368 HCI_DEBUG("%s: Statement Should Not Occur \n",
2369 "phHciNfc_Send_RFReader_Command");
2373 if( NFCSTATUS_SUCCESS == status )
2375 p_pipe_info->sent_msg_type = HCP_MSG_TYPE_COMMAND;
2376 p_pipe_info->prev_msg = cmd;
2377 psHciContext->tx_total = length;
2378 psHciContext->response_pending = TRUE ;
2380 /* Send the Constructed HCP packet to the lower layer */
2381 status = phHciNfc_Send_HCP( psHciContext, pHwRef );
2382 p_pipe_info->prev_status = NFCSTATUS_PENDING;