15d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 25d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Copyright (C) 2010 NXP Semiconductors 35d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 45d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Licensed under the Apache License, Version 2.0 (the "License"); 55d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * you may not use this file except in compliance with the License. 65d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * You may obtain a copy of the License at 75d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 85d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * http://www.apache.org/licenses/LICENSE-2.0 95d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Unless required by applicable law or agreed to in writing, software 115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * distributed under the License is distributed on an "AS IS" BASIS, 125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * See the License for the specific language governing permissions and 145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * limitations under the License. 155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* =========================================================================== * 195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* \file phHciNfc_SWP.c * 225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* \brief HCI SWP gate Management Routines. * 235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* Project: NFC-FRI-1.1 * 265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Date: Tue Aug 18 10:16:36 2009 $ * 285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Author: ing04880 $ * 295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Revision: 1.31 $ * 305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $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 $ * * 315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* =========================================================================== * 325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly***************************** Header File Inclusion **************************** 365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcCompId.h> 385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Pipe.h> 395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_SWP.h> 405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phOsalNfc.h> 415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Emulation.h> 425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_DevMgmt.h> 435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly****************************** Macro Definitions ******************************* 455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* SWP Gate regsitry Settings */ 485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* set default mode mode as virtual mode */ 495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define NXP_SWP_DEFAULT_MODE_INDEX (0x01U) 505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* Get the Status of the UICC Connection */ 515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define NXP_SWP_STATUS_INDEX (0x02U) 525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* Configure the Secure Element Protected Mode */ 545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define NXP_SWP_PROTECTED_INDEX (0x03U) 555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* Switch mode index */ 575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define NXP_EVT_SWP_SWITCH_MODE (0x03U) 585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* Protected Event from the Host Controller */ 605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define NXP_EVT_SWP_PROTECTED (0x04U) 615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/****************** Structure and Enumeration ****************************/ 635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/****************** Static Function Declaration **************************/ 655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_SWP_Response( 695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pResponse, 725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Send_SWP_Event( 825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id, 855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t event 865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_SWP_Event( 925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pEvent, 955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_InfoUpdate( 1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t index, 1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *reg_value, 1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t reg_length 1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Function Definitions *************************** 1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Get_PipeID( 1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *ppipe_id 1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL != psHciContext) 1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && ( NULL != ppipe_id ) 1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && ( NULL != psHciContext->p_swp_info ) 1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *p_swp_info=NULL; 1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_swp_info = (phHciNfc_SWP_Info_t *) 1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *ppipe_id = p_swp_info->pipe_id ; 1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Init_Resources(phHciNfc_sContext_t *psHciContext) 1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == psHciContext ) 1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(( NULL == psHciContext->p_swp_info ) && 1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_Allocate_Resource((void **)(&ps_swp_info), 1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly sizeof(phHciNfc_SWP_Info_t))== NFCSTATUS_SUCCESS)) 1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info = ps_swp_info; 1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = SWP_INVALID_SEQUENCE; 1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_INVALID_SEQUENCE; 1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id = (uint8_t)HCI_UNKNOWN_PIPE_ID; 1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES); 1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Update_PipeInfo( 1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipeID, 1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeInfo 1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == psHciContext ) 1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *) 1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Update the pipe_id of the SWP Gate obtained from HCI Response */ 1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id = pipeID; 1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->p_pipe_info = pPipeInfo; 1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NULL != pPipeInfo) 1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Update the Response Receive routine of the SWP Gate */ 1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pPipeInfo->recv_resp = &phHciNfc_Recv_SWP_Response; 2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pPipeInfo->recv_event =&phHciNfc_Recv_SWP_Event; 2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_SWP_Response( 2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pResponse, 2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = 2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_sContext_t *)psContext ; 2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse) 2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (length == 0)) 2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t prev_cmd = ANY_GET_PARAMETER; 2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *) 2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == ps_swp_info->p_pipe_info) 2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly prev_cmd = ps_swp_info->p_pipe_info->prev_msg ; 2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(prev_cmd) 2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_GET_PARAMETER: 2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT(" Getting the SWP Parameter \n"); 2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_SWP_InfoUpdate(psHciContext, 2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->p_pipe_info->reg_index, 2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &pResponse[HCP_HEADER_LEN], 2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)(length - HCP_HEADER_LEN)); 2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_SET_PARAMETER: 2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("SWP Parameter Set \n"); 2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_OPEN_PIPE: 2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("SWP gate open pipe complete\n"); 2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_CLOSE_PIPE: 2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("SWP close pipe complete\n"); 2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE); 2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NFCSTATUS_SUCCESS == status ) 2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_EmuMgmt_Update_Seq(psHciContext, 2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly UPDATE_SEQ); 2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->p_pipe_info->prev_status = NFCSTATUS_SUCCESS; 2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = ps_swp_info->next_seq; 2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Configure_Default( 2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t enable_type 3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly static uint8_t param = 0 ; 3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle); 3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((NULL == psHciContext)||(NULL == pHwRef)) 3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info=NULL; 3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info; 3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_swp_info->p_pipe_info; 3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info) 3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = NXP_SWP_DEFAULT_MODE_INDEX; 3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Enable/Disable SWP link */ 3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly param = (uint8_t)enable_type; 3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_info =(void*)¶m ; 3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_length = sizeof(param) ; 3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef, 3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id, 3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)ANY_SET_PARAMETER); 3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Get_Status( 3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef 3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* static uint8_t param = 0 ; */ 3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle); 3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((NULL == psHciContext)||(NULL == pHwRef)) 3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info=NULL; 3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info; 3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_swp_info->p_pipe_info; 3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info) 3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = NXP_SWP_STATUS_INDEX; 3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef, 3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id, 3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)ANY_GET_PARAMETER); 3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Get_Bitrate( 3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef 3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *) 3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciHandle); 3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((NULL == psHciContext) || (NULL == pHwRef)) 3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info = NULL; 4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info; 4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_DevMgmt_Get_Info(psHciContext, pHwRef, 4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFC_ADDRESS_SWP_BITRATE, &(ps_swp_info->uicc_bitrate)); 4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Protection( 4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t mode 4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly static uint8_t param = 0 ; 4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle); 4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((NULL == psHciContext)||(NULL == pHwRef)) 4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 4415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info=NULL; 4425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info; 4445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_swp_info->p_pipe_info; 4455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info) 4475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 4495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 4505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = NXP_SWP_PROTECTED_INDEX; 4545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Enable/Disable SWP Protection */ 4555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly param = (uint8_t)mode; 4565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_info =(void*)¶m ; 4575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_length = sizeof(param) ; 4585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Generic_Cmd(psHciContext, pHwRef, 4595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id, 4605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)ANY_SET_PARAMETER); 4615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 4655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 4665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 4715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 4725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_InfoUpdate( 4735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 4745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t index, 4755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *reg_value, 4765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t reg_length 4775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 4795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 4805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 4815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *) 4835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 4845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* To remove "warning (VS C4100) : unreferenced formal parameter" */ 4865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly PHNFC_UNUSED_VARIABLE(reg_length); 4875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(index) 4885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case NXP_SWP_DEFAULT_MODE_INDEX: 4905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("\tUICC Enable Register:",reg_value,reg_length); 4925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Get the Status of the UICC Connection */ 4955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case NXP_SWP_STATUS_INDEX: 4965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("\tUICC Connection Status:", reg_value, reg_length); 4985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->uicc_status = (phHciNfc_SWP_Status_t ) *reg_value ; 4995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case NXP_SWP_PROTECTED_INDEX: 5025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("\t UICC Card Emulation Rights :",reg_value,reg_length); 5045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 5085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION); 5105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /* End of switch(index) */ 5135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 5155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 5165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 5185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Configure_Mode( 5195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 5205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 5215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t uicc_mode 5225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 5245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 5255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly static uint8_t param = 0; 5265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *) 5275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciHandle); 5285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext)||(NULL == pHwRef)) 5305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 5325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if ( NULL == psHciContext->p_swp_info ) 5345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 5365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 5375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 5395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 5415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info=NULL; 5425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t*)psHciContext->p_swp_info; 5445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_swp_info->p_pipe_info; 5465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info) 5475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 5495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 5505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 5525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Switch the Mode of the SmartMx */ 5545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly param = uicc_mode; 5555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_info =(void*)¶m ; 5565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_length = sizeof(param) ; 5575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_SWP_Event( psHciContext, pHwRef, 5585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->pipe_id, 5595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NXP_EVT_SWP_SWITCH_MODE ); 5605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Send the Success Status as this is an event */ 5625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((status == NFCSTATUS_PENDING)? 5635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 5645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly }/* End of else part*/ 5665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 5685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 5695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 5715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 5725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_SWP_Event( 5735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 5745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 5755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pEvent, 5765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 5775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 5785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 5795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 5805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 5835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 5845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = 5855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_sContext_t *)psContext ; 5865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly static phHal_sEventInfo_t EventInfo; 5875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent) 5905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (length == 0)) 5915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 5935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_swp_info) 5955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 5975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 5995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 6015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *) 6035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 6045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == ps_swp_info->p_pipe_info) 6055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 6075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 6085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 6105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Packet_t *p_packet = NULL; 6125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Message_t *message = NULL; 6135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t EventType = 0; 6145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_packet = (phHciNfc_HCP_Packet_t *)pEvent; 6165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly message = &(p_packet->msg.message); 6175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Get the instruction bits from the Message Header */ 6185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly EventType = (uint8_t) GET_BITS8( message->msg_header, 6195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN); 6205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly EventInfo.eventHost = phHal_eHostController; 6225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly EventInfo.eventSource = phHal_ePICC_DevType; 6235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Occurrence of the Protected events for reporting */ 6245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NXP_EVT_SWP_PROTECTED == EventType) 6255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly EventInfo.eventType = NFC_EVT_PROTECTED; 6275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 6295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE); 6315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NFCSTATUS_SUCCESS == status ) 6345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Notify_Event( psHciContext, pHwRef, 6365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFC_NOTIFY_EVENT, (void*)&EventInfo); 6375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 6425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 6435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 6475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 6485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Send_SWP_Event( 6495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 6505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 6515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id, 6525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t event 6535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 6555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Packet_t *hcp_packet = NULL; 6565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Message_t *hcp_message = NULL; 6575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 6585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length = 0; 6595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t i=0; 6605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 6615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = (phHciNfc_Pipe_Info_t *) 6635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_pipe_list[pipe_id]; 6645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->tx_total = 0 ; 6655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly length = (length + HCP_HEADER_LEN); 6665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer; 6685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Construct the HCP Frame */ 6695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT, 6705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t) pipe_id, 6715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCP_MSG_TYPE_EVENT, event); 6725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_message = &(hcp_packet->msg.message); 6745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload, 6765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly i, 6775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t *)p_pipe_info->param_info, 6785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->param_length); 6795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly length = (uint8_t)(length + i + p_pipe_info->param_length); 6805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->sent_msg_type = HCP_MSG_TYPE_EVENT ; 6825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->prev_msg = event ; 6835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->tx_total = length; 6845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Send the Constructed HCP packet to the lower layer */ 6865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_HCP( psHciContext, pHwRef ); 6875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_PENDING == status) 6885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->current_seq = 6905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->next_seq; 6915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->prev_status = status; 6925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 6955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 6965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 6985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Update_Sequence( 6995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 7005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_eSeqType_t SWP_seq 7015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 7035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 7045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 7055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == psHciContext ) 7065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 7085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if( NULL == psHciContext->p_swp_info ) 7105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 7125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 7135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *) 7175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_swp_info ; 7185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(SWP_seq) 7195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case RESET_SEQ: 7215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case INIT_SEQ: 7225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = SWP_INVALID_SEQUENCE; 7245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_INVALID_SEQUENCE ; 7255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case UPDATE_SEQ: 7285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = ps_swp_info->next_seq; 7305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case REL_SEQ: 7335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = SWP_INVALID_SEQUENCE; 7355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_INVALID_SEQUENCE; 7365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case CONFIG_SEQ: 7395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->current_seq = SWP_STATUS_SEQ; 7415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_STATUS_SEQ; 7425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 7455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 7515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 7525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 7545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_SWP_Config_Sequence( 7555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 7565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 7575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHal_sEmulationCfg_t *ps_emulation_cfg 7585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 7605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 7615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SWP_Info_t *ps_swp_info=NULL; 7625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if ((NULL == psHciContext) || (NULL == pHwRef) || 7645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (NULL == ps_emulation_cfg)) 7655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 7675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if( NULL == psHciContext->p_swp_info ) 7695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 7715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 7725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info = NULL; 7765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHal_sUiccEmuCfg_t *uicc_config = 7775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &(ps_emulation_cfg->config.uiccEmuCfg); 7785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info = (phHciNfc_SWP_Info_t *)psHciContext->p_swp_info; 7805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_swp_info->p_pipe_info; 7815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NULL == ps_pipe_info) 7835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 7855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 7865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(ps_swp_info->current_seq) 7905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case SWP_STATUS_SEQ : 7925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_SWP_Configure_Default( psHciContext, 7945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pHwRef, uicc_config->enableUicc ); 7955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_PENDING) 7975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_STATUS_SEQ; 7995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = NFCSTATUS_SUCCESS; 8005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case SWP_MODE_SEQ : 8045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_SWP_Configure_Mode( psHciContext, 8065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pHwRef, UICC_SWITCH_MODE_DEFAULT ); 8075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* UICC_SWITCH_MODE_ON */ 8085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_PENDING) 8095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_swp_info->next_seq = SWP_STATUS_SEQ; 8115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = NFCSTATUS_SUCCESS; 8125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default : 8165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 8185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_INFORMATION); 8195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 8255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 8265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 8275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 8285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 829