1 /*
2  * Copyright (c) 2017-2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /* Macro to convert time in us to connection interval units */
8 #define RADIO_CONN_EVENTS(x, y) ((uint16_t)(((x) + (y) - 1) / (y)))
9 
10 /* Macro to convert time in us to periodic advertising interval units */
11 #define RADIO_SYNC_EVENTS(x, y) ((uint16_t)(((x) + (y) - 1) / (y)))
12 
ull_ref_get(struct ull_hdr * hdr)13 static inline uint8_t ull_ref_get(struct ull_hdr *hdr)
14 {
15 	return hdr->ref;
16 }
17 
ull_ref_inc(struct ull_hdr * hdr)18 static inline uint8_t ull_ref_inc(struct ull_hdr *hdr)
19 {
20 	return ++hdr->ref;
21 }
22 
ull_ref_dec(struct ull_hdr * hdr)23 static inline uint8_t ull_ref_dec(struct ull_hdr *hdr)
24 {
25 	return hdr->ref--;
26 }
27 
ull_hdr_init(struct ull_hdr * hdr)28 static inline void ull_hdr_init(struct ull_hdr *hdr)
29 {
30 	hdr->ref = 0U;
31 	hdr->disabled_cb = hdr->disabled_param = NULL;
32 }
33 
34 void *ll_rx_link_alloc(void);
35 void ll_rx_link_release(void *link);
36 void *ll_rx_alloc(void);
37 void ll_rx_release(void *node_rx);
38 void *ll_pdu_rx_alloc_peek(uint8_t count);
39 void *ll_pdu_rx_alloc(void);
40 void ll_rx_put(memq_link_t *link, void *rx);
41 void ll_rx_sched(void);
42 void ull_ticker_status_give(uint32_t status, void *param);
43 uint32_t ull_ticker_status_take(uint32_t ret, uint32_t volatile *ret_cb);
44 void *ull_disable_mark(void *param);
45 void *ull_disable_unmark(void *param);
46 void *ull_disable_mark_get(void);
47 int ull_ticker_stop_with_mark(uint8_t ticker_handle, void *param,
48 			      void *lll_disable);
49 void *ull_update_mark(void *param);
50 void *ull_update_unmark(void *param);
51 void *ull_update_mark_get(void);
52 int ull_disable(void *param);
53 void ull_drift_ticks_get(struct node_rx_event_done *done,
54 			 uint32_t *ticks_drift_plus,
55 			 uint32_t *ticks_drift_minus);
56