Bluetooth: controller: Replace slave with peripheral
Replace the old slave term with the new peripheral one from the Bluetooth spec v5.3. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
ba2d2ee936
commit
947b38ac0a
40 changed files with 315 additions and 309 deletions
|
@ -81,6 +81,10 @@ Modified in this release
|
||||||
|
|
||||||
* The ``CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY`` Kconfig option is now
|
* The ``CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY`` Kconfig option is now
|
||||||
:kconfig:`CONFIG_BT_PERIPHERAL_PREF_LATENCY`
|
:kconfig:`CONFIG_BT_PERIPHERAL_PREF_LATENCY`
|
||||||
|
* The ``CONFIG_BT_CTLR_SLAVE_FEAT_REQ_SUPPORT`` Kconfig option is now
|
||||||
|
:kconfig:`CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT`
|
||||||
|
* The ``CONFIG_BT_CTLR_SLAVE_FEAT_REQ`` Kconfig option is now
|
||||||
|
:kconfig:`CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG`
|
||||||
|
|
||||||
Changes in this release
|
Changes in this release
|
||||||
==========================
|
==========================
|
||||||
|
|
|
@ -73,7 +73,7 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||||
)
|
)
|
||||||
if(CONFIG_BT_PERIPHERAL)
|
if(CONFIG_BT_PERIPHERAL)
|
||||||
zephyr_library_sources(
|
zephyr_library_sources(
|
||||||
ll_sw/ull_slave.c
|
ll_sw/ull_peripheral.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_CTLR_PERIPHERAL_ISO
|
CONFIG_BT_CTLR_PERIPHERAL_ISO
|
||||||
|
@ -82,7 +82,7 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||||
endif()
|
endif()
|
||||||
if(CONFIG_BT_CENTRAL)
|
if(CONFIG_BT_CENTRAL)
|
||||||
zephyr_library_sources(
|
zephyr_library_sources(
|
||||||
ll_sw/ull_master.c
|
ll_sw/ull_central.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_CTLR_CENTRAL_ISO
|
CONFIG_BT_CTLR_CENTRAL_ISO
|
||||||
|
|
|
@ -17,7 +17,7 @@ config BT_CTLR_CONN_PARAM_REQ_SUPPORT
|
||||||
config BT_CTLR_EXT_REJ_IND_SUPPORT
|
config BT_CTLR_EXT_REJ_IND_SUPPORT
|
||||||
bool
|
bool
|
||||||
|
|
||||||
config BT_CTLR_SLAVE_FEAT_REQ_SUPPORT
|
config BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT
|
||||||
bool
|
bool
|
||||||
|
|
||||||
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
|
config BT_CTLR_DATA_LEN_UPDATE_SUPPORT
|
||||||
|
@ -308,12 +308,12 @@ config BT_CTLR_EXT_REJ_IND
|
||||||
Enable support for Bluetooth v4.1 Extended Reject Indication feature
|
Enable support for Bluetooth v4.1 Extended Reject Indication feature
|
||||||
in the Controller.
|
in the Controller.
|
||||||
|
|
||||||
config BT_CTLR_SLAVE_FEAT_REQ
|
config BT_CTLR_PER_INIT_FEAT_XCHG
|
||||||
bool "Slave-initiated Features Exchange"
|
bool "Peripheral-initiated Features Exchange"
|
||||||
depends on BT_CTLR_SLAVE_FEAT_REQ_SUPPORT
|
depends on BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable support for Bluetooth v4.1 Slave-initiated Features Exchange
|
Enable support for Bluetooth v4.1 Peripheral-initiated Features Exchange
|
||||||
feature in the Controller.
|
feature in the Controller.
|
||||||
|
|
||||||
config BT_CTLR_LE_PING
|
config BT_CTLR_LE_PING
|
||||||
|
|
|
@ -18,7 +18,7 @@ config BT_LLL_VENDOR_NORDIC
|
||||||
!BT_CTLR_PHY_2M_NRF
|
!BT_CTLR_PHY_2M_NRF
|
||||||
select BT_CTLR_CONN_PARAM_REQ_SUPPORT
|
select BT_CTLR_CONN_PARAM_REQ_SUPPORT
|
||||||
select BT_CTLR_EXT_REJ_IND_SUPPORT
|
select BT_CTLR_EXT_REJ_IND_SUPPORT
|
||||||
select BT_CTLR_SLAVE_FEAT_REQ_SUPPORT
|
select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT
|
||||||
select BT_CTLR_DATA_LEN_UPDATE_SUPPORT if HAS_HW_NRF_CCM_LFLEN_8BIT || \
|
select BT_CTLR_DATA_LEN_UPDATE_SUPPORT if HAS_HW_NRF_CCM_LFLEN_8BIT || \
|
||||||
BT_CTLR_DATA_LENGTH_CLEAR
|
BT_CTLR_DATA_LENGTH_CLEAR
|
||||||
select BT_CTLR_PRIVACY_SUPPORT if !SOC_SERIES_NRF51X
|
select BT_CTLR_PRIVACY_SUPPORT if !SOC_SERIES_NRF51X
|
||||||
|
@ -307,15 +307,15 @@ config BT_CTLR_SCHED_ADVANCED
|
||||||
depends on (BT_MAX_CONN != 0) && BT_CTLR_SCHED_ADVANCED_SUPPORT
|
depends on (BT_MAX_CONN != 0) && BT_CTLR_SCHED_ADVANCED_SUPPORT
|
||||||
default y if !(BT_PERIPHERAL && !BT_CENTRAL)
|
default y if !(BT_PERIPHERAL && !BT_CENTRAL)
|
||||||
help
|
help
|
||||||
Enable non-overlapping placement of observer, initiator and master
|
Enable non-overlapping placement of observer, initiator and central
|
||||||
roles in timespace. Uses window offset in connection updates and uses
|
roles in timespace. Uses window offset in connection updates and uses
|
||||||
connection parameter request in slave role to negotiate
|
connection parameter request in peripheral role to negotiate
|
||||||
non-overlapping placement with active master roles to avoid slave
|
non-overlapping placement with active central roles to avoid peripheral
|
||||||
roles drifting into active master roles in the local controller.
|
roles drifting into active central roles in the local controller.
|
||||||
|
|
||||||
This feature maximizes the average data transmission amongst active
|
This feature maximizes the average data transmission amongst active
|
||||||
concurrent master and slave connections while other observer,
|
concurrent central and peripheral connections while other observer,
|
||||||
initiator, master or slave roles are active in the local controller.
|
initiator, central or peripheral roles are active in the local controller.
|
||||||
|
|
||||||
Disabling this feature will lead to overlapping role in timespace
|
Disabling this feature will lead to overlapping role in timespace
|
||||||
leading to skipped events amongst active roles.
|
leading to skipped events amongst active roles.
|
||||||
|
|
|
@ -6345,7 +6345,7 @@ static void le_unknown_rsp(struct pdu_data *pdu_data, uint16_t handle,
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (pdu_data->llctrl.unknown_rsp.type) {
|
switch (pdu_data->llctrl.unknown_rsp.type) {
|
||||||
case PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ:
|
case PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG:
|
||||||
le_remote_feat_complete(BT_HCI_ERR_UNSUPP_REMOTE_FEATURE,
|
le_remote_feat_complete(BT_HCI_ERR_UNSUPP_REMOTE_FEATURE,
|
||||||
NULL, handle, buf);
|
NULL, handle, buf);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
#define LL_FEAT_BIT_EXT_REJ_IND 0
|
#define LL_FEAT_BIT_EXT_REJ_IND 0
|
||||||
#endif /* !CONFIG_BT_CTLR_EXT_REJ_IND */
|
#endif /* !CONFIG_BT_CTLR_EXT_REJ_IND */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ)
|
#if defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG)
|
||||||
#define LL_FEAT_BIT_SLAVE_FEAT_REQ BIT64(BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG)
|
#define LL_FEAT_BIT_PER_INIT_FEAT_XCHG BIT64(BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG)
|
||||||
#else /* !CONFIG_BT_CTLR_SLAVE_FEAT_REQ */
|
#else /* !CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */
|
||||||
#define LL_FEAT_BIT_SLAVE_FEAT_REQ 0
|
#define LL_FEAT_BIT_PER_INIT_FEAT_XCHG 0
|
||||||
#endif /* !CONFIG_BT_CTLR_SLAVE_FEAT_REQ */
|
#endif /* !CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_LE_PING)
|
#if defined(CONFIG_BT_CTLR_LE_PING)
|
||||||
#define LL_FEAT_BIT_PING BIT64(BT_LE_FEAT_BIT_PING)
|
#define LL_FEAT_BIT_PING BIT64(BT_LE_FEAT_BIT_PING)
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
#define LL_FEAT (LL_FEAT_BIT_ENC | \
|
#define LL_FEAT (LL_FEAT_BIT_ENC | \
|
||||||
LL_FEAT_BIT_CONN_PARAM_REQ | \
|
LL_FEAT_BIT_CONN_PARAM_REQ | \
|
||||||
LL_FEAT_BIT_EXT_REJ_IND | \
|
LL_FEAT_BIT_EXT_REJ_IND | \
|
||||||
LL_FEAT_BIT_SLAVE_FEAT_REQ | \
|
LL_FEAT_BIT_PER_INIT_FEAT_XCHG | \
|
||||||
LL_FEAT_BIT_PING | \
|
LL_FEAT_BIT_PING | \
|
||||||
LL_FEAT_BIT_DLE | \
|
LL_FEAT_BIT_DLE | \
|
||||||
LL_FEAT_BIT_PRIVACY | \
|
LL_FEAT_BIT_PRIVACY | \
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int lll_master_init(void);
|
int lll_central_init(void);
|
||||||
int lll_master_reset(void);
|
int lll_central_reset(void);
|
||||||
void lll_master_prepare(void *param);
|
void lll_central_prepare(void *param);
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct lll_conn {
|
||||||
struct {
|
struct {
|
||||||
uint8_t initiated:1;
|
uint8_t initiated:1;
|
||||||
uint8_t cancelled:1;
|
uint8_t cancelled:1;
|
||||||
} master;
|
} central;
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
struct {
|
struct {
|
||||||
uint8_t initiated:1;
|
uint8_t initiated:1;
|
||||||
|
@ -73,7 +73,7 @@ struct lll_conn {
|
||||||
uint32_t window_widening_event_us;
|
uint32_t window_widening_event_us;
|
||||||
uint32_t window_size_prepare_us;
|
uint32_t window_size_prepare_us;
|
||||||
uint32_t window_size_event_us;
|
uint32_t window_size_event_us;
|
||||||
} slave;
|
} periph;
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int lll_slave_init(void);
|
int lll_periph_init(void);
|
||||||
int lll_slave_reset(void);
|
int lll_periph_reset(void);
|
||||||
void lll_slave_prepare(void *param);
|
void lll_periph_prepare(void *param);
|
|
@ -856,7 +856,7 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
* transmitting connectable advertising event if cancelled flag is set.
|
* transmitting connectable advertising event if cancelled flag is set.
|
||||||
*/
|
*/
|
||||||
if (unlikely(lll->conn &&
|
if (unlikely(lll->conn &&
|
||||||
(lll->conn->slave.initiated || lll->conn->slave.cancelled))) {
|
(lll->conn->periph.initiated || lll->conn->periph.cancelled))) {
|
||||||
radio_isr_set(lll_isr_early_abort, lll);
|
radio_isr_set(lll_isr_early_abort, lll);
|
||||||
radio_disable();
|
radio_disable();
|
||||||
|
|
||||||
|
@ -1091,7 +1091,7 @@ static void isr_tx(void *param)
|
||||||
radio_tmr_hcto_configure(hcto);
|
radio_tmr_hcto_configure(hcto);
|
||||||
|
|
||||||
/* capture end of CONNECT_IND PDU, used for calculating first
|
/* capture end of CONNECT_IND PDU, used for calculating first
|
||||||
* slave event.
|
* peripheral event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -1205,7 +1205,7 @@ static void isr_done(void *param)
|
||||||
*/
|
*/
|
||||||
if (lll->chan_map_curr &&
|
if (lll->chan_map_curr &&
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
(!lll->conn || !lll->conn->slave.cancelled) &&
|
(!lll->conn || !lll->conn->periph.cancelled) &&
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
1) {
|
1) {
|
||||||
struct pdu_adv *pdu;
|
struct pdu_adv *pdu;
|
||||||
|
@ -1447,7 +1447,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||||
*/
|
*/
|
||||||
} else if ((pdu_rx->type == PDU_ADV_TYPE_CONNECT_IND) &&
|
} else if ((pdu_rx->type == PDU_ADV_TYPE_CONNECT_IND) &&
|
||||||
(pdu_rx->len == sizeof(struct pdu_adv_connect_ind)) &&
|
(pdu_rx->len == sizeof(struct pdu_adv_connect_ind)) &&
|
||||||
lll->conn && !lll->conn->slave.cancelled &&
|
lll->conn && !lll->conn->periph.cancelled &&
|
||||||
lll_adv_connect_ind_check(lll, pdu_rx, tx_addr, addr,
|
lll_adv_connect_ind_check(lll, pdu_rx, tx_addr, addr,
|
||||||
rx_addr, tgt_addr,
|
rx_addr, tgt_addr,
|
||||||
devmatch_ok, &rl_idx)) {
|
devmatch_ok, &rl_idx)) {
|
||||||
|
@ -1481,7 +1481,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||||
|
|
||||||
/* Stop further LLL radio events */
|
/* Stop further LLL radio events */
|
||||||
lll->conn->slave.initiated = 1;
|
lll->conn->periph.initiated = 1;
|
||||||
|
|
||||||
rx = ull_pdu_rx_alloc();
|
rx = ull_pdu_rx_alloc();
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ static void isr_tx(void *param)
|
||||||
radio_tmr_hcto_configure(hcto);
|
radio_tmr_hcto_configure(hcto);
|
||||||
|
|
||||||
/* capture end of CONNECT_IND PDU, used for calculating first
|
/* capture end of CONNECT_IND PDU, used for calculating first
|
||||||
* slave event.
|
* peripheral event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ static void isr_tx_connect_rsp(void *param)
|
||||||
|
|
||||||
if (is_done) {
|
if (is_done) {
|
||||||
/* Stop further LLL radio events */
|
/* Stop further LLL radio events */
|
||||||
lll->conn->slave.initiated = 1;
|
lll->conn->periph.initiated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear radio status and events */
|
/* Clear radio status and events */
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
#include "lll_clock.h"
|
#include "lll_clock.h"
|
||||||
#include "lll_df_types.h"
|
#include "lll_df_types.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_master.h"
|
#include "lll_central.h"
|
||||||
#include "lll_chan.h"
|
#include "lll_chan.h"
|
||||||
|
|
||||||
#include "lll_internal.h"
|
#include "lll_internal.h"
|
||||||
#include "lll_tim_internal.h"
|
#include "lll_tim_internal.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||||
#define LOG_MODULE_NAME bt_ctlr_lll_master
|
#define LOG_MODULE_NAME bt_ctlr_lll_central
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
static int init_reset(void);
|
static int init_reset(void);
|
||||||
static int prepare_cb(struct lll_prepare_param *p);
|
static int prepare_cb(struct lll_prepare_param *p);
|
||||||
|
|
||||||
int lll_master_init(void)
|
int lll_central_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ int lll_master_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lll_master_reset(void)
|
int lll_central_reset(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ int lll_master_reset(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lll_master_prepare(void *param)
|
void lll_central_prepare(void *param)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ void lll_conn_isr_rx(void *param)
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
/* Event done for master */
|
/* Event done for central */
|
||||||
} else if (!lll->role) {
|
} else if (!lll->role) {
|
||||||
radio_disable();
|
radio_disable();
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void lll_conn_isr_rx(void *param)
|
||||||
goto lll_conn_isr_rx_exit;
|
goto lll_conn_isr_rx_exit;
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
/* Event done for slave */
|
/* Event done for peripheral */
|
||||||
} else {
|
} else {
|
||||||
radio_switch_complete_and_disable();
|
radio_switch_complete_and_disable();
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
@ -660,12 +660,12 @@ static void isr_done(void *param)
|
||||||
e->drift.start_to_address_actual_us =
|
e->drift.start_to_address_actual_us =
|
||||||
radio_tmr_aa_restore() - radio_tmr_ready_get();
|
radio_tmr_aa_restore() - radio_tmr_ready_get();
|
||||||
e->drift.window_widening_event_us =
|
e->drift.window_widening_event_us =
|
||||||
lll->slave.window_widening_event_us;
|
lll->periph.window_widening_event_us;
|
||||||
e->drift.preamble_to_addr_us = preamble_to_addr_us;
|
e->drift.preamble_to_addr_us = preamble_to_addr_us;
|
||||||
|
|
||||||
/* Reset window widening, as anchor point sync-ed */
|
/* Reset window widening, as anchor point sync-ed */
|
||||||
lll->slave.window_widening_event_us = 0;
|
lll->periph.window_widening_event_us = 0;
|
||||||
lll->slave.window_size_event_us = 0;
|
lll->periph.window_size_event_us = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
@ -711,10 +711,10 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
/* First ack (and redundantly any other ack) enable use of
|
/* First ack (and redundantly any other ack) enable use of
|
||||||
* slave latency.
|
* peripheral latency.
|
||||||
*/
|
*/
|
||||||
if (lll->role) {
|
if (lll->role) {
|
||||||
lll->slave.latency_enabled = 1;
|
lll->periph.latency_enabled = 1;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
#include "lll_vendor.h"
|
#include "lll_vendor.h"
|
||||||
#include "lll_clock.h"
|
#include "lll_clock.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_slave.h"
|
#include "lll_peripheral.h"
|
||||||
#include "lll_chan.h"
|
#include "lll_chan.h"
|
||||||
|
|
||||||
#include "lll_internal.h"
|
#include "lll_internal.h"
|
||||||
#include "lll_tim_internal.h"
|
#include "lll_tim_internal.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||||
#define LOG_MODULE_NAME bt_ctlr_lll_slave
|
#define LOG_MODULE_NAME bt_ctlr_lll_periph
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static int init_reset(void);
|
static int init_reset(void);
|
||||||
static int prepare_cb(struct lll_prepare_param *p);
|
static int prepare_cb(struct lll_prepare_param *p);
|
||||||
|
|
||||||
int lll_slave_init(void)
|
int lll_periph_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int lll_slave_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lll_slave_reset(void)
|
int lll_periph_reset(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ int lll_slave_reset(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lll_slave_prepare(void *param)
|
void lll_periph_prepare(void *param)
|
||||||
{
|
{
|
||||||
struct lll_prepare_param *p;
|
struct lll_prepare_param *p;
|
||||||
struct lll_conn *lll;
|
struct lll_conn *lll;
|
||||||
|
@ -75,12 +75,12 @@ void lll_slave_prepare(void *param)
|
||||||
lll = p->param;
|
lll = p->param;
|
||||||
|
|
||||||
/* Accumulate window widening */
|
/* Accumulate window widening */
|
||||||
lll->slave.window_widening_prepare_us +=
|
lll->periph.window_widening_prepare_us +=
|
||||||
lll->slave.window_widening_periodic_us * (p->lazy + 1);
|
lll->periph.window_widening_periodic_us * (p->lazy + 1);
|
||||||
if (lll->slave.window_widening_prepare_us >
|
if (lll->periph.window_widening_prepare_us >
|
||||||
lll->slave.window_widening_max_us) {
|
lll->periph.window_widening_max_us) {
|
||||||
lll->slave.window_widening_prepare_us =
|
lll->periph.window_widening_prepare_us =
|
||||||
lll->slave.window_widening_max_us;
|
lll->periph.window_widening_max_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke common pipeline handling of prepare */
|
/* Invoke common pipeline handling of prepare */
|
||||||
|
@ -151,19 +151,19 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* current window widening */
|
/* current window widening */
|
||||||
lll->slave.window_widening_event_us +=
|
lll->periph.window_widening_event_us +=
|
||||||
lll->slave.window_widening_prepare_us;
|
lll->periph.window_widening_prepare_us;
|
||||||
lll->slave.window_widening_prepare_us = 0;
|
lll->periph.window_widening_prepare_us = 0;
|
||||||
if (lll->slave.window_widening_event_us >
|
if (lll->periph.window_widening_event_us >
|
||||||
lll->slave.window_widening_max_us) {
|
lll->periph.window_widening_max_us) {
|
||||||
lll->slave.window_widening_event_us =
|
lll->periph.window_widening_event_us =
|
||||||
lll->slave.window_widening_max_us;
|
lll->periph.window_widening_max_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* current window size */
|
/* current window size */
|
||||||
lll->slave.window_size_event_us +=
|
lll->periph.window_size_event_us +=
|
||||||
lll->slave.window_size_prepare_us;
|
lll->periph.window_size_prepare_us;
|
||||||
lll->slave.window_size_prepare_us = 0;
|
lll->periph.window_size_prepare_us = 0;
|
||||||
|
|
||||||
/* Ensure that empty flag reflects the state of the Tx queue, as a
|
/* Ensure that empty flag reflects the state of the Tx queue, as a
|
||||||
* peripheral if this is the first connection event and as no prior PDU
|
* peripheral if this is the first connection event and as no prior PDU
|
||||||
|
@ -227,8 +227,8 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
|
|
||||||
hcto = remainder_us +
|
hcto = remainder_us +
|
||||||
((EVENT_JITTER_US + EVENT_TICKER_RES_MARGIN_US +
|
((EVENT_JITTER_US + EVENT_TICKER_RES_MARGIN_US +
|
||||||
lll->slave.window_widening_event_us) << 1) +
|
lll->periph.window_widening_event_us) << 1) +
|
||||||
lll->slave.window_size_event_us;
|
lll->periph.window_size_event_us;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_PHY)
|
#if defined(CONFIG_BT_CTLR_PHY)
|
||||||
hcto += radio_rx_ready_delay_get(lll->phy_rx, 1);
|
hcto += radio_rx_ready_delay_get(lll->phy_rx, 1);
|
|
@ -328,8 +328,8 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume)
|
||||||
*/
|
*/
|
||||||
if (unlikely(lll->is_stop ||
|
if (unlikely(lll->is_stop ||
|
||||||
(lll->conn &&
|
(lll->conn &&
|
||||||
(lll->conn->master.initiated ||
|
(lll->conn->central.initiated ||
|
||||||
lll->conn->master.cancelled)))) {
|
lll->conn->central.cancelled)))) {
|
||||||
radio_isr_set(lll_isr_early_abort, lll);
|
radio_isr_set(lll_isr_early_abort, lll);
|
||||||
radio_disable();
|
radio_disable();
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume)
|
||||||
remainder_us = radio_tmr_start(0, ticks_at_start, remainder);
|
remainder_us = radio_tmr_start(0, ticks_at_start, remainder);
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event or extended scan to schedule auxiliary channel
|
* central event or extended scan to schedule auxiliary channel
|
||||||
* reception.
|
* reception.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
@ -573,7 +573,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
|
||||||
if (0) {
|
if (0) {
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
|
} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
|
||||||
lll->conn && lll->conn->master.initiated) {
|
lll->conn && lll->conn->central.initiated) {
|
||||||
while (!radio_has_disabled()) {
|
while (!radio_has_disabled()) {
|
||||||
cpu_sleep();
|
cpu_sleep();
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ static void isr_done(void *param)
|
||||||
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event.
|
* central event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ static void isr_window(void *param)
|
||||||
#endif /* !CONFIG_BT_CENTRAL */
|
#endif /* !CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event.
|
* central event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -1027,7 +1027,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
|
||||||
/* Note: connectable ADV_EXT_IND is handled as any other ADV_EXT_IND
|
/* Note: connectable ADV_EXT_IND is handled as any other ADV_EXT_IND
|
||||||
* because we need to receive AUX_ADV_IND anyway.
|
* because we need to receive AUX_ADV_IND anyway.
|
||||||
*/
|
*/
|
||||||
} else if (lll->conn && !lll->conn->master.cancelled &&
|
} else if (lll->conn && !lll->conn->central.cancelled &&
|
||||||
(pdu_adv_rx->type != PDU_ADV_TYPE_EXT_IND) &&
|
(pdu_adv_rx->type != PDU_ADV_TYPE_EXT_IND) &&
|
||||||
isr_scan_init_check(lll, pdu_adv_rx, rl_idx)) {
|
isr_scan_init_check(lll, pdu_adv_rx, rl_idx)) {
|
||||||
struct lll_conn *lll_conn;
|
struct lll_conn *lll_conn;
|
||||||
|
@ -1137,7 +1137,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
|
||||||
/* FIXME: for extended connection initiation, handle reset on
|
/* FIXME: for extended connection initiation, handle reset on
|
||||||
* event aborted before connect_rsp is received.
|
* event aborted before connect_rsp is received.
|
||||||
*/
|
*/
|
||||||
lll->conn->master.initiated = 1U;
|
lll->conn->central.initiated = 1U;
|
||||||
|
|
||||||
/* Stop further initiating events */
|
/* Stop further initiating events */
|
||||||
lll->is_stop = 1U;
|
lll->is_stop = 1U;
|
||||||
|
|
|
@ -278,8 +278,8 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
*/
|
*/
|
||||||
if (unlikely(scan_lll->is_stop ||
|
if (unlikely(scan_lll->is_stop ||
|
||||||
(scan_lll->conn &&
|
(scan_lll->conn &&
|
||||||
(scan_lll->conn->master.initiated ||
|
(scan_lll->conn->central.initiated ||
|
||||||
scan_lll->conn->master.cancelled)))) {
|
scan_lll->conn->central.cancelled)))) {
|
||||||
radio_isr_set(isr_early_abort, lll);
|
radio_isr_set(isr_early_abort, lll);
|
||||||
radio_disable();
|
radio_disable();
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
|
||||||
if (0) {
|
if (0) {
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
/* Initiator */
|
/* Initiator */
|
||||||
} else if (lll->conn && !lll->conn->master.cancelled &&
|
} else if (lll->conn && !lll->conn->central.cancelled &&
|
||||||
(pdu->adv_ext_ind.adv_mode & BT_HCI_LE_ADV_PROP_CONN) &&
|
(pdu->adv_ext_ind.adv_mode & BT_HCI_LE_ADV_PROP_CONN) &&
|
||||||
lll_scan_ext_tgta_check(lll, false, true, pdu,
|
lll_scan_ext_tgta_check(lll, false, true, pdu,
|
||||||
rl_idx)) {
|
rl_idx)) {
|
||||||
|
@ -879,7 +879,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Stop further connection initiation */
|
/* Stop further connection initiation */
|
||||||
lll->conn->master.initiated = 1U;
|
lll->conn->central.initiated = 1U;
|
||||||
|
|
||||||
/* Stop further initiating events */
|
/* Stop further initiating events */
|
||||||
lll->is_stop = 1U;
|
lll->is_stop = 1U;
|
||||||
|
@ -1287,7 +1287,7 @@ static void isr_rx_connect_rsp(void *param)
|
||||||
struct node_rx_ftr *ftr;
|
struct node_rx_ftr *ftr;
|
||||||
|
|
||||||
/* Try again with connection initiation */
|
/* Try again with connection initiation */
|
||||||
lll->conn->master.initiated = 0U;
|
lll->conn->central.initiated = 0U;
|
||||||
|
|
||||||
/* Dont stop initiating events on primary channels */
|
/* Dont stop initiating events on primary channels */
|
||||||
lll->is_stop = 0U;
|
lll->is_stop = 0U;
|
||||||
|
|
|
@ -37,11 +37,11 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_PERIPHERAL
|
CONFIG_BT_PERIPHERAL
|
||||||
ll_sw/nordic/lll/lll_slave.c
|
ll_sw/nordic/lll/lll_peripheral.c
|
||||||
)
|
)
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_CENTRAL
|
CONFIG_BT_CENTRAL
|
||||||
ll_sw/nordic/lll/lll_master.c
|
ll_sw/nordic/lll/lll_central.c
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
|
|
|
@ -21,12 +21,12 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||||
)
|
)
|
||||||
if(CONFIG_BT_PERIPHERAL)
|
if(CONFIG_BT_PERIPHERAL)
|
||||||
zephyr_library_sources(
|
zephyr_library_sources(
|
||||||
ll_sw/openisa/lll/lll_slave.c
|
ll_sw/openisa/lll/lll_peripheral.c
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(CONFIG_BT_CENTRAL)
|
if(CONFIG_BT_CENTRAL)
|
||||||
zephyr_library_sources(
|
zephyr_library_sources(
|
||||||
ll_sw/openisa/lll/lll_master.c
|
ll_sw/openisa/lll/lll_central.c
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1285,7 +1285,8 @@ void *radio_ccm_rx_pkt_set(struct ccm *ccm, uint8_t phy, void *pkt)
|
||||||
ctx_ccm.rx_pkt_out = (struct pdu_data *)pkt;
|
ctx_ccm.rx_pkt_out = (struct pdu_data *)pkt;
|
||||||
ctx_ccm.nonce.counter = ccm->counter; /* LSO to MSO, counter is LE */
|
ctx_ccm.nonce.counter = ccm->counter; /* LSO to MSO, counter is LE */
|
||||||
/* The directionBit set to 1 for Data Physical Chan PDUs sent by
|
/* The directionBit set to 1 for Data Physical Chan PDUs sent by
|
||||||
* the master and set to 0 for Data Physical Chan PDUs sent by the slave
|
* the central and set to 0 for Data Physical Chan PDUs sent by the
|
||||||
|
* peripheral
|
||||||
*/
|
*/
|
||||||
ctx_ccm.nonce.bytes[4] |= ccm->direction << 7;
|
ctx_ccm.nonce.bytes[4] |= ccm->direction << 7;
|
||||||
memcpy(&ctx_ccm.nonce.bytes[5], ccm->iv, 8); /* LSO to MSO */
|
memcpy(&ctx_ccm.nonce.bytes[5], ccm->iv, 8); /* LSO to MSO */
|
||||||
|
@ -1383,7 +1384,8 @@ void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt)
|
||||||
memcpy(key_local, ccm->key, sizeof(key_local));
|
memcpy(key_local, ccm->key, sizeof(key_local));
|
||||||
ctx_ccm.nonce.counter = ccm->counter; /* LSO to MSO, counter is LE */
|
ctx_ccm.nonce.counter = ccm->counter; /* LSO to MSO, counter is LE */
|
||||||
/* The directionBit set to 1 for Data Physical Chan PDUs sent by
|
/* The directionBit set to 1 for Data Physical Chan PDUs sent by
|
||||||
* the master and set to 0 for Data Physical Chan PDUs sent by the slave
|
* the central and set to 0 for Data Physical Chan PDUs sent by the
|
||||||
|
* peripheral
|
||||||
*/
|
*/
|
||||||
ctx_ccm.nonce.bytes[4] |= ccm->direction << 7;
|
ctx_ccm.nonce.bytes[4] |= ccm->direction << 7;
|
||||||
memcpy(&ctx_ccm.nonce.bytes[5], ccm->iv, 8); /* LSO to MSO */
|
memcpy(&ctx_ccm.nonce.bytes[5], ccm->iv, 8); /* LSO to MSO */
|
||||||
|
|
|
@ -329,7 +329,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||||
/* Check if stopped (on connection establishment race between LLL and
|
/* Check if stopped (on connection establishment race between LLL and
|
||||||
* ULL.
|
* ULL.
|
||||||
*/
|
*/
|
||||||
if (unlikely(lll->conn && lll->conn->master.initiated)) {
|
if (unlikely(lll->conn && lll->conn->central.initiated)) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = lll_clk_off();
|
err = lll_clk_off();
|
||||||
|
@ -557,7 +557,7 @@ static void isr_tx(void *param)
|
||||||
radio_tmr_hcto_configure(hcto);
|
radio_tmr_hcto_configure(hcto);
|
||||||
|
|
||||||
/* capture end of CONNECT_IND PDU, used for calculating first
|
/* capture end of CONNECT_IND PDU, used for calculating first
|
||||||
* slave event.
|
* peripheral event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||||
/* Stop further LLL radio events */
|
/* Stop further LLL radio events */
|
||||||
lll->conn->master.initiated = 1;
|
lll->conn->central.initiated = 1;
|
||||||
|
|
||||||
rx = ull_pdu_rx_alloc();
|
rx = ull_pdu_rx_alloc();
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#include "lll.h"
|
#include "lll.h"
|
||||||
#include "lll_vendor.h"
|
#include "lll_vendor.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_master.h"
|
#include "lll_central.h"
|
||||||
#include "lll_chan.h"
|
#include "lll_chan.h"
|
||||||
|
|
||||||
#include "lll_internal.h"
|
#include "lll_internal.h"
|
||||||
#include "lll_tim_internal.h"
|
#include "lll_tim_internal.h"
|
||||||
|
|
||||||
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_master
|
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_central
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
static int init_reset(void);
|
static int init_reset(void);
|
||||||
static int prepare_cb(struct lll_prepare_param *p);
|
static int prepare_cb(struct lll_prepare_param *p);
|
||||||
|
|
||||||
int lll_master_init(void)
|
int lll_central_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int lll_master_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lll_master_reset(void)
|
int lll_central_reset(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ int lll_master_reset(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lll_master_prepare(void *param)
|
void lll_central_prepare(void *param)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ void lll_conn_isr_rx(void *param)
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
/* Event done for master */
|
/* Event done for central */
|
||||||
} else if (!lll->role) {
|
} else if (!lll->role) {
|
||||||
radio_disable();
|
radio_disable();
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void lll_conn_isr_rx(void *param)
|
||||||
goto lll_conn_isr_rx_exit;
|
goto lll_conn_isr_rx_exit;
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
/* Event done for slave */
|
/* Event done for peripheral */
|
||||||
} else {
|
} else {
|
||||||
radio_switch_complete_and_disable();
|
radio_switch_complete_and_disable();
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
@ -605,12 +605,12 @@ static void isr_done(void *param)
|
||||||
e->drift.start_to_address_actual_us =
|
e->drift.start_to_address_actual_us =
|
||||||
radio_tmr_aa_restore() - radio_tmr_ready_get();
|
radio_tmr_aa_restore() - radio_tmr_ready_get();
|
||||||
e->drift.window_widening_event_us =
|
e->drift.window_widening_event_us =
|
||||||
lll->slave.window_widening_event_us;
|
lll->periph.window_widening_event_us;
|
||||||
e->drift.preamble_to_addr_us = preamble_to_addr_us;
|
e->drift.preamble_to_addr_us = preamble_to_addr_us;
|
||||||
|
|
||||||
/* Reset window widening, as anchor point sync-ed */
|
/* Reset window widening, as anchor point sync-ed */
|
||||||
lll->slave.window_widening_event_us = 0;
|
lll->periph.window_widening_event_us = 0;
|
||||||
lll->slave.window_size_event_us = 0;
|
lll->periph.window_size_event_us = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
@ -657,10 +657,10 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
/* First ack (and redundantly any other ack) enable use of
|
/* First ack (and redundantly any other ack) enable use of
|
||||||
* slave latency.
|
* peripheral latency.
|
||||||
*/
|
*/
|
||||||
if (lll->role) {
|
if (lll->role) {
|
||||||
lll->slave.latency_enabled = 1;
|
lll->periph.latency_enabled = 1;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#include "lll.h"
|
#include "lll.h"
|
||||||
#include "lll_vendor.h"
|
#include "lll_vendor.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_slave.h"
|
#include "lll_peripheral.h"
|
||||||
#include "lll_chan.h"
|
#include "lll_chan.h"
|
||||||
|
|
||||||
#include "lll_internal.h"
|
#include "lll_internal.h"
|
||||||
#include "lll_tim_internal.h"
|
#include "lll_tim_internal.h"
|
||||||
|
|
||||||
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_slave
|
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_periph
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
static int init_reset(void);
|
static int init_reset(void);
|
||||||
static int prepare_cb(struct lll_prepare_param *p);
|
static int prepare_cb(struct lll_prepare_param *p);
|
||||||
|
|
||||||
int lll_slave_init(void)
|
int lll_periph_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int lll_slave_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lll_slave_reset(void)
|
int lll_periph_reset(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ int lll_slave_reset(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lll_slave_prepare(void *param)
|
void lll_periph_prepare(void *param)
|
||||||
{
|
{
|
||||||
struct lll_prepare_param *p;
|
struct lll_prepare_param *p;
|
||||||
struct lll_conn *lll;
|
struct lll_conn *lll;
|
||||||
|
@ -73,12 +73,12 @@ void lll_slave_prepare(void *param)
|
||||||
lll = p->param;
|
lll = p->param;
|
||||||
|
|
||||||
/* Accumulate window widening */
|
/* Accumulate window widening */
|
||||||
lll->slave.window_widening_prepare_us +=
|
lll->periph.window_widening_prepare_us +=
|
||||||
lll->slave.window_widening_periodic_us * (p->lazy + 1);
|
lll->periph.window_widening_periodic_us * (p->lazy + 1);
|
||||||
if (lll->slave.window_widening_prepare_us >
|
if (lll->periph.window_widening_prepare_us >
|
||||||
lll->slave.window_widening_max_us) {
|
lll->periph.window_widening_max_us) {
|
||||||
lll->slave.window_widening_prepare_us =
|
lll->periph.window_widening_prepare_us =
|
||||||
lll->slave.window_widening_max_us;
|
lll->periph.window_widening_max_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke common pipeline handling of prepare */
|
/* Invoke common pipeline handling of prepare */
|
||||||
|
@ -140,19 +140,19 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* current window widening */
|
/* current window widening */
|
||||||
lll->slave.window_widening_event_us +=
|
lll->periph.window_widening_event_us +=
|
||||||
lll->slave.window_widening_prepare_us;
|
lll->periph.window_widening_prepare_us;
|
||||||
lll->slave.window_widening_prepare_us = 0;
|
lll->periph.window_widening_prepare_us = 0;
|
||||||
if (lll->slave.window_widening_event_us >
|
if (lll->periph.window_widening_event_us >
|
||||||
lll->slave.window_widening_max_us) {
|
lll->periph.window_widening_max_us) {
|
||||||
lll->slave.window_widening_event_us =
|
lll->periph.window_widening_event_us =
|
||||||
lll->slave.window_widening_max_us;
|
lll->periph.window_widening_max_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* current window size */
|
/* current window size */
|
||||||
lll->slave.window_size_event_us +=
|
lll->periph.window_size_event_us +=
|
||||||
lll->slave.window_size_prepare_us;
|
lll->periph.window_size_prepare_us;
|
||||||
lll->slave.window_size_prepare_us = 0;
|
lll->periph.window_size_prepare_us = 0;
|
||||||
|
|
||||||
/* Start setting up Radio h/w */
|
/* Start setting up Radio h/w */
|
||||||
radio_reset();
|
radio_reset();
|
||||||
|
@ -194,8 +194,8 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
radio_tmr_aa_save(0);
|
radio_tmr_aa_save(0);
|
||||||
|
|
||||||
hcto = remainder_us + EVENT_JITTER_US + (EVENT_JITTER_US << 2) +
|
hcto = remainder_us + EVENT_JITTER_US + (EVENT_JITTER_US << 2) +
|
||||||
(lll->slave.window_widening_event_us << 1) +
|
(lll->periph.window_widening_event_us << 1) +
|
||||||
lll->slave.window_size_event_us;
|
lll->periph.window_size_event_us;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_PHY)
|
#if defined(CONFIG_BT_CTLR_PHY)
|
||||||
hcto += radio_rx_ready_delay_get(lll->phy_rx, 1);
|
hcto += radio_rx_ready_delay_get(lll->phy_rx, 1);
|
|
@ -134,7 +134,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||||
/* Check if stopped (on connection establishment race between LLL and
|
/* Check if stopped (on connection establishment race between LLL and
|
||||||
* ULL.
|
* ULL.
|
||||||
*/
|
*/
|
||||||
if (unlikely(lll->conn && lll->conn->master.initiated)) {
|
if (unlikely(lll->conn && lll->conn->central.initiated)) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = lll_clk_off();
|
err = lll_clk_off();
|
||||||
|
@ -211,7 +211,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
|
||||||
remainder_us = radio_tmr_start(0, ticks_at_start, remainder);
|
remainder_us = radio_tmr_start(0, ticks_at_start, remainder);
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event.
|
* central event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ static void isr_done(void *param)
|
||||||
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event.
|
* central event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ static void isr_window(void *param)
|
||||||
remainder_us = radio_tmr_start_tick(0, ticks_at_start);
|
remainder_us = radio_tmr_start_tick(0, ticks_at_start);
|
||||||
|
|
||||||
/* capture end of Rx-ed PDU, for initiator to calculate first
|
/* capture end of Rx-ed PDU, for initiator to calculate first
|
||||||
* master event.
|
* central event.
|
||||||
*/
|
*/
|
||||||
radio_tmr_end_capture();
|
radio_tmr_end_capture();
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Stop further LLL radio events */
|
/* Stop further LLL radio events */
|
||||||
lll->conn->master.initiated = 1;
|
lll->conn->central.initiated = 1;
|
||||||
|
|
||||||
rx = ull_pdu_rx_alloc();
|
rx = ull_pdu_rx_alloc();
|
||||||
|
|
||||||
|
|
|
@ -456,7 +456,7 @@ enum pdu_data_llctrl_type {
|
||||||
PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP = 0x0B,
|
PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP = 0x0B,
|
||||||
PDU_DATA_LLCTRL_TYPE_VERSION_IND = 0x0C,
|
PDU_DATA_LLCTRL_TYPE_VERSION_IND = 0x0C,
|
||||||
PDU_DATA_LLCTRL_TYPE_REJECT_IND = 0x0D,
|
PDU_DATA_LLCTRL_TYPE_REJECT_IND = 0x0D,
|
||||||
PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ = 0x0E,
|
PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG = 0x0E,
|
||||||
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ = 0x0F,
|
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ = 0x0F,
|
||||||
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP = 0x10,
|
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP = 0x10,
|
||||||
PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND = 0x11,
|
PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND = 0x11,
|
||||||
|
@ -542,7 +542,7 @@ struct pdu_data_llctrl_reject_ind {
|
||||||
uint8_t error_code;
|
uint8_t error_code;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct pdu_data_llctrl_slave_feature_req {
|
struct pdu_data_llctrl_per_init_feat_xchg {
|
||||||
uint8_t features[8];
|
uint8_t features[8];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ struct pdu_data_llctrl {
|
||||||
struct pdu_data_llctrl_pause_enc_rsp pause_enc_rsp;
|
struct pdu_data_llctrl_pause_enc_rsp pause_enc_rsp;
|
||||||
struct pdu_data_llctrl_version_ind version_ind;
|
struct pdu_data_llctrl_version_ind version_ind;
|
||||||
struct pdu_data_llctrl_reject_ind reject_ind;
|
struct pdu_data_llctrl_reject_ind reject_ind;
|
||||||
struct pdu_data_llctrl_slave_feature_req slave_feature_req;
|
struct pdu_data_llctrl_per_init_feat_xchg per_init_feat_xchg;
|
||||||
struct pdu_data_llctrl_conn_param_req conn_param_req;
|
struct pdu_data_llctrl_conn_param_req conn_param_req;
|
||||||
struct pdu_data_llctrl_conn_param_rsp conn_param_rsp;
|
struct pdu_data_llctrl_conn_param_rsp conn_param_rsp;
|
||||||
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind;
|
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind;
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#include "ull_scan_internal.h"
|
#include "ull_scan_internal.h"
|
||||||
#include "ull_sync_internal.h"
|
#include "ull_sync_internal.h"
|
||||||
#include "ull_sync_iso_internal.h"
|
#include "ull_sync_iso_internal.h"
|
||||||
#include "ull_master_internal.h"
|
#include "ull_central_internal.h"
|
||||||
#include "ull_conn_internal.h"
|
#include "ull_conn_internal.h"
|
||||||
#include "lll_conn_iso.h"
|
#include "lll_conn_iso.h"
|
||||||
#include "ull_conn_iso_types.h"
|
#include "ull_conn_iso_types.h"
|
||||||
|
@ -242,7 +242,7 @@
|
||||||
#if defined(CONFIG_BT_CTLR_LOW_LAT) && \
|
#if defined(CONFIG_BT_CTLR_LOW_LAT) && \
|
||||||
(CONFIG_BT_CTLR_LLL_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
|
(CONFIG_BT_CTLR_LLL_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
|
||||||
/* NOTE: When ticker job is disabled inside radio events then all advertising,
|
/* NOTE: When ticker job is disabled inside radio events then all advertising,
|
||||||
* scanning, and slave latency cancel ticker operations will be deferred,
|
* scanning, and peripheral latency cancel ticker operations will be deferred,
|
||||||
* requiring increased ticker thread context operation queue count.
|
* requiring increased ticker thread context operation queue count.
|
||||||
*/
|
*/
|
||||||
#define TICKER_USER_THREAD_OPS (BT_CTLR_ADV_SET + BT_CTLR_SCAN_SET + \
|
#define TICKER_USER_THREAD_OPS (BT_CTLR_ADV_SET + BT_CTLR_SCAN_SET + \
|
||||||
|
@ -1243,7 +1243,7 @@ void ll_rx_mem_release(void **node_rx)
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
} else if (cc->status == BT_HCI_ERR_UNKNOWN_CONN_ID) {
|
} else if (cc->status == BT_HCI_ERR_UNKNOWN_CONN_ID) {
|
||||||
ull_master_cleanup(rx_free);
|
ull_central_cleanup(rx_free);
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||||
#if defined(CONFIG_BT_BROADCASTER)
|
#if defined(CONFIG_BT_BROADCASTER)
|
||||||
|
|
|
@ -983,18 +983,18 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
|
|
||||||
/* FIXME: BEGIN: Move to ULL? */
|
/* FIXME: BEGIN: Move to ULL? */
|
||||||
conn_lll->role = 1;
|
conn_lll->role = 1;
|
||||||
conn_lll->slave.initiated = 0;
|
conn_lll->periph.initiated = 0;
|
||||||
conn_lll->slave.cancelled = 0;
|
conn_lll->periph.cancelled = 0;
|
||||||
conn_lll->data_chan_sel = 0;
|
conn_lll->data_chan_sel = 0;
|
||||||
conn_lll->data_chan_use = 0;
|
conn_lll->data_chan_use = 0;
|
||||||
conn_lll->event_counter = 0;
|
conn_lll->event_counter = 0;
|
||||||
|
|
||||||
conn_lll->latency_prepare = 0;
|
conn_lll->latency_prepare = 0;
|
||||||
conn_lll->latency_event = 0;
|
conn_lll->latency_event = 0;
|
||||||
conn_lll->slave.latency_enabled = 0;
|
conn_lll->periph.latency_enabled = 0;
|
||||||
conn_lll->slave.window_widening_prepare_us = 0;
|
conn_lll->periph.window_widening_prepare_us = 0;
|
||||||
conn_lll->slave.window_widening_event_us = 0;
|
conn_lll->periph.window_widening_event_us = 0;
|
||||||
conn_lll->slave.window_size_prepare_us = 0;
|
conn_lll->periph.window_size_prepare_us = 0;
|
||||||
/* FIXME: END: Move to ULL? */
|
/* FIXME: END: Move to ULL? */
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_META)
|
#if defined(CONFIG_BT_CTLR_CONN_META)
|
||||||
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));
|
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));
|
||||||
|
@ -1020,7 +1020,7 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
|
|
||||||
conn->common.fex_valid = 0;
|
conn->common.fex_valid = 0;
|
||||||
conn->common.txn_lock = 0;
|
conn->common.txn_lock = 0;
|
||||||
conn->slave.latency_cancel = 0;
|
conn->periph.latency_cancel = 0;
|
||||||
|
|
||||||
conn->llcp_req = conn->llcp_ack = conn->llcp_type = 0;
|
conn->llcp_req = conn->llcp_ack = conn->llcp_type = 0;
|
||||||
conn->llcp_rx = NULL;
|
conn->llcp_rx = NULL;
|
||||||
|
@ -1042,14 +1042,14 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
conn->llcp_enc.req = conn->llcp_enc.ack = 0U;
|
conn->llcp_enc.req = conn->llcp_enc.ack = 0U;
|
||||||
conn->llcp_enc.pause_tx = conn->llcp_enc.pause_rx = 0U;
|
conn->llcp_enc.pause_tx = conn->llcp_enc.pause_rx = 0U;
|
||||||
conn->llcp_enc.refresh = 0U;
|
conn->llcp_enc.refresh = 0U;
|
||||||
conn->slave.llcp_type = 0U;
|
conn->periph.llcp_type = 0U;
|
||||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||||
conn->llcp_conn_param.req = 0;
|
conn->llcp_conn_param.req = 0;
|
||||||
conn->llcp_conn_param.ack = 0;
|
conn->llcp_conn_param.ack = 0;
|
||||||
conn->llcp_conn_param.disabled = 0;
|
conn->llcp_conn_param.disabled = 0;
|
||||||
conn->slave.ticks_to_offset = 0;
|
conn->periph.ticks_to_offset = 0;
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
|
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
|
||||||
|
@ -2479,13 +2479,13 @@ static inline uint8_t disable(uint8_t handle)
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
if (adv->lll.conn) {
|
if (adv->lll.conn) {
|
||||||
/* Indicate to LLL that a cancellation is requested */
|
/* Indicate to LLL that a cancellation is requested */
|
||||||
adv->lll.conn->slave.cancelled = 1U;
|
adv->lll.conn->periph.cancelled = 1U;
|
||||||
cpu_dmb();
|
cpu_dmb();
|
||||||
|
|
||||||
/* Check if a connection was initiated (connection
|
/* Check if a connection was initiated (connection
|
||||||
* establishment race between LLL and ULL).
|
* establishment race between LLL and ULL).
|
||||||
*/
|
*/
|
||||||
if (unlikely(adv->lll.conn->slave.initiated)) {
|
if (unlikely(adv->lll.conn->periph.initiated)) {
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "lll_scan.h"
|
#include "lll_scan.h"
|
||||||
#include "lll/lll_df_types.h"
|
#include "lll/lll_df_types.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_master.h"
|
#include "lll_central.h"
|
||||||
#include "lll_filter.h"
|
#include "lll_filter.h"
|
||||||
|
|
||||||
#include "ull_adv_types.h"
|
#include "ull_adv_types.h"
|
||||||
|
@ -45,14 +45,14 @@
|
||||||
#include "ull_chan_internal.h"
|
#include "ull_chan_internal.h"
|
||||||
#include "ull_scan_internal.h"
|
#include "ull_scan_internal.h"
|
||||||
#include "ull_conn_internal.h"
|
#include "ull_conn_internal.h"
|
||||||
#include "ull_master_internal.h"
|
#include "ull_central_internal.h"
|
||||||
|
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "ll_feat.h"
|
#include "ll_feat.h"
|
||||||
#include "ll_settings.h"
|
#include "ll_settings.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||||
#define LOG_MODULE_NAME bt_ctlr_ull_master
|
#define LOG_MODULE_NAME bt_ctlr_ull_central
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
conn_lll->data_chan_sel = 0;
|
conn_lll->data_chan_sel = 0;
|
||||||
conn_lll->data_chan_use = 0;
|
conn_lll->data_chan_use = 0;
|
||||||
conn_lll->role = 0;
|
conn_lll->role = 0;
|
||||||
conn_lll->master.initiated = 0;
|
conn_lll->central.initiated = 0;
|
||||||
conn_lll->master.cancelled = 0;
|
conn_lll->central.cancelled = 0;
|
||||||
/* FIXME: END: Move to ULL? */
|
/* FIXME: END: Move to ULL? */
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_META)
|
#if defined(CONFIG_BT_CTLR_CONN_META)
|
||||||
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));
|
memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta));
|
||||||
|
@ -276,7 +276,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
|
|
||||||
conn->common.fex_valid = 0U;
|
conn->common.fex_valid = 0U;
|
||||||
conn->common.txn_lock = 0U;
|
conn->common.txn_lock = 0U;
|
||||||
conn->master.terminate_ack = 0U;
|
conn->central.terminate_ack = 0U;
|
||||||
|
|
||||||
conn->llcp_req = conn->llcp_ack = conn->llcp_type = 0U;
|
conn->llcp_req = conn->llcp_ack = conn->llcp_type = 0U;
|
||||||
conn->llcp_rx = NULL;
|
conn->llcp_rx = NULL;
|
||||||
|
@ -501,13 +501,13 @@ uint8_t ll_connect_disable(void **rx)
|
||||||
if (!conn_lll) {
|
if (!conn_lll) {
|
||||||
/* Scanning not associated with initiation of a connection or
|
/* Scanning not associated with initiation of a connection or
|
||||||
* connection setup already complete (was set to NULL in
|
* connection setup already complete (was set to NULL in
|
||||||
* ull_master_setup), but HCI event not processed by host.
|
* ull_central_setup), but HCI event not processed by host.
|
||||||
*/
|
*/
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate to LLL that a cancellation is requested */
|
/* Indicate to LLL that a cancellation is requested */
|
||||||
conn_lll->master.cancelled = 1U;
|
conn_lll->central.cancelled = 1U;
|
||||||
cpu_dmb();
|
cpu_dmb();
|
||||||
|
|
||||||
/* Check if connection was established under race condition, i.e.
|
/* Check if connection was established under race condition, i.e.
|
||||||
|
@ -641,7 +641,7 @@ uint8_t ll_enc_req_send(uint16_t handle, uint8_t const *const rand,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||||
|
|
||||||
int ull_master_reset(void)
|
int ull_central_reset(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
void *rx;
|
void *rx;
|
||||||
|
@ -679,7 +679,7 @@ int ull_master_reset(void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ull_master_cleanup(struct node_rx_hdr *rx_free)
|
void ull_central_cleanup(struct node_rx_hdr *rx_free)
|
||||||
{
|
{
|
||||||
struct lll_conn *conn_lll;
|
struct lll_conn *conn_lll;
|
||||||
struct ll_scan_set *scan;
|
struct ll_scan_set *scan;
|
||||||
|
@ -729,7 +729,7 @@ void ull_master_cleanup(struct node_rx_hdr *rx_free)
|
||||||
#endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */
|
#endif /* CONFIG_BT_CTLR_ADV_EXT && CONFIG_BT_CTLR_PHY_CODED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
void ull_central_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
struct lll_conn *lll)
|
struct lll_conn *lll)
|
||||||
{
|
{
|
||||||
uint32_t conn_offset_us, conn_interval_us;
|
uint32_t conn_offset_us, conn_interval_us;
|
||||||
|
@ -915,7 +915,7 @@ void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH,
|
ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH,
|
||||||
TICKER_ID_SCAN_STOP, NULL, NULL);
|
TICKER_ID_SCAN_STOP, NULL, NULL);
|
||||||
|
|
||||||
/* Start master */
|
/* Start central */
|
||||||
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
||||||
ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR,
|
ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR,
|
||||||
TICKER_USER_ID_ULL_HIGH,
|
TICKER_USER_ID_ULL_HIGH,
|
||||||
|
@ -927,7 +927,7 @@ void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
TICKER_NULL_LAZY,
|
TICKER_NULL_LAZY,
|
||||||
(conn->ull.ticks_slot +
|
(conn->ull.ticks_slot +
|
||||||
ticks_slot_overhead),
|
ticks_slot_overhead),
|
||||||
ull_master_ticker_cb, conn, ticker_op_cb,
|
ull_central_ticker_cb, conn, ticker_op_cb,
|
||||||
(void *)__LINE__);
|
(void *)__LINE__);
|
||||||
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
||||||
(ticker_status == TICKER_STATUS_BUSY));
|
(ticker_status == TICKER_STATUS_BUSY));
|
||||||
|
@ -940,12 +940,12 @@ void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ull_master_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
uint32_t remainder, uint16_t lazy, uint8_t force,
|
uint32_t remainder, uint16_t lazy, uint8_t force,
|
||||||
void *param)
|
void *param)
|
||||||
{
|
{
|
||||||
static memq_link_t link;
|
static memq_link_t link;
|
||||||
static struct mayfly mfy = {0, 0, &link, NULL, lll_master_prepare};
|
static struct mayfly mfy = {0, 0, &link, NULL, lll_central_prepare};
|
||||||
static struct lll_prepare_param p;
|
static struct lll_prepare_param p;
|
||||||
struct ll_conn *conn;
|
struct ll_conn *conn;
|
||||||
uint32_t err;
|
uint32_t err;
|
||||||
|
@ -1023,7 +1023,7 @@ void ull_master_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
DEBUG_RADIO_PREPARE_M(1);
|
DEBUG_RADIO_PREPARE_M(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ull_master_chm_update(void)
|
uint8_t ull_central_chm_update(void)
|
||||||
{
|
{
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ull_master_reset(void);
|
int ull_central_reset(void);
|
||||||
void ull_master_cleanup(struct node_rx_hdr *rx_free);
|
void ull_central_cleanup(struct node_rx_hdr *rx_free);
|
||||||
void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
void ull_central_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
struct lll_conn *lll);
|
struct lll_conn *lll);
|
||||||
void ull_master_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
void ull_central_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
uint32_t remainder, uint16_t lazy, uint8_t force,
|
uint32_t remainder, uint16_t lazy, uint8_t force,
|
||||||
void *param);
|
void *param);
|
||||||
uint8_t ull_master_chm_update(void);
|
uint8_t ull_central_chm_update(void);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "ull_adv_types.h"
|
#include "ull_adv_types.h"
|
||||||
|
|
||||||
#include "ull_adv_internal.h"
|
#include "ull_adv_internal.h"
|
||||||
#include "ull_master_internal.h"
|
#include "ull_central_internal.h"
|
||||||
|
|
||||||
/* Initial channel map indicating Used and Unused data channels.
|
/* Initial channel map indicating Used and Unused data channels.
|
||||||
* The HCI LE Set Host Channel Classification command allows the Host to
|
* The HCI LE Set Host Channel Classification command allows the Host to
|
||||||
|
@ -45,7 +45,7 @@ uint8_t ll_chm_update(uint8_t const *const chm)
|
||||||
chan_map_set(chm);
|
chan_map_set(chm);
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
(void)ull_master_chm_update();
|
(void)ull_central_chm_update();
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
|
#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
#include "ull_sched_internal.h"
|
#include "ull_sched_internal.h"
|
||||||
#include "ull_chan_internal.h"
|
#include "ull_chan_internal.h"
|
||||||
#include "ull_conn_internal.h"
|
#include "ull_conn_internal.h"
|
||||||
#include "ull_slave_internal.h"
|
#include "ull_periph_internal.h"
|
||||||
#include "ull_master_internal.h"
|
#include "ull_central_internal.h"
|
||||||
|
|
||||||
#include "ull_iso_internal.h"
|
#include "ull_iso_internal.h"
|
||||||
#include "ull_conn_iso_internal.h"
|
#include "ull_conn_iso_internal.h"
|
||||||
|
@ -320,7 +320,7 @@ int ll_tx_mem_enqueue(uint16_t handle, void *tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_THROUGHPUT)
|
#if defined(CONFIG_BT_CTLR_THROUGHPUT)
|
||||||
|
@ -423,7 +423,7 @@ uint8_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, uint16_t in
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) &&
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) &&
|
||||||
conn->lll.role) {
|
conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason)
|
||||||
conn->llcp_terminate.req++; /* (req - ack) == 1, TERM_REQ */
|
conn->llcp_terminate.req++; /* (req - ack) == 1, TERM_REQ */
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -516,9 +516,9 @@ uint8_t ll_feature_req_send(uint16_t handle)
|
||||||
conn->llcp_feature.req++;
|
conn->llcp_feature.req++;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) &&
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) &&
|
||||||
IS_ENABLED(CONFIG_BT_CTLR_SLAVE_FEAT_REQ) &&
|
IS_ENABLED(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) &&
|
||||||
conn->lll.role) {
|
conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -540,7 +540,7 @@ uint8_t ll_version_ind_send(uint16_t handle)
|
||||||
conn->llcp_version.req++;
|
conn->llcp_version.req++;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -593,7 +593,7 @@ uint32_t ll_length_req_send(uint16_t handle, uint16_t tx_octets, uint16_t tx_tim
|
||||||
conn->llcp_length.req++;
|
conn->llcp_length.req++;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -687,7 +687,7 @@ uint8_t ll_phy_req_send(uint16_t handle, uint8_t tx, uint8_t flags, uint8_t rx)
|
||||||
conn->llcp_phy.req++;
|
conn->llcp_phy.req++;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) {
|
||||||
ull_slave_latency_cancel(conn, handle);
|
ull_periph_latency_cancel(conn, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -761,7 +761,7 @@ int ull_conn_reset(void)
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
/* Reset initiator */
|
/* Reset initiator */
|
||||||
(void)ull_master_reset();
|
(void)ull_central_reset();
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
for (handle = 0U; handle < CONFIG_BT_MAX_CONN; handle++) {
|
for (handle = 0U; handle < CONFIG_BT_MAX_CONN; handle++) {
|
||||||
|
@ -937,7 +937,7 @@ int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire, uint16_t lazy)
|
||||||
if ((conn->llcp_ack == conn->llcp_req) &&
|
if ((conn->llcp_ack == conn->llcp_req) &&
|
||||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
(!conn->lll.role || (conn->slave.llcp_type == LLCP_NONE)) &&
|
(!conn->lll.role || (conn->periph.llcp_type == LLCP_NONE)) &&
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
!conn->llcp_enc.pause_rx) {
|
!conn->llcp_enc.pause_rx) {
|
||||||
#else /* !CONFIG_BT_CTLR_LE_ENC */
|
#else /* !CONFIG_BT_CTLR_LE_ENC */
|
||||||
|
@ -1096,8 +1096,8 @@ int ull_conn_llcp(struct ll_conn *conn, uint32_t ticks_at_expire, uint16_t lazy)
|
||||||
/* Run any pending local peripheral role initiated procedure stored when
|
/* Run any pending local peripheral role initiated procedure stored when
|
||||||
* peer central initiated a encryption procedure
|
* peer central initiated a encryption procedure
|
||||||
*/
|
*/
|
||||||
if (conn->lll.role && (conn->slave.llcp_type != LLCP_NONE)) {
|
if (conn->lll.role && (conn->periph.llcp_type != LLCP_NONE)) {
|
||||||
switch (conn->slave.llcp_type) {
|
switch (conn->periph.llcp_type) {
|
||||||
case LLCP_CONN_UPD:
|
case LLCP_CONN_UPD:
|
||||||
{
|
{
|
||||||
if (event_conn_upd_prep(conn, lazy,
|
if (event_conn_upd_prep(conn, lazy,
|
||||||
|
@ -1265,7 +1265,7 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
(((conn->llcp_terminate.req -
|
(((conn->llcp_terminate.req -
|
||||||
conn->llcp_terminate.ack) & 0xFF) ==
|
conn->llcp_terminate.ack) & 0xFF) ==
|
||||||
TERM_ACKED) ||
|
TERM_ACKED) ||
|
||||||
conn->master.terminate_ack ||
|
conn->central.terminate_ack ||
|
||||||
(reason_final == BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL)
|
(reason_final == BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL)
|
||||||
#else /* CONFIG_BT_CENTRAL */
|
#else /* CONFIG_BT_CENTRAL */
|
||||||
1
|
1
|
||||||
|
@ -1287,8 +1287,8 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
#endif
|
#endif
|
||||||
elapsed_event = latency_event + 1;
|
elapsed_event = latency_event + 1;
|
||||||
|
|
||||||
/* Slave drift compensation calc and new latency or
|
/* Peripheral drift compensation calc and new latency or
|
||||||
* master terminate acked
|
* central terminate acked
|
||||||
*/
|
*/
|
||||||
ticks_drift_plus = 0U;
|
ticks_drift_plus = 0U;
|
||||||
ticks_drift_minus = 0U;
|
ticks_drift_minus = 0U;
|
||||||
|
@ -1307,14 +1307,14 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
lll->memq_tx.tail,
|
lll->memq_tx.tail,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
lll->latency_event = 0;
|
lll->latency_event = 0;
|
||||||
} else if (lll->slave.latency_enabled) {
|
} else if (lll->periph.latency_enabled) {
|
||||||
lll->latency_event = lll->latency;
|
lll->latency_event = lll->latency;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
} else if (reason_final) {
|
} else if (reason_final) {
|
||||||
conn->master.terminate_ack = 1;
|
conn->central.terminate_ack = 1;
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1358,26 +1358,26 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
/* break latency */
|
/* break latency */
|
||||||
lll->latency_event = 0U;
|
lll->latency_event = 0U;
|
||||||
|
|
||||||
/* Force both master and slave when close to
|
/* Force both central and peripheral when close to
|
||||||
* supervision timeout.
|
* supervision timeout.
|
||||||
*/
|
*/
|
||||||
if (conn->supervision_expire <= 6U) {
|
if (conn->supervision_expire <= 6U) {
|
||||||
force = 1U;
|
force = 1U;
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE)
|
#if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE)
|
||||||
/* use randomness to force slave role when anchor
|
/* use randomness to force peripheral role when anchor
|
||||||
* points are being missed.
|
* points are being missed.
|
||||||
*/
|
*/
|
||||||
else if (lll->role) {
|
else if (lll->role) {
|
||||||
if (latency_event) {
|
if (latency_event) {
|
||||||
force = 1U;
|
force = 1U;
|
||||||
} else {
|
} else {
|
||||||
force = conn->slave.force & 0x01;
|
force = conn->periph.force & 0x01;
|
||||||
|
|
||||||
/* rotate force bits */
|
/* rotate force bits */
|
||||||
conn->slave.force >>= 1U;
|
conn->periph.force >>= 1U;
|
||||||
if (force) {
|
if (force) {
|
||||||
conn->slave.force |= BIT(31);
|
conn->periph.force |= BIT(31);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1487,9 +1487,9 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
uint32_t ticker_status;
|
uint32_t ticker_status;
|
||||||
|
|
||||||
/* Call to ticker_update can fail under the race
|
/* Call to ticker_update can fail under the race
|
||||||
* condition where in the Slave role is being stopped but
|
* condition where in the peripheral role is being stopped but
|
||||||
* at the same time it is preempted by Slave event that
|
* at the same time it is preempted by peripheral event that
|
||||||
* gets into close state. Accept failure when Slave role
|
* gets into close state. Accept failure when peripheral role
|
||||||
* is being stopped.
|
* is being stopped.
|
||||||
*/
|
*/
|
||||||
ticker_status = ticker_update(TICKER_INSTANCE_ID_CTLR,
|
ticker_status = ticker_update(TICKER_INSTANCE_ID_CTLR,
|
||||||
|
@ -1862,7 +1862,7 @@ static struct node_tx *tx_ull_dequeue(struct ll_conn *conn, struct node_tx *tx)
|
||||||
|
|
||||||
static void ticker_update_conn_op_cb(uint32_t status, void *param)
|
static void ticker_update_conn_op_cb(uint32_t status, void *param)
|
||||||
{
|
{
|
||||||
/* Slave drift compensation succeeds, or it fails in a race condition
|
/* Peripheral drift compensation succeeds, or it fails in a race condition
|
||||||
* when disconnecting or connection update (race between ticker_update
|
* when disconnecting or connection update (race between ticker_update
|
||||||
* and ticker_stop calls).
|
* and ticker_stop calls).
|
||||||
*/
|
*/
|
||||||
|
@ -1907,13 +1907,13 @@ static void conn_setup_adv_scan_disabled_cb(void *param)
|
||||||
switch (lll->role) {
|
switch (lll->role) {
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
case 0:
|
case 0:
|
||||||
ull_master_setup(rx, ftr, lll);
|
ull_central_setup(rx, ftr, lll);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
case 1:
|
case 1:
|
||||||
ull_slave_setup(rx, ftr, lll);
|
ull_periph_setup(rx, ftr, lll);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
|
@ -1979,7 +1979,7 @@ static void conn_cleanup_finalize(struct ll_conn *conn)
|
||||||
/* flush demux-ed Tx buffer still in ULL context */
|
/* flush demux-ed Tx buffer still in ULL context */
|
||||||
tx_ull_flush(conn);
|
tx_ull_flush(conn);
|
||||||
|
|
||||||
/* Stop Master or Slave role ticker */
|
/* Stop Central or Peripheral role ticker */
|
||||||
ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR,
|
ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR,
|
||||||
TICKER_USER_ID_ULL_HIGH,
|
TICKER_USER_ID_ULL_HIGH,
|
||||||
TICKER_ID_CONN_BASE + lll->handle,
|
TICKER_ID_CONN_BASE + lll->handle,
|
||||||
|
@ -2525,7 +2525,7 @@ static inline void event_conn_upd_init(struct ll_conn *conn,
|
||||||
uint32_t retval;
|
uint32_t retval;
|
||||||
|
|
||||||
/* calculate window offset that places the connection in the
|
/* calculate window offset that places the connection in the
|
||||||
* next available slot after existing masters.
|
* next available slot after existing centrals.
|
||||||
*/
|
*/
|
||||||
conn->llcp.conn_upd.ticks_anchor = ticks_at_expire;
|
conn->llcp.conn_upd.ticks_anchor = ticks_at_expire;
|
||||||
|
|
||||||
|
@ -2688,12 +2688,12 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
||||||
uint16_t latency;
|
uint16_t latency;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
if (conn->lll.role && (conn->slave.llcp_type != LLCP_NONE)) {
|
if (conn->lll.role && (conn->periph.llcp_type != LLCP_NONE)) {
|
||||||
/* Local peripheral initiated connection update
|
/* Local peripheral initiated connection update
|
||||||
* completed while a remote central had initiated
|
* completed while a remote central had initiated
|
||||||
* encryption procedure
|
* encryption procedure
|
||||||
*/
|
*/
|
||||||
conn->slave.llcp_type = LLCP_NONE;
|
conn->periph.llcp_type = LLCP_NONE;
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
||||||
{
|
{
|
||||||
|
@ -2797,39 +2797,39 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
||||||
if (0) {
|
if (0) {
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
} else if (lll->role) {
|
} else if (lll->role) {
|
||||||
lll->slave.window_widening_prepare_us -=
|
lll->periph.window_widening_prepare_us -=
|
||||||
lll->slave.window_widening_periodic_us *
|
lll->periph.window_widening_periodic_us *
|
||||||
instant_latency;
|
instant_latency;
|
||||||
|
|
||||||
lll->slave.window_widening_periodic_us =
|
lll->periph.window_widening_periodic_us =
|
||||||
(((lll_clock_ppm_local_get() +
|
(((lll_clock_ppm_local_get() +
|
||||||
lll_clock_ppm_get(conn->slave.sca)) *
|
lll_clock_ppm_get(conn->periph.sca)) *
|
||||||
conn_interval_us) + (1000000 - 1)) / 1000000U;
|
conn_interval_us) + (1000000 - 1)) / 1000000U;
|
||||||
lll->slave.window_widening_max_us =
|
lll->periph.window_widening_max_us =
|
||||||
(conn_interval_us >> 1) - EVENT_IFS_US;
|
(conn_interval_us >> 1) - EVENT_IFS_US;
|
||||||
lll->slave.window_size_prepare_us =
|
lll->periph.window_size_prepare_us =
|
||||||
conn->llcp_cu.win_size * CONN_INT_UNIT_US;
|
conn->llcp_cu.win_size * CONN_INT_UNIT_US;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||||
conn->slave.ticks_to_offset = 0U;
|
conn->periph.ticks_to_offset = 0U;
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||||
|
|
||||||
lll->slave.window_widening_prepare_us +=
|
lll->periph.window_widening_prepare_us +=
|
||||||
lll->slave.window_widening_periodic_us *
|
lll->periph.window_widening_periodic_us *
|
||||||
latency;
|
latency;
|
||||||
if (lll->slave.window_widening_prepare_us >
|
if (lll->periph.window_widening_prepare_us >
|
||||||
lll->slave.window_widening_max_us) {
|
lll->periph.window_widening_max_us) {
|
||||||
lll->slave.window_widening_prepare_us =
|
lll->periph.window_widening_prepare_us =
|
||||||
lll->slave.window_widening_max_us;
|
lll->periph.window_widening_max_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks_at_expire -= HAL_TICKER_US_TO_TICKS(
|
ticks_at_expire -= HAL_TICKER_US_TO_TICKS(
|
||||||
lll->slave.window_widening_periodic_us *
|
lll->periph.window_widening_periodic_us *
|
||||||
latency);
|
latency);
|
||||||
ticks_win_offset = HAL_TICKER_US_TO_TICKS(
|
ticks_win_offset = HAL_TICKER_US_TO_TICKS(
|
||||||
(conn->llcp_cu.win_offset_us /
|
(conn->llcp_cu.win_offset_us /
|
||||||
CONN_INT_UNIT_US) * CONN_INT_UNIT_US);
|
CONN_INT_UNIT_US) * CONN_INT_UNIT_US);
|
||||||
periodic_us -= lll->slave.window_widening_periodic_us;
|
periodic_us -= lll->periph.window_widening_periodic_us;
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
|
@ -2885,7 +2885,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
||||||
0);
|
0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* start slave/master with new timings */
|
/* start peripheral/central with new timings */
|
||||||
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
||||||
ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR,
|
ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR,
|
||||||
TICKER_USER_ID_ULL_HIGH,
|
TICKER_USER_ID_ULL_HIGH,
|
||||||
|
@ -2909,12 +2909,12 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy,
|
||||||
(ticks_slot_overhead +
|
(ticks_slot_overhead +
|
||||||
conn->ull.ticks_slot),
|
conn->ull.ticks_slot),
|
||||||
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL)
|
||||||
lll->role ? ull_slave_ticker_cb :
|
lll->role ? ull_periph_ticker_cb :
|
||||||
ull_master_ticker_cb,
|
ull_central_ticker_cb,
|
||||||
#elif defined(CONFIG_BT_PERIPHERAL)
|
#elif defined(CONFIG_BT_PERIPHERAL)
|
||||||
ull_slave_ticker_cb,
|
ull_periph_ticker_cb,
|
||||||
#else
|
#else
|
||||||
ull_master_ticker_cb,
|
ull_central_ticker_cb,
|
||||||
#endif
|
#endif
|
||||||
conn, ticker_start_conn_op_cb,
|
conn, ticker_start_conn_op_cb,
|
||||||
(void *)conn);
|
(void *)conn);
|
||||||
|
@ -2974,12 +2974,12 @@ static inline void event_ch_map_prep(struct ll_conn *conn,
|
||||||
struct lll_conn *lll = &conn->lll;
|
struct lll_conn *lll = &conn->lll;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
if (conn->lll.role && (conn->slave.llcp_type != LLCP_NONE)) {
|
if (conn->lll.role && (conn->periph.llcp_type != LLCP_NONE)) {
|
||||||
/* Local peripheral initiated channel map update
|
/* Local peripheral initiated channel map update
|
||||||
* completed while a remote central had initiated
|
* completed while a remote central had initiated
|
||||||
* encryption procedure
|
* encryption procedure
|
||||||
*/
|
*/
|
||||||
conn->slave.llcp_type = LLCP_NONE;
|
conn->periph.llcp_type = LLCP_NONE;
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
||||||
{
|
{
|
||||||
|
@ -3095,7 +3095,7 @@ static inline void event_enc_prep(struct ll_conn *conn)
|
||||||
|
|
||||||
pdu_ctrl_tx = (void *)tx->pdu;
|
pdu_ctrl_tx = (void *)tx->pdu;
|
||||||
|
|
||||||
/* master sends encrypted enc start rsp in control priority */
|
/* central sends encrypted enc start rsp in control priority */
|
||||||
if (!lll->role) {
|
if (!lll->role) {
|
||||||
/* calc the Session Key */
|
/* calc the Session Key */
|
||||||
ecb_encrypt(&conn->llcp_enc.ltk[0],
|
ecb_encrypt(&conn->llcp_enc.ltk[0],
|
||||||
|
@ -3114,8 +3114,8 @@ static inline void event_enc_prep(struct ll_conn *conn)
|
||||||
lll->ccm_rx.counter = 0;
|
lll->ccm_rx.counter = 0;
|
||||||
lll->ccm_tx.counter = 0;
|
lll->ccm_tx.counter = 0;
|
||||||
|
|
||||||
/* set direction: slave to master = 0,
|
/* set direction: peripheral to central = 0,
|
||||||
* master to slave = 1
|
* central to peripheral = 1
|
||||||
*/
|
*/
|
||||||
lll->ccm_rx.direction = 0;
|
lll->ccm_rx.direction = 0;
|
||||||
lll->ccm_tx.direction = 1;
|
lll->ccm_tx.direction = 1;
|
||||||
|
@ -3129,7 +3129,7 @@ static inline void event_enc_prep(struct ll_conn *conn)
|
||||||
ctrl_tx_enqueue(conn, tx);
|
ctrl_tx_enqueue(conn, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* slave send reject ind or start enc req at control priority */
|
/* peripheral send reject ind or start enc req at control priority */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_FAST_ENC)
|
#if defined(CONFIG_BT_CTLR_FAST_ENC)
|
||||||
else {
|
else {
|
||||||
|
@ -3168,14 +3168,14 @@ static inline void event_enc_prep(struct ll_conn *conn)
|
||||||
lll->ccm_rx.counter = 0U;
|
lll->ccm_rx.counter = 0U;
|
||||||
lll->ccm_tx.counter = 0U;
|
lll->ccm_tx.counter = 0U;
|
||||||
|
|
||||||
/* set direction: slave to master = 0,
|
/* set direction: peripheral to central = 0,
|
||||||
* master to slave = 1
|
* central to peripheral = 1
|
||||||
*/
|
*/
|
||||||
lll->ccm_rx.direction = 1U;
|
lll->ccm_rx.direction = 1U;
|
||||||
lll->ccm_tx.direction = 0U;
|
lll->ccm_tx.direction = 0U;
|
||||||
|
|
||||||
/* enable receive encryption (transmit turned
|
/* enable receive encryption (transmit turned
|
||||||
* on when start enc resp from master is
|
* on when start enc resp from central is
|
||||||
* received)
|
* received)
|
||||||
*/
|
*/
|
||||||
lll->enc_rx = 1U;
|
lll->enc_rx = 1U;
|
||||||
|
@ -3260,7 +3260,7 @@ static inline void event_fex_prep(struct ll_conn *conn)
|
||||||
sizeof(struct pdu_data_llctrl_feature_req);
|
sizeof(struct pdu_data_llctrl_feature_req);
|
||||||
pdu->llctrl.opcode = !conn->lll.role ?
|
pdu->llctrl.opcode = !conn->lll.role ?
|
||||||
PDU_DATA_LLCTRL_TYPE_FEATURE_REQ :
|
PDU_DATA_LLCTRL_TYPE_FEATURE_REQ :
|
||||||
PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ;
|
PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG;
|
||||||
(void)memset(&pdu->llctrl.feature_req.features[0],
|
(void)memset(&pdu->llctrl.feature_req.features[0],
|
||||||
0x00,
|
0x00,
|
||||||
sizeof(pdu->llctrl.feature_req.features));
|
sizeof(pdu->llctrl.feature_req.features));
|
||||||
|
@ -3459,7 +3459,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* master/slave response with reject ext ind */
|
/* central/peripheral response with reject ext ind */
|
||||||
pdu = (void *)tx->pdu;
|
pdu = (void *)tx->pdu;
|
||||||
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
pdu->ll_id = PDU_DATA_LLID_CTRL;
|
||||||
pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;
|
pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;
|
||||||
|
@ -3481,7 +3481,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* master respond with connection update */
|
/* central respond with connection update */
|
||||||
if (!conn->lll.role) {
|
if (!conn->lll.role) {
|
||||||
uint16_t interval_max;
|
uint16_t interval_max;
|
||||||
uint8_t preferred_periodicity;
|
uint8_t preferred_periodicity;
|
||||||
|
@ -3520,7 +3520,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* slave response with connection parameter response */
|
/* peripheral response with connection parameter response */
|
||||||
tx = mem_acquire(&mem_conn_tx_ctrl.free);
|
tx = mem_acquire(&mem_conn_tx_ctrl.free);
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
return;
|
return;
|
||||||
|
@ -4170,11 +4170,11 @@ static inline void event_phy_upd_ind_prep(struct ll_conn *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
if (conn->lll.role && (conn->slave.llcp_type != LLCP_NONE)) {
|
if (conn->lll.role && (conn->periph.llcp_type != LLCP_NONE)) {
|
||||||
/* Local peripheral initiated PHY update completed while
|
/* Local peripheral initiated PHY update completed while
|
||||||
* a remote central had initiated encryption procedure
|
* a remote central had initiated encryption procedure
|
||||||
*/
|
*/
|
||||||
conn->slave.llcp_type = LLCP_NONE;
|
conn->periph.llcp_type = LLCP_NONE;
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
#endif /* CONFIG_BT_PERIPHERAL && CONFIG_BT_CTLR_LE_ENC */
|
||||||
{
|
{
|
||||||
|
@ -4334,8 +4334,8 @@ static uint8_t conn_upd_recv(struct ll_conn *conn, memq_link_t *link,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||||
/* Set CPR mutex, if only not already set. As a master the mutex shall
|
/* Set CPR mutex, if only not already set. As a central the mutex shall
|
||||||
* be set, but a slave we accept it as new 'set' of mutex.
|
* be set, but a peripheral we accept it as new 'set' of mutex.
|
||||||
*/
|
*/
|
||||||
cpr_active_check_and_set(conn);
|
cpr_active_check_and_set(conn);
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||||
|
@ -4488,7 +4488,7 @@ static int enc_rsp_send(struct ll_conn *conn)
|
||||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.skds) +
|
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.skds) +
|
||||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.ivs));
|
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.ivs));
|
||||||
|
|
||||||
/* things from slave stored for session key calculation */
|
/* things from peripheral stored for session key calculation */
|
||||||
memcpy(&conn->llcp.encryption.skd[8],
|
memcpy(&conn->llcp.encryption.skd[8],
|
||||||
&pdu_ctrl_tx->llctrl.enc_rsp.skds[0], 8);
|
&pdu_ctrl_tx->llctrl.enc_rsp.skds[0], 8);
|
||||||
memcpy(&conn->lll.ccm_rx.iv[4],
|
memcpy(&conn->lll.ccm_rx.iv[4],
|
||||||
|
@ -4619,7 +4619,7 @@ static inline uint64_t feat_land_octet0(uint64_t feat_to_keep,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_PERIPHERAL) || \
|
#if defined(CONFIG_BT_PERIPHERAL) || \
|
||||||
(defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ))
|
(defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG))
|
||||||
static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
||||||
struct pdu_data *pdu_rx)
|
struct pdu_data *pdu_rx)
|
||||||
{
|
{
|
||||||
|
@ -4672,9 +4672,9 @@ static int feature_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* PERIPHERAL || (CENTRAL && SLAVE_FEAT_REQ) */
|
#endif /* PERIPHERAL || (CENTRAL && PER_INIT_FEAT_XCHG) */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ)
|
#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG)
|
||||||
static void feature_rsp_recv(struct ll_conn *conn, struct pdu_data *pdu_rx)
|
static void feature_rsp_recv(struct ll_conn *conn, struct pdu_data *pdu_rx)
|
||||||
{
|
{
|
||||||
struct pdu_data_llctrl_feature_rsp *rsp;
|
struct pdu_data_llctrl_feature_rsp *rsp;
|
||||||
|
@ -4698,7 +4698,7 @@ static void feature_rsp_recv(struct ll_conn *conn, struct pdu_data *pdu_rx)
|
||||||
conn->llcp_feature.ack = conn->llcp_feature.req;
|
conn->llcp_feature.ack = conn->llcp_feature.req;
|
||||||
conn->procedure_expire = 0U;
|
conn->procedure_expire = 0U;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_CTLR_SLAVE_FEAT_REQ */
|
#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
static int pause_enc_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
static int pause_enc_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
||||||
|
@ -4874,7 +4874,7 @@ static inline int reject_ind_conn_upd_recv(struct ll_conn *conn,
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
/* update to next ticks offset */
|
/* update to next ticks offset */
|
||||||
if (lll->role) {
|
if (lll->role) {
|
||||||
conn->slave.ticks_to_offset =
|
conn->periph.ticks_to_offset =
|
||||||
conn->llcp_conn_param.ticks_to_offset_next;
|
conn->llcp_conn_param.ticks_to_offset_next;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
@ -5460,7 +5460,7 @@ static int phy_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for peer master to complete the procedure */
|
/* Wait for peer central to complete the procedure */
|
||||||
conn->llcp_phy.state = LLCP_PHY_STATE_RSP_WAIT;
|
conn->llcp_phy.state = LLCP_PHY_STATE_RSP_WAIT;
|
||||||
if (conn->llcp_phy.ack ==
|
if (conn->llcp_phy.ack ==
|
||||||
conn->llcp_phy.req) {
|
conn->llcp_phy.req) {
|
||||||
|
@ -5795,7 +5795,7 @@ static inline void ctrl_tx_ack(struct ll_conn *conn, struct node_tx **tx,
|
||||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
|
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
|
||||||
/* things from master stored for session key calculation */
|
/* things from central stored for session key calculation */
|
||||||
memcpy(&conn->llcp.encryption.skd[0],
|
memcpy(&conn->llcp.encryption.skd[0],
|
||||||
&pdu_tx->llctrl.enc_req.skdm[0], 8);
|
&pdu_tx->llctrl.enc_req.skdm[0], 8);
|
||||||
memcpy(&conn->lll.ccm_rx.iv[0],
|
memcpy(&conn->lll.ccm_rx.iv[0],
|
||||||
|
@ -6101,8 +6101,8 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
conn->llcp_ack += 2U;
|
conn->llcp_ack += 2U;
|
||||||
|
|
||||||
/* Store the local peripheral initiated procedure */
|
/* Store the local peripheral initiated procedure */
|
||||||
LL_ASSERT(conn->slave.llcp_type == LLCP_NONE);
|
LL_ASSERT(conn->periph.llcp_type == LLCP_NONE);
|
||||||
conn->slave.llcp_type = conn->llcp_type;
|
conn->periph.llcp_type = conn->llcp_type;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CTLR_PHY */
|
#endif /* CONFIG_BT_CTLR_PHY */
|
||||||
|
|
||||||
|
@ -6125,7 +6125,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
conn->llcp_enc.ediv[0] = pdu_rx->llctrl.enc_req.ediv[0];
|
conn->llcp_enc.ediv[0] = pdu_rx->llctrl.enc_req.ediv[0];
|
||||||
conn->llcp_enc.ediv[1] = pdu_rx->llctrl.enc_req.ediv[1];
|
conn->llcp_enc.ediv[1] = pdu_rx->llctrl.enc_req.ediv[1];
|
||||||
|
|
||||||
/* Enc rsp to be scheduled in master prepare */
|
/* Enc rsp to be scheduled in central prepare */
|
||||||
conn->llcp.encryption.state = LLCP_ENC_STATE_INIT;
|
conn->llcp.encryption.state = LLCP_ENC_STATE_INIT;
|
||||||
|
|
||||||
/* Mark for buffer for release */
|
/* Mark for buffer for release */
|
||||||
|
@ -6136,7 +6136,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
conn->llcp_type = LLCP_ENCRYPTION;
|
conn->llcp_type = LLCP_ENCRYPTION;
|
||||||
conn->llcp_ack -= 2U;
|
conn->llcp_ack -= 2U;
|
||||||
|
|
||||||
/* things from master stored for session key calculation */
|
/* things from central stored for session key calculation */
|
||||||
memcpy(&conn->llcp.encryption.skd[0],
|
memcpy(&conn->llcp.encryption.skd[0],
|
||||||
&pdu_rx->llctrl.enc_req.skdm[0], 8);
|
&pdu_rx->llctrl.enc_req.skdm[0], 8);
|
||||||
memcpy(&conn->lll.ccm_rx.iv[0],
|
memcpy(&conn->lll.ccm_rx.iv[0],
|
||||||
|
@ -6160,7 +6160,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
goto ull_conn_rx_unknown_rsp_send;
|
goto ull_conn_rx_unknown_rsp_send;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* things sent by slave stored for session key calculation */
|
/* things sent by peripheral stored for session key calculation */
|
||||||
memcpy(&conn->llcp.encryption.skd[8],
|
memcpy(&conn->llcp.encryption.skd[8],
|
||||||
&pdu_rx->llctrl.enc_rsp.skds[0], 8);
|
&pdu_rx->llctrl.enc_rsp.skds[0], 8);
|
||||||
memcpy(&conn->lll.ccm_rx.iv[4],
|
memcpy(&conn->lll.ccm_rx.iv[4],
|
||||||
|
@ -6181,7 +6181,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
goto ull_conn_rx_unknown_rsp_send;
|
goto ull_conn_rx_unknown_rsp_send;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start enc rsp to be scheduled in master prepare */
|
/* start enc rsp to be scheduled in central prepare */
|
||||||
conn->llcp.encryption.state = LLCP_ENC_STATE_INPROG;
|
conn->llcp.encryption.state = LLCP_ENC_STATE_INPROG;
|
||||||
|
|
||||||
/* Mark for buffer for release */
|
/* Mark for buffer for release */
|
||||||
|
@ -6199,7 +6199,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
|
|
||||||
if (conn->lll.role) {
|
if (conn->lll.role) {
|
||||||
#if !defined(CONFIG_BT_CTLR_FAST_ENC)
|
#if !defined(CONFIG_BT_CTLR_FAST_ENC)
|
||||||
/* start enc rsp to be scheduled in slave prepare */
|
/* start enc rsp to be scheduled in peripheral prepare */
|
||||||
conn->llcp.encryption.state = LLCP_ENC_STATE_INPROG;
|
conn->llcp.encryption.state = LLCP_ENC_STATE_INPROG;
|
||||||
|
|
||||||
#else /* CONFIG_BT_CTLR_FAST_ENC */
|
#else /* CONFIG_BT_CTLR_FAST_ENC */
|
||||||
|
@ -6242,20 +6242,20 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ)
|
#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG)
|
||||||
case PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ:
|
case PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG:
|
||||||
if (conn->lll.role ||
|
if (conn->lll.role ||
|
||||||
PDU_DATA_LLCTRL_LEN(slave_feature_req) != pdu_rx->len) {
|
PDU_DATA_LLCTRL_LEN(per_init_feat_xchg) != pdu_rx->len) {
|
||||||
goto ull_conn_rx_unknown_rsp_send;
|
goto ull_conn_rx_unknown_rsp_send;
|
||||||
}
|
}
|
||||||
|
|
||||||
nack = feature_rsp_send(conn, *rx, pdu_rx);
|
nack = feature_rsp_send(conn, *rx, pdu_rx);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_SLAVE_FEAT_REQ */
|
#endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ)
|
#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG)
|
||||||
case PDU_DATA_LLCTRL_TYPE_FEATURE_RSP:
|
case PDU_DATA_LLCTRL_TYPE_FEATURE_RSP:
|
||||||
if ((!IS_ENABLED(CONFIG_BT_CTLR_SLAVE_FEAT_REQ) &&
|
if ((!IS_ENABLED(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) &&
|
||||||
conn->lll.role) ||
|
conn->lll.role) ||
|
||||||
PDU_DATA_LLCTRL_LEN(feature_rsp) != pdu_rx->len) {
|
PDU_DATA_LLCTRL_LEN(feature_rsp) != pdu_rx->len) {
|
||||||
goto ull_conn_rx_unknown_rsp_send;
|
goto ull_conn_rx_unknown_rsp_send;
|
||||||
|
@ -6263,7 +6263,7 @@ static inline int ctrl_rx(memq_link_t *link, struct node_rx_pdu **rx,
|
||||||
|
|
||||||
feature_rsp_recv(conn, pdu_rx);
|
feature_rsp_recv(conn, pdu_rx);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_CTLR_SLAVE_FEAT_REQ */
|
#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
|
|
|
@ -89,7 +89,7 @@ struct ll_conn {
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||||
uint32_t ticks_to_offset;
|
uint32_t ticks_to_offset;
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||||
} slave;
|
} periph;
|
||||||
#endif /* CONFIG_BT_PERIPHERAL */
|
#endif /* CONFIG_BT_PERIPHERAL */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
|
@ -100,7 +100,7 @@ struct ll_conn {
|
||||||
uint8_t is_must_expire:1;
|
uint8_t is_must_expire:1;
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_META */
|
#endif /* CONFIG_BT_CTLR_CONN_META */
|
||||||
uint8_t terminate_ack:1;
|
uint8_t terminate_ack:1;
|
||||||
} master;
|
} central;
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
subsys/bluetooth/controller/ll_sw/ull_periph_internal.h
Normal file
12
subsys/bluetooth/controller/ll_sw/ull_periph_internal.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
void ull_periph_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
|
struct lll_conn *lll);
|
||||||
|
void ull_periph_latency_cancel(struct ll_conn *conn, uint16_t handle);
|
||||||
|
void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
|
uint32_t remainder, uint16_t lazy, uint8_t force,
|
||||||
|
void *param);
|
|
@ -31,7 +31,7 @@
|
||||||
#include "lll/lll_adv_pdu.h"
|
#include "lll/lll_adv_pdu.h"
|
||||||
#include "lll_chan.h"
|
#include "lll_chan.h"
|
||||||
#include "lll_conn.h"
|
#include "lll_conn.h"
|
||||||
#include "lll_slave.h"
|
#include "lll_peripheral.h"
|
||||||
#include "lll_filter.h"
|
#include "lll_filter.h"
|
||||||
#include "lll/lll_df_types.h"
|
#include "lll/lll_df_types.h"
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
#include "ull_internal.h"
|
#include "ull_internal.h"
|
||||||
#include "ull_adv_internal.h"
|
#include "ull_adv_internal.h"
|
||||||
#include "ull_conn_internal.h"
|
#include "ull_conn_internal.h"
|
||||||
#include "ull_slave_internal.h"
|
#include "ull_periph_internal.h"
|
||||||
|
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
|
|
||||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||||
#define LOG_MODULE_NAME bt_ctlr_ull_slave
|
#define LOG_MODULE_NAME bt_ctlr_ull_periph
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static void ticker_op_cb(uint32_t status, void *param);
|
||||||
static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status,
|
static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status,
|
||||||
void *param);
|
void *param);
|
||||||
|
|
||||||
void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
void ull_periph_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
struct lll_conn *lll)
|
struct lll_conn *lll)
|
||||||
{
|
{
|
||||||
uint32_t conn_offset_us, conn_interval_us;
|
uint32_t conn_offset_us, conn_interval_us;
|
||||||
|
@ -85,7 +85,7 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
adv = ((struct lll_adv *)ftr->param)->hdr.parent;
|
adv = ((struct lll_adv *)ftr->param)->hdr.parent;
|
||||||
conn = lll->hdr.parent;
|
conn = lll->hdr.parent;
|
||||||
|
|
||||||
/* Populate the slave context */
|
/* Populate the peripheral context */
|
||||||
pdu_adv = (void *)((struct node_rx_pdu *)rx)->pdu;
|
pdu_adv = (void *)((struct node_rx_pdu *)rx)->pdu;
|
||||||
|
|
||||||
peer_addr_type = pdu_adv->tx_addr;
|
peer_addr_type = pdu_adv->tx_addr;
|
||||||
|
@ -173,14 +173,14 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate the window widening */
|
/* calculate the window widening */
|
||||||
conn->slave.sca = pdu_adv->connect_ind.sca;
|
conn->periph.sca = pdu_adv->connect_ind.sca;
|
||||||
lll->slave.window_widening_periodic_us =
|
lll->periph.window_widening_periodic_us =
|
||||||
(((lll_clock_ppm_local_get() +
|
(((lll_clock_ppm_local_get() +
|
||||||
lll_clock_ppm_get(conn->slave.sca)) *
|
lll_clock_ppm_get(conn->periph.sca)) *
|
||||||
conn_interval_us) + (1000000 - 1)) / 1000000U;
|
conn_interval_us) + (1000000 - 1)) / 1000000U;
|
||||||
lll->slave.window_widening_max_us = (conn_interval_us >> 1) -
|
lll->periph.window_widening_max_us = (conn_interval_us >> 1) -
|
||||||
EVENT_IFS_US;
|
EVENT_IFS_US;
|
||||||
lll->slave.window_size_event_us = pdu_adv->connect_ind.win_size *
|
lll->periph.window_size_event_us = pdu_adv->connect_ind.win_size *
|
||||||
CONN_INT_UNIT_US;
|
CONN_INT_UNIT_US;
|
||||||
|
|
||||||
/* procedure timeouts */
|
/* procedure timeouts */
|
||||||
|
@ -204,8 +204,8 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
#endif /* CONFIG_BT_CTLR_LE_PING */
|
#endif /* CONFIG_BT_CTLR_LE_PING */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE)
|
#if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE)
|
||||||
memcpy((void *)&conn->slave.force, &lll->access_addr[0],
|
memcpy((void *)&conn->periph.force, &lll->access_addr[0],
|
||||||
sizeof(conn->slave.force));
|
sizeof(conn->periph.force));
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_RANDOM_FORCE */
|
#endif /* CONFIG_BT_CTLR_CONN_RANDOM_FORCE */
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
|
@ -243,7 +243,7 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
cc->interval = lll->interval;
|
cc->interval = lll->interval;
|
||||||
cc->latency = lll->latency;
|
cc->latency = lll->latency;
|
||||||
cc->timeout = timeout;
|
cc->timeout = timeout;
|
||||||
cc->sca = conn->slave.sca;
|
cc->sca = conn->periph.sca;
|
||||||
|
|
||||||
lll->handle = ll_conn_handle_get(conn);
|
lll->handle = ll_conn_handle_get(conn);
|
||||||
rx->handle = lll->handle;
|
rx->handle = lll->handle;
|
||||||
|
@ -358,7 +358,7 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
}
|
}
|
||||||
ticks_slot_offset += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
|
ticks_slot_offset += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
|
||||||
|
|
||||||
conn_interval_us -= lll->slave.window_widening_periodic_us;
|
conn_interval_us -= lll->periph.window_widening_periodic_us;
|
||||||
|
|
||||||
conn_offset_us = ftr->radio_end_us;
|
conn_offset_us = ftr->radio_end_us;
|
||||||
conn_offset_us += win_offset * CONN_INT_UNIT_US;
|
conn_offset_us += win_offset * CONN_INT_UNIT_US;
|
||||||
|
@ -411,7 +411,7 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
TICKER_ID_ADV_STOP, NULL, NULL);
|
TICKER_ID_ADV_STOP, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start Slave */
|
/* Start Peripheral */
|
||||||
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn);
|
||||||
ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR,
|
ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR,
|
||||||
TICKER_USER_ID_ULL_HIGH,
|
TICKER_USER_ID_ULL_HIGH,
|
||||||
|
@ -423,7 +423,7 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
TICKER_NULL_LAZY,
|
TICKER_NULL_LAZY,
|
||||||
(conn->ull.ticks_slot +
|
(conn->ull.ticks_slot +
|
||||||
ticks_slot_overhead),
|
ticks_slot_overhead),
|
||||||
ull_slave_ticker_cb, conn, ticker_op_cb,
|
ull_periph_ticker_cb, conn, ticker_op_cb,
|
||||||
(void *)__LINE__);
|
(void *)__LINE__);
|
||||||
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
||||||
(ticker_status == TICKER_STATUS_BUSY));
|
(ticker_status == TICKER_STATUS_BUSY));
|
||||||
|
@ -436,13 +436,13 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ull_slave_latency_cancel(struct ll_conn *conn, uint16_t handle)
|
void ull_periph_latency_cancel(struct ll_conn *conn, uint16_t handle)
|
||||||
{
|
{
|
||||||
/* break peripheral latency */
|
/* break peripheral latency */
|
||||||
if (conn->lll.latency_event && !conn->slave.latency_cancel) {
|
if (conn->lll.latency_event && !conn->periph.latency_cancel) {
|
||||||
uint32_t ticker_status;
|
uint32_t ticker_status;
|
||||||
|
|
||||||
conn->slave.latency_cancel = 1U;
|
conn->periph.latency_cancel = 1U;
|
||||||
|
|
||||||
ticker_status =
|
ticker_status =
|
||||||
ticker_update(TICKER_INSTANCE_ID_CTLR,
|
ticker_update(TICKER_INSTANCE_ID_CTLR,
|
||||||
|
@ -456,12 +456,12 @@ void ull_slave_latency_cancel(struct ll_conn *conn, uint16_t handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ull_slave_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
void ull_periph_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
||||||
uint32_t remainder, uint16_t lazy, uint8_t force,
|
uint32_t remainder, uint16_t lazy, uint8_t force,
|
||||||
void *param)
|
void *param)
|
||||||
{
|
{
|
||||||
static memq_link_t link;
|
static memq_link_t link;
|
||||||
static struct mayfly mfy = {0, 0, &link, NULL, lll_slave_prepare};
|
static struct mayfly mfy = {0, 0, &link, NULL, lll_periph_prepare};
|
||||||
static struct lll_prepare_param p;
|
static struct lll_prepare_param p;
|
||||||
struct ll_conn *conn;
|
struct ll_conn *conn;
|
||||||
uint32_t err;
|
uint32_t err;
|
||||||
|
@ -587,7 +587,7 @@ static void invalid_release(struct ull_hdr *hdr, struct lll_conn *lll,
|
||||||
hdr->disabled_cb = NULL;
|
hdr->disabled_cb = NULL;
|
||||||
|
|
||||||
/* Let the advertiser continue with connectable advertising */
|
/* Let the advertiser continue with connectable advertising */
|
||||||
lll->slave.initiated = 0U;
|
lll->periph.initiated = 0U;
|
||||||
|
|
||||||
/* Mark for buffer for release */
|
/* Mark for buffer for release */
|
||||||
rx->type = NODE_RX_TYPE_RELEASE;
|
rx->type = NODE_RX_TYPE_RELEASE;
|
||||||
|
@ -637,5 +637,5 @@ static void ticker_update_latency_cancel_op_cb(uint32_t ticker_status,
|
||||||
|
|
||||||
LL_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
LL_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
||||||
|
|
||||||
conn->slave.latency_cancel = 0U;
|
conn->periph.latency_cancel = 0U;
|
||||||
}
|
}
|
|
@ -416,7 +416,7 @@ uint8_t ull_scan_enable(struct ll_scan_set *scan)
|
||||||
&ticks_ref, &offset_us);
|
&ticks_ref, &offset_us);
|
||||||
|
|
||||||
/* Use the ticks_ref as scanner's anchor if a free time space
|
/* Use the ticks_ref as scanner's anchor if a free time space
|
||||||
* after any master role is available (indicated by a non-zero
|
* after any central role is available (indicated by a non-zero
|
||||||
* offset_us value).
|
* offset_us value).
|
||||||
*/
|
*/
|
||||||
if (offset_us) {
|
if (offset_us) {
|
||||||
|
|
|
@ -229,7 +229,7 @@ void ull_sched_mfy_free_win_offset_calc(void *param)
|
||||||
#if defined(CONFIG_BT_PERIPHERAL)
|
#if defined(CONFIG_BT_PERIPHERAL)
|
||||||
if (conn->lll.role) {
|
if (conn->lll.role) {
|
||||||
conn->llcp_conn_param.ticks_to_offset_next =
|
conn->llcp_conn_param.ticks_to_offset_next =
|
||||||
conn->slave.ticks_to_offset;
|
conn->periph.ticks_to_offset;
|
||||||
|
|
||||||
ticks_to_offset_next =
|
ticks_to_offset_next =
|
||||||
&conn->llcp_conn_param.ticks_to_offset_next;
|
&conn->llcp_conn_param.ticks_to_offset_next;
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018-2019 Nordic Semiconductor ASA
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
|
||||||
struct lll_conn *lll);
|
|
||||||
void ull_slave_latency_cancel(struct ll_conn *conn, uint16_t handle);
|
|
||||||
void ull_slave_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
|
|
||||||
uint32_t remainder, uint16_t lazy, uint8_t force,
|
|
||||||
void *param);
|
|
|
@ -55,7 +55,7 @@ struct ticker_node {
|
||||||
* skipping
|
* skipping
|
||||||
*/
|
*/
|
||||||
uint16_t lazy_current; /* Current number of timeouts
|
uint16_t lazy_current; /* Current number of timeouts
|
||||||
* skipped = slave latency
|
* skipped = peripheral latency
|
||||||
*/
|
*/
|
||||||
union {
|
union {
|
||||||
uint32_t remainder_periodic;/* Sub-microsecond tick remainder
|
uint32_t remainder_periodic;/* Sub-microsecond tick remainder
|
||||||
|
@ -151,7 +151,7 @@ struct ticker_user_op_update {
|
||||||
* slot reservation (air-time)
|
* slot reservation (air-time)
|
||||||
*/
|
*/
|
||||||
#endif /* CONFIG_BT_TICKER_SLOT_AGNOSTIC */
|
#endif /* CONFIG_BT_TICKER_SLOT_AGNOSTIC */
|
||||||
uint16_t lazy; /* Slave latency:
|
uint16_t lazy; /* Peripheral latency:
|
||||||
* 0: Do nothing
|
* 0: Do nothing
|
||||||
* 1: latency = 0
|
* 1: latency = 0
|
||||||
* >1: latency = lazy - 1
|
* >1: latency = lazy - 1
|
||||||
|
|
|
@ -4,7 +4,7 @@ CONFIG_BT_LL_SW_SPLIT=y
|
||||||
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
|
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
|
||||||
CONFIG_BT_CTLR_CONN_PARAM_REQ=n
|
CONFIG_BT_CTLR_CONN_PARAM_REQ=n
|
||||||
CONFIG_BT_CTLR_EXT_REJ_IND=n
|
CONFIG_BT_CTLR_EXT_REJ_IND=n
|
||||||
CONFIG_BT_CTLR_SLAVE_FEAT_REQ=n
|
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=n
|
||||||
CONFIG_BT_CTLR_LE_PING=n
|
CONFIG_BT_CTLR_LE_PING=n
|
||||||
CONFIG_BT_CTLR_PRIVACY=n
|
CONFIG_BT_CTLR_PRIVACY=n
|
||||||
CONFIG_BT_CTLR_EXT_SCAN_FP=n
|
CONFIG_BT_CTLR_EXT_SCAN_FP=n
|
||||||
|
|
|
@ -35,7 +35,7 @@ CONFIG_BT_CTLR_PRIVACY=n
|
||||||
CONFIG_BT_CTLR_DTM_HCI=n
|
CONFIG_BT_CTLR_DTM_HCI=n
|
||||||
CONFIG_BT_CTLR_EXT_SCAN_FP=n
|
CONFIG_BT_CTLR_EXT_SCAN_FP=n
|
||||||
CONFIG_BT_DATA_LEN_UPDATE=n
|
CONFIG_BT_DATA_LEN_UPDATE=n
|
||||||
CONFIG_BT_CTLR_SLAVE_FEAT_REQ=n
|
CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=n
|
||||||
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
|
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
|
||||||
CONFIG_BT_CTLR_FILTER_ACCEPT_LIST=n
|
CONFIG_BT_CTLR_FILTER_ACCEPT_LIST=n
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue