Bluetooth: controller: Add DF initialization to controller init sequence
Direction Finding requires initalization of a set of registers in Radio peripheral. Also it requires information about antenna matrix unit that are provided by end user in DTS overlay. Implemented initialization step is responsible for validation of hardware information delivered by DTS and setting up DF related registers in Radio. Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
parent
f3e04898eb
commit
0b230ae639
3 changed files with 49 additions and 0 deletions
|
@ -22,5 +22,8 @@ struct lll_df_adv_cfg {
|
|||
/* @brief Max supported CTE length in 8us units */
|
||||
#define LLL_DF_MAX_CTE_LEN 20
|
||||
|
||||
int lll_df_init(void);
|
||||
int lll_df_reset(void);
|
||||
|
||||
/* Provides number of available antennas for Direction Finding */
|
||||
uint8_t lll_df_ant_num_get(void);
|
||||
|
|
|
@ -8,6 +8,34 @@
|
|||
#include "hal/radio_df.h"
|
||||
#include "lll_df.h"
|
||||
|
||||
/* @brief Function performs common steps for initialization and reset
|
||||
* of Direction Finding LLL module.
|
||||
*
|
||||
* @return Zero in case of success, other value in case of failure.
|
||||
*/
|
||||
static int init_reset(void);
|
||||
|
||||
/* @brief Function performs Direction Finding initialization
|
||||
*
|
||||
* @return Zero in case of success, other value in case of failure.
|
||||
*/
|
||||
int lll_df_init(void)
|
||||
{
|
||||
radio_df_ant_configure();
|
||||
|
||||
return init_reset();
|
||||
}
|
||||
|
||||
|
||||
/* @brief Function performs Direction Finding reset
|
||||
*
|
||||
* @return Zero in case of success, other value in case of failure.
|
||||
*/
|
||||
int lll_df_reset(void)
|
||||
{
|
||||
return init_reset();
|
||||
}
|
||||
|
||||
/* @brief Function provides number of available antennas.
|
||||
*
|
||||
* The number of antenna is hardware defined and it is provided via devicetree.
|
||||
|
@ -18,3 +46,8 @@ uint8_t lll_df_ant_num_get(void)
|
|||
{
|
||||
return radio_df_ant_num_get();
|
||||
}
|
||||
|
||||
static int init_reset(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "lll_sync.h"
|
||||
#include "lll_sync_iso.h"
|
||||
#include "lll_conn.h"
|
||||
#include "lll_df.h"
|
||||
#include "ull_adv_types.h"
|
||||
#include "ull_scan_types.h"
|
||||
#include "ull_sync_types.h"
|
||||
|
@ -462,6 +463,13 @@ int ll_init(struct k_sem *sem_rx)
|
|||
}
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
#if IS_ENABLED(CONFIG_BT_CTLR_DF)
|
||||
err = lll_df_init();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_USER_EXT)
|
||||
err = ull_user_init();
|
||||
if (err) {
|
||||
|
@ -1666,6 +1674,11 @@ static void perform_lll_reset(void *param)
|
|||
LL_ASSERT(!err);
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
#if IS_ENABLED(CONFIG_BT_CTLR_DF)
|
||||
err = lll_df_reset();
|
||||
LL_ASSERT(!err);
|
||||
#endif /* CONFIG_BT_CTLR_DF */
|
||||
|
||||
#if !defined(CONFIG_BT_CTLR_ZLI)
|
||||
k_sem_give(param);
|
||||
#endif /* !CONFIG_BT_CTLR_ZLI */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue