Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2010-2014 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  *  This is the public interface file for NFA, Broadcom's NFC application
     22  *  layer for mobile phones.
     23  *
     24  ******************************************************************************/
     25 #ifndef NFA_API_H
     26 #define NFA_API_H
     27 
     28 #include "gki.h"
     29 #include "nci_defs.h"
     30 #include "nfc_api.h"
     31 #include "nfc_hal_api.h"
     32 #include "nfc_target.h"
     33 #include "rw_api.h"
     34 #include "tags_defs.h"
     35 
     36 /*****************************************************************************
     37 **  Constants and data types
     38 *****************************************************************************/
     39 
     40 /* Max length of Appliction ID in 7816-4 */
     41 #define NFA_MAX_AID_LEN NFC_MAX_AID_LEN
     42 #define NFA_MIN_AID_LEN 5 /* per NCI specification */
     43 
     44 /* NFA API return status codes */
     45 /* Command succeeded    */
     46 #define NFA_STATUS_OK NCI_STATUS_OK
     47 /* Command is rejected. */
     48 #define NFA_STATUS_REJECTED NCI_STATUS_REJECTED
     49 /* Message is corrupted */
     50 #define NFA_STATUS_MSG_CORRUPTED NCI_STATUS_MESSAGE_CORRUPTED
     51 /* buffer full          */
     52 #define NFA_STATUS_BUFFER_FULL NCI_STATUS_BUFFER_FULL
     53 /* failed               */
     54 #define NFA_STATUS_FAILED NCI_STATUS_FAILED
     55 /* not initialized      */
     56 #define NFA_STATUS_NOT_INITIALIZED NCI_STATUS_NOT_INITIALIZED
     57 /* Syntax error         */
     58 #define NFA_STATUS_SYNTAX_ERROR NCI_STATUS_SYNTAX_ERROR
     59 /* Semantic error       */
     60 #define NFA_STATUS_SEMANTIC_ERROR NCI_STATUS_SEMANTIC_ERROR
     61 /* Unknown NCI Group ID */
     62 #define NFA_STATUS_UNKNOWN_GID NCI_STATUS_UNKNOWN_GID
     63 /* Unknown NCI Opcode   */
     64 #define NFA_STATUS_UNKNOWN_OID NCI_STATUS_UNKNOWN_OID
     65 /* Invalid Parameter    */
     66 #define NFA_STATUS_INVALID_PARAM NCI_STATUS_INVALID_PARAM
     67 /* Message size too big */
     68 #define NFA_STATUS_MSG_SIZE_TOO_BIG NCI_STATUS_MSG_SIZE_TOO_BIG
     69 /* Already started      */
     70 #define NFA_STATUS_ALREADY_STARTED NCI_STATUS_ALREADY_STARTED
     71 /* Activation Failed    */
     72 #define NFA_STATUS_ACTIVATION_FAILED NCI_STATUS_ACTIVATION_FAILED
     73 /* Tear Down Error      */
     74 #define NFA_STATUS_TEAR_DOWN NCI_STATUS_TEAR_DOWN
     75 /* RF transmission error*/
     76 #define NFA_STATUS_RF_TRANSMISSION_ERR NCI_STATUS_RF_TRANSMISSION_ERR
     77 /* RF protocol error    */
     78 #define NFA_STATUS_RF_PROTOCOL_ERR NCI_STATUS_RF_PROTOCOL_ERR
     79 /* RF Timeout           */
     80 #define NFA_STATUS_TIMEOUT NCI_STATUS_TIMEOUT
     81 /* EE Intf activate err */
     82 #define NFA_STATUS_EE_INTF_ACTIVE_FAIL NCI_STATUS_EE_INTF_ACTIVE_FAIL
     83 /* EE transmission error*/
     84 #define NFA_STATUS_EE_TRANSMISSION_ERR NCI_STATUS_EE_TRANSMISSION_ERR
     85 /* EE protocol error    */
     86 #define NFA_STATUS_EE_PROTOCOL_ERR NCI_STATUS_EE_PROTOCOL_ERR
     87 /* EE Timeout           */
     88 #define NFA_STATUS_EE_TIMEOUT NCI_STATUS_EE_TIMEOUT
     89 
     90 /* Command started successfully */
     91 #define NFA_STATUS_CMD_STARTED NFC_STATUS_CMD_STARTED
     92 /* NFCC Timeout in responding to an NCI command */
     93 #define NFA_STATUS_HW_TIMEOUT NFC_STATUS_HW_TIMEOUT
     94 /* More NFA_CE_GET_ROUTING_REVT to follow */
     95 #define NFA_STATUS_CONTINUE NFC_STATUS_CONTINUE
     96 /* API is called to perform illegal function */
     97 #define NFA_STATUS_REFUSED NFC_STATUS_REFUSED
     98 /* Wrong format of R-APDU, CC file or NDEF file */
     99 #define NFA_STATUS_BAD_RESP NFC_STATUS_BAD_RESP
    100 /* 7816 Status Word is not command complete(0x9000) */
    101 #define NFA_STATUS_CMD_NOT_CMPLTD NFC_STATUS_CMD_NOT_CMPLTD
    102 /* Out of GKI buffers */
    103 #define NFA_STATUS_NO_BUFFERS NFC_STATUS_NO_BUFFERS
    104 /* Protocol mismatch between API and activated one */
    105 #define NFA_STATUS_WRONG_PROTOCOL NFC_STATUS_WRONG_PROTOCOL
    106 /* Another Tag command is already in progress */
    107 #define NFA_STATUS_BUSY NFC_STATUS_BUSY
    108 
    109 /* data len exceeds MIU                             */
    110 #define NFA_STATUS_BAD_LENGTH NFC_STATUS_BAD_LENGTH
    111 /* invalid handle                                   */
    112 #define NFA_STATUS_BAD_HANDLE NFC_STATUS_BAD_HANDLE
    113 /* congested                                        */
    114 #define NFA_STATUS_CONGESTED NFC_STATUS_CONGESTED
    115 typedef uint8_t tNFA_STATUS;
    116 
    117 /* Handle for NFA registrations and connections */
    118 typedef uint16_t tNFA_HANDLE;
    119 #define NFA_HANDLE_INVALID (0xFFFF)
    120 /* NFA Handle definitions */
    121 
    122 /* The upper byte of NFA_HANDLE signifies the handle group */
    123 /* Connection handles           */
    124 #define NFA_HANDLE_GROUP_CONNECTION 0x0100
    125 /* NDEF Type Handler handles    */
    126 #define NFA_HANDLE_GROUP_NDEF_HANDLER 0x0200
    127 /* DH Card Emulation handles    */
    128 #define NFA_HANDLE_GROUP_CE 0x0300
    129 /* Handles to identify NFCEE    */
    130 #define NFA_HANDLE_GROUP_EE 0x0400
    131 /* P2P handles                  */
    132 #define NFA_HANDLE_GROUP_P2P 0x0500
    133 /* SNEP handles                 */
    134 #define NFA_HANDLE_GROUP_SNEP 0x0700
    135 /* HCI handles                  */
    136 #define NFA_HANDLE_GROUP_HCI 0x0800
    137 /* Local NDEF message handle    */
    138 #define NFA_HANDLE_GROUP_LOCAL_NDEF 0x0900
    139 #define NFA_HANDLE_GROUP_MASK 0xFF00
    140 #define NFA_HANDLE_MASK 0x00FF
    141 
    142 /* NCI Parameter IDs */
    143 typedef uint8_t tNFA_PMID;
    144 
    145 /* Definitions for tNFA_TECHNOLOGY_MASK */
    146 #define NFA_TECHNOLOGY_MASK_A 0x01        /* NFC Technology A             */
    147 #define NFA_TECHNOLOGY_MASK_B 0x02        /* NFC Technology B             */
    148 #define NFA_TECHNOLOGY_MASK_F 0x04        /* NFC Technology F             */
    149 /* TECHNOLOGY_MASK_V in NCI2.0 and TECHNOLOGY_MASK_15693 proprietary in NCI1.0*/
    150 #define NFA_TECHNOLOGY_MASK_V 0x08
    151 #define NFA_TECHNOLOGY_MASK_B_PRIME 0x10  /* Proprietary Technology       */
    152 #define NFA_TECHNOLOGY_MASK_KOVIO 0x20    /* Proprietary Technology       */
    153 /* NFC technology NFC-DEP protocol active mode */
    154 #define NFA_TECHNOLOGY_MASK_ACTIVE 0x40
    155 /* NFC Technology A active mode */
    156 #define NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40
    157 /* NFC Technology F active mode */
    158 #define NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80
    159 /* All supported technologies   */
    160 #define NFA_TECHNOLOGY_MASK_ALL 0xFF
    161 typedef uint8_t tNFA_TECHNOLOGY_MASK;
    162 
    163 /* Definitions for NFC protocol for RW, CE and P2P APIs */
    164 /* Type1Tag - NFC-A */
    165 #define NFA_PROTOCOL_T1T NFC_PROTOCOL_T1T
    166 /* MIFARE/Type2Tag - NFC-A */
    167 #define NFA_PROTOCOL_T2T NFC_PROTOCOL_T2T
    168 /* Felica/Type3Tag - NFC-F */
    169 #define NFA_PROTOCOL_T3T NFC_PROTOCOL_T3T
    170 /* Type 4A,4B - NFC-A or NFC-B */
    171 #define NFA_PROTOCOL_ISO_DEP NFC_PROTOCOL_ISO_DEP
    172 /* NFCDEP/LLCP - NFC-A or NFC-F */
    173 #define NFA_PROTOCOL_NFC_DEP NFC_PROTOCOL_NFC_DEP
    174 /* NFC_PROTOCOL_T5T in NCI2.0 and NFC_PROTOCOL_ISO15693 proprietary in NCI1.0*/
    175 #define NFA_PROTOCOL_T5T NFC_PROTOCOL_T5T
    176 #define NFA_PROTOCOL_B_PRIME NFC_PROTOCOL_B_PRIME
    177 #define NFA_PROTOCOL_KOVIO NFC_PROTOCOL_KOVIO
    178 #define NFA_PROTOCOL_MIFARE NFC_PROTOCOL_MIFARE
    179 #define NFA_PROTOCOL_INVALID 0xFF
    180 #define NFA_MAX_NUM_PROTOCOLS 8
    181 typedef uint8_t tNFA_NFC_PROTOCOL;
    182 
    183 /* Definitions for tNFA_PROTOCOL_MASK */
    184 #define NFA_PROTOCOL_MASK_T1T 0x01     /* Type 1 tag          */
    185 #define NFA_PROTOCOL_MASK_T2T 0x02     /* MIFARE / Type 2 tag */
    186 #define NFA_PROTOCOL_MASK_T3T 0x04     /* FeliCa / Type 3 tag */
    187 #define NFA_PROTOCOL_MASK_ISO_DEP 0x08 /* ISODEP/4A,4B        */
    188 #define NFA_PROTOCOL_MASK_NFC_DEP 0x10 /* NFCDEP/LLCP         */
    189 typedef uint8_t tNFA_PROTOCOL_MASK;
    190 
    191 /* NFA_DM callback events */
    192 /* Result of NFA_Enable             */
    193 #define NFA_DM_ENABLE_EVT 0
    194 /* Result of NFA_Disable            */
    195 #define NFA_DM_DISABLE_EVT 1
    196 /* Result of NFA_SetConfig          */
    197 #define NFA_DM_SET_CONFIG_EVT 2
    198 /* Result of NFA_GetConfig          */
    199 #define NFA_DM_GET_CONFIG_EVT 3
    200 /* Result of NFA_PowerOffSleepMode  */
    201 #define NFA_DM_PWR_MODE_CHANGE_EVT 4
    202 #define NFA_DM_RF_FIELD_EVT 5 /* Status of RF Field               */
    203 /* NFCC is not responding           */
    204 #define NFA_DM_NFCC_TIMEOUT_EVT 6
    205 /* NCI Tranport error               */
    206 #define NFA_DM_NFCC_TRANSPORT_ERR_EVT 7
    207 /* Result of NFA_SetPowerSubStateForScreenState */
    208 #define NFA_DM_SET_POWER_SUB_STATE_EVT 11
    209 /* T1T HR length            */
    210 #define NFA_T1T_HR_LEN T1T_HR_LEN
    211 /* Max UID length of T1/T2  */
    212 #define NFA_MAX_UID_LEN TAG_MAX_UID_LEN
    213 /* T1T UID length           */
    214 #define NFA_T1T_UID_LEN T1T_UID_LEN
    215 /* UID len for T1T cmds     */
    216 #define NFA_T1T_CMD_UID_LEN T1T_CMD_UID_LEN
    217 /* T2T UID length           */
    218 #define NFA_T2T_UID_LEN T2T_UID_LEN
    219 
    220 /* Tag is read only */
    221 #define NFA_RW_NDEF_FL_READ_ONLY RW_NDEF_FL_READ_ONLY
    222 /* Tag formated for NDEF */
    223 #define NFA_RW_NDEF_FL_FORMATED RW_NDEF_FL_FORMATED
    224 /* NDEF supported by the tag */
    225 #define NFA_RW_NDEF_FL_SUPPORTED RW_NDEF_FL_SUPPORTED
    226 /* Unable to find if tag is ndef capable/formated/read only */
    227 #define NFA_RW_NDEF_FL_UNKNOWN RW_NDEF_FL_UNKNOWN
    228 /* Tag supports format operation */
    229 #define NFA_RW_NDEF_FL_FORMATABLE RW_NDEF_FL_FORMATABLE
    230 /* Tag can be soft locked */
    231 #define NFA_RW_NDEF_FL_SOFT_LOCKABLE RW_NDEF_FL_SOFT_LOCKABLE
    232 /* Tag can be hard locked */
    233 #define NFA_RW_NDEF_FL_HARD_LOCKABLE RW_NDEF_FL_HARD_LOCKABLE
    234 /* Tag is one time programmable */
    235 #define NFA_RW_NDEF_FL_OTP RW_NDEF_FL_OTP
    236 
    237 typedef uint8_t tNFA_RW_NDEF_FLAG;
    238 
    239 /* Data for NFA_DM_SET_CONFIG_EVT */
    240 typedef struct {
    241   tNFA_STATUS status;                   /* NFA_STATUS_OK if successful  */
    242   uint8_t num_param_id;                 /* Number of rejected Param ID  */
    243   tNFA_PMID param_ids[NFC_MAX_NUM_IDS]; /* Rejected Param ID            */
    244 } tNFA_SET_CONFIG;
    245 
    246 /* Data for NFA_DM_GET_CONFIG_EVT */
    247 typedef struct {
    248   tNFA_STATUS status;    /* NFA_STATUS_OK if successful              */
    249   uint16_t tlv_size;     /* The length of TLV                        */
    250   uint8_t param_tlvs[1]; /* TLV (Parameter ID-Len-Value byte stream) */
    251 } tNFA_GET_CONFIG;
    252 
    253 /* Structure to store screen state */
    254 typedef enum screen_state {
    255   NFA_SCREEN_STATE_UNKNOWN = 0x00,
    256   NFA_SCREEN_STATE_OFF_UNLOCKED = 0x01,
    257   NFA_SCREEN_STATE_OFF_LOCKED = 0x02,
    258   NFA_SCREEN_STATE_ON_LOCKED = 0x04,
    259   NFA_SCREEN_STATE_ON_UNLOCKED = 0x08
    260 } eScreenState_t;
    261 
    262 typedef enum power_substate {
    263   SCREEN_STATE_ON_UNLOCKED = 0x00,
    264   SCREEN_STATE_OFF_UNLOCKED,
    265   SCREEN_STATE_ON_LOCKED,
    266   SCREEN_STATE_OFF_LOCKED,
    267 } epower_substate_t;
    268 
    269 #define NFA_SCREEN_STATE_MASK 0x0F
    270 
    271 /* CONN_DISCOVER_PARAM */
    272 #define NFA_LISTEN_DH_NFCEE_ENABLE_MASK NCI_LISTEN_DH_NFCEE_ENABLE_MASK
    273 #define NFA_LISTEN_DH_NFCEE_DISABLE_MASK NCI_LISTEN_DH_NFCEE_DISABLE_MASK
    274 #define NFA_POLLING_DH_DISABLE_MASK NCI_POLLING_DH_DISABLE_MASK
    275 #define NFA_POLLING_DH_ENABLE_MASK NCI_POLLING_DH_ENABLE_MASK
    276 #define NFA_DM_PWR_MODE_FULL 0x04
    277 #define NFA_DM_PWR_MODE_OFF_SLEEP 0x00
    278 
    279 typedef uint8_t tNFA_DM_PWR_MODE;
    280 
    281 /* Data for NFA_DM_PWR_MODE_CHANGE_EVT */
    282 typedef struct {
    283   tNFA_STATUS status; /* NFA_STATUS_OK if successful */
    284   /* NFA_DM_PWR_MODE_FULL or NFA_DM_PWR_MODE_OFF_SLEEP */
    285   tNFA_DM_PWR_MODE power_mode;
    286 } tNFA_DM_PWR_MODE_CHANGE;
    287 
    288 /* Data for NFA_DM_RF_FIELD_EVT */
    289 #define NFA_DM_RF_FIELD_OFF 0x00
    290 #define NFA_DM_RF_FIELD_ON 0x01
    291 
    292 typedef struct {
    293   tNFA_STATUS status; /* NFA_STATUS_OK if successful  */
    294   /* NFA_DM_RF_FIELD_ON if operating field generated by remote */
    295   uint8_t rf_field_status;
    296 } tNFA_DM_RF_FIELD;
    297 
    298 typedef struct {
    299   tNFA_STATUS status;  /* NFA_STATUS_OK if successful  */
    300   uint8_t power_state; /* current screen/power state */
    301 } tNFA_DM_POWER_STATE;
    302 
    303 /* Union of all DM callback structures */
    304 typedef union {
    305   tNFA_STATUS status;                 /* NFA_DM_ENABLE_EVT        */
    306   tNFA_SET_CONFIG set_config;         /* NFA_DM_SET_CONFIG_EVT    */
    307   tNFA_GET_CONFIG get_config;         /* NFA_DM_GET_CONFIG_EVT    */
    308   tNFA_DM_PWR_MODE_CHANGE power_mode; /* NFA_DM_PWR_MODE_CHANGE_EVT   */
    309   tNFA_DM_RF_FIELD rf_field;          /* NFA_DM_RF_FIELD_EVT      */
    310   void* p_vs_evt_data;                /* Vendor-specific evt data */
    311   tNFA_DM_POWER_STATE power_sub_state; /* power sub state */
    312 } tNFA_DM_CBACK_DATA;
    313 
    314 /* NFA_DM callback */
    315 typedef void(tNFA_DM_CBACK)(uint8_t event, tNFA_DM_CBACK_DATA* p_data);
    316 
    317 /* NFA Enable DTA Type Mode */
    318 typedef enum {
    319   NFA_DTA_DEFAULT_MODE = 0x00000001,
    320   NFA_DTA_LLCP_MODE = 0x00000002,
    321   NFA_DTA_SNEP_MODE = 0x00000003,
    322   NFA_DTA_HCEF_MODE = 0x00000004,
    323   NFA_DTA_CR8 = 0x00000080,
    324   NFA_DTA_CR9 = 0x00000090,
    325   NFA_DTA_CR10 = 0x000000A0,
    326   NFA_DTA_CR11 = 0x000000B0,
    327   NFA_DTA_CR12 = 0x000000C0,
    328 } tNFA_eDtaModes;
    329 
    330 /* NFA Connection Callback Events */
    331 #define NFA_POLL_ENABLED_EVT 0  /* Polling enabled event */
    332 #define NFA_POLL_DISABLED_EVT 1 /* Polling disabled event */
    333 /* NFC link/protocol discovery notificaiton */
    334 #define NFA_DISC_RESULT_EVT 2
    335 /* NFC link/protocol discovery select response */
    336 #define NFA_SELECT_RESULT_EVT 3
    337 #define NFA_DEACTIVATE_FAIL_EVT 4 /* NFA_Deactivate failure */
    338 /* NFC link/protocol activated */
    339 #define NFA_ACTIVATED_EVT 5
    340 /* NFC link/protocol deactivated */
    341 #define NFA_DEACTIVATED_EVT 6
    342 #define NFA_TLV_DETECT_EVT 7 /* TLV Detection complete */
    343 /* NDEF Detection complete */
    344 #define NFA_NDEF_DETECT_EVT 8
    345 #define NFA_DATA_EVT 9            /* Data message received */
    346 #define NFA_SELECT_CPLT_EVT 10    /* Select completed */
    347 #define NFA_READ_CPLT_EVT 11      /* Read completed */
    348 #define NFA_WRITE_CPLT_EVT 12     /* Write completed */
    349 #define NFA_LLCP_ACTIVATED_EVT 13 /* LLCP link is activated */
    350 /* LLCP link is deactivated */
    351 #define NFA_LLCP_DEACTIVATED_EVT 14
    352 /* Response to NFA_RwPresenceCheck */
    353 #define NFA_PRESENCE_CHECK_EVT 15
    354 /* Tag Formating completed */
    355 #define NFA_FORMAT_CPLT_EVT 16
    356 /* ISO 15693 command completed */
    357 #define NFA_I93_CMD_CPLT_EVT 17
    358 #define NFA_SET_TAG_RO_EVT 18 /* Tag set as Read only */
    359 /* Result for NFA_RequestExclusiveRfControl */
    360 #define NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT 19
    361 /* Result for NFA_ReleaseExclusiveRfControl */
    362 #define NFA_EXCLUSIVE_RF_CONTROL_STOPPED_EVT 20
    363 /* DH Card emulation: AID or System code reg'd  */
    364 #define NFA_CE_REGISTERED_EVT 21
    365 /* DH Card emulation: AID or System code dereg'd */
    366 #define NFA_CE_DEREGISTERED_EVT 22
    367 /* DH Card emulation: data received event */
    368 #define NFA_CE_DATA_EVT 23
    369 /* DH Card emulation: activation event */
    370 #define NFA_CE_ACTIVATED_EVT 24
    371 /* DH Card emulation: deactivation event */
    372 #define NFA_CE_DEACTIVATED_EVT 25
    373 /* DH Card emulation: local NDEF configured */
    374 #define NFA_CE_LOCAL_TAG_CONFIGURED_EVT 26
    375 /* DH Card emulation: NDEF write started */
    376 #define NFA_CE_NDEF_WRITE_START_EVT 27
    377 /* DH Card emulation: NDEF write completed */
    378 #define NFA_CE_NDEF_WRITE_CPLT_EVT 28
    379 #define NFA_CE_UICC_LISTEN_CONFIGURED_EVT 29 /* UICC Listen configured */
    380 /* RF Discovery started event */
    381 #define NFA_RF_DISCOVERY_STARTED_EVT 30
    382 /* RF Discovery stopped event */
    383 #define NFA_RF_DISCOVERY_STOPPED_EVT 31
    384 /* status of updating RF communication paramters */
    385 #define NFA_UPDATE_RF_PARAM_RESULT_EVT 32
    386 /* RF Interface error event */
    387 #define NFA_RW_INTF_ERROR_EVT 34
    388 /* status of setting P2P listen technologies */
    389 #define NFA_SET_P2P_LISTEN_TECH_EVT 33
    390 /* First packet received over LLCP link */
    391 #define NFA_LLCP_FIRST_PACKET_RECEIVED_EVT 35
    392 /* Listening enabled event */
    393 #define NFA_LISTEN_ENABLED_EVT 36
    394 /* Listening disabled event */
    395 #define NFA_LISTEN_DISABLED_EVT 37
    396 /* P2P services paused event */
    397 #define NFA_P2P_PAUSED_EVT 38
    398 /* P2P services resumed event */
    399 #define NFA_P2P_RESUMED_EVT 39
    400 
    401 /* NFC deactivation type */
    402 #define NFA_DEACTIVATE_TYPE_IDLE NFC_DEACTIVATE_TYPE_IDLE
    403 #define NFA_DEACTIVATE_TYPE_SLEEP NFC_DEACTIVATE_TYPE_SLEEP
    404 #define NFA_DEACTIVATE_TYPE_DISCOVERY NFC_DEACTIVATE_TYPE_DISCOVERY
    405 
    406 typedef uint8_t tNFA_DEACTIVATE_TYPE;
    407 
    408 /* Data for NFA_DISC_RESULT_EVT */
    409 typedef struct {
    410   tNFA_STATUS status;             /* NFA_STATUS_OK if successful       */
    411   tNFC_RESULT_DEVT discovery_ntf; /* RF discovery notification details */
    412 } tNFA_DISC_RESULT;
    413 
    414 /* Data for NFA_ACTIVATED_EVT */
    415 typedef struct {
    416   uint8_t hr[NFA_T1T_HR_LEN];       /* HR of Type 1 tag         */
    417   uint8_t uid[NFA_T1T_CMD_UID_LEN]; /* UID used in T1T Commands */
    418 } tNFA_T1T_PARAMS;
    419 
    420 typedef struct {
    421   uint8_t uid[NFA_MAX_UID_LEN]; /* UID of T2T tag           */
    422 } tNFA_T2T_PARAMS;
    423 
    424 typedef struct {
    425   uint8_t num_system_codes; /* Number of system codes supporte by tag   */
    426   uint16_t* p_system_codes; /* Pointer to list of system codes          */
    427 } tNFA_T3T_PARAMS;
    428 
    429 typedef struct {
    430   uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB */
    431   uint8_t info_flags;   /* information flags                            */
    432   uint8_t dsfid;        /* DSFID if I93_INFO_FLAG_DSFID                 */
    433   uint8_t afi;          /* AFI if I93_INFO_FLAG_AFI                     */
    434   uint16_t num_block;   /* number of blocks if I93_INFO_FLAG_MEM_SIZE   */
    435   uint8_t block_size;   /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
    436   uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF         */
    437 } tNFA_I93_PARAMS;
    438 
    439 typedef union {
    440   tNFA_T1T_PARAMS t1t; /* HR and UID of T1T                */
    441   tNFA_T2T_PARAMS t2t; /* UID of T2T                       */
    442   tNFA_T3T_PARAMS t3t; /* System codes                     */
    443   tNFA_I93_PARAMS i93; /* System Information of ISO 15693  */
    444 } tNFA_TAG_PARAMS;
    445 
    446 typedef struct {
    447   tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
    448   tNFA_TAG_PARAMS params;          /* additional informaiton of tag   */
    449 } tNFA_ACTIVATED;
    450 
    451 /* Data for NFA_DEACTIVATED_EVT */
    452 typedef struct {
    453   /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
    454   tNFA_DEACTIVATE_TYPE type;
    455 } tNFA_DEACTIVATED;
    456 
    457 /* Structure for NFA_NDEF_DETECT_EVT event data */
    458 typedef struct {
    459   tNFA_STATUS status;         /* Status of the ndef detecton */
    460   tNFA_NFC_PROTOCOL protocol; /* protocol used to detect NDEF */
    461   uint32_t max_size;          /* max number of bytes available for NDEF data */
    462   uint32_t cur_size;          /* current size of stored NDEF data (in bytes) */
    463   /* Flags to indicate NDEF capability, is formated, soft/hard lockable,
    464    * formatable, otp and read only */
    465   tNFA_RW_NDEF_FLAG flags;
    466 } tNFA_NDEF_DETECT;
    467 
    468 /* Structure for NFA_TLV_DETECT_EVT event data */
    469 typedef struct {
    470   tNFA_STATUS status;         /* Status of the tlv detecton        */
    471   tNFA_NFC_PROTOCOL protocol; /* protocol used to detect TLV       */
    472   uint8_t num_tlvs;           /* number of tlvs present in the tag */
    473   uint8_t num_bytes;          /* number of lock/reserved bytes     */
    474 } tNFA_TLV_DETECT;
    475 
    476 /* Structure for NFA_DATA_EVT data */
    477 typedef struct {
    478   tNFA_STATUS status; /* Status of Data received          */
    479   uint8_t* p_data;    /* Data buffer                      */
    480   uint16_t len;       /* Length of data                   */
    481 } tNFA_RX_DATA;
    482 
    483 /* Structure for NFA_CE_NDEF_WRITE_CPLT_EVT data */
    484 typedef struct {
    485   tNFA_STATUS status; /* Status of the ndef write op      */
    486   uint32_t len;       /* Update length of NDEF data       */
    487   uint8_t* p_data;    /* data buffer                      */
    488 } tNFA_CE_NDEF_WRITE_CPLT;
    489 
    490 /* Data for NFA_LLCP_ACTIVATED_EVT */
    491 typedef struct {
    492   bool is_initiator;        /* TRUE if initiator                */
    493   uint16_t remote_wks;      /* Well-Known service mask of peer  */
    494   uint8_t remote_lsc;       /* Link Service Class of peer       */
    495   uint16_t remote_link_miu; /* Link MIU of peer                 */
    496   uint16_t local_link_miu;  /* Link MIU of local                */
    497   uint8_t remote_version;   /* LLCP version of remote           */
    498 } tNFA_LLCP_ACTIVATED;
    499 
    500 /* Data for NFA_LLCP_DEACTIVATED_EVT */
    501 typedef struct {
    502   uint8_t reason; /* reason of deactivation           */
    503 } tNFA_LLCP_DEACTIVATED;
    504 
    505 /* Data for NFA_I93_CMD_CPLT_EVT */
    506 typedef struct {
    507   uint8_t dsfid;                 /* DSFID                       */
    508   uint8_t uid[I93_UID_BYTE_LEN]; /* UID[0]:MSB, ... UID[7]:LSB  */
    509 } tNFA_I93_INVENTORY;
    510 
    511 typedef struct /* RW_I93_SYS_INFO_EVT                          */
    512 {
    513   uint8_t info_flags; /* information flags                            */
    514   uint8_t uid[I93_UID_BYTE_LEN]; /* UID */
    515   uint8_t dsfid;        /* DSFID if I93_INFO_FLAG_DSFID                 */
    516   uint8_t afi;          /* AFI if I93_INFO_FLAG_AFI                     */
    517   uint16_t num_block;   /* number of blocks if I93_INFO_FLAG_MEM_SIZE   */
    518   uint8_t block_size;   /* block size in byte if I93_INFO_FLAG_MEM_SIZE */
    519   uint8_t IC_reference; /* IC Reference if I93_INFO_FLAG_IC_REF         */
    520 } tNFA_I93_SYS_INFO;
    521 
    522 typedef struct {
    523   tNFA_STATUS status;   /* Status of sending command       */
    524   uint8_t sent_command; /* sent command to tag             */
    525   union {
    526     uint8_t error_code;           /* error code defined in ISO 15693 */
    527     tNFA_I93_INVENTORY inventory; /* inventory response              */
    528     tNFA_I93_SYS_INFO sys_info;   /* system information              */
    529   } params;
    530 } tNFA_I93_CMD_CPLT;
    531 
    532 /* Data for NFA_CE_REGISTERED_EVT */
    533 typedef struct {
    534   tNFA_STATUS status; /* NFA_STATUS_OK if successful                      */
    535   tNFA_HANDLE handle; /* handle for NFA_CeRegisterFelicaSystemCodeOnDH () */
    536                       /*            NFA_CeRegisterT4tAidOnDH ()           */
    537 } tNFA_CE_REGISTERED;
    538 
    539 /* Data for NFA_CE_DEREGISTERED_EVT */
    540 typedef struct {
    541   tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT   */
    542 } tNFA_CE_DEREGISTERED;
    543 
    544 /* Data for NFA_CE_ACTIVATED_EVT */
    545 typedef struct {
    546   tNFA_STATUS status; /* NFA_STATUS_OK if successful              */
    547   tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT        */
    548   tNFC_ACTIVATE_DEVT activate_ntf; /* RF discovery activation details */
    549 } tNFA_CE_ACTIVATED;
    550 
    551 /* Data for NFA_CE_DEACTIVATED_EVT */
    552 typedef struct {
    553   tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT   */
    554   /* NFA_DEACTIVATE_TYPE_IDLE or NFA_DEACTIVATE_TYPE_SLEEP */
    555   tNFA_DEACTIVATE_TYPE type;
    556 } tNFA_CE_DEACTIVATED;
    557 
    558 /* Structure for NFA_CE_DATA_EVT data */
    559 typedef struct {
    560   tNFA_STATUS status; /* NFA_STATUS_OK if complete packet     */
    561   tNFA_HANDLE handle; /* handle from NFA_CE_REGISTERED_EVT    */
    562   uint8_t* p_data;    /* Data buffer                          */
    563   uint16_t len;       /* Length of data                       */
    564 } tNFA_CE_DATA;
    565 
    566 /* Union of all connection callback structures */
    567 typedef union {
    568   tNFA_STATUS status;           /* NFA_POLL_ENABLED_EVT                 */
    569                                 /* NFA_POLL_DISABLED_EVT                */
    570                                 /* NFA_CE_UICC_LISTEN_CONFIGURED_EVT    */
    571                                 /* NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT */
    572                                 /* NFA_EXCLUSIVE_RF_CONTROL_STOPPED_EVT */
    573                                 /* NFA_SELECT_RESULT_EVT                */
    574                                 /* NFA_DEACTIVATE_FAIL_EVT              */
    575                                 /* NFA_CE_NDEF_WRITE_START_EVT          */
    576                                 /* NFA_SELECT_CPLT_EVT                  */
    577                                 /* NFA_READ_CPLT_EVT                    */
    578                                 /* NFA_WRITE_CPLT_EVT                   */
    579                                 /* NFA_PRESENCE_CHECK_EVT               */
    580                                 /* NFA_FORMAT_CPLT_EVT                  */
    581                                 /* NFA_SET_TAG_RO_EVT                   */
    582                                 /* NFA_UPDATE_RF_PARAM_RESULT_EVT       */
    583                                 /* NFA_RW_INTF_ERROR_EVT                */
    584   tNFA_DISC_RESULT disc_result; /* NFA_DISC_RESULT_EVT                  */
    585   tNFA_ACTIVATED activated;     /* NFA_ACTIVATED_EVT                    */
    586   tNFA_DEACTIVATED deactivated; /* NFA_DEACTIVATED_EVT                  */
    587   tNFA_NDEF_DETECT ndef_detect; /* NFA_NDEF_DETECT_EVT                  */
    588   tNFA_TLV_DETECT tlv_detect;   /* NFA_TLV_DETECT_EVT                   */
    589   tNFA_RX_DATA data;            /* NFA_DATA_EVT                         */
    590   tNFA_CE_NDEF_WRITE_CPLT ndef_write_cplt; /* NFA_CE_NDEF_WRITE_CPLT_EVT */
    591   tNFA_LLCP_ACTIVATED llcp_activated; /* NFA_LLCP_ACTIVATED_EVT               */
    592   tNFA_LLCP_DEACTIVATED llcp_deactivated; /* NFA_LLCP_DEACTIVATED_EVT */
    593   tNFA_I93_CMD_CPLT i93_cmd_cplt;   /* NFA_I93_CMD_CPLT_EVT                 */
    594   tNFA_CE_REGISTERED ce_registered; /* NFA_CE_REGISTERED_EVT                */
    595   tNFA_CE_DEREGISTERED ce_deregistered; /* NFA_CE_DEREGISTERED_EVT */
    596   tNFA_CE_ACTIVATED ce_activated;     /* NFA_CE_ACTIVATED_EVT                 */
    597   tNFA_CE_DEACTIVATED ce_deactivated; /* NFA_CE_DEACTIVATED_EVT               */
    598   tNFA_CE_DATA ce_data;               /* NFA_CE_DATA_EVT                      */
    599 
    600 } tNFA_CONN_EVT_DATA;
    601 
    602 /* NFA Connection Callback */
    603 typedef void(tNFA_CONN_CBACK)(uint8_t event, tNFA_CONN_EVT_DATA* p_data);
    604 
    605 #ifndef NFA_DM_NUM_INTERFACE_MAP
    606 #define NFA_DM_NUM_INTERFACE_MAP 3
    607 #endif
    608 
    609 /* compile-time configuration structure for the RF Discovery Frequency for each
    610  * technology */
    611 typedef struct {
    612   uint8_t pa;   /* Frequency for NFC Technology A               */
    613   uint8_t pb;   /* Frequency for NFC Technology B               */
    614   uint8_t pf;   /* Frequency for NFC Technology F               */
    615   uint8_t pi93; /* Frequency for Proprietary Technology/15693   */
    616   uint8_t pbp;  /* Frequency for Proprietary Technology/B-Prime */
    617   uint8_t pk;   /* Frequency for Proprietary Technology/Kovio   */
    618   uint8_t paa;  /* Frequency for NFC Technology A active mode   */
    619   uint8_t pfa;  /* Frequency for NFC Technology F active mode   */
    620   uint8_t pacm; /* Frequency for NFC Technology active mode     */
    621 } tNFA_DM_DISC_FREQ_CFG;
    622 
    623 /* definitions for tNFA_DM_CFG.presence_check_option */
    624 /* if NDEF is not supported by the tag, use sleep/wake(last interface) */
    625 #define NFA_DM_PCO_ISO_SLEEP_WAKE 0x01
    626 /* NFA_SendRawFrame() has been used, use empty I block for presence check
    627  * if this bit is not set, use read-binary on channel 3 for presence check */
    628 #define NFA_DM_PCO_EMPTY_I_BLOCK 0x02
    629 
    630 /* compile-time configuration structure */
    631 typedef struct {
    632   /* Automatic NDEF detection (when not in exclusive RF mode) */
    633   bool auto_detect_ndef;
    634   /* Automatic NDEF read (when not in exclusive RF mode)      */
    635   bool auto_read_ndef;
    636   /* Automatic presence check                                 */
    637   bool auto_presence_check;
    638   /* Use sleep/wake(last interface) for ISODEP presence check */
    639   uint8_t presence_check_option;
    640   /* Maximum time to wait for presence check response         */
    641   uint16_t presence_check_timeout;
    642 } tNFA_DM_CFG;
    643 
    644 /* compile-time configuration structure for HCI */
    645 typedef struct {
    646   /* Maximum idle(no HCP Pkt) time to wait for EE DISC REQ Ntf(s) */
    647   uint16_t hci_netwk_enable_timeout;
    648   /* Maximum time to wait for EE DISC REQ NTF(s) after HOT PLUG EVT(s) */
    649   uint16_t hcp_response_timeout;
    650   /* Number of host in the whitelist of Terminal host */
    651   uint8_t num_whitelist_host;
    652   /* Whitelist of Terminal Host */
    653   uint8_t* p_whitelist;
    654 } tNFA_HCI_CFG;
    655 
    656 /*
    657 ** Exclusive RF mode listen configuration
    658 */
    659 
    660 #define NFA_LB_MAX_NFCID0_LEN 4
    661 #define NFA_LF_MAX_SC_NFCID2 1
    662 #define NFA_LA_MAX_HIST_BYTES 15
    663 #define NFA_LB_MAX_H_INFO_LEN 15
    664 
    665 typedef struct {
    666   /*
    667   ** Discovery Configuration Parameters for Listen A
    668   */
    669   bool la_enable;             /* TRUE if listening A                      */
    670   uint8_t la_bit_frame_sdd;   /* Bit Frame SDD in Byte 1 of SENS_RES      */
    671   uint8_t la_platform_config; /* Platform Config in Byte 2 of SENS_RES    */
    672   uint8_t la_sel_info;        /* Byte of SEL_RES                          */
    673   uint8_t la_nfcid1_len;      /* NFCID1 (0, 4, 7 or 10 bytes)             */
    674   uint8_t la_nfcid1[NCI_NFCID1_MAX_LEN]; /*        if empty, NFCC will decide */
    675 
    676   /*
    677   ** Discovery Configuration Parameters for Listen B
    678   */
    679   bool lb_enable;        /* TRUE if listening B                      */
    680   uint8_t lb_sensb_info; /* Byte 2 of Protocol Info within SENSB_RES */
    681   uint8_t lb_nfcid0_len; /* NFCID0 (0, 1 or 4 bytes)                 */
    682   uint8_t
    683       lb_nfcid0[NFA_LB_MAX_NFCID0_LEN]; /*         if empty, NFCC will decide */
    684   uint8_t lb_app_data[NCI_PARAM_LEN_LB_APPDATA]; /* Bytes 6 - 9 in SENSB_RES */
    685   uint8_t lb_sfgi;   /* Start-Up Frame Guard Time                */
    686   uint8_t lb_adc_fo; /* Byte 12 in SENSB_RES                     */
    687 
    688   /*
    689   ** Discovery Configuration Parameters for Listen F
    690   */
    691   bool lf_enable;           /* TRUE if listening F          */
    692   uint8_t lf_con_bitr_f;    /* bit rate to listen           */
    693   uint8_t lf_protocol_type; /* Supported Protocols          */
    694   /* bit field indicating which lf_t3t_identifier are enabled */
    695   uint16_t lf_t3t_flags;
    696   uint8_t lf_t3t_identifier[NFA_LF_MAX_SC_NFCID2]
    697                            [NCI_SYSTEMCODE_LEN + NCI_NFCID2_LEN];
    698   /* System Code and NFCID2       */
    699   uint8_t lf_t3t_pmm[NCI_T3T_PMM_LEN]; /* Bytes 10 - 17 in SENSF_RES   */
    700 
    701   /*
    702   ** Discovery Configuration Parameters for Listen ISO-DEP
    703   */
    704   bool li_enable;            /* TRUE if listening ISO-DEP            */
    705   uint8_t li_fwi;            /* Frame Waiting Time Integer           */
    706   uint8_t la_hist_bytes_len; /* historical bytes for Listen-A        */
    707   uint8_t la_hist_bytes[NFA_LA_MAX_HIST_BYTES];
    708   uint8_t lb_h_info_resp_len; /* higher layer response for Listen-B   */
    709   uint8_t lb_h_info_resp[NFA_LB_MAX_H_INFO_LEN];
    710 
    711   /*
    712   ** Discovery Configuration Parameters for Listen NFC-DEP
    713   */
    714   bool ln_enable;                   /* TRUE if listening NFC-DEP            */
    715   uint8_t ln_wt;                    /* Waiting Time Integer                 */
    716   uint8_t ln_atr_res_gen_bytes_len; /* General bytes in ATR_RES             */
    717   uint8_t ln_atr_res_gen_bytes[NCI_MAX_GEN_BYTES_LEN];
    718   uint8_t ln_atr_res_config; /* Optional parameters (PPt) in ATR_RES */
    719 } tNFA_LISTEN_CFG;
    720 
    721 /* Data for NFA_UpdateRFCommParams () */
    722 typedef tNFC_RF_COMM_PARAMS tNFA_RF_COMM_PARAMS;
    723 
    724 /* RF Interface type */
    725 #define NFA_INTERFACE_FRAME NFC_INTERFACE_FRAME
    726 #define NFA_INTERFACE_ISO_DEP NFC_INTERFACE_ISO_DEP
    727 #define NFA_INTERFACE_NFC_DEP NFC_INTERFACE_NFC_DEP
    728 #define NFA_INTERFACE_MIFARE NFC_INTERFACE_MIFARE
    729 typedef tNFC_INTF_TYPE tNFA_INTF_TYPE;
    730 
    731 /*******************************************************************************
    732 ** NDEF Definitions
    733 *******************************************************************************/
    734 
    735 /* Definitions for tNFA_TNF (NDEF type name format ID) */
    736 /* Empty or no type specified                       */
    737 #define NFA_TNF_EMPTY NDEF_TNF_EMPTY
    738 /* NFC Forum well-known type [NFC RTD]              */
    739 #define NFA_TNF_WKT NDEF_TNF_WKT
    740 /* Media-type as defined in RFC 2046 [RFC 2046]     */
    741 #define NFA_TNF_RFC2046_MEDIA NDEF_TNF_MEDIA
    742 /* Absolute URI as defined in RFC 3986 [RFC 3986]   */
    743 #define NFA_TNF_RFC3986_URI NDEF_TNF_URI
    744 /* NFC Forum external type [NFC RTD]                */
    745 #define NFA_TNF_EXTERNAL NDEF_TNF_EXT
    746 /* Unknown                                          */
    747 #define NFA_TNF_UNKNOWN NDEF_TNF_UNKNOWN
    748 /* Unchanged                                        */
    749 #define NFA_TNF_UNCHANGED NDEF_TNF_UNCHANGED
    750 /* Reserved                                         */
    751 #define NFA_TNF_RESERVED NDEF_TNF_RESERVED
    752 /* Used to register default NDEF type handler       */
    753 #define NFA_TNF_DEFAULT 0xFF
    754 typedef uint8_t tNFA_TNF;
    755 
    756 /* Definitions for tNFA_NDEF_URI_ID (Frequently used prefixes. For additional
    757  * values, see [NFC RTD URI] */
    758 #define NFA_NDEF_URI_ID_ABSOLUTE 0x00 /* Unabridged URI.  */
    759 #define NFA_NDEF_URI_ID_HTTP 0x03     /* http://          */
    760 #define NFA_NDEF_URI_ID_HTTPS 0x04    /* https://         */
    761 #define NFA_NDEF_URI_ID_TEL 0x05      /* tel:             */
    762 #define NFA_NDEF_URI_ID_MAILTO 0x06   /* mailto:          */
    763 #define NFA_NDEF_URI_ID_FTP 0x0D      /* ftp://           */
    764 #define NFA_NDEF_URI_ID_FILE 0x1D     /* file://          */
    765 
    766 typedef uint8_t tNFA_NDEF_URI_ID;
    767 
    768 /* Events for tNFA_NDEF_CBACK */
    769 /* NDEF record type registered. (In response to NFA_RegisterNDefTypeHandler) */
    770 #define NFA_NDEF_REGISTER_EVT 0
    771 /* Received an NDEF message with the registered type. See [tNFA_NDEF_DATA] */
    772 #define NFA_NDEF_DATA_EVT 1
    773 typedef uint8_t tNFA_NDEF_EVT;
    774 
    775 /* Structure for NFA_NDEF_REGISTER_EVT event data */
    776 typedef struct {
    777   tNFA_STATUS status;           /* Status of the registration               */
    778   tNFA_HANDLE ndef_type_handle; /* Handle for this NDEF type registration.  */
    779 } tNFA_NDEF_REGISTER;
    780 
    781 /* Structure for NFA_NDEF_DATA_EVT event data */
    782 typedef struct {
    783   tNFA_HANDLE ndef_type_handle; /* Handle for NDEF type registration.   */
    784   uint8_t* p_data;              /* Data buffer                          */
    785   uint32_t len;                 /* Length of data                       */
    786 } tNFA_NDEF_DATA;
    787 
    788 /* Union of all NDEF callback structures */
    789 typedef union {
    790   /* Structure for NFA_NDEF_REGISTER_EVT event data */
    791   tNFA_NDEF_REGISTER ndef_reg;
    792   /* Structure for NFA_NDEF_DATA_EVT event data */
    793   tNFA_NDEF_DATA ndef_data;
    794 } tNFA_NDEF_EVT_DATA;
    795 
    796 /* NFA_NDEF callback */
    797 typedef void(tNFA_NDEF_CBACK)(tNFA_NDEF_EVT event, tNFA_NDEF_EVT_DATA* p_data);
    798 
    799 /* NFA VSC Callback */
    800 typedef void(tNFA_VSC_CBACK)(uint8_t event, uint16_t param_len,
    801                              uint8_t* p_param);
    802 
    803 /*****************************************************************************
    804 **  External Function Declarations
    805 *****************************************************************************/
    806 #ifdef __cplusplus
    807 extern "C" {
    808 #endif
    809 
    810 /*******************************************************************************
    811 **
    812 ** Function         NFA_Init
    813 **
    814 ** Description      This function initializes control blocks for NFA
    815 **
    816 **                  p_hal_entry_tbl points to a table of HAL entry points
    817 **
    818 **                  NOTE: the buffer that p_hal_entry_tbl points must be
    819 **                  persistent until NFA is disabled.
    820 **
    821 **
    822 ** Returns          none
    823 **
    824 *******************************************************************************/
    825 extern void NFA_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl);
    826 
    827 /*******************************************************************************
    828 **
    829 ** Function         NFA_Enable
    830 **
    831 ** Description      This function enables NFC. Prior to calling NFA_Enable,
    832 **                  the NFCC must be powered up, and ready to receive commands.
    833 **                  This function enables the tasks needed by NFC, opens the NCI
    834 **                  transport, resets the NFC controller, downloads patches to
    835 **                  the NFCC (if necessary), and initializes the NFC subsystems.
    836 **
    837 **                  This function should only be called once - typically when
    838 **                  NFC is enabled during boot-up, or when NFC is enabled from a
    839 **                  settings UI. Subsequent calls to NFA_Enable while NFA is
    840 **                  enabling or enabled will be ignored. When the NFC startup
    841 **                  procedure is completed, an NFA_DM_ENABLE_EVT is returned to
    842 **                  the application using the tNFA_DM_CBACK.
    843 **
    844 **                  The tNFA_CONN_CBACK parameter is used to register a callback
    845 **                  for polling, p2p and card emulation events.
    846 **
    847 **
    848 ** Returns          NFA_STATUS_OK if successfully initiated
    849 **                  NFA_STATUS_FAILED otherwise
    850 **
    851 *******************************************************************************/
    852 extern tNFA_STATUS NFA_Enable(tNFA_DM_CBACK* p_dm_cback,
    853                               tNFA_CONN_CBACK* p_conn_cback);
    854 
    855 /*******************************************************************************
    856 **
    857 ** Function         NFA_Disable
    858 **
    859 ** Description      This function is called to shutdown NFC. The tasks for NFC
    860 **                  are terminated, and clean up routines are performed. This
    861 **                  function is typically called during platform shut-down, or
    862 **                  when NFC is disabled from a settings UI. When the NFC
    863 **                  shutdown procedure is completed, an NFA_DM_DISABLE_EVT is
    864 **                  returned to the application using the tNFA_DM_CBACK.
    865 **
    866 **                  The platform should wait until the NFC_DISABLE_REVT is
    867 **                  received before powering down the NFC chip and NCI
    868 **                  transport. This is required to so that NFA can gracefully
    869 **                  shut down any open connections.
    870 **
    871 ** Returns          NFA_STATUS_OK if successfully initiated
    872 **                  NFA_STATUS_FAILED otherwise
    873 **
    874 *******************************************************************************/
    875 extern tNFA_STATUS NFA_Disable(bool graceful);
    876 
    877 /*******************************************************************************
    878 **
    879 ** Function         NFA_SetConfig
    880 **
    881 ** Description      Set the configuration parameters to NFCC. The result is
    882 **                  reported with an NFA_DM_SET_CONFIG_EVT in the tNFA_DM_CBACK
    883 **                  callback.
    884 **
    885 ** Note:            If RF discovery is started,
    886 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
    887 **                  happen before calling this function. Most Configuration
    888 **                  parameters are related to RF discovery.
    889 **
    890 ** Returns          NFA_STATUS_OK if successfully initiated
    891 **                  NFA_STATUS_BUSY if previous setting is on-going
    892 **                  NFA_STATUS_FAILED otherwise
    893 **
    894 *******************************************************************************/
    895 extern tNFA_STATUS NFA_SetConfig(tNFA_PMID param_id, uint8_t length,
    896                                  uint8_t* p_data);
    897 
    898 /*******************************************************************************
    899 **
    900 ** Function         NFA_GetConfig
    901 **
    902 ** Description      Get the configuration parameters from NFCC. The result is
    903 **                  reported with an NFA_DM_GET_CONFIG_EVT in the tNFA_DM_CBACK
    904 **                  callback.
    905 **
    906 ** Returns          NFA_STATUS_OK if successfully initiated
    907 **                  NFA_STATUS_FAILED otherwise
    908 **
    909 *******************************************************************************/
    910 extern tNFA_STATUS NFA_GetConfig(uint8_t num_ids, tNFA_PMID* p_param_ids);
    911 
    912 /*******************************************************************************
    913 **
    914 ** Function         NFA_RequestExclusiveRfControl
    915 **
    916 ** Description      Request exclusive control of NFC.
    917 **                  - Previous behavior (polling/tag reading, DH card emulation)
    918 **                    will be suspended .
    919 **                  - Polling and listening will be done based on the specified
    920 **                    params
    921 **
    922 **                  The NFA_EXCLUSIVE_RF_CONTROL_STARTED_EVT event of
    923 **                  tNFA_CONN_CBACK indicates the status of the operation.
    924 **
    925 **                  NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT indicates link
    926 **                  activation/deactivation.
    927 **
    928 **                  NFA_SendRawFrame is used to send data to the peer.
    929 **                  NFA_DATA_EVT indicates data from the peer.
    930 **
    931 **                  If a tag is activated, then the NFA_RW APIs may be used to
    932 **                  send commands to the tag. Incoming NDEF messages are sent to
    933 **                  the NDEF callback.
    934 **
    935 **                  Once exclusive RF control has started, NFA will not activate
    936 **                  LLCP internally. The application has exclusive control of
    937 **                  the link.
    938 **
    939 ** Note:            If RF discovery is started,
    940 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
    941 **                  happen before calling this function
    942 **
    943 ** Returns          NFA_STATUS_OK if successfully initiated
    944 **                  NFA_STATUS_FAILED otherwise
    945 **
    946 *******************************************************************************/
    947 extern tNFA_STATUS NFA_RequestExclusiveRfControl(tNFA_TECHNOLOGY_MASK poll_mask,
    948                                                  tNFA_LISTEN_CFG* p_listen_cfg,
    949                                                  tNFA_CONN_CBACK* p_conn_cback,
    950                                                  tNFA_NDEF_CBACK* p_ndef_cback);
    951 
    952 /*******************************************************************************
    953 **
    954 ** Function         NFA_ReleaseExclusiveRfControl
    955 **
    956 ** Description      Release exclusive control of NFC. Once released, behavior
    957 **                  prior to obtaining exclusive RF control will resume.
    958 **
    959 Note??
    960 ** Returns          NFA_STATUS_OK if successfully initiated
    961 **                  NFA_STATUS_FAILED otherwise
    962 **
    963 *******************************************************************************/
    964 extern tNFA_STATUS NFA_ReleaseExclusiveRfControl(void);
    965 
    966 /*******************************************************************************
    967 **
    968 ** Function         NFA_EnablePolling
    969 **
    970 ** Description      Enable polling for technologies specified by poll_mask.
    971 **
    972 **                  The following events (notified using the connection
    973 **                  callback registered with NFA_Enable) are generated during
    974 **                  polling:
    975 **
    976 **                  - NFA_POLL_ENABLED_EVT indicates whether or not polling
    977 **                    successfully enabled.
    978 **                  - NFA_DISC_RESULT_EVT indicates there are more than one
    979 **                    devices, so application must select one of tags by calling
    980 **                    NFA_Select().
    981 **                  - NFA_SELECT_RESULT_EVT indicates whether previous selection
    982 **                    was successful or not. If it was failed then application
    983 **                    must select again or deactivate by calling
    984 **                    NFA_Deactivate().
    985 **                  - NFA_ACTIVATED_EVT is generated when an NFC link is
    986 **                    activated.
    987 **                  - NFA_NDEF_DETECT_EVT is generated if tag is activated
    988 **                  - NFA_LLCP_ACTIVATED_EVT/NFA_LLCP_DEACTIVATED_EVT is
    989 **                    generated if NFC-DEP is activated
    990 **                  - NFA_DEACTIVATED_EVT will be returned after deactivating
    991 **                    NFC link.
    992 **
    993 ** Note:            If RF discovery is started,
    994 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
    995 **                  happen before calling this function
    996 **
    997 ** Returns          NFA_STATUS_OK if successfully initiated
    998 **                  NFA_STATUS_FAILED otherwise
    999 **
   1000 *******************************************************************************/
   1001 extern tNFA_STATUS NFA_EnablePolling(tNFA_TECHNOLOGY_MASK poll_mask);
   1002 
   1003 /*******************************************************************************
   1004 **
   1005 ** Function         NFA_DisablePolling
   1006 **
   1007 ** Description      Disable polling
   1008 **                  NFA_POLL_DISABLED_EVT will be returned after stopping
   1009 **                  polling.
   1010 **
   1011 ** Note:            If RF discovery is started,
   1012 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1013 **                  happen before calling this function
   1014 **
   1015 ** Returns          NFA_STATUS_OK if successfully initiated
   1016 **                  NFA_STATUS_FAILED otherwise
   1017 **
   1018 *******************************************************************************/
   1019 extern tNFA_STATUS NFA_DisablePolling(void);
   1020 
   1021 /*******************************************************************************
   1022 **
   1023 ** Function         NFA_EnableListening
   1024 **
   1025 ** Description      Enable listening.
   1026 **                  NFA_LISTEN_ENABLED_EVT will be returned after listening is
   1027 **                  allowed.
   1028 **
   1029 **                  The actual listening technologies are specified by other NFA
   1030 **                  API functions. Such functions include (but not limited to)
   1031 **                  NFA_CeConfigureUiccListenTech.
   1032 **                  If NFA_DisableListening () is called to ignore the listening
   1033 **                  technologies, NFA_EnableListening () is called to restore
   1034 **                  the listening technologies set by these functions.
   1035 **
   1036 ** Note:            If RF discovery is started,
   1037 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1038 **                  happen before calling this function
   1039 **
   1040 ** Returns          NFA_STATUS_OK if successfully initiated
   1041 **                  NFA_STATUS_FAILED otherwise
   1042 **
   1043 *******************************************************************************/
   1044 extern tNFA_STATUS NFA_EnableListening(void);
   1045 
   1046 /*******************************************************************************
   1047 **
   1048 ** Function         NFA_DisableListening
   1049 **
   1050 ** Description      Disable listening
   1051 **                  NFA_LISTEN_DISABLED_EVT will be returned after stopping
   1052 **                  listening. This function is called to exclude listen at RF
   1053 **                  discovery.
   1054 **
   1055 ** Note:            If RF discovery is started,
   1056 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1057 **                  happen before calling this function
   1058 **
   1059 ** Returns          NFA_STATUS_OK if successfully initiated
   1060 **                  NFA_STATUS_FAILED otherwise
   1061 **
   1062 *******************************************************************************/
   1063 extern tNFA_STATUS NFA_DisableListening(void);
   1064 
   1065 /*******************************************************************************
   1066 **
   1067 ** Function         NFA_PauseP2p
   1068 **
   1069 ** Description      Pause P2P services.
   1070 **                  NFA_P2P_PAUSED_EVT will be returned after P2P services are
   1071 **                  disabled.
   1072 **
   1073 **                  The P2P services enabled by NFA_P2p* API functions are not
   1074 **                  available. NFA_ResumeP2p() is called to resume the P2P
   1075 **                  services.
   1076 **
   1077 ** Note:            If RF discovery is started,
   1078 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1079 **                  happen before calling this function
   1080 **
   1081 ** Returns          NFA_STATUS_OK if successfully initiated
   1082 **                  NFA_STATUS_FAILED otherwise
   1083 **
   1084 *******************************************************************************/
   1085 extern tNFA_STATUS NFA_PauseP2p(void);
   1086 
   1087 /*******************************************************************************
   1088 **
   1089 ** Function         NFA_ResumeP2p
   1090 **
   1091 ** Description      Resume P2P services.
   1092 **                  NFA_P2P_RESUMED_EVT will be returned after P2P services are.
   1093 **                  enables again.
   1094 **
   1095 ** Note:            If RF discovery is started,
   1096 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1097 **                  happen before calling this function
   1098 **
   1099 ** Returns          NFA_STATUS_OK if successfully initiated
   1100 **                  NFA_STATUS_FAILED otherwise
   1101 **
   1102 *******************************************************************************/
   1103 extern tNFA_STATUS NFA_ResumeP2p(void);
   1104 
   1105 /*******************************************************************************
   1106 **
   1107 ** Function         NFA_SetP2pListenTech
   1108 **
   1109 ** Description      This function is called to set listen technology for
   1110 **                  NFC-DEP. This funtion may be called before or after starting
   1111 **                  any server on NFA P2P/CHO/SNEP.
   1112 **                  If there is no technology for NFC-DEP, P2P listening will be
   1113 **                  stopped.
   1114 **
   1115 **                  NFA_SET_P2P_LISTEN_TECH_EVT without data will be returned.
   1116 **
   1117 ** Note:            If RF discovery is started,
   1118 **                  NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should
   1119 **                  happen before calling this function
   1120 **
   1121 ** Returns          NFA_STATUS_OK if successfully initiated
   1122 **                  NFA_STATUS_FAILED otherwise
   1123 **
   1124 *******************************************************************************/
   1125 extern tNFA_STATUS NFA_SetP2pListenTech(tNFA_TECHNOLOGY_MASK tech_mask);
   1126 
   1127 /*******************************************************************************
   1128 **
   1129 ** Function         NFA_StartRfDiscovery
   1130 **
   1131 ** Description      Start RF discovery
   1132 **                  RF discovery parameters shall be set by other APIs.
   1133 **
   1134 **                  An NFA_RF_DISCOVERY_STARTED_EVT indicates whether starting
   1135 **                  was successful or not.
   1136 **
   1137 ** Returns          NFA_STATUS_OK if successfully initiated
   1138 **                  NFA_STATUS_FAILED otherwise
   1139 **
   1140 *******************************************************************************/
   1141 extern tNFA_STATUS NFA_StartRfDiscovery(void);
   1142 
   1143 /*******************************************************************************
   1144 **
   1145 ** Function         NFA_StopRfDiscovery
   1146 **
   1147 ** Description      Stop RF discovery
   1148 **
   1149 **                  An NFA_RF_DISCOVERY_STOPPED_EVT indicates whether stopping
   1150 **                  was successful or not.
   1151 **
   1152 ** Returns          NFA_STATUS_OK if successfully initiated
   1153 **                  NFA_STATUS_FAILED otherwise
   1154 **
   1155 *******************************************************************************/
   1156 extern tNFA_STATUS NFA_StopRfDiscovery(void);
   1157 
   1158 /*******************************************************************************
   1159 **
   1160 ** Function         NFA_SetRfDiscoveryDuration
   1161 **
   1162 ** Description      Set the duration of the single discovery period in [ms].
   1163 **                  Allowable range: 0 ms to 0xFFFF ms.
   1164 **
   1165 ** Note:            If discovery is already started, the application should
   1166 **                  call NFA_StopRfDiscovery prior to calling
   1167 **                  NFA_SetRfDiscoveryDuration, and then call
   1168 **                  NFA_StartRfDiscovery afterwards to restart discovery using
   1169 **                  the new duration.
   1170 **
   1171 ** Returns:
   1172 **                  NFA_STATUS_OK, if command accepted
   1173 **                  NFA_STATUS_FAILED: otherwise
   1174 **
   1175 *******************************************************************************/
   1176 extern tNFA_STATUS NFA_SetRfDiscoveryDuration(uint16_t discovery_period_ms);
   1177 
   1178 /*******************************************************************************
   1179 **
   1180 ** Function         NFA_Select
   1181 **
   1182 ** Description      Select one from detected devices by NFA_DISC_RESULT_EVT
   1183 **                  after the last discovery result is received.
   1184 **                  An NFA_SELECT_RESULT_EVT indicates whether selection was
   1185 **                  successful or not. If failed then application must select
   1186 **                  again or deactivate by NFA_Deactivate ().
   1187 **
   1188 ** Returns          NFA_STATUS_OK if successfully initiated
   1189 **                  NFA_STATUS_INVALID_PARAM if RF interface is not matched
   1190 **                  protocol
   1191 **                  NFA_STATUS_FAILED otherwise
   1192 **
   1193 *******************************************************************************/
   1194 extern tNFA_STATUS NFA_Select(uint8_t rf_disc_id, tNFA_NFC_PROTOCOL protocol,
   1195                               tNFA_INTF_TYPE rf_interface);
   1196 
   1197 /*******************************************************************************
   1198 **
   1199 ** Function         NFA_UpdateRFCommParams
   1200 **
   1201 ** Description      This function is called to update RF Communication
   1202 **                  parameters once the Frame RF Interface has been activated.
   1203 **
   1204 **                  An NFA_UPDATE_RF_PARAM_RESULT_EVT indicates whether updating
   1205 **                  was successful or not.
   1206 **
   1207 ** Returns          NFA_STATUS_OK if successfully initiated
   1208 **                  NFA_STATUS_FAILED otherwise
   1209 **
   1210 *******************************************************************************/
   1211 extern tNFA_STATUS NFA_UpdateRFCommParams(tNFA_RF_COMM_PARAMS* p_params);
   1212 
   1213 /*******************************************************************************
   1214 **
   1215 ** Function         NFA_Deactivate
   1216 **
   1217 ** Description
   1218 **                  If sleep_mode=TRUE:
   1219 **                      Deselect the activated device by deactivating into sleep
   1220 **                      mode.
   1221 **
   1222 **                      An NFA_DEACTIVATE_FAIL_EVT indicates that selection was
   1223 **                      not successful. Application can select another
   1224 **                      discovered device or deactivate by NFA_Deactivate ()
   1225 **                      after receiving NFA_DEACTIVATED_EVT.
   1226 **
   1227 **                      Deactivating to sleep mode is not allowed when NFCC is
   1228 **                      in wait-for-host-select mode, or in listen-sleep states;
   1229 **                      NFA will deactivate to idle or discovery state for these
   1230 **                      cases respectively.
   1231 **
   1232 **
   1233 **                  If sleep_mode=FALSE:
   1234 **                      Deactivate the connection (e.g. as a result of presence
   1235 **                      check failure) NFA_DEACTIVATED_EVT will indicate that
   1236 **                      link is deactivated. Polling/listening will resume
   1237 **                      (unless the nfcc is in wait_for-all-discoveries state)
   1238 **
   1239 **
   1240 ** Returns          NFA_STATUS_OK if successfully initiated
   1241 **                  NFA_STATUS_FAILED otherwise
   1242 **
   1243 *******************************************************************************/
   1244 extern tNFA_STATUS NFA_Deactivate(bool sleep_mode);
   1245 
   1246 /*******************************************************************************
   1247 **
   1248 ** Function         NFA_SendRawFrame
   1249 **
   1250 ** Description      Send a raw frame over the activated interface with the NFCC.
   1251 **                  This function can only be called after NFC link is
   1252 **                  activated.
   1253 **
   1254 **                  If the activated interface is a tag and auto-presence check
   1255 **                  is enabled then presence_check_start_delay can be used to
   1256 **                  indicate the delay in msec after which the next auto
   1257 **                  presence check command can be sent.
   1258 **                  NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY can be used as the
   1259 **                  default value for the delay.
   1260 **
   1261 ** Returns          NFA_STATUS_OK if successfully initiated
   1262 **                  NFA_STATUS_FAILED otherwise
   1263 **
   1264 *******************************************************************************/
   1265 extern tNFA_STATUS NFA_SendRawFrame(uint8_t* p_raw_data, uint16_t data_len,
   1266                                     uint16_t presence_check_start_delay);
   1267 
   1268 /*******************************************************************************
   1269 ** NDEF APIs
   1270 *******************************************************************************/
   1271 
   1272 /*******************************************************************************
   1273 **
   1274 ** Function         NFA_RegisterNDefTypeHandler
   1275 **
   1276 ** Description      This function allows the applications to register for
   1277 **                  specific types of NDEF records. When NDEF records are
   1278 **                  received, NFA will parse the record-type field, and pass
   1279 **                  the record to the registered tNFA_NDEF_CBACK.
   1280 **
   1281 **                  For records types which were not registered, the record will
   1282 **                  be sent to the default handler. A default type-handler may
   1283 **                  be registered by calling this NFA_RegisterNDefTypeHandler
   1284 **                  with tnf=NFA_TNF_DEFAULT. In this case, all un-registered
   1285 **                  record types will be sent to the callback. Only one default
   1286 **                  handler may be registered at a time.
   1287 **
   1288 **                  An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
   1289 **                  to indicate that registration was successful, and provide a
   1290 **                  handle for this record type.
   1291 **
   1292 **
   1293 ** Returns          NFA_STATUS_OK if successfully initiated
   1294 **                  NFA_STATUS_FAILED otherwise
   1295 **
   1296 *******************************************************************************/
   1297 extern tNFA_STATUS NFA_RegisterNDefTypeHandler(bool handle_whole_message,
   1298                                                tNFA_TNF tnf,
   1299                                                uint8_t* p_type_name,
   1300                                                uint8_t type_name_len,
   1301                                                tNFA_NDEF_CBACK* p_ndef_cback);
   1302 
   1303 /*******************************************************************************
   1304 **
   1305 ** Function         NFA_RegisterNDefUriHandler
   1306 **
   1307 ** Description      This API is a special-case of NFA_RegisterNDefTypeHandler
   1308 **                  with TNF=NFA_TNF_WKT, and type_name='U' (URI record); and
   1309 **                  allows registering for specific URI types (e.g. 'tel:' or
   1310 **                  'mailto:').
   1311 **
   1312 **                  An NFA_NDEF_REGISTER_EVT will be sent to the tNFA_NDEF_CBACK
   1313 **                  to indicate that registration was successful, and provide a
   1314 **                  handle for this registration.
   1315 **
   1316 **                  If uri_id=NFA_NDEF_URI_ID_ABSOLUTE, then p_abs_uri contains
   1317 **                  the unabridged URI. For all other uri_id values, the
   1318 **                  p_abs_uri parameter is ignored (i.e the URI prefix is
   1319 **                  implied by uri_id).
   1320 **
   1321 **                  See [NFC RTD URI] for more information.
   1322 **
   1323 ** Returns          NFA_STATUS_OK if successfully initiated
   1324 **                  NFA_STATUS_FAILED otherwise
   1325 **
   1326 *******************************************************************************/
   1327 extern tNFA_STATUS NFA_RegisterNDefUriHandler(bool handle_whole_message,
   1328                                               tNFA_NDEF_URI_ID uri_id,
   1329                                               uint8_t* p_abs_uri,
   1330                                               uint8_t uri_id_len,
   1331                                               tNFA_NDEF_CBACK* p_ndef_cback);
   1332 
   1333 /*******************************************************************************
   1334 **
   1335 ** Function         NFA_DeregisterNDefTypeHandler
   1336 **
   1337 ** Description      Deregister NDEF record type handler.
   1338 **
   1339 ** Returns          NFA_STATUS_OK if successfully initiated
   1340 **                  NFA_STATUS_FAILED otherwise
   1341 **
   1342 *******************************************************************************/
   1343 extern tNFA_STATUS NFA_DeregisterNDefTypeHandler(tNFA_HANDLE ndef_type_handle);
   1344 
   1345 /*******************************************************************************
   1346 **
   1347 ** Function         NFA_PowerOffSleepMode
   1348 **
   1349 ** Description      This function is called to enter or leave NFCC Power Off
   1350 **                  Sleep mode
   1351 **                  NFA_DM_PWR_MODE_CHANGE_EVT will be sent to indicate status.
   1352 **
   1353 **                  start_stop : TRUE if entering Power Off Sleep mode
   1354 **                               FALSE if leaving Power Off Sleep mode
   1355 **
   1356 Note??
   1357 ** Returns          NFA_STATUS_OK if successfully initiated
   1358 **                  NFA_STATUS_FAILED otherwise
   1359 **
   1360 *******************************************************************************/
   1361 extern tNFA_STATUS NFA_PowerOffSleepMode(bool start_stop);
   1362 
   1363 /*******************************************************************************
   1364 **
   1365 ** Function         NFA_RegVSCback
   1366 **
   1367 ** Description      This function is called to register or de-register a
   1368 **                  callback function to receive Proprietary NCI response and
   1369 **                  notification events.
   1370 **                  The maximum number of callback functions allowed is
   1371 **                  NFC_NUM_VS_CBACKS
   1372 **
   1373 ** Returns          tNFC_STATUS
   1374 **
   1375 *******************************************************************************/
   1376 extern tNFC_STATUS NFA_RegVSCback(bool is_register, tNFA_VSC_CBACK* p_cback);
   1377 
   1378 /*******************************************************************************
   1379 **
   1380 ** Function         NFA_SendVsCommand
   1381 **
   1382 ** Description      This function is called to send an NCI Vendor Specific
   1383 **                  command to NFCC.
   1384 **
   1385 **                  oid             - The opcode of the VS command.
   1386 **                  cmd_params_len  - The command parameter len
   1387 **                  p_cmd_params    - The command parameter
   1388 **                  p_cback         - The callback function to receive the
   1389 **                                    command status
   1390 **
   1391 ** Returns          NFA_STATUS_OK if successfully initiated
   1392 **                  NFA_STATUS_FAILED otherwise
   1393 **
   1394 *******************************************************************************/
   1395 extern tNFA_STATUS NFA_SendVsCommand(uint8_t oid, uint8_t cmd_params_len,
   1396                                      uint8_t* p_cmd_params,
   1397                                      tNFA_VSC_CBACK* p_cback);
   1398 
   1399 /*******************************************************************************
   1400 **
   1401 ** Function         NFA_SendRawVsCommand
   1402 **
   1403 ** Description      This function is called to send raw vendor specific
   1404 **                  command to NFCC.
   1405 **
   1406 **                  cmd_params_len  - The command parameter len
   1407 **                  p_cmd_params    - The command parameter
   1408 **                  p_cback         - The callback function to receive the
   1409 **                                    command
   1410 **
   1411 ** Returns          NFA_STATUS_OK if successfully initiated
   1412 **                  NFA_STATUS_FAILED otherwise
   1413 **
   1414 *******************************************************************************/
   1415 
   1416 extern tNFA_STATUS NFA_SendRawVsCommand(uint8_t cmd_params_len,
   1417                                         uint8_t* p_cmd_params,
   1418                                         tNFA_VSC_CBACK* p_cback);
   1419 
   1420 /*******************************************************************************
   1421 **
   1422 ** Function         NFA_SetTraceLevel
   1423 **
   1424 ** Description      This function sets the trace level for NFA.  If called with
   1425 **                  a value of 0xFF, it simply returns the current trace level.
   1426 **
   1427 ** Returns          The new or current trace level
   1428 **
   1429 *******************************************************************************/
   1430 extern uint8_t NFA_SetTraceLevel(uint8_t new_level);
   1431 
   1432 /*******************************************************************************
   1433 **
   1434 ** Function:        NFA_EnableDTA_TypeMode
   1435 **
   1436 ** Description:     Initialize and get global DTA type mode from .conf
   1437 **
   1438 ** Returns:         none:
   1439 **
   1440 *******************************************************************************/
   1441 extern void NFA_EnableDtamode(tNFA_eDtaModes eDtaMode);
   1442 
   1443 /*******************************************************************************
   1444 ** Function:        NFA_SetPowerSubStateForScreenState
   1445 **
   1446 ** Description:     This function send the current screen state
   1447 **
   1448 ** Returns:        NFA_STATUS_OK if successfully initiated
   1449 **                  NFA_STATUS_FAILED otherwise
   1450 *******************************************************************************/
   1451 extern tNFA_STATUS NFA_SetPowerSubStateForScreenState(uint8_t ScreenState);
   1452 
   1453 #ifdef __cplusplus
   1454 }
   1455 #endif
   1456 
   1457 #endif /* NFA_API_H */
   1458