mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(nimble): Nimble Host only mode over uart
This commit is contained in:
committed by
Roshan Bangar
parent
97cda1a732
commit
51efb20516
@@ -53,7 +53,9 @@ set(ble_mesh_include_dirs
|
||||
|
||||
set(bluedroid_include_dirs host/bluedroid/api/include/api)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_ENABLED OR CONFIG_IDF_DOC_BUILD)
|
||||
set(nimble_hci_include_dirs host/nimble/esp-hci/include)
|
||||
endif()
|
||||
|
||||
if(CONFIG_IDF_DOC_BUILD)
|
||||
list(APPEND include_dirs
|
||||
@@ -567,6 +569,11 @@ if(CONFIG_BT_ENABLED)
|
||||
"porting/nimble/src/os_msys_init.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
|
||||
)
|
||||
endif()
|
||||
list(APPEND include_dirs
|
||||
porting/include
|
||||
porting/nimble/include
|
||||
@@ -697,6 +704,13 @@ if(CONFIG_BT_ENABLED)
|
||||
"host/nimble/nimble/nimble/host/src/ble_gattc_cache_conn.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED AND CONFIG_BT_NIMBLE_TRANSPORT_UART)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/nimble/transport/uart_ll/src/hci_uart.c"
|
||||
"host/nimble/nimble/nimble/transport/common/hci_h4/src/hci_h4.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/nimble_port.c"
|
||||
"host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c"
|
||||
@@ -709,6 +723,12 @@ if(CONFIG_BT_ENABLED)
|
||||
host/nimble/nimble/nimble/transport/include
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
list(APPEND include_dirs
|
||||
host/nimble/nimble/nimble/transport/common/hci_h4/include
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/endian.c"
|
||||
@@ -718,6 +738,13 @@ if(CONFIG_BT_ENABLED)
|
||||
"host/nimble/nimble/porting/nimble/src/os_msys_init.c"
|
||||
"host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED AND CONFIG_BT_NIMBLE_TRANSPORT_UART)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND include_dirs
|
||||
host/nimble/nimble/porting/npl/freertos/include
|
||||
host/nimble/nimble/porting/nimble/include
|
||||
@@ -725,7 +752,7 @@ if(CONFIG_BT_ENABLED)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE)
|
||||
if(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
list(APPEND srcs
|
||||
"host/nimble/esp-hci/src/esp_nimble_hci.c"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,6 @@ menu "Bluetooth"
|
||||
|
||||
config BT_NIMBLE_ENABLED
|
||||
bool "NimBLE - BLE only"
|
||||
depends on BT_CONTROLLER_ENABLED
|
||||
help
|
||||
This option is recommended for BLE only usecases to save on memory
|
||||
|
||||
|
||||
@@ -926,3 +926,26 @@ config BT_NIMBLE_HOST_QUEUE_CONG_CHECK
|
||||
When scanning and scan duplicate is not enabled, if there are a lot of adv packets around
|
||||
or application layer handling adv packets is slow, it will cause the controller memory
|
||||
to run out. if enabled, adv packets will be lost when host queue is congested.
|
||||
|
||||
menu "Host-controller Transport"
|
||||
config BT_NIMBLE_TRANSPORT_UART
|
||||
bool "Enable Uart Transport"
|
||||
default y
|
||||
depends on BT_CONTROLLER_DISABLED
|
||||
help
|
||||
Use UART transport
|
||||
|
||||
config BT_NIMBLE_UART_RX_PIN
|
||||
int "Rx pin for Nimble Uart"
|
||||
depends on BT_CONTROLLER_DISABLED && BT_NIMBLE_TRANSPORT_UART
|
||||
default 5
|
||||
help
|
||||
Rx pin for Nimble Transport
|
||||
|
||||
config BT_NIMBLE_UART_TX_PIN
|
||||
int "Tx pin for Nimble Uart"
|
||||
depends on BT_CONTROLLER_DISABLED && BT_NIMBLE_TRANSPORT_UART
|
||||
default 4
|
||||
help
|
||||
Tx pin for Nimble Transport
|
||||
endmenu
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
#include "esp_nimble_hci.h"
|
||||
#include "esp_nimble_mem.h"
|
||||
#include "bt_osi_mem.h"
|
||||
#if CONFIG_BT_CONTROLLER_ENABLED
|
||||
#include "esp_bt.h"
|
||||
#endif
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_compiler.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: 62d54eb2fa...83f6028a2e
@@ -1792,4 +1792,40 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_CONTROLLER_DISABLED
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_PORT
|
||||
/* #ifdef CONFIG_BT_NIMBLE_TRANSPORT_UART_PORT */
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_PORT /* CONFIG_BT_NIMBLE_TRANSPORT_UART_PORT */ (1)
|
||||
/* #endif */
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY_none
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY_none MYNEWT_VAL_BLE_HCI_UART_PARITY
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY__odd
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY__odd (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY__even
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_PARITY__even (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_FLOW_CONTROL__rtscts
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_FLOW_CONTROL__rtscts (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_BAUDRATE
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_BAUDRATE (921600)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_DATA_BITS
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_DATA_BITS (3)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_UART_STOP_BITS
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_UART_STOP_BITS (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
|
||||
struct os_mempool;
|
||||
struct os_mbuf_pool;
|
||||
|
||||
@@ -63,7 +63,7 @@ extern "C" {
|
||||
typedef int ble_hci_trans_rx_cmd_fn(uint8_t *cmd, void *arg);
|
||||
typedef int ble_hci_trans_rx_acl_fn(struct os_mbuf *om, void *arg);
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
#define ble_transport_alloc_cmd() ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD)
|
||||
#define ble_transport_alloc_event(X) ble_hci_trans_buf_alloc(X ? BLE_HCI_TRANS_BUF_EVT_LO : BLE_HCI_TRANS_BUF_EVT_HI)
|
||||
#define ble_transport_free ble_hci_trans_buf_free
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#define NIMBLE_HS_STACK_SIZE CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
#define NIMBLE_LL_STACK_SIZE CONFIG_BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
void r_put_le16(void *buf, uint16_t x);
|
||||
#define put_le16 r_put_le16
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ _os_mbuf_trailingspace(struct os_mbuf *om)
|
||||
#define OS_MBUF_TRAILINGSPACE(__om) _os_mbuf_trailingspace(__om)
|
||||
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
/**
|
||||
* Initializes an mqueue. An mqueue is a queue of mbufs that ties to a
|
||||
* particular task's event queue. Mqueues form a helper API around a common
|
||||
|
||||
@@ -163,7 +163,7 @@ typedef __uint128_t os_membuf_t;
|
||||
#define OS_MEMPOOL_BYTES(n,blksize) \
|
||||
(sizeof (os_membuf_t) * OS_MEMPOOL_SIZE((n), (blksize)))
|
||||
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER
|
||||
#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
|
||||
/**
|
||||
* Initialize a memory pool.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user