Zephyr API 3.6.99
Loading...
Searching...
No Matches
iso.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2020 Intel Corporation
8 * Copyright (c) 2021-2024 Nordic Semiconductor ASA
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_
14
26#include <stdint.h>
27
33#include <zephyr/net_buf.h>
34#include <zephyr/sys/atomic.h>
35#include <zephyr/sys/slist.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
45#define BT_ISO_CHAN_SEND_RESERVE BT_BUF_ISO_SIZE(0)
46
55#define BT_ISO_SDU_BUF_SIZE(mtu) BT_BUF_ISO_SIZE(mtu)
56
65#define BT_ISO_BIS_INDEX_BIT(x) (BIT((x) - 1))
66
68#define BT_ISO_DATA_PATH_HCI 0x00
69
71#define BT_ISO_SDU_INTERVAL_MIN 0x0000FFU
73#define BT_ISO_SDU_INTERVAL_MAX 0x0FFFFFU
75#define BT_ISO_ISO_INTERVAL_MIN 0x0004U
77#define BT_ISO_ISO_INTERVAL_MAX 0x0C80U
79#define BT_ISO_LATENCY_MIN 0x0005
81#define BT_ISO_LATENCY_MAX 0x0FA0
83#define BT_ISO_PACKING_SEQUENTIAL 0x00
85#define BT_ISO_PACKING_INTERLEAVED 0x01
87#define BT_ISO_FRAMING_UNFRAMED 0x00
89#define BT_ISO_FRAMING_FRAMED 0x01
91#define BT_ISO_MAX_GROUP_ISO_COUNT 0x1F
93#define BT_ISO_MIN_SDU 0x0001
95#define BT_ISO_MAX_SDU 0x0FFF
97#define BT_ISO_CONNECTED_PDU_MIN 0x0000U
99#define BT_ISO_BROADCAST_PDU_MIN 0x0001U
101#define BT_ISO_PDU_MAX 0x00FBU
103#define BT_ISO_BN_MIN 0x01U
105#define BT_ISO_BN_MAX 0x0FU
107#define BT_ISO_FT_MIN 0x01U
109#define BT_ISO_FT_MAX 0xFFU
111#define BT_ISO_NSE_MIN 0x01U
113#define BT_ISO_NSE_MAX 0x1FU
115#define BT_ISO_SYNC_TIMEOUT_MIN 0x000A
117#define BT_ISO_SYNC_TIMEOUT_MAX 0x4000
119#define BT_ISO_SYNC_MSE_ANY 0x00
121#define BT_ISO_SYNC_MSE_MIN 0x01
123#define BT_ISO_SYNC_MSE_MAX 0x1F
125#define BT_ISO_CONNECTED_RTN_MAX 0xFF
127#define BT_ISO_BROADCAST_RTN_MAX 0x1E
129#define BT_ISO_BROADCAST_CODE_SIZE 16
131#define BT_ISO_BIS_INDEX_MIN 0x01
133#define BT_ISO_BIS_INDEX_MAX 0x1F
135#define BT_ISO_IRC_MIN 0x01U
137#define BT_ISO_IRC_MAX 0x0FU
139#define BT_ISO_PTO_MIN 0x00U
141#define BT_ISO_PTO_MAX 0x0FU
142
159
160
170
174 struct bt_conn *iso;
181#if (defined(CONFIG_BT_SMP) && defined(CONFIG_BT_ISO_UNICAST)) || defined(__DOXYGEN__)
193#endif /* CONFIG_BT_SMP && CONFIG_BT_ISO_UNICAST */
196};
197
225
226#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
237
244#endif /* CONFIG_BT_ISO_TEST_PARAMS */
245};
246
266
267#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
276#endif /* CONFIG_BT_ISO_TEST_PARAMS */
277};
278
296
298enum {
301
308
311
320
336
348
349
351struct bt_iso_cig;
352
357
364
371
378
387
396
405
412
419
420#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
430
440
449#endif /* CONFIG_BT_ISO_TEST_PARAMS */
450};
451
456
458 struct bt_conn *acl;
459};
460
462struct bt_iso_big;
463
468
475
482
491
498
505
508
522
523#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
532
541
550#endif /* CONFIG_BT_ISO_TEST_PARAMS */
551};
552
611
656
670 void (*connected)(struct bt_iso_chan *chan);
671
682 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
683
694 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
695
706 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
707 struct net_buf *buf);
708
719 void (*sent)(struct bt_iso_chan *chan);
720};
721
725 struct bt_conn *acl;
726
733
740};
741
744#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
751#endif /* CONFIG_BT_SMP */
752
763 int (*accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan);
764};
765
778
789
804int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig);
805
826int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param);
827
837int bt_iso_cig_terminate(struct bt_iso_cig *cig);
838
876int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
877
898
918int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num);
919
942int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
943 uint32_t ts);
944
962
977
1001
1019
1024
1027
1030
1038
1046
1048 union {
1049#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
1054#endif /* CONFIG_BT_ISO_UNICAST */
1055#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
1060#endif /* CONFIG_BT_ISO_BROADCASTER */
1061#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
1066#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
1067 };
1068};
1069
1078int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info);
1079
1095int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1096
1108int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1109 struct bt_iso_big **out_big);
1110
1118int bt_iso_big_terminate(struct bt_iso_big *big);
1119
1129int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1130 struct bt_iso_big **out_big);
1131
1132#ifdef __cplusplus
1133}
1134#endif
1135
1140#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem core APIs.
Bluetooth data buffer API.
Bluetooth connection handling.
bt_security_t
Security level.
Definition conn.h:806
int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num)
Send data to ISO channel without timestamp.
int bt_iso_server_unregister(struct bt_iso_server *server)
Unregister ISO server.
#define BT_ISO_BROADCAST_CODE_SIZE
Broadcast code size.
Definition iso.h:129
int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info)
Get ISO channel info.
int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param, struct bt_iso_big **out_big)
Creates a BIG as a receiver.
int bt_iso_chan_disconnect(struct bt_iso_chan *chan)
Disconnect connected ISO channel.
int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
Connect ISO channels on ACL connections.
int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param)
Reconfigure a CIG as a central.
int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info)
Get ISO transmission timing info.
int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
Send data to ISO channel with timestamp.
int bt_iso_big_terminate(struct bt_iso_big *big)
Terminates a BIG as a broadcaster or receiver.
int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param, struct bt_iso_big **out_big)
Creates a BIG as a broadcaster.
int bt_iso_cig_terminate(struct bt_iso_cig *cig)
Terminates a CIG as a central.
int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig)
Creates a CIG as a central.
bt_iso_state
Life-span states of ISO channel.
Definition iso.h:147
bt_iso_chan_type
ISO Channel Type.
Definition iso.h:164
int bt_iso_server_register(struct bt_iso_server *server)
Register ISO server.
@ BT_ISO_FLAGS_VALID
The ISO packet is valid.
Definition iso.h:300
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition iso.h:310
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition iso.h:307
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition iso.h:318
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition iso.h:151
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition iso.h:153
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition iso.h:155
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition iso.h:157
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition iso.h:149
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition iso.h:165
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition iso.h:167
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition iso.h:168
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition iso.h:166
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
Buffer management.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Bluetooth LE Device Address.
Definition addr.h:49
ISO Accept Info Structure.
Definition iso.h:723
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition iso.h:725
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition iso.h:739
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition iso.h:732
Broadcast Isochronous Group (BIG) creation parameters.
Definition iso.h:465
bool encryption
Whether or not to encrypt the streams.
Definition iso.h:507
uint16_t iso_interval
ISO interval.
Definition iso.h:549
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition iso.h:467
uint32_t interval
Channel interval in us.
Definition iso.h:481
uint8_t num_bis
Number of channels in bis_channels.
Definition iso.h:474
uint8_t framing
Channel framing mode.
Definition iso.h:504
uint8_t bcode[16]
Broadcast code.
Definition iso.h:521
uint16_t latency
Channel Latency in ms.
Definition iso.h:490
uint8_t packing
Channel packing mode.
Definition iso.h:497
uint8_t irc
Immediate Repetition Count.
Definition iso.h:531
uint8_t pto
Pre-transmission offset.
Definition iso.h:540
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition iso.h:554
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition iso.h:573
uint32_t mse
Maximum subevents.
Definition iso.h:585
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition iso.h:592
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition iso.h:595
uint8_t num_bis
Number channels in bis_channels.
Definition iso.h:563
uint8_t bcode[16]
Broadcast code.
Definition iso.h:609
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition iso.h:556
Broadcast Isochronous Group (BIG) information.
Definition iso.h:613
uint8_t framing
Channel framing mode.
Definition iso.h:651
uint8_t num_bis
Number of BISes in the BIG.
Definition iso.h:621
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition iso.h:624
uint8_t phy
Channel PHY.
Definition iso.h:648
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition iso.h:642
uint8_t offset
Offset used for pre-transmissions.
Definition iso.h:633
uint8_t sid
Advertiser SID.
Definition iso.h:618
bool encryption
Whether or not the BIG is encrypted.
Definition iso.h:654
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition iso.h:636
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition iso.h:645
const bt_addr_le_t * addr
Address of the advertiser.
Definition iso.h:615
uint8_t burst_number
The number of new payloads in each BIS event.
Definition iso.h:630
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition iso.h:639
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition iso.h:627
ISO Broadcaster Info Structure.
Definition iso.h:979
uint8_t phy
The transport PHY
Definition iso.h:993
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition iso.h:981
uint32_t latency
The transport latency in us.
Definition iso.h:984
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition iso.h:987
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:990
uint8_t bn
The burst number.
Definition iso.h:996
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition iso.h:999
ISO Channel IO QoS structure.
Definition iso.h:199
uint8_t phy
Channel PHY - See the BT_GAP_LE_PHY_* values.
Definition iso.h:211
uint8_t rtn
Channel Retransmission Number.
Definition iso.h:217
struct bt_iso_chan_path * path
Channel data path reference.
Definition iso.h:224
uint8_t burst_number
Burst number.
Definition iso.h:243
uint16_t sdu
Channel SDU.
Definition iso.h:205
uint16_t max_pdu
Maximum PDU size.
Definition iso.h:236
ISO Channel operations structure.
Definition iso.h:658
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition iso.h:719
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition iso.h:682
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition iso.h:670
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition iso.h:706
ISO Channel Data Path structure.
Definition iso.h:280
uint8_t cc_len
Codec Configuration length.
Definition iso.h:292
uint8_t format
Coding Format.
Definition iso.h:284
uint8_t pid
Default path ID.
Definition iso.h:282
uint16_t cid
Company ID.
Definition iso.h:286
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition iso.h:294
uint32_t delay
Controller Delay.
Definition iso.h:290
uint16_t vid
Vendor-defined Codec ID.
Definition iso.h:288
ISO Channel QoS structure.
Definition iso.h:248
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition iso.h:265
uint8_t num_subevents
Number of subevents.
Definition iso.h:275
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition iso.h:256
ISO Channel structure.
Definition iso.h:172
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition iso.h:176
enum bt_iso_state state
Channel state.
Definition iso.h:180
bt_security_t required_sec_level
The required security level of the channel.
Definition iso.h:192
struct bt_conn * iso
Channel connection reference.
Definition iso.h:174
sys_snode_t node
Definition iso.h:195
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition iso.h:178
Connected Isochronous Group (CIG) parameters.
Definition iso.h:354
uint32_t p_to_c_interval
Channel interval in us for SDUs sent from Peripheral to Central.
Definition iso.h:377
uint8_t packing
Channel packing mode.
Definition iso.h:411
uint8_t framing
Channel framing mode.
Definition iso.h:418
uint8_t num_cis
Number of channels in cis_channels.
Definition iso.h:363
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition iso.h:404
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition iso.h:356
uint16_t iso_interval
ISO interval.
Definition iso.h:448
uint8_t c_to_p_ft
Central to Peripheral flush timeout.
Definition iso.h:429
uint8_t p_to_c_ft
Peripheral to Central flush timeout.
Definition iso.h:439
uint16_t p_to_c_latency
Channel Latency in ms for SDUs sent from Peripheral to Central.
Definition iso.h:395
uint32_t c_to_p_interval
Channel interval in us for SDUs sent from Central to Peripheral.
Definition iso.h:370
uint16_t c_to_p_latency
Channel Latency in ms for SDUs sent from Central to Peripheral.
Definition iso.h:386
ISO connection parameters structure.
Definition iso.h:453
struct bt_conn * acl
The ACL connection.
Definition iso.h:458
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition iso.h:455
ISO channel Info Structure.
Definition iso.h:1021
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition iso.h:1029
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition iso.h:1053
bool can_send
True if the channel is able to send data.
Definition iso.h:1037
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition iso.h:1026
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition iso.h:1059
bool can_recv
True if the channel is able to recv data.
Definition iso.h:1045
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition iso.h:1065
enum bt_iso_chan_type type
Channel Type.
Definition iso.h:1023
ISO Meta Data structure for received ISO packets.
Definition iso.h:322
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition iso.h:334
uint32_t ts
ISO timestamp.
Definition iso.h:328
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition iso.h:331
ISO Server structure.
Definition iso.h:743
bt_security_t sec_level
Required minimum security level.
Definition iso.h:750
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition iso.h:763
ISO Synchronized Receiver Info Structure.
Definition iso.h:1003
uint32_t latency
The transport latency in us.
Definition iso.h:1005
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:1011
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition iso.h:1017
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition iso.h:1008
uint8_t bn
The burst number.
Definition iso.h:1014
ISO Meta Data structure for transmitted ISO packets.
Definition iso.h:338
uint32_t offset
Time offset, in microseconds.
Definition iso.h:343
uint16_t seq_num
Packet sequence number.
Definition iso.h:346
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition iso.h:340
ISO Unicast Info Structure.
Definition iso.h:964
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition iso.h:966
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition iso.h:975
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition iso.h:972
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition iso.h:969
ISO Unicast TX Info Structure.
Definition iso.h:946
uint32_t latency
The transport latency in us.
Definition iso.h:948
uint8_t phy
The transport PHY
Definition iso.h:957
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition iso.h:951
uint8_t bn
The burst number.
Definition iso.h:960
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:954
Network buffer representation.
Definition net_buf.h:1006
Macro utilities.