Bluetooth: controller: split: Added LE Ext. Create Connection
Added implementation of LE Extended Create Connection. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
b87cae97bb
commit
a74276e1bd
4 changed files with 103 additions and 6 deletions
|
@ -80,10 +80,19 @@ uint8_t ll_rl_enable(uint8_t enable);
|
||||||
void ll_rl_timeout_set(uint16_t timeout);
|
void ll_rl_timeout_set(uint16_t timeout);
|
||||||
uint8_t ll_priv_mode_set(bt_addr_le_t *id_addr, uint8_t mode);
|
uint8_t ll_priv_mode_set(bt_addr_le_t *id_addr, uint8_t mode);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||||
|
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
|
uint8_t filter_policy, uint8_t peer_addr_type,
|
||||||
|
uint8_t *peer_addr, uint8_t own_addr_type,
|
||||||
|
uint16_t interval, uint16_t latency, uint16_t timeout,
|
||||||
|
uint8_t phy);
|
||||||
|
uint8_t ll_connect_enable(uint8_t is_coded_included);
|
||||||
|
#else /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
uint8_t filter_policy, uint8_t peer_addr_type,
|
uint8_t filter_policy, uint8_t peer_addr_type,
|
||||||
uint8_t *peer_addr, uint8_t own_addr_type,
|
uint8_t *peer_addr, uint8_t own_addr_type,
|
||||||
uint16_t interval, uint16_t latency, uint16_t timeout);
|
uint16_t interval, uint16_t latency, uint16_t timeout);
|
||||||
|
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
uint8_t ll_connect_disable(void **rx);
|
uint8_t ll_connect_disable(void **rx);
|
||||||
uint8_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, uint16_t interval_min,
|
uint8_t ll_conn_update(uint16_t handle, uint8_t cmd, uint8_t status, uint16_t interval_min,
|
||||||
uint16_t interval_max, uint16_t latency, uint16_t timeout);
|
uint16_t interval_max, uint16_t latency, uint16_t timeout);
|
||||||
|
|
|
@ -54,10 +54,18 @@ static void ticker_op_stop_scan_cb(uint32_t status, void *params);
|
||||||
static void ticker_op_cb(uint32_t status, void *params);
|
static void ticker_op_cb(uint32_t status, void *params);
|
||||||
static inline void conn_release(struct ll_scan_set *scan);
|
static inline void conn_release(struct ll_scan_set *scan);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||||
|
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
|
uint8_t filter_policy, uint8_t peer_addr_type,
|
||||||
|
uint8_t *peer_addr, uint8_t own_addr_type,
|
||||||
|
uint16_t interval, uint16_t latency, uint16_t timeout,
|
||||||
|
uint8_t phy)
|
||||||
|
#else /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
uint8_t filter_policy, uint8_t peer_addr_type,
|
uint8_t filter_policy, uint8_t peer_addr_type,
|
||||||
uint8_t *peer_addr, uint8_t own_addr_type,
|
uint8_t *peer_addr, uint8_t own_addr_type,
|
||||||
uint16_t interval, uint16_t latency, uint16_t timeout)
|
uint16_t interval, uint16_t latency, uint16_t timeout)
|
||||||
|
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
{
|
{
|
||||||
struct lll_conn *conn_lll;
|
struct lll_conn *conn_lll;
|
||||||
struct ll_scan_set *scan;
|
struct ll_scan_set *scan;
|
||||||
|
@ -68,16 +76,55 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
uint8_t hop;
|
uint8_t hop;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
scan = ull_scan_is_disabled_get(0);
|
scan = ull_scan_is_disabled_get(SCAN_HANDLE_1M);
|
||||||
if (!scan) {
|
if (!scan) {
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
lll = &scan->lll;
|
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||||
if (lll->conn) {
|
#if defined(CONFIG_BT_CTLR_PHY_CODED)
|
||||||
|
struct ll_scan_set *scan_coded;
|
||||||
|
struct lll_scan *lll_coded;
|
||||||
|
|
||||||
|
scan_coded = ull_scan_is_disabled_get(SCAN_HANDLE_PHY_CODED);
|
||||||
|
if (!scan_coded) {
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lll = &scan->lll;
|
||||||
|
lll_coded = &scan_coded->lll;
|
||||||
|
|
||||||
|
if (phy & BT_HCI_LE_EXT_SCAN_PHY_CODED) {
|
||||||
|
if (!lll_coded->conn) {
|
||||||
|
lll_coded->conn = lll->conn;
|
||||||
|
}
|
||||||
|
scan = scan_coded;
|
||||||
|
lll = lll_coded;
|
||||||
|
} else {
|
||||||
|
if (!lll->conn) {
|
||||||
|
lll->conn = lll_coded->conn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||||
|
if (phy & ~BT_HCI_LE_EXT_SCAN_PHY_1M) {
|
||||||
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
|
}
|
||||||
|
|
||||||
|
lll = &scan->lll;
|
||||||
|
|
||||||
|
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||||
|
|
||||||
|
lll->phy = phy;
|
||||||
|
|
||||||
|
#else /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
|
lll = &scan->lll;
|
||||||
|
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
|
|
||||||
|
if (lll->conn) {
|
||||||
|
goto conn_is_valid;
|
||||||
|
}
|
||||||
|
|
||||||
link = ll_rx_link_alloc();
|
link = ll_rx_link_alloc();
|
||||||
if (!link) {
|
if (!link) {
|
||||||
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
|
||||||
|
@ -250,6 +297,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
ull_hdr_init(&conn->ull);
|
ull_hdr_init(&conn->ull);
|
||||||
lll_hdr_init(&conn->lll, conn);
|
lll_hdr_init(&conn->lll, conn);
|
||||||
|
|
||||||
|
conn_is_valid:
|
||||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||||
ull_filter_scan_update(filter_policy);
|
ull_filter_scan_update(filter_policy);
|
||||||
|
|
||||||
|
@ -273,6 +321,9 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
|
|
||||||
scan->own_addr_type = own_addr_type;
|
scan->own_addr_type = own_addr_type;
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||||
|
return 0;
|
||||||
|
#else /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
/* wait for stable clocks */
|
/* wait for stable clocks */
|
||||||
err = lll_clock_wait();
|
err = lll_clock_wait();
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -282,8 +333,45 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
}
|
}
|
||||||
|
|
||||||
return ull_scan_enable(scan);
|
return ull_scan_enable(scan);
|
||||||
|
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||||
|
uint8_t ll_connect_enable(uint8_t is_coded_included)
|
||||||
|
{
|
||||||
|
uint8_t err = BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
|
struct ll_scan_set *scan;
|
||||||
|
|
||||||
|
scan = ull_scan_set_get(SCAN_HANDLE_1M);
|
||||||
|
|
||||||
|
/* wait for stable clocks */
|
||||||
|
err = lll_clock_wait();
|
||||||
|
if (err) {
|
||||||
|
conn_release(scan);
|
||||||
|
|
||||||
|
return BT_HCI_ERR_HW_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_coded_included ||
|
||||||
|
(scan->lll.phy & BIT(0))) {
|
||||||
|
err = ull_scan_enable(scan);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED) && is_coded_included) {
|
||||||
|
scan = ull_scan_set_get(SCAN_HANDLE_PHY_CODED);
|
||||||
|
err = ull_scan_enable(scan);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_BT_CTLR_ADV_EXT */
|
||||||
|
|
||||||
uint8_t ll_connect_disable(void **rx)
|
uint8_t ll_connect_disable(void **rx)
|
||||||
{
|
{
|
||||||
struct lll_conn *conn_lll;
|
struct lll_conn *conn_lll;
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include "hal/debug.h"
|
#include "hal/debug.h"
|
||||||
|
|
||||||
#define SCAN_HANDLE_1M 0
|
|
||||||
#define SCAN_HANDLE_PHY_CODED 1
|
|
||||||
|
|
||||||
static int init_reset(void);
|
static int init_reset(void);
|
||||||
static void ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_t lazy,
|
static void ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_t lazy,
|
||||||
void *param);
|
void *param);
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
/* NOTE: Definitions used internal to ULL implementations */
|
/* NOTE: Definitions used internal to ULL implementations */
|
||||||
|
|
||||||
|
#define SCAN_HANDLE_1M 0
|
||||||
|
#define SCAN_HANDLE_PHY_CODED 1
|
||||||
|
|
||||||
int ull_scan_init(void);
|
int ull_scan_init(void);
|
||||||
int ull_scan_reset(void);
|
int ull_scan_reset(void);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue