1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-2012 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 private interface file for the NFA device manager. 22 * 23 ******************************************************************************/ 24 #ifndef NFA_DM_INT_H 25 #define NFA_DM_INT_H 26 27 #include "nfc_api.h" 28 #include "nfa_api.h" 29 30 31 /***************************************************************************** 32 ** Constants and data types 33 *****************************************************************************/ 34 35 /* DM events */ 36 enum 37 { 38 /* device manager local device API events */ 39 NFA_DM_API_ENABLE_EVT = NFA_SYS_EVT_START (NFA_ID_DM), 40 NFA_DM_API_DISABLE_EVT, 41 NFA_DM_API_SET_CONFIG_EVT, 42 NFA_DM_API_GET_CONFIG_EVT, 43 NFA_DM_API_REQUEST_EXCL_RF_CTRL_EVT, 44 NFA_DM_API_RELEASE_EXCL_RF_CTRL_EVT, 45 NFA_DM_API_ENABLE_POLLING_EVT, 46 NFA_DM_API_DISABLE_POLLING_EVT, 47 NFA_DM_API_RAW_FRAME_EVT, 48 NFA_DM_API_SET_P2P_LISTEN_TECH_EVT, 49 NFA_DM_API_START_RF_DISCOVERY_EVT, 50 NFA_DM_API_STOP_RF_DISCOVERY_EVT, 51 NFA_DM_API_SET_RF_DISC_DURATION_EVT, 52 NFA_DM_API_SELECT_EVT, 53 NFA_DM_API_UPDATE_RF_PARAMS_EVT, 54 NFA_DM_API_DEACTIVATE_EVT, 55 NFA_DM_API_POWER_OFF_SLEEP_EVT, 56 NFA_DM_API_REG_NDEF_HDLR_EVT, 57 NFA_DM_API_DEREG_NDEF_HDLR_EVT, 58 NFA_DM_API_REG_VSC_EVT, 59 NFA_DM_API_SEND_VSC_EVT, 60 NFA_DM_TIMEOUT_DISABLE_EVT, 61 NFA_DM_MAX_EVT 62 }; 63 64 65 /* data type for NFA_DM_API_ENABLE_EVT */ 66 typedef struct 67 { 68 BT_HDR hdr; 69 tNFA_DM_CBACK *p_dm_cback; 70 tNFA_CONN_CBACK *p_conn_cback; 71 } tNFA_DM_API_ENABLE; 72 73 /* data type for NFA_DM_API_DISABLE_EVT */ 74 typedef struct 75 { 76 BT_HDR hdr; 77 BOOLEAN graceful; 78 } tNFA_DM_API_DISABLE; 79 80 /* data type for NFA_DM_API_SET_CONFIG_EVT */ 81 typedef struct 82 { 83 BT_HDR hdr; 84 tNFA_PMID param_id; 85 UINT8 length; 86 UINT8 *p_data; 87 } tNFA_DM_API_SET_CONFIG; 88 89 /* data type for NFA_DM_API_GET_CONFIG_EVT */ 90 typedef struct 91 { 92 BT_HDR hdr; 93 UINT8 num_ids; 94 tNFA_PMID *p_pmids; 95 } tNFA_DM_API_GET_CONFIG; 96 97 /* data type for NFA_DM_API_REQ_EXCL_RF_CTRL_EVT */ 98 typedef struct 99 { 100 BT_HDR hdr; 101 tNFA_TECHNOLOGY_MASK poll_mask; 102 tNFA_LISTEN_CFG listen_cfg; 103 tNFA_CONN_CBACK *p_conn_cback; 104 tNFA_NDEF_CBACK *p_ndef_cback; 105 } tNFA_DM_API_REQ_EXCL_RF_CTRL; 106 107 /* data type for NFA_DM_API_ENABLE_POLLING_EVT */ 108 typedef struct 109 { 110 BT_HDR hdr; 111 tNFA_TECHNOLOGY_MASK poll_mask; 112 } tNFA_DM_API_ENABLE_POLL; 113 114 /* data type for NFA_DM_API_SET_P2P_LISTEN_TECH_EVT */ 115 typedef struct 116 { 117 BT_HDR hdr; 118 tNFA_TECHNOLOGY_MASK tech_mask; 119 } tNFA_DM_API_SET_P2P_LISTEN_TECH; 120 121 /* data type for NFA_DM_API_SELECT_EVT */ 122 typedef struct 123 { 124 BT_HDR hdr; 125 UINT8 rf_disc_id; 126 tNFA_NFC_PROTOCOL protocol; 127 tNFA_INTF_TYPE rf_interface; 128 } tNFA_DM_API_SELECT; 129 130 /* data type for NFA_DM_API_UPDATE_RF_PARAMS_EVT */ 131 typedef struct 132 { 133 BT_HDR hdr; 134 tNFA_RF_COMM_PARAMS params; 135 } tNFA_DM_API_UPDATE_RF_PARAMS; 136 137 /* data type for NFA_DM_API_DEACTIVATE_EVT */ 138 typedef struct 139 { 140 BT_HDR hdr; 141 BOOLEAN sleep_mode; 142 } tNFA_DM_API_DEACTIVATE; 143 144 /* data type for NFA_DM_API_SET_RF_DISC_DURATION_EVT */ 145 typedef struct 146 { 147 BT_HDR hdr; 148 UINT16 rf_disc_dur_ms; 149 } tNFA_DM_API_SET_RF_DISC_DUR; 150 #define NFA_RF_DISC_DURATION_MAX 0xFFFF 151 152 /* data type for NFA_DM_API_REG_NDEF_HDLR_EVT */ 153 #define NFA_NDEF_FLAGS_HANDLE_WHOLE_MESSAGE 0x01 154 #define NFA_NDEF_FLAGS_WKT_URI 0x02 155 #define NFA_NDEF_FLAGS_WHOLE_MESSAGE_NOTIFIED 0x04 156 157 typedef struct 158 { 159 BT_HDR hdr; 160 tNFA_HANDLE ndef_type_handle; 161 UINT8 flags; 162 tNFA_NDEF_CBACK *p_ndef_cback; 163 tNFA_TNF tnf; /* Type-name field of record-type that was registered. */ 164 tNFA_NDEF_URI_ID uri_id; /* URI prefix abrieviation (for NFA_RegisterNDefUriHandler) */ 165 UINT8 name_len; /* Length of type name or absolute URI */ 166 UINT8 name[1]; /* Type name or absolute URI of record-type that got was registered. */ 167 } tNFA_DM_API_REG_NDEF_HDLR; 168 169 /* data type for NFA_DM_API_DEREG_NDEF_HDLR_EVT */ 170 typedef struct 171 { 172 BT_HDR hdr; 173 tNFA_HANDLE ndef_type_handle; 174 } tNFA_DM_API_DEREG_NDEF_HDLR; 175 176 /* data type for NFA_DM_API_REG_VSC_EVT */ 177 typedef struct 178 { 179 BT_HDR hdr; 180 tNFA_VSC_CBACK *p_cback; 181 BOOLEAN is_register; 182 } tNFA_DM_API_REG_VSC; 183 184 /* data type for NFA_DM_API_SEND_VSC_EVT */ 185 typedef struct 186 { 187 BT_HDR hdr; 188 tNFA_VSC_CBACK *p_cback; 189 UINT8 oid; 190 UINT8 cmd_params_len; 191 UINT16 pad; /* add padding to ensure the size is big enough for offset=NCI_VSC_MSG_HDR_SIZE */ 192 UINT8 *p_cmd_params; 193 } tNFA_DM_API_SEND_VSC; 194 195 196 /* union of all data types */ 197 typedef union 198 { 199 /* GKI event buffer header */ 200 BT_HDR hdr; /* NFA_DM_API_RAW_FRAME_EVT */ 201 /* NFA_DM_API_MULTI_TECH_RSP_EVT */ 202 /* NFA_DM_API_RELEASE_EXCL_RF_CTRL */ 203 /* NFA_DM_API_DISABLE_POLLING_EVT */ 204 /* NFA_DM_API_START_RF_DISCOVERY_EVT */ 205 /* NFA_DM_API_STOP_RF_DISCOVERY_EVT */ 206 tNFA_DM_API_ENABLE enable; /* NFA_DM_API_ENABLE_EVT */ 207 tNFA_DM_API_DISABLE disable; /* NFA_DM_API_DISABLE_EVT */ 208 tNFA_DM_API_SET_CONFIG setconfig; /* NFA_DM_API_SET_CONFIG_EVT */ 209 tNFA_DM_API_GET_CONFIG getconfig; /* NFA_DM_API_GET_CONFIG_EVT */ 210 tNFA_DM_API_SET_RF_DISC_DUR disc_duration; /* NFA_DM_API_SET_RF_DISC_DURATION_EVT */ 211 tNFA_DM_API_REG_NDEF_HDLR reg_ndef_hdlr; /* NFA_DM_API_REG_NDEF_HDLR_EVT */ 212 tNFA_DM_API_DEREG_NDEF_HDLR dereg_ndef_hdlr; /* NFA_DM_API_DEREG_NDEF_HDLR_EVT */ 213 tNFA_DM_API_REQ_EXCL_RF_CTRL req_excl_rf_ctrl; /* NFA_DM_API_REQUEST_EXCL_RF_CTRL */ 214 tNFA_DM_API_ENABLE_POLL enable_poll; /* NFA_DM_API_ENABLE_POLLING_EVT */ 215 tNFA_DM_API_SET_P2P_LISTEN_TECH set_p2p_listen_tech;/* NFA_DM_API_SET_P2P_LISTEN_TECH_EVT */ 216 tNFA_DM_API_SELECT select; /* NFA_DM_API_SELECT_EVT */ 217 tNFA_DM_API_UPDATE_RF_PARAMS update_rf_params; /* NFA_DM_API_UPDATE_RF_PARAMS_EVT */ 218 tNFA_DM_API_DEACTIVATE deactivate; /* NFA_DM_API_DEACTIVATE_EVT */ 219 tNFA_DM_API_SEND_VSC send_vsc; /* NFA_DM_API_SEND_VSC_EVT */ 220 tNFA_DM_API_REG_VSC reg_vsc; /* NFA_DM_API_REG_VSC_EVT */ 221 } tNFA_DM_MSG; 222 223 /* DM RF discovery state */ 224 enum 225 { 226 NFA_DM_RFST_IDLE, /* idle state */ 227 NFA_DM_RFST_DISCOVERY, /* discovery state */ 228 NFA_DM_RFST_W4_ALL_DISCOVERIES, /* wait for all discoveries state */ 229 NFA_DM_RFST_W4_HOST_SELECT, /* wait for host selection state */ 230 NFA_DM_RFST_POLL_ACTIVE, /* poll mode activated state */ 231 NFA_DM_RFST_LISTEN_ACTIVE, /* listen mode activated state */ 232 NFA_DM_RFST_LISTEN_SLEEP, /* listen mode sleep state */ 233 NFA_DM_RFST_LP_LISTEN, /* Listening in Low Power mode */ 234 NFA_DM_RFST_LP_ACTIVE /* Activated in Low Power mode */ 235 }; 236 typedef UINT8 tNFA_DM_RF_DISC_STATE; 237 238 /* DM RF discovery state machine event */ 239 enum 240 { 241 NFA_DM_RF_DISCOVER_CMD, /* start RF discovery */ 242 NFA_DM_RF_DISCOVER_RSP, /* discover response from NFCC */ 243 NFA_DM_RF_DISCOVER_NTF, /* RF discovery NTF from NFCC */ 244 NFA_DM_RF_DISCOVER_SELECT_CMD, /* select discovered target */ 245 NFA_DM_RF_DISCOVER_SELECT_RSP, /* select response from NFCC */ 246 NFA_DM_RF_INTF_ACTIVATED_NTF, /* RF interface activation NTF from NFCC */ 247 NFA_DM_RF_DEACTIVATE_CMD, /* deactivate RF interface */ 248 NFA_DM_RF_DEACTIVATE_RSP, /* deactivate response from NFCC */ 249 NFA_DM_RF_DEACTIVATE_NTF, /* deactivate RF interface NTF from NFCC */ 250 NFA_DM_LP_LISTEN_CMD, /* NFCC is listening in low power mode */ 251 NFA_DM_CORE_INTF_ERROR_NTF, /* RF interface error NTF from NFCC */ 252 NFA_DM_DISC_SM_MAX_EVENT 253 }; 254 typedef UINT8 tNFA_DM_RF_DISC_SM_EVENT; 255 256 /* DM RF discovery state machine data */ 257 typedef struct 258 { 259 UINT8 rf_disc_id; 260 tNFA_NFC_PROTOCOL protocol; 261 tNFA_INTF_TYPE rf_interface; 262 } tNFA_DM_DISC_SELECT_PARAMS; 263 264 typedef union 265 { 266 tNFC_DISCOVER nfc_discover; /* discovery data from NFCC */ 267 tNFC_DEACT_TYPE deactivate_type; /* deactivation type */ 268 tNFA_DM_DISC_SELECT_PARAMS select; /* selected target information */ 269 } tNFA_DM_RF_DISC_DATA; 270 271 /* Callback event from NFA DM RF Discovery to other NFA sub-modules */ 272 enum 273 { 274 NFA_DM_RF_DISC_START_EVT, /* discovery started with protocol, technology and mode */ 275 NFA_DM_RF_DISC_ACTIVATED_EVT, /* activated with configured protocol, technology and mode */ 276 NFA_DM_RF_DISC_DEACTIVATED_EVT, /* deactivated sleep or idle */ 277 NFA_DM_RF_DISC_CMD_IDLE_CMPL_EVT /* deactivated to idle from host select or listen sleep state */ 278 /* by DH request */ 279 }; 280 typedef UINT8 tNFA_DM_RF_DISC_EVT; 281 282 /* Combined NFC Technology and protocol bit mask */ 283 #define NFA_DM_DISC_MASK_PA_T1T 0x00000001 284 #define NFA_DM_DISC_MASK_PA_T2T 0x00000002 285 #define NFA_DM_DISC_MASK_PA_ISO_DEP 0x00000004 286 #define NFA_DM_DISC_MASK_PA_NFC_DEP 0x00000008 287 #define NFA_DM_DISC_MASK_PB_ISO_DEP 0x00000010 288 #define NFA_DM_DISC_MASK_PF_T3T 0x00000020 289 #define NFA_DM_DISC_MASK_PF_NFC_DEP 0x00000040 290 #define NFA_DM_DISC_MASK_P_ISO15693 0x00000100 291 #define NFA_DM_DISC_MASK_P_B_PRIME 0x00000200 292 #define NFA_DM_DISC_MASK_P_KOVIO 0x00000400 293 #define NFA_DM_DISC_MASK_PAA_NFC_DEP 0x00000800 294 #define NFA_DM_DISC_MASK_PFA_NFC_DEP 0x00001000 295 #define NFA_DM_DISC_MASK_P_LEGACY 0x00002000 /* Legacy/proprietary/non-NFC Forum protocol (e.g Shanghai transit card) */ 296 #define NFA_DM_DISC_MASK_POLL 0x0000FFFF 297 298 #define NFA_DM_DISC_MASK_LA_T1T 0x00010000 299 #define NFA_DM_DISC_MASK_LA_T2T 0x00020000 300 #define NFA_DM_DISC_MASK_LA_ISO_DEP 0x00040000 301 #define NFA_DM_DISC_MASK_LA_NFC_DEP 0x00080000 302 #define NFA_DM_DISC_MASK_LB_ISO_DEP 0x00100000 303 #define NFA_DM_DISC_MASK_LF_T3T 0x00200000 304 #define NFA_DM_DISC_MASK_LF_NFC_DEP 0x00400000 305 #define NFA_DM_DISC_MASK_L_ISO15693 0x01000000 306 #define NFA_DM_DISC_MASK_L_B_PRIME 0x02000000 307 #define NFA_DM_DISC_MASK_LAA_NFC_DEP 0x04000000 308 #define NFA_DM_DISC_MASK_LFA_NFC_DEP 0x08000000 309 #define NFA_DM_DISC_MASK_L_LEGACY 0x10000000 310 #define NFA_DM_DISC_MASK_LISTEN 0xFFFF0000 311 312 typedef UINT32 tNFA_DM_DISC_TECH_PROTO_MASK; 313 314 315 /* DM RF discovery host ID */ 316 #define NFA_DM_DISC_HOST_ID_DH NFC_DH_ID 317 typedef UINT8 tNFA_DM_DISC_HOST_ID; 318 319 /* DM deactivation callback type */ 320 typedef void (tNFA_DISCOVER_CBACK) (tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER *p_data); 321 322 /* DM RF discovery action flags */ 323 #define NFA_DM_DISC_FLAGS_ENABLED 0x0001 /* RF discovery process has been started */ 324 #define NFA_DM_DISC_FLAGS_STOPPING 0x0002 /* Stop RF discovery is pending */ 325 #define NFA_DM_DISC_FLAGS_DISABLING 0x0004 /* Disable NFA is pending */ 326 #define NFA_DM_DISC_FLAGS_CHECKING 0x0008 /* Presence check/unknown protocol in progress */ 327 #define NFA_DM_DISC_FLAGS_NOTIFY 0x0010 /* Notify sub-module that discovery is starting */ 328 #define NFA_DM_DISC_FLAGS_W4_RSP 0x0020 /* command has been sent to NFCC in the state */ 329 #define NFA_DM_DISC_FLAGS_W4_NTF 0x0040 /* wait for NTF before changing discovery state */ 330 331 typedef UINT16 tNFA_DM_DISC_FLAGS; 332 333 /* DM Discovery control block */ 334 typedef struct 335 { 336 BOOLEAN in_use; /* TRUE if used */ 337 tNFA_DISCOVER_CBACK *p_disc_cback; /* discovery callback */ 338 339 tNFA_DM_DISC_FLAGS disc_flags; /* specific action flags */ 340 tNFA_DM_DISC_HOST_ID host_id; /* DH or UICC1/UICC2 */ 341 tNFA_DM_DISC_TECH_PROTO_MASK requested_disc_mask;/* technology and protocol requested */ 342 tNFA_DM_DISC_TECH_PROTO_MASK selected_disc_mask; /* technology and protocol waiting for activation */ 343 } tNFA_DM_DISC_ENTRY; 344 345 #define NFA_DM_DISC_NUM_ENTRIES 8 /* polling, raw listen, P2P listen, NDEF CE, 2xVSE, 2xUICC */ 346 347 #define NFA_DM_MAX_DISC_PARAMS 16 /* max discovery technology parameters */ 348 349 /* index of listen mode routing table for technologies */ 350 enum { 351 NFA_DM_DISC_LRT_NFC_A, 352 NFA_DM_DISC_LRT_NFC_B, 353 NFA_DM_DISC_LRT_NFC_F, 354 NFA_DM_DISC_LRT_NFC_BP 355 }; 356 357 /* SLP_REQ (HLTA) command */ 358 #define SLP_REQ_CMD 0x5000 359 #define NFA_DM_MAX_TECH_ROUTE 4 /* NFA_EE_MAX_TECH_ROUTE. only A, B, F, Bprime are supported by UICC now */ 360 361 typedef struct 362 { 363 UINT16 disc_duration; /* Disc duration */ 364 tNFA_DM_DISC_FLAGS disc_flags; /* specific action flags */ 365 tNFA_DM_RF_DISC_STATE disc_state; /* RF discovery state */ 366 367 tNFC_RF_TECH_N_MODE activated_tech_mode; /* activated technology and mode */ 368 UINT8 activated_rf_disc_id; /* activated RF discovery ID */ 369 tNFA_INTF_TYPE activated_rf_interface; /* activated RF interface */ 370 tNFA_NFC_PROTOCOL activated_protocol; /* activated protocol */ 371 tNFA_HANDLE activated_handle; /* handle of activated sub-module */ 372 UINT8 activated_sel_res; /* activated tag's SEL_RES response */ 373 374 tNFA_DM_DISC_ENTRY entry[NFA_DM_DISC_NUM_ENTRIES]; 375 376 tNFA_DM_DISC_ENTRY excl_disc_entry; /* exclusive RF discovery */ 377 tNFA_LISTEN_CFG excl_listen_config; /* listen cfg for exclusive-rf mode */ 378 379 UINT8 listen_RT[NFA_DM_MAX_TECH_ROUTE];/* Host ID for A, B, F, B' technology routing*/ 380 tNFA_DM_DISC_TECH_PROTO_MASK dm_disc_mask; /* technology and protocol waiting for activation */ 381 382 } tNFA_DM_DISC_CB; 383 384 /* NDEF Type Handler Definitions */ 385 #define NFA_NDEF_DEFAULT_HANDLER_IDX 0 /* Default handler entry in ndef_handler table */ 386 387 #define NFA_PARAM_ID_INVALID 0xFF 388 389 /* Maximum number of pending SetConfigs */ 390 #define NFA_DM_SETCONFIG_PENDING_MAX 32 391 392 /* NFA_DM flags */ 393 #define NFA_DM_FLAGS_DM_IS_ACTIVE 0x00000001 /* DM is enabled */ 394 #define NFA_DM_FLAGS_EXCL_RF_ACTIVE 0x00000002 /* Exclusive RF mode is active */ 395 #define NFA_DM_FLAGS_POLLING_ENABLED 0x00000004 /* Polling is enabled (while not in exclusive RF mode */ 396 #define NFA_DM_FLAGS_SEND_POLL_STOP_EVT 0x00000008 /* send poll stop event */ 397 #define NFA_DM_FLAGS_AUTO_READING_NDEF 0x00000010 /* auto reading of NDEF in progress */ 398 #define NFA_DM_FLAGS_ENABLE_EVT_PEND 0x00000020 /* NFA_DM_ENABLE_EVT is not reported yet */ 399 #define NFA_DM_FLAGS_SEND_DEACTIVATED_EVT 0x00000040 /* Send NFA_DEACTIVATED_EVT when deactivated */ 400 #define NFA_DM_FLAGS_NFCC_IS_RESTORING 0x00000100 /* NFCC is restoring after back to full power mode */ 401 #define NFA_DM_FLAGS_SETTING_PWR_MODE 0x00000200 /* NFCC power mode is updating */ 402 #define NFA_DM_FLAGS_DM_DISABLING_NFC 0x00000400 /* NFA DM is disabling NFC */ 403 /* stored parameters */ 404 typedef struct 405 { 406 UINT8 total_duration[NCI_PARAM_LEN_TOTAL_DURATION]; 407 408 UINT8 la_bit_frame_sdd[NCI_PARAM_LEN_LA_BIT_FRAME_SDD]; 409 UINT8 la_bit_frame_sdd_len; 410 UINT8 la_platform_config[NCI_PARAM_LEN_LA_PLATFORM_CONFIG]; 411 UINT8 la_platform_config_len; 412 UINT8 la_sel_info[NCI_PARAM_LEN_LA_SEL_INFO]; 413 UINT8 la_sel_info_len; 414 UINT8 la_nfcid1[NCI_NFCID1_MAX_LEN]; 415 UINT8 la_nfcid1_len; 416 UINT8 la_hist_by[NCI_MAX_HIS_BYTES_LEN]; 417 UINT8 la_hist_by_len; 418 419 UINT8 lb_sensb_info[NCI_PARAM_LEN_LB_SENSB_INFO]; 420 UINT8 lb_sensb_info_len; 421 UINT8 lb_nfcid0[NCI_PARAM_LEN_LB_NFCID0]; 422 UINT8 lb_nfcid0_len; 423 UINT8 lb_appdata[NCI_PARAM_LEN_LB_APPDATA]; 424 UINT8 lb_appdata_len; 425 UINT8 lb_adc_fo[NCI_PARAM_LEN_LB_ADC_FO]; 426 UINT8 lb_adc_fo_len; 427 UINT8 lb_h_info[NCI_MAX_ATTRIB_LEN]; 428 UINT8 lb_h_info_len; 429 430 UINT8 lf_protocol[NCI_PARAM_LEN_LF_PROTOCOL]; 431 UINT8 lf_protocol_len; 432 UINT8 lf_t3t_flags2[NCI_PARAM_LEN_LF_T3T_FLAGS2]; 433 UINT8 lf_t3t_flags2_len; 434 UINT8 lf_t3t_pmm[NCI_PARAM_LEN_LF_T3T_PMM]; 435 UINT8 lf_t3t_id[NFA_CE_LISTEN_INFO_MAX][NCI_PARAM_LEN_LF_T3T_ID]; 436 437 UINT8 fwi[NCI_PARAM_LEN_FWI]; 438 UINT8 wt[NCI_PARAM_LEN_WT]; 439 UINT8 atr_req_gen_bytes[NCI_MAX_GEN_BYTES_LEN]; 440 UINT8 atr_req_gen_bytes_len; 441 UINT8 atr_res_gen_bytes[NCI_MAX_GEN_BYTES_LEN]; 442 UINT8 atr_res_gen_bytes_len; 443 } tNFA_DM_PARAMS; 444 445 /* DM control block */ 446 typedef struct 447 { 448 UINT32 flags; /* NFA_DM flags (see definitions for NFA_DM_FLAGS_*) */ 449 tNFA_DM_CBACK *p_dm_cback; /* NFA DM callback */ 450 TIMER_LIST_ENT tle; 451 452 BOOLEAN presence_check_deact_pending; /* TRUE if deactivate while checking presence */ 453 tNFA_DEACTIVATE_TYPE presence_check_deact_type; /* deactivate type */ 454 455 /* NFC link connection management */ 456 tNFA_CONN_CBACK *p_conn_cback; /* callback for connection events */ 457 tNFA_TECHNOLOGY_MASK poll_mask; /* technologies being polled */ 458 459 tNFA_CONN_CBACK *p_excl_conn_cback; /* exclusive RF mode callback */ 460 tNFA_NDEF_CBACK *p_excl_ndef_cback; /* ndef callback for exclusive RF mdoe */ 461 462 tNFA_HANDLE poll_disc_handle; /* discovery handle for polling */ 463 464 UINT8 *p_activate_ntf; /* temp holding activation notfication */ 465 466 UINT8 activated_nfcid[NCI_NFCID1_MAX_LEN]; 467 /* NFCID 0/1/2 or UID of ISO15694 */ 468 UINT8 activated_nfcid_len;/* length of NFCID ot UID */ 469 470 /* NFC link discovery management */ 471 tNFA_DM_DISC_CB disc_cb; 472 473 /* NDEF Type handler */ 474 tNFA_DM_API_REG_NDEF_HDLR *p_ndef_handler[NFA_NDEF_MAX_HANDLERS]; /* ndef handler table */ 475 476 /* stored parameters */ 477 tNFA_DM_PARAMS params; 478 479 /* SetConfig management */ 480 UINT32 setcfg_pending_mask; /* Mask of to indicate whether pending SET_CONFIGs require NFA_DM_SET_CONFIG_EVT. LSB=oldest pending */ 481 UINT8 setcfg_pending_num; /* Number of setconfigs pending */ 482 483 /* NFCC power mode */ 484 UINT8 nfcc_pwr_mode; /* NFA_DM_PWR_MODE_FULL or NFA_DM_PWR_MODE_OFF_SLEEP */ 485 } tNFA_DM_CB; 486 487 /* Internal function prototypes */ 488 void nfa_dm_ndef_handle_message (tNFA_STATUS status, UINT8 *p_msg_buf, UINT32 len); 489 void nfa_dm_ndef_dereg_all (void); 490 void nfa_dm_act_conn_cback_notify (UINT8 event, tNFA_CONN_EVT_DATA *p_data); 491 void nfa_dm_notify_activation_status (tNFA_STATUS status, tNFA_TAG_PARAMS *p_params); 492 void nfa_dm_disable_complete (void); 493 494 /* Internal functions from nfa_rw */ 495 void nfa_rw_init (void); 496 void nfa_rw_proc_disc_evt (tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER *p_data, BOOLEAN excl_rf_not_active); 497 tNFA_STATUS nfa_rw_send_raw_frame (BT_HDR *p_data); 498 499 /* Internal functions from nfa_ce */ 500 void nfa_ce_init (void); 501 502 /* Pointer to compile-time configuration structure */ 503 extern tNFA_DM_CFG *p_nfa_dm_cfg; 504 extern UINT8 *p_nfa_dm_ce_cfg; 505 extern UINT8 *p_nfa_dm_gen_cfg; 506 extern UINT8 nfa_ee_max_ee_cfg; 507 extern tNCI_DISCOVER_MAPS *p_nfa_dm_interface_mapping; 508 extern UINT8 nfa_dm_num_dm_interface_mapping; 509 510 /* NFA device manager control block */ 511 #if NFA_DYNAMIC_MEMORY == FALSE 512 extern tNFA_DM_CB nfa_dm_cb; 513 #else 514 extern tNFA_DM_CB *nfa_dm_cb_ptr; 515 #define nfa_dm_cb (*nfa_dm_cb_ptr) 516 #endif 517 518 void nfa_dm_init (void); 519 void nfa_p2p_init (void); 520 void nfa_cho_init (void); 521 void nfa_snep_init (BOOLEAN is_dta_mode); 522 void nfa_dta_init (void); 523 #if (NFC_NFCEE_INCLUDED == TRUE) 524 void nfa_ee_init (void); 525 void nfa_hci_init (void); 526 #else 527 #define nfa_ee_init() 528 #define nfa_hci_init() 529 #endif 530 531 /* Action function prototypes */ 532 BOOLEAN nfa_dm_enable (tNFA_DM_MSG *p_data); 533 BOOLEAN nfa_dm_disable (tNFA_DM_MSG *p_data); 534 BOOLEAN nfa_dm_set_config (tNFA_DM_MSG *p_data); 535 BOOLEAN nfa_dm_get_config (tNFA_DM_MSG *p_data); 536 BOOLEAN nfa_dm_act_request_excl_rf_ctrl (tNFA_DM_MSG *p_data); 537 BOOLEAN nfa_dm_act_release_excl_rf_ctrl (tNFA_DM_MSG *p_data); 538 BOOLEAN nfa_dm_act_enable_polling (tNFA_DM_MSG *p_data); 539 BOOLEAN nfa_dm_act_disable_polling (tNFA_DM_MSG *p_data); 540 BOOLEAN nfa_dm_act_send_raw_frame (tNFA_DM_MSG *p_data); 541 BOOLEAN nfa_dm_set_p2p_listen_tech (tNFA_DM_MSG *p_data); 542 BOOLEAN nfa_dm_act_start_rf_discovery (tNFA_DM_MSG *p_data); 543 BOOLEAN nfa_dm_act_stop_rf_discovery (tNFA_DM_MSG *p_data); 544 BOOLEAN nfa_dm_act_set_rf_disc_duration (tNFA_DM_MSG *p_data); 545 BOOLEAN nfa_dm_act_select (tNFA_DM_MSG *p_data); 546 BOOLEAN nfa_dm_act_update_rf_params (tNFA_DM_MSG *p_data); 547 BOOLEAN nfa_dm_act_deactivate (tNFA_DM_MSG *p_data); 548 BOOLEAN nfa_dm_act_power_off_sleep (tNFA_DM_MSG *p_data); 549 BOOLEAN nfa_dm_ndef_reg_hdlr (tNFA_DM_MSG *p_data); 550 BOOLEAN nfa_dm_ndef_dereg_hdlr (tNFA_DM_MSG *p_data); 551 BOOLEAN nfa_dm_tout (tNFA_DM_MSG *p_data); 552 BOOLEAN nfa_dm_act_reg_vsc (tNFA_DM_MSG *p_data); 553 BOOLEAN nfa_dm_act_send_vsc (tNFA_DM_MSG *p_data); 554 BOOLEAN nfa_dm_act_disable_timeout (tNFA_DM_MSG *p_data); 555 BOOLEAN nfa_dm_act_nfc_cback_data (tNFA_DM_MSG *p_data); 556 557 void nfa_dm_proc_nfcc_power_mode (UINT8 nfcc_power_mode); 558 559 /* Main function prototypes */ 560 BOOLEAN nfa_dm_evt_hdlr (BT_HDR *p_msg); 561 void nfa_dm_sys_enable (void); 562 void nfa_dm_sys_disable (void); 563 tNFA_STATUS nfa_dm_check_set_config (UINT8 tlv_list_len, UINT8 *p_tlv_list, BOOLEAN app_init); 564 565 void nfa_dm_conn_cback_event_notify (UINT8 event, tNFA_CONN_EVT_DATA *p_data); 566 567 /* Discovery function prototypes */ 568 void nfa_dm_disc_sm_execute (tNFA_DM_RF_DISC_SM_EVENT event, tNFA_DM_RF_DISC_DATA *p_data); 569 tNFA_HANDLE nfa_dm_add_rf_discover (tNFA_DM_DISC_TECH_PROTO_MASK disc_mask, tNFA_DM_DISC_HOST_ID host_id, tNFA_DISCOVER_CBACK *p_disc_cback); 570 void nfa_dm_delete_rf_discover (tNFA_HANDLE handle); 571 void nfa_dm_start_excl_discovery (tNFA_TECHNOLOGY_MASK poll_tech_mask, 572 tNFA_LISTEN_CFG *p_listen_cfg, 573 tNFA_DISCOVER_CBACK *p_disc_cback); 574 void nfa_dm_rel_excl_rf_control_and_notify (void); 575 void nfa_dm_stop_excl_discovery (void); 576 void nfa_dm_disc_new_state (tNFA_DM_RF_DISC_STATE new_state); 577 578 void nfa_dm_start_rf_discover (void); 579 void nfa_dm_rf_discover_select (UINT8 rf_disc_id, tNFA_NFC_PROTOCOL protocol, tNFA_INTF_TYPE rf_interface); 580 tNFA_STATUS nfa_dm_rf_deactivate (tNFA_DEACTIVATE_TYPE deactivate_type); 581 BOOLEAN nfa_dm_is_protocol_supported (tNFA_NFC_PROTOCOL protocol, UINT8 sel_res); 582 BOOLEAN nfa_dm_is_active (void); 583 tNFC_STATUS nfa_dm_disc_presence_check (void); 584 585 586 #if (NFC_NFCEE_INCLUDED == FALSE) 587 #define nfa_ee_get_tech_route(ps, ha) memset(ha, NFC_DH_ID, NFA_DM_MAX_TECH_ROUTE); 588 #endif 589 590 #if (BT_TRACE_VERBOSE == TRUE) 591 char *nfa_dm_nfc_revt_2_str (tNFC_RESPONSE_EVT event); 592 #endif 593 594 595 #endif /* NFA_DM_INT_H */ 596 597