1 /*
2 * Copyright (c) 2018-2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /* The Aux Offset shall be at least the length of the packet plus T_MAFS */
8 #define PDU_ADV_AUX_OFFSET_MIN_US 300
9
10 int lll_adv_data_init(struct lll_adv_pdu *pdu);
11 int lll_adv_data_reset(struct lll_adv_pdu *pdu);
12 int lll_adv_data_release(struct lll_adv_pdu *pdu);
13
lll_adv_pdu_enqueue(struct lll_adv_pdu * pdu,uint8_t idx)14 static inline void lll_adv_pdu_enqueue(struct lll_adv_pdu *pdu, uint8_t idx)
15 {
16 pdu->last = idx;
17 }
18
19 struct pdu_adv *lll_adv_pdu_alloc(struct lll_adv_pdu *pdu, uint8_t *idx);
20
lll_adv_data_alloc(struct lll_adv * lll,uint8_t * idx)21 static inline struct pdu_adv *lll_adv_data_alloc(struct lll_adv *lll,
22 uint8_t *idx)
23 {
24 return lll_adv_pdu_alloc(&lll->adv_data, idx);
25 }
26
lll_adv_data_enqueue(struct lll_adv * lll,uint8_t idx)27 static inline void lll_adv_data_enqueue(struct lll_adv *lll, uint8_t idx)
28 {
29 lll_adv_pdu_enqueue(&lll->adv_data, idx);
30 }
31
lll_adv_data_peek(struct lll_adv * lll)32 static inline struct pdu_adv *lll_adv_data_peek(struct lll_adv *lll)
33 {
34 return (void *)lll->adv_data.pdu[lll->adv_data.last];
35 }
36
lll_adv_scan_rsp_alloc(struct lll_adv * lll,uint8_t * idx)37 static inline struct pdu_adv *lll_adv_scan_rsp_alloc(struct lll_adv *lll,
38 uint8_t *idx)
39 {
40 return lll_adv_pdu_alloc(&lll->scan_rsp, idx);
41 }
42
lll_adv_scan_rsp_enqueue(struct lll_adv * lll,uint8_t idx)43 static inline void lll_adv_scan_rsp_enqueue(struct lll_adv *lll, uint8_t idx)
44 {
45 lll_adv_pdu_enqueue(&lll->scan_rsp, idx);
46 }
47
lll_adv_scan_rsp_peek(struct lll_adv * lll)48 static inline struct pdu_adv *lll_adv_scan_rsp_peek(struct lll_adv *lll)
49 {
50 return (void *)lll->scan_rsp.pdu[lll->scan_rsp.last];
51 }
52