bluetooth: fixes shadow variables
Massaging code to fix shadow variables found by -Wshadow. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
6e38356b3c
commit
e3ecca5784
47 changed files with 729 additions and 765 deletions
|
@ -152,14 +152,14 @@ static inline int bt_spi_transceive(void *tx, uint32_t tx_len,
|
||||||
return spi_transceive_dt(&bus, &spi_tx, &spi_rx);
|
return spi_transceive_dt(&bus, &spi_tx, &spi_rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t bt_spi_get_cmd(uint8_t *txmsg)
|
static inline uint16_t bt_spi_get_cmd(uint8_t *msg)
|
||||||
{
|
{
|
||||||
return (txmsg[CMD_OCF] << 8) | txmsg[CMD_OGF];
|
return (msg[CMD_OCF] << 8) | msg[CMD_OGF];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t bt_spi_get_evt(uint8_t *rxmsg)
|
static inline uint16_t bt_spi_get_evt(uint8_t *msg)
|
||||||
{
|
{
|
||||||
return (rxmsg[EVT_VENDOR_CODE_MSB] << 8) | rxmsg[EVT_VENDOR_CODE_LSB];
|
return (msg[EVT_VENDOR_CODE_MSB] << 8) | msg[EVT_VENDOR_CODE_LSB];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bt_to_inactive_isr(const struct device *unused1,
|
static void bt_to_inactive_isr(const struct device *unused1,
|
||||||
|
@ -187,11 +187,11 @@ static void bt_to_active_isr(const struct device *unused1,
|
||||||
k_sem_give(&sem_request);
|
k_sem_give(&sem_request);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bt_spi_handle_vendor_evt(uint8_t *rxmsg)
|
static bool bt_spi_handle_vendor_evt(uint8_t *msg)
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
switch (bt_spi_get_evt(rxmsg)) {
|
switch (bt_spi_get_evt(msg)) {
|
||||||
case EVT_BLUE_INITIALIZED:
|
case EVT_BLUE_INITIALIZED:
|
||||||
k_sem_give(&sem_initialised);
|
k_sem_give(&sem_initialised);
|
||||||
#if defined(CONFIG_BT_BLUENRG_ACI)
|
#if defined(CONFIG_BT_BLUENRG_ACI)
|
||||||
|
|
|
@ -151,7 +151,6 @@ static void ase_status_changed(struct bt_ascs_ase *ase, uint8_t state)
|
||||||
const uint8_t att_ntf_header_size = 3; /* opcode (1) + handle (2) */
|
const uint8_t att_ntf_header_size = 3; /* opcode (1) + handle (2) */
|
||||||
const uint16_t max_ntf_size = bt_gatt_get_mtu(conn) - att_ntf_header_size;
|
const uint16_t max_ntf_size = bt_gatt_get_mtu(conn) - att_ntf_header_size;
|
||||||
uint16_t ntf_size;
|
uint16_t ntf_size;
|
||||||
int err;
|
|
||||||
|
|
||||||
err = k_sem_take(&ase_buf_sem, ASE_BUF_SEM_TIMEOUT);
|
err = k_sem_take(&ase_buf_sem, ASE_BUF_SEM_TIMEOUT);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
|
|
@ -759,9 +759,9 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_create_param *
|
||||||
stream_param->data,
|
stream_param->data,
|
||||||
stream_param->data_count * sizeof(*stream_param->data));
|
stream_param->data_count * sizeof(*stream_param->data));
|
||||||
source->stream_data[stream_count].data_count = stream_param->data_count;
|
source->stream_data[stream_count].data_count = stream_param->data_count;
|
||||||
for (uint8_t i = 0U; i < stream_param->data_count; i++) {
|
for (uint8_t k = 0U; k < stream_param->data_count; k++) {
|
||||||
source->stream_data[stream_count].data[i].data.data =
|
source->stream_data[stream_count].data[k].data.data =
|
||||||
source->stream_data[stream_count].data[i].value;
|
source->stream_data[stream_count].data[k].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_slist_append(&subgroup->streams, &stream->_node);
|
sys_slist_append(&subgroup->streams, &stream->_node);
|
||||||
|
|
|
@ -249,7 +249,7 @@ static void scan_delegator_security_changed(struct bt_conn *conn,
|
||||||
/* Notify all receive states after a bonded device reconnects */
|
/* Notify all receive states after a bonded device reconnects */
|
||||||
for (int i = 0; i < ARRAY_SIZE(scan_delegator.recv_states); i++) {
|
for (int i = 0; i < ARRAY_SIZE(scan_delegator.recv_states); i++) {
|
||||||
struct bass_recv_state_internal *internal_state = &scan_delegator.recv_states[i];
|
struct bass_recv_state_internal *internal_state = &scan_delegator.recv_states[i];
|
||||||
int err;
|
int gatt_err;
|
||||||
|
|
||||||
if (!internal_state->active) {
|
if (!internal_state->active) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -257,12 +257,12 @@ static void scan_delegator_security_changed(struct bt_conn *conn,
|
||||||
|
|
||||||
net_buf_put_recv_state(internal_state);
|
net_buf_put_recv_state(internal_state);
|
||||||
|
|
||||||
err = bt_gatt_notify_uuid(conn, BT_UUID_BASS_RECV_STATE,
|
gatt_err = bt_gatt_notify_uuid(conn, BT_UUID_BASS_RECV_STATE,
|
||||||
internal_state->attr, read_buf.data,
|
internal_state->attr, read_buf.data,
|
||||||
read_buf.len);
|
read_buf.len);
|
||||||
if (err != 0) {
|
if (gatt_err != 0) {
|
||||||
LOG_WRN("Could not notify receive state[%d] to reconnecting assistant: %d",
|
LOG_WRN("Could not notify receive state[%d] to reconnecting assistant: %d",
|
||||||
i, err);
|
i, gatt_err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ struct mcs_instance_t {
|
||||||
#endif /* CONFIG_BT_MCC_OTS */
|
#endif /* CONFIG_BT_MCC_OTS */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mcs_instance_t mcs_inst;
|
static struct mcs_instance_t mcs_instance;
|
||||||
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
||||||
|
|
||||||
static struct bt_mcc_cb *mcc_cb;
|
static struct bt_mcc_cb *mcc_cb;
|
||||||
|
@ -168,7 +168,7 @@ static struct mcs_instance_t *lookup_inst_by_conn(struct bt_conn *conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Expand when supporting more instances */
|
/* TODO: Expand when supporting more instances */
|
||||||
return &mcs_inst;
|
return &mcs_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mcc_player_name_cb(struct bt_conn *conn, uint8_t err, const void *data, uint16_t length)
|
static void mcc_player_name_cb(struct bt_conn *conn, uint8_t err, const void *data, uint16_t length)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -970,7 +970,7 @@ static int cmd_discover(const struct shell *sh, size_t argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cbs_registered) {
|
if (!cbs_registered) {
|
||||||
int err = bt_bap_unicast_client_register_cb(&unicast_client_cbs);
|
err = bt_bap_unicast_client_register_cb(&unicast_client_cbs);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
shell_error(sh, "Failed to register unicast client callbacks: %d", err);
|
shell_error(sh, "Failed to register unicast client callbacks: %d", err);
|
||||||
|
@ -1981,12 +1981,13 @@ static void stream_released_cb(struct bt_bap_stream *stream)
|
||||||
bool group_can_be_deleted = true;
|
bool group_can_be_deleted = true;
|
||||||
|
|
||||||
for (size_t i = 0U; i < ARRAY_SIZE(unicast_streams); i++) {
|
for (size_t i = 0U; i < ARRAY_SIZE(unicast_streams); i++) {
|
||||||
const struct bt_bap_stream *stream = &unicast_streams[i].stream.bap_stream;
|
const struct bt_bap_stream *bap_stream =
|
||||||
|
&unicast_streams[i].stream.bap_stream;
|
||||||
|
|
||||||
if (stream->ep != NULL) {
|
if (bap_stream->ep != NULL) {
|
||||||
struct bt_bap_ep_info ep_info;
|
struct bt_bap_ep_info ep_info;
|
||||||
|
|
||||||
bt_bap_ep_get_info(stream->ep, &ep_info);
|
bt_bap_ep_get_info(bap_stream->ep, &ep_info);
|
||||||
|
|
||||||
if (ep_info.state != BT_BAP_EP_STATE_CODEC_CONFIGURED &&
|
if (ep_info.state != BT_BAP_EP_STATE_CODEC_CONFIGURED &&
|
||||||
ep_info.state != BT_BAP_EP_STATE_IDLE) {
|
ep_info.state != BT_BAP_EP_STATE_IDLE) {
|
||||||
|
@ -2285,7 +2286,6 @@ static int cmd_sync_broadcast(const struct shell *sh, size_t argc, char *argv[])
|
||||||
stream_cnt = 0U;
|
stream_cnt = 0U;
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
val = shell_strtoul(argv[i], 0, &err);
|
val = shell_strtoul(argv[i], 0, &err);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
|
|
@ -234,17 +234,17 @@ static int cmd_cap_initiator_unicast_start(const struct shell *sh, size_t argc,
|
||||||
|
|
||||||
#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0
|
#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0
|
||||||
conn_snk_cnt = sink_cnt;
|
conn_snk_cnt = sink_cnt;
|
||||||
for (size_t i = 0U; i < sink_cnt; i++) {
|
for (size_t j = 0U; j < sink_cnt; j++) {
|
||||||
struct bt_cap_stream *stream =
|
struct bt_cap_stream *stream =
|
||||||
&unicast_streams[start_param.count].stream;
|
&unicast_streams[start_param.count].stream;
|
||||||
struct shell_stream *uni_stream =
|
struct shell_stream *uni_stream =
|
||||||
CONTAINER_OF(stream, struct shell_stream, stream);
|
CONTAINER_OF(stream, struct shell_stream, stream);
|
||||||
struct bt_bap_ep *snk_ep = snks[bt_conn_index(conn)][i];
|
struct bt_bap_ep *snk_ep = snks[bt_conn_index(conn)][j];
|
||||||
|
|
||||||
if (snk_ep == NULL) {
|
if (snk_ep == NULL) {
|
||||||
shell_info(sh, "Could only setup %zu/%zu sink endpoints",
|
shell_info(sh, "Could only setup %zu/%zu sink endpoints",
|
||||||
i, sink_cnt);
|
j, sink_cnt);
|
||||||
conn_snk_cnt = i;
|
conn_snk_cnt = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ static int cmd_cap_initiator_unicast_start(const struct shell *sh, size_t argc,
|
||||||
stream_param[start_param.count].qos;
|
stream_param[start_param.count].qos;
|
||||||
group_stream_params[start_param.count].stream =
|
group_stream_params[start_param.count].stream =
|
||||||
&stream_param[start_param.count].stream->bap_stream;
|
&stream_param[start_param.count].stream->bap_stream;
|
||||||
pair_params[pair_cnt + i].tx_param =
|
pair_params[pair_cnt + j].tx_param =
|
||||||
&group_stream_params[start_param.count];
|
&group_stream_params[start_param.count];
|
||||||
|
|
||||||
start_param.count++;
|
start_param.count++;
|
||||||
|
@ -268,17 +268,17 @@ static int cmd_cap_initiator_unicast_start(const struct shell *sh, size_t argc,
|
||||||
|
|
||||||
#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0
|
#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0
|
||||||
conn_src_cnt = source_cnt;
|
conn_src_cnt = source_cnt;
|
||||||
for (size_t i = 0U; i < source_cnt; i++) {
|
for (size_t j = 0U; j < source_cnt; j++) {
|
||||||
struct bt_cap_stream *stream =
|
struct bt_cap_stream *stream =
|
||||||
&unicast_streams[start_param.count].stream;
|
&unicast_streams[start_param.count].stream;
|
||||||
struct shell_stream *uni_stream =
|
struct shell_stream *uni_stream =
|
||||||
CONTAINER_OF(stream, struct shell_stream, stream);
|
CONTAINER_OF(stream, struct shell_stream, stream);
|
||||||
struct bt_bap_ep *src_ep = srcs[bt_conn_index(conn)][i];
|
struct bt_bap_ep *src_ep = srcs[bt_conn_index(conn)][j];
|
||||||
|
|
||||||
if (src_ep == NULL) {
|
if (src_ep == NULL) {
|
||||||
shell_info(sh, "Could only setup %zu/%zu source endpoints",
|
shell_info(sh, "Could only setup %zu/%zu source endpoints",
|
||||||
i, source_cnt);
|
j, source_cnt);
|
||||||
conn_src_cnt = i;
|
conn_src_cnt = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ static int cmd_cap_initiator_unicast_start(const struct shell *sh, size_t argc,
|
||||||
stream_param[start_param.count].qos;
|
stream_param[start_param.count].qos;
|
||||||
group_stream_params[start_param.count].stream =
|
group_stream_params[start_param.count].stream =
|
||||||
&stream_param[start_param.count].stream->bap_stream;
|
&stream_param[start_param.count].stream->bap_stream;
|
||||||
pair_params[pair_cnt + i].rx_param =
|
pair_params[pair_cnt + j].rx_param =
|
||||||
&group_stream_params[start_param.count];
|
&group_stream_params[start_param.count];
|
||||||
|
|
||||||
start_param.count++;
|
start_param.count++;
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct bt_csip_set_member_svc_inst *svc_inst;
|
||||||
static uint8_t sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
|
static uint8_t sirk_read_rsp = BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
|
||||||
|
|
||||||
static void locked_cb(struct bt_conn *conn,
|
static void locked_cb(struct bt_conn *conn,
|
||||||
struct bt_csip_set_member_svc_inst *svc_inst,
|
struct bt_csip_set_member_svc_inst *inst,
|
||||||
bool locked)
|
bool locked)
|
||||||
{
|
{
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
|
@ -41,7 +41,7 @@ static void locked_cb(struct bt_conn *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t sirk_read_req_cb(struct bt_conn *conn,
|
static uint8_t sirk_read_req_cb(struct bt_conn *conn,
|
||||||
struct bt_csip_set_member_svc_inst *svc_inst)
|
struct bt_csip_set_member_svc_inst *inst)
|
||||||
{
|
{
|
||||||
char addr[BT_ADDR_LE_STR_LEN];
|
char addr[BT_ADDR_LE_STR_LEN];
|
||||||
static const char *const rsp_strings[] = {
|
static const char *const rsp_strings[] = {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "shell/bt.h"
|
#include "shell/bt.h"
|
||||||
|
|
||||||
static struct bt_micp_mic_ctlr *mic_ctlr;
|
static struct bt_micp_mic_ctlr *micp_mic_ctlr;
|
||||||
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
|
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
|
||||||
static struct bt_micp_included micp_included;
|
static struct bt_micp_included micp_included;
|
||||||
#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
|
#endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
|
||||||
|
@ -233,7 +233,7 @@ static int cmd_micp_mic_ctlr_discover(const struct shell *sh, size_t argc,
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_micp_mic_ctlr_discover(default_conn, &mic_ctlr);
|
result = bt_micp_mic_ctlr_discover(default_conn, &micp_mic_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -246,11 +246,11 @@ static int cmd_micp_mic_ctlr_mute_get(const struct shell *sh, size_t argc,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_micp_mic_ctlr_mute_get(mic_ctlr);
|
result = bt_micp_mic_ctlr_mute_get(micp_mic_ctlr);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -264,11 +264,11 @@ static int cmd_micp_mic_ctlr_mute(const struct shell *sh, size_t argc,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_micp_mic_ctlr_mute(mic_ctlr);
|
result = bt_micp_mic_ctlr_mute(micp_mic_ctlr);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -282,11 +282,11 @@ static int cmd_micp_mic_ctlr_unmute(const struct shell *sh, size_t argc,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_micp_mic_ctlr_unmute(mic_ctlr);
|
result = bt_micp_mic_ctlr_unmute(micp_mic_ctlr);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
|
@ -316,7 +316,7 @@ static int cmd_micp_mic_ctlr_aics_input_state_get(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ static int cmd_micp_mic_ctlr_aics_gain_setting_get(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ static int cmd_micp_mic_ctlr_aics_input_type_get(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ static int cmd_micp_mic_ctlr_aics_input_status_get(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ static int cmd_micp_mic_ctlr_aics_input_mute(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ static int cmd_micp_mic_ctlr_aics_manual_input_gain_set(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ static int cmd_micp_mic_ctlr_aics_automatic_input_gain_set(const struct shell *s
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ static int cmd_micp_mic_ctlr_aics_gain_set(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ static int cmd_micp_mic_ctlr_aics_input_description_get(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ static int cmd_micp_mic_ctlr_aics_input_description_set(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mic_ctlr == NULL) {
|
if (micp_mic_ctlr == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "shell/bt.h"
|
#include "shell/bt.h"
|
||||||
|
|
||||||
static struct bt_vcp_vol_ctlr *vol_ctlr;
|
static struct bt_vcp_vol_ctlr *vcp_vol_ctlr;
|
||||||
static struct bt_vcp_included vcp_included;
|
static struct bt_vcp_included vcp_included;
|
||||||
|
|
||||||
static void vcs_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err,
|
static void vcs_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err,
|
||||||
|
@ -343,7 +343,7 @@ static int cmd_vcp_vol_ctlr_discover(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_discover(default_conn, &vol_ctlr);
|
result = bt_vcp_vol_ctlr_discover(default_conn, &vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ static int cmd_vcp_vol_ctlr_state_get(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_read_state(vol_ctlr);
|
result = bt_vcp_vol_ctlr_read_state(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ static int cmd_vcp_vol_ctlr_flags_get(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_read_flags(vol_ctlr);
|
result = bt_vcp_vol_ctlr_read_flags(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ static int cmd_vcp_vol_ctlr_volume_down(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_vol_down(vol_ctlr);
|
result = bt_vcp_vol_ctlr_vol_down(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ static int cmd_vcp_vol_ctlr_volume_up(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_vol_up(vol_ctlr);
|
result = bt_vcp_vol_ctlr_vol_up(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ static int cmd_vcp_vol_ctlr_unmute_volume_down(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_unmute_vol_down(vol_ctlr);
|
result = bt_vcp_vol_ctlr_unmute_vol_down(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ static int cmd_vcp_vol_ctlr_unmute_volume_up(const struct shell *sh,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_unmute_vol_up(vol_ctlr);
|
result = bt_vcp_vol_ctlr_unmute_vol_up(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ static int cmd_vcp_vol_ctlr_volume_set(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_set_vol(vol_ctlr, volume);
|
result = bt_vcp_vol_ctlr_set_vol(vcp_vol_ctlr, volume);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ static int cmd_vcp_vol_ctlr_unmute(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_unmute(vol_ctlr);
|
result = bt_vcp_vol_ctlr_unmute(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ static int cmd_vcp_vol_ctlr_mute(const struct shell *sh, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = bt_vcp_vol_ctlr_mute(vol_ctlr);
|
result = bt_vcp_vol_ctlr_mute(vcp_vol_ctlr);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
shell_print(sh, "Fail: %d", result);
|
shell_print(sh, "Fail: %d", result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,8 +467,6 @@ static uint8_t vcs_discover_func(struct bt_conn *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_params != NULL) {
|
if (sub_params != NULL) {
|
||||||
int err;
|
|
||||||
|
|
||||||
sub_params->value = BT_GATT_CCC_NOTIFY;
|
sub_params->value = BT_GATT_CCC_NOTIFY;
|
||||||
sub_params->value_handle = chrc->value_handle;
|
sub_params->value_handle = chrc->value_handle;
|
||||||
sub_params->ccc_handle = 0;
|
sub_params->ccc_handle = 0;
|
||||||
|
|
|
@ -2032,8 +2032,8 @@ static void le_set_cig_parameters(struct net_buf *buf, struct net_buf **evt)
|
||||||
status = ll_cig_parameters_commit(cig_id, handles);
|
status = ll_cig_parameters_commit(cig_id, handles);
|
||||||
|
|
||||||
if (status == BT_HCI_ERR_SUCCESS) {
|
if (status == BT_HCI_ERR_SUCCESS) {
|
||||||
for (uint8_t i = 0; i < cis_count; i++) {
|
for (uint8_t j = 0; j < cis_count; j++) {
|
||||||
rp->handle[i] = sys_cpu_to_le16(handles[i]);
|
rp->handle[j] = sys_cpu_to_le16(handles[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2104,8 +2104,8 @@ static void le_set_cig_params_test(struct net_buf *buf, struct net_buf **evt)
|
||||||
status = ll_cig_parameters_commit(cig_id, handles);
|
status = ll_cig_parameters_commit(cig_id, handles);
|
||||||
|
|
||||||
if (status == BT_HCI_ERR_SUCCESS) {
|
if (status == BT_HCI_ERR_SUCCESS) {
|
||||||
for (uint8_t i = 0; i < cis_count; i++) {
|
for (uint8_t j = 0; j < cis_count; j++) {
|
||||||
rp->handle[i] = sys_cpu_to_le16(handles[i]);
|
rp->handle[j] = sys_cpu_to_le16(handles[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,7 +577,7 @@ static void isr_tx(void *param)
|
||||||
|
|
||||||
/* Schedule next subevent */
|
/* Schedule next subevent */
|
||||||
if (se_curr < cis_lll->nse) {
|
if (se_curr < cis_lll->nse) {
|
||||||
const struct lll_conn *conn_lll;
|
const struct lll_conn *evt_conn_lll;
|
||||||
uint16_t data_chan_id;
|
uint16_t data_chan_id;
|
||||||
uint32_t subevent_us;
|
uint32_t subevent_us;
|
||||||
uint32_t start_us;
|
uint32_t start_us;
|
||||||
|
@ -590,13 +590,13 @@ static void isr_tx(void *param)
|
||||||
LL_ASSERT(start_us == (subevent_us + 1U));
|
LL_ASSERT(start_us == (subevent_us + 1U));
|
||||||
|
|
||||||
/* Get reference to ACL context */
|
/* Get reference to ACL context */
|
||||||
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
|
evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
|
||||||
|
|
||||||
/* Calculate the radio channel to use for next subevent */
|
/* Calculate the radio channel to use for next subevent */
|
||||||
data_chan_id = lll_chan_id(cis_lll->access_addr);
|
data_chan_id = lll_chan_id(cis_lll->access_addr);
|
||||||
next_chan_use = lll_chan_iso_subevent(data_chan_id,
|
next_chan_use = lll_chan_iso_subevent(data_chan_id,
|
||||||
conn_lll->data_chan_map,
|
evt_conn_lll->data_chan_map,
|
||||||
conn_lll->data_chan_count,
|
evt_conn_lll->data_chan_count,
|
||||||
&data_chan_prn_s,
|
&data_chan_prn_s,
|
||||||
&data_chan_remap_idx);
|
&data_chan_remap_idx);
|
||||||
} else {
|
} else {
|
||||||
|
@ -938,21 +938,21 @@ isr_rx_next_subevent:
|
||||||
bn = cis_lll->rx.bn_curr;
|
bn = cis_lll->rx.bn_curr;
|
||||||
while (bn <= cis_lll->rx.bn) {
|
while (bn <= cis_lll->rx.bn) {
|
||||||
struct node_rx_iso_meta *iso_meta;
|
struct node_rx_iso_meta *iso_meta;
|
||||||
struct node_rx_pdu *node_rx;
|
struct node_rx_pdu *status_node_rx;
|
||||||
|
|
||||||
/* Ensure there is always one free for reception
|
/* Ensure there is always one free for reception
|
||||||
* of ISO PDU by the radio h/w DMA, hence peek
|
* of ISO PDU by the radio h/w DMA, hence peek
|
||||||
* for two available ISO PDU when using one for
|
* for two available ISO PDU when using one for
|
||||||
* generating invalid ISO data.
|
* generating invalid ISO data.
|
||||||
*/
|
*/
|
||||||
node_rx = ull_iso_pdu_rx_alloc_peek(2U);
|
status_node_rx = ull_iso_pdu_rx_alloc_peek(2U);
|
||||||
if (!node_rx) {
|
if (!status_node_rx) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node_rx->hdr.type = NODE_RX_TYPE_ISO_PDU;
|
status_node_rx->hdr.type = NODE_RX_TYPE_ISO_PDU;
|
||||||
node_rx->hdr.handle = cis_lll->handle;
|
status_node_rx->hdr.handle = cis_lll->handle;
|
||||||
iso_meta = &node_rx->hdr.rx_iso_meta;
|
iso_meta = &status_node_rx->hdr.rx_iso_meta;
|
||||||
iso_meta->payload_number = (cis_lll->event_count *
|
iso_meta->payload_number = (cis_lll->event_count *
|
||||||
cis_lll->rx.bn) + (bn - 1U);
|
cis_lll->rx.bn) + (bn - 1U);
|
||||||
iso_meta->timestamp =
|
iso_meta->timestamp =
|
||||||
|
@ -963,7 +963,7 @@ isr_rx_next_subevent:
|
||||||
iso_meta->status = 1U;
|
iso_meta->status = 1U;
|
||||||
|
|
||||||
ull_iso_pdu_rx_alloc();
|
ull_iso_pdu_rx_alloc();
|
||||||
iso_rx_put(node_rx->hdr.link, node_rx);
|
iso_rx_put(status_node_rx->hdr.link, status_node_rx);
|
||||||
|
|
||||||
bn++;
|
bn++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,12 +814,12 @@ void lll_conn_pdu_tx_prep(struct lll_conn *lll, struct pdu_data **pdu_data_tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_FORCE_MD_AUTO)
|
#if defined(CONFIG_BT_CTLR_FORCE_MD_AUTO)
|
||||||
uint8_t lll_conn_force_md_cnt_set(uint8_t force_md_cnt)
|
uint8_t lll_conn_force_md_cnt_set(uint8_t reload_cnt)
|
||||||
{
|
{
|
||||||
uint8_t previous;
|
uint8_t previous;
|
||||||
|
|
||||||
previous = force_md_cnt_reload;
|
previous = force_md_cnt_reload;
|
||||||
force_md_cnt_reload = force_md_cnt;
|
force_md_cnt_reload = reload_cnt;
|
||||||
|
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,12 +257,12 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||||
} else if (conn_lll->enc_rx) {
|
} else if (conn_lll->enc_rx) {
|
||||||
uint64_t payload_count;
|
uint64_t payload_cnt;
|
||||||
uint8_t pkt_flags;
|
uint8_t pkt_flags;
|
||||||
|
|
||||||
payload_count = (cis_lll->event_count * cis_lll->rx.bn) +
|
payload_cnt = (cis_lll->event_count * cis_lll->rx.bn) +
|
||||||
(cis_lll->rx.bn_curr - 1U);
|
(cis_lll->rx.bn_curr - 1U);
|
||||||
cis_lll->rx.ccm.counter = payload_count;
|
cis_lll->rx.ccm.counter = payload_cnt;
|
||||||
|
|
||||||
pkt_flags = RADIO_PKT_CONF_FLAGS(RADIO_PKT_CONF_PDU_TYPE_DC,
|
pkt_flags = RADIO_PKT_CONF_FLAGS(RADIO_PKT_CONF_PDU_TYPE_DC,
|
||||||
phy,
|
phy,
|
||||||
|
|
|
@ -1083,18 +1083,18 @@ static void isr_done_cleanup(void *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lll->is_aux_sched) {
|
if (lll->is_aux_sched) {
|
||||||
struct node_rx_pdu *node_rx;
|
struct node_rx_pdu *node_rx2;
|
||||||
|
|
||||||
lll->is_aux_sched = 0U;
|
lll->is_aux_sched = 0U;
|
||||||
|
|
||||||
node_rx = ull_pdu_rx_alloc();
|
node_rx2 = ull_pdu_rx_alloc();
|
||||||
LL_ASSERT(node_rx);
|
LL_ASSERT(node_rx2);
|
||||||
|
|
||||||
node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
|
node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
|
||||||
|
|
||||||
node_rx->hdr.rx_ftr.param = lll;
|
node_rx2->hdr.rx_ftr.param = lll;
|
||||||
|
|
||||||
ull_rx_put_sched(node_rx->hdr.link, node_rx);
|
ull_rx_put_sched(node_rx2->hdr.link, node_rx2);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CTLR_ADV_EXT */
|
#endif /* CONFIG_BT_CTLR_ADV_EXT */
|
||||||
|
|
||||||
|
|
|
@ -846,12 +846,12 @@ isr_rx_do_close:
|
||||||
} else {
|
} else {
|
||||||
/* Send message to flush Auxiliary PDU list */
|
/* Send message to flush Auxiliary PDU list */
|
||||||
if (lll->is_aux_sched && err != -ECANCELED) {
|
if (lll->is_aux_sched && err != -ECANCELED) {
|
||||||
struct node_rx_pdu *node_rx;
|
struct node_rx_pdu *node_rx2;
|
||||||
|
|
||||||
node_rx = ull_pdu_rx_alloc();
|
node_rx2 = ull_pdu_rx_alloc();
|
||||||
LL_ASSERT(node_rx);
|
LL_ASSERT(node_rx2);
|
||||||
|
|
||||||
node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
|
node_rx2->hdr.type = NODE_RX_TYPE_EXT_AUX_RELEASE;
|
||||||
|
|
||||||
/* Use LLL scan context pointer which will be resolved
|
/* Use LLL scan context pointer which will be resolved
|
||||||
* to LLL aux context in the `ull_scan_aux_release`
|
* to LLL aux context in the `ull_scan_aux_release`
|
||||||
|
@ -862,9 +862,9 @@ isr_rx_do_close:
|
||||||
* under race, if ULL execution did assign one, it will
|
* under race, if ULL execution did assign one, it will
|
||||||
* free it.
|
* free it.
|
||||||
*/
|
*/
|
||||||
node_rx->hdr.rx_ftr.param = lll;
|
node_rx2->hdr.rx_ftr.param = lll;
|
||||||
|
|
||||||
ull_rx_put_sched(node_rx->hdr.link, node_rx);
|
ull_rx_put_sched(node_rx2->hdr.link, node_rx2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if LLL scheduled auxiliary PDU reception by scan
|
/* Check if LLL scheduled auxiliary PDU reception by scan
|
||||||
|
@ -902,7 +902,6 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
|
||||||
lll_scan_ext_tgta_check(lll, false, true, pdu,
|
lll_scan_ext_tgta_check(lll, false, true, pdu,
|
||||||
rl_idx, NULL)) {
|
rl_idx, NULL)) {
|
||||||
struct lll_scan_aux *lll_aux_to_use;
|
struct lll_scan_aux *lll_aux_to_use;
|
||||||
struct node_rx_ftr *ftr;
|
|
||||||
struct node_rx_pdu *rx;
|
struct node_rx_pdu *rx;
|
||||||
struct pdu_adv *pdu_tx;
|
struct pdu_adv *pdu_tx;
|
||||||
uint32_t conn_space_us;
|
uint32_t conn_space_us;
|
||||||
|
|
|
@ -301,8 +301,6 @@ static int create_prepare_cb(struct lll_prepare_param *p)
|
||||||
if (false) {
|
if (false) {
|
||||||
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
|
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
|
||||||
} else if (cfg->is_enabled) {
|
} else if (cfg->is_enabled) {
|
||||||
int err;
|
|
||||||
|
|
||||||
/* In case of call in create_prepare_cb, new sync event starts hence discard
|
/* In case of call in create_prepare_cb, new sync event starts hence discard
|
||||||
* previous incomplete state.
|
* previous incomplete state.
|
||||||
*/
|
*/
|
||||||
|
@ -312,8 +310,8 @@ static int create_prepare_cb(struct lll_prepare_param *p)
|
||||||
err = lll_df_iq_report_no_resources_prepare(lll);
|
err = lll_df_iq_report_no_resources_prepare(lll);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
err = lll_df_conf_cte_rx_enable(cfg->slot_durations, cfg->ant_sw_len,
|
err = lll_df_conf_cte_rx_enable(cfg->slot_durations, cfg->ant_sw_len,
|
||||||
cfg->ant_ids, chan_idx, CTE_INFO_IN_PAYLOAD,
|
cfg->ant_ids, chan_idx,
|
||||||
lll->phy);
|
CTE_INFO_IN_PAYLOAD, lll->phy);
|
||||||
if (err) {
|
if (err) {
|
||||||
lll->is_cte_incomplete = true;
|
lll->is_cte_incomplete = true;
|
||||||
}
|
}
|
||||||
|
@ -388,8 +386,6 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
cfg = lll_df_sync_cfg_latest_get(&lll->df_cfg, NULL);
|
cfg = lll_df_sync_cfg_latest_get(&lll->df_cfg, NULL);
|
||||||
|
|
||||||
if (cfg->is_enabled) {
|
if (cfg->is_enabled) {
|
||||||
int err;
|
|
||||||
|
|
||||||
/* In case of call in prepare, new sync event starts hence discard previous
|
/* In case of call in prepare, new sync event starts hence discard previous
|
||||||
* incomplete state.
|
* incomplete state.
|
||||||
*/
|
*/
|
||||||
|
@ -399,8 +395,8 @@ static int prepare_cb(struct lll_prepare_param *p)
|
||||||
err = lll_df_iq_report_no_resources_prepare(lll);
|
err = lll_df_iq_report_no_resources_prepare(lll);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
err = lll_df_conf_cte_rx_enable(cfg->slot_durations, cfg->ant_sw_len,
|
err = lll_df_conf_cte_rx_enable(cfg->slot_durations, cfg->ant_sw_len,
|
||||||
cfg->ant_ids, chan_idx, CTE_INFO_IN_PAYLOAD,
|
cfg->ant_ids, chan_idx,
|
||||||
lll->phy);
|
CTE_INFO_IN_PAYLOAD, lll->phy);
|
||||||
if (err) {
|
if (err) {
|
||||||
lll->is_cte_incomplete = true;
|
lll->is_cte_incomplete = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,14 +529,14 @@ static void isr_rx(void *param)
|
||||||
|
|
||||||
/* Save the AA captured for the first anchor point sync */
|
/* Save the AA captured for the first anchor point sync */
|
||||||
if (!radio_tmr_aa_restore()) {
|
if (!radio_tmr_aa_restore()) {
|
||||||
const struct lll_sync_iso_stream *stream;
|
const struct lll_sync_iso_stream *sync_stream;
|
||||||
uint32_t se_offset_us;
|
uint32_t se_offset_us;
|
||||||
uint8_t se;
|
uint8_t se;
|
||||||
|
|
||||||
crc_ok_anchor = crc_ok;
|
crc_ok_anchor = crc_ok;
|
||||||
|
|
||||||
stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
sync_stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
|
||||||
se = ((lll->bis_curr - stream->bis_index) *
|
se = ((lll->bis_curr - sync_stream->bis_index) *
|
||||||
((lll->bn * lll->irc) + lll->ptc)) +
|
((lll->bn * lll->irc) + lll->ptc)) +
|
||||||
((lll->irc_curr - 1U) * lll->bn) + (lll->bn_curr - 1U) +
|
((lll->irc_curr - 1U) * lll->bn) + (lll->bn_curr - 1U) +
|
||||||
lll->ptc_curr + lll->ctrl;
|
lll->ptc_curr + lll->ctrl;
|
||||||
|
@ -553,7 +553,7 @@ static void isr_rx(void *param)
|
||||||
|
|
||||||
/* Check CRC and generate ISO Data PDU */
|
/* Check CRC and generate ISO Data PDU */
|
||||||
if (crc_ok) {
|
if (crc_ok) {
|
||||||
struct lll_sync_iso_stream *stream;
|
struct lll_sync_iso_stream *sync_stream;
|
||||||
uint16_t stream_handle;
|
uint16_t stream_handle;
|
||||||
struct pdu_bis *pdu;
|
struct pdu_bis *pdu;
|
||||||
|
|
||||||
|
@ -600,10 +600,10 @@ static void isr_rx(void *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_handle = lll->stream_handle[lll->stream_curr];
|
stream_handle = lll->stream_handle[lll->stream_curr];
|
||||||
stream = ull_sync_iso_lll_stream_get(stream_handle);
|
sync_stream = ull_sync_iso_lll_stream_get(stream_handle);
|
||||||
|
|
||||||
/* store the received PDU */
|
/* store the received PDU */
|
||||||
if ((lll->bis_curr == stream->bis_index) && pdu->len &&
|
if ((lll->bis_curr == sync_stream->bis_index) && pdu->len &&
|
||||||
!lll->payload[bis_idx][payload_index] &&
|
!lll->payload[bis_idx][payload_index] &&
|
||||||
((payload_index >= lll->payload_tail) ||
|
((payload_index >= lll->payload_tail) ||
|
||||||
(payload_index < lll->payload_head))) {
|
(payload_index < lll->payload_head))) {
|
||||||
|
@ -723,18 +723,18 @@ isr_rx_find_subevent:
|
||||||
/* Next BIS */
|
/* Next BIS */
|
||||||
if (lll->bis_curr < lll->num_bis) {
|
if (lll->bis_curr < lll->num_bis) {
|
||||||
const uint8_t stream_curr = lll->stream_curr + 1U;
|
const uint8_t stream_curr = lll->stream_curr + 1U;
|
||||||
struct lll_sync_iso_stream *stream;
|
struct lll_sync_iso_stream *sync_stream;
|
||||||
uint16_t stream_handle;
|
uint16_t stream_handle;
|
||||||
|
|
||||||
/* Next selected stream */
|
/* Next selected stream */
|
||||||
if (stream_curr < lll->stream_count) {
|
if (stream_curr < lll->stream_count) {
|
||||||
lll->stream_curr = stream_curr;
|
lll->stream_curr = stream_curr;
|
||||||
stream_handle = lll->stream_handle[lll->stream_curr];
|
stream_handle = lll->stream_handle[lll->stream_curr];
|
||||||
stream = ull_sync_iso_lll_stream_get(stream_handle);
|
sync_stream = ull_sync_iso_lll_stream_get(stream_handle);
|
||||||
if (stream->bis_index <= lll->num_bis) {
|
if (sync_stream->bis_index <= lll->num_bis) {
|
||||||
uint8_t bis_idx_new;
|
uint8_t bis_idx_new;
|
||||||
|
|
||||||
lll->bis_curr = stream->bis_index;
|
lll->bis_curr = sync_stream->bis_index;
|
||||||
lll->ptc_curr = 0U;
|
lll->ptc_curr = 0U;
|
||||||
lll->irc_curr = 1U;
|
lll->irc_curr = 1U;
|
||||||
lll->bn_curr = 1U;
|
lll->bn_curr = 1U;
|
||||||
|
|
|
@ -661,7 +661,7 @@ static void ticker_start_next_op_cb(uint32_t status, void *param)
|
||||||
LL_ASSERT(status == TICKER_STATUS_SUCCESS);
|
LL_ASSERT(status == TICKER_STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t preempt_ticker_start(struct lll_event *event,
|
static uint32_t preempt_ticker_start(struct lll_event *evt,
|
||||||
ticker_op_func op_cb)
|
ticker_op_func op_cb)
|
||||||
{
|
{
|
||||||
struct lll_prepare_param *p;
|
struct lll_prepare_param *p;
|
||||||
|
@ -671,7 +671,7 @@ static uint32_t preempt_ticker_start(struct lll_event *event,
|
||||||
uint32_t ret;
|
uint32_t ret;
|
||||||
|
|
||||||
/* Calc the preempt timeout */
|
/* Calc the preempt timeout */
|
||||||
p = &event->prepare_param;
|
p = &evt->prepare_param;
|
||||||
ull = HDR_LLL2ULL(p->param);
|
ull = HDR_LLL2ULL(p->param);
|
||||||
preempt_anchor = p->ticks_at_expire;
|
preempt_anchor = p->ticks_at_expire;
|
||||||
preempt_to = MAX(ull->ticks_active_to_start,
|
preempt_to = MAX(ull->ticks_active_to_start,
|
||||||
|
@ -688,8 +688,8 @@ static uint32_t preempt_ticker_start(struct lll_event *event,
|
||||||
TICKER_NULL_REMAINDER,
|
TICKER_NULL_REMAINDER,
|
||||||
TICKER_NULL_LAZY,
|
TICKER_NULL_LAZY,
|
||||||
TICKER_NULL_SLOT,
|
TICKER_NULL_SLOT,
|
||||||
preempt_ticker_cb, event,
|
preempt_ticker_cb, evt,
|
||||||
op_cb, event);
|
op_cb, evt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1100,11 +1100,11 @@ void ll_rx_dequeue(void)
|
||||||
|
|
||||||
LL_ASSERT(!lll_conn->link_tx_free);
|
LL_ASSERT(!lll_conn->link_tx_free);
|
||||||
|
|
||||||
memq_link_t *link = memq_deinit(&lll_conn->memq_tx.head,
|
memq_link_t *memq_link = memq_deinit(&lll_conn->memq_tx.head,
|
||||||
&lll_conn->memq_tx.tail);
|
&lll_conn->memq_tx.tail);
|
||||||
LL_ASSERT(link);
|
LL_ASSERT(memq_link);
|
||||||
|
|
||||||
lll_conn->link_tx_free = link;
|
lll_conn->link_tx_free = memq_link;
|
||||||
|
|
||||||
struct ll_conn *conn = HDR_LLL2ULL(lll_conn);
|
struct ll_conn *conn = HDR_LLL2ULL(lll_conn);
|
||||||
|
|
||||||
|
@ -1144,17 +1144,17 @@ void ll_rx_dequeue(void)
|
||||||
if (cc->status == BT_HCI_ERR_ADV_TIMEOUT) {
|
if (cc->status == BT_HCI_ERR_ADV_TIMEOUT) {
|
||||||
struct lll_conn *conn_lll;
|
struct lll_conn *conn_lll;
|
||||||
struct ll_conn *conn;
|
struct ll_conn *conn;
|
||||||
memq_link_t *link;
|
memq_link_t *memq_link;
|
||||||
|
|
||||||
conn_lll = lll->conn;
|
conn_lll = lll->conn;
|
||||||
LL_ASSERT(conn_lll);
|
LL_ASSERT(conn_lll);
|
||||||
lll->conn = NULL;
|
lll->conn = NULL;
|
||||||
|
|
||||||
LL_ASSERT(!conn_lll->link_tx_free);
|
LL_ASSERT(!conn_lll->link_tx_free);
|
||||||
link = memq_deinit(&conn_lll->memq_tx.head,
|
memq_link = memq_deinit(&conn_lll->memq_tx.head,
|
||||||
&conn_lll->memq_tx.tail);
|
&conn_lll->memq_tx.tail);
|
||||||
LL_ASSERT(link);
|
LL_ASSERT(memq_link);
|
||||||
conn_lll->link_tx_free = link;
|
conn_lll->link_tx_free = memq_link;
|
||||||
|
|
||||||
conn = HDR_LLL2ULL(conn_lll);
|
conn = HDR_LLL2ULL(conn_lll);
|
||||||
ll_conn_release(conn);
|
ll_conn_release(conn);
|
||||||
|
|
|
@ -1392,7 +1392,7 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
* started.
|
* started.
|
||||||
*/
|
*/
|
||||||
if (sync) {
|
if (sync) {
|
||||||
uint32_t ticks_slot_overhead;
|
uint32_t ticks_slot_overhead2;
|
||||||
uint32_t ticks_slot_aux;
|
uint32_t ticks_slot_aux;
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_ADV_RESERVE_MAX)
|
#if defined(CONFIG_BT_CTLR_ADV_RESERVE_MAX)
|
||||||
|
@ -1436,10 +1436,10 @@ uint8_t ll_adv_enable(uint8_t enable)
|
||||||
|
|
||||||
#endif /* CONFIG_BT_CTLR_ADV_AUX_SYNC_OFFSET */
|
#endif /* CONFIG_BT_CTLR_ADV_AUX_SYNC_OFFSET */
|
||||||
|
|
||||||
ticks_slot_overhead = ull_adv_sync_evt_init(adv, sync, NULL);
|
ticks_slot_overhead2 = ull_adv_sync_evt_init(adv, sync, NULL);
|
||||||
ret = ull_adv_sync_start(adv, sync,
|
ret = ull_adv_sync_start(adv, sync,
|
||||||
ticks_anchor_sync,
|
ticks_anchor_sync,
|
||||||
ticks_slot_overhead);
|
ticks_slot_overhead2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
goto failure_cleanup;
|
goto failure_cleanup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,7 +582,7 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref,
|
||||||
|
|
||||||
if (adv->is_enabled) {
|
if (adv->is_enabled) {
|
||||||
struct ll_adv_aux_set *aux;
|
struct ll_adv_aux_set *aux;
|
||||||
struct pdu_adv *pdu;
|
struct pdu_adv *chan_res_pdu;
|
||||||
uint8_t tmp_idx;
|
uint8_t tmp_idx;
|
||||||
|
|
||||||
aux = HDR_LLL2ULL(adv->lll.aux);
|
aux = HDR_LLL2ULL(adv->lll.aux);
|
||||||
|
@ -634,8 +634,8 @@ uint8_t ll_adv_aux_ad_data_set(uint8_t handle, uint8_t op, uint8_t frag_pref,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update primary channel reservation */
|
/* Update primary channel reservation */
|
||||||
pdu = lll_adv_data_alloc(&adv->lll, &tmp_idx);
|
chan_res_pdu = lll_adv_data_alloc(&adv->lll, &tmp_idx);
|
||||||
err = ull_adv_time_update(adv, pdu, NULL);
|
err = ull_adv_time_update(adv, chan_res_pdu, NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -3053,7 +3053,6 @@ void ull_adv_aux_lll_auxptr_fill(struct pdu_adv *pdu, struct lll_adv *adv)
|
||||||
offset_us = HAL_TICKER_TICKS_TO_US(lll_aux->ticks_pri_pdu_offset) +
|
offset_us = HAL_TICKER_TICKS_TO_US(lll_aux->ticks_pri_pdu_offset) +
|
||||||
lll_aux->us_pri_pdu_offset;
|
lll_aux->us_pri_pdu_offset;
|
||||||
if ((offset_us/OFFS_UNIT_30_US)*OFFS_UNIT_30_US < EVENT_MAFS_US + pdu_us) {
|
if ((offset_us/OFFS_UNIT_30_US)*OFFS_UNIT_30_US < EVENT_MAFS_US + pdu_us) {
|
||||||
struct ll_adv_aux_set *aux = HDR_LLL2ULL(lll_aux);
|
|
||||||
uint32_t interval_us;
|
uint32_t interval_us;
|
||||||
|
|
||||||
/* Offset too small, point to next aux packet instead */
|
/* Offset too small, point to next aux packet instead */
|
||||||
|
|
|
@ -1383,20 +1383,20 @@ static void tx_lll_flush(void *param)
|
||||||
struct lll_adv_iso_stream *stream;
|
struct lll_adv_iso_stream *stream;
|
||||||
struct node_tx_iso *tx;
|
struct node_tx_iso *tx;
|
||||||
uint16_t stream_handle;
|
uint16_t stream_handle;
|
||||||
memq_link_t *link;
|
memq_link_t *link2;
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
|
|
||||||
stream_handle = lll->stream_handle[num_bis];
|
stream_handle = lll->stream_handle[num_bis];
|
||||||
handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle);
|
handle = LL_BIS_ADV_HANDLE_FROM_IDX(stream_handle);
|
||||||
stream = ull_adv_iso_stream_get(stream_handle);
|
stream = ull_adv_iso_stream_get(stream_handle);
|
||||||
|
|
||||||
link = memq_dequeue(stream->memq_tx.tail, &stream->memq_tx.head,
|
link2 = memq_dequeue(stream->memq_tx.tail, &stream->memq_tx.head,
|
||||||
(void **)&tx);
|
(void **)&tx);
|
||||||
while (link) {
|
while (link2) {
|
||||||
tx->next = link;
|
tx->next = link2;
|
||||||
ull_iso_lll_ack_enqueue(handle, tx);
|
ull_iso_lll_ack_enqueue(handle, tx);
|
||||||
|
|
||||||
link = memq_dequeue(stream->memq_tx.tail,
|
link2 = memq_dequeue(stream->memq_tx.tail,
|
||||||
&stream->memq_tx.head,
|
&stream->memq_tx.head,
|
||||||
(void **)&tx);
|
(void **)&tx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,6 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
||||||
uint8_t err;
|
|
||||||
|
|
||||||
err = adv_type_check(adv);
|
err = adv_type_check(adv);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -112,7 +110,6 @@ uint8_t ll_adv_sync_param_set(uint8_t handle, uint16_t interval, uint16_t flags)
|
||||||
struct pdu_adv *ter_pdu;
|
struct pdu_adv *ter_pdu;
|
||||||
struct lll_adv *lll;
|
struct lll_adv *lll;
|
||||||
uint8_t chm_last;
|
uint8_t chm_last;
|
||||||
int err;
|
|
||||||
|
|
||||||
sync = sync_acquire();
|
sync = sync_acquire();
|
||||||
if (!sync) {
|
if (!sync) {
|
||||||
|
@ -268,8 +265,6 @@ uint8_t ll_adv_sync_ad_data_set(uint8_t handle, uint8_t op, uint8_t len,
|
||||||
|
|
||||||
/* Check for advertising set type */
|
/* Check for advertising set type */
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
||||||
uint8_t err;
|
|
||||||
|
|
||||||
err = adv_type_check(adv);
|
err = adv_type_check(adv);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -757,8 +752,6 @@ uint8_t ll_adv_sync_enable(uint8_t handle, uint8_t enable)
|
||||||
|
|
||||||
/* Check for advertising set type */
|
/* Check for advertising set type */
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
|
||||||
uint8_t err;
|
|
||||||
|
|
||||||
err = adv_type_check(adv);
|
err = adv_type_check(adv);
|
||||||
if (err) {
|
if (err) {
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
|
|
|
@ -1237,7 +1237,7 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
ticks_slot_plus || ticks_slot_minus ||
|
ticks_slot_plus || ticks_slot_minus ||
|
||||||
lazy || force) {
|
lazy || force) {
|
||||||
uint8_t ticker_id = TICKER_ID_CONN_BASE + lll->handle;
|
uint8_t ticker_id = TICKER_ID_CONN_BASE + lll->handle;
|
||||||
struct ll_conn *conn = lll->hdr.parent;
|
struct ll_conn *conn_ll = lll->hdr.parent;
|
||||||
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
|
||||||
|
@ -1253,10 +1253,10 @@ void ull_conn_done(struct node_rx_event_done *done)
|
||||||
ticks_slot_plus, ticks_slot_minus,
|
ticks_slot_plus, ticks_slot_minus,
|
||||||
lazy, force,
|
lazy, force,
|
||||||
ticker_update_conn_op_cb,
|
ticker_update_conn_op_cb,
|
||||||
conn);
|
conn_ll);
|
||||||
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
||||||
(ticker_status == TICKER_STATUS_BUSY) ||
|
(ticker_status == TICKER_STATUS_BUSY) ||
|
||||||
((void *)conn == ull_disable_mark_get()));
|
((void *)conn_ll == ull_disable_mark_get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,11 +341,11 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
ftr->aux_data_len = sync->data_len + data_len;
|
ftr->aux_data_len = sync_set->data_len + data_len;
|
||||||
sync->data_len = 0U;
|
sync_set->data_len = 0U;
|
||||||
} else if (aux) {
|
} else if (aux) {
|
||||||
aux->data_len += data_len;
|
aux->data_len += data_len;
|
||||||
ftr->aux_data_len = aux->data_len;
|
ftr->aux_data_len = aux->data_len;
|
||||||
|
@ -469,11 +469,11 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
(!IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED) &&
|
(!IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED) &&
|
||||||
PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) == EXT_ADV_AUX_PHY_LE_CODED)) {
|
PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) == EXT_ADV_AUX_PHY_LE_CODED)) {
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
ftr->aux_data_len = sync->data_len + data_len;
|
ftr->aux_data_len = sync_set->data_len + data_len;
|
||||||
sync->data_len = 0U;
|
sync_set->data_len = 0U;
|
||||||
} else if (aux) {
|
} else if (aux) {
|
||||||
aux->data_len += data_len;
|
aux->data_len += data_len;
|
||||||
ftr->aux_data_len = aux->data_len;
|
ftr->aux_data_len = aux->data_len;
|
||||||
|
@ -509,11 +509,11 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) &&
|
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) &&
|
||||||
sync_lll) {
|
sync_lll) {
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
ftr->aux_data_len = sync->data_len + data_len;
|
ftr->aux_data_len = sync_set->data_len + data_len;
|
||||||
sync->data_len = 0U;
|
sync_set->data_len = 0U;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,11 +547,11 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
* enqueue rx in aux context and will flush them after scan is complete.
|
* enqueue rx in aux context and will flush them after scan is complete.
|
||||||
*/
|
*/
|
||||||
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) {
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
sync->data_len += data_len;
|
sync_set->data_len += data_len;
|
||||||
ftr->aux_data_len = sync->data_len;
|
ftr->aux_data_len = sync_set->data_len;
|
||||||
} else {
|
} else {
|
||||||
if (aux->rx_last) {
|
if (aux->rx_last) {
|
||||||
aux->rx_last->rx_ftr.extra = rx;
|
aux->rx_last->rx_ftr.extra = rx;
|
||||||
|
@ -607,14 +607,14 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
|
||||||
*/
|
*/
|
||||||
lll->lll_aux = NULL;
|
lll->lll_aux = NULL;
|
||||||
} else {
|
} else {
|
||||||
struct ll_sync_set *sync;
|
struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
LL_ASSERT(sync_lll &&
|
LL_ASSERT(sync_lll &&
|
||||||
(!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux));
|
(!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux));
|
||||||
|
|
||||||
/* Do not ULL schedule if sync terminate requested */
|
/* Do not ULL schedule if sync terminate requested */
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
if (unlikely(sync->is_stop)) {
|
if (unlikely(sync_set->is_stop)) {
|
||||||
goto ull_scan_aux_rx_flush;
|
goto ull_scan_aux_rx_flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,14 +758,14 @@ ull_scan_aux_rx_flush:
|
||||||
aux->rx_last->rx_ftr.extra = rx;
|
aux->rx_last->rx_ftr.extra = rx;
|
||||||
aux->rx_last = rx;
|
aux->rx_last = rx;
|
||||||
} else {
|
} else {
|
||||||
const struct ll_sync_set *sync;
|
const struct ll_sync_set *sync_set;
|
||||||
|
|
||||||
LL_ASSERT(sync_lll);
|
LL_ASSERT(sync_lll);
|
||||||
|
|
||||||
ll_rx_put_sched(link, rx);
|
ll_rx_put_sched(link, rx);
|
||||||
|
|
||||||
sync = HDR_LLL2ULL(sync_lll);
|
sync_set = HDR_LLL2ULL(sync_lll);
|
||||||
if (unlikely(sync->is_stop && sync_lll->lll_aux)) {
|
if (unlikely(sync_set->is_stop && sync_lll->lll_aux)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -853,12 +853,12 @@ void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll,
|
||||||
|
|
||||||
if (is_lll_scan) {
|
if (is_lll_scan) {
|
||||||
struct ll_scan_set *scan;
|
struct ll_scan_set *scan;
|
||||||
struct lll_scan *lll;
|
struct lll_scan *lllscan;
|
||||||
|
|
||||||
lll = aux->parent;
|
lllscan = aux->parent;
|
||||||
LL_ASSERT(lll);
|
LL_ASSERT(lllscan);
|
||||||
|
|
||||||
scan = HDR_LLL2ULL(lll);
|
scan = HDR_LLL2ULL(lllscan);
|
||||||
*is_lll_scan = !!ull_scan_is_valid_get(scan);
|
*is_lll_scan = !!ull_scan_is_valid_get(scan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ typedef struct ull_hdr *(*ull_hdr_get_func)(uint8_t ticker_id,
|
||||||
uint32_t *ticks_slot);
|
uint32_t *ticks_slot);
|
||||||
static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
||||||
ticker_op_match_func ticker_match_op_cb,
|
ticker_op_match_func ticker_match_op_cb,
|
||||||
ull_hdr_get_func ull_hdr_get_cb,
|
ull_hdr_get_func ull_hdr_get_cb_fn,
|
||||||
uint32_t *ticks_anchor,
|
uint32_t *ticks_anchor,
|
||||||
uint32_t *ticks_to_expire_match,
|
uint32_t *ticks_to_expire_match,
|
||||||
uint32_t *remainder_match,
|
uint32_t *remainder_match,
|
||||||
|
@ -413,7 +413,7 @@ static int group_free_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
||||||
|
|
||||||
static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
||||||
ticker_op_match_func ticker_match_op_cb,
|
ticker_op_match_func ticker_match_op_cb,
|
||||||
ull_hdr_get_func ull_hdr_get_cb,
|
ull_hdr_get_func ull_hdr_get_cb_fn,
|
||||||
uint32_t *ticks_anchor,
|
uint32_t *ticks_anchor,
|
||||||
uint32_t *ticks_to_expire_match,
|
uint32_t *ticks_to_expire_match,
|
||||||
uint32_t *remainder_match,
|
uint32_t *remainder_match,
|
||||||
|
@ -518,7 +518,7 @@ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH */
|
#endif /* CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH */
|
||||||
|
|
||||||
hdr = ull_hdr_get_cb(ticker_id, &ticks_slot);
|
hdr = ull_hdr_get_cb_fn(ticker_id, &ticks_slot);
|
||||||
if (!hdr) {
|
if (!hdr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,7 +609,6 @@ static int hci_set_adv_ext_fragmented(struct bt_le_ext_adv *adv, uint16_t hci_op
|
||||||
struct net_buf *buf;
|
struct net_buf *buf;
|
||||||
const size_t data_len = MIN(BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN, stream.remaining_size);
|
const size_t data_len = MIN(BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN, stream.remaining_size);
|
||||||
const size_t cmd_size = sizeof(*set_data) + data_len;
|
const size_t cmd_size = sizeof(*set_data) + data_len;
|
||||||
int err;
|
|
||||||
|
|
||||||
buf = bt_hci_cmd_create(hci_op, cmd_size);
|
buf = bt_hci_cmd_create(hci_op, cmd_size);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
|
@ -717,7 +716,6 @@ static int hci_set_per_adv_data(const struct bt_le_ext_adv *adv,
|
||||||
struct net_buf *buf;
|
struct net_buf *buf;
|
||||||
const size_t data_len = MIN(BT_HCI_LE_PER_ADV_FRAG_MAX_LEN, stream.remaining_size);
|
const size_t data_len = MIN(BT_HCI_LE_PER_ADV_FRAG_MAX_LEN, stream.remaining_size);
|
||||||
const size_t cmd_size = sizeof(*set_data) + data_len;
|
const size_t cmd_size = sizeof(*set_data) + data_len;
|
||||||
int err;
|
|
||||||
|
|
||||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_DATA, cmd_size);
|
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_DATA, cmd_size);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
|
|
|
@ -303,8 +303,6 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->code == BT_ATT_OP_SIGNED_WRITE_CMD) {
|
if (hdr->code == BT_ATT_OP_SIGNED_WRITE_CMD) {
|
||||||
int err;
|
|
||||||
|
|
||||||
err = bt_smp_sign(chan->att->conn, buf);
|
err = bt_smp_sign(chan->att->conn, buf);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Error signing data");
|
LOG_ERR("Error signing data");
|
||||||
|
|
|
@ -598,11 +598,11 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf)
|
||||||
check_names:
|
check_names:
|
||||||
/* if still waiting for names */
|
/* if still waiting for names */
|
||||||
for (i = 0; i < discovery_results_count; i++) {
|
for (i = 0; i < discovery_results_count; i++) {
|
||||||
struct discovery_priv *priv;
|
struct discovery_priv *dpriv;
|
||||||
|
|
||||||
priv = (struct discovery_priv *)&discovery_results[i]._priv;
|
dpriv = (struct discovery_priv *)&discovery_results[i]._priv;
|
||||||
|
|
||||||
if (priv->resolving) {
|
if (dpriv->resolving) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1522,9 +1522,7 @@ int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
|
||||||
|
|
||||||
static void notify_connected(struct bt_conn *conn)
|
static void notify_connected(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
|
||||||
if (cb->connected) {
|
if (cb->connected) {
|
||||||
cb->connected(conn, conn->err);
|
cb->connected(conn, conn->err);
|
||||||
}
|
}
|
||||||
|
@ -1539,9 +1537,7 @@ static void notify_connected(struct bt_conn *conn)
|
||||||
|
|
||||||
static void notify_disconnected(struct bt_conn *conn)
|
static void notify_disconnected(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
|
||||||
if (cb->disconnected) {
|
if (cb->disconnected) {
|
||||||
cb->disconnected(conn, conn->err);
|
cb->disconnected(conn, conn->err);
|
||||||
}
|
}
|
||||||
|
@ -1558,7 +1554,6 @@ static void notify_disconnected(struct bt_conn *conn)
|
||||||
void notify_remote_info(struct bt_conn *conn)
|
void notify_remote_info(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_remote_info remote_info;
|
struct bt_conn_remote_info remote_info;
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = bt_conn_get_remote_info(conn, &remote_info);
|
err = bt_conn_get_remote_info(conn, &remote_info);
|
||||||
|
@ -1567,7 +1562,7 @@ void notify_remote_info(struct bt_conn *conn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->remote_info_available) {
|
if (cb->remote_info_available) {
|
||||||
cb->remote_info_available(conn, &remote_info);
|
cb->remote_info_available(conn, &remote_info);
|
||||||
}
|
}
|
||||||
|
@ -1583,8 +1578,6 @@ void notify_remote_info(struct bt_conn *conn)
|
||||||
|
|
||||||
void notify_le_param_updated(struct bt_conn *conn)
|
void notify_le_param_updated(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
|
|
||||||
/* If new connection parameters meet requirement of pending
|
/* If new connection parameters meet requirement of pending
|
||||||
* parameters don't send peripheral conn param request anymore on timeout
|
* parameters don't send peripheral conn param request anymore on timeout
|
||||||
*/
|
*/
|
||||||
|
@ -1596,7 +1589,7 @@ void notify_le_param_updated(struct bt_conn *conn)
|
||||||
atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET);
|
atomic_clear_bit(conn->flags, BT_CONN_PERIPHERAL_PARAM_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->le_param_updated) {
|
if (cb->le_param_updated) {
|
||||||
cb->le_param_updated(conn, conn->le.interval,
|
cb->le_param_updated(conn, conn->le.interval,
|
||||||
conn->le.latency,
|
conn->le.latency,
|
||||||
|
@ -1616,9 +1609,7 @@ void notify_le_param_updated(struct bt_conn *conn)
|
||||||
#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
|
#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
|
||||||
void notify_le_data_len_updated(struct bt_conn *conn)
|
void notify_le_data_len_updated(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
|
||||||
if (cb->le_data_len_updated) {
|
if (cb->le_data_len_updated) {
|
||||||
cb->le_data_len_updated(conn, &conn->le.data_len);
|
cb->le_data_len_updated(conn, &conn->le.data_len);
|
||||||
}
|
}
|
||||||
|
@ -1635,9 +1626,7 @@ void notify_le_data_len_updated(struct bt_conn *conn)
|
||||||
#if defined(CONFIG_BT_USER_PHY_UPDATE)
|
#if defined(CONFIG_BT_USER_PHY_UPDATE)
|
||||||
void notify_le_phy_updated(struct bt_conn *conn)
|
void notify_le_phy_updated(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
|
||||||
if (cb->le_phy_updated) {
|
if (cb->le_phy_updated) {
|
||||||
cb->le_phy_updated(conn, &conn->le.phy);
|
cb->le_phy_updated(conn, &conn->le.phy);
|
||||||
}
|
}
|
||||||
|
@ -1653,13 +1642,11 @@ void notify_le_phy_updated(struct bt_conn *conn)
|
||||||
|
|
||||||
bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param)
|
bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
|
|
||||||
if (!bt_le_conn_params_valid(param)) {
|
if (!bt_le_conn_params_valid(param)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (!cb->le_param_req) {
|
if (!cb->le_param_req) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2149,7 +2136,6 @@ bool bt_conn_ltk_present(const struct bt_conn *conn)
|
||||||
void bt_conn_identity_resolved(struct bt_conn *conn)
|
void bt_conn_identity_resolved(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
const bt_addr_le_t *rpa;
|
const bt_addr_le_t *rpa;
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
|
|
||||||
if (conn->role == BT_HCI_ROLE_CENTRAL) {
|
if (conn->role == BT_HCI_ROLE_CENTRAL) {
|
||||||
rpa = &conn->le.resp_addr;
|
rpa = &conn->le.resp_addr;
|
||||||
|
@ -2157,7 +2143,7 @@ void bt_conn_identity_resolved(struct bt_conn *conn)
|
||||||
rpa = &conn->le.init_addr;
|
rpa = &conn->le.init_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->identity_resolved) {
|
if (cb->identity_resolved) {
|
||||||
cb->identity_resolved(conn, rpa, &conn->le.dst);
|
cb->identity_resolved(conn, rpa, &conn->le.dst);
|
||||||
}
|
}
|
||||||
|
@ -2261,15 +2247,13 @@ static void reset_pairing(struct bt_conn *conn)
|
||||||
void bt_conn_security_changed(struct bt_conn *conn, uint8_t hci_err,
|
void bt_conn_security_changed(struct bt_conn *conn, uint8_t hci_err,
|
||||||
enum bt_security_err err)
|
enum bt_security_err err)
|
||||||
{
|
{
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
|
|
||||||
reset_pairing(conn);
|
reset_pairing(conn);
|
||||||
bt_l2cap_security_changed(conn, hci_err);
|
bt_l2cap_security_changed(conn, hci_err);
|
||||||
if (IS_ENABLED(CONFIG_BT_ISO_CENTRAL)) {
|
if (IS_ENABLED(CONFIG_BT_ISO_CENTRAL)) {
|
||||||
bt_iso_security_changed(conn, hci_err);
|
bt_iso_security_changed(conn, hci_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->security_changed) {
|
if (cb->security_changed) {
|
||||||
cb->security_changed(conn, conn->sec_level, err);
|
cb->security_changed(conn, conn->sec_level, err);
|
||||||
}
|
}
|
||||||
|
@ -3366,7 +3350,6 @@ void bt_hci_le_df_connection_iq_report_common(uint8_t event, struct net_buf *buf
|
||||||
{
|
{
|
||||||
struct bt_df_conn_iq_samples_report iq_report;
|
struct bt_df_conn_iq_samples_report iq_report;
|
||||||
struct bt_conn *conn;
|
struct bt_conn *conn;
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (event == BT_HCI_EVT_LE_CONNECTION_IQ_REPORT) {
|
if (event == BT_HCI_EVT_LE_CONNECTION_IQ_REPORT) {
|
||||||
|
@ -3387,7 +3370,7 @@ void bt_hci_le_df_connection_iq_report_common(uint8_t event, struct net_buf *buf
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->cte_report_cb) {
|
if (cb->cte_report_cb) {
|
||||||
cb->cte_report_cb(conn, &iq_report);
|
cb->cte_report_cb(conn, &iq_report);
|
||||||
}
|
}
|
||||||
|
@ -3421,7 +3404,6 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf)
|
||||||
{
|
{
|
||||||
struct bt_df_conn_iq_samples_report iq_report;
|
struct bt_df_conn_iq_samples_report iq_report;
|
||||||
struct bt_conn *conn;
|
struct bt_conn *conn;
|
||||||
struct bt_conn_cb *cb;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = hci_df_prepare_conn_cte_req_failed(buf, &iq_report, &conn);
|
err = hci_df_prepare_conn_cte_req_failed(buf, &iq_report, &conn);
|
||||||
|
@ -3430,7 +3412,7 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cb = callback_list; cb; cb = cb->_next) {
|
for (struct bt_conn_cb *cb = callback_list; cb; cb = cb->_next) {
|
||||||
if (cb->cte_report_cb) {
|
if (cb->cte_report_cb) {
|
||||||
cb->cte_report_cb(conn, &iq_report);
|
cb->cte_report_cb(conn, &iq_report);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ static const uint8_t debug_public_key[BT_PUB_KEY_LEN] = {
|
||||||
0x6d, 0xeb, 0x2a, 0x65, 0x49, 0x9c, 0x80, 0xdc
|
0x6d, 0xeb, 0x2a, 0x65, 0x49, 0x9c, 0x80, 0xdc
|
||||||
};
|
};
|
||||||
|
|
||||||
bool bt_pub_key_is_debug(uint8_t *pub_key)
|
bool bt_pub_key_is_debug(uint8_t *cmp_pub_key)
|
||||||
{
|
{
|
||||||
return memcmp(pub_key, debug_public_key, BT_PUB_KEY_LEN) == 0;
|
return memcmp(cmp_pub_key, debug_public_key, BT_PUB_KEY_LEN) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
||||||
|
|
|
@ -38,11 +38,11 @@ struct bt_pub_key_cb {
|
||||||
* Compare the Public key to the Bluetooth specification defined debug public
|
* Compare the Public key to the Bluetooth specification defined debug public
|
||||||
* key.
|
* key.
|
||||||
*
|
*
|
||||||
* @param pub_key The public key to compare.
|
* @param cmp_pub_key The public key to compare.
|
||||||
*
|
*
|
||||||
* @return True if the public key is the debug public key.
|
* @return True if the public key is the debug public key.
|
||||||
*/
|
*/
|
||||||
bool bt_pub_key_is_debug(uint8_t *pub_key);
|
bool bt_pub_key_is_debug(uint8_t *cmp_pub_key);
|
||||||
|
|
||||||
/* @brief Generate a new Public Key.
|
/* @brief Generate a new Public Key.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3190,10 +3190,10 @@ static void sc_restore_rsp(struct bt_conn *conn,
|
||||||
#endif /* CONFIG_BT_GATT_CACHING */
|
#endif /* CONFIG_BT_GATT_CACHING */
|
||||||
|
|
||||||
if (!err && IS_ENABLED(CONFIG_BT_GATT_SERVICE_CHANGED)) {
|
if (!err && IS_ENABLED(CONFIG_BT_GATT_SERVICE_CHANGED)) {
|
||||||
struct gatt_sc_cfg *sc_cfg = find_sc_cfg(conn->id, &conn->le.dst);
|
struct gatt_sc_cfg *gsc_cfg = find_sc_cfg(conn->id, &conn->le.dst);
|
||||||
|
|
||||||
if (sc_cfg) {
|
if (gsc_cfg) {
|
||||||
sc_reset(sc_cfg);
|
sc_reset(gsc_cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,6 @@ void bt_iso_connected(struct bt_conn *iso)
|
||||||
} else if (iso->iso.info.type == BT_ISO_CHAN_TYPE_BROADCASTER ||
|
} else if (iso->iso.info.type == BT_ISO_CHAN_TYPE_BROADCASTER ||
|
||||||
iso->iso.info.type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER) {
|
iso->iso.info.type == BT_ISO_CHAN_TYPE_SYNC_RECEIVER) {
|
||||||
struct bt_iso_big *big;
|
struct bt_iso_big *big;
|
||||||
int err;
|
|
||||||
|
|
||||||
big = lookup_big_by_handle(iso->iso.big_handle);
|
big = lookup_big_by_handle(iso->iso.big_handle);
|
||||||
|
|
||||||
|
@ -2031,13 +2030,13 @@ int bt_iso_cig_reconfigure(struct bt_iso_cig *cig,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < param->num_cis; i++) {
|
for (uint8_t j = 0; j < param->num_cis; j++) {
|
||||||
struct bt_iso_chan *cis = param->cis_channels[i];
|
struct bt_iso_chan *param_cis = param->cis_channels[j];
|
||||||
|
|
||||||
if (cis->iso != NULL && !cis_is_in_cig(cig, cis)) {
|
if (param_cis->iso != NULL && !cis_is_in_cig(cig, param_cis)) {
|
||||||
LOG_DBG("Cannot reconfigure other CIG's (id 0x%02X) CIS "
|
LOG_DBG("Cannot reconfigure other CIG's (id 0x%02X) CIS "
|
||||||
"with this CIG (id 0x%02X)",
|
"with this CIG (id 0x%02X)",
|
||||||
cis->iso->iso.cig_id, cig->id);
|
param_cis->iso->iso.cig_id, cig->id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3175,24 +3174,24 @@ int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_para
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < param->num_bis; i++) {
|
for (uint8_t i = 0; i < param->num_bis; i++) {
|
||||||
struct bt_iso_chan *bis = param->bis_channels[i];
|
struct bt_iso_chan *param_bis = param->bis_channels[i];
|
||||||
|
|
||||||
CHECKIF(bis == NULL) {
|
CHECKIF(param_bis == NULL) {
|
||||||
LOG_DBG("bis_channels[%u]: NULL channel", i);
|
LOG_DBG("bis_channels[%u]: NULL channel", i);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bis->iso) {
|
if (param_bis->iso) {
|
||||||
LOG_DBG("bis_channels[%u]: already allocated", i);
|
LOG_DBG("bis_channels[%u]: already allocated", i);
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKIF(bis->qos == NULL) {
|
CHECKIF(param_bis->qos == NULL) {
|
||||||
LOG_DBG("bis_channels[%u]: qos is NULL", i);
|
LOG_DBG("bis_channels[%u]: qos is NULL", i);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKIF(bis->qos->rx == NULL) {
|
CHECKIF(param_bis->qos->rx == NULL) {
|
||||||
LOG_DBG("bis_channels[%u]: qos->rx is NULL", i);
|
LOG_DBG("bis_channels[%u]: qos->rx is NULL", i);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4894,14 +4894,14 @@ static const uint8_t M[] = {
|
||||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
|
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
static int aes_test(const char *prefix, const uint8_t *key, const uint8_t *m,
|
static int aes_test(const char *prefix, const uint8_t *in_key, const uint8_t *m,
|
||||||
uint16_t len, const uint8_t *mac)
|
uint16_t len, const uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t out[16];
|
uint8_t out[16];
|
||||||
|
|
||||||
LOG_DBG("%s: AES CMAC of message with len %u", prefix, len);
|
LOG_DBG("%s: AES CMAC of message with len %u", prefix, len);
|
||||||
|
|
||||||
bt_crypto_aes_cmac(key, m, len, out);
|
bt_crypto_aes_cmac(in_key, m, len, out);
|
||||||
if (!memcmp(out, mac, 16)) {
|
if (!memcmp(out, mac, 16)) {
|
||||||
LOG_DBG("%s: Success", prefix);
|
LOG_DBG("%s: Success", prefix);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4955,7 +4955,7 @@ static int smp_aes_cmac_test(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m,
|
static int sign_test(const char *prefix, const uint8_t *sign_key, const uint8_t *m,
|
||||||
uint16_t len, const uint8_t *sig)
|
uint16_t len, const uint8_t *sig)
|
||||||
{
|
{
|
||||||
uint8_t msg[len + sizeof(uint32_t) + 8];
|
uint8_t msg[len + sizeof(uint32_t) + 8];
|
||||||
|
@ -4971,7 +4971,7 @@ static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m,
|
||||||
|
|
||||||
memcpy(orig, msg, sizeof(msg));
|
memcpy(orig, msg, sizeof(msg));
|
||||||
|
|
||||||
err = smp_sign_buf(key, msg, len);
|
err = smp_sign_buf(sign_key, msg, len);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,8 +670,7 @@ static int mod_app_list_handle(struct bt_mesh_msg_ctx *ctx, struct net_buf_simpl
|
||||||
|
|
||||||
if (param->member_cnt && param->members) {
|
if (param->member_cnt && param->members) {
|
||||||
|
|
||||||
int err =
|
err = bt_mesh_key_idx_unpack_list(buf, param->members, param->member_cnt);
|
||||||
bt_mesh_key_idx_unpack_list(buf, param->members, param->member_cnt);
|
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("The message size for the application opcode is "
|
LOG_ERR("The message size for the application opcode is "
|
||||||
|
|
|
@ -31,7 +31,7 @@ static struct {
|
||||||
bool is_ready;
|
bool is_ready;
|
||||||
uint8_t private_key_be[PRIV_KEY_SIZE];
|
uint8_t private_key_be[PRIV_KEY_SIZE];
|
||||||
uint8_t public_key_be[PUB_KEY_SIZE];
|
uint8_t public_key_be[PUB_KEY_SIZE];
|
||||||
} key;
|
} dh_pair;
|
||||||
|
|
||||||
int bt_mesh_encrypt(const struct bt_mesh_key *key, const uint8_t plaintext[16],
|
int bt_mesh_encrypt(const struct bt_mesh_key *key, const uint8_t plaintext[16],
|
||||||
uint8_t enc_data[16])
|
uint8_t enc_data[16])
|
||||||
|
@ -110,22 +110,24 @@ int bt_mesh_sha256_hmac_raw_key(const uint8_t key[32], struct bt_mesh_sg *sg, si
|
||||||
|
|
||||||
int bt_mesh_pub_key_gen(void)
|
int bt_mesh_pub_key_gen(void)
|
||||||
{
|
{
|
||||||
int rc = uECC_make_key(key.public_key_be, key.private_key_be, &curve_secp256r1);
|
int rc = uECC_make_key(dh_pair.public_key_be,
|
||||||
|
dh_pair.private_key_be,
|
||||||
|
&curve_secp256r1);
|
||||||
|
|
||||||
if (rc == TC_CRYPTO_FAIL) {
|
if (rc == TC_CRYPTO_FAIL) {
|
||||||
key.is_ready = false;
|
dh_pair.is_ready = false;
|
||||||
LOG_ERR("Failed to create public/private pair");
|
LOG_ERR("Failed to create public/private pair");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
key.is_ready = true;
|
dh_pair.is_ready = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *bt_mesh_pub_key_get(void)
|
const uint8_t *bt_mesh_pub_key_get(void)
|
||||||
{
|
{
|
||||||
return key.is_ready ? key.public_key_be : NULL;
|
return dh_pair.is_ready ? dh_pair.public_key_be : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_dhkey_gen(const uint8_t *pub_key, const uint8_t *priv_key, uint8_t *dhkey)
|
int bt_mesh_dhkey_gen(const uint8_t *pub_key, const uint8_t *priv_key, uint8_t *dhkey)
|
||||||
|
@ -133,8 +135,9 @@ int bt_mesh_dhkey_gen(const uint8_t *pub_key, const uint8_t *priv_key, uint8_t *
|
||||||
if (uECC_valid_public_key(pub_key, &curve_secp256r1)) {
|
if (uECC_valid_public_key(pub_key, &curve_secp256r1)) {
|
||||||
LOG_ERR("Public key is not valid");
|
LOG_ERR("Public key is not valid");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} else if (uECC_shared_secret(pub_key, priv_key ? priv_key : key.private_key_be, dhkey,
|
} else if (uECC_shared_secret(pub_key, priv_key ? priv_key :
|
||||||
&curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
dh_pair.private_key_be,
|
||||||
|
dhkey, &curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
||||||
LOG_ERR("DHKey generation failed");
|
LOG_ERR("DHKey generation failed");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ enum {
|
||||||
STATE_SUSPENDED,
|
STATE_SUSPENDED,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t timeout = (10 * MSEC_PER_SEC);
|
static int32_t dfu_cli_timeout = (10 * MSEC_PER_SEC);
|
||||||
|
|
||||||
static struct bt_mesh_dfu_target *target_get(struct bt_mesh_dfu_cli *cli,
|
static struct bt_mesh_dfu_target *target_get(struct bt_mesh_dfu_cli *cli,
|
||||||
uint16_t addr)
|
uint16_t addr)
|
||||||
|
@ -1079,7 +1079,7 @@ int bt_mesh_dfu_cli_cancel(struct bt_mesh_dfu_cli *cli,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return req_wait(cli, K_MSEC(timeout));
|
return req_wait(cli, K_MSEC(dfu_cli_timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cli->xfer.state == STATE_IDLE) {
|
if (cli->xfer.state == STATE_IDLE) {
|
||||||
|
@ -1168,7 +1168,7 @@ int bt_mesh_dfu_cli_imgs_get(struct bt_mesh_dfu_cli *cli,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = req_wait(cli, K_MSEC(timeout));
|
err = req_wait(cli, K_MSEC(dfu_cli_timeout));
|
||||||
|
|
||||||
cli->req.img_cb = NULL;
|
cli->req.img_cb = NULL;
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ int bt_mesh_dfu_cli_metadata_check(struct bt_mesh_dfu_cli *cli,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return req_wait(cli, K_MSEC(timeout));
|
return req_wait(cli, K_MSEC(dfu_cli_timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
int bt_mesh_dfu_cli_status_get(struct bt_mesh_dfu_cli *cli,
|
int bt_mesh_dfu_cli_status_get(struct bt_mesh_dfu_cli *cli,
|
||||||
|
@ -1229,15 +1229,15 @@ int bt_mesh_dfu_cli_status_get(struct bt_mesh_dfu_cli *cli,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return req_wait(cli, K_MSEC(timeout));
|
return req_wait(cli, K_MSEC(dfu_cli_timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bt_mesh_dfu_cli_timeout_get(void)
|
int32_t bt_mesh_dfu_cli_timeout_get(void)
|
||||||
{
|
{
|
||||||
return timeout;
|
return dfu_cli_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_mesh_dfu_cli_timeout_set(int32_t t)
|
void bt_mesh_dfu_cli_timeout_set(int32_t t)
|
||||||
{
|
{
|
||||||
timeout = t;
|
dfu_cli_timeout = t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ static void friend_clear(struct bt_mesh_friend *frnd)
|
||||||
/* If cancelling the timer fails, we'll exit early in the work handler. */
|
/* If cancelling the timer fails, we'll exit early in the work handler. */
|
||||||
(void)k_work_cancel_delayable(&frnd->timer);
|
(void)k_work_cancel_delayable(&frnd->timer);
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(frnd->cred); i++) {
|
for (i = 0; i < ARRAY_SIZE(frnd->cred); i++) {
|
||||||
if (frnd->subnet->keys[i].valid) {
|
if (frnd->subnet->keys[i].valid) {
|
||||||
bt_mesh_friend_cred_destroy(&frnd->cred[i]);
|
bt_mesh_friend_cred_destroy(&frnd->cred[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ static void hb_publish(struct k_work *work)
|
||||||
.start = hb_publish_start_cb,
|
.start = hb_publish_start_cb,
|
||||||
.end = hb_publish_end_cb,
|
.end = hb_publish_end_cb,
|
||||||
};
|
};
|
||||||
struct bt_mesh_subnet *sub;
|
struct bt_mesh_subnet *subnet;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
LOG_DBG("hb_pub.count: %u", pub.count);
|
LOG_DBG("hb_pub.count: %u", pub.count);
|
||||||
|
@ -174,8 +174,8 @@ static void hb_publish(struct k_work *work)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub = bt_mesh_subnet_get(pub.net_idx);
|
subnet = bt_mesh_subnet_get(pub.net_idx);
|
||||||
if (!sub) {
|
if (!subnet) {
|
||||||
LOG_ERR("No matching subnet for idx 0x%02x", pub.net_idx);
|
LOG_ERR("No matching subnet for idx 0x%02x", pub.net_idx);
|
||||||
pub.dst = BT_MESH_ADDR_UNASSIGNED;
|
pub.dst = BT_MESH_ADDR_UNASSIGNED;
|
||||||
return;
|
return;
|
||||||
|
@ -412,7 +412,7 @@ void bt_mesh_hb_resume(void)
|
||||||
static int hb_pub_set(const char *name, size_t len_rd,
|
static int hb_pub_set(const char *name, size_t len_rd,
|
||||||
settings_read_cb read_cb, void *cb_arg)
|
settings_read_cb read_cb, void *cb_arg)
|
||||||
{
|
{
|
||||||
struct bt_mesh_hb_pub pub;
|
struct bt_mesh_hb_pub hb_pub;
|
||||||
struct hb_pub_val hb_val;
|
struct hb_pub_val hb_val;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -422,19 +422,19 @@ static int hb_pub_set(const char *name, size_t len_rd,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub.dst = hb_val.dst;
|
hb_pub.dst = hb_val.dst;
|
||||||
pub.period = bt_mesh_hb_pwr2(hb_val.period);
|
hb_pub.period = bt_mesh_hb_pwr2(hb_val.period);
|
||||||
pub.ttl = hb_val.ttl;
|
hb_pub.ttl = hb_val.ttl;
|
||||||
pub.feat = hb_val.feat;
|
hb_pub.feat = hb_val.feat;
|
||||||
pub.net_idx = hb_val.net_idx;
|
hb_pub.net_idx = hb_val.net_idx;
|
||||||
|
|
||||||
if (hb_val.indefinite) {
|
if (hb_val.indefinite) {
|
||||||
pub.count = 0xffff;
|
hb_pub.count = 0xffff;
|
||||||
} else {
|
} else {
|
||||||
pub.count = 0U;
|
hb_pub.count = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)bt_mesh_hb_pub_set(&pub);
|
(void)bt_mesh_hb_pub_set(&hb_pub);
|
||||||
|
|
||||||
LOG_DBG("Restored heartbeat publication");
|
LOG_DBG("Restored heartbeat publication");
|
||||||
|
|
||||||
|
@ -445,20 +445,20 @@ BT_MESH_SETTINGS_DEFINE(pub, "HBPub", hb_pub_set);
|
||||||
|
|
||||||
void bt_mesh_hb_pub_pending_store(void)
|
void bt_mesh_hb_pub_pending_store(void)
|
||||||
{
|
{
|
||||||
struct bt_mesh_hb_pub pub;
|
struct bt_mesh_hb_pub hb_pub;
|
||||||
struct hb_pub_val val;
|
struct hb_pub_val val;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
bt_mesh_hb_pub_get(&pub);
|
bt_mesh_hb_pub_get(&hb_pub);
|
||||||
if (pub.dst == BT_MESH_ADDR_UNASSIGNED) {
|
if (hb_pub.dst == BT_MESH_ADDR_UNASSIGNED) {
|
||||||
err = settings_delete("bt/mesh/HBPub");
|
err = settings_delete("bt/mesh/HBPub");
|
||||||
} else {
|
} else {
|
||||||
val.indefinite = (pub.count == 0xffff);
|
val.indefinite = (hb_pub.count == 0xffff);
|
||||||
val.dst = pub.dst;
|
val.dst = hb_pub.dst;
|
||||||
val.period = bt_mesh_hb_log(pub.period);
|
val.period = bt_mesh_hb_log(hb_pub.period);
|
||||||
val.ttl = pub.ttl;
|
val.ttl = hb_pub.ttl;
|
||||||
val.feat = pub.feat;
|
val.feat = hb_pub.feat;
|
||||||
val.net_idx = pub.net_idx;
|
val.net_idx = hb_pub.net_idx;
|
||||||
|
|
||||||
err = settings_save_one("bt/mesh/HBPub", &val, sizeof(val));
|
err = settings_save_one("bt/mesh/HBPub", &val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,11 +113,11 @@ static int bt_mesh_sar_cfg_cli_init(struct bt_mesh_model *model)
|
||||||
|
|
||||||
static void bt_mesh_sar_cfg_cli_reset(struct bt_mesh_model *model)
|
static void bt_mesh_sar_cfg_cli_reset(struct bt_mesh_model *model)
|
||||||
{
|
{
|
||||||
struct bt_mesh_sar_cfg_cli *cli;
|
struct bt_mesh_sar_cfg_cli *model_cli;
|
||||||
|
|
||||||
cli = model->user_data;
|
model_cli = model->user_data;
|
||||||
|
|
||||||
bt_mesh_msg_ack_ctx_clear(&cli->ack_ctx);
|
bt_mesh_msg_ack_ctx_clear(&model_cli->ack_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct bt_mesh_model_cb _bt_mesh_sar_cfg_cli_cb = {
|
const struct bt_mesh_model_cb _bt_mesh_sar_cfg_cli_cb = {
|
||||||
|
|
|
@ -877,16 +877,16 @@ static int cmd_auth_method_set_output(const struct shell *sh, size_t argc, char
|
||||||
static int cmd_auth_method_set_static(const struct shell *sh, size_t argc, char *argv[])
|
static int cmd_auth_method_set_static(const struct shell *sh, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
uint8_t static_val[16];
|
uint8_t static_oob_auth[16];
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
len = hex2bin(argv[1], strlen(argv[1]), static_val, sizeof(static_val));
|
len = hex2bin(argv[1], strlen(argv[1]), static_oob_auth, sizeof(static_oob_auth));
|
||||||
if (len < 1) {
|
if (len < 1) {
|
||||||
shell_warn(sh, "Unable to parse input string argument");
|
shell_warn(sh, "Unable to parse input string argument");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_mesh_auth_method_set_static(static_val, len);
|
err = bt_mesh_auth_method_set_static(static_oob_auth, len);
|
||||||
if (err) {
|
if (err) {
|
||||||
shell_error(sh, "Setting static OOB authentication failed (err %d)", err);
|
shell_error(sh, "Setting static OOB authentication failed (err %d)", err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1515,11 +1515,11 @@ static int cmd_scan_filter_clear_addr(const struct shell *sh, size_t argc,
|
||||||
|
|
||||||
#if defined(CONFIG_BT_BROADCASTER)
|
#if defined(CONFIG_BT_BROADCASTER)
|
||||||
static ssize_t ad_init(struct bt_data *data_array, const size_t data_array_size,
|
static ssize_t ad_init(struct bt_data *data_array, const size_t data_array_size,
|
||||||
const atomic_t *adv_opt)
|
const atomic_t *adv_options)
|
||||||
{
|
{
|
||||||
const bool discoverable = atomic_test_bit(adv_opt, SHELL_ADV_OPT_DISCOVERABLE);
|
const bool discoverable = atomic_test_bit(adv_options, SHELL_ADV_OPT_DISCOVERABLE);
|
||||||
const bool appearance = atomic_test_bit(adv_opt, SHELL_ADV_OPT_APPEARANCE);
|
const bool appearance = atomic_test_bit(adv_options, SHELL_ADV_OPT_APPEARANCE);
|
||||||
const bool adv_ext = atomic_test_bit(adv_opt, SHELL_ADV_OPT_EXT_ADV);
|
const bool adv_ext = atomic_test_bit(adv_options, SHELL_ADV_OPT_EXT_ADV);
|
||||||
static uint8_t ad_flags;
|
static uint8_t ad_flags;
|
||||||
size_t ad_len = 0;
|
size_t ad_len = 0;
|
||||||
|
|
||||||
|
@ -1548,11 +1548,11 @@ static ssize_t ad_init(struct bt_data *data_array, const size_t data_array_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appearance) {
|
if (appearance) {
|
||||||
const uint16_t appearance = bt_get_appearance();
|
const uint16_t appearance2 = bt_get_appearance();
|
||||||
static uint8_t appearance_data[sizeof(appearance)];
|
static uint8_t appearance_data[sizeof(appearance2)];
|
||||||
|
|
||||||
__ASSERT(data_array_size > ad_len, "No space for appearance");
|
__ASSERT(data_array_size > ad_len, "No space for appearance");
|
||||||
sys_put_le16(appearance, appearance_data);
|
sys_put_le16(appearance2, appearance_data);
|
||||||
data_array[ad_len].type = BT_DATA_GAP_APPEARANCE;
|
data_array[ad_len].type = BT_DATA_GAP_APPEARANCE;
|
||||||
data_array[ad_len].data_len = sizeof(appearance_data);
|
data_array[ad_len].data_len = sizeof(appearance_data);
|
||||||
data_array[ad_len].data = appearance_data;
|
data_array[ad_len].data = appearance_data;
|
||||||
|
@ -1573,7 +1573,7 @@ static ssize_t ad_init(struct bt_data *data_array, const size_t data_array_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_AUDIO) && IS_ENABLED(CONFIG_BT_EXT_ADV) && adv_ext) {
|
if (IS_ENABLED(CONFIG_BT_AUDIO) && IS_ENABLED(CONFIG_BT_EXT_ADV) && adv_ext) {
|
||||||
const bool connectable = atomic_test_bit(adv_opt, SHELL_ADV_OPT_CONNECTABLE);
|
const bool connectable = atomic_test_bit(adv_options, SHELL_ADV_OPT_CONNECTABLE);
|
||||||
ssize_t audio_ad_len;
|
ssize_t audio_ad_len;
|
||||||
|
|
||||||
audio_ad_len = audio_ad_data_add(&data_array[ad_len], data_array_size - ad_len,
|
audio_ad_len = audio_ad_data_add(&data_array[ad_len], data_array_size - ad_len,
|
||||||
|
@ -2332,30 +2332,30 @@ static int cmd_per_adv_sync_create(const struct shell *sh, size_t argc,
|
||||||
|
|
||||||
create_params.sid = strtol(argv[3], NULL, 16);
|
create_params.sid = strtol(argv[3], NULL, 16);
|
||||||
|
|
||||||
for (int i = 4; i < argc; i++) {
|
for (int j = 4; j < argc; j++) {
|
||||||
if (!strcmp(argv[i], "aoa")) {
|
if (!strcmp(argv[j], "aoa")) {
|
||||||
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA;
|
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA;
|
||||||
} else if (!strcmp(argv[i], "aod_1us")) {
|
} else if (!strcmp(argv[j], "aod_1us")) {
|
||||||
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US;
|
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US;
|
||||||
} else if (!strcmp(argv[i], "aod_2us")) {
|
} else if (!strcmp(argv[j], "aod_2us")) {
|
||||||
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US;
|
options |= BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US;
|
||||||
} else if (!strcmp(argv[i], "only_cte")) {
|
} else if (!strcmp(argv[j], "only_cte")) {
|
||||||
options |=
|
options |=
|
||||||
BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT;
|
BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT;
|
||||||
} else if (!strcmp(argv[i], "timeout")) {
|
} else if (!strcmp(argv[j], "timeout")) {
|
||||||
if (++i == argc) {
|
if (++j == argc) {
|
||||||
shell_help(sh);
|
shell_help(sh);
|
||||||
return SHELL_CMD_HELP_PRINTED;
|
return SHELL_CMD_HELP_PRINTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_params.timeout = strtoul(argv[i], NULL, 16);
|
create_params.timeout = strtoul(argv[j], NULL, 16);
|
||||||
} else if (!strcmp(argv[i], "skip")) {
|
} else if (!strcmp(argv[j], "skip")) {
|
||||||
if (++i == argc) {
|
if (++j == argc) {
|
||||||
shell_help(sh);
|
shell_help(sh);
|
||||||
return SHELL_CMD_HELP_PRINTED;
|
return SHELL_CMD_HELP_PRINTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_params.skip = strtoul(argv[i], NULL, 16);
|
create_params.skip = strtoul(argv[j], NULL, 16);
|
||||||
} else {
|
} else {
|
||||||
shell_help(sh);
|
shell_help(sh);
|
||||||
return SHELL_CMD_HELP_PRINTED;
|
return SHELL_CMD_HELP_PRINTED;
|
||||||
|
@ -2448,34 +2448,34 @@ static int cmd_past_subscribe(const struct shell *sh, size_t argc,
|
||||||
param.timeout = 1000; /* 10 seconds */
|
param.timeout = 1000; /* 10 seconds */
|
||||||
param.skip = 10;
|
param.skip = 10;
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int j = 1; j < argc; j++) {
|
||||||
if (!strcmp(argv[i], "aoa")) {
|
if (!strcmp(argv[j], "aoa")) {
|
||||||
param.options |=
|
param.options |=
|
||||||
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA;
|
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA;
|
||||||
} else if (!strcmp(argv[i], "aod_1us")) {
|
} else if (!strcmp(argv[j], "aod_1us")) {
|
||||||
param.options |=
|
param.options |=
|
||||||
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US;
|
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US;
|
||||||
} else if (!strcmp(argv[i], "aod_2us")) {
|
} else if (!strcmp(argv[j], "aod_2us")) {
|
||||||
param.options |=
|
param.options |=
|
||||||
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US;
|
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US;
|
||||||
} else if (!strcmp(argv[i], "only_cte")) {
|
} else if (!strcmp(argv[j], "only_cte")) {
|
||||||
param.options |=
|
param.options |=
|
||||||
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE;
|
BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE;
|
||||||
} else if (!strcmp(argv[i], "timeout")) {
|
} else if (!strcmp(argv[j], "timeout")) {
|
||||||
if (++i == argc) {
|
if (++j == argc) {
|
||||||
shell_help(sh);
|
shell_help(sh);
|
||||||
return SHELL_CMD_HELP_PRINTED;
|
return SHELL_CMD_HELP_PRINTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.timeout = strtoul(argv[i], NULL, 16);
|
param.timeout = strtoul(argv[j], NULL, 16);
|
||||||
} else if (!strcmp(argv[i], "skip")) {
|
} else if (!strcmp(argv[j], "skip")) {
|
||||||
if (++i == argc) {
|
if (++j == argc) {
|
||||||
shell_help(sh);
|
shell_help(sh);
|
||||||
return SHELL_CMD_HELP_PRINTED;
|
return SHELL_CMD_HELP_PRINTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.skip = strtoul(argv[i], NULL, 16);
|
param.skip = strtoul(argv[j], NULL, 16);
|
||||||
} else if (!strcmp(argv[i], "conn")) {
|
} else if (!strcmp(argv[j], "conn")) {
|
||||||
if (!default_conn) {
|
if (!default_conn) {
|
||||||
shell_print(sh, "Not connected");
|
shell_print(sh, "Not connected");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -718,7 +718,7 @@ static uint8_t print_attr(const struct bt_gatt_attr *attr, uint16_t handle,
|
||||||
|
|
||||||
static int cmd_show_db(const struct shell *sh, size_t argc, char *argv[])
|
static int cmd_show_db(const struct shell *sh, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct bt_uuid_16 uuid;
|
struct bt_uuid_16 uuid16;
|
||||||
size_t total_len;
|
size_t total_len;
|
||||||
|
|
||||||
memset(&stats, 0, sizeof(stats));
|
memset(&stats, 0, sizeof(stats));
|
||||||
|
@ -726,14 +726,14 @@ static int cmd_show_db(const struct shell *sh, size_t argc, char *argv[])
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
uint16_t num_matches = 0;
|
uint16_t num_matches = 0;
|
||||||
|
|
||||||
uuid.uuid.type = BT_UUID_TYPE_16;
|
uuid16.uuid.type = BT_UUID_TYPE_16;
|
||||||
uuid.val = strtoul(argv[1], NULL, 16);
|
uuid16.val = strtoul(argv[1], NULL, 16);
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
num_matches = strtoul(argv[2], NULL, 10);
|
num_matches = strtoul(argv[2], NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_gatt_foreach_attr_type(0x0001, 0xffff, &uuid.uuid, NULL,
|
bt_gatt_foreach_attr_type(0x0001, 0xffff, &uuid16.uuid, NULL,
|
||||||
num_matches, print_attr,
|
num_matches, print_attr,
|
||||||
(void *)sh);
|
(void *)sh);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue