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 private interface file for the NFA EE. 22 * 23 ******************************************************************************/ 24 #ifndef NFA_EE_INT_H 25 #define NFA_EE_INT_H 26 #include "nfa_ee_api.h" 27 #include "nfa_sys.h" 28 #include "nfc_api.h" 29 30 /***************************************************************************** 31 ** Constants and data types 32 *****************************************************************************/ 33 /* the number of tNFA_EE_ECBs (for NFCEEs and DH) */ 34 #define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED + 1) 35 /* The index for DH in nfa_ee_cb.ee_cb[] */ 36 #define NFA_EE_CB_4_DH NFA_EE_MAX_EE_SUPPORTED 37 #define NFA_EE_INVALID 0xFF 38 /* only A, B, F, Bprime are supported by UICC now */ 39 #define NFA_EE_MAX_TECH_ROUTE 4 40 41 #ifndef NFA_EE_AID_CFG_TAG_NAME 42 /* AID */ 43 #define NFA_EE_AID_CFG_TAG_NAME 0x4F 44 #endif 45 46 /* NFA EE events */ 47 enum { 48 NFA_EE_API_DISCOVER_EVT = NFA_SYS_EVT_START(NFA_ID_EE), 49 NFA_EE_API_REGISTER_EVT, 50 NFA_EE_API_DEREGISTER_EVT, 51 NFA_EE_API_MODE_SET_EVT, 52 NFA_EE_API_SET_TECH_CFG_EVT, 53 NFA_EE_API_CLEAR_TECH_CFG_EVT, 54 NFA_EE_API_SET_PROTO_CFG_EVT, 55 NFA_EE_API_CLEAR_PROTO_CFG_EVT, 56 NFA_EE_API_ADD_AID_EVT, 57 NFA_EE_API_REMOVE_AID_EVT, 58 NFA_EE_API_ADD_SYSCODE_EVT, 59 NFA_EE_API_REMOVE_SYSCODE_EVT, 60 NFA_EE_API_LMRT_SIZE_EVT, 61 NFA_EE_API_UPDATE_NOW_EVT, 62 NFA_EE_API_CONNECT_EVT, 63 NFA_EE_API_SEND_DATA_EVT, 64 NFA_EE_API_DISCONNECT_EVT, 65 66 NFA_EE_NCI_DISC_RSP_EVT, 67 NFA_EE_NCI_DISC_NTF_EVT, 68 NFA_EE_NCI_MODE_SET_RSP_EVT, 69 NFA_EE_NCI_CONN_EVT, 70 NFA_EE_NCI_DATA_EVT, 71 NFA_EE_NCI_ACTION_NTF_EVT, 72 NFA_EE_NCI_DISC_REQ_NTF_EVT, 73 NFA_EE_NCI_WAIT_RSP_EVT, 74 75 NFA_EE_ROUT_TIMEOUT_EVT, 76 NFA_EE_DISCV_TIMEOUT_EVT, 77 NFA_EE_CFG_TO_NFCC_EVT, 78 NFA_EE_NCI_NFCEE_STATUS_NTF_EVT, 79 NFA_EE_MAX_EVT 80 81 }; 82 83 typedef uint16_t tNFA_EE_INT_EVT; 84 /* for listen mode routing table*/ 85 #define NFA_EE_AE_ROUTE 0x80 86 #define NFA_EE_AE_VS 0x40 87 88 /* NFA EE Management state */ 89 enum { 90 NFA_EE_EM_STATE_INIT = 0, 91 NFA_EE_EM_STATE_INIT_DONE, 92 NFA_EE_EM_STATE_RESTORING, 93 NFA_EE_EM_STATE_DISABLING, 94 NFA_EE_EM_STATE_DISABLED, 95 96 NFA_EE_EM_STATE_MAX 97 }; 98 typedef uint8_t tNFA_EE_EM_STATE; 99 100 /* NFA EE connection status */ 101 enum { 102 NFA_EE_CONN_ST_NONE, /* not connected */ 103 NFA_EE_CONN_ST_WAIT, /* connection is initiated; waiting for ack */ 104 NFA_EE_CONN_ST_CONN, /* connected; can send/receive data */ 105 NFA_EE_CONN_ST_DISC /* disconnecting; waiting for ack */ 106 }; 107 typedef uint8_t tNFA_EE_CONN_ST; 108 109 #define NFA_EE_MAX_AID_CFG_LEN (510) 110 // Technology A/B/F reserved: 5*3 = 15 111 // Protocol ISODEP/NFCDEP/T3T reserved: 5*3 = 15 112 // Extends (APDU pattern/SC)reserved: 30 113 #define NFA_EE_MAX_PROTO_TECH_EXT_ROUTE_LEN 60 114 115 #define NFA_EE_SYSTEM_CODE_LEN 02 116 #define NFA_EE_SYSTEM_CODE_TLV_SIZE 06 117 #define NFA_EE_MAX_SYSTEM_CODE_ENTRIES 10 118 #define NFA_EE_MAX_SYSTEM_CODE_CFG_LEN \ 119 (NFA_EE_MAX_SYSTEM_CODE_ENTRIES * NFA_EE_SYSTEM_CODE_TLV_SIZE) 120 121 /* NFA EE control block flags: 122 * use to indicate an API function has changed the configuration of the 123 * associated NFCEE 124 * The flags are cleared when the routing table/VS is updated */ 125 /* technology routing changed */ 126 #define NFA_EE_ECB_FLAGS_TECH 0x02 127 /* protocol routing changed */ 128 #define NFA_EE_ECB_FLAGS_PROTO 0x04 129 /* AID routing changed */ 130 #define NFA_EE_ECB_FLAGS_AID 0x08 131 /* System Code routing changed */ 132 #define NFA_EE_ECB_FLAGS_SYSCODE 0xE0 133 /* VS changed */ 134 #define NFA_EE_ECB_FLAGS_VS 0x10 135 /* Restore related */ 136 #define NFA_EE_ECB_FLAGS_RESTORE 0x20 137 /* routing flags changed */ 138 #define NFA_EE_ECB_FLAGS_ROUTING 0x0E 139 /* NFCEE Discover Request NTF is set */ 140 #define NFA_EE_ECB_FLAGS_DISC_REQ 0x40 141 /* DISC_REQ N reported before DISC N */ 142 #define NFA_EE_ECB_FLAGS_ORDER 0x80 143 typedef uint8_t tNFA_EE_ECB_FLAGS; 144 145 /* part of tNFA_EE_STATUS; for internal use only */ 146 /* waiting for restore to full power mode to complete */ 147 #define NFA_EE_STATUS_RESTORING 0x20 148 /* this bit is in ee_status for internal use only */ 149 #define NFA_EE_STATUS_INT_MASK 0x20 150 151 /* NFA-EE information for a particular NFCEE Entity (including DH) */ 152 typedef struct { 153 tNFA_TECHNOLOGY_MASK 154 tech_switch_on; /* default routing - technologies switch_on */ 155 tNFA_TECHNOLOGY_MASK 156 tech_switch_off; /* default routing - technologies switch_off */ 157 tNFA_TECHNOLOGY_MASK 158 tech_battery_off; /* default routing - technologies battery_off*/ 159 tNFA_TECHNOLOGY_MASK 160 tech_screen_lock; /* default routing - technologies screen_lock*/ 161 tNFA_TECHNOLOGY_MASK 162 tech_screen_off; /* default routing - technologies screen_off*/ 163 tNFA_TECHNOLOGY_MASK 164 tech_screen_off_lock; /* default routing - technologies screen_off_lock*/ 165 tNFA_PROTOCOL_MASK 166 proto_switch_on; /* default routing - protocols switch_on */ 167 tNFA_PROTOCOL_MASK 168 proto_switch_off; /* default routing - protocols switch_off */ 169 tNFA_PROTOCOL_MASK 170 proto_battery_off; /* default routing - protocols battery_off */ 171 tNFA_PROTOCOL_MASK 172 proto_screen_lock; /* default routing - protocols screen_lock */ 173 tNFA_PROTOCOL_MASK 174 proto_screen_off; /* default routing - protocols screen_off */ 175 tNFA_PROTOCOL_MASK 176 proto_screen_off_lock; /* default routing - protocols screen_off_lock */ 177 tNFA_EE_CONN_ST conn_st; /* connection status */ 178 uint8_t conn_id; /* connection id */ 179 tNFA_EE_CBACK* p_ee_cback; /* the callback function */ 180 181 /* Each AID entry has an ssociated aid_len, aid_pwr_cfg, aid_rt_info. 182 * aid_cfg[] contains AID and maybe some other VS information in TLV format 183 * The first T is always NFA_EE_AID_CFG_TAG_NAME, the L is the actual AID 184 * length 185 * the aid_len is the total length of all the TLVs associated with this AID 186 * entry 187 */ 188 uint8_t* aid_len; /* the actual lengths in aid_cfg */ 189 uint8_t* aid_pwr_cfg; /* power configuration of this 190 AID entry */ 191 uint8_t* aid_rt_info; /* route/vs info for this AID 192 entry */ 193 uint8_t* aid_cfg; /* routing entries based on AID */ 194 uint8_t* aid_info; /* Aid Info Prefix/Suffix/Exact */ 195 196 uint8_t aid_entries; /* The number of AID entries in aid_cfg */ 197 uint8_t nfcee_id; /* ID for this NFCEE */ 198 uint8_t ee_status; /* The NFCEE status */ 199 uint8_t ee_old_status; /* The NFCEE status before going to low power mode */ 200 tNFA_EE_INTERFACE 201 ee_interface[NFC_MAX_EE_INTERFACE]; /* NFCEE supported interface */ 202 tNFA_EE_TLV ee_tlv[NFC_MAX_EE_TLVS]; /* the TLV */ 203 uint8_t num_interface; /* number of Target interface */ 204 uint8_t num_tlvs; /* number of TLVs */ 205 uint8_t ee_power_supply_status; /* power supply of NFCEE*/ 206 tNFA_EE_ECB_FLAGS ecb_flags; /* the flags of this control block */ 207 tNFA_EE_INTERFACE use_interface; /* NFCEE interface used for the connection */ 208 tNFA_NFC_PROTOCOL la_protocol; /* Listen A protocol */ 209 tNFA_NFC_PROTOCOL lb_protocol; /* Listen B protocol */ 210 tNFA_NFC_PROTOCOL lf_protocol; /* Listen F protocol */ 211 tNFA_NFC_PROTOCOL lbp_protocol; /* Listen B' protocol */ 212 uint8_t size_mask_proto; /* the size for protocol routing */ 213 uint8_t size_mask_tech; /* the size for technology routing */ 214 uint16_t size_aid; /* the size for aid routing */ 215 /*System Code Based Routing Variables*/ 216 uint8_t sys_code_cfg[NFA_EE_MAX_SYSTEM_CODE_ENTRIES * NFA_EE_SYSTEM_CODE_LEN]; 217 uint8_t sys_code_pwr_cfg[NFA_EE_MAX_SYSTEM_CODE_ENTRIES]; 218 uint8_t sys_code_rt_loc[NFA_EE_MAX_SYSTEM_CODE_ENTRIES]; 219 uint8_t sys_code_rt_loc_vs_info[NFA_EE_MAX_SYSTEM_CODE_ENTRIES]; 220 /* The number of SC entries in sys_code_cfg buffer*/ 221 uint8_t sys_code_cfg_entries; 222 uint16_t size_sys_code; /* The size for system code routing */ 223 } tNFA_EE_ECB; 224 225 /* data type for NFA_EE_API_DISCOVER_EVT */ 226 typedef struct { 227 NFC_HDR hdr; 228 tNFA_EE_CBACK* p_cback; 229 } tNFA_EE_API_DISCOVER; 230 231 /* data type for NFA_EE_API_REGISTER_EVT */ 232 typedef struct { 233 NFC_HDR hdr; 234 tNFA_EE_CBACK* p_cback; 235 } tNFA_EE_API_REGISTER; 236 237 /* data type for NFA_EE_API_DEREGISTER_EVT */ 238 typedef struct { 239 NFC_HDR hdr; 240 int index; 241 } tNFA_EE_API_DEREGISTER; 242 243 /* data type for NFA_EE_API_MODE_SET_EVT */ 244 typedef struct { 245 NFC_HDR hdr; 246 tNFA_EE_ECB* p_cb; 247 uint8_t nfcee_id; 248 uint8_t mode; 249 } tNFA_EE_API_MODE_SET; 250 251 /* data type for NFA_EE_API_SET_TECH_CFG_EVT */ 252 typedef struct { 253 NFC_HDR hdr; 254 tNFA_EE_ECB* p_cb; 255 uint8_t nfcee_id; 256 tNFA_TECHNOLOGY_MASK technologies_switch_on; 257 tNFA_TECHNOLOGY_MASK technologies_switch_off; 258 tNFA_TECHNOLOGY_MASK technologies_battery_off; 259 tNFA_TECHNOLOGY_MASK technologies_screen_lock; 260 tNFA_TECHNOLOGY_MASK technologies_screen_off; 261 tNFA_TECHNOLOGY_MASK technologies_screen_off_lock; 262 } tNFA_EE_API_SET_TECH_CFG, tNFA_EE_API_CLEAR_TECH_CFG; 263 264 /* data type for NFA_EE_API_SET_PROTO_CFG_EVT */ 265 typedef struct { 266 NFC_HDR hdr; 267 tNFA_EE_ECB* p_cb; 268 uint8_t nfcee_id; 269 tNFA_PROTOCOL_MASK protocols_switch_on; 270 tNFA_PROTOCOL_MASK protocols_switch_off; 271 tNFA_PROTOCOL_MASK protocols_battery_off; 272 tNFA_PROTOCOL_MASK protocols_screen_lock; 273 tNFA_PROTOCOL_MASK protocols_screen_off; 274 tNFA_PROTOCOL_MASK protocols_screen_off_lock; 275 } tNFA_EE_API_SET_PROTO_CFG, tNFA_EE_API_CLEAR_PROTO_CFG; 276 277 /* data type for NFA_EE_API_ADD_AID_EVT */ 278 typedef struct { 279 NFC_HDR hdr; 280 tNFA_EE_ECB* p_cb; 281 uint8_t nfcee_id; 282 uint8_t aid_len; 283 uint8_t* p_aid; 284 tNFA_EE_PWR_STATE power_state; 285 uint8_t aidInfo; 286 } tNFA_EE_API_ADD_AID; 287 288 /* data type for NFA_EE_API_REMOVE_AID_EVT */ 289 typedef struct { 290 NFC_HDR hdr; 291 uint8_t aid_len; 292 uint8_t* p_aid; 293 } tNFA_EE_API_REMOVE_AID; 294 295 /* data type for NFA_EE_API_ADD_SYSCODE_EVT */ 296 typedef struct { 297 NFC_HDR hdr; 298 tNFA_EE_ECB* p_cb; 299 uint8_t nfcee_id; 300 uint16_t syscode; 301 tNFA_EE_PWR_STATE power_state; 302 } tNFA_EE_API_ADD_SYSCODE; 303 304 /* data type for NFA_EE_API_REMOVE_SYSCODE_EVT */ 305 typedef struct { 306 NFC_HDR hdr; 307 uint16_t syscode; 308 } tNFA_EE_API_REMOVE_SYSCODE; 309 310 /* data type for NFA_EE_API_LMRT_SIZE_EVT */ 311 typedef NFC_HDR tNFA_EE_API_LMRT_SIZE; 312 313 /* data type for NFA_EE_API_CONNECT_EVT */ 314 typedef struct { 315 NFC_HDR hdr; 316 tNFA_EE_ECB* p_cb; 317 uint8_t nfcee_id; 318 uint8_t ee_interface; 319 tNFA_EE_CBACK* p_cback; 320 } tNFA_EE_API_CONNECT; 321 322 /* data type for NFA_EE_API_SEND_DATA_EVT */ 323 typedef struct { 324 NFC_HDR hdr; 325 tNFA_EE_ECB* p_cb; 326 uint8_t nfcee_id; 327 uint16_t data_len; 328 uint8_t* p_data; 329 } tNFA_EE_API_SEND_DATA; 330 331 /* data type for NFA_EE_API_DISCONNECT_EVT */ 332 typedef struct { 333 NFC_HDR hdr; 334 tNFA_EE_ECB* p_cb; 335 uint8_t nfcee_id; 336 } tNFA_EE_API_DISCONNECT; 337 338 /* common data type for internal events with nfa_ee_use_cfg_cb[] as TRUE */ 339 typedef struct { 340 NFC_HDR hdr; 341 tNFA_EE_ECB* p_cb; 342 uint8_t nfcee_id; 343 } tNFA_EE_CFG_HDR; 344 345 /* data type for NFA_EE_NCI_DISC_RSP_EVT */ 346 typedef struct { 347 NFC_HDR hdr; 348 tNFC_NFCEE_DISCOVER_REVT* p_data; 349 } tNFA_EE_NCI_DISC_RSP; 350 351 /* data type for NFA_EE_NCI_DISC_NTF_EVT */ 352 typedef struct { 353 NFC_HDR hdr; 354 tNFC_NFCEE_INFO_REVT* p_data; 355 } tNFA_EE_NCI_DISC_NTF; 356 357 /* data type for NFA_EE_NCI_MODE_SET_RSP_EVT */ 358 typedef struct { 359 NFC_HDR hdr; 360 tNFC_NFCEE_MODE_SET_REVT* p_data; 361 } tNFA_EE_NCI_MODE_SET; 362 363 /* data type for NFA_EE_NCI_WAIT_RSP_EVT */ 364 typedef struct { 365 NFC_HDR hdr; 366 void* p_data; 367 uint8_t opcode; 368 } tNFA_EE_NCI_WAIT_RSP; 369 370 /* data type for NFA_EE_NCI_CONN_EVT and NFA_EE_NCI_DATA_EVT */ 371 typedef struct { 372 NFC_HDR hdr; 373 uint8_t conn_id; 374 tNFC_CONN_EVT event; 375 tNFC_CONN* p_data; 376 } tNFA_EE_NCI_CONN; 377 378 /* data type for NFA_EE_NCI_ACTION_NTF_EVT */ 379 typedef struct { 380 NFC_HDR hdr; 381 tNFC_EE_ACTION_REVT* p_data; 382 } tNFA_EE_NCI_ACTION; 383 384 /* data type for NFA_EE_NCI_DISC_REQ_NTF_EVT */ 385 typedef struct { 386 NFC_HDR hdr; 387 tNFC_EE_DISCOVER_REQ_REVT* p_data; 388 } tNFA_EE_NCI_DISC_REQ; 389 390 /* data type for NFA_EE_NCI_NFCEE_STATUS_EVT */ 391 typedef struct { 392 NFC_HDR hdr; 393 tNFC_NFCEE_STATUS_REVT* p_data; 394 } tNFA_EE_NCI_NFCEE_STATUS_NTF; 395 396 /* union of all event data types */ 397 typedef union { 398 NFC_HDR hdr; 399 tNFA_EE_CFG_HDR cfg_hdr; 400 tNFA_EE_API_DISCOVER ee_discover; 401 tNFA_EE_API_REGISTER ee_register; 402 tNFA_EE_API_DEREGISTER deregister; 403 tNFA_EE_API_MODE_SET mode_set; 404 tNFA_EE_API_SET_TECH_CFG set_tech; 405 tNFA_EE_API_CLEAR_TECH_CFG clear_tech; 406 tNFA_EE_API_SET_PROTO_CFG set_proto; 407 tNFA_EE_API_CLEAR_PROTO_CFG clear_proto; 408 tNFA_EE_API_ADD_AID add_aid; 409 tNFA_EE_API_REMOVE_AID rm_aid; 410 tNFA_EE_API_ADD_SYSCODE add_syscode; 411 tNFA_EE_API_REMOVE_SYSCODE rm_syscode; 412 tNFA_EE_API_LMRT_SIZE lmrt_size; 413 tNFA_EE_API_CONNECT connect; 414 tNFA_EE_API_SEND_DATA send_data; 415 tNFA_EE_API_DISCONNECT disconnect; 416 tNFA_EE_NCI_DISC_RSP disc_rsp; 417 tNFA_EE_NCI_DISC_NTF disc_ntf; 418 tNFA_EE_NCI_MODE_SET mode_set_rsp; 419 tNFA_EE_NCI_WAIT_RSP wait_rsp; 420 tNFA_EE_NCI_CONN conn; 421 tNFA_EE_NCI_ACTION act; 422 tNFA_EE_NCI_DISC_REQ disc_req; 423 tNFA_EE_NCI_NFCEE_STATUS_NTF nfcee_status_ntf; 424 } tNFA_EE_MSG; 425 426 /* type for State Machine (SM) action functions */ 427 typedef void (*tNFA_EE_SM_ACT)(tNFA_EE_MSG* p_data); 428 429 /***************************************************************************** 430 ** control block 431 *****************************************************************************/ 432 #define NFA_EE_CFGED_UPDATE_NOW 0x80 433 /* either switch off or battery off is configured */ 434 #define NFA_EE_CFGED_OFF_ROUTING 0x40 435 436 /* the following status are the definition used in ee_cfg_sts */ 437 #define NFA_EE_STS_CHANGED_ROUTING 0x01 438 #define NFA_EE_STS_CHANGED 0x0f 439 #define NFA_EE_STS_PREV_ROUTING 0x10 440 #define NFA_EE_STS_PREV 0xf0 441 442 /* need to report NFA_EE_UPDATED_EVT */ 443 #define NFA_EE_WAIT_UPDATE 0x10 444 /* waiting for the rsp of set routing commands */ 445 #define NFA_EE_WAIT_UPDATE_RSP 0x20 446 #define NFA_EE_WAIT_UPDATE_ALL 0xF0 447 448 typedef uint8_t tNFA_EE_WAIT; 449 450 /* set this bit when waiting for HCI to finish the initialization process in 451 * NFA_EE_EM_STATE_RESTORING */ 452 #define NFA_EE_FLAG_WAIT_HCI 0x01 453 /* set this bit when EE needs to notify the p_enable_cback at the end of NFCEE 454 * discover process in NFA_EE_EM_STATE_RESTORING */ 455 #define NFA_EE_FLAG_NOTIFY_HCI 0x02 456 /* set this bit when gracefully disable with outstanding NCI connections */ 457 #define NFA_EE_FLAG_WAIT_DISCONN 0x04 458 typedef uint8_t tNFA_EE_FLAGS; 459 460 /* NFCEE DISCOVER in progress */ 461 #define NFA_EE_DISC_STS_ON 0x00 462 /* disable NFCEE DISCOVER */ 463 #define NFA_EE_DISC_STS_OFF 0x01 464 /* received NFCEE DISCOVER REQ NTF */ 465 #define NFA_EE_DISC_STS_REQ 0x02 466 /* received NFA_EE_MODE_SET_COMPLETE */ 467 #define NFA_EE_MODE_SET_COMPLETE 0x03 468 /* initialize EE_RECOVERY */ 469 #define NFA_EE_RECOVERY_INIT 0x04 470 /* update ee config during EE_RECOVERY */ 471 #define NFA_EE_RECOVERY_REDISCOVERED 0x05 472 typedef uint8_t tNFA_EE_DISC_STS; 473 474 typedef void(tNFA_EE_ENABLE_DONE_CBACK)(tNFA_EE_DISC_STS status); 475 476 /* NFA EE Management control block */ 477 typedef struct { 478 tNFA_EE_ECB ecb[NFA_EE_NUM_ECBS]; /* control block for DH and NFCEEs */ 479 TIMER_LIST_ENT timer; /* timer to send info to NFCC */ 480 TIMER_LIST_ENT discv_timer; /* timer to end NFCEE discovery */ 481 tNFA_EE_CBACK* p_ee_cback[NFA_EE_MAX_CBACKS]; /* to report EE events */ 482 tNFA_EE_CBACK* p_ee_disc_cback; /* to report EE discovery result */ 483 tNFA_EE_ENABLE_DONE_CBACK* 484 p_enable_cback; /* callback to notify on enable done*/ 485 tNFA_EE_EM_STATE em_state; /* NFA-EE state initialized or not */ 486 uint8_t wait_rsp; /* num of NCI rsp expected (update) */ 487 uint8_t num_ee_expecting; /* number of ee_info still expecting*/ 488 uint8_t cur_ee; /* the number of ee_info in cb */ 489 uint8_t ee_cfged; /* the bit mask of configured ECBs */ 490 uint8_t ee_cfg_sts; /* configuration status */ 491 tNFA_EE_WAIT ee_wait_evt; /* Pending event(s) to be reported */ 492 tNFA_EE_FLAGS ee_flags; /* flags */ 493 uint8_t route_block_control; /* controls route block feature */ 494 bool isDiscoveryStopped; /* discovery status */ 495 } tNFA_EE_CB; 496 497 /* Order of Routing entries in Routing Table */ 498 #define NCI_ROUTE_ORDER_AID 0x01 /* AID routing order */ 499 #define NCI_ROUTE_ORDER_SYS_CODE 0x03 /* System Code routing order*/ 500 #define NCI_ROUTE_ORDER_PROTOCOL 0x04 /* Protocol routing order*/ 501 #define NCI_ROUTE_ORDER_TECHNOLOGY 0x05 /* Technology routing order*/ 502 503 /***************************************************************************** 504 ** External variables 505 *****************************************************************************/ 506 507 /* NFA EE control block */ 508 extern tNFA_EE_CB nfa_ee_cb; 509 510 /***************************************************************************** 511 ** External functions 512 *****************************************************************************/ 513 /* function prototypes - exported from nfa_ee_main.c */ 514 void nfa_ee_sys_enable(void); 515 void nfa_ee_sys_disable(void); 516 517 /* event handler function type */ 518 bool nfa_ee_evt_hdlr(NFC_HDR* p_msg); 519 void nfa_ee_proc_nfcc_power_mode(uint8_t nfcc_power_mode); 520 #if (NFC_NFCEE_INCLUDED == TRUE) 521 void nfa_ee_get_tech_route(uint8_t power_state, uint8_t* p_handles); 522 #endif 523 void nfa_ee_proc_evt(tNFC_RESPONSE_EVT event, void* p_data); 524 tNFA_EE_ECB* nfa_ee_find_ecb(uint8_t nfcee_id); 525 tNFA_EE_ECB* nfa_ee_find_ecb_by_conn_id(uint8_t conn_id); 526 uint8_t nfa_ee_ecb_to_mask(tNFA_EE_ECB* p_cb); 527 void nfa_ee_restore_one_ecb(tNFA_EE_ECB* p_cb); 528 bool nfa_ee_is_active(tNFA_HANDLE nfcee_id); 529 530 /* Action function prototypes - nfa_ee_act.c */ 531 void nfa_ee_api_discover(tNFA_EE_MSG* p_data); 532 void nfa_ee_api_register(tNFA_EE_MSG* p_data); 533 void nfa_ee_api_deregister(tNFA_EE_MSG* p_data); 534 void nfa_ee_api_mode_set(tNFA_EE_MSG* p_data); 535 void nfa_ee_api_set_tech_cfg(tNFA_EE_MSG* p_data); 536 void nfa_ee_api_clear_tech_cfg(tNFA_EE_MSG* p_data); 537 void nfa_ee_api_set_proto_cfg(tNFA_EE_MSG* p_data); 538 void nfa_ee_api_clear_proto_cfg(tNFA_EE_MSG* p_data); 539 void nfa_ee_api_add_aid(tNFA_EE_MSG* p_data); 540 void nfa_ee_api_remove_aid(tNFA_EE_MSG* p_data); 541 void nfa_ee_api_add_sys_code(tNFA_EE_MSG* p_data); 542 void nfa_ee_api_remove_sys_code(tNFA_EE_MSG* p_data); 543 void nfa_ee_api_lmrt_size(tNFA_EE_MSG* p_data); 544 void nfa_ee_api_update_now(tNFA_EE_MSG* p_data); 545 void nfa_ee_api_connect(tNFA_EE_MSG* p_data); 546 void nfa_ee_api_send_data(tNFA_EE_MSG* p_data); 547 void nfa_ee_api_disconnect(tNFA_EE_MSG* p_data); 548 void nfa_ee_report_disc_done(bool notify_sys); 549 void nfa_ee_nci_disc_rsp(tNFA_EE_MSG* p_data); 550 void nfa_ee_nci_disc_ntf(tNFA_EE_MSG* p_data); 551 void nfa_ee_nci_mode_set_rsp(tNFA_EE_MSG* p_data); 552 void nfa_ee_nci_nfcee_status_ntf(tNFA_EE_MSG* p_data); 553 void nfa_ee_nci_wait_rsp(tNFA_EE_MSG* p_data); 554 void nfa_ee_nci_conn(tNFA_EE_MSG* p_data); 555 void nfa_ee_nci_action_ntf(tNFA_EE_MSG* p_data); 556 void nfa_ee_nci_disc_req_ntf(tNFA_EE_MSG* p_data); 557 void nfa_ee_rout_timeout(tNFA_EE_MSG* p_data); 558 void nfa_ee_discv_timeout(tNFA_EE_MSG* p_data); 559 void nfa_ee_lmrt_to_nfcc(tNFA_EE_MSG* p_data); 560 void nfa_ee_update_rout(void); 561 void nfa_ee_report_event(tNFA_EE_CBACK* p_cback, tNFA_EE_EVT event, 562 tNFA_EE_CBACK_DATA* p_data); 563 tNFA_EE_ECB* nfa_ee_find_aid_offset(uint8_t aid_len, uint8_t* p_aid, 564 int* p_offset, int* p_entry); 565 tNFA_EE_ECB* nfa_ee_find_sys_code_offset(uint16_t sys_code, int* p_offset, 566 int* p_entry); 567 int nfa_ee_find_total_aid_len(tNFA_EE_ECB* p_cb, int start_entry); 568 void nfa_ee_start_timer(void); 569 void nfa_ee_reg_cback_enable_done(tNFA_EE_ENABLE_DONE_CBACK* p_cback); 570 void nfa_ee_report_update_evt(void); 571 572 extern void nfa_ee_proc_hci_info_cback(void); 573 void nfa_ee_check_disable(void); 574 bool nfa_ee_restore_ntf_done(void); 575 void nfa_ee_check_restore_complete(void); 576 int nfa_ee_find_max_aid_cfg_len(void); 577 #endif /* NFA_P2P_INT_H */ 578