1# Bluetooth common configuration options 2 3# Copyright (c) 2017 Nordic Semiconductor ASA 4# Copyright (c) 2016 Intel Corporation 5# SPDX-License-Identifier: Apache-2.0 6 7menu "Bluetooth buffer configuration" 8 9config BT_BUF_ACL_TX_SIZE 10 int "Maximum supported ACL size for outgoing data" 11 range 27 $(UINT16_MAX) 12 default 37 if BT_MESH_GATT 13 default 27 14 help 15 Maximum supported ACL size of data packets sent from the Host to the 16 Controller. This value does not include the HCI ACL header. 17 18 In a combined build this value will be set in both the Host and the 19 Controller. 20 21 In a Host-only build the Host will read the maximum ACL size supported 22 by the Controller and use the smallest value supported by both the 23 Host and the Controller. 24 25 The Host supports sending of larger L2CAP PDUs than the ACL size and 26 will fragment L2CAP PDUs into ACL data packets. 27 The Controller will return this value in the HCI LE Read Buffer 28 Size command response. If this size if greater than effective Link 29 Layer transmission size then the Controller will perform 30 fragmentation before transmitting the packet(s) on air. 31 If this value is less than the effective Link Layer transmission size 32 then this will restrict the maximum Link Layer transmission size. 33 34config BT_BUF_ACL_TX_COUNT 35 int "Number of outgoing ACL data buffers" 36 default 7 if BT_HCI_RAW 37 default 4 if BT_MESH_GATT 38 default 3 39 range 1 $(UINT8_MAX) 40 help 41 Number of outgoing ACL data buffers sent from the Host to the 42 Controller. This determines the maximum amount of data packets the 43 Host can have queued in the Controller before waiting for the 44 to notify the Host that more packets can be queued with the Number of 45 Completed Packets event. 46 The buffers are shared between all of the connections and the Host 47 determines how to divide the buffers between the connections. 48 The Controller will return this value in the HCI LE Read Buffer Size 49 command response. 50 51config BT_BUF_ACL_RX_SIZE 52 int "Maximum supported ACL size for incoming data" 53 # For GOEP over RFCOMM, including, 54 # 255 bytes - the minimum MTU of GOEP, 55 # 4 bytes - L2CAP Header, 56 # 5 bytes - 4 bytes for RFCOMM header with extended length, 1 byte for FCS. 57 default 264 if BT_CLASSIC && BT_GOEP 58 default 200 if BT_CLASSIC 59 default 70 if BT_EATT 60 default 69 if BT_SMP 61 default 37 if BT_MESH_GATT 62 default 27 63 range 264 $(UINT16_MAX) if BT_CLASSIC && BT_GOEP 64 range 70 $(UINT16_MAX) if BT_EATT 65 range 69 $(UINT16_MAX) if BT_SMP 66 range 27 $(UINT16_MAX) 67 help 68 Maximum support ACL size of data packets sent from the Controller to 69 the Host. This value does not include the HCI ACL header. 70 71 In a combined Host and Controller build, both the 72 Host and the Controller will use this value for buffer sizes, making 73 Controller to Host flow control not strictly necessary. 74 75 In a Host only build with Controller to Host flow control enabled 76 the Host will inform the Controller about the maximum ACL data size it 77 can send by setting this value in the Host Buffer Size command. 78 79 If Controller to Host flow control is not enabled then the Controller 80 can assume the Host has to receive and process ACL data faster than 81 the controller can produce it. 82 83 In a Controller only build this will determine the maximum ACL size 84 that the Controller will send to the Host. 85 86config BT_BUF_ACL_RX_COUNT_EXTRA 87 # As Host implementation unconditionally references this Kconfig, we 88 # hide it for !BT_CONN and default to 0. 89 int "Number of extra incoming ACL data buffers" if BT_CONN 90 range 1 65535 if BT_CONN 91 default BT_MAX_CONN if BT_CONN 92 range 0 0 93 default 0 94 help 95 Number of incoming extra ACL data buffers sent from the Controller to 96 the Host. 97 98 By default, the total number of incoming ACL data buffers is equal to 99 CONFIG_BT_MAX_CONN + 1, to support L2CAP recombination. 100 101 The L2CAP recombination in the Host keeps the first Rx buffer for each 102 connection and uses one Rx buffer across all connections to receive a 103 fragment from the Controller. 104 105config BT_BUF_ACL_RX_COUNT 106 int "[DEPRECATED] Number of incoming ACL data buffers" 107 default 0 108 range 0 256 109 help 110 Number or incoming ACL data buffers sent from the Controller to the 111 Host. 112 In a combined Host and Controller build the buffers are shared and 113 therefore Controller to Host flow control is not needed. 114 115 In a Host only build with Controller to Host flow control enabled 116 the Host will inform the Controller about the maximum number of 117 buffers by setting this value in the Host Buffer Size command. 118 119 When Controller to Host flow control is not enabled the Controller 120 can assume that the Host has infinite amount of buffers. 121 122 For both configurations, there is an additional requirement that is 123 enforced by a build-time check: BT_BUF_ACL_RX_COUNT needs to be at 124 least one greater than BT_MAX_CONN. 125 126config BT_BUF_EVT_RX_SIZE 127 int "Maximum supported HCI Event buffer length" 128 default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING || BT_LE_EXTENDED_FEAT_SET 129 # LE Read Supported Commands command complete event. 130 default 68 131 range 68 $(UINT8_MAX) 132 range 78 $(UINT8_MAX) if BT_CHANNEL_SOUNDING 133 help 134 Maximum supported HCI event buffer size. This value does not include 135 the HCI Event header. 136 This value is used by both the Host and the Controller for buffer 137 sizes that include HCI events. It should be set according to the 138 expected HCI events that can be generated from the configuration. 139 If the subset of possible HCI events is unknown, this should be set to 140 the maximum of 255. 141 142config BT_BUF_EVT_RX_COUNT 143 int "Number of HCI Event buffers" 144 default 20 if (BT_MESH && !(BT_BUF_EVT_DISCARDABLE_COUNT > 0)) 145 default 10 146 range 2 $(UINT8_MAX) 147 help 148 Number of buffers available for incoming HCI events from the 149 Controller. 150 151config BT_BUF_CMD_TX_SIZE 152 int "Maximum support HCI Command buffer length" 153 default $(UINT8_MAX) if (BT_EXT_ADV || BT_CLASSIC || BT_ISO_CENTRAL || BT_CHANNEL_SOUNDING) 154 # LE Set Connection CTE Receive Parameters. Value required to store max allowed number 155 # of antenna ids for platforms other than Nordic. 156 default 83 if (!BT_EXT_ADV && !BT_CLASSIC && BT_CTLR_DF && BT_CTLR_DF_CONN_CTE_REQ && !SOC_COMPATIBLE_NRF) 157 # LE Generate DHKey v2 command 158 default 65 159 range 65 $(UINT8_MAX) 160 help 161 Maximum data size for each HCI Command buffer. This value does not 162 include the HCI Command header. 163 This value is used by both the Host and the Controller for buffer 164 sizes that include HCI commands. It should be set according to the 165 expected HCI commands that can be sent from the configuration. 166 If the subset of possible HCI commands is unknown, this should be set 167 to the maximum of 255. 168 169config BT_BUF_CMD_TX_COUNT 170 # This option is only visible for a user when Host and Controller are build together, or for 171 # Host-only builds. 172 int "Number of HCI command buffers" if !BT_HCI_RAW || !HAS_BT_CTLR 173 # This option is present when Host and Controller are build together, or 174 # for Host only builds, or when Controller-to-Host ACL data flow control 175 # is disabled. 176 depends on !BT_HCI_RAW || !HAS_BT_CTLR || !BT_HCI_ACL_FLOW_CONTROL 177 # The Mesh stack usage in applications and tests can start both advertising and scanning in 178 # parallel. Also, when BT_MESH_WORKQ_SYS is enabled, the Mesh stack is starting Extended 179 # Advertising in the receive callback run in the system work queue and as the Host also uses 180 # the system work queue for HCI command Tx towards the Controller, one additional HCI 181 # command buffer is needed. 182 range 2 64 if BT_MESH 183 range 1 64 184 default 2 if BT_MESH 185 default 1 186 help 187 Number of buffers available for outgoing HCI commands from the Host. 188 189 HCI Controllers may not support Num_HCI_Command_Packets > 1, hence they default to 1 when 190 not enabling Controller to Host data flow control (BT_HCI_ACL_FLOW_CONTROL), Read Remote 191 Version Information (BT_REMOTE_VERSION), Auto-Initiate PHY update (BT_AUTO_PHY_UPDATE), or 192 Auto-Initiate Data Length Update (BT_AUTO_DATA_LEN_UPDATE). 193 194 Normal HCI commands follow the HCI command flow control using Num_HCI_Command_Packets 195 return in HCI command complete and status. 196 197 The Host Number of Completed Packets command does not follow normal flow control of HCI 198 commands and the Controller side HCI drivers that allocates HCI command buffers with 199 K_NO_WAIT can end up running out of command buffers. 200 201 When Controller to Host data flow control is enabled in the Host-only or combined 202 Host plus Controller build, the internal BT_BUF_CMD_TX_COUNT is adjusted accordingly 203 taking into considerations the enabled auto-initiated procedures, and to follow the normal 204 HCI command flow control to be able to send Ncmd normal HCI commands and 205 BT_BUF_ACL_RX_COUNT of Host Number of Completed Packets command down to the Controller. 206 207 When Controller to Host data flow control is supported in the Controller-only build, 208 the internal BT_BUF_CMD_TX_COUNT is adjusted to be equal to (BT_BUF_RX_COUNT + Ncmd). 209 210 Where Ncmd is supported maximum Num_HCI_Command_Packets in the Controller implementation. 211 212endmenu 213 214# Workaround to have commas on function arguments 215ZEPHYR_BT_HCI := zephyr,bt-hci 216 217config BT_HAS_HCI_VS 218 bool 219 default $(dt_chosen_bool_prop,$(ZEPHYR_BT_HCI),bt-hci-vs-ext) 220 help 221 This option is set by the Bluetooth controller to indicate support 222 for the Zephyr HCI Vendor-Specific Commands and Event. 223 224config BT_HCI_VS 225 bool "Zephyr HCI Vendor-Specific Commands" 226 depends on BT_HAS_HCI_VS || !HAS_BT_CTLR 227 default y if BT_HAS_HCI_VS 228 help 229 Enable support for the Zephyr HCI Vendor-Specific Commands in the 230 Host and/or Controller. This enables Set Version Information, 231 Supported Commands, Supported Features vendor commands. 232 233config BT_HCI_VS_FATAL_ERROR 234 bool "Allow vendor specific HCI event Zephyr Fatal Error" 235 depends on BT_HCI_VS 236 help 237 Enable emitting HCI Vendor-Specific events for system and Controller 238 errors that are unrecoverable. 239 240config BT_HCI_VS_EXT_DETECT 241 bool "Use heuristics to guess HCI vendor extensions support in advance" 242 depends on BT_HCI_VS && !HAS_BT_CTLR 243 default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_SIM 244 help 245 Use some heuristics to try to guess in advance whether the controller 246 supports the HCI vendor extensions in advance, in order to prevent 247 sending vendor commands to controller which may interpret them in 248 completely different ways. 249 250config BT_HCI_MESH_EXT 251 bool "Mesh HCI Command support" 252 depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT 253 help 254 Enable support for the Bluetooth Mesh HCI Commands. 255 256config BT_WAIT_NOP 257 bool "Wait for \"NOP\" Command Complete event during init" 258 help 259 Emit a Command Complete event from the Controller (and wait for it 260 from the Host) for the NOP opcode to indicate that the Controller is 261 ready to receive commands. 262 263config BT_RPA 264 bool 265 depends on BT_HOST_CRYPTO || BT_CTLR_CRYPTO 266 267config BT_PRIVATE_SHELL 268 bool 269 default n 270 271config BT_ASSERT 272 bool "Custom Bluetooth assert implementation" 273 default y 274 help 275 Use a custom Bluetooth assert implementation instead of the 276 kernel-wide __ASSERT() when CONFIG_ASSERT is disabled. 277 278if BT_ASSERT 279 280config BT_ASSERT_VERBOSE 281 bool "Print out an assert string when using BT_ASSERT" 282 default y 283 help 284 When CONFIG_BT_ASSERT is enabled, this option turns on printing the 285 cause of the assert to the console using printk(). 286 287config BT_ASSERT_PANIC 288 bool "Use k_panic() instead of k_oops()" 289 help 290 When CONFIG_BT_ASSERT is enabled, this option makes the code call 291 k_panic() instead of k_oops() when an assertion is triggered. 292 293endif # BT_ASSERT 294 295config BT_HCI_ERR_TO_STR 296 bool "Print HCI error codes as strings [EXPERIMENTAL]" 297 select EXPERIMENTAL 298 help 299 This configuration enables printing of HCI error 300 codes represented as strings. 301 See bt_hci_err_to_str() for more details. 302 303config BT_MONITOR 304 bool 305 select LOG_OUTPUT 306 307choice BT_DEBUG_TYPE 308 prompt "Bluetooth debug type" 309 default BT_DEBUG_NONE 310 311config BT_DEBUG_NONE 312 bool "No debug log" 313 help 314 Select this to disable all Bluetooth debug logs. 315 316config BT_DEBUG_MONITOR_UART 317 bool "Monitor protocol over UART" 318 select LOG 319 select CONSOLE_HAS_DRIVER 320 select BT_MONITOR 321 help 322 Use a custom logging protocol over the console UART 323 instead of plain-text output. Requires a special application 324 on the host side that can decode this protocol. Currently 325 the 'btmon' tool from BlueZ is capable of doing this. 326 327 If the target board has two or more external UARTs it is 328 possible to keep using UART_CONSOLE together with this option, 329 however if there is only a single external UART then 330 UART_CONSOLE needs to be disabled (in which case printk/printf 331 will get encoded into the monitor protocol). 332 333config BT_DEBUG_MONITOR_RTT 334 bool "Monitor protocol over RTT" 335 depends on USE_SEGGER_RTT 336 depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 337 select LOG 338 select CONSOLE_HAS_DRIVER 339 select BT_MONITOR 340 help 341 Use a custom logging protocol over the RTT buffer instead of 342 plain-text output. Requires a special application 343 on the host side that can decode this protocol. Currently 344 the 'btmon' tool from BlueZ is capable of doing this. 345 346if BT_DEBUG_MONITOR_RTT 347 348config BT_DEBUG_MONITOR_RTT_BUFFER 349 int "Buffer number used for custom logger output." 350 range 1 SEGGER_RTT_MAX_NUM_UP_BUFFERS 351 default 1 352 help 353 Select index of up-buffer used for logger output. 354 Make sure the buffer number is not used by other logger, 355 e.g. in LOG_BACKEND_RTT_BUFFER, otherwise the buffer will be 356 overwritten. 357 358config BT_DEBUG_MONITOR_RTT_BUFFER_NAME 359 string "Buffer name used for custom logger output." 360 default "btmonitor" 361 help 362 Select index of up-buffer used for logger output. 363 364config BT_DEBUG_MONITOR_RTT_BUFFER_SIZE 365 int "Size of reserved up-buffer for custom logger output." 366 default 1024 367 help 368 Specify reserved size of up-buffer used for custom logger output. 369 370endif # BT_DEBUG_MONITOR_RTT 371 372endchoice # Bluetooth debug type 373