1 /*
2 * Copyright (c) 2018-2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 struct pdu_adv *lll_adv_pdu_latest_get(struct lll_adv_pdu *pdu,
8 uint8_t *is_modified);
9
10 #if defined(CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY)
11 struct pdu_adv *lll_adv_pdu_and_extra_data_latest_get(struct lll_adv_pdu *pdu,
12 void **extra_data,
13 uint8_t *is_modified);
14
15 #endif /* CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY */
16
lll_adv_data_latest_get(struct lll_adv * lll,uint8_t * is_modified)17 static inline struct pdu_adv *lll_adv_data_latest_get(struct lll_adv *lll,
18 uint8_t *is_modified)
19 {
20 return lll_adv_pdu_latest_get(&lll->adv_data, is_modified);
21 }
22
lll_adv_scan_rsp_latest_get(struct lll_adv * lll,uint8_t * is_modified)23 static inline struct pdu_adv *lll_adv_scan_rsp_latest_get(struct lll_adv *lll,
24 uint8_t *is_modified)
25 {
26 return lll_adv_pdu_latest_get(&lll->scan_rsp, is_modified);
27 }
28
lll_adv_scan_rsp_curr_get(struct lll_adv * lll)29 static inline struct pdu_adv *lll_adv_scan_rsp_curr_get(struct lll_adv *lll)
30 {
31 return (void *)lll->scan_rsp.pdu[lll->scan_rsp.first];
32 }
33
34 #if defined(CONFIG_BT_CTLR_ADV_EXT)
35 static inline struct pdu_adv *
lll_adv_aux_data_latest_get(struct lll_adv_aux * lll,uint8_t * is_modified)36 lll_adv_aux_data_latest_get(struct lll_adv_aux *lll, uint8_t *is_modified)
37 {
38 return lll_adv_pdu_latest_get(&lll->data, is_modified);
39 }
40
41 #if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
42 static inline struct pdu_adv *
lll_adv_sync_data_latest_get(struct lll_adv_sync * lll,void ** extra_data,uint8_t * is_modified)43 lll_adv_sync_data_latest_get(struct lll_adv_sync *lll, void **extra_data,
44 uint8_t *is_modified)
45 {
46 #if defined(CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY)
47 return lll_adv_pdu_and_extra_data_latest_get(&lll->data, extra_data,
48 is_modified);
49 #else
50 return lll_adv_pdu_latest_get(&lll->data, is_modified);
51 #endif /* CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY */
52 }
53 #endif /* CONFIG_BT_CTLR_ADV_PERIODIC */
54 #endif /* CONFIG_BT_CTLR_ADV_EXT */
55
56 bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr,
57 uint8_t tx_addr, uint8_t *addr,
58 uint8_t devmatch_ok, uint8_t *rl_idx);
59
60 #if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
61 int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
62 uint8_t rl_idx, uint8_t rssi_ready);
63 #endif
64
65 bool lll_adv_connect_ind_check(struct lll_adv *lll, struct pdu_adv *ci,
66 uint8_t tx_addr, uint8_t *addr,
67 uint8_t rx_addr, uint8_t *tgt_addr,
68 uint8_t devmatch_ok, uint8_t *rl_idx);
69
70 #if defined(CONFIG_ZTEST)
71 uint32_t lll_adv_free_pdu_fifo_count_get(void);
72 uint32_t lll_adv_pdu_mem_free_count_get(void);
73 #endif /* CONFIG_ZTEST */
74