Kconfig.in 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. choice BTDM_CTRL_MODE
  2. prompt "Bluetooth controller mode (BR/EDR/BLE/DUALMODE)"
  3. help
  4. Specify the bluetooth controller mode (BR/EDR, BLE or dual mode).
  5. config BTDM_CTRL_MODE_BLE_ONLY
  6. bool "BLE Only"
  7. config BTDM_CTRL_MODE_BR_EDR_ONLY
  8. bool "BR/EDR Only"
  9. config BTDM_CTRL_MODE_BTDM
  10. bool "Bluetooth Dual Mode"
  11. endchoice
  12. config BTDM_CTRL_BLE_MAX_CONN
  13. int "BLE Max Connections"
  14. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  15. default 3
  16. range 1 9
  17. help
  18. BLE maximum connections of bluetooth controller.
  19. Each connection uses 1KB static DRAM whenever the BT controller is enabled.
  20. config BTDM_CTRL_BR_EDR_MAX_ACL_CONN
  21. int "BR/EDR ACL Max Connections"
  22. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  23. default 2
  24. range 1 7
  25. help
  26. BR/EDR ACL maximum connections of bluetooth controller.
  27. Each connection uses 1.2 KB DRAM whenever the BT controller is enabled.
  28. config BTDM_CTRL_BR_EDR_MAX_SYNC_CONN
  29. int "BR/EDR Sync(SCO/eSCO) Max Connections"
  30. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  31. default 0
  32. range 0 3
  33. help
  34. BR/EDR Synchronize maximum connections of bluetooth controller.
  35. Each connection uses 2 KB DRAM whenever the BT controller is enabled.
  36. choice BTDM_CTRL_BR_EDR_SCO_DATA_PATH
  37. prompt "BR/EDR Sync(SCO/eSCO) default data path"
  38. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  39. default BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  40. help
  41. SCO data path, i.e. HCI or PCM.
  42. SCO data can be sent/received through HCI synchronous packets, or the data
  43. can be routed to on-chip PCM module on ESP32. PCM input/output signals can
  44. be "matrixed" to GPIOs. The default data path can also be set using API
  45. "esp_bredr_sco_datapath_set"
  46. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI
  47. bool "HCI"
  48. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  49. bool "PCM"
  50. endchoice
  51. config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF
  52. int
  53. default 0 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI
  54. default 1 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  55. default 0
  56. menuconfig BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  57. bool "PCM Signal Config (Role and Polar)"
  58. depends on BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM
  59. default y
  60. choice BTDM_CTRL_PCM_ROLE
  61. prompt "PCM Role"
  62. depends on BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  63. help
  64. PCM role can be configured as PCM master or PCM slave
  65. config BTDM_CTRL_PCM_ROLE_MASTER
  66. bool "PCM Master"
  67. config BTDM_CTRL_PCM_ROLE_SLAVE
  68. bool "PCM Slave"
  69. endchoice
  70. choice BTDM_CTRL_PCM_POLAR
  71. prompt "PCM Polar"
  72. depends on BTDM_CTRL_PCM_ROLE_EDGE_CONFIG
  73. help
  74. PCM polarity can be configured as Falling Edge or Rising Edge
  75. config BTDM_CTRL_PCM_POLAR_FALLING_EDGE
  76. bool "Falling Edge"
  77. config BTDM_CTRL_PCM_POLAR_RISING_EDGE
  78. bool "Rising Edge"
  79. endchoice
  80. config BTDM_CTRL_PCM_ROLE_EFF
  81. int
  82. default 0 if BTDM_CTRL_PCM_ROLE_MASTER
  83. default 1 if BTDM_CTRL_PCM_ROLE_SLAVE
  84. default 0
  85. config BTDM_CTRL_PCM_POLAR_EFF
  86. int
  87. default 0 if BTDM_CTRL_PCM_POLAR_FALLING_EDGE
  88. default 1 if BTDM_CTRL_PCM_POLAR_RISING_EDGE
  89. default 0
  90. config BTDM_CTRL_AUTO_LATENCY
  91. bool "Auto latency"
  92. depends on BTDM_CTRL_MODE_BTDM
  93. default n
  94. help
  95. BLE auto latency, used to enhance classic BT performance
  96. while classic BT and BLE are enabled at the same time.
  97. config BTDM_CTRL_AUTO_LATENCY_EFF
  98. bool
  99. default BTDM_CTRL_AUTO_LATENCY if BTDM_CTRL_MODE_BTDM
  100. default n
  101. config BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT
  102. bool "Legacy Authentication Vendor Specific Event Enable"
  103. depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  104. default y
  105. help
  106. To protect from BIAS attack during Legacy authentication,
  107. Legacy authentication Vendor specific event should be enabled
  108. config BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF
  109. bool
  110. default BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  111. default 0
  112. config BTDM_CTRL_BLE_MAX_CONN_EFF
  113. int
  114. default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  115. default 0
  116. config BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF
  117. int
  118. default BTDM_CTRL_BR_EDR_MAX_ACL_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  119. default 0
  120. config BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF
  121. int
  122. default BTDM_CTRL_BR_EDR_MAX_SYNC_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
  123. default 0
  124. choice BTDM_CTRL_PINNED_TO_CORE_CHOICE
  125. prompt "The cpu core which bluetooth controller run"
  126. depends on !FREERTOS_UNICORE
  127. help
  128. Specify the cpu core to run bluetooth controller.
  129. Can not specify no-affinity.
  130. config BTDM_CTRL_PINNED_TO_CORE_0
  131. bool "Core 0 (PRO CPU)"
  132. config BTDM_CTRL_PINNED_TO_CORE_1
  133. bool "Core 1 (APP CPU)"
  134. depends on !FREERTOS_UNICORE
  135. endchoice
  136. config BTDM_CTRL_PINNED_TO_CORE
  137. int
  138. default 0 if BTDM_CTRL_PINNED_TO_CORE_0
  139. default 1 if BTDM_CTRL_PINNED_TO_CORE_1
  140. default 0
  141. choice BTDM_CTRL_HCI_MODE_CHOICE
  142. prompt "HCI mode"
  143. help
  144. Speicify HCI mode as VHCI or UART(H4)
  145. config BTDM_CTRL_HCI_MODE_VHCI
  146. bool "VHCI"
  147. help
  148. Normal option. Mostly, choose this VHCI when bluetooth host run on ESP32, too.
  149. config BTDM_CTRL_HCI_MODE_UART_H4
  150. bool "UART(H4)"
  151. help
  152. If use external bluetooth host which run on other hardware and use UART as the HCI interface,
  153. choose this option.
  154. endchoice
  155. menu "HCI UART(H4) Options"
  156. visible if BTDM_CTRL_HCI_MODE_UART_H4
  157. config BTDM_CTRL_HCI_UART_NO
  158. int "UART Number for HCI"
  159. depends on BTDM_CTRL_HCI_MODE_UART_H4
  160. range 1 2
  161. default 1
  162. help
  163. Uart number for HCI. The available uart is UART1 and UART2.
  164. config BTDM_CTRL_HCI_UART_BAUDRATE
  165. int "UART Baudrate for HCI"
  166. depends on BTDM_CTRL_HCI_MODE_UART_H4
  167. range 115200 921600
  168. default 921600
  169. help
  170. UART Baudrate for HCI. Please use standard baudrate.
  171. config BTDM_CTRL_HCI_UART_FLOW_CTRL_EN
  172. bool "Enable UART flow control"
  173. depends on BTDM_CTRL_HCI_MODE_UART_H4
  174. default y
  175. endmenu
  176. menu "MODEM SLEEP Options"
  177. config BTDM_CTRL_MODEM_SLEEP
  178. bool "Bluetooth modem sleep"
  179. default y
  180. help
  181. Enable/disable bluetooth controller low power mode.
  182. choice BTDM_CTRL_MODEM_SLEEP_MODE
  183. prompt "Bluetooth Modem sleep mode"
  184. depends on BTDM_CTRL_MODEM_SLEEP
  185. help
  186. To select which strategy to use for modem sleep
  187. config BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
  188. bool "ORIG Mode(sleep with low power clock)"
  189. help
  190. ORIG mode is a bluetooth sleep mode that can be used for dual mode controller. In this mode,
  191. bluetooth controller sleeps between BR/EDR frames and BLE events. A low power clock is used to
  192. maintain bluetooth reference clock.
  193. config BTDM_CTRL_MODEM_SLEEP_MODE_EVED
  194. bool "EVED Mode(For internal test only)"
  195. help
  196. EVED mode is for BLE only and is only for internal test. Do not use it for production. this
  197. mode is not compatible with DFS nor light sleep
  198. endchoice
  199. choice BTDM_CTRL_LOW_POWER_CLOCK
  200. prompt "Bluetooth low power clock"
  201. depends on BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
  202. help
  203. Select the low power clock source for bluetooth controller. Bluetooth low power clock is
  204. the clock source to maintain time in sleep mode.
  205. - "Main crystal" option provides good accuracy and can support Dynamic Frequency Scaling
  206. to be used with Bluetooth modem sleep. Light sleep is not supported.
  207. - "External 32kHz crystal" option allows user to use a 32.768kHz crystal as Bluetooth low
  208. power clock. This option is allowed as long as External 32kHz crystal is configured as
  209. the system RTC clock source. This option provides good accuracy and supports Bluetooth
  210. modem sleep to be used alongside Dynamic Frequency Scaling or light sleep.
  211. config BTDM_CTRL_LPCLK_SEL_MAIN_XTAL
  212. bool "Main crystal"
  213. help
  214. Main crystal can be used as low power clock for bluetooth modem sleep. If this option is
  215. selected, bluetooth modem sleep can work under Dynamic Frequency Scaling(DFS) enabled, but
  216. cannot work when light sleep is enabled. Main crystal has a good performance in accuracy as
  217. the bluetooth low power clock source.
  218. config BTDM_CTRL_LPCLK_SEL_EXT_32K_XTAL
  219. bool "External 32kHz crystal"
  220. depends on RTC_CLK_SRC_EXT_CRYS
  221. help
  222. External 32kHz crystal has a nominal frequency of 32.768kHz and provides good frequency
  223. stability. If used as Bluetooth low power clock, External 32kHz can support Bluetooth
  224. modem sleep to be used with both DFS and light sleep.
  225. endchoice
  226. endmenu
  227. choice BTDM_BLE_SLEEP_CLOCK_ACCURACY
  228. prompt "BLE Sleep Clock Accuracy"
  229. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  230. default BTDM_BLE_DEFAULT_SCA_250PPM
  231. help
  232. BLE Sleep Clock Accuracy(SCA) for the local device is used to estimate window widening in BLE
  233. connection events. With a lower level of clock accuracy(e.g. 500ppm over 250ppm), the slave
  234. needs a larger RX window to synchronize with master in each anchor point, thus resulting in an
  235. increase of power consumption but a higher level of robustness in keeping connected. According
  236. to the requirements of Bluetooth Core specification 4.2, the worst-case accuracy of Classic
  237. Bluetooth low power oscialltor(LPO) is +/-250ppm in STANDBY and in low power modes such as
  238. sniff. For BLE the worst-case SCA is +/-500ppm.
  239. - "151ppm to 250ppm" option is the default value for Bluetooth Dual mode
  240. - "251ppm to 500ppm" option can be used in BLE only mode when using external 32kHz crystal as
  241. low power clock. This option is provided in case that BLE sleep clock has a lower level of
  242. accuracy, or other error sources contribute to the inaccurate timing during sleep.
  243. config BTDM_BLE_DEFAULT_SCA_500PPM
  244. bool "251ppm to 500ppm"
  245. depends on BTDM_CTRL_LPCLK_SEL_EXT_32K_XTAL && BTDM_CTRL_MODE_BLE_ONLY
  246. config BTDM_BLE_DEFAULT_SCA_250PPM
  247. bool "151ppm to 250ppm"
  248. endchoice
  249. config BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF
  250. int
  251. default 0 if BTDM_BLE_DEFAULT_SCA_500PPM
  252. default 1 if BTDM_BLE_DEFAULT_SCA_250PPM
  253. default 1
  254. config BTDM_BLE_SCAN_DUPL
  255. bool "BLE Scan Duplicate Options"
  256. depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
  257. default y
  258. help
  259. This select enables parameters setting of BLE scan duplicate.
  260. choice BTDM_SCAN_DUPL_TYPE
  261. prompt "Scan Duplicate Type"
  262. default BTDM_SCAN_DUPL_TYPE_DEVICE
  263. depends on BTDM_BLE_SCAN_DUPL
  264. help
  265. Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use
  266. advertiser address filtering. The adv packet of the same address is only allowed to be reported once.
  267. Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising
  268. data and device address filtering. All different adv packets with the same address are allowed to be
  269. reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data
  270. filtering. All same advertising data only allow to be reported once even though they are from
  271. different devices.
  272. config BTDM_SCAN_DUPL_TYPE_DEVICE
  273. bool "Scan Duplicate By Device Address"
  274. help
  275. This way is to use advertiser address filtering. The adv packet of the same address is only
  276. allowed to be reported once
  277. config BTDM_SCAN_DUPL_TYPE_DATA
  278. bool "Scan Duplicate By Advertising Data"
  279. help
  280. This way is to use advertising data filtering. All same advertising data only allow to be reported
  281. once even though they are from different devices.
  282. config BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
  283. bool "Scan Duplicate By Device Address And Advertising Data"
  284. help
  285. This way is to use advertising data and device address filtering. All different adv packets with
  286. the same address are allowed to be reported.
  287. endchoice
  288. config BTDM_SCAN_DUPL_TYPE
  289. int
  290. depends on BTDM_BLE_SCAN_DUPL
  291. default 0 if BTDM_SCAN_DUPL_TYPE_DEVICE
  292. default 1 if BTDM_SCAN_DUPL_TYPE_DATA
  293. default 2 if BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
  294. default 0
  295. config BTDM_SCAN_DUPL_CACHE_SIZE
  296. int "Maximum number of devices in scan duplicate filter"
  297. depends on BTDM_BLE_SCAN_DUPL
  298. range 10 1000
  299. default 100
  300. help
  301. Maximum number of devices which can be recorded in scan duplicate filter.
  302. When the maximum amount of device in the filter is reached, the cache will be refreshed.
  303. config BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD
  304. int "Duplicate scan list refresh period (seconds)"
  305. depends on BTDM_BLE_SCAN_DUPL
  306. range 0 1000
  307. default 0
  308. help
  309. If the period value is non-zero, the controller will periodically clear the device information
  310. stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
  311. until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
  312. Host in advertising report events.
  313. There are two scenarios where the ADV packet will be repeatedly reported:
  314. 1. The duplicate scan cache is full, the controller will delete the oldest device information and
  315. add new device information.
  316. 2. When the refresh period is up, the controller will clear all device information and start filtering
  317. again.
  318. config BTDM_BLE_MESH_SCAN_DUPL_EN
  319. bool "Special duplicate scan mechanism for BLE Mesh scan"
  320. depends on BTDM_BLE_SCAN_DUPL
  321. default n
  322. help
  323. This enables the BLE scan duplicate for special BLE Mesh scan.
  324. config BTDM_MESH_DUPL_SCAN_CACHE_SIZE
  325. int "Maximum number of Mesh adv packets in scan duplicate filter"
  326. depends on BTDM_BLE_MESH_SCAN_DUPL_EN
  327. range 10 1000
  328. default 100
  329. help
  330. Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
  331. When the maximum amount of device in the filter is reached, the cache will be refreshed.
  332. config BTDM_CTRL_FULL_SCAN_SUPPORTED
  333. bool "BLE full scan feature supported"
  334. depends on BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
  335. default y
  336. help
  337. The full scan function is mainly used to provide BLE scan performance.
  338. This is required for scenes with high scan performance requirements, such as BLE Mesh scenes.
  339. config BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  340. bool "BLE adv report flow control supported"
  341. depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
  342. default y
  343. help
  344. The function is mainly used to enable flow control for advertising reports. When it is enabled,
  345. advertising reports will be discarded by the controller if the number of unprocessed advertising
  346. reports exceeds the size of BLE adv report flow control.
  347. config BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM
  348. int "BLE adv report flow control number"
  349. depends on BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  350. range 50 1000
  351. default 100
  352. help
  353. The number of unprocessed advertising report that Bluedroid can save.If you set
  354. `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a small value, this may cause adv packets lost.
  355. If you set `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` to a large value, Bluedroid may cache a
  356. lot of adv packets and this may cause system memory run out. For example, if you set
  357. it to 50, the maximum memory consumed by host is 35 * 50 bytes. Please set
  358. `BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM` according to your system free memory and handle adv
  359. packets as fast as possible, otherwise it will cause adv packets lost.
  360. config BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
  361. int "BLE adv lost event threshold value"
  362. depends on BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
  363. range 1 1000
  364. default 20
  365. help
  366. When adv report flow control is enabled, The ADV lost event will be generated when the number
  367. of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
  368. If you set `BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
  369. may cause adv packets lost more.
  370. config BTDM_RESERVE_DRAM
  371. hex
  372. default 0xdb5c if BT_ENABLED
  373. default 0
  374. config BTDM_CTRL_HLI
  375. bool "High level interrupt"
  376. depends on BT_ENABLED
  377. default y
  378. help
  379. Using Level 4 interrupt for Bluetooth.