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 default 200 if BT_CLASSIC 54 default 70 if BT_EATT 55 default 69 if BT_SMP 56 default 37 if BT_MESH_GATT 57 default 27 58 range 70 $(UINT16_MAX) if BT_EATT 59 range 69 $(UINT16_MAX) if BT_SMP 60 range 27 $(UINT16_MAX) 61 help 62 Maximum support ACL size of data packets sent from the Controller to 63 the Host. This value does not include the HCI ACL header. 64 65 In a combined Host and Controller build, both the 66 Host and the Controller will use this value for buffer sizes, making 67 Controller to Host flow control not strictly necessary. 68 69 In a Host only build with Controller to Host flow control enabled 70 the Host will inform the Controller about the maximum ACL data size it 71 can send by setting this value in the Host Buffer Size command. 72 73 If Controller to Host flow control is not enabled then the Controller 74 can assume the Host has to receive and process ACL data faster than 75 the controller can produce it. 76 77 In a Controller only build this will determine the maximum ACL size 78 that the Controller will send to the Host. 79 80config BT_BUF_ACL_RX_COUNT_EXTRA 81 int "Number of extra incoming ACL data buffers" 82 default 0 83 range 0 65535 84 help 85 Number of incoming extra ACL data buffers sent from the Controller to 86 the Host. 87 88 By default, the number of incoming ACL data buffers is equal to 89 CONFIG_BT_MAX_CONN + 1. 90 91config BT_BUF_ACL_RX_COUNT 92 int "[DEPRECATED] Number of incoming ACL data buffers" 93 default 0 94 range 0 256 95 help 96 Number or incoming ACL data buffers sent from the Controller to the 97 Host. 98 In a combined Host and Controller build the buffers are shared and 99 therefore Controller to Host flow control is not needed. 100 101 In a Host only build with Controller to Host flow control enabled 102 the Host will inform the Controller about the maximum number of 103 buffers by setting this value in the Host Buffer Size command. 104 105 When Controller to Host flow control is not enabled the Controller 106 can assume that the Host has infinite amount of buffers. 107 108 For both configurations, there is an additional requirement that is 109 enforced by a build-time check: BT_BUF_ACL_RX_COUNT needs to be at 110 least one greater than BT_MAX_CONN. 111 112config BT_BUF_EVT_RX_SIZE 113 int "Maximum supported HCI Event buffer length" 114 default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING 115 # LE Read Supported Commands command complete event. 116 default 68 117 range 68 $(UINT8_MAX) 118 range 78 $(UINT8_MAX) if BT_CHANNEL_SOUNDING 119 help 120 Maximum supported HCI event buffer size. This value does not include 121 the HCI Event header. 122 This value is used by both the Host and the Controller for buffer 123 sizes that include HCI events. It should be set according to the 124 expected HCI events that can be generated from the configuration. 125 If the subset of possible HCI events is unknown, this should be set to 126 the maximum of 255. 127 128config BT_BUF_EVT_RX_COUNT 129 int "Number of HCI Event buffers" 130 default 20 if (BT_MESH && !(BT_BUF_EVT_DISCARDABLE_COUNT > 0)) 131 default 10 132 range 2 $(UINT8_MAX) 133 help 134 Number of buffers available for incoming HCI events from the 135 Controller. 136 137config BT_BUF_EVT_DISCARDABLE_SIZE 138 int "Maximum supported discardable HCI Event buffer length" 139 range 43 $(UINT8_MAX) if !BT_EXT_ADV 140 range 58 $(UINT8_MAX) if BT_EXT_ADV 141 # LE Extended Advertising Report event 142 default $(UINT8_MAX) if BT_CLASSIC 143 # Le Advertising Report event 144 default 43 if !BT_EXT_ADV 145 default 58 if BT_EXT_ADV 146 help 147 Maximum support discardable HCI event size of buffers in the separate 148 discardable event buffer pool. This value does not include the 149 HCI Event header. 150 The minimum size is set based on the Advertising Report. Setting 151 the buffer size different than BT_BUF_EVT_RX_SIZE can save memory. 152 153config BT_BUF_EVT_DISCARDABLE_COUNT 154 int "Number of discardable HCI Event buffers" 155 range 1 $(UINT8_MAX) 156 default 20 if BT_MESH 157 default 3 158 depends on !BT_HCI_RAW 159 help 160 Number of buffers in a separate buffer pool for events which 161 the HCI driver considers discardable. Examples of such events 162 could be e.g. Advertising Reports. The benefit of having such 163 a pool is that the if there is a heavy inflow of such events 164 it will not cause the allocation for other critical events to 165 block and may even eliminate deadlocks in some cases. 166 167config BT_BUF_CMD_TX_SIZE 168 int "Maximum support HCI Command buffer length" 169 default $(UINT8_MAX) if (BT_EXT_ADV || BT_CLASSIC || BT_ISO_CENTRAL) 170 # LE Set Connection CTE Receive Parameters. Value required to store max allowed number 171 # of antenna ids for platforms other than Nordic. 172 default 83 if (!BT_EXT_ADV && !BT_CLASSIC && BT_CTLR_DF && BT_CTLR_DF_CONN_CTE_REQ && !SOC_COMPATIBLE_NRF) 173 # LE Generate DHKey v2 command 174 default 65 175 range 65 $(UINT8_MAX) 176 help 177 Maximum data size for each HCI Command buffer. This value does not 178 include the HCI Command header. 179 This value is used by both the Host and the Controller for buffer 180 sizes that include HCI commands. It should be set according to the 181 expected HCI commands that can be sent from the configuration. 182 If the subset of possible HCI commands is unknown, this should be set 183 to the maximum of 255. 184 185config BT_BUF_CMD_TX_COUNT 186 int "Number of HCI command buffers" 187 default 2 188 range 2 64 189 help 190 Number of buffers available for outgoing HCI commands from the Host. 191 192endmenu 193 194# Workaround to have commas on function arguments 195ZEPHYR_BT_HCI := zephyr,bt-hci 196 197config BT_HAS_HCI_VS 198 bool 199 default $(dt_chosen_bool_prop,$(ZEPHYR_BT_HCI),bt-hci-vs-ext) 200 help 201 This option is set by the Bluetooth controller to indicate support 202 for the Zephyr HCI Vendor-Specific Commands and Event. 203 204config BT_HCI_VS 205 bool "Zephyr HCI Vendor-Specific Commands" 206 depends on BT_HAS_HCI_VS || !HAS_BT_CTLR 207 default y if BT_HAS_HCI_VS 208 help 209 Enable support for the Zephyr HCI Vendor-Specific Commands in the 210 Host and/or Controller. This enables Set Version Information, 211 Supported Commands, Supported Features vendor commands. 212 213config BT_HCI_VS_FATAL_ERROR 214 bool "Allow vendor specific HCI event Zephyr Fatal Error" 215 depends on BT_HCI_VS 216 help 217 Enable emitting HCI Vendor-Specific events for system and Controller 218 errors that are unrecoverable. 219 220config BT_HCI_VS_EXT_DETECT 221 bool "Use heuristics to guess HCI vendor extensions support in advance" 222 depends on BT_HCI_VS && !HAS_BT_CTLR 223 default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_POSIX || BOARD_NATIVE_SIM 224 help 225 Use some heuristics to try to guess in advance whether the controller 226 supports the HCI vendor extensions in advance, in order to prevent 227 sending vendor commands to controller which may interpret them in 228 completely different ways. 229 230config BT_HCI_MESH_EXT 231 bool "Mesh HCI Command support" 232 depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT 233 help 234 Enable support for the Bluetooth Mesh HCI Commands. 235 236config BT_WAIT_NOP 237 bool "Wait for \"NOP\" Command Complete event during init" 238 help 239 Emit a Command Complete event from the Controller (and wait for it 240 from the Host) for the NOP opcode to indicate that the Controller is 241 ready to receive commands. 242 243config BT_RPA 244 bool 245 depends on BT_HOST_CRYPTO || BT_CTLR_CRYPTO 246 247config BT_ASSERT 248 bool "Custom Bluetooth assert implementation" 249 default y 250 help 251 Use a custom Bluetooth assert implementation instead of the 252 kernel-wide __ASSERT() when CONFIG_ASSERT is disabled. 253 254if BT_ASSERT 255 256config BT_ASSERT_VERBOSE 257 bool "Print out an assert string when using BT_ASSERT" 258 default y 259 help 260 When CONFIG_BT_ASSERT is enabled, this option turns on printing the 261 cause of the assert to the console using printk(). 262 263config BT_ASSERT_PANIC 264 bool "Use k_panic() instead of k_oops()" 265 help 266 When CONFIG_BT_ASSERT is enabled, this option makes the code call 267 k_panic() instead of k_oops() when an assertion is triggered. 268 269endif # BT_ASSERT 270 271config BT_HCI_ERR_TO_STR 272 bool "Print HCI error codes as strings [EXPERIMENTAL]" 273 select EXPERIMENTAL 274 help 275 This configuration enables printing of HCI error 276 codes represented as strings. 277 See bt_hci_err_to_str() for more details. 278 279config BT_MONITOR 280 bool 281 select LOG_OUTPUT 282 283choice BT_DEBUG_TYPE 284 prompt "Bluetooth debug type" 285 default BT_DEBUG_NONE 286 287config BT_DEBUG_NONE 288 bool "No debug log" 289 help 290 Select this to disable all Bluetooth debug logs. 291 292config BT_DEBUG_MONITOR_UART 293 bool "Monitor protocol over UART" 294 select LOG 295 select CONSOLE_HAS_DRIVER 296 select BT_MONITOR 297 help 298 Use a custom logging protocol over the console UART 299 instead of plain-text output. Requires a special application 300 on the host side that can decode this protocol. Currently 301 the 'btmon' tool from BlueZ is capable of doing this. 302 303 If the target board has two or more external UARTs it is 304 possible to keep using UART_CONSOLE together with this option, 305 however if there is only a single external UART then 306 UART_CONSOLE needs to be disabled (in which case printk/printf 307 will get encoded into the monitor protocol). 308 309config BT_DEBUG_MONITOR_RTT 310 bool "Monitor protocol over RTT" 311 depends on USE_SEGGER_RTT 312 depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 313 select LOG 314 select CONSOLE_HAS_DRIVER 315 select BT_MONITOR 316 help 317 Use a custom logging protocol over the RTT buffer instead of 318 plain-text output. Requires a special application 319 on the host side that can decode this protocol. Currently 320 the 'btmon' tool from BlueZ is capable of doing this. 321 322if BT_DEBUG_MONITOR_RTT 323 324config BT_DEBUG_MONITOR_RTT_BUFFER 325 int "Buffer number used for custom logger output." 326 range 1 SEGGER_RTT_MAX_NUM_UP_BUFFERS 327 default 1 328 help 329 Select index of up-buffer used for logger output. 330 Make sure the buffer number is not used by other logger, 331 e.g. in LOG_BACKEND_RTT_BUFFER, otherwise the buffer will be 332 overwritten. 333 334config BT_DEBUG_MONITOR_RTT_BUFFER_NAME 335 string "Buffer name used for custom logger output." 336 default "btmonitor" 337 help 338 Select index of up-buffer used for logger output. 339 340config BT_DEBUG_MONITOR_RTT_BUFFER_SIZE 341 int "Size of reserved up-buffer for custom logger output." 342 default 1024 343 help 344 Specify reserved size of up-buffer used for custom logger output. 345 346endif # BT_DEBUG_MONITOR_RTT 347 348endchoice # Bluetooth debug type 349