Bluetooth: Controller: Refactor out initiator reset
Refactor out the initiator reset implementation into a function. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
e937dde3ca
commit
29ae143a10
4 changed files with 44 additions and 36 deletions
|
@ -695,42 +695,6 @@ void ll_reset(void)
|
||||||
#endif /* CONFIG_BT_CTLR_ADV_ISO */
|
#endif /* CONFIG_BT_CTLR_ADV_ISO */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CONN)
|
#if defined(CONFIG_BT_CONN)
|
||||||
#if defined(CONFIG_BT_CENTRAL)
|
|
||||||
/* Reset initiator */
|
|
||||||
{
|
|
||||||
void *rx;
|
|
||||||
|
|
||||||
err = ll_connect_disable(&rx);
|
|
||||||
if (!err) {
|
|
||||||
struct ll_scan_set *scan;
|
|
||||||
|
|
||||||
scan = ull_scan_is_enabled_get(SCAN_HANDLE_1M);
|
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_ADV_EXT) &&
|
|
||||||
IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) {
|
|
||||||
struct ll_scan_set *scan_other;
|
|
||||||
|
|
||||||
scan_other = ull_scan_is_enabled_get(SCAN_HANDLE_PHY_CODED);
|
|
||||||
if (scan_other) {
|
|
||||||
if (scan) {
|
|
||||||
scan->is_enabled = 0U;
|
|
||||||
scan->lll.conn = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
scan = scan_other;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LL_ASSERT(scan);
|
|
||||||
|
|
||||||
scan->is_enabled = 0U;
|
|
||||||
scan->lll.conn = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ARG_UNUSED(rx);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_BT_CENTRAL */
|
|
||||||
|
|
||||||
/* Reset conn role */
|
/* Reset conn role */
|
||||||
err = ull_conn_reset();
|
err = ull_conn_reset();
|
||||||
LL_ASSERT(!err);
|
LL_ASSERT(!err);
|
||||||
|
|
|
@ -759,6 +759,11 @@ int ull_conn_reset(void)
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CENTRAL)
|
||||||
|
/* Reset initiator */
|
||||||
|
(void)ull_master_reset();
|
||||||
|
#endif /* CONFIG_BT_CENTRAL */
|
||||||
|
|
||||||
for (handle = 0U; handle < CONFIG_BT_MAX_CONN; handle++) {
|
for (handle = 0U; handle < CONFIG_BT_MAX_CONN; handle++) {
|
||||||
disable(handle);
|
disable(handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,6 +641,44 @@ 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 err;
|
||||||
|
void *rx;
|
||||||
|
|
||||||
|
err = ll_connect_disable(&rx);
|
||||||
|
if (!err) {
|
||||||
|
struct ll_scan_set *scan;
|
||||||
|
|
||||||
|
scan = ull_scan_is_enabled_get(SCAN_HANDLE_1M);
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BT_CTLR_ADV_EXT) &&
|
||||||
|
IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) {
|
||||||
|
struct ll_scan_set *scan_other;
|
||||||
|
|
||||||
|
scan_other =
|
||||||
|
ull_scan_is_enabled_get(SCAN_HANDLE_PHY_CODED);
|
||||||
|
if (scan_other) {
|
||||||
|
if (scan) {
|
||||||
|
scan->is_enabled = 0U;
|
||||||
|
scan->lll.conn = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
scan = scan_other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LL_ASSERT(scan);
|
||||||
|
|
||||||
|
scan->is_enabled = 0U;
|
||||||
|
scan->lll.conn = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ARG_UNUSED(rx);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
void ull_master_cleanup(struct node_rx_hdr *rx_free)
|
void ull_master_cleanup(struct node_rx_hdr *rx_free)
|
||||||
{
|
{
|
||||||
struct lll_conn *conn_lll;
|
struct lll_conn *conn_lll;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int ull_master_reset(void);
|
||||||
void ull_master_cleanup(struct node_rx_hdr *rx_free);
|
void ull_master_cleanup(struct node_rx_hdr *rx_free);
|
||||||
void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
void ull_master_setup(struct node_rx_hdr *rx, struct node_rx_ftr *ftr,
|
||||||
struct lll_conn *lll);
|
struct lll_conn *lll);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue