Skip to content

Commit adaf45c

Browse files
wopu-otnashif
authored andcommitted
Bluetooth: controller: Define ULL/LLL interface for CIS central and periph
Define interface between ULL and LLL for CIS central and peripheral. Signed-off-by: Wolfgang Puffitsch <[email protected]>
1 parent b063fe2 commit adaf45c

File tree

5 files changed

+130
-1
lines changed

5 files changed

+130
-1
lines changed

subsys/bluetooth/controller/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,30 @@ config BT_CTLR_PERIPHERAL_ISO
554554
bool "LE Connected Isochronous Stream Peripheral [EXPERIMENTAL]" if BT_LL_SW_SPLIT
555555
select BT_CTLR_SET_HOST_FEATURE
556556

557+
config BT_CTLR_CONN_ISO_STREAMS
558+
int "LE Connected Isochronous Streams"
559+
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
560+
range 1 64
561+
default 2
562+
help
563+
Maximum supported total number of CISes.
564+
565+
config BT_CTLR_CONN_ISO_GROUPS
566+
int "LE Connected Isochronous Groups"
567+
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
568+
range 1 240
569+
default 1
570+
help
571+
Maximum supported CIGs.
572+
573+
config BT_CTLR_CONN_ISO_STREAMS_PER_GROUP
574+
int "LE Connected Isochronous Streams per Group"
575+
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
576+
range 1 31
577+
default 2
578+
help
579+
Maximum supported CISes per CIG.
580+
557581
config BT_CTLR_DTM
558582
bool
559583
help

subsys/bluetooth/controller/ll_sw/lll.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ enum node_rx_type {
175175
NODE_RX_TYPE_EVENT_DONE,
176176
/* Signals arrival of RX Data Channel payload */
177177
NODE_RX_TYPE_DC_PDU,
178+
/* Signals arrival of isochronous payload */
179+
NODE_RX_TYPE_ISO_PDU,
178180
/* Advertisement report from scanning */
179181
NODE_RX_TYPE_REPORT,
180182
NODE_RX_TYPE_EXT_1M_REPORT,
@@ -241,6 +243,12 @@ struct node_rx_ftr {
241243
#endif /* CONFIG_BT_HCI_MESH_EXT */
242244
};
243245

246+
/* Meta-information for isochronous PDUs in node_rx_hdr */
247+
struct node_rx_iso_meta {
248+
uint64_t payload_number : 39; /* cisPayloadNumber */
249+
uint32_t timestamp; /* Time of reception */
250+
uint8_t status; /* Status of reception (OK/not OK) */
251+
};
244252

245253
/* Header of node_rx_pdu */
246254
struct node_rx_hdr {
@@ -255,10 +263,15 @@ struct node_rx_hdr {
255263
uint16_t handle; /* State/Role instance handle */
256264

257265
union {
266+
struct node_rx_ftr rx_ftr;
267+
#if defined(CONFIG_BT_CTLR_SYNC_ISO) || \
268+
defined(BT_CTLR_PERIPHERAL_ISO) || \
269+
defined(BT_CTLR_CENTRAL_ISO)
270+
struct node_rx_iso_meta rx_iso_meta;
271+
#endif
258272
#if defined(CONFIG_BT_CTLR_RX_PDU_META)
259273
lll_rx_pdu_meta_t rx_pdu_meta;
260274
#endif /* CONFIG_BT_CTLR_RX_PDU_META */
261-
struct node_rx_ftr rx_ftr;
262275
};
263276
};
264277

@@ -380,6 +393,9 @@ void *ull_prepare_dequeue_iter(uint8_t *idx);
380393
void *ull_pdu_rx_alloc_peek(uint8_t count);
381394
void *ull_pdu_rx_alloc_peek_iter(uint8_t *idx);
382395
void *ull_pdu_rx_alloc(void);
396+
void *ull_iso_pdu_rx_alloc_peek(uint8_t count);
397+
void *ull_iso_pdu_rx_alloc_peek_iter(uint8_t *idx);
398+
void *ull_iso_pdu_rx_alloc(void);
383399
void ull_rx_put(memq_link_t *link, void *rx);
384400
void ull_rx_sched(void);
385401
void *ull_event_done_extra_get(void);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2021 Demant
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
int lll_central_iso_init(void);
8+
int lll_central_iso_reset(void);
9+
void lll_central_iso_prepare(void *param);
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright (c) 2021 Demant
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
struct node_tx_iso {
8+
union {
9+
void *next;
10+
memq_link_t *link;
11+
};
12+
13+
uint64_t payload_number : 39; /* cisPayloadNumber */
14+
uint8_t pdu[];
15+
};
16+
17+
struct lll_conn_iso_stream_rxtx {
18+
uint8_t phy; /* PHY */
19+
uint8_t burst_number; /* Burst number (BN) */
20+
uint8_t flush_timeout; /* Flush timeout (FT) */
21+
uint8_t max_octets; /* Maximum PDU size */
22+
};
23+
24+
struct lll_conn_iso_stream {
25+
/* Link to ACL connection (for encryption, channel map, crc init) */
26+
struct lll_conn *conn;
27+
28+
/* Connection parameters */
29+
uint8_t access_addr[4]; /* Access address */
30+
uint32_t offset; /* Offset of CIS from start of CIG in us */
31+
uint32_t sub_interval; /* Interval between subevents in us */
32+
uint32_t subevent_length; /* Length of subevent in us */
33+
uint8_t num_subevents; /* Number of subevents */
34+
struct lll_conn_iso_stream_rxtx rx; /* RX parameters */
35+
struct lll_conn_iso_stream_rxtx tx; /* TX parameters */
36+
37+
/* Event and payload counters */
38+
uint64_t event_count : 39; /* cisEventCount */
39+
uint64_t rx_payload_number : 39; /* cisPayloadNumber */
40+
41+
/* Acknowledgment and flow control */
42+
uint8_t sn:1; /* Sequence number */
43+
uint8_t nesn:1; /* Next expected sequence number */
44+
uint8_t cie:1; /* Close isochronous event */
45+
46+
/* Resumption information */
47+
uint8_t next_subevent; /* Next subevent to schedule */
48+
49+
/* Transmission queue */
50+
MEMQ_DECLARE(tx);
51+
memq_link_t link_tx;
52+
memq_link_t *link_tx_free;
53+
};
54+
55+
struct lll_conn_iso_group {
56+
struct lll_hdr hdr;
57+
58+
uint8_t num_cis; /* Number of CISes in this CIG */
59+
#if defined(CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP)
60+
struct lll_conn_iso_stream *streams
61+
[CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP];
62+
#endif /* CONFIG_BT_CTLR_CONN_ISO_STREAMS */
63+
64+
/* Resumption information */
65+
uint8_t next_cis; /* Next CIS to schedule */
66+
uint32_t next_time; /* When to trigger next activity in the CIG */
67+
};
68+
69+
int lll_conn_iso_init(void);
70+
int lll_conn_iso_reset(void);
71+
void lll_conn_iso_flush(uint16_t handle, struct lll_conn_iso_stream *lll);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2021 Demant
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
int lll_peripheral_iso_init(void);
8+
int lll_peripheral_iso_reset(void);
9+
void lll_peripheral_iso_prepare(void *param);

0 commit comments

Comments
 (0)