2 * Copyright (C) 2010 NXP Semiconductors
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * =========================================================================== *
\r
21 * \file phHciNfc_SWP.c *
\r
22 * \brief HCI SWP gate Management Routines. *
\r
25 * Project: NFC-FRI-1.1 *
\r
27 * $Date: Tue Aug 18 10:16:36 2009 $ *
\r
28 * $Author: ing04880 $ *
\r
29 * $Revision: 1.31 $ *
\r
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 $ * *
\r
31 * =========================================================================== *
\r
35 ***************************** Header File Inclusion ****************************
\r
37 #include <phNfcCompId.h>
\r
38 #include <phHciNfc_Pipe.h>
\r
39 #include <phHciNfc_SWP.h>
\r
40 #include <phOsalNfc.h>
\r
41 #include <phHciNfc_Emulation.h>
\r
42 #include <phHciNfc_DevMgmt.h>
\r
44 ****************************** Macro Definitions *******************************
\r
47 /* SWP Gate regsitry Settings */
\r
48 /* set default mode mode as virtual mode */
\r
49 #define NXP_SWP_DEFAULT_MODE_INDEX (0x01U)
\r
50 /* Get the Status of the UICC Connection */
\r
51 #define NXP_SWP_STATUS_INDEX (0x02U)
\r
53 /* Configure the Secure Element Protected Mode */
\r
54 #define NXP_SWP_PROTECTED_INDEX (0x03U)
\r
56 /* Switch mode index */
\r
57 #define NXP_EVT_SWP_SWITCH_MODE (0x03U)
\r
59 /* Protected Event from the Host Controller */
\r
60 #define NXP_EVT_SWP_PROTECTED (0x04U)
\r
62 /****************** Structure and Enumeration ****************************/
\r
64 /****************** Static Function Declaration **************************/
\r
68 phHciNfc_Recv_SWP_Response(
\r
81 phHciNfc_Send_SWP_Event(
\r
82 phHciNfc_sContext_t *psHciContext,
\r
91 phHciNfc_Recv_SWP_Event(
\r
104 phHciNfc_SWP_InfoUpdate(
\r
105 phHciNfc_sContext_t *psHciContext,
\r
107 uint8_t *reg_value,
\r
112 *************************** Function Definitions ***************************
\r
116 phHciNfc_SWP_Get_PipeID(
\r
117 phHciNfc_sContext_t *psHciContext,
\r
121 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
123 if( (NULL != psHciContext)
\r
124 && ( NULL != ppipe_id )
\r
125 && ( NULL != psHciContext->p_swp_info )
\r
128 phHciNfc_SWP_Info_t *p_swp_info=NULL;
\r
129 p_swp_info = (phHciNfc_SWP_Info_t *)
\r
130 psHciContext->p_swp_info ;
\r
131 *ppipe_id = p_swp_info->pipe_id ;
\r
135 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
141 phHciNfc_SWP_Init_Resources(phHciNfc_sContext_t *psHciContext)
\r
143 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
144 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
146 if( NULL == psHciContext )
\r
148 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
152 if(( NULL == psHciContext->p_swp_info ) &&
\r
153 (phHciNfc_Allocate_Resource((void **)(&ps_swp_info),
\r
154 sizeof(phHciNfc_SWP_Info_t))== NFCSTATUS_SUCCESS))
\r
156 psHciContext->p_swp_info = ps_swp_info;
\r
157 ps_swp_info->current_seq = SWP_INVALID_SEQUENCE;
\r
158 ps_swp_info->next_seq = SWP_INVALID_SEQUENCE;
\r
159 ps_swp_info->pipe_id = (uint8_t)HCI_UNKNOWN_PIPE_ID;
\r
163 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES);
\r
172 phHciNfc_SWP_Update_PipeInfo(
\r
173 phHciNfc_sContext_t *psHciContext,
\r
175 phHciNfc_Pipe_Info_t *pPipeInfo
\r
178 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
180 if( NULL == psHciContext )
\r
182 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
184 else if(NULL == psHciContext->p_swp_info)
\r
186 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
190 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
191 ps_swp_info = (phHciNfc_SWP_Info_t *)
\r
192 psHciContext->p_swp_info ;
\r
193 /* Update the pipe_id of the SWP Gate obtained from HCI Response */
\r
194 ps_swp_info->pipe_id = pipeID;
\r
195 ps_swp_info->p_pipe_info = pPipeInfo;
\r
196 if (NULL != pPipeInfo)
\r
198 /* Update the Response Receive routine of the SWP Gate */
\r
199 pPipeInfo->recv_resp = &phHciNfc_Recv_SWP_Response;
\r
200 pPipeInfo->recv_event =&phHciNfc_Recv_SWP_Event;
\r
209 phHciNfc_Recv_SWP_Response(
\r
212 uint8_t *pResponse,
\r
213 #ifdef ONE_BYTE_LEN
\r
220 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
221 phHciNfc_sContext_t *psHciContext =
\r
222 (phHciNfc_sContext_t *)psContext ;
\r
225 if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse)
\r
228 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
230 else if(NULL == psHciContext->p_swp_info)
\r
232 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
236 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
237 uint8_t prev_cmd = ANY_GET_PARAMETER;
\r
239 ps_swp_info = (phHciNfc_SWP_Info_t *)
\r
240 psHciContext->p_swp_info ;
\r
241 if( NULL == ps_swp_info->p_pipe_info)
\r
243 status = PHNFCSTVAL(CID_NFC_HCI,
\r
244 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
248 prev_cmd = ps_swp_info->p_pipe_info->prev_msg ;
\r
251 case ANY_GET_PARAMETER:
\r
253 HCI_PRINT(" Getting the SWP Parameter \n");
\r
254 status = phHciNfc_SWP_InfoUpdate(psHciContext,
\r
255 ps_swp_info->p_pipe_info->reg_index,
\r
256 &pResponse[HCP_HEADER_LEN],
\r
257 (uint8_t)(length - HCP_HEADER_LEN));
\r
261 case ANY_SET_PARAMETER:
\r
263 HCI_PRINT("SWP Parameter Set \n");
\r
266 case ANY_OPEN_PIPE:
\r
268 HCI_PRINT("SWP gate open pipe complete\n");
\r
271 case ANY_CLOSE_PIPE:
\r
273 HCI_PRINT("SWP close pipe complete\n");
\r
278 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE);
\r
282 if( NFCSTATUS_SUCCESS == status )
\r
284 status = phHciNfc_EmuMgmt_Update_Seq(psHciContext,
\r
286 ps_swp_info->p_pipe_info->prev_status = NFCSTATUS_SUCCESS;
\r
287 ps_swp_info->current_seq = ps_swp_info->next_seq;
\r
296 phHciNfc_SWP_Configure_Default(
\r
299 uint8_t enable_type
\r
302 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
303 static uint8_t param = 0 ;
\r
304 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle);
\r
306 if((NULL == psHciContext)||(NULL == pHwRef))
\r
308 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
310 else if(NULL == psHciContext->p_swp_info)
\r
312 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
316 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
317 phHciNfc_Pipe_Info_t *ps_pipe_info=NULL;
\r
319 ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info;
\r
320 ps_pipe_info = ps_swp_info->p_pipe_info;
\r
322 if(NULL == ps_pipe_info)
\r
324 status = PHNFCSTVAL(CID_NFC_HCI,
\r
325 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
329 ps_pipe_info->reg_index = NXP_SWP_DEFAULT_MODE_INDEX;
\r
330 /* Enable/Disable SWP link */
\r
331 param = (uint8_t)enable_type;
\r
332 ps_pipe_info->param_info =(void*)¶m ;
\r
333 ps_pipe_info->param_length = sizeof(param) ;
\r
334 status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef,
\r
335 ps_swp_info->pipe_id,
\r
336 (uint8_t)ANY_SET_PARAMETER);
\r
345 phHciNfc_SWP_Get_Status(
\r
350 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
351 /* static uint8_t param = 0 ; */
\r
352 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle);
\r
354 if((NULL == psHciContext)||(NULL == pHwRef))
\r
356 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
358 else if(NULL == psHciContext->p_swp_info)
\r
360 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
364 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
365 phHciNfc_Pipe_Info_t *ps_pipe_info=NULL;
\r
367 ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info;
\r
368 ps_pipe_info = ps_swp_info->p_pipe_info;
\r
370 if(NULL == ps_pipe_info)
\r
372 status = PHNFCSTVAL(CID_NFC_HCI,
\r
373 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
377 ps_pipe_info->reg_index = NXP_SWP_STATUS_INDEX;
\r
378 status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef,
\r
379 ps_swp_info->pipe_id,
\r
380 (uint8_t)ANY_GET_PARAMETER);
\r
388 phHciNfc_SWP_Get_Bitrate(
\r
393 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
394 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)
\r
397 if((NULL == psHciContext) || (NULL == pHwRef))
\r
399 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
401 else if(NULL == psHciContext->p_swp_info)
\r
403 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
407 phHciNfc_SWP_Info_t *ps_swp_info = NULL;
\r
409 ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info;
\r
411 status = phHciNfc_DevMgmt_Get_Info(psHciContext, pHwRef,
\r
412 NFC_ADDRESS_SWP_BITRATE, &(ps_swp_info->uicc_bitrate));
\r
420 phHciNfc_SWP_Protection(
\r
426 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
427 static uint8_t param = 0 ;
\r
428 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle);
\r
430 if((NULL == psHciContext)||(NULL == pHwRef))
\r
432 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
434 else if(NULL == psHciContext->p_swp_info)
\r
436 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
440 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
441 phHciNfc_Pipe_Info_t *ps_pipe_info=NULL;
\r
443 ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info;
\r
444 ps_pipe_info = ps_swp_info->p_pipe_info;
\r
446 if(NULL == ps_pipe_info)
\r
448 status = PHNFCSTVAL(CID_NFC_HCI,
\r
449 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
453 ps_pipe_info->reg_index = NXP_SWP_PROTECTED_INDEX;
\r
454 /* Enable/Disable SWP Protection */
\r
455 param = (uint8_t)mode;
\r
456 ps_pipe_info->param_info =(void*)¶m ;
\r
457 ps_pipe_info->param_length = sizeof(param) ;
\r
458 status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef,
\r
459 ps_swp_info->pipe_id,
\r
460 (uint8_t)ANY_SET_PARAMETER);
\r
472 phHciNfc_SWP_InfoUpdate(
\r
473 phHciNfc_sContext_t *psHciContext,
\r
475 uint8_t *reg_value,
\r
479 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
480 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
482 ps_swp_info = (phHciNfc_SWP_Info_t *)
\r
483 psHciContext->p_swp_info ;
\r
485 /* To remove "warning (VS C4100) : unreferenced formal parameter" */
\r
486 PHNFC_UNUSED_VARIABLE(reg_length);
\r
489 case NXP_SWP_DEFAULT_MODE_INDEX:
\r
491 HCI_PRINT_BUFFER("\tUICC Enable Register:",reg_value,reg_length);
\r
494 /* Get the Status of the UICC Connection */
\r
495 case NXP_SWP_STATUS_INDEX:
\r
497 HCI_PRINT_BUFFER("\tUICC Connection Status:", reg_value, reg_length);
\r
498 ps_swp_info->uicc_status = (phHciNfc_SWP_Status_t ) *reg_value ;
\r
501 case NXP_SWP_PROTECTED_INDEX:
\r
503 HCI_PRINT_BUFFER("\t UICC Card Emulation Rights :",reg_value,reg_length);
\r
509 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION);
\r
512 } /* End of switch(index) */
\r
518 phHciNfc_SWP_Configure_Mode(
\r
524 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
525 static uint8_t param = 0;
\r
526 phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)
\r
529 if( (NULL == psHciContext)||(NULL == pHwRef))
\r
531 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
533 else if ( NULL == psHciContext->p_swp_info )
\r
535 status = PHNFCSTVAL(CID_NFC_HCI,
\r
536 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
540 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
541 phHciNfc_Pipe_Info_t *ps_pipe_info=NULL;
\r
543 ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info;
\r
545 ps_pipe_info = ps_swp_info->p_pipe_info;
\r
546 if(NULL == ps_pipe_info)
\r
548 status = PHNFCSTVAL(CID_NFC_HCI,
\r
549 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
553 /* Switch the Mode of the SmartMx */
\r
555 ps_pipe_info->param_info =(void*)¶m ;
\r
556 ps_pipe_info->param_length = sizeof(param) ;
\r
557 status = phHciNfc_Send_SWP_Event( psHciContext, pHwRef,
\r
558 ps_swp_info->pipe_id,
\r
559 NXP_EVT_SWP_SWITCH_MODE );
\r
561 /* Send the Success Status as this is an event */
\r
562 status = ((status == NFCSTATUS_PENDING)?
\r
563 NFCSTATUS_SUCCESS : status);
\r
565 }/* End of else part*/
\r
572 phHciNfc_Recv_SWP_Event(
\r
576 #ifdef ONE_BYTE_LEN
\r
583 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
584 phHciNfc_sContext_t *psHciContext =
\r
585 (phHciNfc_sContext_t *)psContext ;
\r
586 static phHal_sEventInfo_t EventInfo;
\r
589 if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent)
\r
592 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
594 else if(NULL == psHciContext->p_swp_info)
\r
596 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
\r
600 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
602 ps_swp_info = (phHciNfc_SWP_Info_t *)
\r
603 psHciContext->p_swp_info ;
\r
604 if( NULL == ps_swp_info->p_pipe_info)
\r
606 status = PHNFCSTVAL(CID_NFC_HCI,
\r
607 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
611 phHciNfc_HCP_Packet_t *p_packet = NULL;
\r
612 phHciNfc_HCP_Message_t *message = NULL;
\r
613 uint8_t EventType = 0;
\r
615 p_packet = (phHciNfc_HCP_Packet_t *)pEvent;
\r
616 message = &(p_packet->msg.message);
\r
617 /* Get the instruction bits from the Message Header */
\r
618 EventType = (uint8_t) GET_BITS8( message->msg_header,
\r
619 HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN);
\r
621 EventInfo.eventHost = phHal_eHostController;
\r
622 EventInfo.eventSource = phHal_ePICC_DevType;
\r
623 /* Occurrence of the Protected events for reporting */
\r
624 if (NXP_EVT_SWP_PROTECTED == EventType)
\r
626 EventInfo.eventType = NFC_EVT_PROTECTED;
\r
630 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE);
\r
633 if (NFCSTATUS_SUCCESS == status )
\r
635 phHciNfc_Notify_Event( psHciContext, pHwRef,
\r
636 NFC_NOTIFY_EVENT, (void*)&EventInfo);
\r
648 phHciNfc_Send_SWP_Event(
\r
649 phHciNfc_sContext_t *psHciContext,
\r
655 phHciNfc_HCP_Packet_t *hcp_packet = NULL;
\r
656 phHciNfc_HCP_Message_t *hcp_message = NULL;
\r
657 phHciNfc_Pipe_Info_t *p_pipe_info = NULL;
\r
658 uint8_t length = 0;
\r
660 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
662 p_pipe_info = (phHciNfc_Pipe_Info_t *)
\r
663 psHciContext->p_pipe_list[pipe_id];
\r
664 psHciContext->tx_total = 0 ;
\r
665 length = (length + HCP_HEADER_LEN);
\r
667 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
\r
668 /* Construct the HCP Frame */
\r
669 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
\r
670 (uint8_t) pipe_id,
\r
671 HCP_MSG_TYPE_EVENT, event);
\r
673 hcp_message = &(hcp_packet->msg.message);
\r
675 phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
\r
677 (uint8_t *)p_pipe_info->param_info,
\r
678 p_pipe_info->param_length);
\r
679 length = (uint8_t)(length + i + p_pipe_info->param_length);
\r
681 p_pipe_info->sent_msg_type = HCP_MSG_TYPE_EVENT ;
\r
682 p_pipe_info->prev_msg = event ;
\r
683 psHciContext->tx_total = length;
\r
685 /* Send the Constructed HCP packet to the lower layer */
\r
686 status = phHciNfc_Send_HCP( psHciContext, pHwRef );
\r
687 if(NFCSTATUS_PENDING == status)
\r
689 ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->current_seq =
\r
690 ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->next_seq;
\r
691 p_pipe_info->prev_status = status;
\r
698 phHciNfc_SWP_Update_Sequence(
\r
699 phHciNfc_sContext_t *psHciContext,
\r
700 phHciNfc_eSeqType_t SWP_seq
\r
703 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
704 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
705 if( NULL == psHciContext )
\r
707 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
709 else if( NULL == psHciContext->p_swp_info )
\r
711 status = PHNFCSTVAL(CID_NFC_HCI,
\r
712 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
716 ps_swp_info = (phHciNfc_SWP_Info_t *)
\r
717 psHciContext->p_swp_info ;
\r
723 ps_swp_info->current_seq = SWP_INVALID_SEQUENCE;
\r
724 ps_swp_info->next_seq = SWP_INVALID_SEQUENCE ;
\r
729 ps_swp_info->current_seq = ps_swp_info->next_seq;
\r
734 ps_swp_info->current_seq = SWP_INVALID_SEQUENCE;
\r
735 ps_swp_info->next_seq = SWP_INVALID_SEQUENCE;
\r
740 ps_swp_info->current_seq = SWP_STATUS_SEQ;
\r
741 ps_swp_info->next_seq = SWP_STATUS_SEQ;
\r
754 phHciNfc_SWP_Config_Sequence(
\r
755 phHciNfc_sContext_t *psHciContext,
\r
757 phHal_sEmulationCfg_t *ps_emulation_cfg
\r
760 NFCSTATUS status = NFCSTATUS_SUCCESS;
\r
761 phHciNfc_SWP_Info_t *ps_swp_info=NULL;
\r
763 if ((NULL == psHciContext) || (NULL == pHwRef) ||
\r
764 (NULL == ps_emulation_cfg))
\r
766 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
\r
768 else if( NULL == psHciContext->p_swp_info )
\r
770 status = PHNFCSTVAL(CID_NFC_HCI,
\r
771 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
775 phHciNfc_Pipe_Info_t *ps_pipe_info = NULL;
\r
776 phHal_sUiccEmuCfg_t *uicc_config =
\r
777 &(ps_emulation_cfg->config.uiccEmuCfg);
\r
779 ps_swp_info = (phHciNfc_SWP_Info_t *)psHciContext->p_swp_info;
\r
780 ps_pipe_info = ps_swp_info->p_pipe_info;
\r
782 if (NULL == ps_pipe_info)
\r
784 status = PHNFCSTVAL(CID_NFC_HCI,
\r
785 NFCSTATUS_INVALID_HCI_INFORMATION);
\r
789 switch(ps_swp_info->current_seq)
\r
791 case SWP_STATUS_SEQ :
\r
793 status = phHciNfc_SWP_Configure_Default( psHciContext,
\r
794 pHwRef, uicc_config->enableUicc );
\r
796 if(status == NFCSTATUS_PENDING)
\r
798 ps_swp_info->next_seq = SWP_STATUS_SEQ;
\r
799 status = NFCSTATUS_SUCCESS;
\r
803 case SWP_MODE_SEQ :
\r
805 status = phHciNfc_SWP_Configure_Mode( psHciContext,
\r
806 pHwRef, UICC_SWITCH_MODE_DEFAULT );
\r
807 /* UICC_SWITCH_MODE_ON */
\r
808 if(status == NFCSTATUS_PENDING)
\r
810 ps_swp_info->next_seq = SWP_STATUS_SEQ;
\r
811 status = NFCSTATUS_SUCCESS;
\r
817 status = PHNFCSTVAL(CID_NFC_HCI,
\r
818 NFCSTATUS_INVALID_HCI_INFORMATION);
\r