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_EVT_RX_SIZE 106 int "Maximum supported HCI Event buffer length" 107 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 108 # LE Read Supported Commands command complete event. 109 default 68 110 range 68 $(UINT8_MAX) 111 range 78 $(UINT8_MAX) if BT_CHANNEL_SOUNDING 112 help 113 Maximum supported HCI event buffer size. This value does not include 114 the HCI Event header. 115 This value is used by both the Host and the Controller for buffer 116 sizes that include HCI events. It should be set according to the 117 expected HCI events that can be generated from the configuration. 118 If the subset of possible HCI events is unknown, this should be set to 119 the maximum of 255. 120 121config BT_BUF_EVT_RX_COUNT 122 int "Number of HCI Event buffers" 123 default 20 if (BT_MESH && !(BT_BUF_EVT_DISCARDABLE_COUNT > 0)) 124 default 10 125 range 2 $(UINT8_MAX) 126 help 127 Number of buffers available for incoming HCI events from the 128 Controller. 129 130config BT_BUF_CMD_TX_SIZE 131 int "Maximum support HCI Command buffer length" 132 default $(UINT8_MAX) if (BT_EXT_ADV || BT_CLASSIC || BT_ISO_CENTRAL || BT_CHANNEL_SOUNDING) 133 # LE Set Connection CTE Receive Parameters. Value required to store max allowed number 134 # of antenna ids for platforms other than Nordic. 135 default 83 if (!BT_EXT_ADV && !BT_CLASSIC && BT_CTLR_DF && BT_CTLR_DF_CONN_CTE_REQ && !SOC_COMPATIBLE_NRF) 136 # LE Generate DHKey v2 command 137 default 65 138 range 65 $(UINT8_MAX) 139 help 140 Maximum data size for each HCI Command buffer. This value does not 141 include the HCI Command header. 142 This value is used by both the Host and the Controller for buffer 143 sizes that include HCI commands. It should be set according to the 144 expected HCI commands that can be sent from the configuration. 145 If the subset of possible HCI commands is unknown, this should be set 146 to the maximum of 255. 147 148config BT_BUF_CMD_TX_COUNT 149 # This option is only visible for a user when Host and Controller are build together, or for 150 # Host-only builds. 151 int "Number of HCI command buffers" if !BT_HCI_RAW || !HAS_BT_CTLR 152 # This option is present when Host and Controller are build together, or 153 # for Host only builds, or when Controller-to-Host ACL data flow control 154 # is disabled. 155 depends on !BT_HCI_RAW || !HAS_BT_CTLR || !BT_HCI_ACL_FLOW_CONTROL 156 # The Mesh stack usage in applications and tests can start both advertising and scanning in 157 # parallel. Also, when BT_MESH_WORKQ_SYS is enabled, the Mesh stack is starting Extended 158 # Advertising in the receive callback run in the system work queue and as the Host also uses 159 # the system work queue for HCI command Tx towards the Controller, one additional HCI 160 # command buffer is needed. 161 range 2 64 if BT_MESH 162 range 1 64 163 default 2 if BT_MESH 164 default 1 165 help 166 Number of buffers available for outgoing HCI commands from the Host. 167 168 HCI Controllers may not support Num_HCI_Command_Packets > 1, hence they default to 1 when 169 not enabling Controller to Host data flow control (BT_HCI_ACL_FLOW_CONTROL), Read Remote 170 Version Information (BT_REMOTE_VERSION), Auto-Initiate PHY update (BT_AUTO_PHY_UPDATE), or 171 Auto-Initiate Data Length Update (BT_AUTO_DATA_LEN_UPDATE). 172 173 Normal HCI commands follow the HCI command flow control using Num_HCI_Command_Packets 174 return in HCI command complete and status. 175 176 The Host Number of Completed Packets command does not follow normal flow control of HCI 177 commands and the Controller side HCI drivers that allocates HCI command buffers with 178 K_NO_WAIT can end up running out of command buffers. 179 180 When Controller to Host data flow control is enabled in the Host-only or combined 181 Host plus Controller build, the internal BT_BUF_CMD_TX_COUNT is adjusted accordingly 182 taking into considerations the enabled auto-initiated procedures, and to follow the normal 183 HCI command flow control to be able to send Ncmd normal HCI commands and 184 BT_BUF_ACL_RX_COUNT of Host Number of Completed Packets command down to the Controller. 185 186 When Controller to Host data flow control is supported in the Controller-only build, 187 the internal BT_BUF_CMD_TX_COUNT is adjusted to be equal to (BT_BUF_RX_COUNT + Ncmd). 188 189 Where Ncmd is supported maximum Num_HCI_Command_Packets in the Controller implementation. 190 191endmenu 192 193# Workaround to have commas on function arguments 194ZEPHYR_BT_HCI := zephyr,bt-hci 195 196config BT_HAS_HCI_VS 197 bool 198 default $(dt_chosen_bool_prop,$(ZEPHYR_BT_HCI),bt-hci-vs-ext) 199 help 200 This option is set by the Bluetooth controller to indicate support 201 for the Zephyr HCI Vendor-Specific Commands and Event. 202 203config BT_HCI_VS 204 bool "Zephyr HCI Vendor-Specific Commands" 205 depends on BT_HAS_HCI_VS || !HAS_BT_CTLR 206 default y if BT_HAS_HCI_VS 207 help 208 Enable support for the Zephyr HCI Vendor-Specific Commands in the 209 Host and/or Controller. This enables Set Version Information, 210 Supported Commands, Supported Features vendor commands. 211 212config BT_HCI_VS_FATAL_ERROR_SUPPORT 213 bool 214 215config BT_HCI_VS_FATAL_ERROR 216 bool "Allow vendor specific HCI event Zephyr Fatal Error" 217 depends on BT_HCI_VS && BT_HCI_VS_FATAL_ERROR_SUPPORT 218 help 219 Enable emitting HCI Vendor-Specific events for system and Controller 220 errors that are unrecoverable. 221 222config BT_HCI_VS_EXT_DETECT 223 bool "Use heuristics to guess HCI vendor extensions support in advance" 224 depends on BT_HCI_VS && !HAS_BT_CTLR 225 default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_SIM 226 help 227 Use some heuristics to try to guess in advance whether the controller 228 supports the HCI vendor extensions in advance, in order to prevent 229 sending vendor commands to controller which may interpret them in 230 completely different ways. 231 232config BT_HCI_MESH_EXT 233 bool "Mesh HCI Command support" 234 depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT 235 help 236 Enable support for the Bluetooth Mesh HCI Commands. 237 238config BT_WAIT_NOP 239 bool "Wait for \"NOP\" Command Complete event during init" 240 help 241 Emit a Command Complete event from the Controller (and wait for it 242 from the Host) for the NOP opcode to indicate that the Controller is 243 ready to receive commands. 244 245config BT_RPA 246 bool 247 depends on BT_HOST_CRYPTO || BT_CTLR_CRYPTO 248 249config BT_PRIVATE_SHELL 250 bool 251 default n 252 253config BT_ASSERT 254 bool "Custom Bluetooth assert implementation" 255 default y 256 help 257 Use a custom Bluetooth assert implementation instead of the 258 kernel-wide __ASSERT() when CONFIG_ASSERT is disabled. 259 260if BT_ASSERT 261 262config BT_ASSERT_VERBOSE 263 bool "Print out an assert string when using BT_ASSERT" 264 default y 265 help 266 When CONFIG_BT_ASSERT is enabled, this option turns on printing the 267 cause of the assert to the console using printk(). 268 269config BT_ASSERT_PANIC 270 bool "Use k_panic() instead of k_oops()" 271 help 272 When CONFIG_BT_ASSERT is enabled, this option makes the code call 273 k_panic() instead of k_oops() when an assertion is triggered. 274 275endif # BT_ASSERT 276 277config BT_HCI_ERR_TO_STR 278 bool "Print HCI error codes as strings [EXPERIMENTAL]" 279 select EXPERIMENTAL 280 help 281 This configuration enables printing of HCI error 282 codes represented as strings. 283 See bt_hci_err_to_str() for more details. 284 285config BT_MONITOR 286 bool 287 select LOG_OUTPUT 288 289choice BT_DEBUG_TYPE 290 prompt "Bluetooth debug type" 291 default BT_DEBUG_NONE 292 293config BT_DEBUG_NONE 294 bool "No debug log" 295 help 296 Select this to disable all Bluetooth debug logs. 297 298config BT_DEBUG_MONITOR_UART 299 bool "Monitor protocol over UART" 300 select LOG 301 select CONSOLE_HAS_DRIVER 302 select BT_MONITOR 303 help 304 Use a custom logging protocol over the console UART 305 instead of plain-text output. Requires a special application 306 on the host side that can decode this protocol. Currently 307 the 'btmon' tool from BlueZ is capable of doing this. 308 309 If the target board has two or more external UARTs it is 310 possible to keep using UART_CONSOLE together with this option, 311 however if there is only a single external UART then 312 UART_CONSOLE needs to be disabled (in which case printk/printf 313 will get encoded into the monitor protocol). 314 315config BT_DEBUG_MONITOR_RTT 316 bool "Monitor protocol over RTT" 317 depends on USE_SEGGER_RTT 318 depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 319 select LOG 320 select CONSOLE_HAS_DRIVER 321 select BT_MONITOR 322 help 323 Use a custom logging protocol over the RTT buffer instead of 324 plain-text output. Requires a special application 325 on the host side that can decode this protocol. Currently 326 the 'btmon' tool from BlueZ is capable of doing this. 327 328if BT_DEBUG_MONITOR_RTT 329 330config BT_DEBUG_MONITOR_RTT_BUFFER 331 int "Buffer number used for custom logger output." 332 range 1 SEGGER_RTT_MAX_NUM_UP_BUFFERS 333 default 1 334 help 335 Select index of up-buffer used for logger output. 336 Make sure the buffer number is not used by other logger, 337 e.g. in LOG_BACKEND_RTT_BUFFER, otherwise the buffer will be 338 overwritten. 339 340config BT_DEBUG_MONITOR_RTT_BUFFER_NAME 341 string "Buffer name used for custom logger output." 342 default "btmonitor" 343 help 344 Select index of up-buffer used for logger output. 345 346config BT_DEBUG_MONITOR_RTT_BUFFER_SIZE 347 int "Size of reserved up-buffer for custom logger output." 348 default 1024 349 help 350 Specify reserved size of up-buffer used for custom logger output. 351 352endif # BT_DEBUG_MONITOR_RTT 353 354endchoice # Bluetooth debug type 355