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_ISO15693.c * 225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* \brief HCI ISO-15693 management routines. * 235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* Project: NFC-FRI-1.1 * 265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Date: Thu Feb 11 18:54:47 2010 $ * 285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Author: ing04880 $ * 295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* $Revision: 1.7 $ * 30e1b8bffcf9ff1a5c290c03be5a1d85be0c103223aferir* $Aliases: $ 315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* * 325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly* =========================================================================== * 335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly***************************** Header File Inclusion **************************** 375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcCompId.h> 395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_Pipe.h> 405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_RFReader.h> 415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phOsalNfc.h> 425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if defined (TYPE_ISO15693) 445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHciNfc_ISO15693.h> 455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly****************************** Macro Definitions ******************************* 485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_INVENTORY_INDEX 0x01U 505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_AFI_INDEX 0x02U 515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_INVENTORY_LENGTH 0x0AU 535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_AFI_LENGTH 0x01U 545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_SINGLE_TAG_FOUND 0x00U 565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define ISO_15693_MULTIPLE_TAGS_FOUND 0x03U 575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Structure and Enumeration *************************** 605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Static Function Declaration ************************** 645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_InfoUpdate( 695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t index, 715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *reg_value, 725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t reg_length 735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_ISO15693_Response( 785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pResponse, 815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_ISO15693_Event( 915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pEvent, 945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ); 1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* 1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*************************** Function Definitions *************************** 1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/ 1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Init_Resources( 1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext 1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info=NULL; 1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == psHciContext ) 1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NULL != psHciContext->p_iso_15693_info) 1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = NFCSTATUS_SUCCESS; 1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(( NULL == psHciContext->p_iso_15693_info ) && 1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_Allocate_Resource((void **)(&ps_15693_info), 1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly sizeof(phHciNfc_ISO15693_Info_t))== NFCSTATUS_SUCCESS) 1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info = ps_15693_info; 1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->current_seq = ISO15693_INVENTORY; 1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_INVENTORY; 1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->ps_15693_pipe_info = NULL; 1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INSUFFICIENT_RESOURCES); 1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Get_PipeID( 1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *ppipe_id 1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL != psHciContext) 1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && ( NULL != ppipe_id ) 1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && ( NULL != psHciContext->p_iso_15693_info ) 1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info ; 1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *ppipe_id = ps_15693_info->ps_15693_pipe_info->pipe.pipe_id; 1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Update_PipeInfo( 1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipeID, 1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *pPipeInfo 1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if((NULL == psHciContext) || (NULL == pPipeInfo)) 1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_iso_15693_info) 1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info ; 1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Update the pipe_id of the ISO15693 Gate obtained from 1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly the HCI Response */ 1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->ps_15693_pipe_info = pPipeInfo; 1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->pipe_id = pipeID; 1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->ps_15693_pipe_info->pipe.pipe_id = pipeID; 1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Update the Response Receive routine of the ISO15693 Gate */ 1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pPipeInfo->recv_resp = &phHciNfc_Recv_ISO15693_Response; 1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Update the event Receive routine of the ISO15693 Gate */ 1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pPipeInfo->recv_event = &phHciNfc_Recv_ISO15693_Event; 1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Update_Info( 2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t infotype, 2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *iso_15693_info 2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NULL == psHciContext) 2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_iso_15693_info) 2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info; 2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(infotype) 2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case HCI_ISO_15693_ENABLE: 2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NULL != iso_15693_info) 2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->enable_iso_15693_gate = 2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *((uint8_t *)iso_15693_info); 2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case HCI_ISO_15693_INFO_SEQ: 2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->current_seq = ISO15693_INVENTORY; 2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_INVENTORY; 2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Info_Sequence ( 2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psHciHandle, 2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef 2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = ((phHciNfc_sContext_t *)psHciHandle); 2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) 2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (NULL == pHwRef) 2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if((NULL == psHciContext->p_iso_15693_info) || 2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (HCI_ISO_15693_ENABLE != 2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly enable_iso_15693_gate)) 2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info = NULL; 2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipeid = 0; 2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info; 2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_15693_info->ps_15693_pipe_info; 2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info ) 2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_SEQUENCE); 2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(ps_15693_info->current_seq) 2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ISO15693_INVENTORY: 2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = ISO_15693_INVENTORY_INDEX; 2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid = ps_pipe_info->pipe.pipe_id ; 2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Fill the data buffer and send the command to the 2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly device */ 3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = 3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef, 3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid, (uint8_t)ANY_GET_PARAMETER); 3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_PENDING == status ) 3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_AFI; 3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ISO15693_AFI: 3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = ISO_15693_AFI_INDEX; 3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid = ps_pipe_info->pipe.pipe_id ; 3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Fill the data buffer and send the command to the 3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly device */ 3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = 3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef, 3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid, (uint8_t)ANY_GET_PARAMETER); 3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NFCSTATUS_PENDING == status ) 3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_END_SEQUENCE; 3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ISO15693_END_SEQUENCE: 3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phNfc_sCompletionInfo_t CompInfo; 3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (ISO_15693_MULTIPLE_TAGS_FOUND == 3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->multiple_tgts_found) 3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly CompInfo.status = NFCSTATUS_MULTIPLE_TAGS; 3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly CompInfo.status = NFCSTATUS_SUCCESS; 3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly CompInfo.info = &(ps_15693_info->iso15693_info); 3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemDevType = 3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHal_eISO15693_PICC; 3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->current_seq = ISO15693_INVENTORY; 3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_INVENTORY; 3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = NFCSTATUS_SUCCESS; 3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Notify to the upper layer */ 3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Tag_Notify(psHciContext, pHwRef, 3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFC_NOTIFY_TARGET_DISCOVERED, 3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &CompInfo); 3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_RESPONSE); 3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_InfoUpdate( 3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t index, 3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *reg_value, 3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t reg_length 3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 3725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t i = 0; 3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (psHciContext->p_iso_15693_info); 3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(index) 3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ISO_15693_INVENTORY_INDEX: 3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (ISO_15693_INVENTORY_LENGTH == reg_length) 3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemoteDevInfo 3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly .Iso15693_Info.Flags = *(reg_value + i ); 3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly i++; 3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemoteDevInfo 3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly .Iso15693_Info.Dsfid = *(reg_value + i ); 3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly i++; 3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (void)memcpy(ps_15693_info->iso15693_info. 3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly RemoteDevInfo.Iso15693_Info.Uid, 3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (reg_value+i), (reg_length - i )); 3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemoteDevInfo 3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly .Iso15693_Info.UidLength = ( reg_length - i ); 3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("\tISO 15693 inventory", reg_value, reg_length); 3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_RESPONSE); 4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ISO_15693_AFI_INDEX: 4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (ISO_15693_AFI_LENGTH == reg_length) 4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemoteDevInfo 4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly .Iso15693_Info.Afi = *(reg_value + i ); 4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("\tISO 15693 AFI", reg_value, reg_length); 4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_RESPONSE); 4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_RESPONSE); 4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_ISO15693_Response( 4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pResponse, 4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 4415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 4425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 4435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 4445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 4455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = 4465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_sContext_t *)psContext ; 4475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pResponse) 4505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (0 == length)) 4515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 4535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if(NULL == psHciContext->p_iso_15693_info) 4555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 4575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 4615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info = NULL; 4625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t prev_cmd = ANY_GET_PARAMETER; 4635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 4655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info; 4665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 4675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_15693_info->ps_15693_pipe_info; 4685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == ps_pipe_info) 4695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 4715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_SEQUENCE); 4725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 4745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly prev_cmd = ps_pipe_info->prev_msg ; 4765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly switch(prev_cmd) 4775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_GET_PARAMETER: 4795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ISO15693_InfoUpdate(psHciContext, 4815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index, 4825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &pResponse[HCP_HEADER_LEN], 4835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t)(length - HCP_HEADER_LEN)); 4845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if 0 4855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext, 4865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly UPDATE_SEQ); 4875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if 0 */ 4885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_SET_PARAMETER: 4915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 4925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("ISO 15693 Parameter Set \n"); 4935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext, 4945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly UPDATE_SEQ); 4955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_INVENTORY; 4965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 4975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 4985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_OPEN_PIPE: 4995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("ISO 15693 open pipe complete\n"); 5015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext, 5025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly UPDATE_SEQ); 5035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->next_seq = ISO15693_INVENTORY; 5045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case ANY_CLOSE_PIPE: 5075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("ISO 15693 close pipe complete\n"); 5095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_ReaderMgmt_Update_Sequence(psHciContext, 5105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly UPDATE_SEQ); 5115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly case NXP_ISO15693_CMD: 5155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (length >= HCP_HEADER_LEN) 5175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT("ISO 15693 packet received \n"); 5195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Copy buffer to the receive buffer */ 5205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Append_HCPFrame(psHciContext->recv_buffer, 5215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 0, pResponse, length); 5225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->rx_total = length; 5235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->rx_index = HCP_HEADER_LEN; 5245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCI_PRINT_BUFFER("ISO 15693 Bytes received", 5255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pResponse, length); 5265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 5285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 5305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_RESPONSE); 5315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly default: 5355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE); 5375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly break; 5385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly }/* End of switch(prev_cmd) */ 5405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NFCSTATUS_SUCCESS == status ) 5425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->prev_status = NFCSTATUS_SUCCESS; 5445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->current_seq = ps_15693_info->next_seq; 5455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 5495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 5505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic 5525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 5535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Recv_ISO15693_Event( 5545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 5555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 5565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t *pEvent, 5575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef ONE_BYTE_LEN 5585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t length 5595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else 5605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length 5615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif 5625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 5645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 5655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = 5665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_sContext_t *)psContext ; 5675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) || (NULL == pEvent) 5685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (length == 0)) 5695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 5715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if((NULL == psHciContext->p_iso_15693_info) || 5735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (HCI_ISO_15693_ENABLE != 5745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 5755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly enable_iso_15693_gate)) 5765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 5785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 5795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 5805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 5815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Packet_t *p_packet = NULL; 5825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info=NULL; 5835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Message_t *message = NULL; 5845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t instruction=0, 5855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly i = 0; 5865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 5885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info; 5895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly p_packet = (phHciNfc_HCP_Packet_t *)pEvent; 5905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly message = &p_packet->msg.message; 5915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Get the instruction bits from the Message Header */ 5925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly instruction = (uint8_t) GET_BITS8( message->msg_header, 5935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN); 5945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 5955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if ((EVT_TARGET_DISCOVERED == instruction) 5965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly && ((ISO_15693_MULTIPLE_TAGS_FOUND == message->payload[i]) 5975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly || (ISO_15693_SINGLE_TAG_FOUND == message->payload[i])) 5985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 5995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phNfc_sCompletionInfo_t pCompInfo; 6015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 602e1b8bffcf9ff1a5c290c03be5a1d85be0c103223aferir/* #define NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT 0x00 */ 603e1b8bffcf9ff1a5c290c03be5a1d85be0c103223aferir#if (NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT >= 0x01) 604e1b8bffcf9ff1a5c290c03be5a1d85be0c103223aferir 6055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (ISO_15693_MULTIPLE_TAGS_FOUND == message->payload[i]) 6065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->multiple_tgts_found = ISO_15693_MULTIPLE_TAGS_FOUND; 6085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pCompInfo.status = NFCSTATUS_MULTIPLE_TAGS; 6095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 611e1b8bffcf9ff1a5c290c03be5a1d85be0c103223aferir#endif /* #if (NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT <= 0x01) */ 6125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->multiple_tgts_found = FALSE; 6145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pCompInfo.status = NFCSTATUS_SUCCESS; 6155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* CompInfo.info = &(ps_15693_info->iso15693_info); */ 6175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->host_rf_type = phHal_eISO15693_PCD; 6195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->iso15693_info.RemDevType = phHal_eISO15693_PICC; 6205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info->current_seq = ISO15693_INVENTORY; 6215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Notify to the HCI Generic layer To Update the FSM */ 6225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Notify_Event(psHciContext, pHwRef, 6235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFC_NOTIFY_TARGET_DISCOVERED, 6245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly &pCompInfo); 6255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 6285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_RESPONSE); 6305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 6335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 6345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 6365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_Send_ISO15693_Command( 6375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext, 6385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 6395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipe_id, 6405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t cmd 6415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 6425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 6435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 6445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef) ) 6465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 6485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if((NULL == psHciContext->p_iso_15693_info) || 6505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (HCI_ISO_15693_ENABLE != 6515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 6525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly enable_iso_15693_gate) || 6535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (HCI_UNKNOWN_PIPE_ID == 6545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 6555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id) || 6565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (pipe_id != 6575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 6585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipe_id)) 6595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 6615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 6635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info=NULL; 6655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info=NULL; 6665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Packet_t *hcp_packet = NULL; 6675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_HCP_Message_t *hcp_message = NULL; 6685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t i = 0; 6695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint16_t length = HCP_HEADER_LEN; 6705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 6725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info ; 6735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_15693_info->ps_15693_pipe_info; 6745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if(NULL == ps_pipe_info ) 6755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 6775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_SEQUENCE); 6785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 6795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 6805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->tx_total = 0 ; 6825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer; 6835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Construct the HCP Frame */ 6845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if (NXP_ISO15693_CMD == cmd) 6855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 6865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT, 6875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd); 6885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_message = &(hcp_packet->msg.message); 6895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 6905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if 0 6915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Command */ 6925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_message->payload[i++] = 6935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_xchg_info->params.tag_info.cmd_type ; 6945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Address */ 6955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly hcp_message->payload[i++] = 6965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_xchg_info->params.tag_info.addr ; 6975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if 0 */ 6985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload, 6995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly i, (uint8_t *)ps_pipe_info->param_info, 7005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_length); 7015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly length =(uint16_t)(length + i + ps_pipe_info->param_length); 7025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->sent_msg_type = (uint8_t)HCP_MSG_TYPE_COMMAND; 7045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->prev_msg = cmd; 7055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->tx_total = length; 7065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->response_pending = TRUE; 7075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly /* Send the Constructed HCP packet to the lower layer */ 7095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_HCP( psHciContext, pHwRef); 7105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->prev_status = status; 7115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 7155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 7165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS 7185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyphHciNfc_ISO15693_Set_AFI( 7195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *psContext, 7205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly void *pHwRef, 7215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t afi_value 7225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ) 7235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{ 7245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS status = NFCSTATUS_SUCCESS; 7255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_sContext_t *psHciContext = 7265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (phHciNfc_sContext_t *)psContext ; 7275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( (NULL == psHciContext) || (NULL == pHwRef)) 7295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 7315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else if((NULL == psHciContext->p_iso_15693_info) || 7335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly (HCI_ISO_15693_ENABLE != 7345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ((phHciNfc_ISO15693_Info_t *)(psHciContext->p_iso_15693_info))-> 7355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly enable_iso_15693_gate)) 7365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 7385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_ISO15693_Info_t *ps_15693_info = NULL; 7425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly phHciNfc_Pipe_Info_t *ps_pipe_info = NULL; 7435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly uint8_t pipeid = 0; 7445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_15693_info = (phHciNfc_ISO15693_Info_t *) 7465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly psHciContext->p_iso_15693_info ; 7475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info = ps_15693_info->ps_15693_pipe_info; 7485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly if( NULL == ps_pipe_info) 7505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = PHNFCSTVAL(CID_NFC_HCI, 7525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly NFCSTATUS_INVALID_HCI_SEQUENCE); 7535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly else 7555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly { 7565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->reg_index = ISO_15693_AFI_INDEX; 7575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_info = &afi_value; 7585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly ps_pipe_info->param_length = sizeof(afi_value); 7595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid = ps_pipe_info->pipe.pipe_id ; 7605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly status = phHciNfc_Send_Generic_Cmd( psHciContext, pHwRef, 7615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly pipeid, (uint8_t)ANY_SET_PARAMETER); 7625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly } 7645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly return status; 7655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} 7665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if defined (TYPE_ISO15693) */ 7685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 7695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly 770