From 586a4715ad9ab94a5274404bd47300f5093aac10 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Tue, 27 Sep 2022 17:36:00 +0530 Subject: [PATCH] Nimble: Stack support for Connection subrating feature --- components/bt/host/nimble/Kconfig.in | 13 ++++++++ components/bt/host/nimble/nimble | 2 +- .../host/nimble/port/include/esp_nimble_cfg.h | 13 ++++++++ .../nimble/include/nimble/hci_common.h | 33 +++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index 8c174af5c3..6e149a1b6f 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -585,6 +585,19 @@ config BT_NIMBLE_MAX_PERIODIC_ADVERTISER_LIST help Set this option to set the upper limit for number of periodic advertiser list. +menuconfig BT_NIMBLE_53_FEATURE_SUPPORT + bool "Enable BLE 5.3 feature" + depends on BT_NIMBLE_ENABLED && SOC_ESP_NIMBLE_CONTROLLER + help + Enable BLE 5.3 feature + +config BT_NIMBLE_SUBRATE + bool "Connection Subrate" + depends on BT_NIMBLE_53_FEATURE_SUPPORT + help + Enable support for Connection Subrate + + choice BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM prompt "Coexistence: limit on MAX Tx/Rx time for coded-PHY connection" default BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_DIS diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 9ac9b21f72..df2b82880e 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 9ac9b21f722cc63302a22f7244f162ce9d5b038d +Subproject commit df2b82880e7ff25d7ed93ce1fc89d813d00b6810 diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index ca65484ff9..842a234740 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -160,6 +160,19 @@ #ifndef MYNEWT_VAL_BLE_WHITELIST #define MYNEWT_VAL_BLE_WHITELIST (1) #endif + +#ifndef CONFIG_BT_NIMBLE_53_FEATURE_SUPPORT +#define BLE_53_FEATURE_SUPPORT (0) +#else +#define BLE_53_FEATURE_SUPPORT (CONFIG_BT_NIMBLE_53_FEATURE_SUPPORT) +#endif + +#ifndef CONFIG_BT_NIMBLE_SUBRATE +#define MYNEWT_VAL_BLE_CONN_SUBRATING (0) +#else +#define MYNEWT_VAL_BLE_CONN_SUBRATING (CONFIG_BT_NIMBLE_SUBRATE) +#endif + /*** @apache-mynewt-nimble/nimble/controller */ /*** @apache-mynewt-nimble/nimble/controller */ #ifndef MYNEWT_VAL_BLE_CONTROLLER diff --git a/components/bt/porting/nimble/include/nimble/hci_common.h b/components/bt/porting/nimble/include/nimble/hci_common.h index 41e3a3ecae..a77b2018eb 100644 --- a/components/bt/porting/nimble/include/nimble/hci_common.h +++ b/components/bt/porting/nimble/include/nimble/hci_common.h @@ -1068,6 +1068,25 @@ struct ble_hci_le_set_host_feat_cp { uint8_t val; } __attribute__((packed)); +#define BLE_HCI_OCF_LE_SET_DEFAULT_SUBRATE (0x007D) +struct ble_hci_le_set_default_subrate_cp { + uint16_t subrate_min; + uint16_t subrate_max; + uint16_t max_latency; + uint16_t cont_num; + uint16_t supervision_tmo; +} __attribute__((packed)); + +#define BLE_HCI_OCF_LE_SUBRATE_REQ (0x007E) +struct ble_hci_le_subrate_req_cp { + uint16_t conn_handle; + uint16_t subrate_min; + uint16_t subrate_max; + uint16_t max_latency; + uint16_t cont_num; + uint16_t supervision_tmo; +} __attribute__((packed)); + /* --- Vendor specific commands (OGF 0x00FF) */ #define BLE_HCI_OCF_VS_RD_STATIC_ADDR (0x0001) struct ble_hci_vs_rd_static_addr_rp { @@ -1797,6 +1816,18 @@ struct ble_hci_ev_le_subev_biginfo_adv_report { uint8_t encryption; } __attribute__((packed)); +#define BLE_HCI_LE_SUBEV_SUBRATE_CHANGE (0x23) +struct ble_hci_ev_le_subev_subrate_change { + uint8_t subev_code; + uint8_t status; + uint16_t conn_handle; + uint16_t subrate_factor; + uint16_t periph_latency; + uint16_t cont_num; + uint16_t supervision_tmo; +} __attribute__((packed)); + + /* Data buffer overflow event */ #define BLE_HCI_EVENT_ACL_BUF_OVERFLOW (0x01) @@ -1839,6 +1870,7 @@ struct ble_hci_ev_le_subev_biginfo_adv_report { #define BLE_HCI_VER_BCS_5_0 (9) #define BLE_HCI_VER_BCS_5_1 (10) #define BLE_HCI_VER_BCS_5_2 (11) +#define BLE_HCI_VER_BCS_5_3 (12) #define BLE_LMP_VER_BCS_1_0b (0) #define BLE_LMP_VER_BCS_1_1 (1) @@ -1852,6 +1884,7 @@ struct ble_hci_ev_le_subev_biginfo_adv_report { #define BLE_LMP_VER_BCS_5_0 (9) #define BLE_LMP_VER_BCS_5_1 (10) #define BLE_LMP_VER_BCS_5_2 (11) +#define BLE_LMP_VER_BCS_5_3 (12) /* selected HCI and LMP version */ #if MYNEWT_VAL(BLE_VERSION) == 50