1 /******************************************************************************
2  *
3  *  Copyright (c) 2014 The Android Open Source Project
4  *  Copyright 1999-2016 Broadcom Corporation
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at:
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  ******************************************************************************/
19 
20 #ifndef BT_TARGET_H
21 #define BT_TARGET_H
22 
23 #ifndef BUILDCFG
24 #define BUILDCFG
25 #endif
26 
27 #if !defined(HAS_BDROID_BUILDCFG) && !defined(HAS_NO_BDROID_BUILDCFG)
28 #error \
29     "An Android.mk file did not include bdroid_CFLAGS and possibly not bdroid_C_INCLUDES"
30 #endif
31 
32 #ifdef HAS_BDROID_BUILDCFG
33 #include "bdroid_buildcfg.h"
34 #endif
35 
36 #include "bt_types.h" /* This must be defined AFTER buildcfg.h */
37 
38 #ifndef FALSE
39 #define FALSE false
40 #endif
41 
42 #ifndef TRUE
43 #define TRUE true
44 #endif
45 
46 //------------------Added from bdroid_buildcfg.h---------------------
47 #ifndef L2CAP_EXTFEA_SUPPORTED_MASK
48 #define L2CAP_EXTFEA_SUPPORTED_MASK                                            \
49   (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | \
50    L2CAP_EXTFEA_FIXED_CHNLS)
51 #endif
52 
53 #ifndef BTUI_OPS_FORMATS
54 #define BTUI_OPS_FORMATS (BTA_OP_VCARD21_MASK | BTA_OP_ANY_MASK)
55 #endif
56 
57 #ifndef BTA_RFC_MTU_SIZE
58 #define BTA_RFC_MTU_SIZE \
59   (L2CAP_MTU_SIZE - L2CAP_MIN_OFFSET - RFCOMM_DATA_OVERHEAD)
60 #endif
61 
62 #ifndef BTA_PAN_INCLUDED
63 #define BTA_PAN_INCLUDED TRUE
64 #endif
65 
66 #ifndef BTA_HD_INCLUDED
67 #define BTA_HD_INCLUDED TRUE
68 #endif
69 
70 #ifndef BTA_HH_INCLUDED
71 #define BTA_HH_INCLUDED TRUE
72 #endif
73 
74 #ifndef BTA_HH_ROLE
75 #define BTA_HH_ROLE BTA_CENTRAL_ROLE_PREF
76 #endif
77 
78 #ifndef BTA_AV_SINK_INCLUDED
79 #define BTA_AV_SINK_INCLUDED FALSE
80 #endif
81 
82 #ifndef BTA_DISABLE_DELAY
83 #define BTA_DISABLE_DELAY 200 /* in milliseconds */
84 #endif
85 
86 #ifndef AVDT_VERSION
87 #define AVDT_VERSION 0x0103
88 #endif
89 
90 #ifndef BTA_AG_AT_MAX_LEN
91 #define BTA_AG_AT_MAX_LEN 512
92 #endif
93 
94 #ifndef BTA_AG_SCO_PKT_TYPES
95 #define BTA_AG_SCO_PKT_TYPES                                     \
96   (BTM_SCO_LINK_ONLY_MASK | ESCO_PKT_TYPES_MASK_EV3 |            \
97    ESCO_PKT_TYPES_MASK_NO_3_EV3 | ESCO_PKT_TYPES_MASK_NO_2_EV5 | \
98    ESCO_PKT_TYPES_MASK_NO_3_EV5)
99 #endif
100 
101 #ifndef BTA_AV_RET_TOUT
102 #define BTA_AV_RET_TOUT 15
103 #endif
104 
105 /* TRUE to use SCMS-T content protection */
106 #ifndef BTA_AV_CO_CP_SCMS_T
107 #define BTA_AV_CO_CP_SCMS_T FALSE
108 #endif
109 
110 #ifndef BTA_DM_SDP_DB_SIZE
111 #define BTA_DM_SDP_DB_SIZE 20000
112 #endif
113 
114 #ifndef HL_INCLUDED
115 #define HL_INCLUDED TRUE
116 #endif
117 
118 #ifndef AG_VOICE_SETTINGS
119 #define AG_VOICE_SETTINGS HCI_DEFAULT_VOICE_SETTINGS
120 #endif
121 
122 #ifndef BTIF_DM_OOB_TEST
123 #define BTIF_DM_OOB_TEST TRUE
124 #endif
125 
126 // How long to wait before activating sniff mode after entering the
127 // idle state for server FT/RFCOMM, OPS connections
128 #ifndef BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS
129 #define BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS 7000
130 #endif
131 
132 // How long to wait before activating sniff mode after entering the
133 // idle state for client FT/RFCOMM connections
134 #ifndef BTA_FTC_IDLE_TO_SNIFF_DELAY_MS
135 #define BTA_FTC_IDLE_TO_SNIFF_DELAY_MS 5000
136 #endif
137 
138 //------------------End added from bdroid_buildcfg.h---------------------
139 
140 /******************************************************************************
141  *
142  * Buffer sizes
143  *
144  *****************************************************************************/
145 
146 #ifndef BT_DEFAULT_BUFFER_SIZE
147 #define BT_DEFAULT_BUFFER_SIZE (4096 + 16)
148 #endif
149 
150 #ifndef BT_SMALL_BUFFER_SIZE
151 #define BT_SMALL_BUFFER_SIZE 660
152 #endif
153 
154 /* Receives HCI events from the lower-layer. */
155 #ifndef HCI_CMD_BUF_SIZE
156 #define HCI_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
157 #endif
158 
159 /* Sends SDP data packets. */
160 #ifndef SDP_DATA_BUF_SIZE
161 #define SDP_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
162 #endif
163 
164 /* Sends RFCOMM command packets. */
165 #ifndef RFCOMM_CMD_BUF_SIZE
166 #define RFCOMM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
167 #endif
168 
169 /* Sends RFCOMM data packets. */
170 #ifndef RFCOMM_DATA_BUF_SIZE
171 #define RFCOMM_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
172 #endif
173 
174 /* Sends L2CAP packets to the peer and HCI messages to the controller. */
175 #ifndef L2CAP_CMD_BUF_SIZE
176 #define L2CAP_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
177 #endif
178 
179 #ifndef L2CAP_FCR_ERTM_BUF_SIZE
180 #define L2CAP_FCR_ERTM_BUF_SIZE (10240 + 24)
181 #endif
182 
183 /* Number of ACL buffers to assign to LE */
184 /*
185  * TODO: Do we need this?
186  * It was used when the HCI buffers were shared with BR/EDR.
187  */
188 #ifndef L2C_DEF_NUM_BLE_BUF_SHARED
189 #define L2C_DEF_NUM_BLE_BUF_SHARED 1
190 #endif
191 
192 /* Used by BTM when it sends HCI commands to the controller. */
193 #ifndef BTM_CMD_BUF_SIZE
194 #define BTM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
195 #endif
196 
197 #ifndef OBX_LRG_DATA_BUF_SIZE
198 #define OBX_LRG_DATA_BUF_SIZE (8080 + 26)
199 #endif
200 
201 /* BNEP data and protocol messages. */
202 #ifndef BNEP_BUF_SIZE
203 #define BNEP_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
204 #endif
205 
206 /* AVDTP buffer size for protocol messages */
207 #ifndef AVDT_CMD_BUF_SIZE
208 #define AVDT_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
209 #endif
210 
211 #ifndef PAN_BUF_SIZE
212 #define PAN_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
213 #endif
214 
215 /* Maximum number of buffers to allocate for PAN */
216 #ifndef PAN_BUF_MAX
217 #define PAN_BUF_MAX 100
218 #endif
219 
220 /* AVCTP buffer size for protocol messages */
221 #ifndef AVCT_CMD_BUF_SIZE
222 #define AVCT_CMD_BUF_SIZE 288
223 #endif
224 
225 /* AVRCP buffer size for protocol messages */
226 #ifndef AVRC_CMD_BUF_SIZE
227 #define AVRC_CMD_BUF_SIZE 288
228 #endif
229 
230 /* AVRCP Metadata buffer size for protocol messages */
231 #ifndef AVRC_META_CMD_BUF_SIZE
232 #define AVRC_META_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE
233 #endif
234 
235 #ifndef BTA_HL_LRG_DATA_BUF_SIZE
236 #define BTA_HL_LRG_DATA_BUF_SIZE (10240 + 24)
237 #endif
238 
239 /* GATT Data sending buffer size */
240 #ifndef GATT_DATA_BUF_SIZE
241 #define GATT_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
242 #endif
243 
244 /******************************************************************************
245  *
246  * BTM
247  *
248  *****************************************************************************/
249 
250 /* Cancel Inquiry on incoming SSP */
251 #ifndef BTM_NO_SSP_ON_INQUIRY
252 #define BTM_NO_SSP_ON_INQUIRY FALSE
253 #endif
254 
255 #ifndef DISABLE_WBS
256 #define DISABLE_WBS FALSE
257 #endif
258 
259 /*  This is used to work around a controller bug that doesn't like Disconnect
260  *  issued while there is a role switch in progress
261 */
262 #ifndef BTM_DISC_DURING_RS
263 #define BTM_DISC_DURING_RS TRUE
264 #endif
265 
266 /**************************
267  * Initial SCO TX credit
268  ************************/
269 /* max TX SCO data packet size */
270 #ifndef BTM_SCO_DATA_SIZE_MAX
271 #define BTM_SCO_DATA_SIZE_MAX 240
272 #endif
273 
274 /* The size in bytes of the BTM inquiry database. */
275 #ifndef BTM_INQ_DB_SIZE
276 #define BTM_INQ_DB_SIZE 40
277 #endif
278 
279 /* Sets the Page_Scan_Window:  the length of time that the device is performing
280  * a page scan. */
281 #ifndef BTM_DEFAULT_CONN_WINDOW
282 #define BTM_DEFAULT_CONN_WINDOW 0x0012
283 #endif
284 
285 /* Sets the Page_Scan_Activity:  the interval between the start of two
286  * consecutive page scans. */
287 #ifndef BTM_DEFAULT_CONN_INTERVAL
288 #define BTM_DEFAULT_CONN_INTERVAL 0x0800
289 #endif
290 
291 /* When automatic inquiry scan is enabled, this sets the inquiry scan window. */
292 #ifndef BTM_DEFAULT_DISC_WINDOW
293 #define BTM_DEFAULT_DISC_WINDOW 0x0012
294 #endif
295 
296 /* When automatic inquiry scan is enabled, this sets the inquiry scan interval.
297  */
298 #ifndef BTM_DEFAULT_DISC_INTERVAL
299 #define BTM_DEFAULT_DISC_INTERVAL 0x0800
300 #endif
301 
302 /* Default class of device
303 * {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
304 *
305 * SERVICE_CLASS:0x5A (Bit17 -Networking,Bit19 - Capturing,Bit20 -Object
306 * Transfer,Bit22 -Telephony)
307 * MAJOR_CLASS:0x02 - PHONE
308 * MINOR_CLASS:0x0C - SMART_PHONE
309 *
310 */
311 #ifndef BTA_DM_COD
312 #define BTA_DM_COD \
313   { 0x5A, 0x02, 0x0C }
314 #endif
315 
316 /* The number of SCO links. */
317 #ifndef BTM_MAX_SCO_LINKS
318 #define BTM_MAX_SCO_LINKS 6
319 #endif
320 
321 /* The number of security records for peer devices. */
322 #ifndef BTM_SEC_MAX_DEVICE_RECORDS
323 #define BTM_SEC_MAX_DEVICE_RECORDS 100
324 #endif
325 
326 /* The number of security records for services. */
327 #ifndef BTM_SEC_MAX_SERVICE_RECORDS
328 #define BTM_SEC_MAX_SERVICE_RECORDS 32
329 #endif
330 
331 /* If True, force a retrieval of remote device name for each bond in case it's
332  * changed */
333 #ifndef BTM_SEC_FORCE_RNR_FOR_DBOND
334 #define BTM_SEC_FORCE_RNR_FOR_DBOND FALSE
335 #endif
336 
337 /* Maximum device name length used in btm database. */
338 #ifndef BTM_MAX_REM_BD_NAME_LEN
339 #define BTM_MAX_REM_BD_NAME_LEN 248
340 #endif
341 
342 /* Maximum local device name length stored btm database */
343 #ifndef BTM_MAX_LOC_BD_NAME_LEN
344 #define BTM_MAX_LOC_BD_NAME_LEN 248
345 #endif
346 
347 /* Fixed Default String. When this is defined as null string, the device's
348  * product model name is used as the default local name.
349  */
350 #ifndef BTM_DEF_LOCAL_NAME
351 #define BTM_DEF_LOCAL_NAME ""
352 #endif
353 
354 /* Maximum service name stored with security authorization (0 if not needed) */
355 #ifndef BTM_SEC_SERVICE_NAME_LEN
356 #define BTM_SEC_SERVICE_NAME_LEN BT_MAX_SERVICE_NAME_LEN
357 #endif
358 
359 /* Maximum length of the service name. */
360 #ifndef BT_MAX_SERVICE_NAME_LEN
361 #define BT_MAX_SERVICE_NAME_LEN 21
362 #endif
363 
364 /* The maximum number of clients that can register with the power manager. */
365 #ifndef BTM_MAX_PM_RECORDS
366 #define BTM_MAX_PM_RECORDS 2
367 #endif
368 
369 /* If the user does not respond to security process requests within this many
370  * seconds, a negative response would be sent automatically.
371  * 30 is LMP response timeout value */
372 #ifndef BTM_SEC_TIMEOUT_VALUE
373 #define BTM_SEC_TIMEOUT_VALUE 35
374 #endif
375 
376 /* Maximum number of callbacks that can be registered using
377  * BTM_RegisterForVSEvents */
378 #ifndef BTM_MAX_VSE_CALLBACKS
379 #define BTM_MAX_VSE_CALLBACKS 3
380 #endif
381 
382 /******************************************
383  *    Lisbon Features
384  ******************************************/
385 /* This is set to TRUE if the FEC is required for EIR packet. */
386 #ifndef BTM_EIR_DEFAULT_FEC_REQUIRED
387 #define BTM_EIR_DEFAULT_FEC_REQUIRED TRUE
388 #endif
389 
390 /* The IO capability of the local device (for Simple Pairing) */
391 #ifndef BTM_LOCAL_IO_CAPS
392 #define BTM_LOCAL_IO_CAPS BTM_IO_CAP_IO
393 #endif
394 
395 #ifndef BTM_LOCAL_IO_CAPS_BLE
396 #define BTM_LOCAL_IO_CAPS_BLE BTM_IO_CAP_KBDISP
397 #endif
398 
399 /* TRUE to include Sniff Subrating */
400 #ifndef BTM_SSR_INCLUDED
401 #define BTM_SSR_INCLUDED TRUE
402 #endif
403 
404 /*************************
405  * End of Lisbon Features
406  *************************/
407 
408 /* 4.1/4.2 secure connections feature */
409 #ifndef SC_MODE_INCLUDED
410 #define SC_MODE_INCLUDED TRUE
411 #endif
412 
413 /* Used for conformance testing ONLY */
414 #ifndef BTM_BLE_CONFORMANCE_TESTING
415 #define BTM_BLE_CONFORMANCE_TESTING FALSE
416 #endif
417 
418 /******************************************************************************
419  *
420  * L2CAP
421  *
422  *****************************************************************************/
423 
424 /* The maximum number of simultaneous links that L2CAP can support. */
425 #ifndef MAX_ACL_CONNECTIONS
426 #define MAX_L2CAP_LINKS 13
427 #else
428 #define MAX_L2CAP_LINKS MAX_ACL_CONNECTIONS
429 #endif
430 
431 /* The maximum number of simultaneous channels that L2CAP can support. */
432 #ifndef MAX_L2CAP_CHANNELS
433 #define MAX_L2CAP_CHANNELS 32
434 #endif
435 
436 /* The maximum number of simultaneous applications that can register with L2CAP.
437  */
438 #ifndef MAX_L2CAP_CLIENTS
439 #define MAX_L2CAP_CLIENTS 15
440 #endif
441 
442 /* The number of seconds of link inactivity before a link is disconnected. */
443 #ifndef L2CAP_LINK_INACTIVITY_TOUT
444 #define L2CAP_LINK_INACTIVITY_TOUT 4
445 #endif
446 
447 /* The number of seconds of link inactivity after bonding before a link is
448  * disconnected. */
449 #ifndef L2CAP_BONDING_TIMEOUT
450 #define L2CAP_BONDING_TIMEOUT 3
451 #endif
452 
453 /* The time from the HCI connection complete to disconnect if no channel is
454  * established. */
455 #ifndef L2CAP_LINK_STARTUP_TOUT
456 #define L2CAP_LINK_STARTUP_TOUT 60
457 #endif
458 
459 /* The L2CAP MTU; must be in accord with the HCI ACL buffer size. */
460 #ifndef L2CAP_MTU_SIZE
461 #define L2CAP_MTU_SIZE 1691
462 #endif
463 
464 /*
465  * The L2CAP MPS over Bluetooth; must be in accord with the FCR tx buffer size
466  * and ACL down buffer size.
467  */
468 #ifndef L2CAP_MPS_OVER_BR_EDR
469 #define L2CAP_MPS_OVER_BR_EDR 1010
470 #endif
471 
472 /* If host flow control enabled, this is the number of buffers the controller
473  * can have unacknowledged. */
474 #ifndef L2CAP_HOST_FC_ACL_BUFS
475 #define L2CAP_HOST_FC_ACL_BUFS 20
476 #endif
477 
478 /* This is set to enable L2CAP to  take the ACL link out of park mode when ACL
479  * data is to be sent. */
480 #ifndef L2CAP_WAKE_PARKED_LINK
481 #define L2CAP_WAKE_PARKED_LINK TRUE
482 #endif
483 
484 /* Minimum number of ACL credit for high priority link */
485 #ifndef L2CAP_HIGH_PRI_MIN_XMIT_QUOTA
486 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA 5
487 #endif
488 
489 /* used for monitoring HCI ACL credit management */
490 #ifndef L2CAP_HCI_FLOW_CONTROL_DEBUG
491 #define L2CAP_HCI_FLOW_CONTROL_DEBUG TRUE
492 #endif
493 
494 /* Used for features using fixed channels; set to zero if no fixed channels
495  * supported (BLE, etc.) */
496 /* Excluding L2CAP signaling channel and UCD */
497 #ifndef L2CAP_NUM_FIXED_CHNLS
498 #define L2CAP_NUM_FIXED_CHNLS 32
499 #endif
500 
501 /* First fixed channel supported */
502 #ifndef L2CAP_FIRST_FIXED_CHNL
503 #define L2CAP_FIRST_FIXED_CHNL 4
504 #endif
505 
506 #ifndef L2CAP_LAST_FIXED_CHNL
507 #define L2CAP_LAST_FIXED_CHNL \
508   (L2CAP_FIRST_FIXED_CHNL + L2CAP_NUM_FIXED_CHNLS - 1)
509 #endif
510 
511 /* Round Robin service channels in link */
512 #ifndef L2CAP_ROUND_ROBIN_CHANNEL_SERVICE
513 #define L2CAP_ROUND_ROBIN_CHANNEL_SERVICE TRUE
514 #endif
515 
516 /* Used for conformance testing ONLY:  When TRUE lets scriptwrapper overwrite
517  * info response */
518 #ifndef L2CAP_CONFORMANCE_TESTING
519 #define L2CAP_CONFORMANCE_TESTING FALSE
520 #endif
521 
522 /*
523  * Max bytes per connection to buffer locally before dropping the
524  * connection if local client does not receive it  - default is 1MB
525  */
526 #ifndef L2CAP_MAX_RX_BUFFER
527 #define L2CAP_MAX_RX_BUFFER 0x100000
528 #endif
529 
530 /******************************************************************************
531  *
532  * BLE
533  *
534  *****************************************************************************/
535 
536 #ifndef LOCAL_BLE_CONTROLLER_ID
537 #define LOCAL_BLE_CONTROLLER_ID 1
538 #endif
539 
540 /*
541  * Toggles support for general LE privacy features such as remote address
542  * resolution, local address rotation etc.
543  */
544 #ifndef BLE_PRIVACY_SPT
545 #define BLE_PRIVACY_SPT TRUE
546 #endif
547 
548 /*
549  * Enables or disables support for local privacy (ex. address rotation)
550  */
551 #ifndef BLE_LOCAL_PRIVACY_ENABLED
552 #define BLE_LOCAL_PRIVACY_ENABLED TRUE
553 #endif
554 
555 /*
556  * Toggles support for vendor specific extensions such as RPA offloading,
557  * feature discovery, multi-adv etc.
558  */
559 #ifndef BLE_VND_INCLUDED
560 #define BLE_VND_INCLUDED FALSE
561 #endif
562 
563 /* The maximum number of simultaneous applications that can register with LE
564  * L2CAP. */
565 #ifndef BLE_MAX_L2CAP_CLIENTS
566 #define BLE_MAX_L2CAP_CLIENTS 15
567 #endif
568 
569 /******************************************************************************
570  *
571  * ATT/GATT Protocol/Profile Settings
572  *
573  *****************************************************************************/
574 #ifndef GATT_MAX_SR_PROFILES
575 #define GATT_MAX_SR_PROFILES 32 /* max is 32 */
576 #endif
577 
578 #ifndef GATT_MAX_APPS
579 #define GATT_MAX_APPS 32 /* note: 2 apps used internally GATT and GAP */
580 #endif
581 
582 /* connection manager doesn't generate it's own IDs. Instead, all GATT clients
583  * use their gatt_if to identify against conection manager. When stack tries to
584  * create l2cap connection, it will use this fixed ID. */
585 #define CONN_MGR_ID_L2CAP (GATT_MAX_APPS + 10)
586 
587 #ifndef GATT_MAX_PHY_CHANNEL
588 #define GATT_MAX_PHY_CHANNEL 7
589 #endif
590 
591 /* Used for conformance testing ONLY */
592 #ifndef GATT_CONFORMANCE_TESTING
593 #define GATT_CONFORMANCE_TESTING FALSE
594 #endif
595 
596 /******************************************************************************
597  *
598  * SMP
599  *
600  *****************************************************************************/
601 #ifndef SMP_DEBUG
602 #define SMP_DEBUG FALSE
603 #endif
604 
605 #ifndef SMP_DEFAULT_AUTH_REQ
606 #define SMP_DEFAULT_AUTH_REQ SMP_AUTH_NB_ENC_ONLY
607 #endif
608 
609 #ifndef SMP_MAX_ENC_KEY_SIZE
610 #define SMP_MAX_ENC_KEY_SIZE 16
611 #endif
612 
613 /* minimum link timeout after SMP pairing is done, leave room for key exchange
614    and racing condition for the following service connection.
615    Prefer greater than 0 second, and no less than default inactivity link idle
616    timer(L2CAP_LINK_INACTIVITY_TOUT) in l2cap) */
617 #ifndef SMP_LINK_TOUT_MIN
618 #if (L2CAP_LINK_INACTIVITY_TOUT > 0)
619 #define SMP_LINK_TOUT_MIN L2CAP_LINK_INACTIVITY_TOUT
620 #else
621 #define SMP_LINK_TOUT_MIN 2
622 #endif
623 #endif
624 /******************************************************************************
625  *
626  * SDP
627  *
628  *****************************************************************************/
629 
630 /* The maximum number of SDP records the server can support. */
631 #ifndef SDP_MAX_RECORDS
632 #define SDP_MAX_RECORDS 30
633 #endif
634 
635 /* The maximum number of attributes in each record. */
636 #ifndef SDP_MAX_REC_ATTR
637 #define SDP_MAX_REC_ATTR 25
638 #endif
639 
640 #ifndef SDP_MAX_PAD_LEN
641 #define SDP_MAX_PAD_LEN 600
642 #endif
643 
644 /* The maximum length, in bytes, of an attribute. */
645 #ifndef SDP_MAX_ATTR_LEN
646 #define SDP_MAX_ATTR_LEN 400
647 #endif
648 
649 /* The maximum number of attribute filters supported by SDP databases. */
650 #ifndef SDP_MAX_ATTR_FILTERS
651 #define SDP_MAX_ATTR_FILTERS 15
652 #endif
653 
654 /* The maximum number of UUID filters supported by SDP databases. */
655 #ifndef SDP_MAX_UUID_FILTERS
656 #define SDP_MAX_UUID_FILTERS 3
657 #endif
658 
659 /* The maximum number of record handles retrieved in a search. */
660 #ifndef SDP_MAX_DISC_SERVER_RECS
661 #define SDP_MAX_DISC_SERVER_RECS 21
662 #endif
663 
664 /* The size of a scratchpad buffer, in bytes, for storing the response to an
665  * attribute request. */
666 #ifndef SDP_MAX_LIST_BYTE_COUNT
667 #define SDP_MAX_LIST_BYTE_COUNT 4096
668 #endif
669 
670 /* The maximum number of parameters in an SDP protocol element. */
671 #ifndef SDP_MAX_PROTOCOL_PARAMS
672 #define SDP_MAX_PROTOCOL_PARAMS 2
673 #endif
674 
675 /* The maximum number of simultaneous client and server connections. */
676 #ifndef SDP_MAX_CONNECTIONS
677 #define SDP_MAX_CONNECTIONS 4
678 #endif
679 
680 /* The MTU size for the L2CAP configuration. */
681 #ifndef SDP_MTU_SIZE
682 #define SDP_MTU_SIZE 1024
683 #endif
684 
685 /* The name for security authorization. */
686 #ifndef SDP_SERVICE_NAME
687 #define SDP_SERVICE_NAME "Service Discovery"
688 #endif
689 
690 /******************************************************************************
691  *
692  * RFCOMM
693  *
694  *****************************************************************************/
695 
696 /* The maximum number of ports supported. */
697 #ifndef MAX_RFC_PORTS
698 #define MAX_RFC_PORTS 30
699 #endif
700 
701 /* The maximum simultaneous links to different devices. */
702 #ifndef MAX_ACL_CONNECTIONS
703 #define MAX_BD_CONNECTIONS 7
704 #else
705 #define MAX_BD_CONNECTIONS MAX_ACL_CONNECTIONS
706 #endif
707 
708 /* The port receive queue low watermark level, in bytes. */
709 #ifndef PORT_RX_LOW_WM
710 #define PORT_RX_LOW_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_LOW_WM)
711 #endif
712 
713 /* The port receive queue high watermark level, in bytes. */
714 #ifndef PORT_RX_HIGH_WM
715 #define PORT_RX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_HIGH_WM)
716 #endif
717 
718 /* The port receive queue critical watermark level, in bytes. */
719 #ifndef PORT_RX_CRITICAL_WM
720 #define PORT_RX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_CRITICAL_WM)
721 #endif
722 
723 /* The port receive queue low watermark level, in number of buffers. */
724 #ifndef PORT_RX_BUF_LOW_WM
725 #define PORT_RX_BUF_LOW_WM 4
726 #endif
727 
728 /* The port receive queue high watermark level, in number of buffers. */
729 #ifndef PORT_RX_BUF_HIGH_WM
730 #define PORT_RX_BUF_HIGH_WM 10
731 #endif
732 
733 /* The port receive queue critical watermark level, in number of buffers. */
734 #ifndef PORT_RX_BUF_CRITICAL_WM
735 #define PORT_RX_BUF_CRITICAL_WM 15
736 #endif
737 
738 /* The port transmit queue high watermark level, in bytes. */
739 #ifndef PORT_TX_HIGH_WM
740 #define PORT_TX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_HIGH_WM)
741 #endif
742 
743 /* The port transmit queue critical watermark level, in bytes. */
744 #ifndef PORT_TX_CRITICAL_WM
745 #define PORT_TX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_CRITICAL_WM)
746 #endif
747 
748 /* The port transmit queue high watermark level, in number of buffers. */
749 #ifndef PORT_TX_BUF_HIGH_WM
750 #define PORT_TX_BUF_HIGH_WM 10
751 #endif
752 
753 /* The port transmit queue high watermark level, in number of buffers. */
754 #ifndef PORT_TX_BUF_CRITICAL_WM
755 #define PORT_TX_BUF_CRITICAL_WM 15
756 #endif
757 
758 /* The RFCOMM multiplexer preferred flow control mechanism. */
759 #ifndef PORT_FC_DEFAULT
760 #define PORT_FC_DEFAULT PORT_FC_CREDIT
761 #endif
762 
763 /******************************************************************************
764  *
765  * BNEP
766  *
767  *****************************************************************************/
768 
769 #ifndef BNEP_INCLUDED
770 #define BNEP_INCLUDED TRUE
771 #endif
772 
773 /* BNEP status API call is used mainly to get the L2CAP handle */
774 #ifndef BNEP_SUPPORTS_STATUS_API
775 #define BNEP_SUPPORTS_STATUS_API TRUE
776 #endif
777 
778 /* Maximum number of protocol filters supported. */
779 #ifndef BNEP_MAX_PROT_FILTERS
780 #define BNEP_MAX_PROT_FILTERS 5
781 #endif
782 
783 /* Maximum number of multicast filters supported. */
784 #ifndef BNEP_MAX_MULTI_FILTERS
785 #define BNEP_MAX_MULTI_FILTERS 5
786 #endif
787 
788 /* Preferred MTU size. */
789 #ifndef BNEP_MTU_SIZE
790 #define BNEP_MTU_SIZE L2CAP_MTU_SIZE
791 #endif
792 
793 /* Maximum number of buffers allowed in transmit data queue. */
794 #ifndef BNEP_MAX_XMITQ_DEPTH
795 #define BNEP_MAX_XMITQ_DEPTH 20
796 #endif
797 
798 /* Maximum number BNEP of connections supported. */
799 #ifndef BNEP_MAX_CONNECTIONS
800 #define BNEP_MAX_CONNECTIONS 7
801 #endif
802 
803 /******************************************************************************
804  *
805  * AVDTP
806  *
807  *****************************************************************************/
808 
809 /* Number of simultaneous links to different peer devices. */
810 #ifndef AVDT_NUM_LINKS
811 #define AVDT_NUM_LINKS 6
812 #endif
813 
814 /* Number of simultaneous stream endpoints. */
815 #ifndef AVDT_NUM_SEPS
816 #define AVDT_NUM_SEPS 6
817 #endif
818 
819 /* Number of transport channels setup by AVDT for all media streams */
820 #ifndef AVDT_NUM_TC_TBL
821 #define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS)
822 #endif
823 
824 /* Maximum size in bytes of the content protection information element. */
825 #ifndef AVDT_PROTECT_SIZE
826 #define AVDT_PROTECT_SIZE 90
827 #endif
828 
829 /* Default sink delay value in ms. */
830 #ifndef AVDT_SINK_DELAY_MS
831 #define AVDT_SINK_DELAY_MS 300
832 #endif
833 
834 /******************************************************************************
835  *
836  * PAN
837  *
838  *****************************************************************************/
839 
840 #ifndef PAN_INCLUDED
841 #define PAN_INCLUDED TRUE
842 #endif
843 
844 #ifndef PAN_NAP_DISABLED
845 #define PAN_NAP_DISABLED FALSE
846 #endif
847 
848 #ifndef PANU_DISABLED
849 #define PANU_DISABLED FALSE
850 #endif
851 
852 /* This will enable the PANU role */
853 #ifndef PAN_SUPPORTS_ROLE_PANU
854 #define PAN_SUPPORTS_ROLE_PANU TRUE
855 #endif
856 
857 /* This will enable the NAP role */
858 #ifndef PAN_SUPPORTS_ROLE_NAP
859 #define PAN_SUPPORTS_ROLE_NAP TRUE
860 #endif
861 
862 /* This is just for debugging purposes */
863 #ifndef PAN_SUPPORTS_DEBUG_DUMP
864 #define PAN_SUPPORTS_DEBUG_DUMP TRUE
865 #endif
866 
867 /* Maximum number of PAN connections allowed */
868 #ifndef MAX_PAN_CONNS
869 #define MAX_PAN_CONNS 7
870 #endif
871 
872 /* Default service name for NAP role */
873 #ifndef PAN_NAP_DEFAULT_SERVICE_NAME
874 #define PAN_NAP_DEFAULT_SERVICE_NAME "Network Access Point Service"
875 #endif
876 
877 /* Default service name for PANU role */
878 #ifndef PAN_PANU_DEFAULT_SERVICE_NAME
879 #define PAN_PANU_DEFAULT_SERVICE_NAME "PAN User Service"
880 #endif
881 
882 /* Default description for NAP role service */
883 #ifndef PAN_NAP_DEFAULT_DESCRIPTION
884 #define PAN_NAP_DEFAULT_DESCRIPTION "NAP"
885 #endif
886 
887 /* Default description for PANU role service */
888 #ifndef PAN_PANU_DEFAULT_DESCRIPTION
889 #define PAN_PANU_DEFAULT_DESCRIPTION "PANU"
890 #endif
891 
892 /******************************************************************************
893  *
894  * GAP
895  *
896  *****************************************************************************/
897 
898 #ifndef GAP_INCLUDED
899 #define GAP_INCLUDED TRUE
900 #endif
901 
902 /* The maximum number of simultaneous GAP L2CAP connections. */
903 #ifndef GAP_MAX_CONNECTIONS
904 #define GAP_MAX_CONNECTIONS 30
905 #endif
906 
907 /* keep the raw data received from SDP server in database. */
908 #ifndef SDP_RAW_DATA_INCLUDED
909 #define SDP_RAW_DATA_INCLUDED TRUE
910 #endif
911 
912 /* Inquiry duration in 1.28 second units. */
913 #ifndef SDP_DEBUG
914 #define SDP_DEBUG TRUE
915 #endif
916 
917 /******************************************************************************
918  *
919  * HID
920  *
921  *****************************************************************************/
922 
923 /* HID Device Role Included */
924 #ifndef HID_DEV_INCLUDED
925 #define HID_DEV_INCLUDED TRUE
926 #endif
927 
928 #ifndef HID_CONTROL_BUF_SIZE
929 #define HID_CONTROL_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
930 #endif
931 
932 #ifndef HID_INTERRUPT_BUF_SIZE
933 #define HID_INTERRUPT_BUF_SIZE BT_DEFAULT_BUFFER_SIZE
934 #endif
935 
936 #ifndef HID_DEV_MTU_SIZE
937 #define HID_DEV_MTU_SIZE 512
938 #endif
939 
940 /*************************************************************************
941  * Definitions for Both HID-Host & Device
942 */
943 #ifndef HID_MAX_SVC_NAME_LEN
944 #define HID_MAX_SVC_NAME_LEN 32
945 #endif
946 
947 #ifndef HID_MAX_SVC_DESCR_LEN
948 #define HID_MAX_SVC_DESCR_LEN 32
949 #endif
950 
951 #ifndef HID_MAX_PROV_NAME_LEN
952 #define HID_MAX_PROV_NAME_LEN 32
953 #endif
954 
955 /*************************************************************************
956  * Definitions for HID-Host
957 */
958 #ifndef HID_HOST_INCLUDED
959 #define HID_HOST_INCLUDED TRUE
960 #endif
961 
962 #ifndef HID_HOST_MAX_DEVICES
963 #define HID_HOST_MAX_DEVICES 7
964 #endif
965 
966 #ifndef HID_HOST_MTU
967 #define HID_HOST_MTU 640
968 #endif
969 
970 #ifndef HID_HOST_MAX_CONN_RETRY
971 #define HID_HOST_MAX_CONN_RETRY 1
972 #endif
973 
974 #ifndef HID_HOST_REPAGE_WIN
975 #define HID_HOST_REPAGE_WIN 2
976 #endif
977 
978 /******************************************************************************
979  *
980  * AVCTP
981  *
982  *****************************************************************************/
983 
984 /* Number of simultaneous ACL links to different peer devices. */
985 #ifndef AVCT_NUM_LINKS
986 #define AVCT_NUM_LINKS 6
987 #endif
988 
989 /* Number of simultaneous AVCTP connections. */
990 #ifndef AVCT_NUM_CONN
991 #define AVCT_NUM_CONN 14  // 2 * MaxDevices + 2
992 #endif
993 
994 /******************************************************************************
995  *
996  * AVRCP
997  *
998  *****************************************************************************/
999 
1000 #ifndef AVRC_ADV_CTRL_INCLUDED
1001 #define AVRC_ADV_CTRL_INCLUDED TRUE
1002 #endif
1003 
1004 #ifndef DUMP_PCM_DATA
1005 #define DUMP_PCM_DATA FALSE
1006 #endif
1007 
1008 /******************************************************************************
1009  *
1010  * BTA
1011  *
1012  *****************************************************************************/
1013 /* BTA EIR canned UUID list (default is dynamic) */
1014 #ifndef BTA_EIR_CANNED_UUID_LIST
1015 #define BTA_EIR_CANNED_UUID_LIST FALSE
1016 #endif
1017 
1018 /* Number of supported customer UUID in EIR */
1019 #ifndef BTA_EIR_SERVER_NUM_CUSTOM_UUID
1020 #define BTA_EIR_SERVER_NUM_CUSTOM_UUID 8
1021 #endif
1022 
1023 /* CHLD override */
1024 #ifndef BTA_AG_CHLD_VAL_ECC
1025 #define BTA_AG_CHLD_VAL_ECC "(0,1,1x,2,2x,3)"
1026 #endif
1027 
1028 #ifndef BTA_AG_CHLD_VAL
1029 #define BTA_AG_CHLD_VAL "(0,1,2,3)"
1030 #endif
1031 
1032 /* Set the CIND to match HFP 1.5 */
1033 #ifndef BTA_AG_CIND_INFO
1034 #define BTA_AG_CIND_INFO                                                       \
1035   "(\"call\",(0,1)),(\"callsetup\",(0-3)),(\"service\",(0-1)),(\"signal\",(0-" \
1036   "5)),(\"roam\",(0,1)),(\"battchg\",(0-5)),(\"callheld\",(0-2))"
1037 #endif
1038 
1039 /******************************************************************************
1040  *
1041  * Tracing:  Include trace header file here.
1042  *
1043  *****************************************************************************/
1044 
1045 /* Enable/disable BTSnoop memory logging */
1046 #ifndef BTSNOOP_MEM
1047 #define BTSNOOP_MEM TRUE
1048 #endif
1049 
1050 #include "bt_trace.h"
1051 
1052 #endif /* BT_TARGET_H */
1053