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 hHciNfc_PipeMgmt.c * 225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* \brief HCI Pipe Management Routines. * 235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* Project: NFC-FRI-1.1 * 265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Date: Tue Aug 18 10:12:39 2009 $ * 285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Author: ing04880 $ * 295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Revision: 1.42 $ * 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 365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly***************************** Header File Inclusion **************************** 385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcConfig.h> 415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcCompId.h> 425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Pipe.h> 435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phOsalNfc.h> 445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_AdminMgmt.h> 455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_LinkMgmt.h> 465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_IDMgmt.h> 475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_DevMgmt.h> 485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_PollingLoop.h> 495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_RFReader.h> 505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_RFReaderA.h> 515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_B 525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_RFReaderB.h> 535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_FELICA 555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Felica.h> 565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_JEWEL 585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Jewel.h> 595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_ISO15693 615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_ISO15693.h> 625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_NfcIPMgmt.h> 655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef HOST_EMULATION 675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_CE_A.h> 685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_CE_B.h> 695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_WI.h> 715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_SWP.h> 725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly****************************** Macro Definitions ******************************* 755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Structure and Enumeration *************************** 795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic phHciNfc_GateID_t host_gate_list[] = { 815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_IdentityMgmtGate, 825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PN544MgmtGate, 835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PollingLoopGate, 845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_RFReaderAGate, 855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_B 865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_RFReaderBGate, 875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_FELICA 905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_RFReaderFGate, 915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_JEWEL 945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_JewelReaderGate, 955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_ISO15693 985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693Gate, 995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_NFCIP1InitRFGate, 1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_NFCIP1TargetRFGate, 1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_NfcWIMgmtGate, 1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_SwpMgmtGate, 1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined(HOST_EMULATION) && ( NXP_UICC_CE_RIGHTS < 0x01 ) 1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_CETypeAGate, 1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_CETypeBGate, 1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_UnknownGate 1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}; 1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Static Function Declaration ************************** 1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Create_Pipe( 1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t *destination, 1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t **ppPipeHandle 1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Function Definitions *************************** 1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Creation of the Pipe 1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function creates the pipe between a source host's gate and destination 1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * host's gate 1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Create_Pipe( 1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t *destination, 1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t **ppPipeHandle 1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *ppPipeHandle = (phHciNfc_Pipe_Info_t *) 1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phOsalNfc_GetMemory( sizeof(phHciNfc_Pipe_Info_t) ); 1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL != *ppPipeHandle) 1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Source Host is the Terminal Host */ 1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (*ppPipeHandle)->pipe.source.host_id = (uint8_t) phHciNfc_TerminalHostID; 1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Source Gate is same as the Destination Gate */ 1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (*ppPipeHandle)->pipe.source.gate_id = 1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_Gate_Info_t *)destination)->gate_id; 1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (*ppPipeHandle)->pipe.dest.host_id = 1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_Gate_Info_t *)destination)->host_id; 1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (*ppPipeHandle)->pipe.dest.gate_id = 1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_Gate_Info_t *)destination)->gate_id; 1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* if( hciMode_Override == psHciContext->hci_mode ) */ 1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Pipe ID is unknown until it is assigned */ 1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (*ppPipeHandle)->pipe.pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; 1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Admin_Cmd( psHciContext, pHwRef, 1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ADM_CREATE_PIPE, (PIPEINFO_SIZE-1) 1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ,*ppPipeHandle ); 1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES); 1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Update_Pipe( 1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PipeMgmt_Seq_t *p_pipe_seq 1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly static uint8_t pipe_index = HCI_DYNAMIC_PIPE_ID; 1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly for (pipe_index = 0; 1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (pipe_index + HCI_DYNAMIC_PIPE_ID) <= 2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)(sizeof(host_gate_list)/sizeof(phHciNfc_GateID_t) ); 2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_index++) 2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Allocate_Resource((void **)&p_pipe_info, 2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly sizeof(phHciNfc_Pipe_Info_t)); 2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NFCSTATUS_SUCCESS == status) 2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (NULL != p_pipe_info)) 2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Source Host is the Terminal Host */ 2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.source.host_id = (uint8_t) phHciNfc_TerminalHostID; 2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Source Gate is same as the Destination Gate */ 2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.source.gate_id = 2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly host_gate_list[pipe_index]; 2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.dest.host_id = 2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HostControllerID; 2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.dest.gate_id = 2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly host_gate_list[pipe_index]; 2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* The Pipe ID is unknown until it is assigned */ 2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; 2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Initialise the Resources for the particular Gate */ 2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_All_Pipes(psHciContext, 2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pHwRef, p_pipe_seq ); 2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NFCSTATUS_SUCCESS == status ) 2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id = (uint8_t)(pipe_index + HCI_DYNAMIC_PIPE_ID); 2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Update_PipeInfo( psHciContext, p_pipe_seq , 2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, p_pipe_info ); 2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NFCSTATUS_SUCCESS == status ) 2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info->pipe.pipe_id = pipe_id; 2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_pipe_list[pipe_id] = p_pipe_info; 2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phOsalNfc_FreeMemory(p_pipe_info); 2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = NULL; 2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phOsalNfc_FreeMemory(p_pipe_info); 2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = NULL; 2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES); 2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NFCSTATUS_SUCCESS == status ) 2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_LinkMgmt_Initialise( psHciContext,pHwRef ); 2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderMgmt_Initialise( psHciContext,pHwRef ); 2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_EmuMgmt_Initialise( psHciContext,pHwRef ); 2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Deletion of the Pipe 2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function Deletes a pipe created between a terminal host's gate and 2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * destination host's gate 2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Delete_Pipe( 2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeHandle 2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status=NFCSTATUS_SUCCESS; 2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS cmd_status = NFCSTATUS_SUCCESS; 2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) 2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (NULL == pHwRef) 2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (NULL == pPipeHandle) 2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly cmd_status = phHciNfc_Send_Admin_Cmd( psHciContext, pHwRef, 3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ADM_DELETE_PIPE, PIPEID_LEN, pPipeHandle ); 3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ( (cmd_status == NFCSTATUS_PENDING)? 3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : cmd_status); 3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef HOST_EMULATION 3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_CE_Pipes_OP( 3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PipeMgmt_Seq_t *p_pipe_seq 3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* uint8_t pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; */ 3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) ) 3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch( *p_pipe_seq ) 3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_CARD_A_CREATE: 3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_CETypeAGate; 3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_A_Init_Resources ( psHciContext ); 3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_SUCCESS) 3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_CARD_B_CREATE: 3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_CETypeBGate; 3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_B_Init_Resources ( psHciContext ); 3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_SUCCESS) 3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if 0 3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_CARD_F_CREATE: 3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_CETypeFGate; 3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = phHciNfc_Card_Emulation_Init (psHciContext , TYPE_F); */ 3725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_SUCCESS) 3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_CARD_A_DELETE: 3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_A_Get_PipeID( psHciContext, &pipe_id ); 3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = psHciContext->p_pipe_list[pipe_id]; 3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_SUCCESS) 3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Delete_Pipe( psHciContext, pHwRef, 3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info); 3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_CARD_B_DELETE: 3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_B_Get_PipeID( psHciContext, &pipe_id ); 3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = psHciContext->p_pipe_list[pipe_id]; 3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(status == NFCSTATUS_SUCCESS) 3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Delete_Pipe( psHciContext, pHwRef, 4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info); 4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* case PIPE_MGMT_END : */ 4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE); 4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Creates the Pipes of all the Supported Gates . 4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function Creates the pipes for all the supported gates 4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Create_All_Pipes( 4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PipeMgmt_Seq_t *p_pipe_seq 4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) 4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (NULL == p_pipe_seq) ) 4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 4425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch( *p_pipe_seq ) 4475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Admin pipe close sequence */ 4495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_IDMGMT_CREATE: 4505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 4525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 4545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_IdentityMgmtGate; 4555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_IDMgmt_Init_Resources (psHciContext); 4575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 4585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 4595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 4605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 4615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 4645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 4655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 4665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 4675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_PN544MGMT_CREATE: 4715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 4735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 4755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_PN544MgmtGate; 4765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_DevMgmt_Init_Resources (psHciContext); 4785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 4795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 4805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 4815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 4825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 4855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 4865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(HCI_SELF_TEST == psHciContext->init_mode) 4875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 4895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 4905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_POLLINGLOOP_CREATE: 4955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 4975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 4995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_PollingLoopGate; 5005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_PollLoop_Init_Resources (psHciContext); 5025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 5035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 5045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 5055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 5095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 5105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 5115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 5125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_READER_A_CREATE: 5165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 5185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 5205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_RFReaderAGate; 5215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderA_Init_Resources (psHciContext); 5235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 5245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 5255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 5265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 5305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 5315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 5325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 5335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_B 5375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_READER_B_CREATE: 5385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 5405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 5425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_RFReaderBGate; 5435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderB_Init_Resources (psHciContext); 5455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 5465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 5475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 5485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 5525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 5535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 5545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 5555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #ifdef TYPE_B*/ 5595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_FELICA 5615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_READER_F_CREATE: 5625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 5645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 5665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_RFReaderFGate; 5675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Felica_Init_Resources (psHciContext); 5695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 5705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 5715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 5725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 5765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 5775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 5785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 5795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_JEWEL 5845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_READER_JWL_CREATE: 5855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 5875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 5895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_JewelReaderGate; 5905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Jewel_Init_Resources (psHciContext); 5925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 5935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 5945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 5955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 5995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 6005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 6015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 6025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 6045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #ifdef TYPE_JEWEL */ 6065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_ISO15693 6075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_READER_ISO15693_CREATE: 6085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 6105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 6125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_ISO15693Gate; 6135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ISO15693_Init_Resources (psHciContext); 6155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 6165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 6175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 6185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 6225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 6235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 6245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 6255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 6275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #ifdef TYPE_ISO15693 */ 6295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_NFC_INITIATOR_CREATE: 6305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 6325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 6345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_NFCIP1InitRFGate; 6355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 6365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Initiator_Init_Resources (psHciContext); 6375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 6385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 6395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 6405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 6445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 6455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 6465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 6475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 6505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_NFC_TARGET_CREATE: 6525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 6545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 6565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_NFCIP1TargetRFGate; 6575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 6595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Target_Init_Resources (psHciContext); 6605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 6615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 6625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 6635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 6675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 6685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 6695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 6705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 6735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_WI_CREATE: 6755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 6775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 6795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_NfcWIMgmtGate; 6805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_WI_Init_Resources ( psHciContext ); 6825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 6835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 6845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 6855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 6865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 6895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 6905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* status = ((NFCSTATUS_PENDING == status )? 6915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); */ 6925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 6945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case PIPE_SWP_CREATE: 6965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Gate_Info_t id_dest; 6985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.host_id = (uint8_t)phHciNfc_HostControllerID; 7005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly id_dest.gate_id = (uint8_t)phHciNfc_SwpMgmtGate; 7015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_SWP_Init_Resources ( psHciContext ); 7035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((status == NFCSTATUS_SUCCESS) 7055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ESTABLISH_SESSION 7065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && (hciMode_Session != psHciContext->hci_mode) 7075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 7085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Create_Pipe( psHciContext, pHwRef, 7115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &id_dest, &p_pipe_info); 7125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status )? 7135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 7145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* case PIPE_MGMT_END : */ 7185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 7195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE); 7215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 7225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /* End of Pipe Seq Switch */ 7255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /* End of Null Check for the Context */ 7275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 7295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 7305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 7325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Deletes the Pipes of all the Supported Gates . 7335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 7345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function Deletes the pipes for all the supported gates 7355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 7365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 7385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Delete_All_Pipes( 7395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 7405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 7415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PipeMgmt_Seq_t pipeSeq 7425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 7445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 7455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 7465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length = 0; 7475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) ) 7495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 7515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* pipeSeq = PIPE_DELETE_ALL; */ 7555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if ( PIPE_DELETE_ALL == pipeSeq ) 7575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Admin pipe close sequence */ 7595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_pipe_info = psHciContext->p_pipe_list[PIPETYPE_STATIC_ADMIN]; 7605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Admin_Cmd( psHciContext, 7615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pHwRef, ADM_CLEAR_ALL_PIPE, 7625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly length, p_pipe_info); 7635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((NFCSTATUS_PENDING == status)? 7645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : status); 7655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE); 7695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /* End of Null Check for the Context */ 7735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 7755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 7765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 7805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Update_PipeInfo( 7815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 7825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_PipeMgmt_Seq_t *pPipeSeq, 7835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id, 7845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeInfo 7855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 7875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_GateID_t gate_id = phHciNfc_UnknownGate; 7885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 7895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( 7915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (NULL == psHciContext) || (NULL == pPipeSeq) 7925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || ( NULL == pPipeInfo ) 7935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 7965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly gate_id = (phHciNfc_GateID_t )pPipeInfo->pipe.dest.gate_id ; 8005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch( gate_id ) 8015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Identity Management Pipe Creation */ 8035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_IdentityMgmtGate: 8045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_IDMgmt_Update_PipeInfo(psHciContext, 8065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_PN544MGMT_CREATE; 8105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_PN544MgmtGate: 8145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_DevMgmt_Update_PipeInfo(psHciContext, 8165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = ( HCI_SELF_TEST != psHciContext->init_mode )? 8205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly PIPE_POLLINGLOOP_CREATE:PIPE_DELETE_ALL; 8215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_PollingLoopGate: 8255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_PollLoop_Update_PipeInfo(psHciContext, 8275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_A_CREATE; 8315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_RFReaderAGate: 8355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderA_Update_PipeInfo(psHciContext, 8375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 8415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_B) 8425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_B_CREATE; 8435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_B) */ 8445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_FELICA) 8455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_F_CREATE; 8465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_FELICA) */ 8475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_JEWEL) 8485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_JWL_CREATE; 8495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_JEWEL) */ 8505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_ISO15693) 8515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_ISO15693_CREATE; 8525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_ISO15693) */ 8535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined(ENABLE_P2P) 8545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_INITIATOR_CREATE; 8555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined(ENABLE_P2P) */ 8565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /*lint -e{91} suppress "Line exceeds"*/ 8575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif !defined(TYPE_B) && !defined(TYPE_FELICA) && !defined(TYPE_JEWEL) && !defined(TYPE_ISO15693) && !defined(ENABLE_P2P) 8585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 8595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 8605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_B 8645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_RFReaderBGate: 8655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderB_Update_PipeInfo(psHciContext, 8675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_FELICA) 8715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_F_CREATE; 8725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_FELICA) */ 8735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_JEWEL) 8745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_JWL_CREATE; 8755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_JEWEL) */ 8765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_ISO15693) 8775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_ISO15693_CREATE; 8785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_ISO15693) */ 8795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined(ENABLE_P2P) 8805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_INITIATOR_CREATE; 8815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined(ENABLE_P2P) */ 8825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /*lint -e{91} suppress "Line exceeds"*/ 8835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif !defined(TYPE_FELICA) && !defined(TYPE_JEWEL) && !defined(TYPE_ISO15693) && !defined(ENABLE_P2P) 8845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 8855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 8865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 8885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 8895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 8905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_FELICA 8915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_RFReaderFGate: 8925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Felica_Update_PipeInfo(psHciContext, 8945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 8955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 8965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 8975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_JEWEL) 8985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_JWL_CREATE; 8995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_JEWEL) */ 9005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined (TYPE_ISO15693) 9015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_ISO15693_CREATE; 9025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_ISO15693) */ 9035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined(ENABLE_P2P) 9045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_INITIATOR_CREATE; 9055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined(ENABLE_P2P) */ 9065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif !defined(TYPE_JEWEL) && !defined(TYPE_ISO15693) && !defined(ENABLE_P2P) 9075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 9085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 9095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 9135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef TYPE_JEWEL 9145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_JewelReaderGate: 9155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Jewel_Update_PipeInfo(psHciContext, 9175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_ISO15693) 9215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_READER_ISO15693_CREATE; 9225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined (TYPE_ISO15693) */ 9235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif defined(ENABLE_P2P) 9245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_INITIATOR_CREATE; 9255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* #if defined(ENABLE_P2P) */ 9265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#elif !defined(TYPE_ISO15693) && !defined(ENABLE_P2P) 9275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 9285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 9295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #ifdef TYPE_JEWEL */ 9335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_ISO15693) 9345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_ISO15693Gate: 9355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ISO15693_Update_PipeInfo(psHciContext, 9375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 9415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 9425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_INITIATOR_CREATE; 9435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 9445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 9455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #ifdef ENABLE_P2P */ 9465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if defined (TYPE_ISO15693) */ 9505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_NFCIP1InitRFGate: 9515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 9535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Initiator_Update_PipeInfo(psHciContext, 9545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_NFC_TARGET_CREATE; 9585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 9605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_NFCIP1TargetRFGate: 9635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ENABLE_P2P 9655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Target_Update_PipeInfo(psHciContext, 9665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_WI_CREATE; 9705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 9725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_NfcWIMgmtGate: 9755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_WI_Update_PipeInfo(psHciContext, 9775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_SWP_CREATE; 9815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_SwpMgmtGate: 9855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_SWP_Update_PipeInfo(psHciContext, 9875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 9895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_DELETE_ALL; 9915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 9945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_ConnectivityGate: 9955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 9965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Uicc_Update_PipeInfo(psHciContext, 9975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 9985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 9995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef HOST_EMULATION 10015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_CETypeAGate: 10025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_A_Update_PipeInfo(psHciContext, 10045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 10055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 10065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_CARD_B_CREATE; 10085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 10105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_CETypeBGate: 10125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_CE_B_Update_PipeInfo(psHciContext, 10145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, pPipeInfo); 10155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_SUCCESS == status) 10165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *pPipeSeq = PIPE_DELETE_ALL; 10185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 10205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 10225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case phHciNfc_UnknownGate: 10235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 10245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_HCI_GATE_NOT_SUPPORTED ); 10265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 10275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /*End of the default Switch Case */ 10295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /*End of the Index Switch */ 10315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } /* End of Context and the Identity information validity check */ 10325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 10345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 10355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 10385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Opening the Pipe 10395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 10405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function opens the the pipe created between a terminal host's gate and 10415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * destination host's gate 10425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 10435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 10445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 10465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Open_Pipe( 10475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 10485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 10495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeHandle 10505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 10515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 10525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; 10535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 10545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS cmd_status = NFCSTATUS_SUCCESS; 10555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) 10575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || ( NULL == pHwRef ) 10585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || ( NULL == pPipeHandle ) 10595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 10605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 10625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 10645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Obtain the pipe_id from the pipe_handle */ 10665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id = pPipeHandle->pipe.pipe_id; 10675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if ( pipe_id <= PHHCINFC_MAX_PIPE) 10695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 10705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly cmd_status = phHciNfc_Send_Generic_Cmd( psHciContext,pHwRef, 10715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id, ANY_OPEN_PIPE); 10725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ( (cmd_status == NFCSTATUS_PENDING)? 10735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : cmd_status); 10745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 10765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 10775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 10785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*! 10815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Closing the Pipe 10825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 10835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function Closes the the pipe created between a terminal host's gate and 10845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * destination host's gate 10855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * 10865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */ 10875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 10895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Close_Pipe( 10905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 10915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 10925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeHandle 10935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 10945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 10955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; 10965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 10975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS cmd_status = NFCSTATUS_SUCCESS; 10985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 10995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) 11005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || ( NULL == pHwRef ) 11015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || ( NULL == pPipeHandle ) 11025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 11035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 11045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 11055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 11065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 11075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 11085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Obtain the pipe_id from the pipe_handle */ 11095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id = pPipeHandle->pipe.pipe_id; 11105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 11115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (uint8_t)HCI_UNKNOWN_PIPE_ID > pipe_id) 11125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 11135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly cmd_status = phHciNfc_Send_Generic_Cmd( 11145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext, pHwRef, pipe_id, 11155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ANY_CLOSE_PIPE ); 11165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 11175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = ((cmd_status == NFCSTATUS_PENDING)? 11185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_SUCCESS : cmd_status); 11195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 11205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 11215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 11225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1123