Bluetooth: hci: Fix wrong CTE request interval type
Request interval is a number of connection events that is used to periodically run CTE request control procedure. BT 5.3 Core Specification defines it as 2 octets long. It had wrong type uint8_t. Changed to correct one uint16_t. The commit also changes type of cte_rsp_en field of lll_df_conn_tx_cfg to state that it is a boolean flag. Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
parent
5e2211fa3c
commit
0086e86153
8 changed files with 21 additions and 19 deletions
|
@ -179,7 +179,7 @@ struct bt_df_conn_cte_req_params {
|
||||||
* Value 0x0 means, run the procedure once. Other values are intervals in number of
|
* Value 0x0 means, run the procedure once. Other values are intervals in number of
|
||||||
* connection events, to run the command periodically.
|
* connection events, to run the command periodically.
|
||||||
*/
|
*/
|
||||||
uint8_t interval;
|
uint16_t interval;
|
||||||
/** Requested length of the CTE in 8 us units. */
|
/** Requested length of the CTE in 8 us units. */
|
||||||
uint8_t cte_length;
|
uint8_t cte_length;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1607,7 +1607,7 @@ struct bt_hci_rp_le_set_conn_cte_tx_params {
|
||||||
struct bt_hci_cp_le_conn_cte_req_enable {
|
struct bt_hci_cp_le_conn_cte_req_enable {
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
uint8_t enable;
|
uint8_t enable;
|
||||||
uint8_t cte_request_interval;
|
uint16_t cte_request_interval;
|
||||||
uint8_t requested_cte_length;
|
uint8_t requested_cte_length;
|
||||||
uint8_t requested_cte_type;
|
uint8_t requested_cte_type;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
|
@ -2983,7 +2983,8 @@ static void le_df_set_conn_cte_req_enable(struct net_buf *buf, struct net_buf **
|
||||||
handle_le16 = cmd->handle;
|
handle_le16 = cmd->handle;
|
||||||
handle = sys_le16_to_cpu(handle_le16);
|
handle = sys_le16_to_cpu(handle_le16);
|
||||||
|
|
||||||
status = ll_df_set_conn_cte_req_enable(handle, cmd->enable, cmd->cte_request_interval,
|
status = ll_df_set_conn_cte_req_enable(handle, cmd->enable,
|
||||||
|
sys_le16_to_cpu(cmd->cte_request_interval),
|
||||||
cmd->requested_cte_length, cmd->requested_cte_type);
|
cmd->requested_cte_length, cmd->requested_cte_type);
|
||||||
rp = hci_cmd_complete(evt, sizeof(*rp));
|
rp = hci_cmd_complete(evt, sizeof(*rp));
|
||||||
|
|
||||||
|
|
|
@ -303,8 +303,9 @@ uint8_t ll_df_set_conn_cte_rx_params(uint16_t handle, uint8_t sampling_enable,
|
||||||
uint8_t slot_durations, uint8_t switch_pattern_len,
|
uint8_t slot_durations, uint8_t switch_pattern_len,
|
||||||
const uint8_t *ant_ids);
|
const uint8_t *ant_ids);
|
||||||
/* Enables or disables CTE request control procedure in direction fingin connected mode. */
|
/* Enables or disables CTE request control procedure in direction fingin connected mode. */
|
||||||
uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable, uint8_t cte_request_interval,
|
uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable,
|
||||||
uint8_t requested_cte_length, uint8_t requested_cte_type);
|
uint16_t cte_request_interval, uint8_t requested_cte_length,
|
||||||
|
uint8_t requested_cte_type);
|
||||||
/* Enables or disables CTE response control procedure in direction fingin connected mode. */
|
/* Enables or disables CTE response control procedure in direction fingin connected mode. */
|
||||||
uint8_t ll_df_set_conn_cte_rsp_enable(uint16_t handle, uint8_t enable);
|
uint8_t ll_df_set_conn_cte_rsp_enable(uint16_t handle, uint8_t enable);
|
||||||
/* Enables or disables CTE sampling in periodic advertising scan */
|
/* Enables or disables CTE sampling in periodic advertising scan */
|
||||||
|
|
|
@ -108,11 +108,6 @@ struct lll_df_sync {
|
||||||
struct lll_df_sync_cfg cfg[DOUBLE_BUFFER_SIZE];
|
struct lll_df_sync_cfg cfg[DOUBLE_BUFFER_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Names for allowed states for CTE transmit parameters in connected mode */
|
|
||||||
enum df_cte_tx_state {
|
|
||||||
DF_CTE_CONN_TX_PARAMS_UNINITIALIZED,
|
|
||||||
DF_CTE_CONN_TX_PARAMS_SET,
|
|
||||||
};
|
|
||||||
/* Parameters for reception of Constant Tone Extension in connected mode */
|
/* Parameters for reception of Constant Tone Extension in connected mode */
|
||||||
struct lll_df_conn_rx_params {
|
struct lll_df_conn_rx_params {
|
||||||
uint8_t is_enabled:1;
|
uint8_t is_enabled:1;
|
||||||
|
@ -154,7 +149,11 @@ struct cte_conn_iq_report {
|
||||||
|
|
||||||
/* Configuration for transmission of Constant Tone Extension in connected mode */
|
/* Configuration for transmission of Constant Tone Extension in connected mode */
|
||||||
struct lll_df_conn_tx_cfg {
|
struct lll_df_conn_tx_cfg {
|
||||||
uint8_t state:1;
|
/* Stores information if the TX configuration was set at least once.
|
||||||
|
* It is required for handling HCI_LE_Connection_CTE_Response_Enable HCI command.
|
||||||
|
* See BT 5.3 Core specification Vol 4, Part E, sec. 7.8.86.
|
||||||
|
*/
|
||||||
|
uint8_t is_initialized:1;
|
||||||
uint8_t ant_sw_len:7;
|
uint8_t ant_sw_len:7;
|
||||||
uint8_t cte_rsp_en:1; /* CTE response is enabled */
|
uint8_t cte_rsp_en:1; /* CTE response is enabled */
|
||||||
uint8_t cte_types_allowed:3; /* Bitfield with allowed CTE types */
|
uint8_t cte_types_allowed:3; /* Bitfield with allowed CTE types */
|
||||||
|
|
|
@ -271,7 +271,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window,
|
||||||
#endif /* CONFIG_BT_CTLR_CONN_META */
|
#endif /* CONFIG_BT_CTLR_CONN_META */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
|
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX)
|
||||||
conn_lll->df_rx_cfg.is_initialized = false;
|
conn_lll->df_rx_cfg.is_initialized = 0U;
|
||||||
conn_lll->df_rx_cfg.hdr.elem_size = sizeof(struct lll_df_conn_rx_params);
|
conn_lll->df_rx_cfg.hdr.elem_size = sizeof(struct lll_df_conn_rx_params);
|
||||||
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
|
#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */
|
||||||
|
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ uint8_t ll_df_set_conn_cte_tx_params(uint16_t handle, uint8_t cte_types, uint8_t
|
||||||
df_tx_cfg->ant_sw_len = switch_pattern_len;
|
df_tx_cfg->ant_sw_len = switch_pattern_len;
|
||||||
|
|
||||||
df_tx_cfg->cte_types_allowed = cte_types;
|
df_tx_cfg->cte_types_allowed = cte_types;
|
||||||
df_tx_cfg->state = DF_CTE_CONN_TX_PARAMS_SET;
|
df_tx_cfg->is_initialized = 1U;
|
||||||
|
|
||||||
return BT_HCI_ERR_SUCCESS;
|
return BT_HCI_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1087,7 @@ uint8_t ll_df_set_conn_cte_rx_params(uint16_t handle, uint8_t sampling_enable,
|
||||||
/* This is an information for HCI_LE_Connection_CTE_Request_Enable that
|
/* This is an information for HCI_LE_Connection_CTE_Request_Enable that
|
||||||
* HCI_LE_Set_Connection_CTE_Receive_Parameters was called at least once.
|
* HCI_LE_Set_Connection_CTE_Receive_Parameters was called at least once.
|
||||||
*/
|
*/
|
||||||
cfg_rx->is_initialized = true;
|
cfg_rx->is_initialized = 1U;
|
||||||
params_buf_hdr = &cfg_rx->hdr;
|
params_buf_hdr = &cfg_rx->hdr;
|
||||||
|
|
||||||
params_rx = dbuf_alloc(params_buf_hdr, ¶ms_idx);
|
params_rx = dbuf_alloc(params_buf_hdr, ¶ms_idx);
|
||||||
|
@ -1141,8 +1141,9 @@ uint8_t ll_df_set_conn_cte_rx_params(uint16_t handle, uint8_t sampling_enable,
|
||||||
*
|
*
|
||||||
* @return HCI Status of command completion.
|
* @return HCI Status of command completion.
|
||||||
*/
|
*/
|
||||||
uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable, uint8_t cte_request_interval,
|
uint8_t ll_df_set_conn_cte_req_enable(uint16_t handle, uint8_t enable,
|
||||||
uint8_t requested_cte_length, uint8_t requested_cte_type)
|
uint16_t cte_request_interval, uint8_t requested_cte_length,
|
||||||
|
uint8_t requested_cte_type)
|
||||||
{
|
{
|
||||||
struct ll_conn *conn;
|
struct ll_conn *conn;
|
||||||
|
|
||||||
|
@ -1226,7 +1227,7 @@ uint8_t ll_df_set_conn_cte_rsp_enable(uint16_t handle, uint8_t enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (conn->lll.df_tx_cfg.state == DF_CTE_SAMPLING_UNINITIALIZED) {
|
if (!conn->lll.df_tx_cfg.is_initialized) {
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,7 +1237,7 @@ uint8_t ll_df_set_conn_cte_rsp_enable(uint16_t handle, uint8_t enable)
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_CTLR_PHY */
|
#endif /* CONFIG_BT_CTLR_PHY */
|
||||||
conn->lll.df_tx_cfg.cte_rsp_en = true;
|
conn->lll.df_tx_cfg.cte_rsp_en = 1U;
|
||||||
|
|
||||||
ull_cp_cte_rsp_enable(conn, enable, LLL_DF_MAX_CTE_LEN,
|
ull_cp_cte_rsp_enable(conn, enable, LLL_DF_MAX_CTE_LEN,
|
||||||
conn->lll.df_tx_cfg.cte_types_allowed);
|
conn->lll.df_tx_cfg.cte_types_allowed);
|
||||||
|
|
|
@ -669,7 +669,7 @@ static void prepare_conn_cte_req_enable_cmd_params(struct net_buf *buf, const st
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
cp->cte_request_interval = params->interval;
|
cp->cte_request_interval = params->interval;
|
||||||
cp->requested_cte_length = params->cte_length;
|
cp->requested_cte_length = sys_cpu_to_le16(params->cte_length);
|
||||||
cp->requested_cte_type = get_hci_cte_type(params->cte_type);
|
cp->requested_cte_type = get_hci_cte_type(params->cte_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue