1 /*
2  * Copyright (c) 2021 Demant
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #define IS_PERIPHERAL(cig) \
8 	(IS_ENABLED(CONFIG_BT_CTLR_PERIPHERAL_ISO) && \
9 	 (cig->lll.role == BT_HCI_ROLE_PERIPHERAL))
10 
11 #define IS_CENTRAL(cig) \
12 	(IS_ENABLED(CONFIG_BT_CTLR_CENTRAL_ISO) && \
13 	 (cig->lll.role == BT_HCI_ROLE_CENTRAL))
14 
15 /* Helper functions to initialize and reset ull_conn_iso module */
16 int ull_conn_iso_init(void);
17 int ull_conn_iso_reset(void);
18 
19 struct ll_conn_iso_group *ll_conn_iso_group_acquire(void);
20 void ll_conn_iso_group_release(struct ll_conn_iso_group *cig);
21 uint16_t ll_conn_iso_group_handle_get(struct ll_conn_iso_group *cig);
22 struct ll_conn_iso_group *ll_conn_iso_group_get(uint16_t handle);
23 struct ll_conn_iso_group *ll_conn_iso_group_get_by_id(uint8_t id);
24 
25 struct ll_conn_iso_stream *ll_conn_iso_stream_acquire(void);
26 void ll_conn_iso_stream_release(struct ll_conn_iso_stream *cis);
27 uint16_t ll_conn_iso_stream_handle_get(struct ll_conn_iso_stream *cis);
28 struct ll_conn_iso_stream *ll_conn_iso_stream_get(uint16_t handle);
29 struct ll_conn_iso_stream *ll_iso_stream_connected_get(uint16_t handle);
30 struct ll_conn_iso_stream *ll_conn_iso_stream_get_by_acl(struct ll_conn *conn,
31 							 uint16_t *cis_iter);
32 struct ll_conn_iso_stream *ll_conn_iso_stream_get_by_group(struct ll_conn_iso_group *cig,
33 							   uint16_t *handle_iter);
34 struct ll_conn_iso_stream *ll_conn_iso_stream_get_by_id(uint8_t cis_id);
35 
36 void ull_conn_iso_start(struct ll_conn *acl, uint16_t cis_handle,
37 			uint32_t ticks_at_expire, uint32_t remainder,
38 			uint16_t instant_latency);
39 void ull_conn_iso_done(struct node_rx_event_done *done);
40 void ull_conn_iso_cis_stop(struct ll_conn_iso_stream *cis,
41 			   ll_iso_stream_released_cb_t cis_released_cb,
42 			   uint8_t reason);
43 
44 void ull_conn_iso_resume_ticker_start(struct lll_event *resume_event,
45 				      uint16_t cis_handle,
46 				      uint32_t ticks_anchor,
47 				      uint32_t resume_timeout);
48 void ull_conn_iso_transmit_test_cig_interval(uint16_t handle,
49 					     uint32_t ticks_at_expire);
50 
51 void ull_conn_iso_ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift,
52 			    uint32_t remainder, uint16_t lazy, uint8_t force,
53 			    void *param);
54