2020-08-11 09:58:34 +05:30
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Nordic Semiconductor ASA
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2021-09-03 12:35:33 +02:00
|
|
|
/* Periodic advertisements synchronization status. */
|
|
|
|
enum sync_status {
|
2021-09-04 14:13:47 +02:00
|
|
|
SYNC_STAT_ALLOWED,
|
|
|
|
SYNC_STAT_READY_OR_CONT_SCAN,
|
2021-09-03 12:35:33 +02:00
|
|
|
SYNC_STAT_TERM
|
|
|
|
};
|
|
|
|
|
2020-08-11 09:58:34 +05:30
|
|
|
struct lll_sync {
|
|
|
|
struct lll_hdr hdr;
|
|
|
|
|
|
|
|
uint8_t access_addr[4];
|
|
|
|
uint8_t crc_init[3];
|
|
|
|
|
2021-09-13 22:27:31 +05:30
|
|
|
uint8_t phy:3;
|
2021-09-03 12:35:33 +02:00
|
|
|
/* Bitmask providing not allowed types of CTE. */
|
|
|
|
uint8_t cte_type:5;
|
|
|
|
/* The member is required for filtering by CTE type. If filtering policy is disabled then
|
|
|
|
* synchronization is terminated for periodic advertisements with wrong CTE type.
|
|
|
|
*/
|
|
|
|
uint8_t filter_policy:1;
|
2021-12-02 07:08:34 +05:30
|
|
|
uint8_t is_rx_enabled:1;
|
2021-09-13 22:27:31 +05:30
|
|
|
uint8_t is_aux_sched:1;
|
|
|
|
|
2021-02-18 13:02:24 +05:30
|
|
|
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
|
|
|
|
uint8_t sca:3;
|
|
|
|
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
|
|
|
|
2020-08-11 11:12:34 +05:30
|
|
|
uint16_t skip_prepare;
|
|
|
|
uint16_t skip_event;
|
2020-08-11 09:58:34 +05:30
|
|
|
uint16_t event_counter;
|
|
|
|
|
|
|
|
uint16_t data_chan_id;
|
2021-08-25 20:50:53 +05:30
|
|
|
struct {
|
2021-08-27 10:23:58 +05:30
|
|
|
uint8_t data_chan_map[PDU_CHANNEL_MAP_SIZE];
|
2021-08-25 20:50:53 +05:30
|
|
|
uint8_t data_chan_count:6;
|
|
|
|
} chm[DOUBLE_BUFFER_SIZE];
|
|
|
|
uint8_t chm_first;
|
|
|
|
uint8_t chm_last;
|
|
|
|
uint16_t chm_instant;
|
2020-08-11 09:58:34 +05:30
|
|
|
|
2020-08-11 10:27:12 +05:30
|
|
|
uint32_t window_widening_periodic_us;
|
|
|
|
uint32_t window_widening_max_us;
|
|
|
|
uint32_t window_widening_prepare_us;
|
|
|
|
uint32_t window_widening_event_us;
|
|
|
|
uint32_t window_size_event_us;
|
|
|
|
|
2021-08-26 14:52:44 +02:00
|
|
|
/* used to store lll_aux when chain is being scanned */
|
2021-12-11 19:51:38 +05:30
|
|
|
struct lll_scan_aux *volatile lll_aux;
|
2021-08-17 18:18:04 +02:00
|
|
|
|
2021-04-01 11:44:33 +02:00
|
|
|
#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX)
|
|
|
|
struct lll_df_sync df_cfg;
|
|
|
|
#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */
|
2020-08-11 09:58:34 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
int lll_sync_init(void);
|
|
|
|
int lll_sync_reset(void);
|
2021-09-03 12:35:33 +02:00
|
|
|
void lll_sync_create_prepare(void *param);
|
2020-08-11 09:58:34 +05:30
|
|
|
void lll_sync_prepare(void *param);
|
2021-09-04 14:13:47 +02:00
|
|
|
enum sync_status lll_sync_cte_is_allowed(uint8_t cte_type_mask, uint8_t filter_policy,
|
|
|
|
uint8_t rx_cte_time, uint8_t rx_cte_type);
|
2020-08-11 10:27:12 +05:30
|
|
|
extern uint16_t ull_sync_lll_handle_get(struct lll_sync *lll);
|