Skip to content

Commit

Permalink
Merge branch 'feat/optimize_bt_porting_hci_0628_5.3' into 'release/v5.3'
Browse files Browse the repository at this point in the history
Feat/optimize bt porting hci 0628 5.3

See merge request espressif/esp-idf!32135
  • Loading branch information
Isl2017 committed Jul 25, 2024
2 parents 9fb47d0 + e497c29 commit 0efdd4a
Show file tree
Hide file tree
Showing 47 changed files with 3,358 additions and 1,130 deletions.
59 changes: 42 additions & 17 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ if(CONFIG_BT_ENABLED)
common/btc/include
common/include
porting/mem/
porting/include
)
list(APPEND include_dirs ${common_include_dirs})

Expand Down Expand Up @@ -573,29 +574,51 @@ if(CONFIG_BT_ENABLED)


if(CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT)
list(APPEND srcs
"porting/npl/freertos/src/npl_os_freertos.c"
"porting/mem/os_msys_init.c"
"porting/transport/src/hci_transport.c"
)

if(CONFIG_BT_CONTROLLER_DISABLED)
list(APPEND srcs
"porting/npl/freertos/src/npl_os_freertos.c"
"porting/mem/os_msys_init.c"
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
)

if(CONFIG_BT_CONTROLLER_DISABLED)
elseif(CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
if(CONFIG_BT_NIMBLE_ENABLED)
list(APPEND srcs
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
)
"porting/transport/driver/vhci/hci_driver_nimble.c"
"host/nimble/nimble/nimble/transport/esp_ipc/src/hci_esp_ipc.c"
)
else()
list(APPEND srcs
"porting/transport/driver/vhci/hci_driver_standard.c"
)
endif()
list(APPEND include_dirs
porting/include
porting/npl/freertos/include
porting/transport/include
)

if(CONFIG_BT_LE_HCI_INTERFACE_USE_UART)
elseif(CONFIG_BT_LE_HCI_INTERFACE_USE_UART)
list(APPEND srcs
"porting/transport/uart/hci_uart.c"
)
"porting/transport/driver/common/hci_driver_util.c"
"porting/transport/driver/common/hci_driver_h4.c"
"porting/transport/driver/common/hci_driver_mem.c"
"porting/transport/driver/uart/hci_driver_uart_config.c"
)
if(CONFIG_BT_LE_UART_HCI_DMA_MODE)
list(APPEND srcs
"porting/transport/driver/uart/hci_driver_uart_dma.c"
)
else()
list(APPEND srcs
"porting/transport/driver/uart/hci_driver_uart.c"
)
endif()
endif()
endif()

list(APPEND include_dirs
porting/include
porting/npl/freertos/include
porting/transport/include
)
endif()

if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
list(APPEND include_dirs
Expand All @@ -621,7 +644,6 @@ if(CONFIG_BT_ENABLED)
if(CONFIG_BT_NIMBLE_ENABLED)

list(APPEND include_dirs

host/nimble/nimble/nimble/host/include
host/nimble/nimble/nimble/include
host/nimble/nimble/nimble/host/services/ans/include
Expand Down Expand Up @@ -725,10 +747,12 @@ if(CONFIG_BT_ENABLED)
"host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c"
"host/nimble/port/src/nvs_port.c"
)

list(APPEND include_dirs
host/nimble/nimble/porting/nimble/include
host/nimble/port/include
host/nimble/nimble/nimble/transport/include
host/nimble/nimble/nimble/include
)

if(CONFIG_BT_CONTROLLER_DISABLED)
Expand Down Expand Up @@ -762,6 +786,7 @@ if(CONFIG_BT_ENABLED)
if(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE AND CONFIG_BT_CONTROLLER_ENABLED)
list(APPEND srcs
"host/nimble/esp-hci/src/esp_nimble_hci.c"
"host/nimble/nimble/nimble/transport/esp_ipc_legacy/src/hci_esp_ipc_legacy.c"
)
list(APPEND include_dirs ${nimble_hci_include_dirs})
endif()
Expand Down
89 changes: 81 additions & 8 deletions components/bt/controller/esp32c2/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
menu "HCI Config"

choice BT_LE_HCI_INTERFACE
prompt "Select HCI interface"
prompt "HCI mode"
default BT_LE_HCI_INTERFACE_USE_RAM

config BT_LE_HCI_INTERFACE_USE_RAM
bool "ram"
bool "VHCI"
help
Use RAM as HCI interface
config BT_LE_HCI_INTERFACE_USE_UART
bool "uart"
bool "UART(H4)"
help
Use UART as HCI interface
endchoice
Expand Down Expand Up @@ -73,12 +73,26 @@ menu "HCI Config"
UART_PARITY_ODD
endchoice

config BT_LE_HCI_UART_TASK_STACK_SIZE
int "HCI uart task stack size"
depends on BT_LE_HCI_INTERFACE_USE_UART
default 1000
config BT_LE_HCI_UART_RX_BUFFER_SIZE
int "The size of rx ring buffer memory"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 512
help
The size of rx ring buffer memory

config BT_LE_HCI_UART_TX_BUFFER_SIZE
int "The size of tx ring buffer memory"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 256
help
The size of tx ring buffer memory

config BT_LE_HCI_TRANS_TASK_STACK_SIZE
int "HCI transport task stack size"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 1024
help
Set the size of uart task stack
This configures stack size of hci transport task
endmenu

config BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
Expand Down Expand Up @@ -526,3 +540,62 @@ config BT_LE_ROLE_OBSERVER_ENABLE
default y
help
Enable observer role function.

choice BT_LE_DFT_TX_POWER_LEVEL_DBM
prompt "BLE default Tx power level(dBm)"
default BT_LE_DFT_TX_POWER_LEVEL_P9
help
Specify default Tx power level(dBm).
config BT_LE_DFT_TX_POWER_LEVEL_N24
bool "-24dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N21
bool "-21dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N18
bool "-18dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N15
bool "-15dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N12
bool "-12dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N9
bool "-9dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N6
bool "-6dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N3
bool "-3dBm"
config BT_LE_DFT_TX_POWER_LEVEL_N0
bool "0dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P3
bool "+3dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P6
bool "+6dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P9
bool "+9dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P12
bool "+12dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P15
bool "+15dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P18
bool "+18dBm"
config BT_LE_DFT_TX_POWER_LEVEL_P20
bool "+20dBm"
endchoice

config BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF
int
default -24 if BT_LE_DFT_TX_POWER_LEVEL_N24
default -21 if BT_LE_DFT_TX_POWER_LEVEL_N21
default -18 if BT_LE_DFT_TX_POWER_LEVEL_N18
default -15 if BT_LE_DFT_TX_POWER_LEVEL_N15
default -12 if BT_LE_DFT_TX_POWER_LEVEL_N12
default -9 if BT_LE_DFT_TX_POWER_LEVEL_N9
default -6 if BT_LE_DFT_TX_POWER_LEVEL_N6
default -3 if BT_LE_DFT_TX_POWER_LEVEL_N3
default 0 if BT_LE_DFT_TX_POWER_LEVEL_N0
default 3 if BT_LE_DFT_TX_POWER_LEVEL_P3
default 6 if BT_LE_DFT_TX_POWER_LEVEL_P6
default 9 if BT_LE_DFT_TX_POWER_LEVEL_P9
default 12 if BT_LE_DFT_TX_POWER_LEVEL_P12
default 15 if BT_LE_DFT_TX_POWER_LEVEL_P15
default 18 if BT_LE_DFT_TX_POWER_LEVEL_P18
default 20 if BT_LE_DFT_TX_POWER_LEVEL_P20
default 0
Loading

0 comments on commit 0efdd4a

Please sign in to comment.