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_RFReaderB.c *
22 * \brief HCI Reader B Management Routines. *
25 * Project: NFC-FRI-1.1 *
27 * $Date: Mon Aug 17 15:17:07 2009 $ *
28 * $Author: ing04880 $ *
30 * $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 $
32 * =========================================================================== *
36 ***************************** Header File Inclusion ****************************
38 #include <phNfcCompId.h>
39 #include <phHciNfc_Pipe.h>
40 #include <phHciNfc_RFReader.h>
41 #include <phOsalNfc.h>
44 #include <phHciNfc_RFReaderB.h>
46 ****************************** Macro Definitions *******************************
49 #define RDR_B_SINGLE_TAG_FOUND 0x00U
50 #define RDR_B_MULTIPLE_TAGS_FOUND 0x03U
51 /* Commands exposed to the upper layer */
52 #define NXP_WRA_CONTINUE_ACTIVATION 0x12U
54 #define RDR_B_PUPI_INDEX 0x03U
55 #define RDR_B_APP_DATA_INDEX 0x04U
56 #define RDR_B_AFI_INDEX 0x02U
57 #define RDR_B_HIGHER_LAYER_RESP_INDEX 0x01U
58 #define RDR_B_HIGHER_LAYER_DATA_INDEX 0x05U
62 *************************** Structure and Enumeration ***************************
67 *************************** Static Function Declaration **************************
72 phHciNfc_Recv_ReaderB_Response(
85 phHciNfc_Recv_ReaderB_Event(
98 phHciNfc_ReaderB_InfoUpdate(
99 phHciNfc_sContext_t *psHciContext,
107 phHciNfc_Recv_Iso_B_Packet(
108 phHciNfc_sContext_t *psHciContext,
117 *************************** Function Definitions ***************************
121 phHciNfc_ReaderB_Get_PipeID(
122 phHciNfc_sContext_t *psHciContext,
126 NFCSTATUS status = NFCSTATUS_SUCCESS;
128 if( (NULL != psHciContext)
129 && ( NULL != ppipe_id )
130 && ( NULL != psHciContext->p_reader_b_info )
133 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
134 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
135 psHciContext->p_reader_b_info ;
136 *ppipe_id = p_rdr_b_info->pipe_id ;
140 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
146 phHciNfc_ReaderB_Init_Resources(
147 phHciNfc_sContext_t *psHciContext
150 NFCSTATUS status = NFCSTATUS_SUCCESS;
151 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
152 if( NULL == psHciContext )
154 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
159 ( NULL == psHciContext->p_reader_b_info ) &&
160 (phHciNfc_Allocate_Resource((void **)(&p_rdr_b_info),
161 sizeof(phHciNfc_ReaderB_Info_t))== NFCSTATUS_SUCCESS)
164 psHciContext->p_reader_b_info = p_rdr_b_info;
165 p_rdr_b_info->current_seq = RDR_B_INVALID_SEQ;
166 p_rdr_b_info->next_seq = RDR_B_INVALID_SEQ;
167 p_rdr_b_info->pipe_id = (uint8_t)HCI_UNKNOWN_PIPE_ID;
171 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES);
179 phHciNfc_ReaderB_Update_Info(
180 phHciNfc_sContext_t *psHciContext,
185 NFCSTATUS status = NFCSTATUS_SUCCESS;
187 if (NULL == psHciContext)
189 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
191 else if(NULL == psHciContext->p_reader_b_info)
193 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
197 phHciNfc_ReaderB_Info_t *ps_rdr_b_info=NULL;
198 ps_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
199 psHciContext->p_reader_b_info ;
203 case HCI_READER_B_ENABLE:
205 if(NULL != rdr_b_info)
207 ps_rdr_b_info->enable_rdr_b_gate =
208 *((uint8_t *)rdr_b_info);
212 case HCI_READER_B_INFO_SEQ:
214 ps_rdr_b_info->current_seq = RDR_B_PUPI;
215 ps_rdr_b_info->next_seq = RDR_B_PUPI;
220 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
230 phHciNfc_ReaderB_Update_PipeInfo(
231 phHciNfc_sContext_t *psHciContext,
233 phHciNfc_Pipe_Info_t *pPipeInfo
236 NFCSTATUS status = NFCSTATUS_SUCCESS;
238 if( NULL == psHciContext )
240 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
242 else if(NULL == psHciContext->p_reader_b_info)
244 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
248 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
249 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
250 psHciContext->p_reader_b_info ;
251 /* Update the pipe_id of the reader B Gate obtained from the HCI Response */
252 p_rdr_b_info->pipe_id = pipeID;
253 p_rdr_b_info->p_pipe_info = pPipeInfo;
254 /* Update the Response Receive routine of the reader B Gate */
255 pPipeInfo->recv_resp = &phHciNfc_Recv_ReaderB_Response;
256 /* Update the event Receive routine of the reader B Gate */
257 pPipeInfo->recv_event = &phHciNfc_Recv_ReaderB_Event;
264 phHciNfc_ReaderB_Info_Sequence (
269 NFCSTATUS status = NFCSTATUS_SUCCESS;
270 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle);
271 if( (NULL == psHciContext)
275 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
277 else if((NULL == psHciContext->p_reader_b_info) ||
278 (HCI_READER_B_ENABLE !=
279 ((phHciNfc_ReaderB_Info_t *)(psHciContext->p_reader_b_info))->
282 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
286 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
287 phHciNfc_Pipe_Info_t *p_pipe_info=NULL;
290 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
291 psHciContext->p_reader_b_info ;
292 p_pipe_info = p_rdr_b_info->p_pipe_info;
293 if(NULL == p_pipe_info )
295 status = PHNFCSTVAL(CID_NFC_HCI,
296 NFCSTATUS_INVALID_HCI_SEQUENCE);
300 switch(p_rdr_b_info->current_seq)
304 p_pipe_info->reg_index = RDR_B_PUPI_INDEX;
305 pipeid = p_rdr_b_info->pipe_id ;
306 /* Fill the data buffer and send the command to the
309 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
310 pipeid, (uint8_t)ANY_GET_PARAMETER);
311 if(NFCSTATUS_PENDING == status )
313 p_rdr_b_info->next_seq = RDR_B_APP_DATA;
319 p_pipe_info->reg_index = RDR_B_APP_DATA_INDEX;
320 pipeid = p_rdr_b_info->pipe_id ;
321 /* Fill the data buffer and send the command to the
324 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
325 pipeid, (uint8_t)ANY_GET_PARAMETER);
326 if(NFCSTATUS_PENDING == status )
328 p_rdr_b_info->next_seq = RDR_B_AFI;
334 /* RW to the registry */
335 p_pipe_info->reg_index = RDR_B_AFI_INDEX;
336 pipeid = p_rdr_b_info->pipe_id ;
337 /* Fill the data buffer and send the command to the
340 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
341 pipeid, (uint8_t)ANY_GET_PARAMETER);
342 if(NFCSTATUS_PENDING == status )
344 p_rdr_b_info->next_seq = RDR_B_HIGHER_LAYER_RESP;
349 case RDR_B_HIGHER_LAYER_RESP:
351 p_pipe_info->reg_index = RDR_B_HIGHER_LAYER_RESP_INDEX;
352 pipeid = p_rdr_b_info->pipe_id ;
353 /* Fill the data buffer and send the command to the
356 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
357 pipeid, (uint8_t)ANY_GET_PARAMETER);
358 if(NFCSTATUS_PENDING == status )
360 p_rdr_b_info->next_seq = RDR_B_HIGHER_LAYER_DATA;
365 case RDR_B_HIGHER_LAYER_DATA:
367 /* RW to the registry */
368 p_pipe_info->reg_index = RDR_B_HIGHER_LAYER_DATA_INDEX;
369 pipeid = p_rdr_b_info->pipe_id ;
370 /* Fill the data buffer and send the command to the
373 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
374 pipeid, (uint8_t)ANY_GET_PARAMETER);
375 if(NFCSTATUS_PENDING == status )
377 p_rdr_b_info->next_seq = RDR_B_END_SEQUENCE;
381 case RDR_B_END_SEQUENCE:
383 phNfc_sCompletionInfo_t CompInfo;
384 if (RDR_B_MULTIPLE_TAGS_FOUND ==
385 p_rdr_b_info->multiple_tgts_found)
387 CompInfo.status = NFCSTATUS_MULTIPLE_TAGS;
391 CompInfo.status = NFCSTATUS_SUCCESS;
394 CompInfo.info = &(p_rdr_b_info->reader_b_info);
396 p_rdr_b_info->reader_b_info.RemDevType = phHal_eISO14443_B_PICC;
397 p_rdr_b_info->current_seq = RDR_B_PUPI;
398 p_rdr_b_info->next_seq = RDR_B_PUPI;
399 status = NFCSTATUS_SUCCESS;
400 /* Notify to the upper layer */
401 phHciNfc_Tag_Notify(psHciContext,
403 NFC_NOTIFY_TARGET_DISCOVERED,
409 status = PHNFCSTVAL(CID_NFC_HCI,
410 NFCSTATUS_INVALID_HCI_RESPONSE);
421 phHciNfc_Recv_ReaderB_Response(
432 NFCSTATUS status = NFCSTATUS_SUCCESS;
433 phHciNfc_sContext_t *psHciContext =
434 (phHciNfc_sContext_t *)psContext ;
436 if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse)
439 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
441 else if(NULL == psHciContext->p_reader_b_info)
443 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
447 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
448 uint8_t prev_cmd = ANY_GET_PARAMETER;
450 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
451 psHciContext->p_reader_b_info ;
452 if( NULL == p_rdr_b_info->p_pipe_info)
454 status = PHNFCSTVAL(CID_NFC_HCI,
455 NFCSTATUS_INVALID_HCI_SEQUENCE);
459 prev_cmd = p_rdr_b_info->p_pipe_info->prev_msg ;
462 case ANY_GET_PARAMETER:
464 status = phHciNfc_ReaderB_InfoUpdate(psHciContext,
465 p_rdr_b_info->p_pipe_info->reg_index,
466 &pResponse[HCP_HEADER_LEN],
467 (uint8_t)(length - HCP_HEADER_LEN));
470 case ANY_SET_PARAMETER:
472 HCI_PRINT("Reader B Parameter Set \n");
473 status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext,
475 p_rdr_b_info->next_seq = RDR_B_PUPI;
480 HCI_PRINT("Reader B open pipe complete\n");
481 status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext,
483 p_rdr_b_info->next_seq = RDR_B_PUPI;
488 HCI_PRINT("Reader B close pipe complete\n");
489 status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext,
493 case NXP_WRA_CONTINUE_ACTIVATION:
494 case NXP_WR_ACTIVATE_ID:
496 HCI_PRINT("Reader B continue activation or ");
497 HCI_PRINT("reactivation completed \n");
498 status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext,
504 if (length >= HCP_HEADER_LEN)
507 HCI_PRINT("ISO 14443-4B received \n");
508 /* Copy buffer to the receive buffer */
509 phHciNfc_Append_HCPFrame(psHciContext->recv_buffer,
510 0, pResponse, length);
511 psHciContext->rx_total = (length - i);
512 status = phHciNfc_Recv_Iso_B_Packet(psHciContext,
513 &pResponse[HCP_HEADER_LEN],
514 (length - HCP_HEADER_LEN));
518 status = PHNFCSTVAL(CID_NFC_HCI,
519 NFCSTATUS_INVALID_HCI_RESPONSE);
523 case NXP_WR_PRESCHECK:
525 HCI_PRINT("Presence check completed \n");
528 case NXP_WR_ACTIVATE_NEXT:
530 if (length > HCP_HEADER_LEN)
532 if (RDR_B_MULTIPLE_TAGS_FOUND == pResponse[HCP_HEADER_LEN])
534 p_rdr_b_info->multiple_tgts_found =
535 RDR_B_MULTIPLE_TAGS_FOUND;
539 p_rdr_b_info->multiple_tgts_found = FALSE;
541 HCI_PRINT("Activate next completed \n");
545 status = PHNFCSTVAL(CID_NFC_HCI,
546 NFCSTATUS_INVALID_HCI_RESPONSE);
550 case NXP_WR_DISPATCH_TO_UICC:
556 /* Error code field is optional, if no error
557 code field in the response, then the command
558 is successfully completed */
559 p_rdr_b_info->uicc_activation =
560 UICC_CARD_ACTIVATION_SUCCESS;
563 case (HCP_HEADER_LEN + 1):
565 p_rdr_b_info->uicc_activation =
566 pResponse[HCP_HEADER_LEN];
568 } /* End of case (HCP_HEADER_LEN + index) */
571 status = PHNFCSTVAL(CID_NFC_HCI,
572 NFCSTATUS_INVALID_HCI_RESPONSE);
575 } /* End of switch(length) */
576 if (NFCSTATUS_SUCCESS == status)
578 status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext,
585 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE);
589 if( NFCSTATUS_SUCCESS == status )
591 p_rdr_b_info->p_pipe_info->prev_status = NFCSTATUS_SUCCESS;
592 p_rdr_b_info->current_seq = p_rdr_b_info->next_seq;
602 phHciNfc_Recv_ReaderB_Event(
613 NFCSTATUS status = NFCSTATUS_SUCCESS;
614 phHciNfc_sContext_t *psHciContext =
615 (phHciNfc_sContext_t *)psContext ;
616 if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent)
619 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
621 else if((NULL == psHciContext->p_reader_b_info) ||
622 (HCI_READER_B_ENABLE !=
623 ((phHciNfc_ReaderB_Info_t *)(psHciContext->p_reader_b_info))->
626 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
630 phHciNfc_HCP_Packet_t *p_packet = NULL;
631 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
632 phHciNfc_HCP_Message_t *message = NULL;
633 uint8_t instruction=0,
636 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
637 psHciContext->p_reader_b_info ;
638 p_packet = (phHciNfc_HCP_Packet_t *)pEvent;
639 message = &p_packet->msg.message;
640 /* Get the instruction bits from the Message Header */
641 instruction = (uint8_t) GET_BITS8( message->msg_header,
642 HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN);
644 if ((EVT_TARGET_DISCOVERED == instruction)
645 && ((RDR_B_MULTIPLE_TAGS_FOUND == message->payload[i] )
646 || (RDR_B_SINGLE_TAG_FOUND == message->payload[i]))
649 phNfc_sCompletionInfo_t pCompInfo;
651 if (RDR_B_MULTIPLE_TAGS_FOUND == message->payload[i])
653 p_rdr_b_info->multiple_tgts_found = RDR_B_MULTIPLE_TAGS_FOUND;
654 pCompInfo.status = NFCSTATUS_MULTIPLE_TAGS;
658 p_rdr_b_info->multiple_tgts_found = FALSE;
659 pCompInfo.status = NFCSTATUS_SUCCESS;
662 psHciContext->host_rf_type = phHal_eISO14443_B_PCD;
663 p_rdr_b_info->reader_b_info.RemDevType = phHal_eISO14443_B_PICC;
664 p_rdr_b_info->current_seq = RDR_B_PUPI;
666 /* Notify to the HCI Generic layer To Update the FSM */
667 phHciNfc_Notify_Event(psHciContext, pHwRef,
668 NFC_NOTIFY_TARGET_DISCOVERED,
674 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE);
682 phHciNfc_ReaderB_InfoUpdate(
683 phHciNfc_sContext_t *psHciContext,
689 NFCSTATUS status = NFCSTATUS_SUCCESS;
690 phHciNfc_ReaderB_Info_t *p_rdr_b_info=NULL;
691 phHal_sIso14443BInfo_t *p_tag_b_info = NULL;
693 p_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
694 (psHciContext->p_reader_b_info );
695 p_tag_b_info = &(p_rdr_b_info->reader_b_info.RemoteDevInfo.Iso14443B_Info);
699 case RDR_B_PUPI_INDEX:
701 HCI_PRINT_BUFFER("\tReader B PUPI", reg_value, reg_length);
702 /* Update PUPI buffer and length in the remote device info,
703 PUPI length is 4 bytes */
704 if(PHHAL_PUPI_LENGTH == reg_length)
706 (void)memcpy((void *)p_tag_b_info->AtqB.AtqResInfo.Pupi,
707 (void *)reg_value, reg_length);
711 status = PHNFCSTVAL(CID_NFC_HCI,
712 NFCSTATUS_INVALID_HCI_RESPONSE);
716 case RDR_B_APP_DATA_INDEX:
718 HCI_PRINT_BUFFER("\tReader B Application data", reg_value, reg_length);
719 /* Update application data buffer and length, 3 bytes,
720 this includes CRC_B and number of application
722 if(PHHAL_APP_DATA_B_LENGTH == reg_length)
724 (void)memcpy((void *)p_tag_b_info->AtqB.AtqResInfo.AppData,
725 (void *)reg_value, reg_length);
729 status = PHNFCSTVAL(CID_NFC_HCI,
730 NFCSTATUS_INVALID_HCI_RESPONSE);
734 case RDR_B_AFI_INDEX:
736 HCI_PRINT_BUFFER("\tReader B AFI", reg_value, reg_length);
737 /* Update AFI byte, Only one byte */
738 if(sizeof(*reg_value) == reg_length)
740 p_tag_b_info->Afi = *reg_value;
744 status = PHNFCSTVAL(CID_NFC_HCI,
745 NFCSTATUS_INVALID_HCI_RESPONSE);
750 case RDR_B_HIGHER_LAYER_RESP_INDEX:
752 HCI_PRINT_BUFFER("\tReader B higher layer response", reg_value, reg_length);
753 /* Update higher layer response buffer and length */
754 if (reg_length <= PHHAL_MAX_ATR_LENGTH)
756 (void)memcpy((void *)p_tag_b_info->HiLayerResp,
757 (void *)reg_value, reg_length);
761 status = PHNFCSTVAL(CID_NFC_HCI,
762 NFCSTATUS_INVALID_HCI_RESPONSE);
767 case RDR_B_HIGHER_LAYER_DATA_INDEX:
769 HCI_PRINT_BUFFER("\tReader B higher layer data", reg_value, reg_length);
770 /* Update higher layer data buffer and length */
775 status = PHNFCSTVAL(CID_NFC_HCI,
776 NFCSTATUS_INVALID_HCI_RESPONSE);
786 phHciNfc_Recv_Iso_B_Packet(
787 phHciNfc_sContext_t *psHciContext,
796 NFCSTATUS status = NFCSTATUS_SUCCESS;
799 psHciContext->rx_index = HCP_HEADER_LEN;
800 /* command WR_XCHG_DATA: so give ISO 14443-4B data to the upper layer */
801 HCI_PRINT_BUFFER("ISO 14443-4B Bytes received", pResponse, length);
802 if(FALSE != pResponse[(length - i)])
804 status = PHNFCSTVAL(CID_NFC_HCI,
812 phHciNfc_ReaderB_Set_AFI(
818 NFCSTATUS status = NFCSTATUS_SUCCESS;
819 phHciNfc_sContext_t *psHciContext =
820 (phHciNfc_sContext_t *)psContext ;
821 if( (NULL == psHciContext) || (NULL == pHwRef))
823 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
825 else if((NULL == psHciContext->p_reader_b_info) ||
826 (HCI_READER_B_ENABLE !=
827 ((phHciNfc_ReaderB_Info_t *)(psHciContext->p_reader_b_info))->
830 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
834 phHciNfc_ReaderB_Info_t *ps_rdr_b_info=NULL;
835 phHciNfc_Pipe_Info_t *p_pipe_info=NULL;
838 ps_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
839 psHciContext->p_reader_b_info ;
840 p_pipe_info = ps_rdr_b_info->p_pipe_info;
841 if(NULL == p_pipe_info )
843 status = PHNFCSTVAL(CID_NFC_HCI,
844 NFCSTATUS_INVALID_HCI_SEQUENCE);
848 pipeid = ps_rdr_b_info->pipe_id ;
849 p_pipe_info->reg_index = RDR_B_AFI_INDEX;
851 p_pipe_info->param_info = &afi_value;
852 p_pipe_info->param_length = sizeof(uint8_t);
853 /* Fill the data buffer and send the command to the
856 phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
857 pipeid, (uint8_t)ANY_SET_PARAMETER);
864 phHciNfc_ReaderB_Set_LayerData(
867 phNfc_sData_t *layer_data_info
870 NFCSTATUS status = NFCSTATUS_SUCCESS;
871 phHciNfc_sContext_t *psHciContext =
872 (phHciNfc_sContext_t *)psContext ;
874 if( (NULL == psHciContext) || (NULL == pHwRef) ||
875 (NULL == layer_data_info) || (NULL == layer_data_info->buffer)
876 || (0 == layer_data_info->length))
878 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
880 else if((NULL == psHciContext->p_reader_b_info) ||
881 (HCI_READER_B_ENABLE !=
882 ((phHciNfc_ReaderB_Info_t *)(psHciContext->p_reader_b_info))->
885 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
889 phHciNfc_ReaderB_Info_t *ps_rdr_b_info=NULL;
890 phHciNfc_Pipe_Info_t *p_pipe_info=NULL;
893 ps_rdr_b_info = (phHciNfc_ReaderB_Info_t *)
894 psHciContext->p_reader_b_info ;
895 p_pipe_info = ps_rdr_b_info->p_pipe_info;
896 if(NULL == p_pipe_info )
898 status = PHNFCSTVAL(CID_NFC_HCI,
899 NFCSTATUS_INVALID_HCI_SEQUENCE);
903 p_pipe_info->reg_index = RDR_B_HIGHER_LAYER_DATA_INDEX;
904 pipeid = ps_rdr_b_info->pipe_id ;
905 p_pipe_info->param_info = (void *)layer_data_info->buffer;
906 p_pipe_info->param_length = (uint8_t)
907 layer_data_info->length;
908 /* Fill the data buffer and send the command to the
910 status = phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef,
911 pipeid, (uint8_t)ANY_SET_PARAMETER);
916 #endif /* #if defined (TYPE_B) */