1 /*
2  * Copyright (c) 2020-2021 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
8 /* Calculate ISO PDU buffers required considering SDU fragmentation */
9 /* FIXME: Calculation considering both Connected and Broadcast ISO PDU
10  *        fragmentation.
11  */
12 #if defined(CONFIG_BT_CTLR_CONN_ISO)
13 #define BT_CTLR_ISO_TX_BUFFERS (((CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX + \
14 				  CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX - 1U) / \
15 				 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX) * \
16 				CONFIG_BT_CTLR_ISO_TX_BUFFERS)
17 #else /* !CONFIG_BT_CTLR_CONN_ISO */
18 #define BT_CTLR_ISO_TX_BUFFERS CONFIG_BT_CTLR_ISO_TX_BUFFERS
19 #endif /* !CONFIG_BT_CTLR_CONN_ISO */
20 #else /* !CONFIG_BT_CTLR_ADV_ISO && !CONFIG_BT_CTLR_CONN_ISO */
21 #define BT_CTLR_ISO_TX_BUFFERS 0
22 #endif /* !CONFIG_BT_CTLR_ADV_ISO && !CONFIG_BT_CTLR_CONN_ISO */
23 
24 int ull_iso_init(void);
25 int ull_iso_reset(void);
26 struct ll_iso_datapath *ull_iso_datapath_alloc(void);
27 void ull_iso_datapath_release(struct ll_iso_datapath *dp);
28 void ll_iso_rx_put(memq_link_t *link, void *rx);
29 void *ll_iso_rx_get(void);
30 void ll_iso_rx_dequeue(void);
31 void ll_iso_transmit_test_send_sdu(uint16_t handle, uint32_t ticks_at_expire);
32 uint32_t ull_iso_big_sync_delay(uint8_t num_bis, uint32_t bis_spacing, uint8_t nse,
33 				uint32_t sub_interval, uint8_t phy, uint8_t max_pdu, bool enc);
34 
35 /* Must be implemented by vendor if vendor-specific data path is supported */
36 bool ll_data_path_configured(uint8_t data_path_dir, uint8_t data_path_id);
37 /* Must be implemented by vendor if vendor-specific data path is supported */
38 bool ll_data_path_sink_create(uint16_t handle,
39 			      struct ll_iso_datapath *datapath,
40 			      isoal_sink_sdu_alloc_cb *sdu_alloc,
41 			      isoal_sink_sdu_emit_cb *sdu_emit,
42 			      isoal_sink_sdu_write_cb *sdu_write);
43 /* Must be implemented by vendor if vendor-specific data path is supported */
44 bool ll_data_path_source_create(uint16_t handle,
45 				struct ll_iso_datapath *datapath,
46 				isoal_source_pdu_alloc_cb *pdu_alloc,
47 				isoal_source_pdu_write_cb *pdu_write,
48 				isoal_source_pdu_emit_cb *pdu_emit,
49 				isoal_source_pdu_release_cb *pdu_release);
50 
51 /* Must be implemented by vendor if vendor-specific data path is supported */
52 void ll_data_path_tx_pdu_release(uint16_t handle, struct node_tx_iso *node_tx);
53 
54 void ull_iso_resume_ticker_start(struct lll_event *resume_event,
55 				 uint16_t group_handle,
56 				 uint16_t stream_handle,
57 				 uint8_t  role,
58 				 uint32_t ticks_anchor,
59 				 uint32_t resume_timeout);
60