1config BT_CTRL_MODE_EFF
2    int
3    default 1
4
5config BT_CTRL_BLE_MAX_ACT
6    int "BLE Max Instances"
7    default 6
8    range 1 10
9    help
10        BLE maximum activities of bluetooth controller,both of connections,
11        scan , sync and adv(periodic adv, multi-adv). Each instance needs to
12        consume 828 bytes, you can save RAM by modifying the instance value
13        according to actual needs.
14
15config BT_CTRL_BLE_MAX_ACT_EFF
16    int
17    default BT_CTRL_BLE_MAX_ACT
18    default 0
19
20config BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB
21    int "BLE static ACL TX buffer numbers"
22    range 0 12
23    default 0
24    help
25        BLE ACL buffer have two methods to be allocated. One is persistent allocating
26        (allocate when controller initialise, never free until controller de-initialise)
27        another is dynamically allocating (allocate before TX and free after TX).
28
29choice BT_CTRL_PINNED_TO_CORE_CHOICE
30    prompt "The cpu core which bluetooth controller run"
31    depends on !FREERTOS_UNICORE
32    help
33        Specify the cpu core to run bluetooth controller.
34        Can not specify no-affinity.
35
36    config BT_CTRL_PINNED_TO_CORE_0
37        bool "Core 0 (PRO CPU)"
38    config BT_CTRL_PINNED_TO_CORE_1
39        bool "Core 1 (APP CPU)"
40        depends on !FREERTOS_UNICORE
41endchoice
42
43config BT_CTRL_PINNED_TO_CORE
44    int
45    default 0 if BT_CTRL_PINNED_TO_CORE_0
46    default 1 if BT_CTRL_PINNED_TO_CORE_1
47    default 0
48
49choice BT_CTRL_HCI_MODE_CHOICE
50    prompt "HCI mode"
51    help
52        Specify HCI mode as VHCI or UART(H4)
53
54    config BT_CTRL_HCI_MODE_VHCI
55        bool "VHCI"
56        help
57            Normal option. Mostly, choose this VHCI when bluetooth host run on ESP32S3 or ESP32C3.
58
59    config BT_CTRL_HCI_MODE_UART_H4
60        bool "UART(H4)"
61        help
62            If use external bluetooth host which run on other hardware and use UART as the HCI interface,
63            choose this option.
64endchoice
65
66config BT_CTRL_HCI_TL
67    int
68    default 0 if BT_CTRL_HCI_MODE_UART_H4
69    default 1 if BT_CTRL_HCI_M0DE_VHCI
70    default 1
71    help
72        HCI mode as VHCI or UART(H4)
73
74config BT_CTRL_ADV_DUP_FILT_MAX
75    int "The maximum number of 5.0 extend duplicate scan filter"
76    range 1 500
77    default 30
78    help
79        The maximum number of suplicate scan filter
80
81choice BT_BLE_CCA_MODE
82    prompt "BLE CCA mode"
83    default BT_BLE_CCA_MODE_NONE
84    help
85        Define BT BLE CCA mode
86
87    config BT_BLE_CCA_MODE_NONE
88        bool "NONE"
89    config BT_BLE_CCA_MODE_HW
90        bool "Hardware"
91    config BT_BLE_CCA_MODE_SW
92        bool "Software"
93endchoice
94
95config BT_BLE_CCA_MODE
96    int
97    default 0 if BT_BLE_CCA_MODE_NONE
98    default 1 if BT_BLE_CCA_MODE_HW
99    default 2 if BT_BLE_CCA_MODE_SW
100
101config BT_CTRL_HW_CCA_VAL
102    int "CCA threshold value"
103    range 20 100
104    default 20
105    help
106        It is the threshold value of HW CCA, if the value is 30, it means CCA threshold is -30 dBm.
107
108config BT_CTRL_HW_CCA_EFF
109    int
110    default 1 if BT_CTRL_HW_CCA
111    default 0
112    help
113        If other devices are sending packets in the air and the signal is strong,
114        the packet hw to be sent this time is cancelled.
115
116choice BT_CTRL_CE_LENGTH_TYPE
117    prompt "Connection event length determination method"
118    help
119        Specify connection event length determination
120
121    config BT_CTRL_CE_LENGTH_TYPE_ORIG
122        bool "ORIGINAL"
123    config BT_CTRL_CE_LENGTH_TYPE_CE
124        bool "Use CE parameter for HCI command"
125    config BT_CTRL_CE_LENGTH_TYPE_SD
126        bool "Use Espressif self-defined method"
127endchoice
128
129config BT_CTRL_CE_LENGTH_TYPE_EFF
130    int
131    default 0 if BT_CTRL_CE_LENGTH_TYPE_ORIG
132    default 1 if BT_CTRL_CE_LENGTH_TYPE_CE
133    default 2 if BT_CTRL_CE_LENGTH_TYPE_SD
134
135choice BT_CTRL_TX_ANTENNA_INDEX
136    prompt "default Tx anntena used"
137    help
138        Specify default Tx antenna used for bluetooth
139
140    config BT_CTRL_TX_ANTENNA_INDEX_0
141        bool "Antenna 0"
142    config BT_CTRL_TX_ANTENNA_INDEX_1
143        bool "Antenna 1"
144endchoice
145
146config BT_CTRL_TX_ANTENNA_INDEX_EFF
147    int
148    default 0 if BT_CTRL_TX_ANTENNA_INDEX_0
149    default 1 if BT_CTRL_TX_ANTENNA_INDEX_1
150
151choice BT_CTRL_RX_ANTENNA_INDEX
152    prompt "default Rx anntena used"
153    help
154        Specify default Rx antenna used for bluetooth
155
156    config BT_CTRL_RX_ANTENNA_INDEX_0
157        bool "Antenna 0"
158    config BT_CTRL_RX_ANTENNA_INDEX_1
159        bool "Antenna 1"
160endchoice
161
162config BT_CTRL_RX_ANTENNA_INDEX_EFF
163    int
164    default 0 if BT_CTRL_RX_ANTENNA_INDEX_0
165    default 1 if BT_CTRL_RX_ANTENNA_INDEX_1
166
167choice BT_CTRL_DFT_TX_POWER_LEVEL
168    prompt "BLE default Tx power level"
169    default BT_CTRL_DFT_TX_POWER_LEVEL_P9
170    help
171        Specify default Tx power level
172
173    config BT_CTRL_DFT_TX_POWER_LEVEL_N24
174        bool "-24dBm"
175    config BT_CTRL_DFT_TX_POWER_LEVEL_N21
176        bool "-21dBm"
177    config BT_CTRL_DFT_TX_POWER_LEVEL_N18
178        bool "-18dBm"
179    config BT_CTRL_DFT_TX_POWER_LEVEL_N15
180        bool "-15dBm"
181    config BT_CTRL_DFT_TX_POWER_LEVEL_N12
182        bool "-12dBm"
183    config BT_CTRL_DFT_TX_POWER_LEVEL_N9
184        bool "-9dBm"
185    config BT_CTRL_DFT_TX_POWER_LEVEL_N6
186        bool "-6dBm"
187    config BT_CTRL_DFT_TX_POWER_LEVEL_N3
188        bool "-3dBm"
189    config BT_CTRL_DFT_TX_POWER_LEVEL_N0
190        bool "0dBm"
191    config BT_CTRL_DFT_TX_POWER_LEVEL_P3
192        bool "+3dBm"
193    config BT_CTRL_DFT_TX_POWER_LEVEL_P6
194        bool "+6dBm"
195    config BT_CTRL_DFT_TX_POWER_LEVEL_P9
196        bool "+9dBm"
197    config BT_CTRL_DFT_TX_POWER_LEVEL_P12
198        bool "+12dBm"
199    config BT_CTRL_DFT_TX_POWER_LEVEL_P15
200        bool "+15dBm"
201    config BT_CTRL_DFT_TX_POWER_LEVEL_P18
202        bool "+18dBm"
203    config BT_CTRL_DFT_TX_POWER_LEVEL_P20
204        bool "+20dBm"
205endchoice
206
207config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
208    int
209    default 0 if BT_CTRL_DFT_TX_POWER_LEVEL_N24
210    default 1 if BT_CTRL_DFT_TX_POWER_LEVEL_N21
211    default 2 if BT_CTRL_DFT_TX_POWER_LEVEL_N18
212    default 3 if BT_CTRL_DFT_TX_POWER_LEVEL_N15
213    default 4 if BT_CTRL_DFT_TX_POWER_LEVEL_N12
214    default 5 if BT_CTRL_DFT_TX_POWER_LEVEL_N9
215    default 6 if BT_CTRL_DFT_TX_POWER_LEVEL_N6
216    default 7 if BT_CTRL_DFT_TX_POWER_LEVEL_N3
217    default 8 if BT_CTRL_DFT_TX_POWER_LEVEL_N0
218    default 9 if BT_CTRL_DFT_TX_POWER_LEVEL_P3
219    default 10 if BT_CTRL_DFT_TX_POWER_LEVEL_P6
220    default 11 if BT_CTRL_DFT_TX_POWER_LEVEL_P9
221    default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
222    default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
223    default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
224    default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P20
225    default 0
226
227config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
228    bool "BLE adv report flow control supported"
229    depends on (!BT_CTRL_RUN_IN_FLASH_ONLY) || (BT_CTRL_RUN_IN_FLASH_ONLY && BT_CTRL_BLE_SCAN)
230    default y
231    help
232        The function is mainly used to enable flow control for advertising reports. When it is enabled,
233        advertising reports will be discarded by the controller if the number of unprocessed advertising
234        reports exceeds the size of BLE adv report flow control.
235
236config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM
237    int "BLE adv report flow control number"
238    depends on BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
239    range 50 1000
240    default 100
241    help
242        The number of unprocessed advertising report that bluetooth host can save.If you set
243        `BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a small value, this may cause adv packets lost.
244        If you set `BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a large value, bluetooth host may cache a
245        lot of adv packets and this may cause system memory run out. For example, if you set
246        it to 50, the maximum memory consumed by host is 35 * 50 bytes. Please set
247        `BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM` according to your system free memory and handle adv
248        packets as fast as possible, otherwise it will cause adv packets lost.
249
250config BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD
251    int "BLE adv lost event threshold value"
252    depends on BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
253    range 1 1000
254    default 20
255    help
256        When adv report flow control is enabled, The ADV lost event will be generated when the number
257        of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
258        If you set `BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
259        may cause adv packets lost more.
260
261config BT_CTRL_BLE_SCAN_DUPL
262    bool "BLE Scan Duplicate Options"
263    default y
264    help
265        This select enables parameters setting of BLE scan duplicate.
266
267choice BT_CTRL_SCAN_DUPL_TYPE
268    prompt "Scan Duplicate Type"
269    default BT_CTRL_SCAN_DUPL_TYPE_DEVICE
270    depends on BT_CTRL_BLE_SCAN_DUPL
271    help
272        Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use
273        advertiser address filtering. The adv packet of the same address is only allowed to be reported once.
274        Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising
275        data and device address filtering. All different adv packets with the same address are allowed to be
276        reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data
277        filtering. All same advertising data only allow to be reported once even though they are from
278        different devices.
279
280    config BT_CTRL_SCAN_DUPL_TYPE_DEVICE
281        bool "Scan Duplicate By Device Address"
282        help
283            Advertising packets with the same address, address type, and advertising type are reported once.
284
285    config BT_CTRL_SCAN_DUPL_TYPE_DATA
286        bool "Scan Duplicate By Advertising Data"
287        help
288            Advertising packets with identical advertising data, address type, and advertising type
289            are reported only once, even if they originate from different devices.
290
291    config BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE
292        bool "Scan Duplicate By Device Address And Advertising Data"
293        help
294            Advertising packets with the same address, advertising data, address type,
295            and advertising type are reported only once.
296endchoice
297
298config BT_CTRL_SCAN_DUPL_TYPE
299    int
300    depends on BT_CTRL_BLE_SCAN_DUPL
301    default 0 if BT_CTRL_SCAN_DUPL_TYPE_DEVICE
302    default 1 if BT_CTRL_SCAN_DUPL_TYPE_DATA
303    default 2 if BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE
304    default 0
305
306config BT_CTRL_SCAN_DUPL_CACHE_SIZE
307    int "Maximum number of devices in scan duplicate filter"
308    depends on BT_CTRL_BLE_SCAN_DUPL
309    range 10 1000
310    default 100
311    help
312        Maximum number of devices which can be recorded in scan duplicate filter.
313        When the maximum amount of device in the filter is reached, the cache will be refreshed.
314
315config BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
316    int "Duplicate scan list refresh period (seconds)"
317    depends on BT_CTRL_BLE_SCAN_DUPL
318    range 0 1000
319    default 0
320    help
321        If the period value is non-zero, the controller will periodically clear the device information
322        stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
323        until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
324        Host in advertising report events.
325        There are two scenarios where the ADV packet will be repeatedly reported:
326        1. The duplicate scan cache is full, the controller will delete the oldest device information and
327        add new device information.
328        2. When the refresh period is up, the controller will clear all device information and start filtering
329        again.
330
331config BT_CTRL_BLE_MESH_SCAN_DUPL_EN
332    bool "Special duplicate scan mechanism for BLE Mesh scan"
333    depends on BT_CTRL_BLE_SCAN_DUPL
334    default n
335    help
336        This enables the BLE scan duplicate for special BLE Mesh scan.
337
338config BT_CTRL_MESH_DUPL_SCAN_CACHE_SIZE
339    int "Maximum number of Mesh adv packets in scan duplicate filter"
340    depends on BT_CTRL_BLE_MESH_SCAN_DUPL_EN
341    range 10 1000
342    default 100
343    help
344        Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
345        When the maximum amount of device in the filter is reached, the cache will be refreshed.
346
347choice BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM
348    prompt "Coexistence: limit on MAX Tx/Rx time for coded-PHY connection"
349    default BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS
350    depends on ESP_COEX_SW_COEXIST_ENABLE
351    help
352        When using PHY-Coded in BLE connection, limitation on max tx/rx time can be applied to
353        better avoid dramatic performance deterioration of Wi-Fi.
354
355    config BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN
356        bool "Force Enable"
357        help
358            Always enable the limitation on max tx/rx time for Coded-PHY connection
359
360    config BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS
361        bool "Force Disable"
362        help
363            Disable the limitation on max tx/rx time for Coded-PHY connection
364endchoice
365
366config BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF
367    int
368    default 0 if !ESP_COEX_SW_COEXIST_ENABLE
369    default 1 if BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN
370    default 0 if BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS
371
372menu "MODEM SLEEP Options"
373    visible if BT_ENABLED
374
375    config BT_CTRL_MODEM_SLEEP
376        bool "Bluetooth modem sleep"
377        depends on !BT_CTRL_HCI_MODE_UART_H4
378        default n
379        help
380            Enable/disable bluetooth controller low power mode.
381            Modem sleep is not supported to be used with UART HCI.
382
383    config BT_CTRL_MODEM_SLEEP_MODE_1
384        bool "Bluetooth Modem sleep Mode 1"
385        depends on BT_CTRL_MODEM_SLEEP
386        default y
387        help
388            Mode 1 is the currently supported sleep mode. In this mode,
389            bluetooth controller sleeps between and BLE events. A low
390            power clock is used to maintain bluetooth reference clock.
391
392    choice BT_CTRL_LOW_POWER_CLOCK
393        prompt "Bluetooth low power clock"
394        depends on BT_CTRL_MODEM_SLEEP_MODE_1
395        help
396            Select the low power clock source for bluetooth controller
397
398        config BT_CTRL_LPCLK_SEL_MAIN_XTAL
399            bool "Main crystal"
400            help
401                Main crystal can be used as low power clock for bluetooth modem sleep. If this option is
402                selected, bluetooth modem sleep can work under Dynamic Frequency Scaling(DFS) enabled, and
403                bluetooth can work under light sleep enabled. Main crystal has a relatively better performance
404                than other bluetooth low power clock sources.
405        config BT_CTRL_LPCLK_SEL_EXT_32K_XTAL
406            bool "External 32kHz crystal/oscillator"
407            depends on RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC
408            help
409                External 32kHz crystal/oscillator has a nominal frequency of 32.768kHz and provides good frequency
410                stability. If used as Bluetooth low power clock, External 32kHz can support Bluetooth
411                modem sleep to be used with both DFS and light sleep.
412
413        config BT_CTRL_LPCLK_SEL_RTC_SLOW
414            bool "Internal 150kHz RC oscillator"
415            depends on RTC_CLK_SRC_INT_RC
416            help
417                Internal 150kHz RC oscillator. The accuracy of this clock is a lot larger than 500ppm which is required
418                in Bluetooth communication, so don't select this option in scenarios such as BLE connection state.
419    endchoice
420
421    config BT_CTRL_MAIN_XTAL_PU_DURING_LIGHT_SLEEP
422        bool "power up main XTAL during light sleep"
423        depends on (BT_CTRL_LPCLK_SEL_MAIN_XTAL || BT_CTRL_LPCLK_SEL_EXT_32K_XTAL) && FREERTOS_USE_TICKLESS_IDLE
424        default n
425        help
426            If this option is selected, the main crystal will power up during light sleep when the low power clock
427            selects an external 32kHz crystal but the external 32kHz crystal does not exist or the low power clock
428            selects the main crystal.
429
430endmenu
431
432config BT_CTRL_SLEEP_MODE_EFF
433    int
434    default 1 if BT_CTRL_MODEM_SLEEP_MODE_1
435    default 0
436
437config BT_CTRL_SLEEP_CLOCK_EFF
438    int
439    default 1 if BT_CTRL_LPCLK_SEL_MAIN_XTAL
440    default 2 if BT_CTRL_LPCLK_SEL_EXT_32K_XTAL
441    default 3 if BT_CTRL_LPCLK_SEL_RTC_SLOW
442
443    default 0
444
445config BT_CTRL_HCI_TL_EFF
446    int
447    default 0 if BT_CTRL_HCI_MODE_UART_H4
448    default 1 if BT_CTRL_HCI_M0DE_VHCI
449    default 1
450
451config BT_CTRL_AGC_RECORRECT_EN
452    bool "Enable HW AGC recorrect"
453    default n
454    help
455        Enable uncoded phy AGC recorrect
456
457config BT_CTRL_CODED_AGC_RECORRECT_EN
458    bool "Enable coded phy AGC recorrect"
459    depends on BT_CTRL_AGC_RECORRECT_EN
460    default n
461    help
462        Enable coded phy AGC recorrect
463
464config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
465    bool "Disable active scan backoff"
466    default n
467    help
468        Disable active scan backoff. The bluetooth spec requires that scanners should run a backoff procedure to
469        minimize collision of scan request PDUs from nultiple scanners. If scan backoff is disabled, in active
470        scanning, scan request PDU will be sent every time when HW receives scannable ADV PDU.
471
472config BT_BLE_ADV_DATA_LENGTH_ZERO_AUX
473    bool "Enable aux packet when ext adv data length is zero"
474    default n
475    help
476        When this option is enabled, auxiliary packets will be present in the events of
477        'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
478        If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.
479
480config BT_CTRL_CHAN_ASS_EN
481    bool "Enable channel assessment"
482    default y
483    help
484        If this option is enabled, The Controller will records the communication quality
485        for each channel and then start a timer to check and update the channel map every 4 seconds.
486
487config BT_CTRL_LE_PING_EN
488    bool "Enable LE Ping procedure"
489    default y
490    help
491        If this option is disabled, The Controller will not start the LE authenticated payload timer.
492        This option is used for some compatibility problems related to LE ping procedure.
493
494menu "BLE disconnect when instant passed"
495    config BT_CTRL_BLE_LLCP_CONN_UPDATE
496        bool "BLE ACL connection update procedure"
497        default n
498        help
499            If this option is enabled, Controller will terminate the connection
500            when instant passed during connection update procedure.
501
502    config BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE
503        bool "BLE ACL channel map update procedure"
504        default n
505        help
506            If this option is enabled, Controller will terminate the connection
507            when instant passed in channel map update procedure.
508
509    config BT_CTRL_BLE_LLCP_PHY_UPDATE
510        bool "BLE ACL PHY update procedure"
511        default n
512        help
513            If this option is enabled, Controller will terminate the connection
514            when instant passed in PHY update procedure.
515endmenu
516config BT_CTRL_RUN_IN_FLASH_ONLY
517    bool "Put all BLE Controller code in flash"
518    default n
519    help
520        If this option is enabled, all code for the Bluetooth controller will be moved from ROM and IRAM
521        to flash, saving over 20K bytes of memory. However, it will require more flash resources and the
522        performance of Bluetooth will decrease If this option is enabled, Bluetooth may not work properly
523        during erasing flash. It is recommended to turn on the auto suspend function of flash. After auto
524        suspend is turned on, Bluetooth interrupts can be executed normally during erasing flash, with less
525        impact on Bluetooth performance.
526
527config BT_CTRL_DTM_ENABLE
528    depends on BT_CTRL_RUN_IN_FLASH_ONLY
529    bool "Enable direct test mode feature"
530    default n
531
532config BT_CTRL_BLE_MASTER
533    depends on BT_CTRL_RUN_IN_FLASH_ONLY
534    bool "Enable BLE master role feature"
535    default y
536
537config BT_CTRL_BLE_TEST
538    depends on BT_CTRL_RUN_IN_FLASH_ONLY
539    bool "Enable BLE QA test feature"
540    default n
541
542config BT_CTRL_BLE_SCAN
543    depends on BT_CTRL_RUN_IN_FLASH_ONLY
544    bool "Enable BLE scan feature"
545    default y
546config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
547    bool "Enable enhanced Access Address check in CONNECT_IND"
548    default n
549    help
550        Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU.
551        This improves security by ensuring that only connection requests with valid Access Addresses are accepted.
552        If disabled, only basic checks are applied, improving compatibility.
553