1# Kconfig - Bluetooth LE stack configuration options 2 3# 4# Copyright (c) 2016-2017 Nordic Semiconductor ASA 5# Copyright (c) 2015-2016 Intel Corporation 6# 7# SPDX-License-Identifier: Apache-2.0 8# 9 10comment "Host Stack Configuration" 11 12config BT_HCI_HOST 13 # Virtual/hidden option to make the conditions more intuitive 14 bool 15 default y 16 depends on !BT_HCI_RAW 17 select POLL 18 19config BT_HCI_CMD_COUNT 20 int "Number of HCI command buffers" 21 default 2 22 range 2 64 23 help 24 Number of buffers available for HCI commands. 25 26config BT_RX_BUF_COUNT 27 int "Number of HCI RX buffers" 28 default 3 if BT_RECV_IS_RX_THREAD 29 default 10 30 range 2 255 31 help 32 Number of buffers available for incoming ACL packets or HCI events 33 from the controller. 34 35config BT_RX_BUF_LEN 36 int "Maximum supported HCI RX buffer length" 37 default 264 if BT_BREDR 38 default 77 if BT_MESH_PROXY 39 default 76 40 range 73 2000 41 help 42 Maximum data size for each HCI RX buffer. This size includes 43 everything starting with the ACL or HCI event headers. Note that 44 buffer sizes are always rounded up to the nearest multiple of 4, 45 so if this Kconfig value is something else then there will be some 46 wasted space. The minimum of 73 has been taken for LE SC which has 47 an L2CAP MTU of 65 bytes. On top of this there's the L2CAP header 48 (4 bytes) and the ACL header (also 4 bytes) which yields 73 bytes. 49 50config BT_HCI_TX_STACK_SIZE 51 int "TX thread stack size" 52 # Even if no driver is selected the following default is still 53 # needed e.g. for unit tests. 54 default 1536 55 range 512 4096 56 help 57 Stack size needed for executing bt_send with specified driver 58 59config BT_HCI_TX_PRIO 60 # Hidden option for Co-Operative Tx thread priority 61 int 62 default 24 if BT_USERCHAN 63 default 7 64 65config BT_WAIT_NOP 66 bool "Wait for \"NOP\" Command Complete event during init" 67 depends on BT_HCI 68 help 69 Some controllers emit a Command Complete event for the NOP 70 opcode to indicate that they're ready to receive commands. 71 This option should be selected if the controller used 72 exhibits such behavior. 73 74config BT_HCI_RESERVE 75 int 76 default 1 if BT_H4 77 default 1 if BT_H5 78 default 1 if BT_SPI 79 default 1 if BT_USERCHAN 80 # Even if no driver is selected the following default is still 81 # needed e.g. for unit tests. 82 default 1 83 help 84 Headroom that the driver needs for sending and receiving buffers. Add a 85 new 'default' entry for each new driver. 86 87config BT_RECV_IS_RX_THREAD 88 # Hidden option set by the HCI driver to indicate that there's 89 # no need for the host to have its own RX thread. 90 # It is then the responsibility of the HCI driver to call bt_recv_prio 91 # from a higher priority context than bt_recv in order to avoid deadlock. 92 # If the host has its own RX thread it is safe to call bt_recv and 93 # bt_recv_prio from the same priority context. 94 bool 95 96config BT_RX_STACK_SIZE 97 int "Size of the receiving thread stack" 98 depends on BT_HCI_HOST || BT_RECV_IS_RX_THREAD 99 default 512 if BT_HCI_RAW 100 default 2048 if BT_MESH 101 default 2048 if BT_SETTINGS 102 default 1024 103 range 512 65536 if BT_HCI_RAW 104 range 1100 65536 if BT_MESH 105 range 1024 65536 106 help 107 Size of the receiving thread stack. This is the context from 108 which all event callbacks to the application occur. The 109 default value is sufficient for basic operation, but if the 110 application needs to do advanced things in its callbacks that 111 require extra stack space, this value can be increased to 112 accommodate for that. 113 114config BT_RX_PRIO 115 # Hidden option for Co-Operative Rx thread priority 116 int 117 depends on BT_HCI_HOST || BT_RECV_IS_RX_THREAD 118 default 25 if BT_USERCHAN 119 default 8 120 121if BT_HCI_HOST 122 123config BT_CTLR_CRYPTO 124 bool "Controller crypto feature" 125 default n 126 127config BT_HOST_CRYPTO 128 # Hidden option that compiles in random number generation and AES 129 # encryption support using TinyCrypt library if this is not provided 130 # by the controller implementation. 131 bool 132 default y if !BT_CTLR_CRYPTO 133 select TINYCRYPT 134 select TINYCRYPT_AES 135 select TINYCRYPT_SHA256 136 select TINYCRYPT_SHA256_HMAC 137 select TINYCRYPT_SHA256_HMAC_PRNG 138 139config BT_SETTINGS 140 bool "Store Bluetooth state and configuration persistently" 141 depends on SETTINGS 142 select MPU_ALLOW_FLASH_WRITE if ARM_MPU 143 help 144 When selected, the Bluetooth stack will take care of storing 145 (and restoring) the Bluetooth state (e.g. pairing keys) and 146 configuration persistently in flash. 147 148 When this option has been enabled, it's important that the 149 application makes a call to settings_load() after having done 150 all necessary initialization (e.g. calling bt_enable). The 151 reason settings_load() is handled externally to the stack, is 152 that there may be other subsystems using the settings API, in 153 which case it's more efficient to load all settings in one go, 154 instead of each subsystem doing it independently. 155 156if BT_CONN 157 158if BT_HCI_ACL_FLOW_CONTROL 159config BT_ACL_RX_COUNT 160 int "Number of incoming ACL data buffers" 161 default 6 162 range 1 64 163 help 164 Number of buffers available for incoming ACL data. 165 166config BT_L2CAP_RX_MTU 167 int "Maximum supported L2CAP MTU for incoming data" 168 default 200 if BT_BREDR 169 default 65 if BT_SMP 170 default 23 171 range 65 1300 if BT_SMP 172 range 23 1300 173 help 174 Maximum size of each incoming L2CAP PDU. 175endif # BT_HCI_ACL_FLOW_CONTROL 176 177config BT_L2CAP_TX_BUF_COUNT 178 int "Number of L2CAP TX buffers" 179 default 3 180 range 2 255 181 help 182 Number of buffers available for outgoing L2CAP packets. 183 184config BT_L2CAP_TX_FRAG_COUNT 185 int "Number of L2CAP TX fragment buffers" 186 default 2 187 range 0 255 188 help 189 Number of buffers available for fragments of TX buffers. Warning: 190 setting this to 0 means that the application must ensure that 191 queued TX buffers never need to be fragmented, i.e. that the 192 controller's buffer size is large enough. If this is not ensured, 193 and there are no dedicated fragment buffers, a deadlock may occur. 194 In most cases the default value of 2 is a safe bet. 195 196config BT_L2CAP_TX_MTU 197 int "Maximum supported L2CAP MTU for L2CAP TX buffers" 198 default 253 if BT_BREDR 199 default 65 if BT_SMP 200 default 23 201 range 65 2000 if BT_SMP 202 range 23 2000 203 help 204 Maximum L2CAP MTU for L2CAP TX buffers. 205 206config BT_CONN_TX_MAX 207 int "Maximum number of pending TX buffers" 208 default 7 209 range 1 128 210 help 211 Maximum number of pending TX buffers that have not yet 212 been acknowledged by the controller. 213 214config BT_ATT_ENFORCE_FLOW 215 bool "Enforce strict flow control semantics for incoming PDUs" 216 default y if !(BOARD_QEMU_CORTEX_M3 || BOARD_QEMU_X86 || BOARD_NATIVE_POSIX) 217 help 218 Enforce flow control rules on incoming PDUs, preventing a peer 219 from sending new requests until a previous one has been responded 220 or sending a new indication until a previous one has been 221 confirmed. This may need to be disabled to avoid potential race 222 conditions arising from a USB based HCI transport that splits 223 HCI events and ACL data to separate endpoints. 224 225config BT_ATT_PREPARE_COUNT 226 int "Number of ATT prepare write buffers" 227 default 0 228 range 0 64 229 help 230 Number of buffers available for ATT prepare write, setting 231 this to 0 disables GATT long/reliable writes. 232 233config BT_ATT_TX_MAX 234 int "Maximum number of queued outgoing ATT PDUs" 235 default 2 236 range 1 BT_L2CAP_TX_BUF_COUNT 237 help 238 Number of ATT PDUs that can be at a single moment queued for 239 transmission. If the application tries to send more than this 240 amount the calls will block until an existing queued PDU gets 241 sent. 242 243config BT_AUTO_PHY_UPDATE 244 bool "Auto-initiate PHY Update Procedure" 245 default y 246 help 247 Initiate PHY Update Procedure on connection establishment. 248 249 Disable this if you want PHY Update Procedure feature supported but 250 want to rely on remote device to initiate the procedure at its 251 discretion. 252 253config BT_SMP 254 bool "Security Manager Protocol support" 255 select TINYCRYPT 256 select TINYCRYPT_AES 257 select TINYCRYPT_AES_CMAC 258 select BT_RPA 259 help 260 This option enables support for the Security Manager Protocol 261 (SMP), making it possible to pair devices over LE. 262 263if BT_SMP 264config BT_PRIVACY 265 bool "Privacy Feature" 266 help 267 Enable local Privacy Feature support. This makes it possible 268 to use Resolvable Private Addresses (RPAs). 269 270config BT_RPA_TIMEOUT 271 int "Resolvable Private Address timeout" 272 depends on BT_PRIVACY 273 default 900 274 range 1 65535 275 help 276 This option defines how often resolvable private address is rotated. 277 Value is provided in seconds and defaults to 900 seconds (15 minutes). 278 279config BT_SIGNING 280 bool "Data signing support" 281 help 282 This option enables data signing which is used for transferring 283 authenticated data in an unencrypted connection. 284 285config BT_SMP_SC_ONLY 286 bool "Secure Connections Only Mode" 287 help 288 This option enables support for Secure Connection Only Mode. In this 289 mode device shall only use Security Mode 1 Level 4 with exception 290 for services that only require Security Mode 1 Level 1 (no security). 291 Security Mode 1 Level 4 stands for authenticated LE Secure Connections 292 pairing with encryption. Enabling this option disables legacy pairing. 293 294config BT_FIXED_PASSKEY 295 bool "Use a fixed passkey for pairing" 296 help 297 With this option enabled, the application will be able to call the 298 bt_passkey_set() API to set a fixed passkey. If set, the 299 pairing_confim() callback will be called for all incoming pairings. 300 301config BT_USE_DEBUG_KEYS 302 bool "Enable Security Manager Debug Mode" 303 depends on BT_TINYCRYPT_ECC 304 help 305 This option places Security Manager in a Debug Mode. In this mode 306 predefined Diffie-Hellman private/public key pair is used as described 307 in Core Specification Vol. 3, Part H, 2.3.5.6.1. This option should 308 only be enabled for debugging and should never be used in production. 309 If this option is enabled anyone is able to decipher encrypted air 310 traffic. 311 312endif # BT_SMP 313 314config BT_L2CAP_DYNAMIC_CHANNEL 315 bool "L2CAP Dynamic Channel support" 316 depends on BT_SMP 317 help 318 This option enables support for LE Connection oriented Channels, 319 allowing the creation of dynamic L2CAP Channels. 320 321config BT_GATT_CLIENT 322 bool "GATT client support" 323 help 324 This option enables support for the GATT Client role. 325 326config BT_GATT_READ_MULTIPLE 327 bool "GATT Read Multiple Characteristic Values support" 328 default y 329 help 330 This option enables support for the GATT Read Multiple Characteristic 331 Values procedure. 332 333config BT_MAX_PAIRED 334 int "Maximum number of paired devices" 335 default 0 if !BT_SMP 336 default 1 337 range 0 128 338 help 339 Maximum number of paired Bluetooth devices. The minimum (and 340 default) number is 1. 341 342endif # BT_CONN 343 344config BT_SCAN_WITH_IDENTITY 345 bool "Perform active scanning using local identity address" 346 depends on !BT_PRIVACY && (BT_CENTRAL || BT_OBSERVER) 347 help 348 Enable this if you want to perform active scanning using the local 349 identity address as the scanner address. By default the stack will 350 always use a non-resolvable private address (NRPA) in order to avoid 351 disclosing local identity information. However, if the use case 352 requires disclosing it then enable this option. 353 354config BT_DEVICE_NAME_DYNAMIC 355 bool "Allow to set Bluetooth device name on runtime" 356 help 357 Enabling this option allows for runtime configuration of Bluetooth 358 device name. 359 360config BT_DEVICE_NAME_MAX 361 int "Maximum size in bytes for device name" 362 depends on BT_DEVICE_NAME_DYNAMIC 363 default 28 364 range 2 248 365 help 366 Bluetooth device name storage size. Storage can be up to 248 bytes 367 long (excluding NULL termination). 368 369config BT_DEVICE_NAME_GATT_WRITABLE 370 bool "Allow to write name by remote GATT clients" 371 depends on BT_CONN && BT_DEVICE_NAME_DYNAMIC 372 default y 373 help 374 Enabling this option allows remote GATT clients to write to device 375 name GAP characteristic. 376 377config BT_DEVICE_NAME 378 string "Bluetooth device name" 379 default "YoC Test" 380 help 381 Bluetooth device name. Name can be up to 248 bytes long (excluding 382 NULL termination). Can be empty string. 383 384config BT_DEVICE_APPEARANCE 385 int "Bluetooth device appearance" 386 range 0 65535 387 default 0 388 help 389 Bluetooth device appearance. For the list of possible values please 390 consult the following link: 391 https://www.bluetooth.com/specifications/assigned-numbers 392 393config BT_ID_MAX 394 int "Maximum number of local identities" 395 range 1 10 396 default 1 397 help 398 Maximum number of supported local identity addresses. For most 399 products this is safe to leave as the default value (1). 400 401endif # BT_HCI_HOST 402 403config BT_TINYCRYPT_ECC 404 bool "Use TinyCrypt library for ECDH" 405 select TINYCRYPT 406 select TINYCRYPT_ECC_DH 407 depends on BT_HCI_RAW || BT_HCI_HOST 408 default y if BT_CTLR && (BT_SMP || BT_MESH_PROV) 409 help 410 If this option is set TinyCrypt library is used for emulating the 411 ECDH HCI commands and events needed by e.g. LE Secure Connections. 412 In builds including the BLE Host, if not set the controller crypto is 413 used for ECDH and if the controller doesn't support the required HCI 414 commands the LE Secure Connections support will be disabled. 415 In builds including the HCI Raw interface and the BLE Controller, this 416 option injects support for the 2 HCI commands required for LE Secure 417 Connections so that Hosts can make use of those. The option defaults 418 to enabled for a combined build with Zephyr's own controller, since it 419 does not have any special ECC support itself (at least not currently). 420 421if BT_DEBUG 422config BT_DEBUG_SETTINGS 423 bool "Bluetooth storage debug" 424 depends on BT_SETTINGS 425 help 426 This option enables debug support for Bluetooth storage. 427 428config BT_DEBUG_HCI_CORE 429 bool "Bluetooth HCI core debug" 430 help 431 This option enables debug support for Bluetooth HCI 432 core. 433 434config BT_DEBUG_CONN 435 bool "Bluetooth connection debug" 436 depends on BT_CONN 437 help 438 This option enables debug support for Bluetooth 439 connection handling. 440 441config BT_DEBUG_KEYS 442 bool "Bluetooth security keys debug" 443 depends on BT_HCI_HOST 444 depends on BT_SMP 445 help 446 This option enables debug support for the handling of 447 Bluetooth security keys. 448 449config BT_DEBUG_L2CAP 450 bool "Bluetooth L2CAP debug" 451 depends on BT_CONN 452 help 453 This option enables debug support for the Bluetooth 454 L2ACP layer. 455 456config BT_DEBUG_SMP 457 bool "Bluetooth Security Manager Protocol (SMP) debug" 458 depends on BT_HCI_HOST 459 depends on BT_SMP 460 help 461 This option enables debug support for the Bluetooth 462 Security Manager Protocol (SMP). 463 464config BT_SMP_SELFTEST 465 bool "Bluetooth SMP self tests executed on init" 466 depends on BT_DEBUG_SMP 467 help 468 This option enables SMP self-tests executed on startup 469 to verify security and crypto functions. 470 471config BT_SMP_FORCE_BREDR 472 bool "Force Bluetooth SMP over BR/EDR" 473 depends on BT_DEBUG_SMP 474 help 475 This option enables SMP over BR/EDR even if controller is not 476 supporting BR/EDR Secure Connections. This option is solely for 477 testing and should never be enabled on production devices. 478 479config BT_DEBUG_ATT 480 bool "Bluetooth Attribute Protocol (ATT) debug" 481 depends on BT_CONN 482 help 483 This option enables debug support for the Bluetooth 484 Attribute Protocol (ATT). 485 486config BT_DEBUG_GATT 487 bool "Bluetooth Generic Attribute Profile (GATT) debug" 488 depends on BT_CONN 489 help 490 This option enables debug support for the Bluetooth 491 Generic Attribute Profile (GATT). 492 493config BT_DEBUG_RFCOMM 494 bool "Bluetooth RFCOMM debug" 495 depends on BT_RFCOMM 496 help 497 This option enables debug support for the Bluetooth 498 RFCOMM layer. 499 500config BT_DEBUG_HFP_HF 501 bool "Bluetooth Hands Free Profile (HFP) debug" 502 depends on BT_HFP_HF 503 help 504 This option enables debug support for the Bluetooth 505 Hands Free Profile (HFP). 506 507config BT_DEBUG_AVDTP 508 bool "Bluetooth AVDTP debug" 509 depends on BT_AVDTP 510 help 511 This option enables debug support for the Bluetooth AVDTP. 512 513config BT_DEBUG_A2DP 514 bool "Bluetooth A2DP debug" 515 depends on BT_A2DP 516 help 517 This option enables debug support for the Bluetooth 518 A2DP profile. 519 520config BT_DEBUG_SDP 521 bool "Bluetooth Service Discovery Protocol (SDP) debug" 522 depends on BT_BREDR 523 help 524 This option enables debug support for the Bluetooth 525 Service Discovery Protocol (SDP). 526 527endif # BT_DEBUG 528 529config BT_TESTING 530 bool "Bluetooth Testing" 531 help 532 This option enables custom Bluetooth testing interface. 533 Shall only be used for testing purposes. 534 535config BT_BREDR 536 bool "Bluetooth BR/EDR support [EXPERIMENTAL]" 537 depends on BT_HCI_HOST 538 select BT_PERIPHERAL 539 select BT_CENTRAL 540 select BT_SMP 541 select BT_L2CAP_DYNAMIC_CHANNEL 542 help 543 This option enables Bluetooth BR/EDR support 544 545if BT_BREDR 546config BT_MAX_SCO_CONN 547 int "Maximum number of simultaneous SCO connections" 548 default 1 549 range 1 3 550 help 551 Maximum number of simultaneous Bluetooth synchronous connections 552 supported. The minimum (and default) number is 1. 553 554config BT_RFCOMM 555 bool "Bluetooth RFCOMM protocol support [EXPERIMENTAL]" 556 help 557 This option enables Bluetooth RFCOMM support 558 559config BT_RFCOMM_L2CAP_MTU 560 int "L2CAP MTU for RFCOMM frames" 561 default BT_L2CAP_RX_MTU if BT_HCI_ACL_FLOW_CONTROL 562 default BT_RX_BUF_LEN 563 depends on BT_RFCOMM 564 range BT_L2CAP_RX_MTU 32767 if BT_HCI_ACL_FLOW_CONTROL 565 range BT_RX_BUF_LEN 32767 566 help 567 Maximum size of L2CAP PDU for RFCOMM frames. 568 569config BT_HFP_HF 570 bool "Bluetooth Handsfree profile HF Role support [EXPERIMENTAL]" 571 depends on PRINTK 572 select BT_RFCOMM 573 help 574 This option enables Bluetooth HF support 575 576config BT_AVDTP 577 bool "Bluetooth AVDTP protocol support [EXPERIMENTAL]" 578 help 579 This option enables Bluetooth AVDTP support 580 581config BT_A2DP 582 bool "Bluetooth A2DP Profile [EXPERIMENTAL]" 583 select BT_AVDTP 584 help 585 This option enables the A2DP profile 586 587config BT_PAGE_TIMEOUT 588 hex "Bluetooth Page Timeout" 589 default 0x2000 590 range 0x0001 0xffff 591 help 592 This option sets the page timeout value. Value is selected as 593 (N * 0.625) ms. 594 595endif # BT_BREDR 596