Merge branch 'nimble_esp32c3_support' into 'master'

ESP32C3 NimBLE support

See merge request espressif/esp-idf!12046
This commit is contained in:
Jiang Jiang Jian 2021-01-20 13:57:38 +08:00
commit 53e1a7f661
5 changed files with 96 additions and 7 deletions

View File

@ -21,6 +21,12 @@ menu "Bluetooth"
depends on BT_ENABLED && IDF_TARGET_ESP32S3
default y
config BT_SOC_SUPPORT_5_0
bool
depends on BT_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3)
default y if BT_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3)
default n
menu "Bluetooth controller(ESP32 Dual Mode Bluetooth)"
visible if BT_CTRL_ESP32

View File

@ -219,7 +219,7 @@ config BT_NIMBLE_SVC_GAP_APPEARANCE
config BT_NIMBLE_ACL_BUF_COUNT
int "ACL Buffer count"
depends on BT_NIMBLE_ENABLED
default 12
default 20
help
The number of ACL data buffers.
@ -234,9 +234,12 @@ config BT_NIMBLE_ACL_BUF_SIZE
config BT_NIMBLE_HCI_EVT_BUF_SIZE
int "HCI Event Buffer size"
depends on BT_NIMBLE_ENABLED
default 257 if BT_NIMBLE_EXT_ADV
default 70
help
This is the size of each HCI event buffer in bytes
This is the size of each HCI event buffer in bytes. In case of
extended advertising, packets can be fragmented. 257 bytes is the
maximum size of a packet.
config BT_NIMBLE_HCI_EVT_HI_BUF_COUNT
int "High Priority HCI Event Buffer count"
@ -271,6 +274,7 @@ config BT_NIMBLE_MSYS1_BLOCK_COUNT
config BT_NIMBLE_HS_FLOW_CTRL
bool "Enable Host Flow control"
depends on BT_NIMBLE_ENABLED
default n if BT_SOC_SUPPORT_5_0
default y
help
Enable Host Flow control
@ -418,3 +422,60 @@ config BT_NIMBLE_HS_STOP_TIMEOUT_MS
depends on BT_NIMBLE_ENABLED
help
BLE Host stop procedure timeout in milliseconds.
config BT_NIMBLE_HOST_BASED_PRIVACY
bool "Enable host based privacy for random address."
default n
depends on BT_NIMBLE_ENABLED && !IDF_TARGET_ESP32
help
Use this option to do host based Random Private Address resolution.
If this option is disabled then controller based privacy is used.
config BT_NIMBLE_EXT_ADV
bool "Enable extended advertising."
default y if BT_SOC_SUPPORT_5_0
default n
depends on BT_NIMBLE_ENABLED && BT_SOC_SUPPORT_5_0
help
Enable this option to do extended advertising. Extended advertising
will be supported from BLE 5.0 onwards.
config BT_NIMBLE_MAX_EXT_ADV_INSTANCES
int "Maximum number of extended advertising instances."
range 0 4
default 1 if BT_NIMBLE_EXT_ADV
default 0
depends on BT_NIMBLE_EXT_ADV
help
Change this option to set maximum number of extended advertising
instances. Minimum there is always one instance of
advertising. Enter how many more advertising instances you
want.
config BT_NIMBLE_MAX_EXT_ADV_DATA_LEN
int "Maximum length of the advertising data."
range 0 1650
default 1650 if BT_NIMBLE_EXT_ADV
default 0
depends on BT_NIMBLE_EXT_ADV
help
Defines size of extended advertising data. Size should not increase
1650.
config BT_NIMBLE_ENABLE_PERIODIC_ADV
bool "Enable periodic advertisement."
default y
depends on BT_NIMBLE_EXT_ADV
help
Enable this option to start periodic advertisement.
config BT_NIMBLE_MAX_PERIODIC_SYNCS
int "Maximum number of periodic advertising syncs."
default 1 if BT_NIMBLE_ENABLE_PERIODIC_ADV
default 0
depends on BT_NIMBLE_ENABLE_PERIODIC_ADV
range 1 8
help
Set this option to set the upper limit for number of periodic sync
connections. This should be less than maximum connections allowed by
controller.

View File

@ -213,7 +213,9 @@ void ble_hci_trans_buf_free(uint8_t *buf)
*/
int ble_hci_trans_set_acl_free_cb(os_mempool_put_fn *cb, void *arg)
{
return BLE_ERR_UNSUPPORTED;
ble_hci_acl_pool.mpe_put_cb = cb;
ble_hci_acl_pool.mpe_put_arg = arg;
return 0;
}
int ble_hci_trans_reset(void)

View File

@ -47,11 +47,15 @@
/*** nimble */
#ifndef MYNEWT_VAL_BLE_EXT_ADV
#define MYNEWT_VAL_BLE_EXT_ADV (0)
#define MYNEWT_VAL_BLE_EXT_ADV (CONFIG_BT_NIMBLE_EXT_ADV)
#endif
#ifndef MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE
#define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (31)
#ifdef CONFIG_BT_NIMBLE_EXT_ADV
#define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN)
#else
#define MYNEWT_VAL_BLE_EXT_ADV_MAX_SIZE (0)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_MAX_CONNECTIONS
@ -59,12 +63,20 @@
#endif
#ifndef MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES
#ifdef CONFIG_BT_NIMBLE_EXT_ADV
#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES)
#else
#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (0)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS
#ifdef CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS)
#else
#define MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS (0)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_ROLE_BROADCASTER
#ifdef CONFIG_BT_NIMBLE_ROLE_BROADCASTER
@ -276,8 +288,12 @@
#endif
#ifndef MYNEWT_VAL_BLE_PERIODIC_ADV
#ifdef CONFIG_BT_NIMBLE_EXT_ADV
#define MYNEWT_VAL_BLE_PERIODIC_ADV (CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV)
#else
#define MYNEWT_VAL_BLE_PERIODIC_ADV (0)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER
#define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (0)
@ -575,8 +591,12 @@
#define MYNEWT_VAL_BLE_MONITOR_UART_DEV ("uart0")
#endif
#ifndef MYNEWT_VAL_BLE_HOST_BASED_PRIVACY
#if CONFIG_IDF_TARGET_ESP32
#define MYNEWT_VAL_BLE_HOST_BASED_PRIVACY (1)
#else
#ifndef MYNEWT_VAL_BLE_HOST_BASED_PRIVACY
#define MYNEWT_VAL_BLE_HOST_BASED_PRIVACY (CONFIG_BT_NIMBLE_HOST_BASED_PRIVACY)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_RPA_TIMEOUT

View File

@ -361,11 +361,11 @@ app_main(void)
ble_hs_cfg.sm_sc = 1;
#else
ble_hs_cfg.sm_sc = 0;
#endif
#ifdef CONFIG_EXAMPLE_BONDING
ble_hs_cfg.sm_our_key_dist = 1;
ble_hs_cfg.sm_their_key_dist = 1;
#endif
#endif
rc = gatt_svr_init();