diff --git a/doc/releases/release-notes-2.7.rst b/doc/releases/release-notes-2.7.rst index 4d668d58c73..219b0ef4648 100644 --- a/doc/releases/release-notes-2.7.rst +++ b/doc/releases/release-notes-2.7.rst @@ -81,6 +81,10 @@ Modified in this release * The ``CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY`` Kconfig option is now :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 ========================== diff --git a/subsys/bluetooth/controller/CMakeLists.txt b/subsys/bluetooth/controller/CMakeLists.txt index 96085ce052b..e0b2d8bf4eb 100644 --- a/subsys/bluetooth/controller/CMakeLists.txt +++ b/subsys/bluetooth/controller/CMakeLists.txt @@ -73,7 +73,7 @@ if(CONFIG_BT_LL_SW_SPLIT) ) if(CONFIG_BT_PERIPHERAL) zephyr_library_sources( - ll_sw/ull_slave.c + ll_sw/ull_peripheral.c ) zephyr_library_sources_ifdef( CONFIG_BT_CTLR_PERIPHERAL_ISO @@ -82,7 +82,7 @@ if(CONFIG_BT_LL_SW_SPLIT) endif() if(CONFIG_BT_CENTRAL) zephyr_library_sources( - ll_sw/ull_master.c + ll_sw/ull_central.c ) zephyr_library_sources_ifdef( CONFIG_BT_CTLR_CENTRAL_ISO diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 94be2a087b4..37de921aef9 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -17,7 +17,7 @@ config BT_CTLR_CONN_PARAM_REQ_SUPPORT config BT_CTLR_EXT_REJ_IND_SUPPORT bool -config BT_CTLR_SLAVE_FEAT_REQ_SUPPORT +config BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT bool 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 in the Controller. -config BT_CTLR_SLAVE_FEAT_REQ - bool "Slave-initiated Features Exchange" - depends on BT_CTLR_SLAVE_FEAT_REQ_SUPPORT +config BT_CTLR_PER_INIT_FEAT_XCHG + bool "Peripheral-initiated Features Exchange" + depends on BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT default y 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. config BT_CTLR_LE_PING diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index ff4650fa10b..ec2eaedea07 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -18,7 +18,7 @@ config BT_LLL_VENDOR_NORDIC !BT_CTLR_PHY_2M_NRF select BT_CTLR_CONN_PARAM_REQ_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 || \ BT_CTLR_DATA_LENGTH_CLEAR 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 default y if !(BT_PERIPHERAL && !BT_CENTRAL) 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 - connection parameter request in slave role to negotiate - non-overlapping placement with active master roles to avoid slave - roles drifting into active master roles in the local controller. + connection parameter request in peripheral role to negotiate + non-overlapping placement with active central roles to avoid peripheral + roles drifting into active central roles in the local controller. This feature maximizes the average data transmission amongst active - concurrent master and slave connections while other observer, - initiator, master or slave roles are active in the local controller. + concurrent central and peripheral connections while other observer, + initiator, central or peripheral roles are active in the local controller. Disabling this feature will lead to overlapping role in timespace leading to skipped events amongst active roles. diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 38b7a6bb10e..55ede5d577c 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -6345,7 +6345,7 @@ static void le_unknown_rsp(struct pdu_data *pdu_data, uint16_t handle, { 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, NULL, handle, buf); break; diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index b5159951a73..69d3a9b1ac9 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -25,11 +25,11 @@ #define LL_FEAT_BIT_EXT_REJ_IND 0 #endif /* !CONFIG_BT_CTLR_EXT_REJ_IND */ -#if defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ) -#define LL_FEAT_BIT_SLAVE_FEAT_REQ BIT64(BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG) -#else /* !CONFIG_BT_CTLR_SLAVE_FEAT_REQ */ -#define LL_FEAT_BIT_SLAVE_FEAT_REQ 0 -#endif /* !CONFIG_BT_CTLR_SLAVE_FEAT_REQ */ +#if defined(CONFIG_BT_CTLR_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_PER_INIT_FEAT_XCHG */ +#define LL_FEAT_BIT_PER_INIT_FEAT_XCHG 0 +#endif /* !CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG */ #if defined(CONFIG_BT_CTLR_LE_PING) #define LL_FEAT_BIT_PING BIT64(BT_LE_FEAT_BIT_PING) @@ -205,7 +205,7 @@ #define LL_FEAT (LL_FEAT_BIT_ENC | \ LL_FEAT_BIT_CONN_PARAM_REQ | \ 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_DLE | \ LL_FEAT_BIT_PRIVACY | \ diff --git a/subsys/bluetooth/controller/ll_sw/lll_central.h b/subsys/bluetooth/controller/ll_sw/lll_central.h index 64d73c1a171..26dba15cb7d 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_central.h +++ b/subsys/bluetooth/controller/ll_sw/lll_central.h @@ -4,6 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -int lll_master_init(void); -int lll_master_reset(void); -void lll_master_prepare(void *param); +int lll_central_init(void); +int lll_central_reset(void); +void lll_central_prepare(void *param); diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn.h b/subsys/bluetooth/controller/ll_sw/lll_conn.h index c1340b6a935..2b4f29440a2 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn.h @@ -60,7 +60,7 @@ struct lll_conn { struct { uint8_t initiated:1; uint8_t cancelled:1; - } master; + } central; #if defined(CONFIG_BT_PERIPHERAL) struct { uint8_t initiated:1; @@ -73,7 +73,7 @@ struct lll_conn { uint32_t window_widening_event_us; uint32_t window_size_prepare_us; uint32_t window_size_event_us; - } slave; + } periph; #endif /* CONFIG_BT_PERIPHERAL */ }; diff --git a/subsys/bluetooth/controller/ll_sw/lll_slave.h b/subsys/bluetooth/controller/ll_sw/lll_peripheral.h similarity index 52% rename from subsys/bluetooth/controller/ll_sw/lll_slave.h rename to subsys/bluetooth/controller/ll_sw/lll_peripheral.h index 668f41fed6a..81f083bea6c 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_slave.h +++ b/subsys/bluetooth/controller/ll_sw/lll_peripheral.h @@ -4,6 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -int lll_slave_init(void); -int lll_slave_reset(void); -void lll_slave_prepare(void *param); +int lll_periph_init(void); +int lll_periph_reset(void); +void lll_periph_prepare(void *param); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 78e60ce8ce2..dfe1b2cc866 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -856,7 +856,7 @@ static int prepare_cb(struct lll_prepare_param *p) * transmitting connectable advertising event if cancelled flag is set. */ 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_disable(); @@ -1091,7 +1091,7 @@ static void isr_tx(void *param) radio_tmr_hcto_configure(hcto); /* capture end of CONNECT_IND PDU, used for calculating first - * slave event. + * peripheral event. */ radio_tmr_end_capture(); @@ -1205,7 +1205,7 @@ static void isr_done(void *param) */ if (lll->chan_map_curr && #if defined(CONFIG_BT_PERIPHERAL) - (!lll->conn || !lll->conn->slave.cancelled) && + (!lll->conn || !lll->conn->periph.cancelled) && #endif /* CONFIG_BT_PERIPHERAL */ 1) { 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) && (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, rx_addr, tgt_addr, devmatch_ok, &rl_idx)) { @@ -1481,7 +1481,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, #endif /* CONFIG_BT_CTLR_CONN_RSSI */ /* Stop further LLL radio events */ - lll->conn->slave.initiated = 1; + lll->conn->periph.initiated = 1; rx = ull_pdu_rx_alloc(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index 99fc3270b47..a021247436f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -333,7 +333,7 @@ static void isr_tx(void *param) radio_tmr_hcto_configure(hcto); /* capture end of CONNECT_IND PDU, used for calculating first - * slave event. + * peripheral event. */ radio_tmr_end_capture(); @@ -664,7 +664,7 @@ static void isr_tx_connect_rsp(void *param) if (is_done) { /* Stop further LLL radio events */ - lll->conn->slave.initiated = 1; + lll->conn->periph.initiated = 1; } /* Clear radio status and events */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index b10dfe235b9..c2faa5f32a2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -25,14 +25,14 @@ #include "lll_clock.h" #include "lll_df_types.h" #include "lll_conn.h" -#include "lll_master.h" +#include "lll_central.h" #include "lll_chan.h" #include "lll_internal.h" #include "lll_tim_internal.h" #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 #include "hal/debug.h" @@ -40,7 +40,7 @@ static int init_reset(void); static int prepare_cb(struct lll_prepare_param *p); -int lll_master_init(void) +int lll_central_init(void) { int err; @@ -52,7 +52,7 @@ int lll_master_init(void) return 0; } -int lll_master_reset(void) +int lll_central_reset(void) { int err; @@ -64,7 +64,7 @@ int lll_master_reset(void) return 0; } -void lll_master_prepare(void *param) +void lll_central_prepare(void *param) { int err; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index fbab141ba33..3b254d3aac0 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -256,7 +256,7 @@ void lll_conn_isr_rx(void *param) if (0) { #if defined(CONFIG_BT_CENTRAL) - /* Event done for master */ + /* Event done for central */ } else if (!lll->role) { radio_disable(); @@ -271,7 +271,7 @@ void lll_conn_isr_rx(void *param) goto lll_conn_isr_rx_exit; #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) - /* Event done for slave */ + /* Event done for peripheral */ } else { radio_switch_complete_and_disable(); #endif /* CONFIG_BT_PERIPHERAL */ @@ -660,12 +660,12 @@ static void isr_done(void *param) e->drift.start_to_address_actual_us = radio_tmr_aa_restore() - radio_tmr_ready_get(); 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; /* Reset window widening, as anchor point sync-ed */ - lll->slave.window_widening_event_us = 0; - lll->slave.window_size_event_us = 0; + lll->periph.window_widening_event_us = 0; + lll->periph.window_size_event_us = 0; } } #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) /* First ack (and redundantly any other ack) enable use of - * slave latency. + * peripheral latency. */ if (lll->role) { - lll->slave.latency_enabled = 1; + lll->periph.latency_enabled = 1; } #endif /* CONFIG_BT_PERIPHERAL */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_slave.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c similarity index 86% rename from subsys/bluetooth/controller/ll_sw/nordic/lll/lll_slave.c rename to subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 4b31cb68436..6cc6a53cb4d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_slave.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -22,14 +22,14 @@ #include "lll_vendor.h" #include "lll_clock.h" #include "lll_conn.h" -#include "lll_slave.h" +#include "lll_peripheral.h" #include "lll_chan.h" #include "lll_internal.h" #include "lll_tim_internal.h" #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 #include "hal/debug.h" @@ -37,7 +37,7 @@ static int init_reset(void); static int prepare_cb(struct lll_prepare_param *p); -int lll_slave_init(void) +int lll_periph_init(void) { int err; @@ -49,7 +49,7 @@ int lll_slave_init(void) return 0; } -int lll_slave_reset(void) +int lll_periph_reset(void) { int err; @@ -61,7 +61,7 @@ int lll_slave_reset(void) return 0; } -void lll_slave_prepare(void *param) +void lll_periph_prepare(void *param) { struct lll_prepare_param *p; struct lll_conn *lll; @@ -75,12 +75,12 @@ void lll_slave_prepare(void *param) lll = p->param; /* Accumulate window widening */ - lll->slave.window_widening_prepare_us += - lll->slave.window_widening_periodic_us * (p->lazy + 1); - if (lll->slave.window_widening_prepare_us > - lll->slave.window_widening_max_us) { - lll->slave.window_widening_prepare_us = - lll->slave.window_widening_max_us; + lll->periph.window_widening_prepare_us += + lll->periph.window_widening_periodic_us * (p->lazy + 1); + if (lll->periph.window_widening_prepare_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_prepare_us = + lll->periph.window_widening_max_us; } /* Invoke common pipeline handling of prepare */ @@ -151,19 +151,19 @@ static int prepare_cb(struct lll_prepare_param *p) } /* current window widening */ - lll->slave.window_widening_event_us += - lll->slave.window_widening_prepare_us; - lll->slave.window_widening_prepare_us = 0; - if (lll->slave.window_widening_event_us > - lll->slave.window_widening_max_us) { - lll->slave.window_widening_event_us = - lll->slave.window_widening_max_us; + lll->periph.window_widening_event_us += + lll->periph.window_widening_prepare_us; + lll->periph.window_widening_prepare_us = 0; + if (lll->periph.window_widening_event_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_event_us = + lll->periph.window_widening_max_us; } /* current window size */ - lll->slave.window_size_event_us += - lll->slave.window_size_prepare_us; - lll->slave.window_size_prepare_us = 0; + lll->periph.window_size_event_us += + lll->periph.window_size_prepare_us; + lll->periph.window_size_prepare_us = 0; /* 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 @@ -227,8 +227,8 @@ static int prepare_cb(struct lll_prepare_param *p) hcto = remainder_us + ((EVENT_JITTER_US + EVENT_TICKER_RES_MARGIN_US + - lll->slave.window_widening_event_us) << 1) + - lll->slave.window_size_event_us; + lll->periph.window_widening_event_us) << 1) + + lll->periph.window_size_event_us; #if defined(CONFIG_BT_CTLR_PHY) hcto += radio_rx_ready_delay_get(lll->phy_rx, 1); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index 9e52c273270..d53556fe077 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -328,8 +328,8 @@ static int common_prepare_cb(struct lll_prepare_param *p, bool is_resume) */ if (unlikely(lll->is_stop || (lll->conn && - (lll->conn->master.initiated || - lll->conn->master.cancelled)))) { + (lll->conn->central.initiated || + lll->conn->central.cancelled)))) { radio_isr_set(lll_isr_early_abort, lll); 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); /* 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. */ radio_tmr_end_capture(); @@ -573,7 +573,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) if (0) { #if defined(CONFIG_BT_CENTRAL) } 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()) { cpu_sleep(); } @@ -826,7 +826,7 @@ static void isr_done(void *param) #endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */ /* capture end of Rx-ed PDU, for initiator to calculate first - * master event. + * central event. */ radio_tmr_end_capture(); } @@ -873,7 +873,7 @@ static void isr_window(void *param) #endif /* !CONFIG_BT_CENTRAL */ /* capture end of Rx-ed PDU, for initiator to calculate first - * master event. + * central event. */ 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 * 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) && isr_scan_init_check(lll, pdu_adv_rx, rl_idx)) { 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 * event aborted before connect_rsp is received. */ - lll->conn->master.initiated = 1U; + lll->conn->central.initiated = 1U; /* Stop further initiating events */ lll->is_stop = 1U; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 6c04a11b717..20f5ef64bb2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -278,8 +278,8 @@ static int prepare_cb(struct lll_prepare_param *p) */ if (unlikely(scan_lll->is_stop || (scan_lll->conn && - (scan_lll->conn->master.initiated || - scan_lll->conn->master.cancelled)))) { + (scan_lll->conn->central.initiated || + scan_lll->conn->central.cancelled)))) { radio_isr_set(isr_early_abort, lll); radio_disable(); @@ -739,7 +739,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, if (0) { #if defined(CONFIG_BT_CENTRAL) /* 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) && lll_scan_ext_tgta_check(lll, false, true, pdu, 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 */ - lll->conn->master.initiated = 1U; + lll->conn->central.initiated = 1U; /* Stop further initiating events */ lll->is_stop = 1U; @@ -1287,7 +1287,7 @@ static void isr_rx_connect_rsp(void *param) struct node_rx_ftr *ftr; /* Try again with connection initiation */ - lll->conn->master.initiated = 0U; + lll->conn->central.initiated = 0U; /* Dont stop initiating events on primary channels */ lll->is_stop = 0U; diff --git a/subsys/bluetooth/controller/ll_sw/nrf.cmake b/subsys/bluetooth/controller/ll_sw/nrf.cmake index bbf8d439b13..3e4cc528ffb 100644 --- a/subsys/bluetooth/controller/ll_sw/nrf.cmake +++ b/subsys/bluetooth/controller/ll_sw/nrf.cmake @@ -37,11 +37,11 @@ if(CONFIG_BT_LL_SW_SPLIT) ) zephyr_library_sources_ifdef( CONFIG_BT_PERIPHERAL - ll_sw/nordic/lll/lll_slave.c + ll_sw/nordic/lll/lll_peripheral.c ) zephyr_library_sources_ifdef( CONFIG_BT_CENTRAL - ll_sw/nordic/lll/lll_master.c + ll_sw/nordic/lll/lll_central.c ) endif() zephyr_library_sources_ifdef( diff --git a/subsys/bluetooth/controller/ll_sw/openisa.cmake b/subsys/bluetooth/controller/ll_sw/openisa.cmake index aa0dadd194d..97db02624f9 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa.cmake +++ b/subsys/bluetooth/controller/ll_sw/openisa.cmake @@ -21,12 +21,12 @@ if(CONFIG_BT_LL_SW_SPLIT) ) if(CONFIG_BT_PERIPHERAL) zephyr_library_sources( - ll_sw/openisa/lll/lll_slave.c + ll_sw/openisa/lll/lll_peripheral.c ) endif() if(CONFIG_BT_CENTRAL) zephyr_library_sources( - ll_sw/openisa/lll/lll_master.c + ll_sw/openisa/lll/lll_central.c ) endif() endif() diff --git a/subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/radio/radio.c b/subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/radio/radio.c index 2ad0a81f024..87d9dfe9342 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/hal/RV32M1/radio/radio.c @@ -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.nonce.counter = ccm->counter; /* LSO to MSO, counter is LE */ /* 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; 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)); 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 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; memcpy(&ctx_ccm.nonce.bytes[5], ccm->iv, 8); /* LSO to MSO */ diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c index e38025b1af9..12245a60758 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c @@ -329,7 +329,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param) /* Check if stopped (on connection establishment race between LLL and * ULL. */ - if (unlikely(lll->conn && lll->conn->master.initiated)) { + if (unlikely(lll->conn && lll->conn->central.initiated)) { int err; err = lll_clk_off(); @@ -557,7 +557,7 @@ static void isr_tx(void *param) radio_tmr_hcto_configure(hcto); /* capture end of CONNECT_IND PDU, used for calculating first - * slave event. + * peripheral event. */ radio_tmr_end_capture(); @@ -925,7 +925,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, } #endif /* CONFIG_BT_CTLR_CONN_RSSI */ /* Stop further LLL radio events */ - lll->conn->master.initiated = 1; + lll->conn->central.initiated = 1; rx = ull_pdu_rx_alloc(); diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_central.c index 50c41e21889..a1ee38c3dfa 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_central.c @@ -21,13 +21,13 @@ #include "lll.h" #include "lll_vendor.h" #include "lll_conn.h" -#include "lll_master.h" +#include "lll_central.h" #include "lll_chan.h" #include "lll_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 #include "hal/debug.h" @@ -35,7 +35,7 @@ static int init_reset(void); static int prepare_cb(struct lll_prepare_param *p); -int lll_master_init(void) +int lll_central_init(void) { int err; @@ -47,7 +47,7 @@ int lll_master_init(void) return 0; } -int lll_master_reset(void) +int lll_central_reset(void) { int err; @@ -59,7 +59,7 @@ int lll_master_reset(void) return 0; } -void lll_master_prepare(void *param) +void lll_central_prepare(void *param) { int err; diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_conn.c index c864bf27c3c..46005582db8 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_conn.c @@ -202,7 +202,7 @@ void lll_conn_isr_rx(void *param) if (0) { #if defined(CONFIG_BT_CENTRAL) - /* Event done for master */ + /* Event done for central */ } else if (!lll->role) { radio_disable(); @@ -217,7 +217,7 @@ void lll_conn_isr_rx(void *param) goto lll_conn_isr_rx_exit; #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) - /* Event done for slave */ + /* Event done for peripheral */ } else { radio_switch_complete_and_disable(); #endif /* CONFIG_BT_PERIPHERAL */ @@ -605,12 +605,12 @@ static void isr_done(void *param) e->drift.start_to_address_actual_us = radio_tmr_aa_restore() - radio_tmr_ready_get(); 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; /* Reset window widening, as anchor point sync-ed */ - lll->slave.window_widening_event_us = 0; - lll->slave.window_size_event_us = 0; + lll->periph.window_widening_event_us = 0; + lll->periph.window_size_event_us = 0; } } #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) /* First ack (and redundantly any other ack) enable use of - * slave latency. + * peripheral latency. */ if (lll->role) { - lll->slave.latency_enabled = 1; + lll->periph.latency_enabled = 1; } #endif /* CONFIG_BT_PERIPHERAL */ diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_slave.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_peripheral.c similarity index 84% rename from subsys/bluetooth/controller/ll_sw/openisa/lll/lll_slave.c rename to subsys/bluetooth/controller/ll_sw/openisa/lll/lll_peripheral.c index 8ea9861ac0c..6754777091e 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_slave.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_peripheral.c @@ -21,13 +21,13 @@ #include "lll.h" #include "lll_vendor.h" #include "lll_conn.h" -#include "lll_slave.h" +#include "lll_peripheral.h" #include "lll_chan.h" #include "lll_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 #include "hal/debug.h" @@ -35,7 +35,7 @@ static int init_reset(void); static int prepare_cb(struct lll_prepare_param *p); -int lll_slave_init(void) +int lll_periph_init(void) { int err; @@ -47,7 +47,7 @@ int lll_slave_init(void) return 0; } -int lll_slave_reset(void) +int lll_periph_reset(void) { int err; @@ -59,7 +59,7 @@ int lll_slave_reset(void) return 0; } -void lll_slave_prepare(void *param) +void lll_periph_prepare(void *param) { struct lll_prepare_param *p; struct lll_conn *lll; @@ -73,12 +73,12 @@ void lll_slave_prepare(void *param) lll = p->param; /* Accumulate window widening */ - lll->slave.window_widening_prepare_us += - lll->slave.window_widening_periodic_us * (p->lazy + 1); - if (lll->slave.window_widening_prepare_us > - lll->slave.window_widening_max_us) { - lll->slave.window_widening_prepare_us = - lll->slave.window_widening_max_us; + lll->periph.window_widening_prepare_us += + lll->periph.window_widening_periodic_us * (p->lazy + 1); + if (lll->periph.window_widening_prepare_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_prepare_us = + lll->periph.window_widening_max_us; } /* Invoke common pipeline handling of prepare */ @@ -140,19 +140,19 @@ static int prepare_cb(struct lll_prepare_param *p) } /* current window widening */ - lll->slave.window_widening_event_us += - lll->slave.window_widening_prepare_us; - lll->slave.window_widening_prepare_us = 0; - if (lll->slave.window_widening_event_us > - lll->slave.window_widening_max_us) { - lll->slave.window_widening_event_us = - lll->slave.window_widening_max_us; + lll->periph.window_widening_event_us += + lll->periph.window_widening_prepare_us; + lll->periph.window_widening_prepare_us = 0; + if (lll->periph.window_widening_event_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_event_us = + lll->periph.window_widening_max_us; } /* current window size */ - lll->slave.window_size_event_us += - lll->slave.window_size_prepare_us; - lll->slave.window_size_prepare_us = 0; + lll->periph.window_size_event_us += + lll->periph.window_size_prepare_us; + lll->periph.window_size_prepare_us = 0; /* Start setting up Radio h/w */ radio_reset(); @@ -194,8 +194,8 @@ static int prepare_cb(struct lll_prepare_param *p) radio_tmr_aa_save(0); hcto = remainder_us + EVENT_JITTER_US + (EVENT_JITTER_US << 2) + - (lll->slave.window_widening_event_us << 1) + - lll->slave.window_size_event_us; + (lll->periph.window_widening_event_us << 1) + + lll->periph.window_size_event_us; #if defined(CONFIG_BT_CTLR_PHY) hcto += radio_rx_ready_delay_get(lll->phy_rx, 1); diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c index 5fbb339fd13..244f00a349f 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c @@ -134,7 +134,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param) /* Check if stopped (on connection establishment race between LLL and * ULL. */ - if (unlikely(lll->conn && lll->conn->master.initiated)) { + if (unlikely(lll->conn && lll->conn->central.initiated)) { int err; 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); /* capture end of Rx-ed PDU, for initiator to calculate first - * master event. + * central event. */ radio_tmr_end_capture(); @@ -534,7 +534,7 @@ static void isr_done(void *param) #endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */ /* capture end of Rx-ed PDU, for initiator to calculate first - * master event. + * central event. */ radio_tmr_end_capture(); } @@ -550,7 +550,7 @@ static void isr_window(void *param) remainder_us = radio_tmr_start_tick(0, ticks_at_start); /* capture end of Rx-ed PDU, for initiator to calculate first - * master event. + * central event. */ 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 */ - lll->conn->master.initiated = 1; + lll->conn->central.initiated = 1; rx = ull_pdu_rx_alloc(); diff --git a/subsys/bluetooth/controller/ll_sw/pdu.h b/subsys/bluetooth/controller/ll_sw/pdu.h index f4767b1e7a9..c2e8f9c4561 100644 --- a/subsys/bluetooth/controller/ll_sw/pdu.h +++ b/subsys/bluetooth/controller/ll_sw/pdu.h @@ -456,7 +456,7 @@ enum pdu_data_llctrl_type { PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP = 0x0B, PDU_DATA_LLCTRL_TYPE_VERSION_IND = 0x0C, 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_RSP = 0x10, PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND = 0x11, @@ -542,7 +542,7 @@ struct pdu_data_llctrl_reject_ind { uint8_t error_code; } __packed; -struct pdu_data_llctrl_slave_feature_req { +struct pdu_data_llctrl_per_init_feat_xchg { uint8_t features[8]; } __packed; @@ -704,7 +704,7 @@ struct pdu_data_llctrl { struct pdu_data_llctrl_pause_enc_rsp pause_enc_rsp; struct pdu_data_llctrl_version_ind version_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_rsp conn_param_rsp; struct pdu_data_llctrl_reject_ext_ind reject_ext_ind; diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index d91dbdc15c5..a9ddf48ddfd 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -57,7 +57,7 @@ #include "ull_scan_internal.h" #include "ull_sync_internal.h" #include "ull_sync_iso_internal.h" -#include "ull_master_internal.h" +#include "ull_central_internal.h" #include "ull_conn_internal.h" #include "lll_conn_iso.h" #include "ull_conn_iso_types.h" @@ -242,7 +242,7 @@ #if defined(CONFIG_BT_CTLR_LOW_LAT) && \ (CONFIG_BT_CTLR_LLL_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* 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. */ #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) } 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_BROADCASTER) diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 7d338d0f9dd..e7fb205b959 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -983,18 +983,18 @@ uint8_t ll_adv_enable(uint8_t enable) /* FIXME: BEGIN: Move to ULL? */ conn_lll->role = 1; - conn_lll->slave.initiated = 0; - conn_lll->slave.cancelled = 0; + conn_lll->periph.initiated = 0; + conn_lll->periph.cancelled = 0; conn_lll->data_chan_sel = 0; conn_lll->data_chan_use = 0; conn_lll->event_counter = 0; conn_lll->latency_prepare = 0; conn_lll->latency_event = 0; - conn_lll->slave.latency_enabled = 0; - conn_lll->slave.window_widening_prepare_us = 0; - conn_lll->slave.window_widening_event_us = 0; - conn_lll->slave.window_size_prepare_us = 0; + conn_lll->periph.latency_enabled = 0; + conn_lll->periph.window_widening_prepare_us = 0; + conn_lll->periph.window_widening_event_us = 0; + conn_lll->periph.window_size_prepare_us = 0; /* FIXME: END: Move to ULL? */ #if defined(CONFIG_BT_CTLR_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.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_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.pause_tx = conn->llcp_enc.pause_rx = 0U; conn->llcp_enc.refresh = 0U; - conn->slave.llcp_type = 0U; + conn->periph.llcp_type = 0U; #endif /* CONFIG_BT_CTLR_LE_ENC */ #if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ) conn->llcp_conn_param.req = 0; conn->llcp_conn_param.ack = 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 */ #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 (adv->lll.conn) { /* Indicate to LLL that a cancellation is requested */ - adv->lll.conn->slave.cancelled = 1U; + adv->lll.conn->periph.cancelled = 1U; cpu_dmb(); /* Check if a connection was initiated (connection * 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; } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index 1d869497fab..43ab9e81a83 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -33,7 +33,7 @@ #include "lll_scan.h" #include "lll/lll_df_types.h" #include "lll_conn.h" -#include "lll_master.h" +#include "lll_central.h" #include "lll_filter.h" #include "ull_adv_types.h" @@ -45,14 +45,14 @@ #include "ull_chan_internal.h" #include "ull_scan_internal.h" #include "ull_conn_internal.h" -#include "ull_master_internal.h" +#include "ull_central_internal.h" #include "ll.h" #include "ll_feat.h" #include "ll_settings.h" #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 "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_use = 0; conn_lll->role = 0; - conn_lll->master.initiated = 0; - conn_lll->master.cancelled = 0; + conn_lll->central.initiated = 0; + conn_lll->central.cancelled = 0; /* FIXME: END: Move to ULL? */ #if defined(CONFIG_BT_CTLR_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.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_rx = NULL; @@ -501,13 +501,13 @@ uint8_t ll_connect_disable(void **rx) if (!conn_lll) { /* Scanning not associated with initiation of a connection or * 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; } /* Indicate to LLL that a cancellation is requested */ - conn_lll->master.cancelled = 1U; + conn_lll->central.cancelled = 1U; cpu_dmb(); /* 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 */ -int ull_master_reset(void) +int ull_central_reset(void) { int err; void *rx; @@ -679,7 +679,7 @@ int ull_master_reset(void) 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 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 */ } -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) { 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_ID_SCAN_STOP, NULL, NULL); - /* Start master */ + /* Start central */ ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn); ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, 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, (conn->ull.ticks_slot + ticks_slot_overhead), - ull_master_ticker_cb, conn, ticker_op_cb, + ull_central_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || (ticker_status == TICKER_STATUS_BUSY)); @@ -940,12 +940,12 @@ void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr, #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, void *param) { 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; struct ll_conn *conn; 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); } -uint8_t ull_master_chm_update(void) +uint8_t ull_central_chm_update(void) { uint16_t handle; diff --git a/subsys/bluetooth/controller/ll_sw/ull_central_internal.h b/subsys/bluetooth/controller/ll_sw/ull_central_internal.h index 5b5ab6f5768..76bf6fe81db 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_central_internal.h @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -int ull_master_reset(void); -void ull_master_cleanup(struct node_rx_hdr *rx_free); -void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr, +int ull_central_reset(void); +void ull_central_cleanup(struct node_rx_hdr *rx_free); +void ull_central_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr, 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, void *param); -uint8_t ull_master_chm_update(void); +uint8_t ull_central_chm_update(void); diff --git a/subsys/bluetooth/controller/ll_sw/ull_chan.c b/subsys/bluetooth/controller/ll_sw/ull_chan.c index 3d625d4a589..409ba222f2c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_chan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_chan.c @@ -28,7 +28,7 @@ #include "ull_adv_types.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. * 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); #if defined(CONFIG_BT_CENTRAL) - (void)ull_master_chm_update(); + (void)ull_central_chm_update(); #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 03f54182989..150c31e22ea 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -38,8 +38,8 @@ #include "ull_sched_internal.h" #include "ull_chan_internal.h" #include "ull_conn_internal.h" -#include "ull_slave_internal.h" -#include "ull_master_internal.h" +#include "ull_periph_internal.h" +#include "ull_central_internal.h" #include "ull_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) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } #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) && 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 */ if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } return 0; @@ -516,9 +516,9 @@ uint8_t ll_feature_req_send(uint16_t handle) conn->llcp_feature.req++; 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) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } return 0; @@ -540,7 +540,7 @@ uint8_t ll_version_ind_send(uint16_t handle) conn->llcp_version.req++; if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } 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++; if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } 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++; if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && conn->lll.role) { - ull_slave_latency_cancel(conn, handle); + ull_periph_latency_cancel(conn, handle); } return 0; @@ -761,7 +761,7 @@ int ull_conn_reset(void) #if defined(CONFIG_BT_CENTRAL) /* Reset initiator */ - (void)ull_master_reset(); + (void)ull_central_reset(); #endif /* CONFIG_BT_CENTRAL */ 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 defined(CONFIG_BT_CTLR_LE_ENC) #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 */ !conn->llcp_enc.pause_rx) { #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 * peer central initiated a encryption procedure */ - if (conn->lll.role && (conn->slave.llcp_type != LLCP_NONE)) { - switch (conn->slave.llcp_type) { + if (conn->lll.role && (conn->periph.llcp_type != LLCP_NONE)) { + switch (conn->periph.llcp_type) { case LLCP_CONN_UPD: { 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.ack) & 0xFF) == TERM_ACKED) || - conn->master.terminate_ack || + conn->central.terminate_ack || (reason_final == BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL) #else /* CONFIG_BT_CENTRAL */ 1 @@ -1287,8 +1287,8 @@ void ull_conn_done(struct node_rx_event_done *done) #endif elapsed_event = latency_event + 1; - /* Slave drift compensation calc and new latency or - * master terminate acked + /* Peripheral drift compensation calc and new latency or + * central terminate acked */ ticks_drift_plus = 0U; ticks_drift_minus = 0U; @@ -1307,14 +1307,14 @@ void ull_conn_done(struct node_rx_event_done *done) lll->memq_tx.tail, NULL)) { lll->latency_event = 0; - } else if (lll->slave.latency_enabled) { + } else if (lll->periph.latency_enabled) { lll->latency_event = lll->latency; } #endif /* CONFIG_BT_PERIPHERAL */ #if defined(CONFIG_BT_CENTRAL) } else if (reason_final) { - conn->master.terminate_ack = 1; + conn->central.terminate_ack = 1; #endif /* CONFIG_BT_CENTRAL */ } @@ -1358,26 +1358,26 @@ void ull_conn_done(struct node_rx_event_done *done) /* break latency */ lll->latency_event = 0U; - /* Force both master and slave when close to + /* Force both central and peripheral when close to * supervision timeout. */ if (conn->supervision_expire <= 6U) { force = 1U; } #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. */ else if (lll->role) { if (latency_event) { force = 1U; } else { - force = conn->slave.force & 0x01; + force = conn->periph.force & 0x01; /* rotate force bits */ - conn->slave.force >>= 1U; + conn->periph.force >>= 1U; 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; /* Call to ticker_update can fail under the race - * condition where in the Slave role is being stopped but - * at the same time it is preempted by Slave event that - * gets into close state. Accept failure when Slave role + * condition where in the peripheral role is being stopped but + * at the same time it is preempted by peripheral event that + * gets into close state. Accept failure when peripheral role * is being stopped. */ 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) { - /* 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 * and ticker_stop calls). */ @@ -1907,13 +1907,13 @@ static void conn_setup_adv_scan_disabled_cb(void *param) switch (lll->role) { #if defined(CONFIG_BT_CENTRAL) case 0: - ull_master_setup(rx, ftr, lll); + ull_central_setup(rx, ftr, lll); break; #endif /* CONFIG_BT_CENTRAL */ #if defined(CONFIG_BT_PERIPHERAL) case 1: - ull_slave_setup(rx, ftr, lll); + ull_periph_setup(rx, ftr, lll); break; #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 */ 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_USER_ID_ULL_HIGH, TICKER_ID_CONN_BASE + lll->handle, @@ -2525,7 +2525,7 @@ static inline void event_conn_upd_init(struct ll_conn *conn, uint32_t retval; /* 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; @@ -2688,12 +2688,12 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy, uint16_t latency; #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 * completed while a remote central had initiated * encryption procedure */ - conn->slave.llcp_type = LLCP_NONE; + conn->periph.llcp_type = LLCP_NONE; } else #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 defined(CONFIG_BT_PERIPHERAL) } else if (lll->role) { - lll->slave.window_widening_prepare_us -= - lll->slave.window_widening_periodic_us * + lll->periph.window_widening_prepare_us -= + lll->periph.window_widening_periodic_us * instant_latency; - lll->slave.window_widening_periodic_us = + lll->periph.window_widening_periodic_us = (((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; - lll->slave.window_widening_max_us = + lll->periph.window_widening_max_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; #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 */ - lll->slave.window_widening_prepare_us += - lll->slave.window_widening_periodic_us * + lll->periph.window_widening_prepare_us += + lll->periph.window_widening_periodic_us * latency; - if (lll->slave.window_widening_prepare_us > - lll->slave.window_widening_max_us) { - lll->slave.window_widening_prepare_us = - lll->slave.window_widening_max_us; + if (lll->periph.window_widening_prepare_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_prepare_us = + lll->periph.window_widening_max_us; } ticks_at_expire -= HAL_TICKER_US_TO_TICKS( - lll->slave.window_widening_periodic_us * + lll->periph.window_widening_periodic_us * latency); ticks_win_offset = HAL_TICKER_US_TO_TICKS( (conn->llcp_cu.win_offset_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 */ #if defined(CONFIG_BT_CENTRAL) @@ -2885,7 +2885,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy, 0); #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_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, 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 + conn->ull.ticks_slot), #if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CENTRAL) - lll->role ? ull_slave_ticker_cb : - ull_master_ticker_cb, + lll->role ? ull_periph_ticker_cb : + ull_central_ticker_cb, #elif defined(CONFIG_BT_PERIPHERAL) - ull_slave_ticker_cb, + ull_periph_ticker_cb, #else - ull_master_ticker_cb, + ull_central_ticker_cb, #endif conn, ticker_start_conn_op_cb, (void *)conn); @@ -2974,12 +2974,12 @@ static inline void event_ch_map_prep(struct ll_conn *conn, struct lll_conn *lll = &conn->lll; #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 * completed while a remote central had initiated * encryption procedure */ - conn->slave.llcp_type = LLCP_NONE; + conn->periph.llcp_type = LLCP_NONE; } else #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; - /* master sends encrypted enc start rsp in control priority */ + /* central sends encrypted enc start rsp in control priority */ if (!lll->role) { /* calc the Session Key */ 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_tx.counter = 0; - /* set direction: slave to master = 0, - * master to slave = 1 + /* set direction: peripheral to central = 0, + * central to peripheral = 1 */ lll->ccm_rx.direction = 0; lll->ccm_tx.direction = 1; @@ -3129,7 +3129,7 @@ static inline void event_enc_prep(struct ll_conn *conn) 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) else { @@ -3168,14 +3168,14 @@ static inline void event_enc_prep(struct ll_conn *conn) lll->ccm_rx.counter = 0U; lll->ccm_tx.counter = 0U; - /* set direction: slave to master = 0, - * master to slave = 1 + /* set direction: peripheral to central = 0, + * central to peripheral = 1 */ lll->ccm_rx.direction = 1U; lll->ccm_tx.direction = 0U; /* enable receive encryption (transmit turned - * on when start enc resp from master is + * on when start enc resp from central is * received) */ 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); pdu->llctrl.opcode = !conn->lll.role ? 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], 0x00, sizeof(pdu->llctrl.feature_req.features)); @@ -3459,7 +3459,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn) return; } - /* master/slave response with reject ext ind */ + /* central/peripheral response with reject ext ind */ pdu = (void *)tx->pdu; pdu->ll_id = PDU_DATA_LLID_CTRL; 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; } - /* master respond with connection update */ + /* central respond with connection update */ if (!conn->lll.role) { uint16_t interval_max; uint8_t preferred_periodicity; @@ -3520,7 +3520,7 @@ static inline void event_conn_param_rsp(struct ll_conn *conn) return; } - /* slave response with connection parameter response */ + /* peripheral response with connection parameter response */ tx = mem_acquire(&mem_conn_tx_ctrl.free); if (!tx) { 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 (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 * a remote central had initiated encryption procedure */ - conn->slave.llcp_type = LLCP_NONE; + conn->periph.llcp_type = LLCP_NONE; } else #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) - /* Set CPR mutex, if only not already set. As a master the mutex shall - * be set, but a slave we accept it as new 'set' of mutex. + /* Set CPR mutex, if only not already set. As a central the mutex shall + * be set, but a peripheral we accept it as new 'set' of mutex. */ cpr_active_check_and_set(conn); #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.ivs)); - /* things from slave stored for session key calculation */ + /* things from peripheral stored for session key calculation */ memcpy(&conn->llcp.encryption.skd[8], &pdu_ctrl_tx->llctrl.enc_rsp.skds[0], 8); 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) || \ - (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, 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; } -#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) { 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->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) 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) /* update to next ticks offset */ if (lll->role) { - conn->slave.ticks_to_offset = + conn->periph.ticks_to_offset = conn->llcp_conn_param.ticks_to_offset_next; } #endif /* CONFIG_BT_PERIPHERAL */ @@ -5460,7 +5460,7 @@ static int phy_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx, 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; if (conn->llcp_phy.ack == 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_CENTRAL) 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], &pdu_tx->llctrl.enc_req.skdm[0], 8); 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; /* Store the local peripheral initiated procedure */ - LL_ASSERT(conn->slave.llcp_type == LLCP_NONE); - conn->slave.llcp_type = conn->llcp_type; + LL_ASSERT(conn->periph.llcp_type == LLCP_NONE); + conn->periph.llcp_type = conn->llcp_type; } #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[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; /* 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_ack -= 2U; - /* things from master stored for session key calculation */ + /* things from central stored for session key calculation */ memcpy(&conn->llcp.encryption.skd[0], &pdu_rx->llctrl.enc_req.skdm[0], 8); 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; } - /* things sent by slave stored for session key calculation */ + /* things sent by peripheral stored for session key calculation */ memcpy(&conn->llcp.encryption.skd[8], &pdu_rx->llctrl.enc_rsp.skds[0], 8); 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; } - /* 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; /* 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 !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; #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; #endif /* CONFIG_BT_PERIPHERAL */ -#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_SLAVE_FEAT_REQ) - case PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ: +#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) + case PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG: 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; } nack = feature_rsp_send(conn, *rx, pdu_rx); 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: - if ((!IS_ENABLED(CONFIG_BT_CTLR_SLAVE_FEAT_REQ) && + if ((!IS_ENABLED(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) && conn->lll.role) || PDU_DATA_LLCTRL_LEN(feature_rsp) != pdu_rx->len) { 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); 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_PERIPHERAL) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h index fe01e4f6876..6d2faef9d1e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h @@ -89,7 +89,7 @@ struct ll_conn { #if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ) uint32_t ticks_to_offset; #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ - } slave; + } periph; #endif /* CONFIG_BT_PERIPHERAL */ #if defined(CONFIG_BT_CENTRAL) @@ -100,7 +100,7 @@ struct ll_conn { uint8_t is_must_expire:1; #endif /* CONFIG_BT_CTLR_CONN_META */ uint8_t terminate_ack:1; - } master; + } central; #endif /* CONFIG_BT_CENTRAL */ }; diff --git a/subsys/bluetooth/controller/ll_sw/ull_periph_internal.h b/subsys/bluetooth/controller/ll_sw/ull_periph_internal.h new file mode 100644 index 00000000000..c5a5935447a --- /dev/null +++ b/subsys/bluetooth/controller/ll_sw/ull_periph_internal.h @@ -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); diff --git a/subsys/bluetooth/controller/ll_sw/ull_slave.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c similarity index 93% rename from subsys/bluetooth/controller/ll_sw/ull_slave.c rename to subsys/bluetooth/controller/ll_sw/ull_peripheral.c index 6cdea1ffc51..cf87a9b4ca3 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_slave.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -31,7 +31,7 @@ #include "lll/lll_adv_pdu.h" #include "lll_chan.h" #include "lll_conn.h" -#include "lll_slave.h" +#include "lll_peripheral.h" #include "lll_filter.h" #include "lll/lll_df_types.h" @@ -42,12 +42,12 @@ #include "ull_internal.h" #include "ull_adv_internal.h" #include "ull_conn_internal.h" -#include "ull_slave_internal.h" +#include "ull_periph_internal.h" #include "ll.h" #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 "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, 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) { 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; conn = lll->hdr.parent; - /* Populate the slave context */ + /* Populate the peripheral context */ pdu_adv = (void *)((struct node_rx_pdu *)rx)->pdu; 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 */ - conn->slave.sca = pdu_adv->connect_ind.sca; - lll->slave.window_widening_periodic_us = + conn->periph.sca = pdu_adv->connect_ind.sca; + lll->periph.window_widening_periodic_us = (((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; - lll->slave.window_widening_max_us = (conn_interval_us >> 1) - + lll->periph.window_widening_max_us = (conn_interval_us >> 1) - 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; /* 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 */ #if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE) - memcpy((void *)&conn->slave.force, &lll->access_addr[0], - sizeof(conn->slave.force)); + memcpy((void *)&conn->periph.force, &lll->access_addr[0], + sizeof(conn->periph.force)); #endif /* CONFIG_BT_CTLR_CONN_RANDOM_FORCE */ 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->latency = lll->latency; cc->timeout = timeout; - cc->sca = conn->slave.sca; + cc->sca = conn->periph.sca; lll->handle = ll_conn_handle_get(conn); 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); - 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 += 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); } - /* Start Slave */ + /* Start Peripheral */ ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn); ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, 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, (conn->ull.ticks_slot + ticks_slot_overhead), - ull_slave_ticker_cb, conn, ticker_op_cb, + ull_periph_ticker_cb, conn, ticker_op_cb, (void *)__LINE__); LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || (ticker_status == TICKER_STATUS_BUSY)); @@ -436,13 +436,13 @@ void ull_slave_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr, #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 */ - if (conn->lll.latency_event && !conn->slave.latency_cancel) { + if (conn->lll.latency_event && !conn->periph.latency_cancel) { uint32_t ticker_status; - conn->slave.latency_cancel = 1U; + conn->periph.latency_cancel = 1U; ticker_status = 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, void *param) { 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; struct ll_conn *conn; uint32_t err; @@ -587,7 +587,7 @@ static void invalid_release(struct ull_hdr *hdr, struct lll_conn *lll, hdr->disabled_cb = NULL; /* Let the advertiser continue with connectable advertising */ - lll->slave.initiated = 0U; + lll->periph.initiated = 0U; /* Mark for buffer for 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); - conn->slave.latency_cancel = 0U; + conn->periph.latency_cancel = 0U; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index 572af64280b..11c91ac9393 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -416,7 +416,7 @@ uint8_t ull_scan_enable(struct ll_scan_set *scan) &ticks_ref, &offset_us); /* 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). */ if (offset_us) { diff --git a/subsys/bluetooth/controller/ll_sw/ull_sched.c b/subsys/bluetooth/controller/ll_sw/ull_sched.c index 21e3bece2d3..e77be0db5a0 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sched.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sched.c @@ -229,7 +229,7 @@ void ull_sched_mfy_free_win_offset_calc(void *param) #if defined(CONFIG_BT_PERIPHERAL) if (conn->lll.role) { conn->llcp_conn_param.ticks_to_offset_next = - conn->slave.ticks_to_offset; + conn->periph.ticks_to_offset; ticks_to_offset_next = &conn->llcp_conn_param.ticks_to_offset_next; diff --git a/subsys/bluetooth/controller/ll_sw/ull_slave_internal.h b/subsys/bluetooth/controller/ll_sw/ull_slave_internal.h deleted file mode 100644 index 9f458628684..00000000000 --- a/subsys/bluetooth/controller/ll_sw/ull_slave_internal.h +++ /dev/null @@ -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); diff --git a/subsys/bluetooth/controller/ticker/ticker.c b/subsys/bluetooth/controller/ticker/ticker.c index 92ccf2f8818..3af48b8e3b5 100644 --- a/subsys/bluetooth/controller/ticker/ticker.c +++ b/subsys/bluetooth/controller/ticker/ticker.c @@ -55,7 +55,7 @@ struct ticker_node { * skipping */ uint16_t lazy_current; /* Current number of timeouts - * skipped = slave latency + * skipped = peripheral latency */ union { uint32_t remainder_periodic;/* Sub-microsecond tick remainder @@ -151,7 +151,7 @@ struct ticker_user_op_update { * slot reservation (air-time) */ #endif /* CONFIG_BT_TICKER_SLOT_AGNOSTIC */ - uint16_t lazy; /* Slave latency: + uint16_t lazy; /* Peripheral latency: * 0: Do nothing * 1: latency = 0 * >1: latency = lazy - 1 diff --git a/tests/bluetooth/init/prj_ctlr_tiny.conf b/tests/bluetooth/init/prj_ctlr_tiny.conf index a571a475050..6dc864f1351 100644 --- a/tests/bluetooth/init/prj_ctlr_tiny.conf +++ b/tests/bluetooth/init/prj_ctlr_tiny.conf @@ -4,7 +4,7 @@ CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_DUP_FILTER_LEN=0 CONFIG_BT_CTLR_CONN_PARAM_REQ=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_PRIVACY=n CONFIG_BT_CTLR_EXT_SCAN_FP=n diff --git a/tests/bluetooth/mesh_shell/prj.conf b/tests/bluetooth/mesh_shell/prj.conf index e976c73b957..736fd65d4c3 100644 --- a/tests/bluetooth/mesh_shell/prj.conf +++ b/tests/bluetooth/mesh_shell/prj.conf @@ -35,7 +35,7 @@ CONFIG_BT_CTLR_PRIVACY=n CONFIG_BT_CTLR_DTM_HCI=n CONFIG_BT_CTLR_EXT_SCAN_FP=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_FILTER_ACCEPT_LIST=n