Skip to content

Commit 0b230ae

Browse files
ppryga-nordiccarlescufi
authored andcommitted
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 <[email protected]>
1 parent f3e0489 commit 0b230ae

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

subsys/bluetooth/controller/ll_sw/lll_df.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ struct lll_df_adv_cfg {
2222
/* @brief Max supported CTE length in 8us units */
2323
#define LLL_DF_MAX_CTE_LEN 20
2424

25+
int lll_df_init(void);
26+
int lll_df_reset(void);
27+
2528
/* Provides number of available antennas for Direction Finding */
2629
uint8_t lll_df_ant_num_get(void);

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_df.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,34 @@
88
#include "hal/radio_df.h"
99
#include "lll_df.h"
1010

11+
/* @brief Function performs common steps for initialization and reset
12+
* of Direction Finding LLL module.
13+
*
14+
* @return Zero in case of success, other value in case of failure.
15+
*/
16+
static int init_reset(void);
17+
18+
/* @brief Function performs Direction Finding initialization
19+
*
20+
* @return Zero in case of success, other value in case of failure.
21+
*/
22+
int lll_df_init(void)
23+
{
24+
radio_df_ant_configure();
25+
26+
return init_reset();
27+
}
28+
29+
30+
/* @brief Function performs Direction Finding reset
31+
*
32+
* @return Zero in case of success, other value in case of failure.
33+
*/
34+
int lll_df_reset(void)
35+
{
36+
return init_reset();
37+
}
38+
1139
/* @brief Function provides number of available antennas.
1240
*
1341
* 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)
1846
{
1947
return radio_df_ant_num_get();
2048
}
49+
50+
static int init_reset(void)
51+
{
52+
return 0;
53+
}

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "lll_sync.h"
3939
#include "lll_sync_iso.h"
4040
#include "lll_conn.h"
41+
#include "lll_df.h"
4142
#include "ull_adv_types.h"
4243
#include "ull_scan_types.h"
4344
#include "ull_sync_types.h"
@@ -462,6 +463,13 @@ int ll_init(struct k_sem *sem_rx)
462463
}
463464
#endif /* CONFIG_BT_CONN */
464465

466+
#if IS_ENABLED(CONFIG_BT_CTLR_DF)
467+
err = lll_df_init();
468+
if (err) {
469+
return err;
470+
}
471+
#endif
472+
465473
#if defined(CONFIG_BT_CTLR_USER_EXT)
466474
err = ull_user_init();
467475
if (err) {
@@ -1666,6 +1674,11 @@ static void perform_lll_reset(void *param)
16661674
LL_ASSERT(!err);
16671675
#endif /* CONFIG_BT_CONN */
16681676

1677+
#if IS_ENABLED(CONFIG_BT_CTLR_DF)
1678+
err = lll_df_reset();
1679+
LL_ASSERT(!err);
1680+
#endif /* CONFIG_BT_CTLR_DF */
1681+
16691682
#if !defined(CONFIG_BT_CTLR_ZLI)
16701683
k_sem_give(param);
16711684
#endif /* !CONFIG_BT_CTLR_ZLI */

0 commit comments

Comments
 (0)