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 <wopu@demant.com>
This commit is contained in:
Wolfgang Puffitsch 2021-01-20 11:10:15 +01:00 committed by Anas Nashif
commit adaf45cf4b
5 changed files with 130 additions and 1 deletions

View file

@ -554,6 +554,30 @@ config BT_CTLR_PERIPHERAL_ISO
bool "LE Connected Isochronous Stream Peripheral [EXPERIMENTAL]" if BT_LL_SW_SPLIT
select BT_CTLR_SET_HOST_FEATURE
config BT_CTLR_CONN_ISO_STREAMS
int "LE Connected Isochronous Streams"
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
range 1 64
default 2
help
Maximum supported total number of CISes.
config BT_CTLR_CONN_ISO_GROUPS
int "LE Connected Isochronous Groups"
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
range 1 240
default 1
help
Maximum supported CIGs.
config BT_CTLR_CONN_ISO_STREAMS_PER_GROUP
int "LE Connected Isochronous Streams per Group"
depends on BT_CTLR_CENTRAL_ISO || BT_CTLR_PERIPHERAL_ISO
range 1 31
default 2
help
Maximum supported CISes per CIG.
config BT_CTLR_DTM
bool
help

View file

@ -175,6 +175,8 @@ enum node_rx_type {
NODE_RX_TYPE_EVENT_DONE,
/* Signals arrival of RX Data Channel payload */
NODE_RX_TYPE_DC_PDU,
/* Signals arrival of isochronous payload */
NODE_RX_TYPE_ISO_PDU,
/* Advertisement report from scanning */
NODE_RX_TYPE_REPORT,
NODE_RX_TYPE_EXT_1M_REPORT,
@ -241,6 +243,12 @@ struct node_rx_ftr {
#endif /* CONFIG_BT_HCI_MESH_EXT */
};
/* Meta-information for isochronous PDUs in node_rx_hdr */
struct node_rx_iso_meta {
uint64_t payload_number : 39; /* cisPayloadNumber */
uint32_t timestamp; /* Time of reception */
uint8_t status; /* Status of reception (OK/not OK) */
};
/* Header of node_rx_pdu */
struct node_rx_hdr {
@ -255,10 +263,15 @@ struct node_rx_hdr {
uint16_t handle; /* State/Role instance handle */
union {
struct node_rx_ftr rx_ftr;
#if defined(CONFIG_BT_CTLR_SYNC_ISO) || \
defined(BT_CTLR_PERIPHERAL_ISO) || \
defined(BT_CTLR_CENTRAL_ISO)
struct node_rx_iso_meta rx_iso_meta;
#endif
#if defined(CONFIG_BT_CTLR_RX_PDU_META)
lll_rx_pdu_meta_t rx_pdu_meta;
#endif /* CONFIG_BT_CTLR_RX_PDU_META */
struct node_rx_ftr rx_ftr;
};
};
@ -380,6 +393,9 @@ void *ull_prepare_dequeue_iter(uint8_t *idx);
void *ull_pdu_rx_alloc_peek(uint8_t count);
void *ull_pdu_rx_alloc_peek_iter(uint8_t *idx);
void *ull_pdu_rx_alloc(void);
void *ull_iso_pdu_rx_alloc_peek(uint8_t count);
void *ull_iso_pdu_rx_alloc_peek_iter(uint8_t *idx);
void *ull_iso_pdu_rx_alloc(void);
void ull_rx_put(memq_link_t *link, void *rx);
void ull_rx_sched(void);
void *ull_event_done_extra_get(void);

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2021 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
int lll_central_iso_init(void);
int lll_central_iso_reset(void);
void lll_central_iso_prepare(void *param);

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2021 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
struct node_tx_iso {
union {
void *next;
memq_link_t *link;
};
uint64_t payload_number : 39; /* cisPayloadNumber */
uint8_t pdu[];
};
struct lll_conn_iso_stream_rxtx {
uint8_t phy; /* PHY */
uint8_t burst_number; /* Burst number (BN) */
uint8_t flush_timeout; /* Flush timeout (FT) */
uint8_t max_octets; /* Maximum PDU size */
};
struct lll_conn_iso_stream {
/* Link to ACL connection (for encryption, channel map, crc init) */
struct lll_conn *conn;
/* Connection parameters */
uint8_t access_addr[4]; /* Access address */
uint32_t offset; /* Offset of CIS from start of CIG in us */
uint32_t sub_interval; /* Interval between subevents in us */
uint32_t subevent_length; /* Length of subevent in us */
uint8_t num_subevents; /* Number of subevents */
struct lll_conn_iso_stream_rxtx rx; /* RX parameters */
struct lll_conn_iso_stream_rxtx tx; /* TX parameters */
/* Event and payload counters */
uint64_t event_count : 39; /* cisEventCount */
uint64_t rx_payload_number : 39; /* cisPayloadNumber */
/* Acknowledgment and flow control */
uint8_t sn:1; /* Sequence number */
uint8_t nesn:1; /* Next expected sequence number */
uint8_t cie:1; /* Close isochronous event */
/* Resumption information */
uint8_t next_subevent; /* Next subevent to schedule */
/* Transmission queue */
MEMQ_DECLARE(tx);
memq_link_t link_tx;
memq_link_t *link_tx_free;
};
struct lll_conn_iso_group {
struct lll_hdr hdr;
uint8_t num_cis; /* Number of CISes in this CIG */
#if defined(CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP)
struct lll_conn_iso_stream *streams
[CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP];
#endif /* CONFIG_BT_CTLR_CONN_ISO_STREAMS */
/* Resumption information */
uint8_t next_cis; /* Next CIS to schedule */
uint32_t next_time; /* When to trigger next activity in the CIG */
};
int lll_conn_iso_init(void);
int lll_conn_iso_reset(void);
void lll_conn_iso_flush(uint16_t handle, struct lll_conn_iso_stream *lll);

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2021 Demant
*
* SPDX-License-Identifier: Apache-2.0
*/
int lll_peripheral_iso_init(void);
int lll_peripheral_iso_reset(void);
void lll_peripheral_iso_prepare(void *param);