Bluetooth: controller: Add read antenna information HCI command
Add partial implementation for handling Bluetooth 5.1 Direction Finding HCI command HCI_LE_Read_Antenna_Information to controller Upper Link layer. Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
parent
14890c8eb6
commit
57b55d0fad
7 changed files with 108 additions and 1 deletions
|
@ -100,6 +100,11 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||||
ll_sw/lll_chan.c
|
ll_sw/lll_chan.c
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(CONFIG_BT_CTLR_DF)
|
||||||
|
zephyr_library_sources(
|
||||||
|
ll_sw/ull_df.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
zephyr_library_sources_ifdef(
|
zephyr_library_sources_ifdef(
|
||||||
CONFIG_BT_CTLR_FILTER
|
CONFIG_BT_CTLR_FILTER
|
||||||
ll_sw/ull_filter.c
|
ll_sw/ull_filter.c
|
||||||
|
|
|
@ -561,6 +561,11 @@ config BT_CTLR_ASSERT_HANDLER
|
||||||
and will be invoked whenever the controller code encounters
|
and will be invoked whenever the controller code encounters
|
||||||
an unrecoverable error.
|
an unrecoverable error.
|
||||||
|
|
||||||
|
config BT_CTLR_DF
|
||||||
|
bool "LE Direction Finding Support [EXPERIMENTAL]" if BT_LL_SW_SPLIT
|
||||||
|
help
|
||||||
|
Enable support for Bluetooth 5.1 Direction Finding
|
||||||
|
|
||||||
endif # BT_CTLR
|
endif # BT_CTLR
|
||||||
|
|
||||||
config BT_CTLR_DEBUG_PINS_CPUAPP
|
config BT_CTLR_DEBUG_PINS_CPUAPP
|
||||||
|
|
|
@ -2063,6 +2063,28 @@ static void le_read_tx_power(struct net_buf *buf, struct net_buf **evt)
|
||||||
ll_tx_pwr_get(&rp->min_tx_power, &rp->max_tx_power);
|
ll_tx_pwr_get(&rp->min_tx_power, &rp->max_tx_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_BT_CTLR_DF)
|
||||||
|
static void le_df_read_ant_inf(struct net_buf *buf, struct net_buf **evt)
|
||||||
|
{
|
||||||
|
struct bt_hci_rp_le_read_ant_info *rp;
|
||||||
|
uint8_t max_switch_pattern_len;
|
||||||
|
uint8_t switch_sample_rates;
|
||||||
|
uint8_t max_cte_len;
|
||||||
|
uint8_t num_ant;
|
||||||
|
|
||||||
|
ll_df_read_ant_inf(&switch_sample_rates, &num_ant,
|
||||||
|
&max_switch_pattern_len, &max_cte_len);
|
||||||
|
|
||||||
|
rp = hci_cmd_complete(evt, sizeof(*rp));
|
||||||
|
|
||||||
|
rp->max_switch_pattern_len = max_switch_pattern_len;
|
||||||
|
rp->switch_sample_rates = switch_sample_rates;
|
||||||
|
rp->max_cte_len = max_cte_len;
|
||||||
|
rp->num_ant = num_ant;
|
||||||
|
rp->status = 0x00;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_BT_CTLR_DF */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
||||||
static void le_rx_test(struct net_buf *buf, struct net_buf **evt)
|
static void le_rx_test(struct net_buf *buf, struct net_buf **evt)
|
||||||
{
|
{
|
||||||
|
@ -3059,6 +3081,12 @@ static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd,
|
||||||
le_read_tx_power(cmd, evt);
|
le_read_tx_power(cmd, evt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_DF)
|
||||||
|
case BT_OCF(BT_HCI_OP_LE_READ_ANT_INFO):
|
||||||
|
le_df_read_ant_inf(cmd, evt);
|
||||||
|
break;
|
||||||
|
#endif /* CONFIG_BT_CTLR_DF */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
||||||
case BT_OCF(BT_HCI_OP_LE_RX_TEST):
|
case BT_OCF(BT_HCI_OP_LE_RX_TEST):
|
||||||
le_rx_test(cmd, evt);
|
le_rx_test(cmd, evt);
|
||||||
|
|
|
@ -258,3 +258,11 @@ void ll_rx_mem_release(void **node_rx);
|
||||||
void ll_timeslice_ticker_id_get(uint8_t * const instance_index, uint8_t * const user_id);
|
void ll_timeslice_ticker_id_get(uint8_t * const instance_index, uint8_t * const user_id);
|
||||||
void ll_radio_state_abort(void);
|
void ll_radio_state_abort(void);
|
||||||
uint32_t ll_radio_state_is_idle(void);
|
uint32_t ll_radio_state_is_idle(void);
|
||||||
|
|
||||||
|
/* Direction Finding */
|
||||||
|
|
||||||
|
/* Provides information about antennae switching and sampling settings */
|
||||||
|
void ll_df_read_ant_inf(uint8_t *switch_sample_rates,
|
||||||
|
uint8_t *num_ant,
|
||||||
|
uint8_t *max_switch_pattern_len,
|
||||||
|
uint8_t *max_cte_len);
|
||||||
|
|
39
subsys/bluetooth/controller/ll_sw/ull_df.c
Normal file
39
subsys/bluetooth/controller/ll_sw/ull_df.c
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/util.h>
|
||||||
|
#include "hal/debug.h"
|
||||||
|
#include "ull_df.h"
|
||||||
|
|
||||||
|
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||||
|
#define LOG_MODULE_NAME bt_ctlr_ull_df
|
||||||
|
#include "common/log.h"
|
||||||
|
|
||||||
|
/* @brief Function provides information about Direction Finding
|
||||||
|
* antennae switching and sampling related settings.
|
||||||
|
*
|
||||||
|
* @param[out]switch_sample_rates Pointer to store available antennae
|
||||||
|
* switch-sampling configurations.
|
||||||
|
* @param[out]num_ant Pointer to store number of available
|
||||||
|
* antennae.
|
||||||
|
* @param[out]max_switch_pattern_len Pointer to store maximum number of
|
||||||
|
* antennae switch patterns.
|
||||||
|
* @param[out]max_cte_len Pointer to store maximum length of CTE
|
||||||
|
* in [8us] units.
|
||||||
|
*/
|
||||||
|
void ll_df_read_ant_inf(uint8_t *switch_sample_rates,
|
||||||
|
uint8_t *num_ant,
|
||||||
|
uint8_t *max_switch_pattern_len,
|
||||||
|
uint8_t *max_cte_len)
|
||||||
|
{
|
||||||
|
/* Currently filled with data that inform about
|
||||||
|
* lack of antenna support for Direction Finding
|
||||||
|
*/
|
||||||
|
*switch_sample_rates = 0;
|
||||||
|
*num_ant = 0;
|
||||||
|
*max_switch_pattern_len = 0;
|
||||||
|
*max_cte_len = 0;
|
||||||
|
}
|
22
subsys/bluetooth/controller/ll_sw/ull_df.h
Normal file
22
subsys/bluetooth/controller/ll_sw/ull_df.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2020 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @brief Direction Finding switching sampling rates
|
||||||
|
*
|
||||||
|
* The enum provides information about supported switching
|
||||||
|
* and sampling rates in different Direction Finding types:
|
||||||
|
* - Angle of departure: 1us switching for transmission
|
||||||
|
* - Angle of departure 1us sampling for reception
|
||||||
|
* - Angle of arrival 1us switching-sampling for reception.
|
||||||
|
*
|
||||||
|
* @note Pay attention that both types AoD and AoA
|
||||||
|
* support 2US swiching-sampling as mandatory.
|
||||||
|
*/
|
||||||
|
enum df_switch_sample_support {
|
||||||
|
DF_AOD_1US_TX = BIT(0),
|
||||||
|
DF_AOD_1US_RX = BIT(1),
|
||||||
|
DF_AOA_1US = BIT(2)
|
||||||
|
};
|
|
@ -20,7 +20,7 @@
|
||||||
* @param[out] num_ant Antennae number.
|
* @param[out] num_ant Antennae number.
|
||||||
* @param[out] max_switch_pattern_len Maximum supported antennae switching
|
* @param[out] max_switch_pattern_len Maximum supported antennae switching
|
||||||
* paterns length.
|
* paterns length.
|
||||||
* @param[out] max_CTE_len Maximum length of CTE in 8[us] units.
|
* @param[out] max_cte_len Maximum length of CTE in 8[us] units.
|
||||||
*
|
*
|
||||||
* @return Zero in case of success, other value in case of failure.
|
* @return Zero in case of success, other value in case of failure.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue