nfc_api.h revision 5c65c3a0f42e174e47fecd4e569606003217ff4e
1/****************************************************************************** 2 * 3 * Copyright (C) 2009-2013 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 20/****************************************************************************** 21 * 22 * This file contains the Near Field Communication (NFC) API function 23 * external definitions. 24 * 25 ******************************************************************************/ 26 27#ifndef NFC_API_H 28#define NFC_API_H 29 30#include "nfc_target.h" 31#include "nci_defs.h" 32#include "nfc_hal_api.h" 33#include "gki.h" 34 35/* NFC application return status codes */ 36#define NFC_STATUS_OK NCI_STATUS_OK /* Command succeeded */ 37#define NFC_STATUS_REJECTED NCI_STATUS_REJECTED /* Command is rejected. */ 38#define NFC_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED /* Message is corrupted */ 39#define NFC_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL /* buffer full */ 40#define NFC_STATUS_FAILED NCI_STATUS_FAILED /* failed */ 41#define NFC_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED /* not initialized */ 42#define NFC_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR /* Syntax error */ 43#define NFC_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR /* Semantic error */ 44#define NFC_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID /* Unknown NCI Group ID */ 45#define NFC_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID /* Unknown NCI Opcode */ 46#define NFC_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM /* Invalid Parameter */ 47#define NFC_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG /* Message size too big */ 48#define NFC_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED /* Already started */ 49#define NFC_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED /* Activation Failed */ 50#define NFC_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN /* Tear Down Error */ 51#define NFC_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR /* RF transmission error*/ 52#define NFC_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR /* RF protocol error */ 53#define NFC_STATUS_TIMEOUT NCI_STATUS_TIMEOUT /* RF Timeout */ 54#define NFC_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL /* EE Intf activate err */ 55#define NFC_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR /* EE transmission error*/ 56#define NFC_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR /* EE protocol error */ 57#define NFC_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT /* EE Timeout */ 58 59/* 0xE0 ~0xFF are proprietary status codes */ 60#define NFC_STATUS_CMD_STARTED 0xE3/* Command started successfully */ 61#define NFC_STATUS_HW_TIMEOUT 0xE4/* NFCC Timeout in responding to an NCI command */ 62#define NFC_STATUS_CONTINUE 0xE5/* More (same) event to follow */ 63#define NFC_STATUS_REFUSED 0xE6/* API is called to perform illegal function */ 64#define NFC_STATUS_BAD_RESP 0xE7/* Wrong format of R-APDU, CC file or NDEF file */ 65#define NFC_STATUS_CMD_NOT_CMPLTD 0xE8/* 7816 Status Word is not command complete(0x9000) */ 66#define NFC_STATUS_NO_BUFFERS 0xE9/* Out of GKI buffers */ 67#define NFC_STATUS_WRONG_PROTOCOL 0xEA/* Protocol mismatch between API and activated one */ 68#define NFC_STATUS_BUSY 0xEB/* Another Tag command is already in progress */ 69 70#define NFC_STATUS_LINK_LOSS 0xFC /* Link Loss */ 71#define NFC_STATUS_BAD_LENGTH 0xFD /* data len exceeds MIU */ 72#define NFC_STATUS_BAD_HANDLE 0xFE /* invalid handle */ 73#define NFC_STATUS_CONGESTED 0xFF /* congested */ 74typedef UINT8 tNFC_STATUS; 75 76 77 78/********************************************** 79 * NFC Config Parameter IDs defined by NCI 80 **********************************************/ 81#define NFC_PMID_TOTAL_DURATION NCI_PARAM_ID_TOTAL_DURATION 82#define NFC_PMID_CON_DEVICES_LIMIT NCI_PARAM_ID_CON_DEVICES_LIMIT 83#define NFC_PMID_PA_BAILOUT NCI_PARAM_ID_PA_BAILOUT 84#define NFC_PMID_PB_AFI NCI_PARAM_ID_PB_AFI 85#define NFC_PMID_PB_BAILOUT NCI_PARAM_ID_PB_BAILOUT 86#define NFC_PMID_PB_ATTRIB_PARAM1 NCI_PARAM_ID_PB_ATTRIB_PARAM1 87#define NFC_PMID_PF_BIT_RATE NCI_PARAM_ID_PF_BIT_RATE 88#define NFC_PMID_PB_H_INFO NCI_PARAM_ID_PB_H_INFO 89#define NFC_PMID_BITR_NFC_DEP NCI_PARAM_ID_BITR_NFC_DEP 90#define NFC_PMID_ATR_REQ_GEN_BYTES NCI_PARAM_ID_ATR_REQ_GEN_BYTES 91#define NFC_PMID_ATR_REQ_CONFIG NCI_PARAM_ID_ATR_REQ_CONFIG 92#define NFC_PMID_LA_HIST_BY NCI_PARAM_ID_LA_HIST_BY 93#define NFC_PMID_LA_NFCID1 NCI_PARAM_ID_LA_NFCID1 94#define NFC_PMID_PI_BIT_RATE NCI_PARAM_ID_PI_BIT_RATE 95#define NFC_PMID_LA_BIT_FRAME_SDD NCI_PARAM_ID_LA_BIT_FRAME_SDD 96#define NFC_PMID_LA_PLATFORM_CONFIG NCI_PARAM_ID_LA_PLATFORM_CONFIG 97#define NFC_PMID_LA_SEL_INFO NCI_PARAM_ID_LA_SEL_INFO 98#define NFC_PMID_LI_BIT_RATE NCI_PARAM_ID_LI_BIT_RATE 99#define NFC_PMID_LB_SENSB_INFO NCI_PARAM_ID_LB_SENSB_INFO 100#define NFC_PMID_LB_PROTOCOL NCI_PARAM_ID_LB_PROTOCOL 101#define NFC_PMID_LB_H_INFO NCI_PARAM_ID_LB_H_INFO_RSP 102#define NFC_PMID_LB_NFCID0 NCI_PARAM_ID_LB_NFCID0 103#define NFC_PMID_LB_APPDATA NCI_PARAM_ID_LB_APPDATA 104#define NFC_PMID_LB_SFGI NCI_PARAM_ID_LB_SFGI 105#define NFC_PMID_LB_ADC_FO NCI_PARAM_ID_LB_ADC_FO 106#define NFC_PMID_LF_T3T_ID1 NCI_PARAM_ID_LF_T3T_ID1 107#define NFC_PMID_LF_T3T_ID2 NCI_PARAM_ID_LF_T3T_ID2 108#define NFC_PMID_LF_T3T_ID3 NCI_PARAM_ID_LF_T3T_ID3 109#define NFC_PMID_LF_T3T_ID4 NCI_PARAM_ID_LF_T3T_ID4 110#define NFC_PMID_LF_T3T_ID5 NCI_PARAM_ID_LF_T3T_ID5 111#define NFC_PMID_LF_T3T_ID6 NCI_PARAM_ID_LF_T3T_ID6 112#define NFC_PMID_LF_T3T_ID7 NCI_PARAM_ID_LF_T3T_ID7 113#define NFC_PMID_LF_T3T_ID8 NCI_PARAM_ID_LF_T3T_ID8 114#define NFC_PMID_LF_T3T_ID9 NCI_PARAM_ID_LF_T3T_ID9 115#define NFC_PMID_LF_T3T_ID10 NCI_PARAM_ID_LF_T3T_ID10 116#define NFC_PMID_LF_T3T_ID11 NCI_PARAM_ID_LF_T3T_ID11 117#define NFC_PMID_LF_T3T_ID12 NCI_PARAM_ID_LF_T3T_ID12 118#define NFC_PMID_LF_T3T_ID13 NCI_PARAM_ID_LF_T3T_ID13 119#define NFC_PMID_LF_T3T_ID14 NCI_PARAM_ID_LF_T3T_ID14 120#define NFC_PMID_LF_T3T_ID15 NCI_PARAM_ID_LF_T3T_ID15 121#define NFC_PMID_LF_T3T_ID16 NCI_PARAM_ID_LF_T3T_ID16 122#define NFC_PMID_LF_PROTOCOL NCI_PARAM_ID_LF_PROTOCOL 123#define NFC_PMID_LF_T3T_PMM NCI_PARAM_ID_LF_T3T_PMM 124#define NFC_PMID_LF_T3T_MAX NCI_PARAM_ID_LF_T3T_MAX 125#define NFC_PMID_LF_T3T_FLAGS2 NCI_PARAM_ID_LF_T3T_FLAGS2 126#define NFC_PMID_FWI NCI_PARAM_ID_FWI 127#define NFC_PMID_LF_CON_BITR_F NCI_PARAM_ID_LF_CON_BITR_F 128#define NFC_PMID_WT NCI_PARAM_ID_WT 129#define NFC_PMID_ATR_RES_GEN_BYTES NCI_PARAM_ID_ATR_RES_GEN_BYTES 130#define NFC_PMID_ATR_RSP_CONFIG NCI_PARAM_ID_ATR_RSP_CONFIG 131#define NFC_PMID_RF_FIELD_INFO NCI_PARAM_ID_RF_FIELD_INFO 132#define NFC_PMID_NFC_DEP_OP NCI_PARAM_ID_NFC_DEP_OP 133#define NFC_PARAM_ID_RF_EE_ACTION NCI_PARAM_ID_RF_EE_ACTION 134#define NFC_PARAM_ID_ISO_DEP_OP NCI_PARAM_ID_ISO_DEP_OP 135 136#define NFC_ROUTE_TAG_TECH NCI_ROUTE_TAG_TECH /* Technology based routing */ 137#define NFC_ROUTE_TAG_PROTO NCI_ROUTE_TAG_PROTO /* Protocol based routing */ 138#define NFC_ROUTE_TAG_AID NCI_ROUTE_TAG_AID /* AID routing */ 139#define NFC_ROUTE_TLV_ENTRY_SIZE 4 /* tag, len, 2 byte value for technology/protocol based routing */ 140 141/* For routing */ 142#define NFC_DH_ID NCI_DH_ID /* for DH */ 143/* To identify the loopback test */ 144#define NFC_TEST_ID NCI_TEST_ID /* use a proprietary range */ 145 146typedef UINT8 tNFC_PMID; 147#define NFC_TL_SIZE 2 148#define NFC_SAVED_CMD_SIZE 2 149 150typedef tNCI_DISCOVER_MAPS tNFC_DISCOVER_MAPS; 151typedef tNCI_DISCOVER_PARAMS tNFC_DISCOVER_PARAMS; 152 153/* all NFC Manager Callback functions have prototype like void (cback) (UINT8 event, void *p_data) 154 * tNFC_DATA_CBACK uses connection id as the first parameter; range 0x00-0x0F. 155 * tNFC_DISCOVER_CBACK uses tNFC_DISCOVER_EVT; range 0x4000 ~ 156 * tNFC_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range 0x5000 ~ 157 */ 158 159#define NFC_FIRST_DEVT 0x4000 160#define NFC_FIRST_REVT 0x5000 161#define NFC_FIRST_CEVT 0x6000 162#define NFC_FIRST_TEVT 0x8000 163 164/* the events reported on tNFC_RESPONSE_CBACK */ 165enum 166{ 167 NFC_ENABLE_REVT = NFC_FIRST_REVT, /* 0 Enable event */ 168 NFC_DISABLE_REVT, /* 1 Disable event */ 169 NFC_SET_CONFIG_REVT, /* 2 Set Config Response */ 170 NFC_GET_CONFIG_REVT, /* 3 Get Config Response */ 171 NFC_NFCEE_DISCOVER_REVT, /* 4 Discover NFCEE response */ 172 NFC_NFCEE_INFO_REVT, /* 5 Discover NFCEE Notification */ 173 NFC_NFCEE_MODE_SET_REVT, /* 6 NFCEE Mode Set response */ 174 NFC_RF_FIELD_REVT, /* 7 RF Field information */ 175 NFC_EE_ACTION_REVT, /* 8 EE Action notification */ 176 NFC_EE_DISCOVER_REQ_REVT, /* 9 EE Discover Req notification */ 177 NFC_SET_ROUTING_REVT, /* 10 Configure Routing response */ 178 NFC_GET_ROUTING_REVT, /* 11 Retrieve Routing response */ 179 NFC_RF_COMM_PARAMS_UPDATE_REVT, /* 12 RF Communication Param Update */ 180 NFC_GEN_ERROR_REVT, /* 13 generic error notification */ 181 NFC_NFCC_RESTART_REVT, /* 14 NFCC has been re-initialized */ 182 NFC_NFCC_TIMEOUT_REVT, /* 15 NFCC is not responding */ 183 NFC_NFCC_TRANSPORT_ERR_REVT, /* 16 NCI Tranport error */ 184 NFC_NFCC_POWER_OFF_REVT, /* 17 NFCC turned off */ 185 186 NFC_FIRST_VS_REVT /* First vendor-specific rsp event */ 187}; 188typedef UINT16 tNFC_RESPONSE_EVT; 189 190enum 191{ 192 NFC_CONN_CREATE_CEVT = NFC_FIRST_CEVT, /* 0 Conn Create Response */ 193 NFC_CONN_CLOSE_CEVT, /* 1 Conn Close Response */ 194 NFC_DEACTIVATE_CEVT, /* 2 Deactivate response/notificatn*/ 195 NFC_DATA_CEVT, /* 3 Data */ 196 NFC_ERROR_CEVT /* 4 generic or interface error */ 197}; 198typedef UINT16 tNFC_CONN_EVT; 199 200#define NFC_NFCC_INFO_LEN 4 201#ifndef NFC_NFCC_MAX_NUM_VS_INTERFACE 202#define NFC_NFCC_MAX_NUM_VS_INTERFACE 4 203#endif 204typedef struct 205{ 206 tNFC_STATUS status; /* The event status. */ 207 UINT8 nci_version; /* the NCI version of NFCC */ 208 UINT8 max_conn; /* max number of connections by NFCC*/ 209 UINT32 nci_features; /* the NCI features of NFCC */ 210 UINT16 nci_interfaces; /* the NCI interfaces of NFCC */ 211 UINT16 max_ce_table; /* the max routing table size */ 212 UINT16 max_param_size; /* Max Size for Large Parameters */ 213 UINT8 manufacture_id; /* the Manufacture ID for NFCC */ 214 UINT8 nfcc_info[NFC_NFCC_INFO_LEN];/* the Manufacture Info for NFCC */ 215 UINT8 vs_interface[NFC_NFCC_MAX_NUM_VS_INTERFACE]; /* the NCI VS interfaces of NFCC */ 216} tNFC_ENABLE_REVT; 217 218#define NFC_MAX_NUM_IDS 125 219/* the data type associated with NFC_SET_CONFIG_REVT */ 220typedef struct 221{ 222 tNFC_STATUS status; /* The event status. */ 223 UINT8 num_param_id; /* Number of rejected NCI Param ID */ 224 UINT8 param_ids[NFC_MAX_NUM_IDS];/* NCI Param ID */ 225} tNFC_SET_CONFIG_REVT; 226 227/* the data type associated with NFC_GET_CONFIG_REVT */ 228typedef struct 229{ 230 tNFC_STATUS status; /* The event status. */ 231 UINT16 tlv_size; /* The length of TLV */ 232 UINT8 *p_param_tlvs; /* TLV */ 233} tNFC_GET_CONFIG_REVT; 234 235/* the data type associated with NFC_NFCEE_DISCOVER_REVT */ 236typedef struct 237{ 238 tNFC_STATUS status; /* The event status. */ 239 UINT8 num_nfcee; /* The number of NFCEE */ 240} tNFC_NFCEE_DISCOVER_REVT; 241 242#define NFC_NFCEE_INTERFACE_APDU NCI_NFCEE_INTERFACE_APDU 243#define NFC_NFCEE_INTERFACE_HCI_ACCESS NCI_NFCEE_INTERFACE_HCI_ACCESS 244#define NFC_NFCEE_INTERFACE_T3T NCI_NFCEE_INTERFACE_T3T 245#define NFC_NFCEE_INTERFACE_TRANSPARENT NCI_NFCEE_INTERFACE_TRANSPARENT 246#define NFC_NFCEE_INTERFACE_PROPRIETARY NCI_NFCEE_INTERFACE_PROPRIETARY 247typedef UINT8 tNFC_NFCEE_INTERFACE; 248 249#define NFC_NFCEE_TAG_HW_ID NCI_NFCEE_TAG_HW_ID 250#define NFC_NFCEE_TAG_ATR_BYTES NCI_NFCEE_TAG_ATR_BYTES 251#define NFC_NFCEE_TAG_T3T_INFO NCI_NFCEE_TAG_T3T_INFO 252#define NFC_NFCEE_TAG_HCI_HOST_ID NCI_NFCEE_TAG_HCI_HOST_ID 253typedef UINT8 tNFC_NFCEE_TAG; 254/* additional NFCEE Info */ 255typedef struct 256{ 257 tNFC_NFCEE_TAG tag; 258 UINT8 len; 259 UINT8 info[NFC_MAX_EE_INFO]; 260} tNFC_NFCEE_TLV; 261 262#define NFC_NFCEE_STATUS_INACTIVE NCI_NFCEE_STS_CONN_INACTIVE/* NFCEE connected and inactive */ 263#define NFC_NFCEE_STATUS_ACTIVE NCI_NFCEE_STS_CONN_ACTIVE /* NFCEE connected and active */ 264#define NFC_NFCEE_STATUS_REMOVED NCI_NFCEE_STS_REMOVED /* NFCEE removed */ 265/* the data type associated with NFC_NFCEE_INFO_REVT */ 266typedef struct 267{ 268 tNFC_STATUS status; /* The event status - place holder */ 269 UINT8 nfcee_id; /* NFCEE ID */ 270 UINT8 ee_status; /* The NFCEE status. */ 271 UINT8 num_interface; /* number of NFCEE interfaces */ 272 UINT8 ee_interface[NFC_MAX_EE_INTERFACE];/* NFCEE interface */ 273 UINT8 num_tlvs; /* number of TLVs */ 274 tNFC_NFCEE_TLV ee_tlv[NFC_MAX_EE_TLVS];/* The TLVs associated with NFCEE */ 275} tNFC_NFCEE_INFO_REVT; 276 277#define NFC_MODE_ACTIVATE NCI_NFCEE_MD_ACTIVATE 278#define NFC_MODE_DEACTIVATE NCI_NFCEE_MD_DEACTIVATE 279typedef UINT8 tNFC_NFCEE_MODE; 280/* the data type associated with NFC_NFCEE_MODE_SET_REVT */ 281typedef struct 282{ 283 tNFC_STATUS status; /* The event status.*/ 284 UINT8 nfcee_id; /* NFCEE ID */ 285 tNFC_NFCEE_MODE mode; /* NFCEE mode */ 286} tNFC_NFCEE_MODE_SET_REVT; 287 288#define NFC_MAX_AID_LEN NCI_MAX_AID_LEN /* 16 */ 289 290/* the data type associated with NFC_CE_GET_ROUTING_REVT */ 291typedef struct 292{ 293 tNFC_STATUS status; /* The event status */ 294 UINT8 nfcee_id; /* NFCEE ID */ 295 UINT8 num_tlvs; /* number of TLVs */ 296 UINT8 tlv_size; /* the total len of all TLVs */ 297 UINT8 param_tlvs[NFC_MAX_EE_TLV_SIZE];/* the TLVs */ 298} tNFC_GET_ROUTING_REVT; 299 300 301/* the data type associated with NFC_CONN_CREATE_CEVT */ 302typedef struct 303{ 304 tNFC_STATUS status; /* The event status */ 305 UINT8 dest_type; /* the destination type */ 306 UINT8 id; /* NFCEE ID or RF Discovery ID */ 307 UINT8 buff_size; /* The max buffer size */ 308 UINT8 num_buffs; /* The number of buffers */ 309} tNFC_CONN_CREATE_CEVT; 310 311/* the data type associated with NFC_CONN_CLOSE_CEVT */ 312typedef struct 313{ 314 tNFC_STATUS status; /* The event status */ 315} tNFC_CONN_CLOSE_CEVT; 316 317/* the data type associated with NFC_DATA_CEVT */ 318typedef struct 319{ 320 tNFC_STATUS status; /* The event status */ 321 BT_HDR *p_data; /* The received Data */ 322} tNFC_DATA_CEVT; 323 324/* RF Field Status */ 325#define NFC_RF_STS_NO_REMOTE NCI_RF_STS_NO_REMOTE /* No field generated by remote device */ 326#define NFC_RF_STS_REMOTE NCI_RF_STS_REMOTE /* field generated by remote device */ 327typedef UINT8 tNFC_RF_STS; 328 329/* RF Field Technologies */ 330#define NFC_RF_TECHNOLOGY_A NCI_RF_TECHNOLOGY_A 331#define NFC_RF_TECHNOLOGY_B NCI_RF_TECHNOLOGY_B 332#define NFC_RF_TECHNOLOGY_F NCI_RF_TECHNOLOGY_F 333#define NFC_RF_TECHNOLOGY_15693 NCI_RF_TECHNOLOGY_15693 334typedef UINT8 tNFC_RF_TECH; 335 336 337/* Supported Protocols */ 338#define NFC_PROTOCOL_UNKNOWN NCI_PROTOCOL_UNKNOWN /* Unknown */ 339#define NFC_PROTOCOL_T1T NCI_PROTOCOL_T1T /* Type1Tag - NFC-A */ 340#define NFC_PROTOCOL_T2T NCI_PROTOCOL_T2T /* Type2Tag - NFC-A */ 341#define NFC_PROTOCOL_T3T NCI_PROTOCOL_T3T /* Type3Tag - NFC-F */ 342#define NFC_PROTOCOL_ISO_DEP NCI_PROTOCOL_ISO_DEP /* Type 4A,4B - NFC-A or NFC-B */ 343#define NFC_PROTOCOL_NFC_DEP NCI_PROTOCOL_NFC_DEP /* NFCDEP/LLCP - NFC-A or NFC-F */ 344#define NFC_PROTOCOL_B_PRIME NCI_PROTOCOL_B_PRIME 345#define NFC_PROTOCOL_15693 NCI_PROTOCOL_15693 346#define NFC_PROTOCOL_KOVIO NCI_PROTOCOL_KOVIO 347typedef UINT8 tNFC_PROTOCOL; 348 349/* Discovery Types/Detected Technology and Mode */ 350#define NFC_DISCOVERY_TYPE_POLL_A NCI_DISCOVERY_TYPE_POLL_A 351#define NFC_DISCOVERY_TYPE_POLL_B NCI_DISCOVERY_TYPE_POLL_B 352#define NFC_DISCOVERY_TYPE_POLL_F NCI_DISCOVERY_TYPE_POLL_F 353#define NFC_DISCOVERY_TYPE_POLL_A_ACTIVE NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 354#define NFC_DISCOVERY_TYPE_POLL_F_ACTIVE NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 355#define NFC_DISCOVERY_TYPE_POLL_ISO15693 NCI_DISCOVERY_TYPE_POLL_ISO15693 356#define NFC_DISCOVERY_TYPE_POLL_B_PRIME NCI_DISCOVERY_TYPE_POLL_B_PRIME 357#define NFC_DISCOVERY_TYPE_POLL_KOVIO NCI_DISCOVERY_TYPE_POLL_KOVIO 358#define NFC_DISCOVERY_TYPE_LISTEN_A NCI_DISCOVERY_TYPE_LISTEN_A 359#define NFC_DISCOVERY_TYPE_LISTEN_B NCI_DISCOVERY_TYPE_LISTEN_B 360#define NFC_DISCOVERY_TYPE_LISTEN_F NCI_DISCOVERY_TYPE_LISTEN_F 361#define NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 362#define NFC_DISCOVERY_TYPE_LISTEN_F_ACTIVE NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 363#define NFC_DISCOVERY_TYPE_LISTEN_ISO15693 NCI_DISCOVERY_TYPE_LISTEN_ISO15693 364#define NFC_DISCOVERY_TYPE_LISTEN_B_PRIME NCI_DISCOVERY_TYPE_LISTEN_B_PRIME 365typedef UINT8 tNFC_DISCOVERY_TYPE; 366typedef UINT8 tNFC_RF_TECH_N_MODE; 367 368/* Select Response codes */ 369#define NFC_SEL_RES_NFC_FORUM_T2T 0x00 370#define NFC_SEL_RES_MF_CLASSIC 0x08 371 372/* Bit Rates */ 373#define NFC_BIT_RATE_106 NCI_BIT_RATE_106 /* 106 kbit/s */ 374#define NFC_BIT_RATE_212 NCI_BIT_RATE_212 /* 212 kbit/s */ 375#define NFC_BIT_RATE_424 NCI_BIT_RATE_424 /* 424 kbit/s */ 376#define NFC_BIT_RATE_848 NCI_BIT_RATE_848 /* 848 Kbit/s */ 377#define NFC_BIT_RATE_1696 NCI_BIT_RATE_1696 /* 1696 Kbit/s*/ 378#define NFC_BIT_RATE_3392 NCI_BIT_RATE_3392 /* 3392 Kbit/s*/ 379#define NFC_BIT_RATE_6784 NCI_BIT_RATE_6784 /* 6784 Kbit/s*/ 380typedef UINT8 tNFC_BIT_RATE; 381 382/********************************************** 383 * Interface Types 384 **********************************************/ 385#define NFC_INTERFACE_EE_DIRECT_RF NCI_INTERFACE_EE_DIRECT_RF 386#define NFC_INTERFACE_FRAME NCI_INTERFACE_FRAME 387#define NFC_INTERFACE_ISO_DEP NCI_INTERFACE_ISO_DEP 388#define NFC_INTERFACE_NDEF NCI_INTERFACE_NDEF 389#define NFC_INTERFACE_NFC_DEP NCI_INTERFACE_NFC_DEP 390#define NFC_INTERFACE_LLCP_LOW NCI_INTERFACE_LLCP_LOW 391#define NFC_INTERFACE_LLCP_HIGH NCI_INTERFACE_LLCP_HIGH 392#define NFC_INTERFACE_VS_T2T_CE NCI_INTERFACE_VS_T2T_CE 393typedef tNCI_INTF_TYPE tNFC_INTF_TYPE; 394 395/********************************************** 396 * Deactivation Type 397 **********************************************/ 398#define NFC_DEACTIVATE_TYPE_IDLE NCI_DEACTIVATE_TYPE_IDLE 399#define NFC_DEACTIVATE_TYPE_SLEEP NCI_DEACTIVATE_TYPE_SLEEP 400#define NFC_DEACTIVATE_TYPE_SLEEP_AF NCI_DEACTIVATE_TYPE_SLEEP_AF 401#define NFC_DEACTIVATE_TYPE_DISCOVERY NCI_DEACTIVATE_TYPE_DISCOVERY 402typedef UINT8 tNFC_DEACT_TYPE; 403 404/********************************************** 405 * Deactivation Reasons 406 **********************************************/ 407#define NFC_DEACTIVATE_REASON_DH_REQ NCI_DEACTIVATE_REASON_DH_REQ 408#define NFC_DEACTIVATE_REASON_ENDPOINT_REQ NCI_DEACTIVATE_REASON_ENDPOINT_REQ 409#define NFC_DEACTIVATE_REASON_RF_LINK_LOSS NCI_DEACTIVATE_REASON_RF_LINK_LOSS 410#define NFC_DEACTIVATE_REASON_NFCB_BAD_AFI NCI_DEACTIVATE_REASON_NFCB_BAD_AFI 411typedef UINT8 tNFC_DEACT_REASON; 412 413/* the data type associated with NFC_RF_FIELD_REVT */ 414typedef struct 415{ 416 tNFC_STATUS status; /* The event status - place holder. */ 417 tNFC_RF_STS rf_field; /* RF Field Status */ 418} tNFC_RF_FIELD_REVT; 419 420#define NFC_MAX_APP_DATA_LEN 40 421typedef struct 422{ 423 UINT8 len_aid; /* length of application id */ 424 UINT8 aid[NFC_MAX_AID_LEN]; /* application id */ 425} tNFC_AID; 426typedef struct 427{ 428 UINT8 len_aid; /* length of application id */ 429 UINT8 aid[NFC_MAX_AID_LEN]; /* application id */ 430 UINT8 len_data; /* len of application data */ 431 UINT8 data[NFC_MAX_APP_DATA_LEN]; /* application data */ 432} tNFC_APP_INIT; 433 434#define NFC_EE_TRIG_SELECT NCI_EE_TRIG_7816_SELECT /* ISO 7816-4 SELECT command */ 435#define NFC_EE_TRIG_RF_PROTOCOL NCI_EE_TRIG_RF_PROTOCOL /* RF Protocol changed */ 436#define NFC_EE_TRIG_RF_TECHNOLOGY NCI_EE_TRIG_RF_TECHNOLOGY/* RF Technology changed */ 437#define NFC_EE_TRIG_APP_INIT NCI_EE_TRIG_APP_INIT /* Application initiation */ 438typedef UINT8 tNFC_EE_TRIGGER; 439typedef struct 440{ 441 tNFC_EE_TRIGGER trigger; /* the trigger of this event */ 442 union 443 { 444 tNFC_PROTOCOL protocol; 445 tNFC_RF_TECH technology; 446 tNFC_AID aid; 447 tNFC_APP_INIT app_init; 448 } param; /* Discovery Type specific parameters */ 449} tNFC_ACTION_DATA; 450 451/* the data type associated with NFC_EE_ACTION_REVT */ 452typedef struct 453{ 454 tNFC_STATUS status; /* The event status - place holder */ 455 UINT8 nfcee_id; /* NFCEE ID */ 456 tNFC_ACTION_DATA act_data; /* data associated /w the action */ 457} tNFC_EE_ACTION_REVT; 458 459#define NFC_EE_DISC_OP_ADD 0 460#define NFC_EE_DISC_OP_REMOVE 1 461typedef UINT8 tNFC_EE_DISC_OP; 462typedef struct 463{ 464 tNFC_EE_DISC_OP op; /* add or remove this entry */ 465 UINT8 nfcee_id; /* NFCEE ID */ 466 tNFC_RF_TECH_N_MODE tech_n_mode; /* Discovery Technology and Mode */ 467 tNFC_PROTOCOL protocol; /* NFC protocol */ 468} tNFC_EE_DISCOVER_INFO; 469 470#ifndef NFC_MAX_EE_DISC_ENTRIES 471#define NFC_MAX_EE_DISC_ENTRIES 6 472#endif 473#define NFC_EE_DISCOVER_ENTRY_LEN 5 /* T, L, V(NFCEE ID, TechnMode, Protocol) */ 474#define NFC_EE_DISCOVER_INFO_LEN 3 /* NFCEE ID, TechnMode, Protocol */ 475/* the data type associated with NFC_EE_DISCOVER_REQ_REVT */ 476typedef struct 477{ 478 tNFC_STATUS status; /* The event status - place holder */ 479 UINT8 num_info; /* number of entries in info[] */ 480 tNFC_EE_DISCOVER_INFO info[NFC_MAX_EE_DISC_ENTRIES]; /* discovery request from NFCEE */ 481} tNFC_EE_DISCOVER_REQ_REVT; 482 483typedef union 484{ 485 tNFC_STATUS status; /* The event status. */ 486 tNFC_ENABLE_REVT enable; 487 tNFC_SET_CONFIG_REVT set_config; 488 tNFC_GET_CONFIG_REVT get_config; 489 tNFC_NFCEE_DISCOVER_REVT nfcee_discover; 490 tNFC_NFCEE_INFO_REVT nfcee_info; 491 tNFC_NFCEE_MODE_SET_REVT mode_set; 492 tNFC_RF_FIELD_REVT rf_field; 493 tNFC_STATUS cfg_routing; 494 tNFC_GET_ROUTING_REVT get_routing; 495 tNFC_EE_ACTION_REVT ee_action; 496 tNFC_EE_DISCOVER_REQ_REVT ee_discover_req; 497 void *p_vs_evt_data; 498} tNFC_RESPONSE; 499 500/************************************* 501** RESPONSE Callback Functions 502**************************************/ 503typedef void (tNFC_RESPONSE_CBACK) (tNFC_RESPONSE_EVT event, tNFC_RESPONSE *p_data); 504 505/* The events reported on tNFC_VS_CBACK */ 506/* The event is (NCI_RSP_BIT|oid) for response and (NCI_NTF_BIT|oid) for notification*/ 507 508typedef UINT8 tNFC_VS_EVT; 509 510/************************************* 511** Proprietary (Vendor Specific) Callback Functions 512**************************************/ 513typedef void (tNFC_VS_CBACK) (tNFC_VS_EVT event, UINT16 data_len, UINT8 *p_data); 514 515/* the events reported on tNFC_DISCOVER_CBACK */ 516enum 517{ 518 NFC_START_DEVT = NFC_FIRST_DEVT, /* Status of NFC_DiscoveryStart */ 519 NFC_MAP_DEVT, /* Status of NFC_DiscoveryMap */ 520 NFC_RESULT_DEVT, /* The responses from remote device */ 521 NFC_SELECT_DEVT, /* Status of NFC_DiscoverySelect */ 522 NFC_ACTIVATE_DEVT, /* RF interface is activated */ 523 NFC_DEACTIVATE_DEVT /* Status of RF deactivation */ 524}; 525typedef UINT16 tNFC_DISCOVER_EVT; 526 527/* the data type associated with NFC_START_DEVT */ 528typedef tNFC_STATUS tNFC_START_DEVT; 529 530typedef tNCI_RF_PA_PARAMS tNFC_RF_PA_PARAMS; 531#define NFC_MAX_SENSB_RES_LEN NCI_MAX_SENSB_RES_LEN 532#define NFC_NFCID0_MAX_LEN 4 533typedef struct 534{ 535 UINT8 sensb_res_len;/* Length of SENSB_RES Response (Byte 2 - Byte 12 or 13) Available after Technology Detection */ 536 UINT8 sensb_res[NFC_MAX_SENSB_RES_LEN]; /* SENSB_RES Response (ATQ) */ 537 UINT8 nfcid0[NFC_NFCID0_MAX_LEN]; 538} tNFC_RF_PB_PARAMS; 539 540#define NFC_MAX_SENSF_RES_LEN NCI_MAX_SENSF_RES_LEN 541#define NFC_NFCID2_LEN NCI_NFCID2_LEN 542typedef struct 543{ 544 UINT8 bit_rate;/* NFC_BIT_RATE_212 or NFC_BIT_RATE_424 */ 545 UINT8 sensf_res_len;/* Length of SENSF_RES Response (Byte 2 - Byte 17 or 19) Available after Technology Detection */ 546 UINT8 sensf_res[NFC_MAX_SENSF_RES_LEN]; /* SENSB_RES Response */ 547 UINT8 nfcid2[NFC_NFCID2_LEN]; /* NFCID2 generated by the Local NFCC for NFC-DEP Protocol.Available for Frame Interface */ 548 UINT8 mrti_check; 549 UINT8 mrti_update; 550} tNFC_RF_PF_PARAMS; 551 552typedef tNCI_RF_LF_PARAMS tNFC_RF_LF_PARAMS; 553 554#define NFC_ISO15693_UID_LEN 8 555typedef struct 556{ 557 UINT8 flag; 558 UINT8 dsfid; 559 UINT8 uid[NFC_ISO15693_UID_LEN]; 560} tNFC_RF_PISO15693_PARAMS; 561 562#ifndef NFC_KOVIO_MAX_LEN 563#define NFC_KOVIO_MAX_LEN 32 564#endif 565typedef struct 566{ 567 UINT8 uid_len; 568 UINT8 uid[NFC_KOVIO_MAX_LEN]; 569} tNFC_RF_PKOVIO_PARAMS; 570 571typedef union 572{ 573 tNFC_RF_PA_PARAMS pa; 574 tNFC_RF_PB_PARAMS pb; 575 tNFC_RF_PF_PARAMS pf; 576 tNFC_RF_LF_PARAMS lf; 577 tNFC_RF_PISO15693_PARAMS pi93; 578 tNFC_RF_PKOVIO_PARAMS pk; 579} tNFC_RF_TECH_PARAMU; 580 581typedef struct 582{ 583 tNFC_DISCOVERY_TYPE mode; 584 tNFC_RF_TECH_PARAMU param; 585} tNFC_RF_TECH_PARAMS; 586 587/* the data type associated with NFC_RESULT_DEVT */ 588typedef struct 589{ 590 tNFC_STATUS status; /* The event status - place holder. */ 591 UINT8 rf_disc_id; /* RF Discovery ID */ 592 UINT8 protocol; /* supported protocol */ 593 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */ 594 BOOLEAN more; /* 0: last notification */ 595} tNFC_RESULT_DEVT; 596 597/* the data type associated with NFC_SELECT_DEVT */ 598typedef tNFC_STATUS tNFC_SELECT_DEVT; 599 600/* the data type associated with NFC_STOP_DEVT */ 601typedef tNFC_STATUS tNFC_STOP_DEVT; 602 603#define NFC_MAX_ATS_LEN NCI_MAX_ATS_LEN 604#define NFC_MAX_HIS_BYTES_LEN NCI_MAX_HIS_BYTES_LEN 605#define NFC_MAX_GEN_BYTES_LEN NCI_MAX_GEN_BYTES_LEN 606 607 608typedef struct 609{ 610 UINT8 ats_res_len; /* Length of ATS RES */ 611 UINT8 ats_res[NFC_MAX_ATS_LEN]; /* ATS RES */ 612 BOOLEAN nad_used; /* NAD is used or not */ 613 UINT8 fwi; /* Frame Waiting time Integer */ 614 UINT8 sfgi; /* Start-up Frame Guard time Integer*/ 615 UINT8 his_byte_len; /* len of historical bytes */ 616 UINT8 his_byte[NFC_MAX_HIS_BYTES_LEN];/* historical bytes */ 617} tNFC_INTF_PA_ISO_DEP; 618 619typedef struct 620{ 621 UINT8 rats; /* RATS */ 622} tNFC_INTF_LA_ISO_DEP; 623 624 625typedef struct 626{ 627 UINT8 atr_res_len; /* Length of ATR_RES */ 628 UINT8 atr_res[NFC_MAX_ATS_LEN]; /* ATR_RES (Byte 3 - Byte 17+n) */ 629 UINT8 max_payload_size; /* 64, 128, 192 or 254 */ 630 UINT8 gen_bytes_len; /* len of general bytes */ 631 UINT8 gen_bytes[NFC_MAX_GEN_BYTES_LEN];/* general bytes */ 632 UINT8 waiting_time; /* WT -> Response Waiting Time RWT = (256 x 16/fC) x 2WT */ 633} tNFC_INTF_PA_NFC_DEP; 634 635/* Note: keep tNFC_INTF_PA_NFC_DEP data member in the same order as tNFC_INTF_LA_NFC_DEP */ 636typedef struct 637{ 638 UINT8 atr_req_len; /* Length of ATR_REQ */ 639 UINT8 atr_req[NFC_MAX_ATS_LEN]; /* ATR_REQ (Byte 3 - Byte 18+n) */ 640 UINT8 max_payload_size; /* 64, 128, 192 or 254 */ 641 UINT8 gen_bytes_len; /* len of general bytes */ 642 UINT8 gen_bytes[NFC_MAX_GEN_BYTES_LEN];/* general bytes */ 643} tNFC_INTF_LA_NFC_DEP; 644typedef tNFC_INTF_LA_NFC_DEP tNFC_INTF_LF_NFC_DEP; 645typedef tNFC_INTF_PA_NFC_DEP tNFC_INTF_PF_NFC_DEP; 646 647#define NFC_MAX_ATTRIB_LEN NCI_MAX_ATTRIB_LEN 648 649typedef struct 650{ 651 UINT8 attrib_res_len; /* Length of ATTRIB RES */ 652 UINT8 attrib_res[NFC_MAX_ATTRIB_LEN];/* ATTRIB RES */ 653 UINT8 hi_info_len; /* len of Higher layer Info */ 654 UINT8 hi_info[NFC_MAX_GEN_BYTES_LEN];/* Higher layer Info */ 655 UINT8 mbli; /* Maximum buffer length. */ 656} tNFC_INTF_PB_ISO_DEP; 657 658typedef struct 659{ 660 UINT8 attrib_req_len; /* Length of ATTRIB REQ */ 661 UINT8 attrib_req[NFC_MAX_ATTRIB_LEN];/* ATTRIB REQ (Byte 2 - 10+k)*/ 662 UINT8 hi_info_len; /* len of Higher layer Info */ 663 UINT8 hi_info[NFC_MAX_GEN_BYTES_LEN];/* Higher layer Info */ 664 UINT8 nfcid0[NFC_NFCID0_MAX_LEN]; /* NFCID0 */ 665} tNFC_INTF_LB_ISO_DEP; 666 667 668#ifndef NFC_MAX_RAW_PARAMS 669#define NFC_MAX_RAW_PARAMS 16 670#endif 671#define NFC_MAX_RAW_PARAMS 16 672typedef struct 673{ 674 UINT8 param_len; 675 UINT8 param[NFC_MAX_RAW_PARAMS]; 676} tNFC_INTF_FRAME; 677 678typedef struct 679{ 680 tNFC_INTF_TYPE type; /* Interface Type 1 Byte See Table 67 */ 681 union 682 { 683 tNFC_INTF_LA_ISO_DEP la_iso; 684 tNFC_INTF_PA_ISO_DEP pa_iso; 685 tNFC_INTF_LB_ISO_DEP lb_iso; 686 tNFC_INTF_PB_ISO_DEP pb_iso; 687 tNFC_INTF_LA_NFC_DEP la_nfc; 688 tNFC_INTF_PA_NFC_DEP pa_nfc; 689 tNFC_INTF_LF_NFC_DEP lf_nfc; 690 tNFC_INTF_PF_NFC_DEP pf_nfc; 691 tNFC_INTF_FRAME frame; 692 } intf_param; /* Activation Parameters 0 - n Bytes */ 693} tNFC_INTF_PARAMS; 694 695/* the data type associated with NFC_ACTIVATE_DEVT */ 696typedef struct 697{ 698 UINT8 rf_disc_id; /* RF Discovery ID */ 699 tNFC_PROTOCOL protocol; /* supported protocol */ 700 tNFC_RF_TECH_PARAMS rf_tech_param; /* RF technology parameters */ 701 tNFC_DISCOVERY_TYPE data_mode; /* for future Data Exchange */ 702 tNFC_BIT_RATE tx_bitrate; /* Data Exchange Tx Bitrate */ 703 tNFC_BIT_RATE rx_bitrate; /* Data Exchange Rx Bitrate */ 704 tNFC_INTF_PARAMS intf_param; /* interface type and params*/ 705} tNFC_ACTIVATE_DEVT; 706 707/* the data type associated with NFC_DEACTIVATE_DEVT and NFC_DEACTIVATE_CEVT */ 708typedef struct 709{ 710 tNFC_STATUS status; /* The event status. */ 711 tNFC_DEACT_TYPE type; /* De-activate type */ 712 BOOLEAN is_ntf; /* TRUE, if deactivate notif*/ 713} tNFC_DEACTIVATE_DEVT; 714 715typedef union 716{ 717 tNFC_STATUS status; /* The event status. */ 718 tNFC_START_DEVT start; 719 tNFC_RESULT_DEVT result; 720 tNFC_SELECT_DEVT select; 721 tNFC_STOP_DEVT stop; 722 tNFC_ACTIVATE_DEVT activate; 723 tNFC_DEACTIVATE_DEVT deactivate; 724} tNFC_DISCOVER; 725 726/* Min TR0 indicates to tag the min delay before responding after the end of command */ 727#define NFC_RF_PARAM_MIN_TR0_DEFAULT 0x00 728#define NFC_RF_PARAM_MIN_TR0_48X 0x01 /* 48 x 16/fc */ 729#define NFC_RF_PARAM_MIN_TR0_16X 0x02 /* 16 x 16/fc */ 730 731/* Min TR1 indicates to tag the min delay between subcarrier modulation and data transmission */ 732#define NFC_RF_PARAM_MIN_TR1_DEFAULT 0x00 733#define NFC_RF_PARAM_MIN_TR1_64X 0x01 /* 64 x 16/fc */ 734#define NFC_RF_PARAM_MIN_TR1_16X 0x02 /* 16 x 16/fc */ 735 736/* Min TR2 indicates to RW the min delay between EoS of tag and SoS of RW */ 737#define NFC_RF_PARAM_MIN_TR2_1792 0x00 /* 1792/fc (10etu + 32/fc) */ 738#define NFC_RF_PARAM_MIN_TR2_3328 0x01 /* 3328/fc (10etu + 128/fc) */ 739#define NFC_RF_PARAM_MIN_TR2_5376 0x02 /* 5376/fc (10etu + 256/fc) */ 740#define NFC_RF_PARAM_MIN_TR2_9472 0x03 /* 9472/fc (10etu + 512/fc) */ 741 742#define NFC_RF_PARAM_EOS_REQUIRED 0x00 /* EoS required */ 743#define NFC_RF_PARAM_EOS_NOT_REQUIRED 0x01 /* EoS not required */ 744 745#define NFC_RF_PARAM_SOS_REQUIRED 0x00 /* SoS required */ 746#define NFC_RF_PARAM_SOS_NOT_REQUIRED 0x01 /* SoS not required */ 747 748typedef struct 749{ 750 BOOLEAN include_rf_tech_mode; /* TRUE if including RF Tech and Mode update */ 751 tNFC_RF_TECH_N_MODE rf_tech_n_mode; /* RF tech and mode */ 752 BOOLEAN include_tx_bit_rate; /* TRUE if including Tx bit rate update */ 753 tNFC_BIT_RATE tx_bit_rate; /* Transmit Bit Rate */ 754 BOOLEAN include_rx_bit_rate; /* TRUE if including Rx bit rate update */ 755 tNFC_BIT_RATE rx_bit_rate; /* Receive Bit Rate */ 756 BOOLEAN include_nfc_b_config; /* TRUE if including NFC-B data exchange config */ 757 UINT8 min_tr0; /* Minimun TR0 */ 758 UINT8 min_tr1; /* Minimun TR1 */ 759 UINT8 suppression_eos; /* Suppression of EoS */ 760 UINT8 suppression_sos; /* Suppression of SoS */ 761 UINT8 min_tr2; /* Minimun TR1 */ 762} tNFC_RF_COMM_PARAMS; 763 764/************************************* 765** DISCOVER Callback Functions 766**************************************/ 767typedef void (tNFC_DISCOVER_CBACK) (tNFC_DISCOVER_EVT event, tNFC_DISCOVER *p_data); 768 769/* the events reported on tNFC_TEST_CBACK */ 770enum 771{ 772 NFC_LOOPBACK_TEVT = NFC_FIRST_TEVT, /* 0 Loopback test */ 773 NFC_RF_CONTROL_TEVT, /* 1 RF control Test response */ 774 NFC_RF_FIELD_DONE_TEVT /* 1 RF control Test notificatn*/ 775}; 776typedef UINT16 tNFC_TEST_EVT; 777 778/* the data type associated with NFC_LOOPBACK_TEVT */ 779typedef struct 780{ 781 tNFC_STATUS status; /* The event status. */ 782 BT_HDR *p_data; /* The loop back data from NFCC */ 783} tNFC_LOOPBACK_TEVT; 784 785/* the data type associated with NFC_RF_CONTROL_TEVT */ 786typedef tNFC_STATUS tNFC_RF_CONTROL_TEVT; 787 788typedef union 789{ 790 tNFC_STATUS status; /* The event status. */ 791 tNFC_LOOPBACK_TEVT loop_back; 792 tNFC_RF_CONTROL_TEVT rf_control; 793} tNFC_TEST; 794 795/************************************* 796** TEST Callback Functions 797**************************************/ 798typedef void (tNFC_TEST_CBACK) (tNFC_TEST_EVT event, tNFC_TEST *p_data); 799 800 801typedef tNFC_DEACTIVATE_DEVT tNFC_DEACTIVATE_CEVT; 802typedef union 803{ 804 tNFC_STATUS status; /* The event status. */ 805 tNFC_CONN_CREATE_CEVT conn_create; 806 tNFC_CONN_CLOSE_CEVT conn_close; 807 tNFC_DEACTIVATE_CEVT deactivate; 808 tNFC_DATA_CEVT data; 809} tNFC_CONN; 810 811/************************************* 812** Data Callback Functions 813**************************************/ 814typedef void (tNFC_CONN_CBACK) (UINT8 conn_id, tNFC_CONN_EVT event, tNFC_CONN *p_data); 815#define NFC_MAX_CONN_ID 15 816#define NFC_ILLEGAL_CONN_ID 0xFF 817#define NFC_RF_CONN_ID 0 /* the static connection ID for RF traffic */ 818 819 820 821/************************************* 822** Status callback function 823**************************************/ 824typedef void (tNFC_STATUS_CBACK) (tNFC_STATUS status); 825 826/***************************************************************************** 827** EXTERNAL FUNCTION DECLARATIONS 828*****************************************************************************/ 829#ifdef __cplusplus 830extern "C" { 831#endif 832 833/******************************************************************************* 834** 835** Function NFC_Enable 836** 837** Description This function enables NFC. Prior to calling NFC_Enable: 838** - the NFCC must be powered up, and ready to receive commands. 839** - GKI must be enabled 840** - NFC_TASK must be started 841** - NCIT_TASK must be started (if using dedicated NCI transport) 842** 843** This function opens the NCI transport (if applicable), 844** resets the NFC controller, and initializes the NFC subsystems. 845** 846** When the NFC startup procedure is completed, an 847** NFC_ENABLE_REVT is returned to the application using the 848** tNFC_RESPONSE_CBACK. 849** 850** Returns tNFC_STATUS 851** 852*******************************************************************************/ 853NFC_API extern tNFC_STATUS NFC_Enable (tNFC_RESPONSE_CBACK *p_cback); 854 855/******************************************************************************* 856** 857** Function NFC_Disable 858** 859** Description This function performs clean up routines for shutting down 860** NFC and closes the NCI transport (if using dedicated NCI 861** transport). 862** 863** When the NFC shutdown procedure is completed, an 864** NFC_DISABLED_REVT is returned to the application using the 865** tNFC_RESPONSE_CBACK. 866** 867** Returns nothing 868** 869*******************************************************************************/ 870NFC_API extern void NFC_Disable (void); 871 872/******************************************************************************* 873** 874** Function NFC_Init 875** 876** Description This function initializes control blocks for NFC 877** 878** Returns nothing 879** 880*******************************************************************************/ 881NFC_API extern void NFC_Init(tHAL_NFC_ENTRY *p_hal_entry_tbl); 882 883/******************************************************************************* 884** 885** Function NFC_GetLmrtSize 886** 887** Description Called by application wto query the Listen Mode Routing 888** Table size supported by NFCC 889** 890** Returns Listen Mode Routing Table size 891** 892*******************************************************************************/ 893NFC_API extern UINT16 NFC_GetLmrtSize(void); 894 895/******************************************************************************* 896** 897** Function NFC_SetConfig 898** 899** Description This function is called to send the configuration parameter 900** TLV to NFCC. The response from NFCC is reported by 901** tNFC_RESPONSE_CBACK as NFC_SET_CONFIG_REVT. 902** 903** Parameters tlv_size - the length of p_param_tlvs. 904** p_param_tlvs - the parameter ID/Len/Value list 905** 906** Returns tNFC_STATUS 907** 908*******************************************************************************/ 909NFC_API extern tNFC_STATUS NFC_SetConfig (UINT8 tlv_size, 910 UINT8 *p_param_tlvs); 911 912/******************************************************************************* 913** 914** Function NFC_GetConfig 915** 916** Description This function is called to retrieve the parameter TLV from NFCC. 917** The response from NFCC is reported by tNFC_RESPONSE_CBACK 918** as NFC_GET_CONFIG_REVT. 919** 920** Parameters num_ids - the number of parameter IDs 921** p_param_ids - the parameter ID list. 922** 923** Returns tNFC_STATUS 924** 925*******************************************************************************/ 926NFC_API extern tNFC_STATUS NFC_GetConfig (UINT8 num_ids, 927 UINT8 *p_param_ids); 928 929/******************************************************************************* 930** 931** Function NFC_NfceeDiscover 932** 933** Description This function is called to enable or disable NFCEE Discovery. 934** The response from NFCC is reported by tNFC_RESPONSE_CBACK 935** as NFC_NFCEE_DISCOVER_REVT. 936** The notification from NFCC is reported by tNFC_RESPONSE_CBACK 937** as NFC_NFCEE_INFO_REVT. 938** 939** Parameters discover - 1 to enable discover, 0 to disable. 940** 941** Returns tNFC_STATUS 942** 943*******************************************************************************/ 944NFC_API extern tNFC_STATUS NFC_NfceeDiscover (BOOLEAN discover); 945 946/******************************************************************************* 947** 948** Function NFC_NfceeModeSet 949** 950** Description This function is called to activate or de-activate an NFCEE 951** connected to the NFCC. 952** The response from NFCC is reported by tNFC_RESPONSE_CBACK 953** as NFC_NFCEE_MODE_SET_REVT. 954** 955** Parameters nfcee_id - the NFCEE to activate or de-activate. 956** mode - 0 to activate NFCEE, 1 to de-activate. 957** 958** Returns tNFC_STATUS 959** 960*******************************************************************************/ 961NFC_API extern tNFC_STATUS NFC_NfceeModeSet (UINT8 nfcee_id, 962 tNFC_NFCEE_MODE mode); 963/******************************************************************************* 964** 965** Function NFC_DiscoveryMap 966** 967** Description This function is called to set the discovery interface mapping. 968** The response from NFCC is reported by tNFC_DISCOVER_CBACK as. 969** NFC_MAP_DEVT. 970** 971** Parameters num - the number of items in p_params. 972** p_maps - the discovery interface mappings 973** p_cback - the discovery callback function 974** 975** Returns tNFC_STATUS 976** 977*******************************************************************************/ 978NFC_API extern tNFC_STATUS NFC_DiscoveryMap(UINT8 num, tNFC_DISCOVER_MAPS *p_maps, 979 tNFC_DISCOVER_CBACK *p_cback); 980 981/******************************************************************************* 982** 983** Function NFC_DiscoveryStart 984** 985** Description This function is called to start Polling and/or Listening. 986** The response from NFCC is reported by tNFC_DISCOVER_CBACK as. 987** NFC_START_DEVT. The notification from NFCC is reported by 988** tNFC_DISCOVER_CBACK as NFC_RESULT_DEVT. 989** 990** Parameters num_params - the number of items in p_params. 991** p_params - the discovery parameters 992** p_cback - the discovery callback function 993** 994** Returns tNFC_STATUS 995** 996*******************************************************************************/ 997NFC_API extern tNFC_STATUS NFC_DiscoveryStart(UINT8 num_params, 998 tNFC_DISCOVER_PARAMS *p_params, 999 tNFC_DISCOVER_CBACK *p_cback); 1000 1001/******************************************************************************* 1002** 1003** Function NFC_DiscoverySelect 1004** 1005** Description If tNFC_DISCOVER_CBACK reports status=NFC_MULTIPLE_PROT, 1006** the application needs to use this function to select the 1007** the logical endpoint to continue. The response from NFCC is 1008** reported by tNFC_DISCOVER_CBACK as NFC_SELECT_DEVT. 1009** 1010** Parameters rf_disc_id - The ID identifies the remote device. 1011** protocol - the logical endpoint on the remote devide 1012** rf_interface - the RF interface to communicate with NFCC 1013** 1014** Returns tNFC_STATUS 1015** 1016*******************************************************************************/ 1017NFC_API extern tNFC_STATUS NFC_DiscoverySelect (UINT8 rf_disc_id, 1018 UINT8 protocol, 1019 UINT8 rf_interface); 1020 1021/******************************************************************************* 1022** 1023** Function NFC_ConnCreate 1024** 1025** Description This function is called to create a logical connection with 1026** NFCC for data exchange. 1027** The response from NFCC is reported in tNFC_CONN_CBACK 1028** as NFC_CONN_CREATE_CEVT. 1029** 1030** Parameters dest_type - the destination type 1031** id - the NFCEE ID or RF Discovery ID . 1032** protocol - the protocol 1033** p_cback - the data callback function to receive data fron NFCC 1034** 1035** Returns tNFC_STATUS 1036** 1037*******************************************************************************/ 1038NFC_API extern tNFC_STATUS NFC_ConnCreate(UINT8 dest_type, 1039 UINT8 id, 1040 UINT8 protocol, 1041 tNFC_CONN_CBACK *p_cback); 1042 1043/******************************************************************************* 1044** 1045** Function NFC_ConnClose 1046** 1047** Description This function is called to close a logical connection with 1048** NFCC. 1049** The response from NFCC is reported in tNFC_CONN_CBACK 1050** as NFC_CONN_CLOSE_CEVT. 1051** 1052** Parameters conn_id - the connection id. 1053** 1054** Returns tNFC_STATUS 1055** 1056*******************************************************************************/ 1057NFC_API extern tNFC_STATUS NFC_ConnClose(UINT8 conn_id); 1058 1059/******************************************************************************* 1060** 1061** Function NFC_SetStaticRfCback 1062** 1063** Description This function is called to update the data callback function 1064** to receive the data for the given connection id. 1065** 1066** Parameters p_cback - the connection callback function 1067** 1068** Returns Nothing 1069** 1070*******************************************************************************/ 1071NFC_API extern void NFC_SetStaticRfCback(tNFC_CONN_CBACK *p_cback); 1072 1073/******************************************************************************* 1074** 1075** Function NFC_SendData 1076** 1077** Description This function is called to send the given data packet 1078** to the connection identified by the given connection id. 1079** 1080** Parameters conn_id - the connection id. 1081** p_data - the data packet 1082** 1083** Returns tNFC_STATUS 1084** 1085*******************************************************************************/ 1086NFC_API extern tNFC_STATUS NFC_SendData(UINT8 conn_id, 1087 BT_HDR *p_data); 1088 1089/******************************************************************************* 1090** 1091** Function NFC_FlushData 1092** 1093** Description This function is called to discard the tx data queue of 1094** the given connection id. 1095** 1096** Parameters conn_id - the connection id. 1097** 1098** Returns tNFC_STATUS 1099** 1100*******************************************************************************/ 1101NFC_API extern tNFC_STATUS NFC_FlushData (UINT8 conn_id); 1102 1103/******************************************************************************* 1104** 1105** Function NFC_Deactivate 1106** 1107** Description This function is called to stop the discovery process or 1108** put the listen device in sleep mode or terminate the NFC link. 1109** 1110** The response from NFCC is reported by tNFC_DISCOVER_CBACK 1111** as NFC_DEACTIVATE_DEVT. 1112** 1113** Parameters deactivate_type - NFC_DEACTIVATE_TYPE_IDLE, to IDLE mode. 1114** NFC_DEACTIVATE_TYPE_SLEEP to SLEEP mode. 1115** NFC_DEACTIVATE_TYPE_SLEEP_AF to SLEEP_AF mode. 1116** 1117** Returns tNFC_STATUS 1118** 1119*******************************************************************************/ 1120NFC_API extern tNFC_STATUS NFC_Deactivate(tNFC_DEACT_TYPE deactivate_type); 1121 1122/******************************************************************************* 1123** 1124** Function NFC_UpdateRFCommParams 1125** 1126** Description This function is called to update RF Communication parameters 1127** once the Frame RF Interface has been activated. 1128** 1129** The response from NFCC is reported by tNFC_RESPONSE_CBACK 1130** as NFC_RF_COMM_PARAMS_UPDATE_REVT. 1131** 1132** Returns tNFC_STATUS 1133** 1134*******************************************************************************/ 1135NFC_API extern tNFC_STATUS NFC_UpdateRFCommParams (tNFC_RF_COMM_PARAMS *p_params); 1136 1137/******************************************************************************* 1138** 1139** Function NFC_SetPowerOffSleep 1140** 1141** Description This function closes/opens transport and turns off/on NFCC. 1142** 1143** Returns tNFC_STATUS 1144** 1145*******************************************************************************/ 1146NFC_API extern tNFC_STATUS NFC_SetPowerOffSleep (BOOLEAN enable); 1147 1148/******************************************************************************* 1149** 1150** Function NFC_PowerCycleNFCC 1151** 1152** Description This function turns off and then on NFCC. 1153** 1154** Returns tNFC_STATUS 1155** 1156*******************************************************************************/ 1157NFC_API extern tNFC_STATUS NFC_PowerCycleNFCC (void); 1158 1159/******************************************************************************* 1160** 1161** Function NFC_SetRouting 1162** 1163** Description This function is called to configure the CE routing table. 1164** The response from NFCC is reported by tNFC_RESPONSE_CBACK 1165** as NFC_SET_ROUTING_REVT. 1166** 1167** Parameters 1168** 1169** Returns tNFC_STATUS 1170** 1171*******************************************************************************/ 1172NFC_API extern tNFC_STATUS NFC_SetRouting(BOOLEAN more, 1173 UINT8 nfcee_id, 1174 UINT8 num_tlv, 1175 UINT8 tlv_size, 1176 UINT8 *p_param_tlvs); 1177 1178/******************************************************************************* 1179** 1180** Function NFC_GetRouting 1181** 1182** Description This function is called to retrieve the CE routing table from 1183** NFCC. The response from NFCC is reported by tNFC_RESPONSE_CBACK 1184** as NFC_GET_ROUTING_REVT. 1185** 1186** Returns tNFC_STATUS 1187** 1188*******************************************************************************/ 1189NFC_API extern tNFC_STATUS NFC_GetRouting(void); 1190 1191/******************************************************************************* 1192** 1193** Function NFC_RegVSCback 1194** 1195** Description This function is called to register or de-register a callback 1196** function to receive Proprietary NCI response and notification 1197** events. 1198** The maximum number of callback functions allowed is NFC_NUM_VS_CBACKS 1199** 1200** Returns tNFC_STATUS 1201** 1202*******************************************************************************/ 1203NFC_API extern tNFC_STATUS NFC_RegVSCback (BOOLEAN is_register, 1204 tNFC_VS_CBACK *p_cback); 1205 1206/******************************************************************************* 1207** 1208** Function NFC_SendVsCommand 1209** 1210** Description This function is called to send the given vendor specific 1211** command to NFCC. The response from NFCC is reported to the 1212** given tNFC_VS_CBACK as (oid). 1213** 1214** Parameters oid - The opcode of the VS command. 1215** p_data - The parameters for the VS command 1216** 1217** Returns tNFC_STATUS 1218** 1219*******************************************************************************/ 1220NFC_API extern tNFC_STATUS NFC_SendVsCommand(UINT8 oid, 1221 BT_HDR *p_data, 1222 tNFC_VS_CBACK *p_cback); 1223 1224/******************************************************************************* 1225** 1226** Function NFC_TestLoopback 1227** 1228** Description This function is called to send the given data packet 1229** to NFCC for loopback test. 1230** When loopback data is received from NFCC, tNFC_TEST_CBACK . 1231** reports a NFC_LOOPBACK_TEVT. 1232** 1233** Parameters p_data - the data packet 1234** 1235** Returns tNFC_STATUS 1236** 1237*******************************************************************************/ 1238NFC_API extern tNFC_STATUS NFC_TestLoopback(BT_HDR *p_data); 1239 1240 1241/******************************************************************************* 1242** 1243** Function NFC_SetTraceLevel 1244** 1245** Description This function sets the trace level for NFC. If called with 1246** a value of 0xFF, it simply returns the current trace level. 1247** 1248** Returns The new or current trace level 1249** 1250*******************************************************************************/ 1251NFC_API extern UINT8 NFC_SetTraceLevel (UINT8 new_level); 1252 1253#ifdef __cplusplus 1254} 1255#endif 1256 1257#endif /* NFC_API_H */ 1258