mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-11-06 12:32:46 +00:00
nimble/ll: Advertising Coding Selection support
This commit is contained in:
committed by
Andrzej Kaczmarek
parent
8bb24379f7
commit
dc8ba53cf6
@@ -285,6 +285,8 @@ extern STATS_SECT_DECL(ble_ll_stats) ble_ll_stats;
|
||||
#define BLE_LL_FEAT_CONN_SUBRATING (0x0002000000000)
|
||||
#define BLE_LL_FEAT_CONN_SUBRATING_HOST (0x0004000000000)
|
||||
#define BLE_LL_FEAT_CHANNEL_CLASS (0x0008000000000)
|
||||
#define BLE_LL_FEAT_ADV_CODING_SEL (0x0010000000000)
|
||||
#define BLE_LL_FEAT_ADV_CODING_SEL_HOST (0x0020000000000)
|
||||
#define BLE_LL_FEAT_CS (0x0400000000000)
|
||||
#define BLE_LL_FEAT_CS_HOST_SUPPORT (0x0800000000000)
|
||||
#define BLE_LL_FEAT_CS_PCT_QUALITY_IND (0x1000000000000)
|
||||
@@ -298,8 +300,9 @@ extern STATS_SECT_DECL(ble_ll_stats) ble_ll_stats;
|
||||
#define BLE_LL_CONN_CLEAR_FEATURE(connsm, feature) (connsm->conn_features &= ~(feature))
|
||||
|
||||
/* All the features which can be controlled by the Host */
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
#define BLE_LL_HOST_CONTROLLED_FEATURES (BLE_LL_FEAT_CONN_SUBRATING_HOST)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE) | \
|
||||
MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
#define BLE_LL_HOST_CONTROLLED_FEATURES (1)
|
||||
#else
|
||||
#define BLE_LL_HOST_CONTROLLED_FEATURES (0)
|
||||
#endif
|
||||
|
||||
@@ -86,6 +86,17 @@ static int8_t g_ble_ll_tx_power_phy_current;
|
||||
int8_t g_ble_ll_tx_power_compensation;
|
||||
int8_t g_ble_ll_rx_power_compensation;
|
||||
|
||||
#if BLE_LL_HOST_CONTROLLED_FEATURES
|
||||
static const uint64_t g_ble_ll_host_controlled_features =
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
BLE_LL_FEAT_CONN_SUBRATING_HOST |
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
BLE_LL_FEAT_ADV_CODING_SEL_HOST |
|
||||
#endif
|
||||
0;
|
||||
#endif
|
||||
|
||||
/* Supported states */
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_BROADCASTER)
|
||||
#define BLE_LL_S_NCA ((uint64_t)1 << 0)
|
||||
@@ -1491,7 +1502,7 @@ ble_ll_set_host_feat(const uint8_t *cmdbuf, uint8_t len)
|
||||
}
|
||||
|
||||
mask = (uint64_t)1 << (cmd->bit_num);
|
||||
if (!(mask & BLE_LL_HOST_CONTROLLED_FEATURES)) {
|
||||
if (!(mask & g_ble_ll_host_controlled_features)) {
|
||||
return BLE_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -1947,6 +1958,10 @@ ble_ll_init(void)
|
||||
features |= BLE_LL_FEAT_PERIODIC_ADV_ADI;
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
features |= BLE_LL_FEAT_ADV_CODING_SEL;
|
||||
#endif
|
||||
|
||||
lldata->ll_supp_features = features;
|
||||
|
||||
/* Initialize random number generation */
|
||||
|
||||
@@ -84,6 +84,9 @@ struct ble_ll_scan_aux_data {
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
|
||||
int8_t rpa_index;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
uint8_t pri_phy_mode;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define AUX_MEMPOOL_SIZE (OS_MEMPOOL_SIZE( \
|
||||
@@ -216,7 +219,8 @@ ble_ll_scan_aux_need_truncation(struct ble_ll_scan_aux_data *aux)
|
||||
}
|
||||
|
||||
static struct ble_hci_ev *
|
||||
ble_ll_hci_ev_alloc_ext_adv_report_for_aux(struct ble_ll_scan_addr_data *addrd,
|
||||
ble_ll_hci_ev_alloc_ext_adv_report_for_aux(struct ble_mbuf_hdr_rxinfo *rxinfo,
|
||||
struct ble_ll_scan_addr_data *addrd,
|
||||
struct ble_ll_scan_aux_data *aux)
|
||||
{
|
||||
struct ble_hci_ev_le_subev_ext_adv_rpt *hci_subev;
|
||||
@@ -257,6 +261,16 @@ ble_ll_hci_ev_alloc_ext_adv_report_for_aux(struct ble_ll_scan_addr_data *addrd,
|
||||
report->tx_power = 0x7f;
|
||||
report->rssi = 0x7f;
|
||||
report->periodic_itvl = 0;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
if (aux->pri_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
|
||||
report->pri_phy = 0x04;
|
||||
}
|
||||
if (rxinfo->phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
|
||||
report->sec_phy = 0x04;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (addrd->targeta) {
|
||||
report->evt_type |= BLE_HCI_ADV_DIRECT_MASK;
|
||||
report->dir_addr_type = addrd->targeta_type;
|
||||
@@ -326,6 +340,12 @@ ble_ll_hci_ev_update_ext_adv_report_from_aux(struct ble_hci_ev *hci_ev,
|
||||
}
|
||||
report->sec_phy = rxhdr->rxinfo.phy;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
if (rxhdr->rxinfo.phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
|
||||
report->sec_phy = 0x04;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Strip PDU header and ext header, leave only AD */
|
||||
os_mbuf_adj(rxpdu, 3 + eh_len);
|
||||
|
||||
@@ -419,6 +439,12 @@ ble_ll_hci_ev_update_ext_adv_report_from_ext(struct ble_hci_ev *hci_ev,
|
||||
report->periodic_itvl = 0;
|
||||
report->data_len = 0;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
if (rxinfo->phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
|
||||
report->pri_phy = 0x04;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now parse extended header... */
|
||||
|
||||
if (eh_flags & (1 << BLE_LL_EXT_ADV_ADVA_BIT)) {
|
||||
@@ -609,7 +635,7 @@ ble_ll_hci_ev_send_ext_adv_report_for_aux(struct os_mbuf *rxpdu,
|
||||
hci_ev = aux->hci_ev;
|
||||
aux->hci_ev = NULL;
|
||||
} else {
|
||||
hci_ev = ble_ll_hci_ev_alloc_ext_adv_report_for_aux(addrd, aux);
|
||||
hci_ev = ble_ll_hci_ev_alloc_ext_adv_report_for_aux(&rxhdr->rxinfo, addrd, aux);
|
||||
if (!hci_ev) {
|
||||
aux->hci_state = BLE_LL_SCAN_AUX_H_DONE;
|
||||
return -1;
|
||||
@@ -1077,6 +1103,10 @@ ble_ll_scan_aux_rx_isr_end_on_ext(struct ble_ll_scan_sm *scansm,
|
||||
aux->pri_phy = rxinfo->phy;
|
||||
aux->aux_ptr = aux_ptr;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ADV_CODING_SELECTION)
|
||||
aux->pri_phy_mode = rxinfo->phy_mode;
|
||||
#endif
|
||||
|
||||
if (addrd.adva) {
|
||||
memcpy(aux->adva, addrd.adva, 6);
|
||||
aux->adva_type = addrd.adva_type;
|
||||
|
||||
@@ -357,6 +357,13 @@ syscfg.defs:
|
||||
restrictions:
|
||||
- '(BLE_VERSION >= 53) if 1'
|
||||
|
||||
BLE_LL_ADV_CODING_SELECTION:
|
||||
description: >
|
||||
Enables support Advertising Coding Selection.
|
||||
value: 0
|
||||
restrictions:
|
||||
- '(BLE_VERSION >= 54) if 1'
|
||||
|
||||
BLE_LL_PERIODIC_ADV_SYNC_BIGINFO_REPORTS:
|
||||
description: >
|
||||
This option is used to enable/disable support for
|
||||
|
||||
Reference in New Issue
Block a user