mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-06 09:09:59 +00:00
nimble/controller: Sort out flag configuration for BT5
In order to enable extended advertising feature from Bluetooth 5 MYNEWT_VAL BLE_LL_CFG_FEAT_LL_EXT_ADV shall be set to 1 With this patch controller succesfull builds with and without this flag X-Original-Commit: 926b9598ec7c3ff8b751f2aed662bbb838e5c522
This commit is contained in:
@@ -315,7 +315,9 @@ struct ble_ll_conn_sm
|
||||
struct ble_ll_conn_params conn_cp;
|
||||
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct hci_ext_create_conn initial_params;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
#define BLE_SCAN_RSP_DATA_MAX_LEN (31)
|
||||
#define BLE_SCAN_MAX_PKT_LEN (37)
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
#define BLE_EXT_SCAN_MAX_PKT_LEN (256)
|
||||
|
||||
/* For Bluetooth 5.0 we need state machine for two PHYs*/
|
||||
@@ -138,7 +138,7 @@ int ble_ll_scan_set_scan_params(uint8_t *cmd);
|
||||
/* Turn scanning on/off */
|
||||
int ble_ll_scan_set_enable(uint8_t *cmd, uint8_t ext);
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
int ble_ll_set_ext_scan_params(uint8_t *cmd);
|
||||
#endif
|
||||
|
||||
@@ -199,12 +199,12 @@ int ble_ll_scan_adv_decode_addr(uint8_t pdu_type, uint8_t *rxbuf,
|
||||
uint8_t **inita, uint8_t *inita_is_rpa,
|
||||
int *ext_mode);
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
/* Get aux ptr from ext advertising */
|
||||
int ble_ll_scan_get_aux_data(struct ble_ll_scan_sm *scansm,
|
||||
struct ble_mbuf_hdr *ble_hdr, uint8_t *rxbuf,
|
||||
struct ble_ll_aux_data **aux_data);
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
/* Initialize the extended scanner when we start initiating */
|
||||
struct hci_ext_create_conn;
|
||||
int ble_ll_scan_ext_initiator_start(struct hci_ext_create_conn *hcc,
|
||||
|
||||
@@ -138,7 +138,7 @@ int ble_ll_sched_conn_reschedule(struct ble_ll_conn_sm * connsm);
|
||||
*/
|
||||
int ble_ll_sched_next_time(uint32_t *next_event_time);
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_ll_scan_sm;
|
||||
struct ble_ll_aux_data;
|
||||
int ble_ll_sched_aux_scan(struct ble_mbuf_hdr *ble_hdr,
|
||||
|
||||
@@ -789,6 +789,7 @@ ble_ll_conn_wfr_timer_exp(void)
|
||||
void
|
||||
ble_ll_conn_init_wrf_timer_exp(void)
|
||||
{
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_ll_conn_sm *connsm;
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
|
||||
@@ -804,6 +805,7 @@ ble_ll_conn_init_wrf_timer_exp(void)
|
||||
STATS_INC(ble_ll_stats, aux_missed_adv);
|
||||
ble_ll_event_send(&scansm->scan_sched_ev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Callback for slave when it transmits a data pdu and the connection event
|
||||
@@ -1728,7 +1730,7 @@ ble_ll_conn_master_init(struct ble_ll_conn_sm *connsm,
|
||||
}
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
|
||||
void
|
||||
ble_ll_conn_ext_master_init(struct ble_ll_conn_sm *connsm,
|
||||
@@ -1750,7 +1752,7 @@ ble_ll_conn_ext_master_init(struct ble_ll_conn_sm *connsm,
|
||||
static void
|
||||
ble_ll_conn_set_phy(struct ble_ll_conn_sm *connsm, int tx_phy ,int rx_phy)
|
||||
{
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
|
||||
struct ble_ll_conn_phy_data *phy_data = &connsm->phy_data;
|
||||
|
||||
phy_data->rx_phy_mode = ble_ll_phy_to_phy_mode(rx_phy,
|
||||
@@ -1761,7 +1763,6 @@ ble_ll_conn_set_phy(struct ble_ll_conn_sm *connsm, int tx_phy ,int rx_phy)
|
||||
BLE_HCI_LE_PHY_CODED_ANY);
|
||||
phy_data->cur_tx_phy = tx_phy;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2805,11 +2806,13 @@ ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf, struct ble_mbuf_hdr *ble
|
||||
return;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (pdu_type == BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
|
||||
/* Do nothing, we need AUX_CONN_RSP*/
|
||||
ble_ll_scan_aux_data_free(ble_hdr->rxinfo.aux_data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we have sent a connect request, we need to enter CONNECTION state */
|
||||
if (connsm && CONN_F_CONN_REQ_TXD(connsm)) {
|
||||
@@ -2861,7 +2864,7 @@ ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf, struct ble_mbuf_hdr *ble
|
||||
ble_ll_conn_set_csa(connsm, rxbuf[0] & BLE_ADV_PDU_HDR_CHSEL_MASK);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
/* Lets take last used phy */
|
||||
ble_ll_conn_set_phy(connsm, ble_hdr->rxinfo.phy, ble_hdr->rxinfo.phy);
|
||||
#endif
|
||||
@@ -2902,17 +2905,19 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
uint8_t conn_req_end_trans;
|
||||
struct os_mbuf *rxpdu;
|
||||
struct ble_ll_conn_sm *connsm;
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
|
||||
struct ble_ll_resolv_entry *rl;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
uint8_t phy;
|
||||
struct ble_ll_aux_data *aux_data = NULL;
|
||||
#endif
|
||||
int ext_adv_mode = -1;
|
||||
|
||||
/* Get connection state machine to use if connection to be established */
|
||||
connsm = g_ble_ll_conn_create_sm;
|
||||
scansm = connsm->scansm;
|
||||
|
||||
/*
|
||||
* We have to restart receive if we cant hand up pdu. We return 0 so that
|
||||
* the phy does not get disabled.
|
||||
@@ -2927,7 +2932,9 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
|
||||
inita_is_rpa = 0;
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
scansm = connsm->scansm;
|
||||
|
||||
if (pdu_type == BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
|
||||
if (!scansm) {
|
||||
goto init_rx_isr_exit;
|
||||
@@ -2956,6 +2963,8 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
switch (pdu_type) {
|
||||
case BLE_ADV_PDU_TYPE_ADV_IND:
|
||||
break;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
|
||||
/* Lets see if we have addr. If not we need to wait for aux ptr*/
|
||||
if (!adv_addr || !(ext_adv_mode & BLE_LL_EXT_ADV_MODE_CONN)) {
|
||||
@@ -2982,6 +2991,7 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
}
|
||||
/* if there is direct address lets fall down and check it.*/
|
||||
// no break
|
||||
#endif
|
||||
case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
|
||||
/*
|
||||
* If we expect our address to be private and the INITA is not,
|
||||
@@ -3072,11 +3082,13 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
}
|
||||
}
|
||||
|
||||
/* For CONNECT_IND we don't go into RX state */
|
||||
conn_req_end_trans = BLE_PHY_TRANSITION_NONE;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
/* Check if we should send AUX_CONNECT_REQ and wait for AUX_CONNECT_RSP */
|
||||
if (ble_hdr->rxinfo.channel < BLE_PHY_NUM_DATA_CHANS) {
|
||||
conn_req_end_trans = BLE_PHY_TRANSITION_TX_RX;
|
||||
} else {
|
||||
conn_req_end_trans = BLE_PHY_TRANSITION_NONE;
|
||||
}
|
||||
|
||||
if (connsm->scansm->ext_scanning) {
|
||||
@@ -3091,6 +3103,7 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
|
||||
phy, BLE_HCI_LE_PHY_CODED_ANY);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create the connection request */
|
||||
ble_ll_conn_req_pdu_make(connsm, ble_hdr->rxinfo.channel);
|
||||
|
||||
@@ -518,7 +518,7 @@ ble_ll_conn_create(uint8_t *cmdbuf)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
|
||||
int
|
||||
ble_ll_ext_conn_create(uint8_t *cmdbuf)
|
||||
|
||||
@@ -96,7 +96,7 @@ void ble_ll_conn_enqueue_pkt(struct ble_ll_conn_sm *connsm, struct os_mbuf *om,
|
||||
struct ble_ll_conn_sm *ble_ll_conn_sm_get(void);
|
||||
void ble_ll_conn_master_init(struct ble_ll_conn_sm *connsm,
|
||||
struct hci_create_conn *hcc);
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
void ble_ll_conn_ext_master_init(struct ble_ll_conn_sm *connsm,
|
||||
struct hci_ext_create_conn *hcc);
|
||||
|
||||
@@ -175,7 +175,7 @@ int ble_ll_conn_hci_le_rd_phy(uint8_t *cmdbuf, uint8_t *rsp, uint8_t *rsplen);
|
||||
int ble_ll_conn_hci_le_set_phy(uint8_t *cmdbuf);
|
||||
int ble_ll_conn_chk_phy_upd_start(struct ble_ll_conn_sm *connsm);
|
||||
void ble_ll_conn_req_pdu_make(struct ble_ll_conn_sm *connsm, uint8_t chan);
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
int ble_ll_ext_conn_create(uint8_t *cmdbuf);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -838,7 +838,7 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
|
||||
rc = ble_ll_resolve_set_priv_mode(cmdbuf);
|
||||
break;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
case BLE_HCI_OCF_LE_SET_EXT_SCAN_PARAM:
|
||||
rc = ble_ll_set_ext_scan_params(cmdbuf);
|
||||
break;
|
||||
|
||||
@@ -136,6 +136,7 @@ static uint8_t g_ble_ll_scan_num_dup_advs;
|
||||
struct ble_ll_scan_advertisers
|
||||
g_ble_ll_scan_dup_advs[MYNEWT_VAL(BLE_LL_NUM_SCAN_DUP_ADVS)];
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
/*TODO Make it MYNEWT_VAL*/
|
||||
#define OUTSTANDING_AUX 10
|
||||
|
||||
@@ -197,6 +198,7 @@ ble_ll_scan_ext_adv_init(struct ble_ll_aux_data **aux_data)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* See Vol 6 Part B Section 4.4.3.2. Active scanning backoff */
|
||||
static void
|
||||
@@ -480,7 +482,7 @@ ble_ll_scan_add_scan_rsp_adv(uint8_t *addr, uint8_t txadd)
|
||||
return;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
|
||||
static struct ble_ll_ext_adv *
|
||||
ble_ll_scan_init_ext_adv(void)
|
||||
@@ -686,7 +688,7 @@ ble_ll_scan_send_adv_report(uint8_t pdu_type, uint8_t txadd, uint8_t *rxbuf,
|
||||
adv_addr = rxbuf + BLE_LL_PDU_HDR_LEN;
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (scansm->ext_scanning) {
|
||||
rc = ble_ll_hci_send_legacy_ext_adv_report(subev, evtype,
|
||||
addr_type, adv_addr,
|
||||
@@ -785,7 +787,7 @@ ble_ll_get_chan_to_scan(struct ble_ll_scan_sm *scansm, uint8_t *chan,
|
||||
int *phy)
|
||||
{
|
||||
struct ble_ll_scan_params *scanphy = &scansm->phy_data[scansm->cur_phy];
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_ll_aux_data *aux_data = scansm->cur_aux_data;
|
||||
|
||||
if (!scansm->ext_scanning || !aux_data || !aux_data->scanning) {
|
||||
@@ -995,12 +997,14 @@ ble_ll_scan_sm_stop(int chk_disable)
|
||||
/* Disable scanning state machine */
|
||||
scansm->scan_enabled = 0;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
if (scansm->cur_aux_data) {
|
||||
ble_ll_scan_aux_data_free(scansm->cur_aux_data);
|
||||
scansm->cur_aux_data = NULL;
|
||||
}
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
#endif
|
||||
|
||||
/* Count # of times stopped */
|
||||
STATS_INC(ble_ll_stats, scan_stops);
|
||||
@@ -1073,6 +1077,7 @@ ble_ll_scan_sm_start(struct ble_ll_scan_sm *scansm)
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
static void
|
||||
ble_ll_scan_switch_phy(struct ble_ll_scan_sm *scansm)
|
||||
{
|
||||
@@ -1138,6 +1143,7 @@ ble_ll_scan_start_next_phy(struct ble_ll_scan_sm *scansm,
|
||||
|
||||
return next_event_time;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called to process the scanning OS event which was posted to the LL task
|
||||
@@ -1294,7 +1300,7 @@ ble_ll_scan_event_proc(struct os_event *ev)
|
||||
#endif
|
||||
ble_ll_scan_start(scansm);
|
||||
} else {
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
next_event_time = ble_ll_scan_start_next_phy(scansm, next_event_time);
|
||||
#endif
|
||||
}
|
||||
@@ -1372,7 +1378,7 @@ ble_ll_scan_rx_isr_start(uint8_t pdu_type, uint16_t *rxflags)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
static int
|
||||
ble_ll_ext_adv_phy_mode_to_local_phy(uint8_t adv_phy_mode)
|
||||
{
|
||||
@@ -1679,7 +1685,7 @@ ble_ll_scan_adv_decode_addr(uint8_t pdu_type, uint8_t *rxbuf,
|
||||
uint8_t **inita, uint8_t *inita_is_rpa,
|
||||
int *ext_mode)
|
||||
{
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
uint8_t inita_type;
|
||||
#endif
|
||||
|
||||
@@ -1707,7 +1713,7 @@ ble_ll_scan_adv_decode_addr(uint8_t pdu_type, uint8_t *rxbuf,
|
||||
}
|
||||
|
||||
/* Extended advertising */
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (ble_ll_scan_get_addr_from_ext_adv(rxbuf, ble_hdr, addr, addr_type,
|
||||
inita, &inita_type, ext_mode)) {
|
||||
return -1;
|
||||
@@ -1748,9 +1754,9 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
|
||||
struct ble_mbuf_hdr *ble_hdr;
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
struct ble_ll_scan_params *scanphy;
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
struct ble_ll_aux_data *aux_data = NULL;
|
||||
int ext_adv_mode = -1;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_ll_aux_data *aux_data = NULL;
|
||||
uint8_t phy_mode;
|
||||
#endif
|
||||
|
||||
@@ -1782,7 +1788,7 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
|
||||
rxbuf = rxpdu->om_data;
|
||||
pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK;
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (pdu_type == BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
|
||||
if (!scansm->ext_scanning) {
|
||||
goto scan_rx_isr_exit;
|
||||
@@ -1818,6 +1824,7 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
|
||||
/* Determine if request may be sent and if whitelist needs to be checked */
|
||||
chk_send_req = 0;
|
||||
switch (pdu_type) {
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
case BLE_ADV_PDU_TYPE_ADV_EXT_IND:
|
||||
|
||||
ble_hdr->rxinfo.aux_data = scansm->cur_aux_data;
|
||||
@@ -1834,6 +1841,7 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
|
||||
}
|
||||
chk_wl = 1;
|
||||
break;
|
||||
#endif
|
||||
case BLE_ADV_PDU_TYPE_ADV_IND:
|
||||
case BLE_ADV_PDU_TYPE_ADV_SCAN_IND:
|
||||
if (scanphy->scan_type == BLE_SCAN_TYPE_ACTIVE) {
|
||||
@@ -1901,13 +1909,14 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
|
||||
/* We want to send a request. See if backoff allows us */
|
||||
--scansm->backoff_count;
|
||||
if (scansm->backoff_count == 0) {
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
phy_mode = ble_ll_phy_to_phy_mode(ble_hdr->rxinfo.phy,
|
||||
BLE_HCI_LE_PHY_CODED_ANY);
|
||||
if (ble_ll_scan_has_enought_time_for_scan(ble_hdr->rxinfo.channel,
|
||||
phy_mode)) {
|
||||
goto scan_rx_isr_exit;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* XXX: TODO assume we are on correct phy */
|
||||
ble_ll_scan_req_pdu_make(scansm, adv_addr, addr_type);
|
||||
rc = ble_phy_tx(scansm->scan_req_pdu, BLE_PHY_TRANSITION_TX_RX);
|
||||
@@ -1986,7 +1995,7 @@ ble_ll_scan_wfr_timer_exp(void)
|
||||
ble_ll_scan_req_backoff(scansm, 0);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (scansm->cur_aux_data) {
|
||||
ble_ll_scan_aux_data_free(scansm->cur_aux_data);
|
||||
scansm->cur_aux_data = NULL;
|
||||
@@ -1998,7 +2007,7 @@ ble_ll_scan_wfr_timer_exp(void)
|
||||
ble_phy_restart_rx();
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
void
|
||||
ble_ll_scan_aux_data_free(struct ble_ll_aux_data *aux_scan)
|
||||
{
|
||||
@@ -2077,7 +2086,7 @@ ble_ll_scan_rx_pkt_in(uint8_t ptype, uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
|
||||
|
||||
/* TODO ADD FILTER POLICY */
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (ptype == BLE_ADV_PDU_TYPE_ADV_EXT_IND) {
|
||||
if (!scansm->ext_scanning) {
|
||||
goto scan_continue;
|
||||
@@ -2243,7 +2252,7 @@ ble_ll_scan_set_scan_params(uint8_t *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
static int
|
||||
ble_ll_check_scan_params(uint8_t type, uint16_t itvl, uint16_t window)
|
||||
{
|
||||
@@ -2496,7 +2505,7 @@ ble_ll_scan_initiator_start(struct hci_create_conn *hcc)
|
||||
return ble_ll_scan_sm_start(scansm);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
int
|
||||
ble_ll_scan_ext_initiator_start(struct hci_ext_create_conn *hcc,
|
||||
struct ble_ll_scan_sm **sm)
|
||||
@@ -2675,7 +2684,9 @@ ble_ll_scan_init(void)
|
||||
struct ble_ll_scan_sm *scansm;
|
||||
struct ble_ll_scan_params *scanp;
|
||||
int i;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
os_error_t err;
|
||||
#endif
|
||||
|
||||
/* Clear state machine in case re-initialized */
|
||||
scansm = &g_ble_ll_scan_sm;
|
||||
@@ -2706,7 +2717,7 @@ ble_ll_scan_init(void)
|
||||
sizeof(struct ble_mbuf_hdr));
|
||||
assert(scansm->scan_req_pdu != NULL);
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
err = os_mempool_init(&ext_adv_pool,
|
||||
OUTSTANDING_AUX,
|
||||
sizeof (struct ble_ll_aux_data),
|
||||
|
||||
@@ -256,10 +256,12 @@ ble_ll_sched_conn_reschedule(struct ble_ll_conn_sm *connsm)
|
||||
ble_ll_adv_event_rmvd_from_sched((struct ble_ll_adv_sm *)
|
||||
entry->cb_arg);
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
case BLE_LL_SCHED_TYPE_AUX_SCAN:
|
||||
ble_ll_scan_aux_data_free((struct ble_ll_aux_data *)
|
||||
entry->cb_arg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
@@ -1075,7 +1077,7 @@ ble_ll_sched_rfclk_chk_restart(void)
|
||||
* @return int
|
||||
*/
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
int
|
||||
ble_ll_sched_is_busy_in(uint32_t usec)
|
||||
{
|
||||
|
||||
@@ -230,6 +230,13 @@ syscfg.defs:
|
||||
This option is used to enable/disable support for the coded PHY.
|
||||
value: '0'
|
||||
|
||||
BLE_LL_CFG_FEAT_LL_EXT_ADV:
|
||||
description: >
|
||||
This option is used to enable/disable support for Extended
|
||||
Advertising Feature. That means extended scanner, advertiser
|
||||
and connect.
|
||||
value: 0
|
||||
|
||||
BLE_PUBLIC_DEV_ADDR:
|
||||
description: >
|
||||
Allows the target or app to override the public device address
|
||||
|
||||
@@ -776,7 +776,7 @@ ble_phy_rx_start_isr(void)
|
||||
ble_hdr->rxinfo.channel = g_ble_phy_data.phy_chan;
|
||||
ble_hdr->rxinfo.handle = 0;
|
||||
ble_hdr->rxinfo.phy = ble_phy_get_cur_phy();
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
ble_hdr->rxinfo.aux_data = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ struct ble_mbuf_hdr_rxinfo
|
||||
#if MYNEWT_VAL(BLE_MULTI_ADV_SUPPORT)
|
||||
void *advsm; /* advertising state machine */
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
void *aux_data;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -771,7 +771,7 @@ struct hci_create_conn
|
||||
uint16_t max_ce_len;
|
||||
};
|
||||
|
||||
#if MYNEWT_VAL(BLE_EXT_SCAN_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV) || MYNEWT_VAL(BLE_EXT_ADV)
|
||||
/* LE create connection command (ocf=0x0043). */
|
||||
struct hci_ext_conn_params
|
||||
{
|
||||
|
||||
@@ -51,6 +51,3 @@ syscfg.defs:
|
||||
advertising instances is this number plus 1 (assuming the device
|
||||
supports advertising).
|
||||
value: 0
|
||||
BLE_EXT_SCAN_SUPPORT:
|
||||
description: "Enable extended scan support from Bluetooth 5.0"
|
||||
value: 0
|
||||
|
||||
Reference in New Issue
Block a user