The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 1999-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 | #ifndef NFC_TARGET_H |
| 20 | #define NFC_TARGET_H |
| 21 | |
| 22 | #include "data_types.h" |
| 23 | |
| 24 | #ifdef BUILDCFG |
| 25 | #include "buildcfg.h" |
| 26 | #endif |
| 27 | |
| 28 | /* Include common GKI definitions used by this platform */ |
| 29 | #include "gki_target.h" |
| 30 | |
| 31 | #include "bt_types.h" /* This must be defined AFTER buildcfg.h */ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 32 | #ifndef LMP_TEST |
| 33 | #include "bt_trace.h" |
| 34 | #endif |
| 35 | |
| 36 | |
| 37 | /* API macros for DLL (needed to export API functions from DLLs) */ |
| 38 | #define NFC_API EXPORT_API |
| 39 | #define LLCP_API EXPORT_API |
| 40 | |
| 41 | /****************************************************************************** |
| 42 | ** |
| 43 | ** GKI Mail Box and Timer |
| 44 | ** |
| 45 | ******************************************************************************/ |
| 46 | |
| 47 | /* Mailbox event mask for NFC stack */ |
| 48 | #ifndef NFC_MBOX_EVT_MASK |
| 49 | #define NFC_MBOX_EVT_MASK (TASK_MBOX_0_EVT_MASK) |
| 50 | #endif |
| 51 | |
| 52 | /* Mailbox ID for NFC stack */ |
| 53 | #ifndef NFC_MBOX_ID |
| 54 | #define NFC_MBOX_ID (TASK_MBOX_0) |
| 55 | #endif |
| 56 | |
| 57 | /* Mailbox event mask for NFA */ |
| 58 | #ifndef NFA_MBOX_EVT_MASK |
| 59 | #define NFA_MBOX_EVT_MASK (TASK_MBOX_2_EVT_MASK) |
| 60 | #endif |
| 61 | |
| 62 | /* Mailbox ID for NFA */ |
| 63 | #ifndef NFA_MBOX_ID |
| 64 | #define NFA_MBOX_ID (TASK_MBOX_2) |
| 65 | #endif |
| 66 | |
| 67 | /* GKI timer id used for protocol timer in NFC stack */ |
| 68 | #ifndef NFC_TIMER_ID |
| 69 | #define NFC_TIMER_ID (TIMER_0) |
| 70 | #endif |
| 71 | |
| 72 | /* GKI timer event mask used for protocol timer in NFC stack */ |
| 73 | #ifndef NFC_TIMER_EVT_MASK |
| 74 | #define NFC_TIMER_EVT_MASK (TIMER_0_EVT_MASK) |
| 75 | #endif |
| 76 | |
| 77 | /* GKI timer id used for quick timer in NFC stack */ |
| 78 | #ifndef NFC_QUICK_TIMER_ID |
| 79 | #define NFC_QUICK_TIMER_ID (TIMER_1) |
| 80 | #endif |
| 81 | |
| 82 | /* GKI timer event mask used for quick timer in NFC stack */ |
| 83 | #ifndef NFC_QUICK_TIMER_EVT_MASK |
| 84 | #define NFC_QUICK_TIMER_EVT_MASK (TIMER_1_EVT_MASK) |
| 85 | #endif |
| 86 | |
| 87 | /* GKI timer id used for protocol timer in NFA */ |
| 88 | #ifndef NFA_TIMER_ID |
| 89 | #define NFA_TIMER_ID (TIMER_2) |
| 90 | #endif |
| 91 | |
| 92 | /* GKI timer event mask used for protocol timer in NFA */ |
| 93 | #ifndef NFA_TIMER_EVT_MASK |
| 94 | #define NFA_TIMER_EVT_MASK (TIMER_2_EVT_MASK) |
| 95 | #endif |
| 96 | |
| 97 | /****************************************************************************** |
| 98 | ** |
| 99 | ** GKI Buffer Pools |
| 100 | ** |
| 101 | ******************************************************************************/ |
| 102 | |
| 103 | /* NCI command/notification/data */ |
| 104 | #ifndef NFC_NCI_POOL_ID |
| 105 | #define NFC_NCI_POOL_ID GKI_POOL_ID_2 |
| 106 | #endif |
| 107 | |
| 108 | #ifndef NFC_NCI_POOL_BUF_SIZE |
| 109 | #define NFC_NCI_POOL_BUF_SIZE GKI_BUF2_SIZE |
| 110 | #endif |
| 111 | |
| 112 | /* Reader/Write commands (NCI data payload) */ |
| 113 | #ifndef NFC_RW_POOL_ID |
| 114 | #define NFC_RW_POOL_ID GKI_POOL_ID_2 |
| 115 | #endif |
| 116 | |
| 117 | #ifndef NFC_RW_POOL_BUF_SIZE |
| 118 | #define NFC_RW_POOL_BUF_SIZE GKI_BUF2_SIZE |
| 119 | #endif |
| 120 | |
| 121 | /* Card Emulation responses (NCI data payload) */ |
| 122 | #ifndef NFC_CE_POOL_ID |
| 123 | #define NFC_CE_POOL_ID GKI_POOL_ID_2 |
| 124 | #endif |
| 125 | |
| 126 | #ifndef NFC_CE_POOL_BUF_SIZE |
| 127 | #define NFC_CE_POOL_BUF_SIZE GKI_BUF2_SIZE |
| 128 | #endif |
| 129 | |
| 130 | |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 131 | /* NCI msg pool for HAL (for shared NFC/HAL GKI)*/ |
| 132 | #ifndef NFC_HAL_NCI_POOL_ID |
| 133 | #define NFC_HAL_NCI_POOL_ID NFC_NCI_POOL_ID |
| 134 | #endif |
| 135 | |
| 136 | #ifndef NFC_HAL_NCI_POOL_BUF_SIZE |
| 137 | #define NFC_HAL_NCI_POOL_BUF_SIZE NFC_NCI_POOL_BUF_SIZE |
| 138 | #endif |
| 139 | |
| 140 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 141 | /****************************************************************************** |
| 142 | ** |
| 143 | ** NCI Transport definitions |
| 144 | ** |
| 145 | ******************************************************************************/ |
| 146 | /* offset of the first NCI packet in buffer for outgoing */ |
| 147 | #ifndef NCI_MSG_OFFSET_SIZE |
| 148 | #define NCI_MSG_OFFSET_SIZE 1 |
| 149 | #endif |
| 150 | |
| 151 | /* Restore NFCC baud rate to default on shutdown if NFC_UpdateBaudRate was called */ |
| 152 | #ifndef NFC_RESTORE_BAUD_ON_SHUTDOWN |
| 153 | #define NFC_RESTORE_BAUD_ON_SHUTDOWN TRUE |
| 154 | #endif |
| 155 | |
| 156 | /****************************************************************************** |
| 157 | ** |
| 158 | ** NCI |
| 159 | ** |
| 160 | ******************************************************************************/ |
| 161 | |
| 162 | #define NCI_VERSION_0_F 0x0F |
| 163 | #define NCI_VERSION_1_0 0x10 |
| 164 | |
| 165 | #ifndef NCI_VERSION |
| 166 | #define NCI_VERSION NCI_VERSION_1_0 |
| 167 | #endif |
| 168 | |
| 169 | /* TRUE I2C patch is needed */ |
| 170 | #ifndef NFC_I2C_PATCH_INCLUDED |
| 171 | #define NFC_I2C_PATCH_INCLUDED TRUE /* NFC-Android uses this!!! */ |
| 172 | #endif |
| 173 | |
| 174 | /****************************************************************************** |
| 175 | ** |
| 176 | ** NFC |
| 177 | ** |
| 178 | ******************************************************************************/ |
| 179 | #ifndef NFC_INCLUDED |
| 180 | #define NFC_INCLUDED TRUE |
| 181 | #endif |
| 182 | |
| 183 | /* Define to TRUE to include Broadcom Vendor Specific implementation */ |
| 184 | #ifndef NFC_BRCM_VS_INCLUDED |
| 185 | #define NFC_BRCM_VS_INCLUDED TRUE |
| 186 | #endif |
| 187 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 188 | /* Define to TRUE if compling for NFC Reader/Writer Only mode */ |
| 189 | #ifndef NFC_RW_ONLY |
| 190 | #define NFC_RW_ONLY FALSE |
| 191 | #endif |
| 192 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 193 | /* Timeout for receiving response to NCI command */ |
| 194 | #ifndef NFC_CMD_CMPL_TIMEOUT |
| 195 | #define NFC_CMD_CMPL_TIMEOUT 2 |
| 196 | #endif |
| 197 | |
| 198 | /* Timeout for waiting on data credit/NFC-DEP */ |
| 199 | #ifndef NFC_DEACTIVATE_TIMEOUT |
| 200 | #define NFC_DEACTIVATE_TIMEOUT 2 |
| 201 | #endif |
| 202 | |
| 203 | /* the maximum number of Vendor Specific callback functions allowed to be registered. 1-14 */ |
| 204 | #ifndef NFC_NUM_VS_CBACKS |
| 205 | #define NFC_NUM_VS_CBACKS 3 |
| 206 | #endif |
| 207 | |
| 208 | /* the maximum number of NCI connections allowed. 1-14 */ |
| 209 | #ifndef NCI_MAX_CONN_CBS |
| 210 | #define NCI_MAX_CONN_CBS 4 |
| 211 | #endif |
| 212 | |
| 213 | /* Maximum number of NCI commands that the NFCC accepts without needing to wait for response */ |
| 214 | #ifndef NCI_MAX_CMD_WINDOW |
| 215 | #define NCI_MAX_CMD_WINDOW 1 |
| 216 | #endif |
| 217 | |
| 218 | /* Define to TRUE to include the NFCEE related functionalities */ |
| 219 | #ifndef NFC_NFCEE_INCLUDED |
| 220 | #define NFC_NFCEE_INCLUDED TRUE |
| 221 | #endif |
| 222 | |
| 223 | /* the maximum number of NFCEE interface supported */ |
| 224 | #ifndef NFC_MAX_EE_INTERFACE |
| 225 | #define NFC_MAX_EE_INTERFACE 3 |
| 226 | #endif |
| 227 | |
| 228 | /* the maximum number of NFCEE information supported. */ |
| 229 | #ifndef NFC_MAX_EE_INFO |
| 230 | #define NFC_MAX_EE_INFO 8 |
| 231 | #endif |
| 232 | |
| 233 | /* the maximum number of NFCEE TLVs supported */ |
| 234 | #ifndef NFC_MAX_EE_TLVS |
| 235 | #define NFC_MAX_EE_TLVS 1 |
| 236 | #endif |
| 237 | |
| 238 | /* the maximum size of NFCEE TLV list supported */ |
| 239 | #ifndef NFC_MAX_EE_TLV_SIZE |
| 240 | #define NFC_MAX_EE_TLV_SIZE 150 |
| 241 | #endif |
| 242 | |
Evan Chu | df5080d | 2013-06-14 13:57:47 -0400 | [diff] [blame] | 243 | /* Maximum time to discover NFCEE */ |
| 244 | #ifndef NFA_EE_DISCV_TIMEOUT_VAL |
| 245 | #define NFA_EE_DISCV_TIMEOUT_VAL 2000 |
| 246 | #endif |
| 247 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 248 | /* Number of times reader/writer should attempt to resend a command on failure */ |
| 249 | #ifndef RW_MAX_RETRIES |
| 250 | #define RW_MAX_RETRIES 5 |
| 251 | #endif |
| 252 | |
| 253 | /* RW NDEF Support */ |
| 254 | #ifndef RW_NDEF_INCLUDED |
| 255 | #define RW_NDEF_INCLUDED TRUE |
| 256 | #endif |
| 257 | |
| 258 | /* RW Type 1 Tag timeout for each API call, in ms */ |
| 259 | #ifndef RW_T1T_TOUT_RESP |
| 260 | #define RW_T1T_TOUT_RESP 100 |
| 261 | #endif |
| 262 | |
| 263 | /* CE Type 2 Tag timeout for controller command, in ms */ |
| 264 | #ifndef CE_T2T_TOUT_RESP |
| 265 | #define CE_T2T_TOUT_RESP 1000 |
| 266 | #endif |
| 267 | |
| 268 | /* RW Type 2 Tag timeout for each API call, in ms */ |
| 269 | #ifndef RW_T2T_TOUT_RESP |
Evan Chu | e75b11b | 2013-07-03 11:05:12 -0400 | [diff] [blame] | 270 | #define RW_T2T_TOUT_RESP 150 /* Android requires 150 instead of 100 for presence-check*/ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 271 | #endif |
| 272 | |
| 273 | /* RW Type 2 Tag timeout for each API call, in ms */ |
| 274 | #ifndef RW_T2T_SEC_SEL_TOUT_RESP |
| 275 | #define RW_T2T_SEC_SEL_TOUT_RESP 10 |
| 276 | #endif |
| 277 | |
| 278 | /* RW Type 3 Tag timeout for each API call, in ms */ |
| 279 | #ifndef RW_T3T_TOUT_RESP |
| 280 | #define RW_T3T_TOUT_RESP 100 /* NFC-Android will use 100 instead of 75 for T3t presence-check */ |
| 281 | #endif |
| 282 | |
| 283 | /* CE Type 3 Tag maximum response timeout index (for check and update, used in SENSF_RES) */ |
| 284 | #ifndef CE_T3T_MRTI_C |
| 285 | #define CE_T3T_MRTI_C 0xFF |
| 286 | #endif |
| 287 | #ifndef CE_T3T_MRTI_U |
| 288 | #define CE_T3T_MRTI_U 0xFF |
| 289 | #endif |
| 290 | |
| 291 | /* Default maxblocks for CE_T3T UPDATE/CHECK operations */ |
| 292 | #ifndef CE_T3T_DEFAULT_UPDATE_MAXBLOCKS |
| 293 | #define CE_T3T_DEFAULT_UPDATE_MAXBLOCKS 3 |
| 294 | #endif |
| 295 | |
| 296 | #ifndef CE_T3T_DEFAULT_CHECK_MAXBLOCKS |
| 297 | #define CE_T3T_DEFAULT_CHECK_MAXBLOCKS 3 |
| 298 | #endif |
| 299 | |
| 300 | /* CE Type 4 Tag, Frame Waiting time Integer */ |
| 301 | #ifndef CE_T4T_ISO_DEP_FWI |
| 302 | #define CE_T4T_ISO_DEP_FWI 7 |
| 303 | #endif |
| 304 | |
| 305 | /* RW Type 4 Tag timeout for each API call, in ms */ |
| 306 | #ifndef RW_T4T_TOUT_RESP |
| 307 | #define RW_T4T_TOUT_RESP 1000 |
| 308 | #endif |
| 309 | |
| 310 | /* CE Type 4 Tag timeout for update file, in ms */ |
| 311 | #ifndef CE_T4T_TOUT_UPDATE |
| 312 | #define CE_T4T_TOUT_UPDATE 1000 |
| 313 | #endif |
| 314 | |
| 315 | /* CE Type 4 Tag, mandatory NDEF File ID */ |
| 316 | #ifndef CE_T4T_MANDATORY_NDEF_FILE_ID |
| 317 | #define CE_T4T_MANDATORY_NDEF_FILE_ID 0x1000 |
| 318 | #endif |
| 319 | |
| 320 | /* CE Type 4 Tag, max number of AID supported */ |
| 321 | #ifndef CE_T4T_MAX_REG_AID |
| 322 | #define CE_T4T_MAX_REG_AID 4 |
| 323 | #endif |
| 324 | |
| 325 | /* Sub carrier */ |
| 326 | #ifndef RW_I93_FLAG_SUB_CARRIER |
| 327 | #define RW_I93_FLAG_SUB_CARRIER I93_FLAG_SUB_CARRIER_SINGLE |
| 328 | #endif |
| 329 | |
| 330 | /* Data rate for 15693 command/response */ |
| 331 | #ifndef RW_I93_FLAG_DATA_RATE |
| 332 | #define RW_I93_FLAG_DATA_RATE I93_FLAG_DATA_RATE_HIGH |
| 333 | #endif |
| 334 | |
| 335 | /* TRUE, to include Card Emulation related test commands */ |
| 336 | #ifndef CE_TEST_INCLUDED |
| 337 | #define CE_TEST_INCLUDED FALSE |
| 338 | #endif |
| 339 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 340 | |
| 341 | /* Quick Timer */ |
| 342 | #ifndef QUICK_TIMER_TICKS_PER_SEC |
| 343 | #define QUICK_TIMER_TICKS_PER_SEC 100 /* 10ms timer */ |
| 344 | #endif |
| 345 | |
| 346 | |
| 347 | /****************************************************************************** |
| 348 | ** |
| 349 | ** LLCP |
| 350 | ** |
| 351 | ******************************************************************************/ |
| 352 | |
| 353 | #ifndef LLCP_TEST_INCLUDED |
| 354 | #define LLCP_TEST_INCLUDED FALSE |
| 355 | #endif |
| 356 | |
| 357 | #ifndef LLCP_POOL_ID |
| 358 | #define LLCP_POOL_ID GKI_POOL_ID_3 |
| 359 | #endif |
| 360 | |
| 361 | #ifndef LLCP_POOL_BUF_SIZE |
| 362 | #define LLCP_POOL_BUF_SIZE GKI_BUF3_SIZE |
| 363 | #endif |
| 364 | |
| 365 | /* LLCP Maximum Information Unit (between LLCP_DEFAULT_MIU(128) and LLCP_MAX_MIU (2175)*/ |
| 366 | #ifndef LLCP_MIU |
| 367 | #define LLCP_MIU (LLCP_POOL_BUF_SIZE - BT_HDR_SIZE - NCI_MSG_OFFSET_SIZE - NCI_DATA_HDR_SIZE - LLCP_PDU_HEADER_SIZE) |
| 368 | #endif |
| 369 | |
| 370 | /* Link Timeout, LTO */ |
| 371 | #ifndef LLCP_LTO_VALUE |
| 372 | #define LLCP_LTO_VALUE 1000 /* Default is 100ms. It should be sufficiently larger than RWT */ |
| 373 | #endif |
| 374 | |
| 375 | /* |
| 376 | ** LTO is max time interval between the last bit received and the first bit sent over the air. |
| 377 | ** Link timeout must be delayed as much as time between the packet sent from LLCP and the last bit transmitted at NFCC. |
| 378 | ** - 200ms, max OTA transmitting time between the first bit and the last bit at NFCC |
| 379 | ** Largest MIU(2175bytes) of LLCP must be fragmented and sent on NFC-DEP over the air. |
| 380 | ** 8 * (DEP_REQ/RES+ACK) + DEP_REQ/RES for 2175 MIU at 106kbps bit rate. |
| 381 | ** - 10ms, processing time |
| 382 | */ |
| 383 | #ifndef LLCP_INTERNAL_TX_DELAY |
| 384 | #define LLCP_INTERNAL_TX_DELAY 210 |
| 385 | #endif |
| 386 | |
| 387 | /* |
| 388 | ** LTO is max time interval between the last bit received and the first bit sent over the air. |
| 389 | ** Link timeout must be delayed as much as time between the first bit received at NFCC and the packet received at LLCP. |
| 390 | ** - 200ms, max OTA transmitting time between the first bit and the last bit at NFCC |
| 391 | ** LLCP cannot receive data packet until all bit are received and reassembled in NCI. |
| 392 | ** 8 * (DEP_REQ/RES+ACK) + DEP_REQ/RES for 2175 MIU at 106kbps bit rate. |
| 393 | ** - 10ms, processing time |
| 394 | */ |
| 395 | #ifndef LLCP_INTERNAL_RX_DELAY |
| 396 | #define LLCP_INTERNAL_RX_DELAY 210 |
| 397 | #endif |
| 398 | |
| 399 | /* Wait for application layer sending data before sending SYMM */ |
| 400 | #ifndef LLCP_DELAY_RESP_TIME |
| 401 | #define LLCP_DELAY_RESP_TIME 20 /* in ms */ |
| 402 | #endif |
| 403 | |
| 404 | /* LLCP inactivity timeout for initiator */ |
| 405 | #ifndef LLCP_INIT_INACTIVITY_TIMEOUT |
| 406 | #define LLCP_INIT_INACTIVITY_TIMEOUT 0 /* in ms */ |
| 407 | #endif |
| 408 | |
| 409 | /* LLCP inactivity timeout for target */ |
| 410 | #ifndef LLCP_TARGET_INACTIVITY_TIMEOUT |
| 411 | #define LLCP_TARGET_INACTIVITY_TIMEOUT 0 /* in ms */ |
| 412 | #endif |
| 413 | |
| 414 | /* LLCP delay timeout to send the first PDU as initiator */ |
| 415 | #ifndef LLCP_DELAY_TIME_TO_SEND_FIRST_PDU |
| 416 | #define LLCP_DELAY_TIME_TO_SEND_FIRST_PDU 50 /* in ms */ |
| 417 | #endif |
| 418 | |
| 419 | /* Response Waiting Time */ |
| 420 | #ifndef LLCP_WAITING_TIME |
| 421 | #define LLCP_WAITING_TIME 7 /* its scaled value should be less than LTO */ |
| 422 | #endif |
| 423 | |
| 424 | /* Options Parameters */ |
| 425 | #ifndef LLCP_OPT_VALUE |
| 426 | #define LLCP_OPT_VALUE LLCP_LSC_3 /* Link Service Class 3 */ |
| 427 | #endif |
| 428 | |
| 429 | /* Data link connection timeout */ |
| 430 | #ifndef LLCP_DATA_LINK_CONNECTION_TOUT |
| 431 | #define LLCP_DATA_LINK_CONNECTION_TOUT 1000 |
| 432 | #endif |
| 433 | |
| 434 | /* Max length of service name */ |
| 435 | #ifndef LLCP_MAX_SN_LEN |
| 436 | #define LLCP_MAX_SN_LEN 255 /* max length of service name */ |
| 437 | #endif |
| 438 | |
| 439 | /* Max number of well-known services, at least 2 for LM and SDP and up to 16 */ |
| 440 | #ifndef LLCP_MAX_WKS |
| 441 | #define LLCP_MAX_WKS 5 |
| 442 | #endif |
| 443 | |
| 444 | /* Max number of services advertised by local SDP, up to 16 */ |
| 445 | #ifndef LLCP_MAX_SERVER |
| 446 | #define LLCP_MAX_SERVER 10 |
| 447 | #endif |
| 448 | |
| 449 | /* Max number of services not advertised by local SDP, up to 32 */ |
| 450 | #ifndef LLCP_MAX_CLIENT |
| 451 | #define LLCP_MAX_CLIENT 20 |
| 452 | #endif |
| 453 | |
| 454 | /* Max number of data link connections */ |
| 455 | #ifndef LLCP_MAX_DATA_LINK |
| 456 | #define LLCP_MAX_DATA_LINK 16 |
| 457 | #endif |
| 458 | |
| 459 | /* Max number of outstanding service discovery requests */ |
| 460 | #ifndef LLCP_MAX_SDP_TRANSAC |
| 461 | #define LLCP_MAX_SDP_TRANSAC 16 |
| 462 | #endif |
| 463 | |
| 464 | /* Percentage of LLCP buffer pool for receiving data */ |
| 465 | #ifndef LLCP_RX_BUFF_RATIO |
| 466 | #define LLCP_RX_BUFF_RATIO 30 |
| 467 | #endif |
| 468 | |
| 469 | /* Rx congestion end threshold as percentage of receiving buffers */ |
| 470 | #ifndef LLCP_RX_CONGEST_END |
| 471 | #define LLCP_RX_CONGEST_END 50 |
| 472 | #endif |
| 473 | |
| 474 | /* Rx congestion start threshold as percentage of receiving buffers */ |
| 475 | #ifndef LLCP_RX_CONGEST_START |
| 476 | #define LLCP_RX_CONGEST_START 70 |
| 477 | #endif |
| 478 | |
| 479 | /* limitation of rx UI PDU as percentage of receiving buffers */ |
| 480 | #ifndef LLCP_LL_RX_BUFF_LIMIT |
| 481 | #define LLCP_LL_RX_BUFF_LIMIT 30 |
| 482 | #endif |
| 483 | |
| 484 | /* minimum rx congestion threshold (number of rx I PDU in queue) for data link connection */ |
| 485 | #ifndef LLCP_DL_MIN_RX_CONGEST |
| 486 | #define LLCP_DL_MIN_RX_CONGEST 4 |
| 487 | #endif |
| 488 | |
| 489 | /* limitation of tx UI PDU as percentage of transmitting buffers */ |
| 490 | #ifndef LLCP_LL_TX_BUFF_LIMIT |
| 491 | #define LLCP_LL_TX_BUFF_LIMIT 30 |
| 492 | #endif |
| 493 | |
| 494 | /****************************************************************************** |
| 495 | ** |
| 496 | ** NFA |
| 497 | ** |
| 498 | ******************************************************************************/ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 499 | |
| 500 | #ifndef NFA_INCLUDED |
| 501 | #define NFA_INCLUDED TRUE |
| 502 | #endif |
| 503 | |
| 504 | #ifndef NFA_P2P_INCLUDED |
| 505 | #define NFA_P2P_INCLUDED TRUE |
| 506 | #endif |
| 507 | |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 508 | /* Maximum Idle time (no hcp) to wait for EE DISC REQ Ntf(s) */ |
| 509 | #ifndef NFA_HCI_NETWK_INIT_IDLE_TIMEOUT |
| 510 | #define NFA_HCI_NETWK_INIT_IDLE_TIMEOUT 1000 |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 511 | #endif |
| 512 | |
| 513 | #ifndef NFA_HCI_MAX_HOST_IN_NETWORK |
| 514 | #define NFA_HCI_MAX_HOST_IN_NETWORK 0x06 |
| 515 | #endif |
| 516 | |
| 517 | /* Max number of Application that can be registered to NFA-HCI */ |
| 518 | #ifndef NFA_HCI_MAX_APP_CB |
| 519 | #define NFA_HCI_MAX_APP_CB 0x05 |
| 520 | #endif |
| 521 | |
| 522 | /* Max number of HCI gates that can be created */ |
| 523 | #ifndef NFA_HCI_MAX_GATE_CB |
| 524 | #define NFA_HCI_MAX_GATE_CB 0x06 |
| 525 | #endif |
| 526 | |
| 527 | /* Max number of HCI pipes that can be created for the whole system */ |
| 528 | #ifndef NFA_HCI_MAX_PIPE_CB |
| 529 | #define NFA_HCI_MAX_PIPE_CB 0x08 |
| 530 | #endif |
| 531 | |
| 532 | /* Timeout for waiting for the response to HCP Command packet */ |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 533 | #ifndef NFA_HCI_RESPONSE_TIMEOUT |
| 534 | #define NFA_HCI_RESPONSE_TIMEOUT 1000 |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 535 | #endif |
| 536 | |
| 537 | /* Default poll duration (may be over-ridden using NFA_SetRfDiscoveryDuration) */ |
| 538 | #ifndef NFA_DM_DISC_DURATION_POLL |
| 539 | #define NFA_DM_DISC_DURATION_POLL 500 /* Android requires 500 */ |
| 540 | #endif |
| 541 | |
| 542 | /* Automatic NDEF detection (when not in exclusive RF mode) */ |
| 543 | #ifndef NFA_DM_AUTO_DETECT_NDEF |
| 544 | #define NFA_DM_AUTO_DETECT_NDEF FALSE /* !!!!! NFC-Android needs FALSE */ |
| 545 | #endif |
| 546 | |
| 547 | /* Automatic NDEF read (when not in exclusive RF mode) */ |
| 548 | #ifndef NFA_DM_AUTO_READ_NDEF |
| 549 | #define NFA_DM_AUTO_READ_NDEF FALSE /* !!!!! NFC-Android needs FALSE */ |
| 550 | #endif |
| 551 | |
Evan Chu | a24be4f | 2013-11-13 15:30:16 -0500 | [diff] [blame] | 552 | /* Automatic NDEF presence check (when not in exclusive RF mode) */ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 553 | #ifndef NFA_DM_AUTO_PRESENCE_CHECK |
| 554 | #define NFA_DM_AUTO_PRESENCE_CHECK FALSE /* Android requires FALSE */ |
| 555 | #endif |
| 556 | |
Evan Chu | a24be4f | 2013-11-13 15:30:16 -0500 | [diff] [blame] | 557 | /* Presence check option: 0x01: use sleep/wake for none-NDEF ISO-DEP tags */ |
| 558 | #ifndef NFA_DM_PRESENCE_CHECK_OPTION |
| 559 | #define NFA_DM_PRESENCE_CHECK_OPTION 0x03 /* !!!!! Android needs value 3 */ |
| 560 | #endif |
| 561 | |
| 562 | /* Maximum time to wait for presence check response */ |
| 563 | #ifndef NFA_DM_MAX_PRESENCE_CHECK_TIMEOUT |
| 564 | #define NFA_DM_MAX_PRESENCE_CHECK_TIMEOUT 500 |
| 565 | #endif |
| 566 | |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 567 | /* Default delay to auto presence check after sending raw frame */ |
| 568 | #ifndef NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY |
| 569 | #define NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY 750 |
| 570 | #endif |
| 571 | |
Evan Chu | 7c69b27 | 2013-05-14 12:48:36 -0400 | [diff] [blame] | 572 | /* Timeout for reactivation of Kovio bar code tag (presence check) */ |
| 573 | #ifndef NFA_DM_DISC_TIMEOUT_KOVIO_PRESENCE_CHECK |
| 574 | #define NFA_DM_DISC_TIMEOUT_KOVIO_PRESENCE_CHECK (1000) |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 575 | #endif |
| 576 | |
| 577 | /* Max number of NDEF type handlers that can be registered (including the default handler) */ |
| 578 | #ifndef NFA_NDEF_MAX_HANDLERS |
| 579 | #define NFA_NDEF_MAX_HANDLERS 8 |
| 580 | #endif |
| 581 | |
| 582 | /* Maximum number of listen entries configured/registered with NFA_CeConfigureUiccListenTech, */ |
| 583 | /* NFA_CeRegisterFelicaSystemCodeOnDH, or NFA_CeRegisterT4tAidOnDH */ |
| 584 | #ifndef NFA_CE_LISTEN_INFO_MAX |
| 585 | #define NFA_CE_LISTEN_INFO_MAX 5 |
| 586 | #endif |
| 587 | |
| 588 | #ifndef NFA_CHO_INCLUDED |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 589 | #define NFA_CHO_INCLUDED FALSE /* Anddroid must use FALSE to exclude CHO */ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 590 | #endif |
| 591 | |
| 592 | /* MIU for CHO */ |
| 593 | #ifndef NFA_CHO_MIU |
| 594 | #define NFA_CHO_MIU 499 |
| 595 | #endif |
| 596 | |
| 597 | /* Receiving Window for CHO */ |
| 598 | #ifndef NFA_CHO_RW |
| 599 | #define NFA_CHO_RW 4 |
| 600 | #endif |
| 601 | |
| 602 | /* Max number of alternative carrier information */ |
| 603 | #ifndef NFA_CHO_MAX_AC_INFO |
| 604 | #define NFA_CHO_MAX_AC_INFO 2 |
| 605 | #endif |
| 606 | |
| 607 | /* Max reference character length, it is up to 255 but it's RECOMMENDED short */ |
| 608 | #ifndef NFA_CHO_MAX_REF_NAME_LEN |
| 609 | #define NFA_CHO_MAX_REF_NAME_LEN 8 |
| 610 | #endif |
| 611 | |
| 612 | /* Max auxiliary data count */ |
| 613 | #ifndef NFA_CHO_MAX_AUX_DATA_COUNT |
| 614 | #define NFA_CHO_MAX_AUX_DATA_COUNT 2 |
| 615 | #endif |
| 616 | |
| 617 | #ifndef NFA_CHO_TEST_INCLUDED |
| 618 | #define NFA_CHO_TEST_INCLUDED FALSE |
| 619 | #endif |
| 620 | |
| 621 | #ifndef NFA_SNEP_INCLUDED |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 622 | #define NFA_SNEP_INCLUDED FALSE /* Android must use FALSE to exclude SNEP */ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 623 | #endif |
| 624 | |
| 625 | /* Max acceptable length */ |
| 626 | #ifndef NFA_SNEP_DEFAULT_SERVER_MAX_NDEF_SIZE |
| 627 | #define NFA_SNEP_DEFAULT_SERVER_MAX_NDEF_SIZE 500000 |
| 628 | #endif |
| 629 | |
| 630 | /* Max number of SNEP server/client and data link connection */ |
| 631 | #ifndef NFA_SNEP_MAX_CONN |
| 632 | #define NFA_SNEP_MAX_CONN 6 |
| 633 | #endif |
| 634 | |
| 635 | /* Max number data link connection of SNEP default server*/ |
| 636 | #ifndef NFA_SNEP_DEFAULT_MAX_CONN |
| 637 | #define NFA_SNEP_DEFAULT_MAX_CONN 3 |
| 638 | #endif |
| 639 | |
| 640 | /* MIU for SNEP */ |
| 641 | #ifndef NFA_SNEP_MIU |
| 642 | #define NFA_SNEP_MIU 1980 /* Modified for NFC-A */ |
| 643 | #endif |
| 644 | |
| 645 | /* Receiving Window for SNEP */ |
| 646 | #ifndef NFA_SNEP_RW |
| 647 | #define NFA_SNEP_RW 2 /* Modified for NFC-A */ |
| 648 | #endif |
| 649 | |
| 650 | /* Max number of NFCEE supported */ |
| 651 | #ifndef NFA_EE_MAX_EE_SUPPORTED |
Martijn Coenen | 8263ec7 | 2014-02-20 15:00:51 -0800 | [diff] [blame] | 652 | #define NFA_EE_MAX_EE_SUPPORTED 4 /* Modified for NFC-A until we add dynamic support */ |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 653 | #endif |
| 654 | |
| 655 | /* Maximum number of AID entries per target_handle */ |
| 656 | #ifndef NFA_EE_MAX_AID_ENTRIES |
Paul Chaisson | f23dcad | 2013-11-25 16:51:23 -0500 | [diff] [blame] | 657 | #define NFA_EE_MAX_AID_ENTRIES (32) |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 658 | #endif |
| 659 | |
| 660 | /* Maximum number of callback functions can be registered through NFA_EeRegister() */ |
| 661 | #ifndef NFA_EE_MAX_CBACKS |
| 662 | #define NFA_EE_MAX_CBACKS (3) |
| 663 | #endif |
| 664 | |
| 665 | #ifndef NFA_DTA_INCLUDED |
| 666 | #define NFA_DTA_INCLUDED TRUE |
| 667 | #endif |
| 668 | |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 669 | |
| 670 | /***************************************************************************** |
| 671 | ** Define HAL_WRITE depending on whether HAL is using shared GKI resources |
| 672 | ** as the NFC stack. |
| 673 | *****************************************************************************/ |
| 674 | #ifndef HAL_WRITE |
Ruchi Kandoi | 512ee63 | 2017-01-03 13:59:10 -0800 | [diff] [blame^] | 675 | #define HAL_WRITE(p) {nfc_cb.p_hal->write(p->len, (uint8_t *)(p+1) + p->offset); GKI_freebuf(p);} |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 676 | |
Evan Chu | a24be4f | 2013-11-13 15:30:16 -0500 | [diff] [blame] | 677 | #ifdef NFC_HAL_SHARED_GKI |
| 678 | |
| 679 | /* NFC HAL Included if NFC_NFCEE_INCLUDED */ |
| 680 | #if (NFC_NFCEE_INCLUDED == TRUE) |
| 681 | |
| 682 | #ifndef NFC_HAL_HCI_INCLUDED |
| 683 | #define NFC_HAL_HCI_INCLUDED TRUE |
| 684 | #endif |
| 685 | #else /* NFC_NFCEE_INCLUDED == TRUE */ |
| 686 | #ifndef NFC_HAL_HCI_INCLUDED |
| 687 | #define NFC_HAL_HCI_INCLUDED FALSE |
| 688 | #endif |
| 689 | |
| 690 | #endif /* NFC_NFCEE_INCLUDED == FALSE */ |
| 691 | |
| 692 | #endif /* NFC_HAL_SHARED_GKI */ |
| 693 | |
Martijn Coenen | 5c65c3a | 2013-03-27 13:23:36 -0700 | [diff] [blame] | 694 | |
| 695 | |
| 696 | #endif /* HAL_WRITE */ |
| 697 | |
| 698 | |
The Android Open Source Project | e9df6ba | 2012-12-13 14:55:37 -0800 | [diff] [blame] | 699 | #endif /* NFC_TARGET_H */ |
| 700 | |
| 701 | |
| 702 | |