1 /*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /* Forward declaration to avoid unnecessary includes. */
8 struct lll_adv_sync;
9 struct lll_sync;
10
11 /* Enables CTE transmission according to provided configuration */
12 void lll_df_cte_tx_enable(struct lll_adv_sync *lll_sync, const struct pdu_adv *pdu,
13 uint32_t *cte_len_us);
14
15 /* Allocate memory for new DF sync configuration. It will always return the same
16 * pointer until buffer is swapped by lll_df_sync_cfg_latest_get operation.
17 */
18 struct lll_df_sync_cfg *lll_df_sync_cfg_alloc(struct lll_df_sync *df_cfg,
19 uint8_t *idx);
20 /* Returns pointer to last allocated DF sync configuration. If it is called before
21 * lll_df_sync_cfg_alloc it will return pointer to memory that was recently
22 * enqueued.
23 */
lll_df_sync_cfg_peek(struct lll_df_sync * df_cfg)24 static inline struct lll_df_sync_cfg *lll_df_sync_cfg_peek(struct lll_df_sync *df_cfg)
25 {
26 return &df_cfg->cfg[df_cfg->last];
27 }
28
29 /* Enqueue new DF sync configuration data. */
lll_df_sync_cfg_enqueue(struct lll_df_sync * df_cfg,uint8_t idx)30 static inline void lll_df_sync_cfg_enqueue(struct lll_df_sync *df_cfg, uint8_t idx)
31 {
32 df_cfg->last = idx;
33 }
34
35 /* Get latest DF sync configuration data. Latest configuration data are the one
36 * that were enqueued by last lll_df_sync_cfg_enqueue call.
37 */
38 struct lll_df_sync_cfg *lll_df_sync_cfg_latest_get(struct lll_df_sync *df_cfg,
39 uint8_t *is_modified);
40 /* Get current DF sync configuration data. Current configuration data
41 * are the one that are available after last buffer swap done by call
42 * lll_df_sync_cfg_latest_get.
43 */
lll_df_sync_cfg_curr_get(struct lll_df_sync * df_cfg)44 static inline struct lll_df_sync_cfg *lll_df_sync_cfg_curr_get(struct lll_df_sync *df_cfg)
45 {
46 return &df_cfg->cfg[df_cfg->first];
47 }
48
49 /* Return information if DF sync configuration data were modified since last
50 * call to lll_df_sync_cfg_latest_get.
51 */
lll_df_sync_cfg_is_modified(struct lll_df_sync * df_cfg)52 static inline uint8_t lll_df_sync_cfg_is_modified(struct lll_df_sync *df_cfg)
53 {
54 return df_cfg->first != df_cfg->last;
55 }
56
57 /* Enables CTE reception according to provided configuration */
58 int lll_df_conf_cte_rx_enable(uint8_t slot_duration, uint8_t ant_num, const uint8_t *ant_ids,
59 uint8_t chan_idx, bool cte_info_in_s1, uint8_t phy);
60
61 /* Function prepares memory for Host notification about insufficient resources to sample all CTE
62 * in a given periodic synchronization event.
63 */
64 int lll_df_iq_report_no_resources_prepare(struct lll_sync *sync);
65
66 /* Configure CTE transmission */
67 void lll_df_cte_tx_configure(uint8_t cte_type, uint8_t cte_length, uint8_t num_ant_ids,
68 const uint8_t *ant_ids);
69
70 /* Disables CTE transmission */
71 void lll_df_cte_tx_disable(void);
72
73 /* Enabled parsing of a PDU for CTEInfo */
74 void lll_df_conf_cte_info_parsing_enable(void);
75