1 /******************************************************************************
2  *
3  *  Copyright (c) 2014 The Android Open Source Project
4  *  Copyright (C) 1999-2012 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 #include <bt_common.h>
24 
25 #ifndef BUILDCFG
26 #define BUILDCFG
27 #endif
28 
29 /*
30 #if !defined(HAS_BDROID_BUILDCFG) && !defined(HAS_NO_BDROID_BUILDCFG)
31 #error "An Android.mk file did not include bdroid_CFLAGS and possibly not bdorid_C_INCLUDES"
32 #endif
33 */
34 
35 #ifdef HAS_BDROID_BUILDCFG
36 #include "bdroid_buildcfg.h"
37 #endif
38 
39 #include "bluedroid_user_config.h"
40 #include "stack/bt_types.h"   /* This must be defined AFTER buildcfg.h */
41 
42 #include "stack/dyn_mem.h"    /* defines static and/or dynamic memory for components */
43 
44 
45 /* OS Configuration from User config (eg: sdkconfig) */
46 #define BT_BTU_TASK_STACK_SIZE      UC_BTU_TASK_STACK_SIZE
47 
48 /******************************************************************************
49 **
50 ** Classic BT features
51 **
52 ******************************************************************************/
53 #if (UC_BT_CLASSIC_ENABLED == TRUE)
54 #define CLASSIC_BT_INCLUDED         TRUE
55 #define BTC_SM_INCLUDED             TRUE
56 #define BTC_PRF_QUEUE_INCLUDED      TRUE
57 #define BTC_GAP_BT_INCLUDED         TRUE
58 #define BTA_SDP_INCLUDED            TRUE
59 #define BTA_DM_PM_INCLUDED          TRUE
60 #define BTC_DM_PM_INCLUDED          TRUE
61 #define SDP_INCLUDED                TRUE
62 #define BTA_DM_QOS_INCLUDED         TRUE
63 
64 #if (UC_BT_A2DP_ENABLED == TRUE)
65 #define BTA_AR_INCLUDED             TRUE
66 #define BTA_AV_INCLUDED             TRUE
67 #define AVDT_INCLUDED               TRUE
68 #define A2D_INCLUDED                TRUE
69 #define AVCT_INCLUDED               TRUE
70 #define AVRC_INCLUDED               TRUE
71 #define BTC_AV_INCLUDED             TRUE
72 #define BTA_AV_SINK_INCLUDED        TRUE
73 #define BTC_AV_SINK_INCLUDED        TRUE
74 #define SBC_DEC_INCLUDED            TRUE
75 #define BTC_AV_SRC_INCLUDED         TRUE
76 #define SBC_ENC_INCLUDED            TRUE
77 #endif /* UC_BT_A2DP_ENABLED */
78 
79 #if (UC_BT_SPP_ENABLED == TRUE)
80 #define RFCOMM_INCLUDED             TRUE
81 #define BTA_JV_INCLUDED             TRUE
82 #define BTC_SPP_INCLUDED            TRUE
83 #endif /* UC_BT_SPP_ENABLED */
84 
85 #if (UC_BT_HFP_AG_ENABLED == TRUE)
86 #define BTC_HF_INCLUDED             TRUE
87 #define BTA_AG_INCLUDED             TRUE
88 #define PLC_INCLUDED                TRUE
89 #ifndef RFCOMM_INCLUDED
90 #define RFCOMM_INCLUDED             TRUE
91 #endif
92 #ifndef BTM_SCO_INCLUDED
93 #define BTM_SCO_INCLUDED            TRUE
94 #endif
95 #ifndef BTM_MAX_SCO_LINKS
96 #define BTM_MAX_SCO_LINKS           (1)
97 #endif
98 #ifndef SBC_DEC_INCLUDED
99 #define SBC_DEC_INCLUDED            TRUE
100 #endif
101 #ifndef SBC_ENC_INCLUDED
102 #define SBC_ENC_INCLUDED            TRUE
103 #endif
104 #endif  /* UC_BT_HFP_AG_ENABLED */
105 
106 #if (UC_BT_HFP_CLIENT_ENABLED == TRUE)
107 #define BTC_HF_CLIENT_INCLUDED      TRUE
108 #define BTA_HF_INCLUDED             TRUE
109 #define PLC_INCLUDED                TRUE
110 #ifndef RFCOMM_INCLUDED
111 #define RFCOMM_INCLUDED             TRUE
112 #endif
113 #ifndef BTM_SCO_INCLUDED
114 #define BTM_SCO_INCLUDED            TRUE
115 #endif
116 #ifndef BTM_MAX_SCO_LINKS
117 #define BTM_MAX_SCO_LINKS           (1)
118 #endif
119 
120 #ifndef SBC_DEC_INCLUDED
121 #define SBC_DEC_INCLUDED            TRUE
122 #endif
123 #ifndef SBC_ENC_INCLUDED
124 #define SBC_ENC_INCLUDED            TRUE
125 #endif
126 #endif  /* UC_BT_HFP_CLIENT_ENABLED */
127 
128 #if UC_BT_SSP_ENABLED
129 #define BT_SSP_INCLUDED             TRUE
130 #endif /* UC_BT_SSP_ENABLED */
131 
132 #if UC_BT_HID_HOST_ENABLED
133 #define HID_HOST_INCLUDED           TRUE
134 #define BTA_HH_INCLUDED             TRUE
135 #endif /* UC_BT_HID_HOST_ENABLED */
136 
137 #endif /* UC_BT_CLASSIC_ENABLED */
138 
139 /* This is set to enable use of GAP L2CAP connections. */
140 #if (VND_BT_JV_BTA_L2CAP == TRUE)
141 #define BTA_JV_L2CAP_INCLUDED       TRUE
142 #define GAP_CONN_INCLUDED           TRUE
143 #endif /* VND_BT_JV_BTA_L2CAP */
144 
145 #ifndef CLASSIC_BT_INCLUDED
146 #define CLASSIC_BT_INCLUDED         FALSE
147 #endif /* CLASSIC_BT_INCLUDED */
148 
149 #ifndef CLASSIC_BT_GATT_INCLUDED
150 #define CLASSIC_BT_GATT_INCLUDED    FALSE
151 #endif /* CLASSIC_BT_GATT_INCLUDED */
152 /******************************************************************************
153 **
154 ** BLE features
155 **
156 ******************************************************************************/
157 #if (UC_BT_BLE_ENABLED ==TRUE)
158 #define BLE_INCLUDED              TRUE
159 #else
160 #define BLE_INCLUDED              FALSE
161 #endif /* UC_BT_BLE_ENABLED */
162 
163 #if (UC_BT_BLE_50_FEATURES_SUPPORTED == TRUE)
164 #define BLE_50_FEATURE_SUPPORT   TRUE
165 #else
166 #define BLE_50_FEATURE_SUPPORT   FALSE
167 #endif
168 
169 #if (UC_BT_BLE_42_FEATURES_SUPPORTED == TRUE || BLE_50_FEATURE_SUPPORT == FALSE)
170 #define BLE_42_FEATURE_SUPPORT   TRUE
171 #else
172 #define BLE_42_FEATURE_SUPPORT   FALSE
173 #endif
174 
175 #if (UC_BT_BLE_RPA_SUPPORTED  == TRUE)
176 #define CONTROLLER_RPA_LIST_ENABLE   TRUE
177 #else
178 #define CONTROLLER_RPA_LIST_ENABLE   FALSE
179 #endif
180 
181 #if (UC_BT_GATTS_ENABLE)
182 #define GATTS_INCLUDED              TRUE
183 #else
184 #define GATTS_INCLUDED              FALSE
185 #endif /* UC_BT_GATTS_ENABLE */
186 
187 #if (UC_BT_GATTC_ENABLE)
188 #define GATTC_INCLUDED              TRUE
189 #else
190 #define GATTC_INCLUDED              FALSE
191 #endif  /* UC_BT_GATTC_ENABLE */
192 
193 #if (UC_BT_BLUFI_ENABLE)
194 #define BLUFI_INCLUDED              TRUE
195 #else
196 #define BLUFI_INCLUDED              FALSE
197 #endif  /* UC_BT_BLUFI_ENABLE */
198 
199 #if (UC_BT_GATTC_ENABLE && UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED)
200 #define GATTC_CACHE_NVS             TRUE
201 #else
202 #define GATTC_CACHE_NVS             FALSE
203 #endif  /* UC_BT_GATTC_ENABLE && UC_BT_GATTC_CACHE_NVS_FLASH_ENABLED */
204 
205 #if (UC_BT_GATTC_ENABLE && UC_BT_GATTC_CONNECT_RETRY_COUNT)
206 #define GATTC_CONNECT_RETRY_COUNT             UC_BT_GATTC_CONNECT_RETRY_COUNT
207 #else
208 #define GATTC_CONNECT_RETRY_COUNT             0
209 #endif  /* UC_BT_GATTC_ENABLE && UC_BT_GATTC_CONNECT_RETRY_COUNT */
210 
211 #if (GATTC_CONNECT_RETRY_COUNT > 0)
212 #define GATTC_CONNECT_RETRY_EN     TRUE
213 #else
214 #define GATTC_CONNECT_RETRY_EN     FALSE
215 #endif
216 
217 #if (UC_BT_SMP_ENABLE)
218 #define SMP_INCLUDED                TRUE
219 #if (BLE_INCLUDED == TRUE)
220 #define BLE_PRIVACY_SPT             TRUE
221 #else
222 #define BLE_PRIVACY_SPT             FALSE
223 #endif  /*BLE_INCLUDED*/
224 #else
225 #define SMP_INCLUDED                FALSE
226 #define BLE_PRIVACY_SPT             FALSE
227 #endif  /* UC_BT_SMP_ENABLE */
228 
229 #if(UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE)
230 #define SMP_SLAVE_CON_PARAMS_UPD_ENABLE     TRUE
231 #else
232 #define SMP_SLAVE_CON_PARAMS_UPD_ENABLE     FALSE
233 #endif /* UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE */
234 
235 #ifdef UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
236 #define BLE_ADV_REPORT_FLOW_CONTROL         (UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP && BLE_INCLUDED)
237 #endif /* UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP */
238 
239 #ifdef UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
240 #define BLE_ADV_REPORT_FLOW_CONTROL_NUM     UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
241 #endif /* UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM */
242 
243 #ifdef UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
244 #define BLE_ADV_REPORT_DISCARD_THRSHOLD     UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
245 #endif /* UC_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD */
246 
247 #ifdef UC_BT_ACL_CONNECTIONS
248 #define MAX_ACL_CONNECTIONS         UC_BT_ACL_CONNECTIONS
249 #define GATT_MAX_PHY_CHANNEL        UC_BT_ACL_CONNECTIONS
250 #endif  /* UC_BT_ACL_CONNECTIONS */
251 
252 #ifdef UC_BT_MULTI_CONNECTION_ENBALE
253 #define BT_MULTI_CONNECTION_ENBALE  UC_BT_MULTI_CONNECTION_ENBALE
254 #endif
255 
256 #if(BT_MULTI_CONNECTION_ENBALE && (CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3))
257 #define BLE_CE_LEN_MIN           5
258 #else
259 #define BLE_CE_LEN_MIN           0
260 #endif
261 
262 #ifdef UC_BT_BLE_ESTAB_LINK_CONN_TOUT
263 #define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT UC_BT_BLE_ESTAB_LINK_CONN_TOUT
264 #endif
265 
266 //------------------Added from bdroid_buildcfg.h---------------------
267 #ifndef L2CAP_EXTFEA_SUPPORTED_MASK
268 #define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
269 #endif
270 
271 #ifndef BTUI_OPS_FORMATS
272 #define BTUI_OPS_FORMATS (BTA_OP_VCARD21_MASK | BTA_OP_ANY_MASK)
273 #endif
274 
275 #ifndef BTA_RFC_MTU_SIZE
276 #define BTA_RFC_MTU_SIZE (L2CAP_MTU_SIZE-L2CAP_MIN_OFFSET-RFCOMM_DATA_OVERHEAD)
277 #endif
278 
279 #ifndef SBC_NO_PCM_CPY_OPTION
280 #define SBC_NO_PCM_CPY_OPTION FALSE
281 #endif
282 
283 #ifndef BT_APP_DEMO
284 #define BT_APP_DEMO TRUE
285 #endif
286 
287 #ifndef BTIF_INCLUDED
288 #define BTIF_INCLUDED FALSE
289 #endif
290 
291 /******************************************************************************
292 **
293 ** BTC-layer components
294 **
295 ******************************************************************************/
296 #ifndef BTC_GAP_BT_INCLUDED
297 #define BTC_GAP_BT_INCLUDED FALSE
298 #endif
299 
300 #ifndef BTC_PRF_QUEUE_INCLUDED
301 #define BTC_PRF_QUEUE_INCLUDED FALSE
302 #endif
303 
304 #ifndef BTC_SM_INCLUDED
305 #define BTC_SM_INCLUDED FALSE
306 #endif
307 
308 #ifndef BTC_AV_INCLUDED
309 #define BTC_AV_INCLUDED FALSE
310 #endif
311 
312 #ifndef BTC_AV_SINK_INCLUDED
313 #define BTC_AV_SINK_INCLUDED FALSE
314 #endif
315 
316 #ifndef BTC_AV_SRC_INCLUDED
317 #define BTC_AV_SRC_INCLUDED FALSE
318 #endif
319 
320 #ifndef BTC_SPP_INCLUDED
321 #define BTC_SPP_INCLUDED FALSE
322 #endif
323 
324 #ifndef SBC_DEC_INCLUDED
325 #define SBC_DEC_INCLUDED FALSE
326 #endif
327 
328 #ifndef SBC_ENC_INCLUDED
329 #define SBC_ENC_INCLUDED FALSE
330 #endif
331 
332 /******************************************************************************
333 **
334 ** BTA-layer components
335 **
336 ******************************************************************************/
337 #ifndef BTA_INCLUDED
338 #define BTA_INCLUDED TRUE
339 #endif
340 
341 #ifndef BTA_DM_PM_INCLUDED
342 #define BTA_DM_PM_INCLUDED FALSE
343 #endif
344 
345 #ifndef BTA_DM_QOS_INCLUDED
346 #define BTA_DM_QOS_INCLUDED FALSE
347 #endif
348 
349 #ifndef BTA_PAN_INCLUDED
350 #define BTA_PAN_INCLUDED FALSE
351 #endif
352 
353 #ifndef BTA_HH_INCLUDED
354 #define BTA_HH_INCLUDED FALSE
355 #endif
356 
357 #ifndef BTA_HH_ROLE
358 #define BTA_HH_ROLE BTA_MASTER_ROLE_PREF
359 #endif
360 
361 #ifndef BTA_HH_LE_INCLUDED
362 #define BTA_HH_LE_INCLUDED FALSE
363 #endif
364 
365 #ifndef BTA_AR_INCLUDED
366 #define BTA_AR_INCLUDED FALSE
367 #endif
368 
369 #ifndef BTA_AV_INCLUDED
370 #define BTA_AV_INCLUDED FALSE
371 #endif
372 
373 #ifndef BTA_AV_SINK_INCLUDED
374 #define BTA_AV_SINK_INCLUDED FALSE
375 #endif
376 
377 #ifndef BTA_JV_INCLUDED
378 #define BTA_JV_INCLUDED FALSE
379 #endif
380 
381 #ifndef BTA_SDP_INCLUDED
382 #define BTA_SDP_INCLUDED FALSE
383 #endif
384 
385 /* This is set to enable use of GAP L2CAP connections. */
386 #ifndef VND_BT_JV_BTA_L2CAP
387 #define VND_BT_JV_BTA_L2CAP        FALSE
388 #endif
389 
390 #ifndef BTA_JV_L2CAP_INCLUDED
391 #define BTA_JV_L2CAP_INCLUDED       FALSE
392 #endif
393 
394 #ifndef GAP_CONN_INCLUDED
395 #define GAP_CONN_INCLUDED           FALSE
396 #endif
397 
398 /******************************************************************************
399 **
400 ** Stack-layer components
401 **
402 ******************************************************************************/
403 #ifndef AVCT_INCLUDED
404 #define AVCT_INCLUDED FALSE
405 #endif
406 
407 #ifndef AVDT_INCLUDED
408 #define AVDT_INCLUDED FALSE
409 #endif
410 
411 /******************************************************************************
412 **
413 ** Parameter Configurations for components
414 **
415 ******************************************************************************/
416 #ifndef BTA_DISABLE_DELAY
417 #define BTA_DISABLE_DELAY 200 /* in milliseconds */
418 #endif
419 
420 #ifndef BTA_SYS_TIMER_PERIOD
421 #define BTA_SYS_TIMER_PERIOD  100
422 #endif
423 
424 #ifndef SBC_FOR_EMBEDDED_LINUX
425 #define SBC_FOR_EMBEDDED_LINUX TRUE
426 #endif
427 
428 #ifndef AVDT_VERSION
429 #define AVDT_VERSION  0x0102
430 #endif
431 
432 #ifndef BTA_AG_AT_MAX_LEN
433 #define BTA_AG_AT_MAX_LEN  512
434 #endif
435 
436 #ifndef BTA_AVRCP_FF_RW_SUPPORT
437 #define BTA_AVRCP_FF_RW_SUPPORT FALSE
438 #endif
439 
440 #ifndef BTA_AG_SCO_PKT_TYPES
441 #define BTA_AG_SCO_PKT_TYPES  (BTM_SCO_LINK_ONLY_MASK | BTM_SCO_PKT_TYPES_MASK_EV3 |  BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 | BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | BTM_SCO_PKT_TYPES_MASK_NO_3_EV5)
442 #endif
443 
444 #ifndef BTA_AV_RET_TOUT
445 #define BTA_AV_RET_TOUT 15
446 #endif
447 
448 #ifndef PORCHE_PAIRING_CONFLICT
449 #define PORCHE_PAIRING_CONFLICT  TRUE
450 #endif
451 
452 #ifndef BTA_AV_CO_CP_SCMS_T
453 #define BTA_AV_CO_CP_SCMS_T  FALSE
454 #endif
455 
456 #if UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
457 #define SCAN_QUEUE_CONGEST_CHECK  TRUE
458 #else
459 #define SCAN_QUEUE_CONGEST_CHECK  FALSE
460 #endif
461 
462 #ifdef UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
463 #define BTM_PERIPHERAL_ENABLED   UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
464 #endif
465 
466 #ifdef UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
467 #define GATTS_SEND_SERVICE_CHANGE_MODE UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
468 #endif
469 
470 #ifdef UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN
471 #define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY    UC_BT_BLE_ACT_SCAN_REP_ADV_SCAN
472 #endif
473 
474 /* This feature is used to eanble interleaved scan*/
475 #ifndef BTA_HOST_INTERLEAVE_SEARCH
476 #define BTA_HOST_INTERLEAVE_SEARCH FALSE
477 #endif
478 
479 #ifndef BT_USE_TRACES
480 #define BT_USE_TRACES  FALSE
481 #endif
482 
483 #ifndef BT_TRACE_BTIF
484 #define BT_TRACE_BTIF  TRUE
485 #endif
486 
487 #ifndef BT_TRACE_VERBOSE
488 #define BT_TRACE_VERBOSE  FALSE
489 #endif
490 
491 #ifndef BTA_DM_SDP_DB_SIZE
492 #define BTA_DM_SDP_DB_SIZE  8000
493 #endif
494 
495 #ifndef HL_INCLUDED
496 #define HL_INCLUDED  TRUE
497 #endif
498 
499 #ifndef AG_VOICE_SETTINGS
500 #define AG_VOICE_SETTINGS  HCI_DEFAULT_VOICE_SETTINGS
501 #endif
502 
503 #ifndef BTIF_DM_OOB_TEST
504 #define BTIF_DM_OOB_TEST  FALSE
505 #endif
506 
507 // How long to wait before activating sniff mode after entering the
508 // idle state for FTS, OPS connections
509 #ifndef BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS
510 #define BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS 7000
511 #endif
512 #ifndef BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS
513 #define BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS 5000
514 #endif
515 
516 //------------------End added from bdroid_buildcfg.h---------------------
517 
518 
519 /******************************************************************************
520 **
521 ** Buffer Size
522 **
523 ******************************************************************************/
524 
525 #ifndef BT_DEFAULT_BUFFER_SIZE
526 #define BT_DEFAULT_BUFFER_SIZE          (4096 + 16)
527 #endif
528 
529 #ifndef BT_SMALL_BUFFER_SIZE
530 #define BT_SMALL_BUFFER_SIZE            660
531 #endif
532 
533 /* Receives HCI events from the lower-layer. */
534 #ifndef HCI_CMD_BUF_SIZE
535 #define HCI_CMD_BUF_SIZE                BT_SMALL_BUFFER_SIZE
536 #endif
537 
538 /* Sends SDP data packets. */
539 #ifndef SDP_DATA_BUF_SIZE
540 #define SDP_DATA_BUF_SIZE               BT_DEFAULT_BUFFER_SIZE
541 #endif
542 
543 /* Sends RFCOMM command packets. */
544 #ifndef RFCOMM_CMD_BUF_SIZE
545 #define RFCOMM_CMD_BUF_SIZE             BT_SMALL_BUFFER_SIZE
546 #endif
547 
548 /* Sends RFCOMM data packets. */
549 #ifndef RFCOMM_DATA_BUF_SIZE
550 #define RFCOMM_DATA_BUF_SIZE            BT_DEFAULT_BUFFER_SIZE
551 #endif
552 
553 /* Sends L2CAP packets to the peer and HCI messages to the controller. */
554 #ifndef L2CAP_CMD_BUF_SIZE
555 #define L2CAP_CMD_BUF_SIZE              BT_SMALL_BUFFER_SIZE
556 #endif
557 
558 #ifndef L2CAP_USER_TX_BUF_SIZE
559 #define L2CAP_USER_TX_BUF_SIZE          BT_DEFAULT_BUFFER_SIZE
560 #endif
561 
562 #ifndef L2CAP_USER_RX_BUF_SIZE
563 #define L2CAP_USER_RX_BUF_SIZE          BT_DEFAULT_BUFFER_SIZE
564 #endif
565 
566 /* Sends L2CAP segmented packets in ERTM mode */
567 #ifndef L2CAP_FCR_TX_BUF_SIZE
568 #define L2CAP_FCR_TX_BUF_SIZE           BT_DEFAULT_BUFFER_SIZE
569 #endif
570 
571 /* Receives L2CAP segmented packets in ERTM mode */
572 #ifndef L2CAP_FCR_RX_BUF_SIZE
573 #define L2CAP_FCR_RX_BUF_SIZE           BT_DEFAULT_BUFFER_SIZE
574 #endif
575 
576 #ifndef L2CAP_FCR_ERTM_BUF_SIZE
577 #define L2CAP_FCR_ERTM_BUF_SIZE         (10240 + 24)
578 #endif
579 
580 /* Number of ACL buffers to assign to LE
581    if the HCI buffer pool is shared with BR/EDR */
582 #ifndef L2C_DEF_NUM_BLE_BUF_SHARED
583 #define L2C_DEF_NUM_BLE_BUF_SHARED      1
584 #endif
585 
586 /* Used by BTM when it sends HCI commands to the controller. */
587 #ifndef BTM_CMD_BUF_SIZE
588 #define BTM_CMD_BUF_SIZE                BT_SMALL_BUFFER_SIZE
589 #endif
590 
591 #ifndef OBX_LRG_DATA_BUF_SIZE
592 #define OBX_LRG_DATA_BUF_SIZE           (8080 + 26)
593 #endif
594 
595 /* Used to send data to L2CAP. */
596 #ifndef GAP_DATA_BUF_SIZE
597 #define GAP_DATA_BUF_SIZE               BT_DEFAULT_BUFFER_SIZE
598 #endif
599 
600 /* BNEP data and protocol messages. */
601 #ifndef BNEP_BUF_SIZE
602 #define BNEP_BUF_SIZE                   BT_DEFAULT_BUFFER_SIZE
603 #endif
604 
605 /* AVDTP buffer size for protocol messages */
606 #ifndef AVDT_CMD_BUF_SIZE
607 #define AVDT_CMD_BUF_SIZE               BT_SMALL_BUFFER_SIZE
608 #endif
609 
610 /* AVDTP buffer size for media packets in case of fragmentation */
611 #ifndef AVDT_DATA_BUF_SIZE
612 #define AVDT_DATA_BUF_SIZE              BT_DEFAULT_BUFFER_SIZE
613 #endif
614 
615 #ifndef PAN_BUF_SIZE
616 #define PAN_BUF_SIZE                    BT_DEFAULT_BUFFER_SIZE
617 #endif
618 
619 /* Maximum number of buffers to allocate for PAN */
620 #ifndef PAN_BUF_MAX
621 #define PAN_BUF_MAX                     100
622 #endif
623 
624 /* AVCTP buffer size for protocol messages */
625 #ifndef AVCT_CMD_BUF_SIZE
626 #define AVCT_CMD_BUF_SIZE               288
627 #endif
628 
629 /* AVRCP buffer size for protocol messages */
630 #ifndef AVRC_CMD_BUF_SIZE
631 #define AVRC_CMD_BUF_SIZE               288
632 #endif
633 
634 /* AVRCP Metadata buffer size for protocol messages */
635 #ifndef AVRC_META_CMD_BUF_SIZE
636 #define AVRC_META_CMD_BUF_SIZE          BT_SMALL_BUFFER_SIZE
637 #endif
638 
639 #ifndef BTA_HL_LRG_DATA_BUF_SIZE
640 #define BTA_HL_LRG_DATA_BUF_SIZE        (10240 + 24)
641 #endif
642 
643 /* GATT Server Database buffer size */
644 #ifndef GATT_DB_BUF_SIZE
645 #define GATT_DB_BUF_SIZE                128
646 #endif
647 
648 /* GATT Data sending buffer size */
649 #ifndef GATT_DATA_BUF_SIZE
650 #define GATT_DATA_BUF_SIZE              BT_DEFAULT_BUFFER_SIZE
651 #endif
652 
653 /******************************************************************************
654 **
655 ** HCI Services (H4)
656 **
657 ******************************************************************************/
658 
659 /* Use 2 second for low-resolution systems, override to 1 for high-resolution systems */
660 #ifndef BT_1SEC_TIMEOUT
661 #define BT_1SEC_TIMEOUT             (2)
662 #endif
663 
664 /* Quick Timer */
665 /* if L2CAP_FCR_INCLUDED is TRUE then it should have 100 millisecond resolution */
666 /* if none of them is included then QUICK_TIMER_TICKS_PER_SEC is set to 0 to exclude quick timer */
667 #ifndef QUICK_TIMER_TICKS_PER_SEC
668 #define QUICK_TIMER_TICKS_PER_SEC   10       /* 100ms timer */
669 #endif
670 
671 /******************************************************************************
672 **
673 ** BTM
674 **
675 ******************************************************************************/
676 
677 /* Cancel Inquiry on incoming SSP */
678 #ifndef BTM_NO_SSP_ON_INQUIRY
679 #define BTM_NO_SSP_ON_INQUIRY       FALSE
680 #endif
681 
682 /* Includes SCO if TRUE */
683 #ifndef BTM_SCO_INCLUDED
684 #define BTM_SCO_INCLUDED                FALSE       /* TRUE includes SCO code */
685 #endif
686 
687 /* Includes SCO if TRUE */
688 #ifndef BTM_SCO_HCI_INCLUDED
689 #if UC_BT_HFP_AUDIO_DATA_PATH_HCI
690 #define BTM_SCO_HCI_INCLUDED            TRUE       /* TRUE includes SCO over HCI code */
691 #else
692 #define BTM_SCO_HCI_INCLUDED            FALSE
693 #endif /* UC_HFP_AUDIO_DATA_PATH_HCI */
694 #endif
695 
696 /* Includes WBS if TRUE */
697 #ifndef BTM_WBS_INCLUDED
698 #define BTM_WBS_INCLUDED                UC_BT_HFP_WBS_ENABLE    /* TRUE includes WBS code */
699 #endif
700 
701 /*  This is used to work around a controller bug that doesn't like Disconnect
702 **  issued while there is a role switch in progress
703 */
704 #ifndef BTM_DISC_DURING_RS
705 #define BTM_DISC_DURING_RS TRUE
706 #endif
707 
708 /**************************
709 ** Initial SCO TX credit
710 *************************/
711 /* max TX SCO data packet size */
712 #ifndef BTM_SCO_DATA_SIZE_MAX
713 #define BTM_SCO_DATA_SIZE_MAX       120 //240
714 #endif
715 
716 /* max TX eSCO data packet size */
717 #ifndef BTM_MSBC_FRAME_SIZE
718 #define BTM_MSBC_FRAME_SIZE      60
719 #endif
720 
721 /* TX eSCO data packet size */
722 #ifndef BTM_MSBC_FRAME_DATA_SIZE
723 #define BTM_MSBC_FRAME_DATA_SIZE          57
724 #endif
725 
726 /* The size in bytes of the BTM inquiry database. 5 As Default */
727 #ifndef BTM_INQ_DB_SIZE
728 #define BTM_INQ_DB_SIZE             5
729 #endif
730 
731 /* The default scan mode */
732 #ifndef BTM_DEFAULT_SCAN_TYPE
733 #define BTM_DEFAULT_SCAN_TYPE       BTM_SCAN_TYPE_INTERLACED
734 #endif
735 
736 /* Should connections to unknown devices be allowed when not discoverable? */
737 #ifndef BTM_ALLOW_CONN_IF_NONDISCOVER
738 #define BTM_ALLOW_CONN_IF_NONDISCOVER   TRUE
739 #endif
740 
741 /* Sets the Page_Scan_Window:  the length of time that the device is performing a page scan. */
742 #ifndef BTM_DEFAULT_CONN_WINDOW
743 #define BTM_DEFAULT_CONN_WINDOW     0x0012
744 #endif
745 
746 /* Sets the Page_Scan_Activity:  the interval between the start of two consecutive page scans. */
747 #ifndef BTM_DEFAULT_CONN_INTERVAL
748 #define BTM_DEFAULT_CONN_INTERVAL   0x0800
749 #endif
750 
751 /* When automatic inquiry scan is enabled, this sets the inquiry scan window. */
752 #ifndef BTM_DEFAULT_DISC_WINDOW
753 #define BTM_DEFAULT_DISC_WINDOW     0x0012
754 #endif
755 
756 /* When automatic inquiry scan is enabled, this sets the inquiry scan interval. */
757 #ifndef BTM_DEFAULT_DISC_INTERVAL
758 #define BTM_DEFAULT_DISC_INTERVAL   0x0800
759 #endif
760 
761 /*
762 * {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
763 *
764 * SERVICE_CLASS:0x5A (Bit17 -Networking,Bit19 - Capturing,Bit20 -Object Transfer,Bit22 -Telephony)
765 * MAJOR_CLASS:0x02 - PHONE
766 * MINOR_CLASS:0x0C - SMART_PHONE
767 *
768 */
769 #define BTA_DM_COD_SMARTPHONE {0x5A, 0x02, 0x0C}
770 
771 /*
772 * {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
773 *
774 * SERVICE_CLASS:0x2C (Bit21 - Audio, Bit19 - Capturing)
775 * MAJOR_CLASS:0x04 - Audio/Video
776 * MINOR_CLASS:0x05 - LoudSpeaker
777 */
778 #define BTA_DM_COD_LOUDSPEAKER {0x2C, 0x04, 0x14}
779 
780 /*
781 * {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
782 *
783 * SERVICE_CLASS:0x00 None
784 * MAJOR_CLASS:0x1f - Uncategorized: device code not specified
785 * MINOR_CLASS:0x00 - None
786 */
787 #define BTA_DM_COD_UNCLASSIFIED {0x00, 0x1f, 0x00}
788 
789 /* Default class of device */
790 #ifndef BTA_DM_COD
791 #define BTA_DM_COD BTA_DM_COD_UNCLASSIFIED
792 #endif
793 
794 /* The number of SCO links. */
795 #ifndef BTM_MAX_SCO_LINKS
796 #define BTM_MAX_SCO_LINKS           0	//3
797 #endif
798 
799 /* The preferred type of SCO links (2-eSCO, 0-SCO). */
800 #ifndef BTM_DEFAULT_SCO_MODE
801 #define BTM_DEFAULT_SCO_MODE        2
802 #endif
803 
804 /* The number of security records for peer devices. 100 AS Default*/
805 #ifndef BTM_SEC_MAX_DEVICE_RECORDS
806 #if SMP_INCLUDED == TRUE
807 #define BTM_SEC_MAX_DEVICE_RECORDS  15 // 100
808 #else
809 #define BTM_SEC_MAX_DEVICE_RECORDS  8
810 #endif /* SMP_INCLUDED == TRUE */
811 #endif
812 
813 /* The number of security records for services. 32 AS Default*/
814 #ifndef BTM_SEC_MAX_SERVICE_RECORDS
815 #define BTM_SEC_MAX_SERVICE_RECORDS 8 // 32
816 #endif
817 
818 /* If True, force a retrieval of remote device name for each bond in case it's changed */
819 #ifndef BTM_SEC_FORCE_RNR_FOR_DBOND
820 #define BTM_SEC_FORCE_RNR_FOR_DBOND  FALSE
821 #endif
822 
823 /* Maximum device name length used in btm database. Up to 248*/
824 #ifndef BTM_MAX_REM_BD_NAME_LEN
825 #define BTM_MAX_REM_BD_NAME_LEN     64
826 #endif
827 
828 /* Maximum local device name length stored btm database.
829   '0' disables storage of the local name in BTM */
830 #ifndef BTM_MAX_LOC_BD_NAME_LEN
831 #define BTM_MAX_LOC_BD_NAME_LEN     64
832 #endif
833 
834 /* Fixed Default String. When this is defined as null string, the device's
835  * product model name is used as the default local name.
836  */
837 #ifndef BTM_DEF_LOCAL_NAME
838 #define BTM_DEF_LOCAL_NAME      ""
839 #endif
840 
841 /* Maximum service name stored with security authorization (0 if not needed) */
842 #ifndef BTM_SEC_SERVICE_NAME_LEN
843 #define BTM_SEC_SERVICE_NAME_LEN    BT_MAX_SERVICE_NAME_LEN
844 #endif
845 
846 /* Maximum length of the service name. */
847 #ifndef BT_MAX_SERVICE_NAME_LEN
848 #define BT_MAX_SERVICE_NAME_LEN     21
849 #endif
850 
851 /* ACL buffer size in HCI Host Buffer Size command. */
852 #ifndef BTM_ACL_BUF_SIZE
853 #define BTM_ACL_BUF_SIZE            0
854 #endif
855 
856 /* The maximum number of clients that can register with the power manager. */
857 #ifndef BTM_MAX_PM_RECORDS
858 #define BTM_MAX_PM_RECORDS          2
859 #endif
860 
861 /* This is set to show debug trace messages for the power manager. */
862 #ifndef BTM_PM_DEBUG
863 #define BTM_PM_DEBUG                FALSE
864 #endif
865 
866 /* This is set to TRUE if link is to be unparked due to BTM_CreateSCO API. */
867 #ifndef BTM_SCO_WAKE_PARKED_LINK
868 #define BTM_SCO_WAKE_PARKED_LINK    FALSE
869 #endif
870 
871 /* If the user does not respond to security process requests within this many seconds,
872  * a negative response would be sent automatically.
873  * 30 is LMP response timeout value */
874 #ifndef BTM_SEC_TIMEOUT_VALUE
875 #define BTM_SEC_TIMEOUT_VALUE           35
876 #endif
877 
878 /* Maximum number of callbacks that can be registered using BTM_RegisterForVSEvents */
879 #ifndef BTM_MAX_VSE_CALLBACKS
880 #define BTM_MAX_VSE_CALLBACKS           3
881 #endif
882 
883 /******************************************
884 **    Lisbon Features
885 *******************************************/
886 /* This is set to TRUE if the FEC is required for EIR packet. */
887 #ifndef BTM_EIR_DEFAULT_FEC_REQUIRED
888 #define BTM_EIR_DEFAULT_FEC_REQUIRED    TRUE
889 #endif
890 
891 /* The IO capability of the local device (for Simple Pairing) */
892 #ifndef BTM_LOCAL_IO_CAPS
893 #define BTM_LOCAL_IO_CAPS               BTM_IO_CAP_NONE
894 #endif
895 
896 #ifndef BTM_LOCAL_IO_CAPS_BLE
897 #if (BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
898 #define BTM_LOCAL_IO_CAPS_BLE           BTM_IO_CAP_KBDISP
899 #else
900 #define BTM_LOCAL_IO_CAPS_BLE           4
901 #endif  ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
902 #endif
903 
904 /* The default MITM Protection Requirement (for Simple Pairing)
905  * Possible values are BTM_AUTH_SP_YES or BTM_AUTH_SP_NO */
906 #ifndef BTM_DEFAULT_AUTH_REQ
907 #define BTM_DEFAULT_AUTH_REQ            BTM_AUTH_SP_NO
908 #endif
909 
910 /* The default MITM Protection Requirement for dedicated bonding using Simple Pairing
911  * Possible values are BTM_AUTH_AP_YES or BTM_AUTH_AP_NO */
912 #ifndef BTM_DEFAULT_DD_AUTH_REQ
913 #define BTM_DEFAULT_DD_AUTH_REQ            BTM_AUTH_AP_YES
914 #endif
915 
916 /* Include Out-of-Band implementation for Simple Pairing */
917 #ifndef BTM_OOB_INCLUDED
918 #define BTM_OOB_INCLUDED                TRUE
919 #endif
920 
921 /* TRUE to include Sniff Subrating */
922 #if (BTA_DM_PM_INCLUDED == TRUE)
923 #ifndef BTM_SSR_INCLUDED
924 #define BTM_SSR_INCLUDED                FALSE
925 #endif
926 #endif /* BTA_DM_PM_INCLUDED */
927 
928 /*************************
929 ** End of Lisbon Features
930 **************************/
931 
932 /* 4.1/4.2 secure connections feature */
933 #ifndef SC_MODE_INCLUDED
934 // Disable AES-CCM (BT 4.1) for BT Classic to workaround controller AES issue. E0 encryption (BT 4.0) will be used.
935 #define SC_MODE_INCLUDED                FALSE
936 #endif
937 
938 /* Used for conformance testing ONLY */
939 #ifndef BTM_BLE_CONFORMANCE_TESTING
940 #define BTM_BLE_CONFORMANCE_TESTING           FALSE
941 #endif
942 
943 /******************************************************************************
944 **
945 ** CONTROLLER TO HOST FLOW CONTROL
946 **
947 ******************************************************************************/
948 
949 #define C2H_FLOW_CONTROL_INCLUDED TRUE
950 
951 /******************************************************************************
952 **
953 ** L2CAP
954 **
955 ******************************************************************************/
956 
957 #ifndef L2CAP_CLIENT_INCLUDED
958 #define L2CAP_CLIENT_INCLUDED FALSE
959 #endif
960 
961 /* The maximum number of simultaneous applications that can register with LE L2CAP. */
962 #ifndef BLE_MAX_L2CAP_CLIENTS
963 #define BLE_MAX_L2CAP_CLIENTS           15
964 #endif
965 
966 
967 /* The maximum number of simultaneous links that L2CAP can support. Up to 7*/
968 #ifndef MAX_ACL_CONNECTIONS
969 #define MAX_L2CAP_LINKS             5
970 #else
971 #define MAX_L2CAP_LINKS             MAX_ACL_CONNECTIONS
972 #endif
973 
974 /* The maximum number of simultaneous channels that L2CAP can support. Up to 16*/
975 #ifndef MAX_L2CAP_CHANNELS
976 #if (CLASSIC_BT_INCLUDED == TRUE)
977 #define MAX_L2CAP_CHANNELS          16
978 #else
979 #if (SMP_INCLUDED == FALSE)
980 #define MAX_L2CAP_CHANNELS          MAX_ACL_CONNECTIONS  //This is used in the BLE client when start connected with the peer device
981 #else
982 #define MAX_L2CAP_CHANNELS          (MAX_ACL_CONNECTIONS * 2)  //This is used in the BLE client when start connected with the peer device and in SMP
983 #endif   ///SMP_INCLUDED == FALSE
984 #endif   ///CLASSIC_BT_INCLUDED == TRUE
985 #endif   ///MAX_L2CAP_CHANNELS
986 
987 /* The maximum number of simultaneous applications that can register with L2CAP. */
988 #ifndef MAX_L2CAP_CLIENTS
989 #if (CLASSIC_BT_INCLUDED == TRUE)
990 #define MAX_L2CAP_CLIENTS           8
991 #else
992 #define MAX_L2CAP_CLIENTS           1  //Not support to allocate a channel control block in BLE only mode
993 #endif  ///CLASSIC_BT_INCLUDED == TRUE
994 #endif
995 
996 /* The number of seconds of link inactivity before a link is disconnected. */
997 #ifndef L2CAP_LINK_INACTIVITY_TOUT
998 #define L2CAP_LINK_INACTIVITY_TOUT  4
999 #endif
1000 
1001 /* The number of seconds of link inactivity after bonding before a link is disconnected. */
1002 #ifndef L2CAP_BONDING_TIMEOUT
1003 #define L2CAP_BONDING_TIMEOUT       3
1004 #endif
1005 
1006 /* The time from the HCI connection complete to disconnect if no channel is established. */
1007 #ifndef L2CAP_LINK_STARTUP_TOUT
1008 #define L2CAP_LINK_STARTUP_TOUT     60
1009 #endif
1010 
1011 /* The L2CAP MTU; must be in accord with the HCI ACL pool size. */
1012 #ifndef L2CAP_MTU_SIZE
1013 #define L2CAP_MTU_SIZE              1691
1014 #endif
1015 
1016 /* The L2CAP MPS over Bluetooth; must be in accord with the FCR tx pool size and ACL down buffer size. */
1017 #ifndef L2CAP_MPS_OVER_BR_EDR
1018 #define L2CAP_MPS_OVER_BR_EDR       1010
1019 #endif
1020 
1021 /* If host flow control enabled, this is the number of buffers the controller can have unacknowledged. */
1022 #ifndef L2CAP_HOST_FC_ACL_BUFS
1023 #define L2CAP_HOST_FC_ACL_BUFS      20
1024 #endif
1025 
1026 /* This is set to enable L2CAP to  take the ACL link out of park mode when ACL data is to be sent. */
1027 #ifndef L2CAP_WAKE_PARKED_LINK
1028 #define L2CAP_WAKE_PARKED_LINK      TRUE
1029 #endif
1030 
1031 /* Whether link wants to be the master or the slave. */
1032 #ifndef L2CAP_DESIRED_LINK_ROLE
1033 #define L2CAP_DESIRED_LINK_ROLE     HCI_ROLE_SLAVE
1034 #endif
1035 
1036 /* Include Non-Flushable Packet Boundary Flag feature of Lisbon */
1037 #ifndef L2CAP_NON_FLUSHABLE_PB_INCLUDED
1038 #define L2CAP_NON_FLUSHABLE_PB_INCLUDED     TRUE
1039 #endif
1040 
1041 /* Minimum number of ACL credit for high priority link */
1042 #ifndef L2CAP_HIGH_PRI_MIN_XMIT_QUOTA
1043 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA       5
1044 #endif
1045 
1046 /* used for monitoring HCI ACL credit management */
1047 #ifndef L2CAP_HCI_FLOW_CONTROL_DEBUG
1048 #define L2CAP_HCI_FLOW_CONTROL_DEBUG        TRUE
1049 #endif
1050 
1051 /* Used for calculating transmit buffers off of */
1052 #ifndef L2CAP_NUM_XMIT_BUFFS
1053 #define L2CAP_NUM_XMIT_BUFFS                HCI_ACL_BUF_MAX
1054 #endif
1055 
1056 /* Unicast Connectionless Data */
1057 #ifndef L2CAP_UCD_INCLUDED
1058 #define L2CAP_UCD_INCLUDED                  FALSE
1059 #endif
1060 
1061 /* Unicast Connectionless Data MTU */
1062 #ifndef L2CAP_UCD_MTU
1063 #define L2CAP_UCD_MTU                       L2CAP_MTU_SIZE
1064 #endif
1065 
1066 /* Unicast Connectionless Data Idle Timeout */
1067 #ifndef L2CAP_UCD_IDLE_TIMEOUT
1068 #define L2CAP_UCD_IDLE_TIMEOUT              2
1069 #endif
1070 
1071 /* Unicast Connectionless Data Idle Timeout */
1072 #ifndef L2CAP_UCD_CH_PRIORITY
1073 #define L2CAP_UCD_CH_PRIORITY               L2CAP_CHNL_PRIORITY_MEDIUM
1074 #endif
1075 
1076 /* Used for features using fixed channels; set to zero if no fixed channels supported (BLE, etc.) */
1077 /* Excluding L2CAP signaling channel and UCD */
1078 #ifndef L2CAP_NUM_FIXED_CHNLS
1079 #if (CLASSIC_BT_INCLUDED == TRUE)
1080 #define L2CAP_NUM_FIXED_CHNLS               32
1081 #else
1082 #define L2CAP_NUM_FIXED_CHNLS               3   //There are just three fix channel in the BLE only mode(gatt,signal,smp)
1083 #endif  ///CLASSIC_BT_INCLUDED == TRUE
1084 #endif
1085 
1086 /* First fixed channel supported */
1087 #ifndef L2CAP_FIRST_FIXED_CHNL
1088 #define L2CAP_FIRST_FIXED_CHNL              4
1089 #endif
1090 
1091 #ifndef L2CAP_LAST_FIXED_CHNL
1092 #define L2CAP_LAST_FIXED_CHNL           (L2CAP_FIRST_FIXED_CHNL + L2CAP_NUM_FIXED_CHNLS - 1)
1093 #endif
1094 
1095 /* Round Robin service channels in link */
1096 #ifndef L2CAP_ROUND_ROBIN_CHANNEL_SERVICE
1097 #define L2CAP_ROUND_ROBIN_CHANNEL_SERVICE   TRUE
1098 #endif
1099 
1100 /* Used for calculating transmit buffers off of */
1101 #ifndef L2CAP_NUM_XMIT_BUFFS
1102 #define L2CAP_NUM_XMIT_BUFFS                HCI_ACL_BUF_MAX
1103 #endif
1104 
1105 /* used for monitoring eL2CAP data flow */
1106 #ifndef L2CAP_ERTM_STATS
1107 #define L2CAP_ERTM_STATS                    FALSE
1108 #endif
1109 
1110 /* Used for conformance testing ONLY:  When TRUE lets scriptwrapper overwrite info response */
1111 #ifndef L2CAP_CONFORMANCE_TESTING
1112 #define L2CAP_CONFORMANCE_TESTING           FALSE
1113 #endif
1114 
1115 /*
1116  * Max bytes per connection to buffer locally before dropping the
1117  * connection if local client does not receive it  - default is 1MB
1118  */
1119 #ifndef L2CAP_MAX_RX_BUFFER
1120 #define L2CAP_MAX_RX_BUFFER                 0x100000
1121 #endif
1122 
1123 
1124 #ifndef TIMER_PARAM_TYPE
1125 #define TIMER_PARAM_TYPE    UINT32
1126 #endif
1127 
1128 /******************************************************************************
1129 **
1130 ** BLE
1131 **
1132 ******************************************************************************/
1133 
1134 #ifndef BLE_INCLUDED
1135 #define BLE_INCLUDED            FALSE
1136 #endif
1137 
1138 #ifndef BLE_ANDROID_CONTROLLER_SCAN_FILTER
1139 #define BLE_ANDROID_CONTROLLER_SCAN_FILTER            TRUE
1140 #endif
1141 
1142 #ifndef LOCAL_BLE_CONTROLLER_ID
1143 #define LOCAL_BLE_CONTROLLER_ID         (1)
1144 #endif
1145 
1146 /*
1147  * Toggles support for general LE privacy features such as remote address
1148  * resolution, local address rotation etc.
1149  */
1150 #ifndef BLE_PRIVACY_SPT
1151 #define BLE_PRIVACY_SPT         FALSE
1152 #endif
1153 
1154 /*
1155  * Enables or disables support for local privacy (ex. address rotation)
1156  */
1157 #ifndef BLE_LOCAL_PRIVACY_ENABLED
1158 #define BLE_LOCAL_PRIVACY_ENABLED         TRUE
1159 #endif
1160 
1161 /*
1162  * Toggles support for vendor specific extensions such as RPA offloading,
1163  * feature discovery, multi-adv etc.
1164  */
1165 #ifndef BLE_VND_INCLUDED
1166 #define BLE_VND_INCLUDED        FALSE
1167 #endif
1168 
1169 #ifndef BTM_BLE_ADV_TX_POWER
1170 #define BTM_BLE_ADV_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
1171 #endif
1172 
1173 #ifndef BTM_TX_POWER
1174 #define BTM_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
1175 #endif
1176 
1177 #ifndef BTM_TX_POWER_LEVEL_MAX
1178 #define BTM_TX_POWER_LEVEL_MAX 7
1179 #endif
1180 
1181 
1182 #ifndef BLE_BATCH_SCAN_INCLUDED
1183 #define BLE_BATCH_SCAN_INCLUDED  TRUE
1184 #endif
1185 
1186 /******************************************************************************
1187 **
1188 ** ATT/GATT Protocol/Profile Settings
1189 **
1190 ******************************************************************************/
1191 #ifndef GATT_INCLUDED
1192 #if BLE_INCLUDED == TRUE
1193 #define GATT_INCLUDED TRUE
1194 #else
1195 #define GATT_INCLUDED FALSE
1196 #endif
1197 #endif
1198 
1199 #ifndef BTA_GATT_INCLUDED
1200 #if BLE_INCLUDED == TRUE
1201 #define BTA_GATT_INCLUDED TRUE
1202 #else
1203 #define BTA_GATT_INCLUDED FALSE
1204 #endif
1205 #endif
1206 
1207 #if BTA_GATT_INCLUDED == TRUE && BLE_INCLUDED == FALSE
1208 #error "can't have GATT without BLE"
1209 #endif
1210 
1211 #ifndef BLE_LLT_INCLUDED
1212 #define BLE_LLT_INCLUDED    TRUE
1213 #endif
1214 
1215 /* Added this marco to fixed the android 7.0 will lead to update connection parameters
1216    collision when the slave sent the HCI_BLE_UPD_LL_CONN_PARAMS comment to the controller
1217    request the master to update connection parameters directly. */
1218 #ifndef BLE_SLAVE_UPD_CONN_PARAMS
1219 #define BLE_SLAVE_UPD_CONN_PARAMS FALSE
1220 #endif
1221 
1222 #ifndef ATT_INCLUDED
1223 #define ATT_INCLUDED         TRUE
1224 #endif
1225 
1226 #ifndef ATT_DEBUG
1227 #define ATT_DEBUG           FALSE
1228 #endif
1229 
1230 #ifndef BLE_PERIPHERAL_MODE_SUPPORT
1231 #define BLE_PERIPHERAL_MODE_SUPPORT  TRUE
1232 #endif
1233 
1234 #ifndef BLE_DELAY_REQUEST_ENC
1235 /* This flag is to work around IPHONE problem, We need to wait for iPhone ready
1236    before send encryption request to iPhone */
1237 #define BLE_DELAY_REQUEST_ENC        FALSE
1238 #endif
1239 
1240 #ifndef GAP_TRANSPORT_SUPPORTED
1241 #define GAP_TRANSPORT_SUPPORTED      GATT_TRANSPORT_LE_BR_EDR
1242 #endif
1243 
1244 #ifndef GATTP_TRANSPORT_SUPPORTED
1245 #define GATTP_TRANSPORT_SUPPORTED    GATT_TRANSPORT_LE_BR_EDR
1246 #endif
1247 
1248 #ifndef GATT_MAX_SR_PROFILES
1249 #define GATT_MAX_SR_PROFILES        UC_CONFIG_BT_GATT_MAX_SR_PROFILES
1250 #endif
1251 
1252 #ifndef GATT_MAX_APPS
1253 #define GATT_MAX_APPS            8 /* MAX is 32 note: 2 apps used internally GATT and GAP */
1254 #endif
1255 
1256 #ifndef GATT_MAX_PHY_CHANNEL
1257 #define GATT_MAX_PHY_CHANNEL        7
1258 #endif
1259 
1260 /* Used for conformance testing ONLY */
1261 #ifndef GATT_CONFORMANCE_TESTING
1262 #define GATT_CONFORMANCE_TESTING           FALSE
1263 #endif
1264 
1265 /* number of background connection device allowence, ideally to be the same as WL size
1266 */
1267 #ifndef GATT_MAX_BG_CONN_DEV
1268 #define GATT_MAX_BG_CONN_DEV        8 /*MAX is 32*/
1269 #endif
1270 
1271 /******************************************************************************
1272 **
1273 ** GATT
1274 **
1275 ******************************************************************************/
1276 #ifndef GATTC_INCLUDED
1277 #if BLE_INCLUDED == TRUE
1278 #define GATTC_INCLUDED         FALSE
1279 #else
1280 #define GATTC_INCLUDED         FALSE
1281 #endif
1282 #endif
1283 
1284 #ifndef GATTS_INCLUDED
1285 #if BLE_INCLUDED == TRUE
1286 #define GATTS_INCLUDED         TRUE
1287 #else
1288 #define GATTS_INCLUDED         FALSE
1289 #endif
1290 #endif
1291 
1292 /******************************************************************************
1293 **
1294 ** SMP
1295 **
1296 ******************************************************************************/
1297 #ifndef SMP_INCLUDED
1298 #if BLE_INCLUDED == TRUE
1299 #define SMP_INCLUDED         FALSE
1300 #else
1301 #define SMP_INCLUDED         FALSE
1302 #endif
1303 #endif
1304 
1305 #ifndef SMP_DEBUG
1306 #define SMP_DEBUG            FALSE
1307 #endif
1308 
1309 #ifndef SMP_DEFAULT_AUTH_REQ
1310 #define SMP_DEFAULT_AUTH_REQ    SMP_AUTH_NB_ENC_ONLY
1311 #endif
1312 
1313 #ifndef SMP_MAX_ENC_KEY_SIZE
1314 #define SMP_MAX_ENC_KEY_SIZE    16
1315 #endif
1316 
1317 #ifndef SMP_MIN_ENC_KEY_SIZE
1318 #define SMP_MIN_ENC_KEY_SIZE    7
1319 #endif
1320 
1321 /* minimum link timeout after SMP pairing is done, leave room for key exchange
1322    and racing condition for the following service connection.
1323    Prefer greater than 0 second, and no less than default inactivity link idle
1324    timer(L2CAP_LINK_INACTIVITY_TOUT) in l2cap) */
1325 #ifndef SMP_LINK_TOUT_MIN
1326 #if (L2CAP_LINK_INACTIVITY_TOUT > 0)
1327 #define SMP_LINK_TOUT_MIN               L2CAP_LINK_INACTIVITY_TOUT
1328 #else
1329 #define SMP_LINK_TOUT_MIN               2
1330 #endif
1331 #endif
1332 
1333 /******************************************************************************
1334 **
1335 ** BT_SSP
1336 **
1337 ******************************************************************************/
1338 #ifndef BT_SSP_INCLUDED
1339 #define BT_SSP_INCLUDED         FALSE
1340 #endif
1341 
1342 #if BT_SSP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == FALSE
1343 #error "Can't have SSP without CLASSIC BT"
1344 #endif
1345 
1346 /******************************************************************************
1347 **
1348 ** SDP
1349 **
1350 ******************************************************************************/
1351 
1352 #ifndef SDP_INCLUDED
1353 #define SDP_INCLUDED                FALSE
1354 #endif
1355 
1356 /* This is set to enable SDP server functionality. */
1357 #ifndef SDP_SERVER_ENABLED
1358 #if SDP_INCLUDED == TRUE
1359 #define SDP_SERVER_ENABLED          TRUE
1360 #else
1361 #define SDP_SERVER_ENABLED          FALSE
1362 #endif
1363 #endif
1364 
1365 /* This is set to enable SDP client functionality. */
1366 #ifndef SDP_CLIENT_ENABLED
1367 #if SDP_INCLUDED == TRUE
1368 #define SDP_CLIENT_ENABLED          TRUE
1369 #else
1370 #define SDP_CLIENT_ENABLED          FALSE
1371 #endif
1372 #endif
1373 
1374 /* The maximum number of SDP records the server can support. */
1375 #ifndef SDP_MAX_RECORDS
1376 #define SDP_MAX_RECORDS             6  /*max is 30*/
1377 #endif
1378 
1379 /* The maximum number of attributes in each record. */
1380 #ifndef SDP_MAX_REC_ATTR
1381 #define SDP_MAX_REC_ATTR            8
1382 #endif
1383 
1384 #ifndef SDP_MAX_PAD_LEN
1385 #define SDP_MAX_PAD_LEN             300
1386 #endif
1387 
1388 /* The maximum length, in bytes, of an attribute. */
1389 #ifndef SDP_MAX_ATTR_LEN
1390 #define SDP_MAX_ATTR_LEN            400
1391 #endif
1392 
1393 /* The maximum number of attribute filters supported by SDP databases. */
1394 #ifndef SDP_MAX_ATTR_FILTERS
1395 #define SDP_MAX_ATTR_FILTERS        15
1396 #endif
1397 
1398 /* The maximum number of UUID filters supported by SDP databases. */
1399 #ifndef SDP_MAX_UUID_FILTERS
1400 #define SDP_MAX_UUID_FILTERS        3
1401 #endif
1402 
1403 /* The maximum number of record handles retrieved in a search. */
1404 #ifndef SDP_MAX_DISC_SERVER_RECS
1405 #define SDP_MAX_DISC_SERVER_RECS    21
1406 #endif
1407 
1408 /* The size of a scratchpad buffer, in bytes, for storing the response to an attribute request. */
1409 #ifndef SDP_MAX_LIST_BYTE_COUNT
1410 #define SDP_MAX_LIST_BYTE_COUNT     4096
1411 #endif
1412 
1413 /* The maximum number of parameters in an SDP protocol element. */
1414 #ifndef SDP_MAX_PROTOCOL_PARAMS
1415 #define SDP_MAX_PROTOCOL_PARAMS     2
1416 #endif
1417 
1418 /* The maximum number of simultaneous client and server connections. */
1419 #ifndef SDP_MAX_CONNECTIONS
1420 #define SDP_MAX_CONNECTIONS         2 // 4
1421 #endif
1422 
1423 /* The MTU size for the L2CAP configuration. */
1424 #ifndef SDP_MTU_SIZE
1425 #define SDP_MTU_SIZE                672
1426 #endif
1427 
1428 /* The flush timeout for the L2CAP configuration. */
1429 #ifndef SDP_FLUSH_TO
1430 #define SDP_FLUSH_TO                0xFFFF
1431 #endif
1432 
1433 /* The name for security authorization. */
1434 #ifndef SDP_SERVICE_NAME
1435 #define SDP_SERVICE_NAME            "Service Discovery"
1436 #endif
1437 
1438 /* The security level for BTM. */
1439 #ifndef SDP_SECURITY_LEVEL
1440 #define SDP_SECURITY_LEVEL          BTM_SEC_NONE
1441 #endif
1442 
1443 /******************************************************************************
1444 **
1445 ** RFCOMM
1446 **
1447 ******************************************************************************/
1448 #ifndef RFCOMM_INCLUDED
1449 #define RFCOMM_INCLUDED             FALSE
1450 #endif
1451 
1452 /* The maximum number of ports supported. */
1453 #ifndef MAX_RFC_PORTS
1454 #define MAX_RFC_PORTS               8 /*max is 30*/
1455 #endif
1456 
1457 /* The maximum simultaneous links to different devices. */
1458 #ifndef MAX_ACL_CONNECTIONS
1459 #define MAX_BD_CONNECTIONS          3 /*max is 7*/
1460 #else
1461 #define MAX_BD_CONNECTIONS          MAX_ACL_CONNECTIONS
1462 #endif
1463 
1464 /* The port receive queue low watermark level, in bytes. */
1465 #ifndef PORT_RX_LOW_WM
1466 #define PORT_RX_LOW_WM              (BTA_RFC_MTU_SIZE * PORT_RX_BUF_LOW_WM)
1467 #endif
1468 
1469 /* The port receive queue high watermark level, in bytes. */
1470 #ifndef PORT_RX_HIGH_WM
1471 #define PORT_RX_HIGH_WM             (BTA_RFC_MTU_SIZE * PORT_RX_BUF_HIGH_WM)
1472 #endif
1473 
1474 /* The port receive queue critical watermark level, in bytes. */
1475 #ifndef PORT_RX_CRITICAL_WM
1476 #define PORT_RX_CRITICAL_WM         (BTA_RFC_MTU_SIZE * PORT_RX_BUF_CRITICAL_WM)
1477 #endif
1478 
1479 /* The port receive queue low watermark level, in number of buffers. */
1480 #ifndef PORT_RX_BUF_LOW_WM
1481 #define PORT_RX_BUF_LOW_WM          4
1482 #endif
1483 
1484 /* The port receive queue high watermark level, in number of buffers. */
1485 #ifndef PORT_RX_BUF_HIGH_WM
1486 #define PORT_RX_BUF_HIGH_WM         10
1487 #endif
1488 
1489 /* The port receive queue critical watermark level, in number of buffers. */
1490 #ifndef PORT_RX_BUF_CRITICAL_WM
1491 #define PORT_RX_BUF_CRITICAL_WM     15
1492 #endif
1493 
1494 /* The port transmit queue high watermark level, in bytes. */
1495 #ifndef PORT_TX_HIGH_WM
1496 #define PORT_TX_HIGH_WM             (BTA_RFC_MTU_SIZE * PORT_TX_BUF_HIGH_WM)
1497 #endif
1498 
1499 /* The port transmit queue critical watermark level, in bytes. */
1500 #ifndef PORT_TX_CRITICAL_WM
1501 #define PORT_TX_CRITICAL_WM         (BTA_RFC_MTU_SIZE * PORT_TX_BUF_CRITICAL_WM)
1502 #endif
1503 
1504 /* The port transmit queue high watermark level, in number of buffers. */
1505 #ifndef PORT_TX_BUF_HIGH_WM
1506 #define PORT_TX_BUF_HIGH_WM         10
1507 #endif
1508 
1509 /* The port transmit queue high watermark level, in number of buffers. */
1510 #ifndef PORT_TX_BUF_CRITICAL_WM
1511 #define PORT_TX_BUF_CRITICAL_WM     15
1512 #endif
1513 
1514 /* The RFCOMM multiplexer preferred flow control mechanism. */
1515 #ifndef PORT_FC_DEFAULT
1516 #define PORT_FC_DEFAULT             PORT_FC_CREDIT
1517 #endif
1518 
1519 /* The maximum number of credits receiver sends to peer when using credit-based flow control. */
1520 #ifndef PORT_CREDIT_RX_MAX
1521 #define PORT_CREDIT_RX_MAX          16
1522 #endif
1523 
1524 /* The credit low watermark level. */
1525 #ifndef PORT_CREDIT_RX_LOW
1526 #define PORT_CREDIT_RX_LOW          8
1527 #endif
1528 
1529 /******************************************************************************
1530 **
1531 ** OBEX
1532 **
1533 ******************************************************************************/
1534 
1535 /*
1536  * Buffer size to reassemble the SDU.
1537  * It will allow buffers to be used that are larger than the L2CAP_MAX_MTU.
1538  */
1539 #ifndef OBX_USER_RX_BUF_SIZE
1540 #define OBX_USER_RX_BUF_SIZE    OBX_LRG_DATA_BUF_SIZE
1541 #endif
1542 
1543 /*
1544  * Buffer size to hold the SDU.
1545  * It will allow buffers to be used that are larger than the L2CAP_MAX_MTU.
1546  */
1547 #ifndef OBX_USER_TX_BUF_SIZE
1548 #define OBX_USER_TX_BUF_SIZE    OBX_LRG_DATA_BUF_SIZE
1549 #endif
1550 
1551 /* Buffer size used to hold MPS segments during SDU reassembly. */
1552 #ifndef OBX_FCR_RX_BUF_SIZE
1553 #define OBX_FCR_RX_BUF_SIZE     BT_DEFAULT_BUFFER_SIZE
1554 #endif
1555 
1556 /*
1557  * Buffer size used to hold MPS segments used in (re)transmissions.
1558  * The size of each buffer must be able to hold the maximum MPS segment size
1559  * passed in L2CA_SetFCROptions plus BT_HDR (8) + HCI preamble (4) +
1560  * L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
1561  */
1562 #ifndef OBX_FCR_TX_BUF_SIZE
1563 #define OBX_FCR_TX_BUF_SIZE     BT_DEFAULT_BUFFER_SIZE
1564 #endif
1565 
1566 /* This option is application when OBX_14_INCLUDED=TRUE
1567 Size of the transmission window when using enhanced retransmission mode. Not used
1568 in basic and streaming modes. Range: 1 - 63
1569 */
1570 #ifndef OBX_FCR_OPT_TX_WINDOW_SIZE_BR_EDR
1571 #define OBX_FCR_OPT_TX_WINDOW_SIZE_BR_EDR       20
1572 #endif
1573 
1574 /* This option is application when OBX_14_INCLUDED=TRUE
1575 Number of transmission attempts for a single I-Frame before taking
1576 Down the connection. Used In ERTM mode only. Value is Ignored in basic and
1577 Streaming modes.
1578 Range: 0, 1-0xFF
1579 0 - infinite retransmissions
1580 1 - single transmission
1581 */
1582 #ifndef OBX_FCR_OPT_MAX_TX_B4_DISCNT
1583 #define OBX_FCR_OPT_MAX_TX_B4_DISCNT    20
1584 #endif
1585 
1586 /* This option is application when OBX_14_INCLUDED=TRUE
1587 Retransmission Timeout
1588 Range: Minimum 2000 (2 secs) on BR/EDR when supporting PBF.
1589  */
1590 #ifndef OBX_FCR_OPT_RETX_TOUT
1591 #define OBX_FCR_OPT_RETX_TOUT           2000
1592 #endif
1593 
1594 /* This option is application when OBX_14_INCLUDED=TRUE
1595 Monitor Timeout
1596 Range: Minimum 12000 (12 secs) on BR/EDR when supporting PBF.
1597 */
1598 #ifndef OBX_FCR_OPT_MONITOR_TOUT
1599 #define OBX_FCR_OPT_MONITOR_TOUT        12000
1600 #endif
1601 
1602 /* This option is application when OBX_14_INCLUDED=TRUE
1603 Maximum PDU payload size.
1604 Suggestion: The maximum amount of data that will fit into a 3-DH5 packet.
1605 Range: 2 octets
1606 */
1607 #ifndef OBX_FCR_OPT_MAX_PDU_SIZE
1608 #define OBX_FCR_OPT_MAX_PDU_SIZE        L2CAP_MPS_OVER_BR_EDR
1609 #endif
1610 
1611 
1612 /******************************************************************************
1613 **
1614 ** BNEP
1615 **
1616 ******************************************************************************/
1617 
1618 #ifndef BNEP_INCLUDED
1619 #define BNEP_INCLUDED               FALSE
1620 #endif
1621 
1622 /* BNEP status API call is used mainly to get the L2CAP handle */
1623 #ifndef BNEP_SUPPORTS_STATUS_API
1624 #define BNEP_SUPPORTS_STATUS_API            FALSE
1625 #endif
1626 
1627 /*
1628 ** When BNEP connection changes roles after the connection is established
1629 ** we will do an authentication check again on the new role
1630 */
1631 #ifndef BNEP_DO_AUTH_FOR_ROLE_SWITCH
1632 #define BNEP_DO_AUTH_FOR_ROLE_SWITCH        FALSE
1633 #endif
1634 
1635 
1636 /* Maximum number of protocol filters supported. */
1637 #ifndef BNEP_MAX_PROT_FILTERS
1638 #define BNEP_MAX_PROT_FILTERS       5
1639 #endif
1640 
1641 /* Maximum number of multicast filters supported. */
1642 #ifndef BNEP_MAX_MULTI_FILTERS
1643 #define BNEP_MAX_MULTI_FILTERS      5
1644 #endif
1645 
1646 /* Minimum MTU size. */
1647 #ifndef BNEP_MIN_MTU_SIZE
1648 #define BNEP_MIN_MTU_SIZE           L2CAP_MTU_SIZE
1649 #endif
1650 
1651 /* Preferred MTU size. */
1652 #ifndef BNEP_MTU_SIZE
1653 #define BNEP_MTU_SIZE               BNEP_MIN_MTU_SIZE
1654 #endif
1655 
1656 /* Maximum number of buffers allowed in transmit data queue. */
1657 #ifndef BNEP_MAX_XMITQ_DEPTH
1658 #define BNEP_MAX_XMITQ_DEPTH        20
1659 #endif
1660 
1661 /* Maximum number BNEP of connections supported. */
1662 #ifndef BNEP_MAX_CONNECTIONS
1663 #define BNEP_MAX_CONNECTIONS        7
1664 #endif
1665 
1666 
1667 /******************************************************************************
1668 **
1669 ** AVDTP
1670 **
1671 ******************************************************************************/
1672 
1673 #ifndef AVDT_INCLUDED
1674 #define AVDT_INCLUDED               TRUE
1675 #endif
1676 
1677 /* Include reporting capability in AVDTP */
1678 #ifndef AVDT_REPORTING
1679 #define AVDT_REPORTING              TRUE
1680 #endif
1681 
1682 /* Include multiplexing capability in AVDTP */
1683 #ifndef AVDT_MULTIPLEXING
1684 #define AVDT_MULTIPLEXING           TRUE
1685 #endif
1686 
1687 /* Number of simultaneous links to different peer devices. */
1688 #ifndef AVDT_NUM_LINKS
1689 #define AVDT_NUM_LINKS              2
1690 #endif
1691 
1692 /* Number of simultaneous stream endpoints. */
1693 #ifndef AVDT_NUM_SEPS
1694 #define AVDT_NUM_SEPS               3
1695 #endif
1696 
1697 /* Number of transport channels setup per media stream(audio or video) */
1698 #ifndef AVDT_NUM_CHANNELS
1699 
1700 #if AVDT_REPORTING == TRUE
1701 /* signaling, media and reporting channels */
1702 #define AVDT_NUM_CHANNELS   3
1703 #else
1704 /* signaling and media channels */
1705 #define AVDT_NUM_CHANNELS   2
1706 #endif  // AVDT_REPORTING
1707 
1708 #endif  // AVDT_NUM_CHANNELS
1709 
1710 /* Number of transport channels setup by AVDT for all media streams
1711  * AVDT_NUM_CHANNELS * Number of simultaneous streams.
1712  */
1713 #ifndef AVDT_NUM_TC_TBL
1714 #define AVDT_NUM_TC_TBL             6
1715 #endif
1716 
1717 /* Maximum size in bytes of the codec capabilities information element. */
1718 #ifndef AVDT_CODEC_SIZE
1719 #define AVDT_CODEC_SIZE             10
1720 #endif
1721 
1722 /* Maximum size in bytes of the content protection information element. */
1723 #ifndef AVDT_PROTECT_SIZE
1724 #define AVDT_PROTECT_SIZE           90
1725 #endif
1726 
1727 /* Maximum number of GKI buffers in the fragment queue (for video frames).
1728  * Must be less than the number of buffers in the buffer pool of size AVDT_DATA_POOL_SIZE */
1729 #ifndef AVDT_MAX_FRAG_COUNT
1730 #define AVDT_MAX_FRAG_COUNT         15
1731 #endif
1732 
1733 /******************************************************************************
1734 **
1735 ** PAN
1736 **
1737 ******************************************************************************/
1738 
1739 #ifndef PAN_INCLUDED
1740 #define PAN_INCLUDED                     FALSE
1741 #endif
1742 
1743 /* This will enable the PANU role */
1744 #ifndef PAN_SUPPORTS_ROLE_PANU
1745 #define PAN_SUPPORTS_ROLE_PANU              FALSE
1746 #endif
1747 
1748 /* This will enable the GN role */
1749 #ifndef PAN_SUPPORTS_ROLE_GN
1750 #define PAN_SUPPORTS_ROLE_GN                FALSE
1751 #endif
1752 
1753 /* This will enable the NAP role */
1754 #ifndef PAN_SUPPORTS_ROLE_NAP
1755 #define PAN_SUPPORTS_ROLE_NAP               FALSE
1756 #endif
1757 
1758 /* This is just for debugging purposes */
1759 #ifndef PAN_SUPPORTS_DEBUG_DUMP
1760 #define PAN_SUPPORTS_DEBUG_DUMP             FALSE
1761 #endif
1762 
1763 /* Maximum number of PAN connections allowed */
1764 #ifndef MAX_PAN_CONNS
1765 #define MAX_PAN_CONNS                    7
1766 #endif
1767 
1768 /* Default service name for NAP role */
1769 #ifndef PAN_NAP_DEFAULT_SERVICE_NAME
1770 #define PAN_NAP_DEFAULT_SERVICE_NAME    "Network Access Point Service"
1771 #endif
1772 
1773 /* Default service name for GN role */
1774 #ifndef PAN_GN_DEFAULT_SERVICE_NAME
1775 #define PAN_GN_DEFAULT_SERVICE_NAME     "Group Network Service"
1776 #endif
1777 
1778 /* Default service name for PANU role */
1779 #ifndef PAN_PANU_DEFAULT_SERVICE_NAME
1780 #define PAN_PANU_DEFAULT_SERVICE_NAME   "PAN User Service"
1781 #endif
1782 
1783 /* Default description for NAP role service */
1784 #ifndef PAN_NAP_DEFAULT_DESCRIPTION
1785 #define PAN_NAP_DEFAULT_DESCRIPTION     "NAP"
1786 #endif
1787 
1788 /* Default description for GN role service */
1789 #ifndef PAN_GN_DEFAULT_DESCRIPTION
1790 #define PAN_GN_DEFAULT_DESCRIPTION      "GN"
1791 #endif
1792 
1793 /* Default description for PANU role service */
1794 #ifndef PAN_PANU_DEFAULT_DESCRIPTION
1795 #define PAN_PANU_DEFAULT_DESCRIPTION    "PANU"
1796 #endif
1797 
1798 /* Default Security level for PANU role. */
1799 #ifndef PAN_PANU_SECURITY_LEVEL
1800 #define PAN_PANU_SECURITY_LEVEL          0
1801 #endif
1802 
1803 /* Default Security level for GN role. */
1804 #ifndef PAN_GN_SECURITY_LEVEL
1805 #define PAN_GN_SECURITY_LEVEL            0
1806 #endif
1807 
1808 /* Default Security level for NAP role. */
1809 #ifndef PAN_NAP_SECURITY_LEVEL
1810 #define PAN_NAP_SECURITY_LEVEL           0
1811 #endif
1812 
1813 /******************************************************************************
1814 **
1815 ** GAP
1816 **
1817 ******************************************************************************/
1818 
1819 #ifndef GAP_INCLUDED
1820 #define GAP_INCLUDED                TRUE
1821 #endif
1822 
1823 /* This is set to enable posting event for data write */
1824 #ifndef GAP_CONN_POST_EVT_INCLUDED
1825 #define GAP_CONN_POST_EVT_INCLUDED  FALSE
1826 #endif
1827 
1828 /* The maximum number of simultaneous GAP L2CAP connections. */
1829 #ifndef GAP_MAX_CONNECTIONS
1830 #define GAP_MAX_CONNECTIONS         10 // 30
1831 #endif
1832 
1833 /* keep the raw data received from SDP server in database. */
1834 #ifndef SDP_RAW_DATA_INCLUDED
1835 #define SDP_RAW_DATA_INCLUDED       TRUE
1836 #endif
1837 
1838 /* Inquiry duration in 1.28 second units. */
1839 #ifndef SDP_DEBUG
1840 #define SDP_DEBUG                   TRUE
1841 #endif
1842 
1843 /******************************************************************************
1844 **
1845 ** HID
1846 **
1847 ******************************************************************************/
1848 
1849 #ifndef HID_CONTROL_BUF_SIZE
1850 #define HID_CONTROL_BUF_SIZE            BT_DEFAULT_BUFFER_SIZE
1851 #endif
1852 
1853 #ifndef HID_INTERRUPT_BUF_SIZE
1854 #define HID_INTERRUPT_BUF_SIZE          BT_DEFAULT_BUFFER_SIZE
1855 #endif
1856 
1857 /*************************************************************************
1858 ** Definitions for Both HID-Host & Device
1859 */
1860 #ifndef HID_MAX_SVC_NAME_LEN
1861 #define HID_MAX_SVC_NAME_LEN  32
1862 #endif
1863 
1864 #ifndef HID_MAX_SVC_DESCR_LEN
1865 #define HID_MAX_SVC_DESCR_LEN 32
1866 #endif
1867 
1868 #ifndef HID_MAX_PROV_NAME_LEN
1869 #define HID_MAX_PROV_NAME_LEN 32
1870 #endif
1871 
1872 /*************************************************************************
1873 ** Definitions for HID-Host
1874 */
1875 #ifndef  HID_HOST_INCLUDED
1876 #define HID_HOST_INCLUDED           FALSE
1877 #endif
1878 
1879 #ifndef HID_HOST_MAX_DEVICES
1880 #define HID_HOST_MAX_DEVICES        7
1881 #endif
1882 
1883 #ifndef HID_HOST_MTU
1884 #define HID_HOST_MTU                640
1885 #endif
1886 
1887 #ifndef HID_HOST_FLUSH_TO
1888 #define HID_HOST_FLUSH_TO                 0xffff
1889 #endif
1890 
1891 #ifndef HID_HOST_MAX_CONN_RETRY
1892 #define HID_HOST_MAX_CONN_RETRY     (3)
1893 #endif
1894 
1895 #ifndef HID_HOST_REPAGE_WIN
1896 #define HID_HOST_REPAGE_WIN          (2)
1897 #endif
1898 
1899 /*************************************************************************
1900  * A2DP Definitions
1901  */
1902 #ifndef A2D_INCLUDED
1903 #define A2D_INCLUDED            FALSE
1904 #endif
1905 
1906 /******************************************************************************
1907 **
1908 ** AVCTP
1909 **
1910 ******************************************************************************/
1911 
1912 /* Number of simultaneous ACL links to different peer devices. */
1913 #ifndef AVCT_NUM_LINKS
1914 #define AVCT_NUM_LINKS              2
1915 #endif
1916 
1917 /* Number of simultaneous AVCTP connections. */
1918 #ifndef AVCT_NUM_CONN
1919 #define AVCT_NUM_CONN               3
1920 #endif
1921 
1922 /******************************************************************************
1923 **
1924 ** AVRCP
1925 **
1926 ******************************************************************************/
1927 #ifndef AVRC_INCLUDED
1928 #define AVRC_INCLUDED               FALSE
1929 #endif
1930 
1931 #ifndef AVRC_METADATA_INCLUDED
1932 #if AVRC_INCLUDED == TRUE
1933 #define AVRC_METADATA_INCLUDED      TRUE
1934 #else
1935 #define AVRC_METADATA_INCLUDED      FALSE
1936 #endif
1937 #endif
1938 
1939 #ifndef AVRC_ADV_CTRL_INCLUDED
1940 #if AVRC_INCLUDED == TRUE
1941 #define AVRC_ADV_CTRL_INCLUDED      TRUE
1942 #else
1943 #define AVRC_ADV_CTRL_INCLUDED      FALSE
1944 #endif
1945 #endif
1946 
1947 #ifndef AVRC_CTLR_INCLUDED
1948 #if AVRC_INCLUDED == TRUE
1949 #define AVRC_CTLR_INCLUDED          TRUE
1950 #else
1951 #define AVRC_CTLR_INCLUDED          FALSE
1952 #endif
1953 #endif
1954 
1955 /******************************************************************************
1956 **
1957 ** MCAP
1958 **
1959 ******************************************************************************/
1960 #ifndef MCA_INCLUDED
1961 #define MCA_INCLUDED                FALSE
1962 #endif
1963 
1964 /* The MTU size for the L2CAP configuration on control channel. 48 is the minimal */
1965 #ifndef MCA_CTRL_MTU
1966 #define MCA_CTRL_MTU    60
1967 #endif
1968 
1969 /* The maximum number of registered MCAP instances. */
1970 #ifndef MCA_NUM_REGS
1971 #define MCA_NUM_REGS    12
1972 #endif
1973 
1974 /* The maximum number of control channels (to difference devices) per registered MCAP instances. */
1975 #ifndef MCA_NUM_LINKS
1976 #define MCA_NUM_LINKS   3
1977 #endif
1978 
1979 /* The maximum number of MDEP (including HDP echo) per registered MCAP instances. */
1980 #ifndef MCA_NUM_DEPS
1981 #define MCA_NUM_DEPS    13
1982 #endif
1983 
1984 /* The maximum number of MDL link per control channel. */
1985 #ifndef MCA_NUM_MDLS
1986 #define MCA_NUM_MDLS    4
1987 #endif
1988 
1989 /* Buffer size to reassemble the SDU. */
1990 #ifndef MCA_USER_RX_BUF_SIZE
1991 #define MCA_USER_RX_BUF_SIZE    BT_DEFAULT_BUFFER_SIZE
1992 #endif
1993 
1994 /* Buffer size to hold the SDU. */
1995 #ifndef MCA_USER_TX_BUF_SIZE
1996 #define MCA_USER_TX_BUF_SIZE    BT_DEFAULT_BUFFER_SIZE
1997 #endif
1998 
1999 /*
2000  * Buffer size used to hold MPS segments during SDU reassembly
2001  */
2002 #ifndef MCA_FCR_RX_BUF_SIZE
2003 #define MCA_FCR_RX_BUF_SIZE     BT_DEFAULT_BUFFER_SIZE
2004 #endif
2005 
2006 /*
2007  * Default buffer size used to hold MPS segments used in (re)transmissions.
2008  * The size of each buffer must be able to hold the maximum MPS segment size
2009  * passed in tL2CAP_FCR_OPTIONS plus BT_HDR (8) + HCI preamble (4) +
2010  * L2CAP_MIN_OFFSET (11 - as of BT 2.1 + EDR Spec).
2011  */
2012 #ifndef MCA_FCR_TX_BUF_SIZE
2013 #define MCA_FCR_TX_BUF_SIZE     BT_DEFAULT_BUFFER_SIZE
2014 #endif
2015 
2016 /* MCAP control channel FCR Option:
2017 Size of the transmission window when using enhanced retransmission mode.
2018 1 is defined by HDP specification for control channel.
2019 */
2020 #ifndef MCA_FCR_OPT_TX_WINDOW_SIZE
2021 #define MCA_FCR_OPT_TX_WINDOW_SIZE      1
2022 #endif
2023 
2024 /* MCAP control channel FCR Option:
2025 Number of transmission attempts for a single I-Frame before taking
2026 Down the connection. Used In ERTM mode only. Value is Ignored in basic and
2027 Streaming modes.
2028 Range: 0, 1-0xFF
2029 0 - infinite retransmissions
2030 1 - single transmission
2031 */
2032 #ifndef MCA_FCR_OPT_MAX_TX_B4_DISCNT
2033 #define MCA_FCR_OPT_MAX_TX_B4_DISCNT    20
2034 #endif
2035 
2036 /* MCAP control channel FCR Option: Retransmission Timeout
2037 The AVRCP specification set a value in the range of 300 - 2000 ms
2038 Timeout (in msecs) to detect Lost I-Frames. Only used in Enhanced retransmission mode.
2039 Range: Minimum 2000 (2 secs) when supporting PBF.
2040  */
2041 #ifndef MCA_FCR_OPT_RETX_TOUT
2042 #define MCA_FCR_OPT_RETX_TOUT           2000
2043 #endif
2044 
2045 /* MCAP control channel FCR Option: Monitor Timeout
2046 The AVRCP specification set a value in the range of 300 - 2000 ms
2047 Timeout (in msecs) to detect Lost S-Frames. Only used in Enhanced retransmission mode.
2048 Range: Minimum 12000 (12 secs) when supporting PBF.
2049 */
2050 #ifndef MCA_FCR_OPT_MONITOR_TOUT
2051 #define MCA_FCR_OPT_MONITOR_TOUT        12000
2052 #endif
2053 
2054 /* MCAP control channel FCR Option: Maximum PDU payload size.
2055 The maximum number of payload octets that the local device can receive in a single PDU.
2056 */
2057 #ifndef MCA_FCR_OPT_MPS_SIZE
2058 #define MCA_FCR_OPT_MPS_SIZE            1000
2059 #endif
2060 
2061 /* Shared transport */
2062 #ifndef NFC_SHARED_TRANSPORT_ENABLED
2063 #define NFC_SHARED_TRANSPORT_ENABLED    FALSE
2064 #endif
2065 
2066 /******************************************************************************
2067 **
2068 ** Sleep Mode (Low Power Mode)
2069 **
2070 ******************************************************************************/
2071 
2072 #ifndef HCILP_INCLUDED
2073 #define HCILP_INCLUDED                  FALSE
2074 #endif
2075 
2076 /******************************************************************************
2077 **
2078 ** APPL - Application Task
2079 **
2080 ******************************************************************************/
2081 
2082 #define L2CAP_FEATURE_REQ_ID      73
2083 #define L2CAP_FEATURE_RSP_ID     173
2084 
2085 /******************************************************************************
2086 **
2087 ** BTA
2088 **
2089 ******************************************************************************/
2090 /* BTA EIR canned UUID list (default is dynamic) */
2091 #ifndef BTA_EIR_CANNED_UUID_LIST
2092 #define BTA_EIR_CANNED_UUID_LIST FALSE
2093 #endif
2094 
2095 /* Number of supported customer UUID in EIR */
2096 #ifndef BTA_EIR_SERVER_NUM_CUSTOM_UUID
2097 #define BTA_EIR_SERVER_NUM_CUSTOM_UUID     8
2098 #endif
2099 
2100 /* CHLD override for bluedroid */
2101 #ifndef BTA_AG_CHLD_VAL_ECC
2102 #define BTA_AG_CHLD_VAL_ECC  "(0,1,1x,2,2x,3)"
2103 #endif
2104 
2105 #ifndef BTA_AG_CHLD_VAL
2106 #define BTA_AG_CHLD_VAL  "(0,1,2,3)"
2107 #endif
2108 
2109 /* Set the CIND to match HFP 1.5 */
2110 #ifndef BTA_AG_CIND_INFO
2111 #define BTA_AG_CIND_INFO "(\"call\",(0,1)),(\"callsetup\",(0-3)),(\"service\",(0-1)),(\"signal\",(0-5)),(\"roam\",(0,1)),(\"battchg\",(0-5)),(\"callheld\",(0-2))"
2112 #endif
2113 
2114 #ifndef BTA_DM_AVOID_A2DP_ROLESWITCH_ON_INQUIRY
2115 #define BTA_DM_AVOID_A2DP_ROLESWITCH_ON_INQUIRY FALSE
2116 #endif
2117 
2118 /******************************************************************************
2119 **
2120 ** Tracing:  Include trace header file here.
2121 **
2122 ******************************************************************************/
2123 
2124 /* Enable/disable BTSnoop memory logging */
2125 #ifndef BTSNOOP_MEM
2126 #define BTSNOOP_MEM FALSE
2127 #endif
2128 
2129 #if UC_BT_BLUEDROID_MEM_DEBUG
2130 #define HEAP_MEMORY_DEBUG   TRUE
2131 #else
2132 #define HEAP_MEMORY_DEBUG   FALSE
2133 #endif
2134 
2135 #if UC_HEAP_ALLOCATION_FROM_SPIRAM_FIRST
2136 #define HEAP_ALLOCATION_FROM_SPIRAM_FIRST TRUE
2137 #else
2138 #define HEAP_ALLOCATION_FROM_SPIRAM_FIRST FALSE
2139 #endif
2140 
2141 #include "common/bt_trace.h"
2142 
2143 #endif /* BT_TARGET_H */
2144