Skip to content

Commit c8d2da1

Browse files
committed
esp32c6: add ble support
Brings necessary changes to enable BLE support. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 8502aaf commit c8d2da1

35 files changed

+7466
-66
lines changed

components/bt/porting/transport/include/esp_hci_driver.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,45 +37,8 @@ typedef struct hci_driver_ops {
3737
void (*hci_driver_deinit)(void);
3838
} hci_driver_ops_t;
3939

40-
4140
#if CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
4241
extern hci_driver_ops_t hci_driver_vhci_ops;
4342
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
4443

45-
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
46-
#if CONFIG_BT_LE_UART_HCI_DMA_MODE
47-
extern hci_driver_ops_t hci_driver_uart_dma_ops;
48-
/**
49-
* @brief Reconfigure the UART pins for the HCI driver.
50-
*
51-
* This function changes the UART pin configuration for the HCI driver.
52-
*
53-
* @param tx_pin The pin number for the UART TX (transmit) line.
54-
* @param rx_pin The pin number for the UART RX (receive) line.
55-
* @param cts_pin The pin number for the UART CTS (clear to send) line.
56-
* @param rts_pin The pin number for the UART RTS (request to send) line.
57-
*
58-
* @return int Returns 0 on success, or a negative error code on failure.
59-
*/
60-
int hci_driver_uart_dma_reconfig_pin(int tx_pin, int rx_pin, int cts_pin, int rts_pin);
61-
#define hci_uart_reconfig_pin hci_driver_uart_dma_reconfig_pin
62-
#else
63-
extern hci_driver_ops_t hci_driver_uart_ops;
64-
/**
65-
* @brief Reconfigure the UART pins for the HCI driver.
66-
*
67-
* This function changes the UART pin configuration for the HCI driver.
68-
*
69-
* @param tx_pin The pin number for the UART TX (transmit) line.
70-
* @param rx_pin The pin number for the UART RX (receive) line.
71-
* @param cts_pin The pin number for the UART CTS (clear to send) line.
72-
* @param rts_pin The pin number for the UART RTS (request to send) line.
73-
*
74-
* @return int Returns 0 on success, or a negative error code on failure.
75-
*/
76-
int hci_driver_uart_reconfig_pin(int tx_pin, int rx_pin, int cts_pin, int rts_pin);
77-
#define hci_uart_reconfig_pin hci_driver_uart_reconfig_pin
78-
#endif // CONFIG_BT_LE_UART_HCI_DMA_MODE
79-
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
80-
8144
#endif // H_ESP_HCI_DRIVER_

components/bt/porting/transport/src/hci_transport.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,6 @@ hci_transport_init(uint8_t hci_transport_mode)
131131
ops = &hci_driver_vhci_ops;
132132
break;
133133
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
134-
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
135-
#if CONFIG_BT_LE_UART_HCI_DMA_MODE
136-
case HCI_TRANSPORT_UART_UHCI:
137-
ops = &hci_driver_uart_dma_ops;
138-
break;
139-
#else
140-
case HCI_TRANSPORT_UART_NO_DMA:
141-
ops = &hci_driver_uart_ops;
142-
break;
143-
#endif // CONFIG_BT_LE_UART_HCI_DMA_MODE
144-
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
145134
default:
146135
assert(0);
147136
}

zephyr/esp32c6/CMakeLists.txt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ if(CONFIG_SOC_SERIES_ESP32C6)
1414

1515
zephyr_include_directories(
1616
include
17-
../esp_shared/include
18-
../esp_shared/components/include
17+
include/bt
1918
../port/include
2019
../common/include
2120

@@ -112,6 +111,10 @@ if(CONFIG_SOC_SERIES_ESP32C6)
112111
../../components/ulp/lp_core/lp_core/include
113112
../../components/ulp/lp_core/shared/include
114113
../../components/ulp/ulp_common/include
114+
115+
src/bt/porting/include
116+
src/bt/porting/npl/zephyr/include
117+
src/bt/porting/transport/include
115118
)
116119

117120
zephyr_link_libraries(
@@ -232,6 +235,7 @@ if(CONFIG_SOC_SERIES_ESP32C6)
232235
../../components/esp_hw_support/adc_share_hw_ctrl.c
233236
../../components/esp_hw_support/cpu.c
234237
../../components/esp_hw_support/clk_ctrl_os.c
238+
../../components/esp_hw_support/hw_random.c
235239
../../components/esp_hw_support/esp_clk.c
236240
../../components/esp_hw_support/mac_addr.c
237241
../../components/esp_hw_support/modem_clock.c
@@ -436,12 +440,32 @@ if(CONFIG_SOC_SERIES_ESP32C6)
436440

437441
## BT definitions
438442
if (CONFIG_BT)
439-
zephyr_sources(src/bt/esp_bt_adapter.c)
443+
444+
zephyr_sources(
445+
../../components/esp_phy/src/btbb_init.c
446+
src/bt/esp_bt_adapter.c
447+
src/bt/esp_ble_adapter.c
448+
src/bt/porting/npl/zephyr/src/npl_os_zephyr.c
449+
src/bt/porting/mem/bt_osi_mem.c
450+
src/bt/porting/mem/os_msys_init.c
451+
src/bt/porting/transport/src/hci_transport.c
452+
src/bt/porting/transport/driver/vhci/hci_driver_standard.c
453+
)
454+
440455
zephyr_compile_definitions(CONFIG_BT_ENABLED)
456+
zephyr_compile_definitions(CONFIG_BT_CONTROLLER_ENABLED)
441457

442-
zephyr_link_libraries(
458+
zephyr_sources_ifdef(
459+
CONFIG_BUILD_ONLY_NO_BLOBS
460+
../port/bluetooth/bt_stubs.c
461+
../port/phy/phy_stubs.c
462+
)
463+
464+
zephyr_link_libraries_ifndef(
465+
CONFIG_BUILD_ONLY_NO_BLOBS
443466
## ble
444467
btbb
468+
ble_app
445469
-L${CMAKE_CURRENT_SOURCE_DIR}/../blobs/lib/${CONFIG_SOC_SERIES}
446470
)
447471

zephyr/esp32c6/include/bt/ble_priv.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
int ble_stack_initEnv(void);
7+
8+
void ble_stack_deinitEnv(void);
9+
10+
int ble_stack_enable(void);
11+
12+
void ble_stack_disable(void);

0 commit comments

Comments
 (0)