Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
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
148#define BT_ISO_VALID_BIS_BITFIELD(_bis_bitfield) \
149 ((_bis_bitfield) != 0U && (_bis_bitfield) <= BIT_MASK(BT_ISO_BIS_INDEX_MAX))
150
167
168
178
182 struct bt_conn *iso;
189#if (defined(CONFIG_BT_SMP) && defined(CONFIG_BT_ISO_UNICAST)) || defined(__DOXYGEN__)
201#endif /* CONFIG_BT_SMP && CONFIG_BT_ISO_UNICAST */
204};
205
233
234#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
245
252#endif /* CONFIG_BT_ISO_TEST_PARAMS */
253};
254
274
275#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
284#endif /* CONFIG_BT_ISO_TEST_PARAMS */
285};
286
304
306enum {
309
316
319
328
344
356
357
359struct bt_iso_cig;
360
365
372
379
386
395
404
413
420
427
428#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
438
448
457#endif /* CONFIG_BT_ISO_TEST_PARAMS */
458};
459
464
466 struct bt_conn *acl;
467};
468
470struct bt_iso_big;
471
476
483
490
499
506
513
516
530
531#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
540
549
558#endif /* CONFIG_BT_ISO_TEST_PARAMS */
559};
560
619
664
678 void (*connected)(struct bt_iso_chan *chan);
679
690 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
691
702 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
703
714 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
715 struct net_buf *buf);
716
727 void (*sent)(struct bt_iso_chan *chan);
728};
729
733 struct bt_conn *acl;
734
741
748};
749
752#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
759#endif /* CONFIG_BT_SMP */
760
771 int (*accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan);
772};
773
786
797
812int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig);
813
834int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param);
835
845int bt_iso_cig_terminate(struct bt_iso_cig *cig);
846
884int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
885
906
926int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num);
927
950int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
951 uint32_t ts);
952
970
985
1009
1027
1032
1035
1038
1046
1054
1056 union {
1057#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
1062#endif /* CONFIG_BT_ISO_UNICAST */
1063#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
1068#endif /* CONFIG_BT_ISO_BROADCASTER */
1069#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
1074#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
1075 };
1076};
1077
1086int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info);
1087
1103int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1104
1116int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1117 struct bt_iso_big **out_big);
1118
1126int bt_iso_big_terminate(struct bt_iso_big *big);
1127
1137int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1138 struct bt_iso_big **out_big);
1139
1140#ifdef __cplusplus
1141}
1142#endif
1143
1148#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:155
bt_iso_chan_type
ISO Channel Type.
Definition iso.h:172
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:308
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition iso.h:318
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition iso.h:315
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition iso.h:326
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition iso.h:159
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition iso.h:161
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition iso.h:163
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition iso.h:165
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition iso.h:157
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition iso.h:173
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition iso.h:175
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition iso.h:176
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition iso.h:174
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:731
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition iso.h:733
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition iso.h:747
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition iso.h:740
Broadcast Isochronous Group (BIG) creation parameters.
Definition iso.h:473
bool encryption
Whether or not to encrypt the streams.
Definition iso.h:515
uint16_t iso_interval
ISO interval.
Definition iso.h:557
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition iso.h:475
uint32_t interval
Channel interval in us.
Definition iso.h:489
uint8_t num_bis
Number of channels in bis_channels.
Definition iso.h:482
uint8_t framing
Channel framing mode.
Definition iso.h:512
uint8_t bcode[16]
Broadcast code.
Definition iso.h:529
uint16_t latency
Channel Latency in ms.
Definition iso.h:498
uint8_t packing
Channel packing mode.
Definition iso.h:505
uint8_t irc
Immediate Repetition Count.
Definition iso.h:539
uint8_t pto
Pre-transmission offset.
Definition iso.h:548
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition iso.h:562
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition iso.h:581
uint32_t mse
Maximum subevents.
Definition iso.h:593
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition iso.h:600
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition iso.h:603
uint8_t num_bis
Number channels in bis_channels.
Definition iso.h:571
uint8_t bcode[16]
Broadcast code.
Definition iso.h:617
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition iso.h:564
Broadcast Isochronous Group (BIG) information.
Definition iso.h:621
uint8_t framing
Channel framing mode.
Definition iso.h:659
uint8_t num_bis
Number of BISes in the BIG.
Definition iso.h:629
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition iso.h:632
uint8_t phy
Channel PHY.
Definition iso.h:656
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition iso.h:650
uint8_t offset
Offset used for pre-transmissions.
Definition iso.h:641
uint8_t sid
Advertiser SID.
Definition iso.h:626
bool encryption
Whether or not the BIG is encrypted.
Definition iso.h:662
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition iso.h:644
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition iso.h:653
const bt_addr_le_t * addr
Address of the advertiser.
Definition iso.h:623
uint8_t burst_number
The number of new payloads in each BIS event.
Definition iso.h:638
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition iso.h:647
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition iso.h:635
ISO Broadcaster Info Structure.
Definition iso.h:987
uint8_t phy
The transport PHY
Definition iso.h:1001
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition iso.h:989
uint32_t latency
The transport latency in us.
Definition iso.h:992
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition iso.h:995
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:998
uint8_t bn
The burst number.
Definition iso.h:1004
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition iso.h:1007
ISO Channel IO QoS structure.
Definition iso.h:207
uint8_t phy
Channel PHY - See the BT_GAP_LE_PHY_* values.
Definition iso.h:219
uint8_t rtn
Channel Retransmission Number.
Definition iso.h:225
struct bt_iso_chan_path * path
Channel data path reference.
Definition iso.h:232
uint8_t burst_number
Burst number.
Definition iso.h:251
uint16_t sdu
Channel SDU.
Definition iso.h:213
uint16_t max_pdu
Maximum PDU size.
Definition iso.h:244
ISO Channel operations structure.
Definition iso.h:666
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition iso.h:727
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition iso.h:690
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition iso.h:678
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition iso.h:714
ISO Channel Data Path structure.
Definition iso.h:288
uint8_t cc_len
Codec Configuration length.
Definition iso.h:300
uint8_t format
Coding Format.
Definition iso.h:292
uint8_t pid
Default path ID.
Definition iso.h:290
uint16_t cid
Company ID.
Definition iso.h:294
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition iso.h:302
uint32_t delay
Controller Delay.
Definition iso.h:298
uint16_t vid
Vendor-defined Codec ID.
Definition iso.h:296
ISO Channel QoS structure.
Definition iso.h:256
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition iso.h:273
uint8_t num_subevents
Number of subevents.
Definition iso.h:283
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition iso.h:264
ISO Channel structure.
Definition iso.h:180
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition iso.h:184
enum bt_iso_state state
Channel state.
Definition iso.h:188
bt_security_t required_sec_level
The required security level of the channel.
Definition iso.h:200
struct bt_conn * iso
Channel connection reference.
Definition iso.h:182
sys_snode_t node
Definition iso.h:203
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition iso.h:186
Connected Isochronous Group (CIG) parameters.
Definition iso.h:362
uint32_t p_to_c_interval
Channel interval in us for SDUs sent from Peripheral to Central.
Definition iso.h:385
uint8_t packing
Channel packing mode.
Definition iso.h:419
uint8_t framing
Channel framing mode.
Definition iso.h:426
uint8_t num_cis
Number of channels in cis_channels.
Definition iso.h:371
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition iso.h:412
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition iso.h:364
uint16_t iso_interval
ISO interval.
Definition iso.h:456
uint8_t c_to_p_ft
Central to Peripheral flush timeout.
Definition iso.h:437
uint8_t p_to_c_ft
Peripheral to Central flush timeout.
Definition iso.h:447
uint16_t p_to_c_latency
Channel Latency in ms for SDUs sent from Peripheral to Central.
Definition iso.h:403
uint32_t c_to_p_interval
Channel interval in us for SDUs sent from Central to Peripheral.
Definition iso.h:378
uint16_t c_to_p_latency
Channel Latency in ms for SDUs sent from Central to Peripheral.
Definition iso.h:394
ISO connection parameters structure.
Definition iso.h:461
struct bt_conn * acl
The ACL connection.
Definition iso.h:466
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition iso.h:463
ISO channel Info Structure.
Definition iso.h:1029
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition iso.h:1037
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition iso.h:1061
bool can_send
True if the channel is able to send data.
Definition iso.h:1045
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition iso.h:1034
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition iso.h:1067
bool can_recv
True if the channel is able to recv data.
Definition iso.h:1053
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition iso.h:1073
enum bt_iso_chan_type type
Channel Type.
Definition iso.h:1031
ISO Meta Data structure for received ISO packets.
Definition iso.h:330
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition iso.h:342
uint32_t ts
ISO timestamp.
Definition iso.h:336
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition iso.h:339
ISO Server structure.
Definition iso.h:751
bt_security_t sec_level
Required minimum security level.
Definition iso.h:758
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition iso.h:771
ISO Synchronized Receiver Info Structure.
Definition iso.h:1011
uint32_t latency
The transport latency in us.
Definition iso.h:1013
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:1019
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition iso.h:1025
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition iso.h:1016
uint8_t bn
The burst number.
Definition iso.h:1022
ISO Meta Data structure for transmitted ISO packets.
Definition iso.h:346
uint32_t offset
Time offset, in microseconds.
Definition iso.h:351
uint16_t seq_num
Packet sequence number.
Definition iso.h:354
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition iso.h:348
ISO Unicast Info Structure.
Definition iso.h:972
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition iso.h:974
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition iso.h:983
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition iso.h:980
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition iso.h:977
ISO Unicast TX Info Structure.
Definition iso.h:954
uint32_t latency
The transport latency in us.
Definition iso.h:956
uint8_t phy
The transport PHY
Definition iso.h:965
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition iso.h:959
uint8_t bn
The burst number.
Definition iso.h:968
uint16_t max_pdu
The maximum PDU size in octets.
Definition iso.h:962
Network buffer representation.
Definition net_buf.h:1006
Macro utilities.