Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
iso.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2020 Intel Corporation
7 * Copyright (c) 2021 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_
13
21#include <zephyr/sys/atomic.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
33#define BT_ISO_CHAN_SEND_RESERVE BT_BUF_ISO_SIZE(0)
34
43#define BT_ISO_SDU_BUF_SIZE(mtu) BT_BUF_ISO_SIZE(mtu)
44
46#define BT_ISO_DATA_PATH_HCI 0x00
47
49#define BT_ISO_SDU_INTERVAL_MIN 0x0000FFU
51#define BT_ISO_SDU_INTERVAL_MAX 0x0FFFFFU
53#define BT_ISO_ISO_INTERVAL_MIN 0x0004U
55#define BT_ISO_ISO_INTERVAL_MAX 0x0C80U
57#define BT_ISO_LATENCY_MIN 0x0005
59#define BT_ISO_LATENCY_MAX 0x0FA0
61#define BT_ISO_PACKING_SEQUENTIAL 0x00
63#define BT_ISO_PACKING_INTERLEAVED 0x01
65#define BT_ISO_FRAMING_UNFRAMED 0x00
67#define BT_ISO_FRAMING_FRAMED 0x01
69#define BT_ISO_MAX_GROUP_ISO_COUNT 0x1F
71#define BT_ISO_MIN_SDU 0x0001
73#define BT_ISO_MAX_SDU 0x0FFF
75#define BT_ISO_CONNECTED_PDU_MIN 0x0000U
77#define BT_ISO_BROADCAST_PDU_MIN 0x0001U
79#define BT_ISO_PDU_MAX 0x00FBU
81#define BT_ISO_BN_MIN 0x01U
83#define BT_ISO_BN_MAX 0x0FU
85#define BT_ISO_FT_MIN 0x01U
87#define BT_ISO_FT_MAX 0xFFU
89#define BT_ISO_NSE_MIN 0x01U
91#define BT_ISO_NSE_MAX 0x1FU
93#define BT_ISO_SYNC_TIMEOUT_MIN 0x000A
95#define BT_ISO_SYNC_TIMEOUT_MAX 0x4000
97#define BT_ISO_SYNC_MSE_ANY 0x00
99#define BT_ISO_SYNC_MSE_MIN 0x01
101#define BT_ISO_SYNC_MSE_MAX 0x1F
103#define BT_ISO_CONNECTED_RTN_MAX 0xFF
105#define BT_ISO_BROADCAST_RTN_MAX 0x1E
107#define BT_ISO_BROADCAST_CODE_SIZE 16
109#define BT_ISO_BIS_INDEX_MIN 0x01
111#define BT_ISO_BIS_INDEX_MAX 0x1F
113#define BT_ISO_IRC_MIN 0x01U
115#define BT_ISO_IRC_MAX 0x0FU
117#define BT_ISO_PTO_MIN 0x00U
119#define BT_ISO_PTO_MAX 0x0FU
120
121
127#define BT_ISO_TIMESTAMP_NONE 0U
128
144};
145
146
156
160 struct bt_conn *iso;
167#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
178#endif /* CONFIG_BT_SMP */
181};
182
202
203#if defined(CONFIG_BT_ISO_ADVANCED)
215 uint16_t max_pdu;
216
221 uint8_t burst_number;
222#endif /* CONFIG_BT_ISO_ADVANCED */
223};
224
243
244#if defined(CONFIG_BT_ISO_ADVANCED)
251 uint8_t num_subevents;
252#endif /* CONFIG_BT_ISO_ADVANCED */
253};
254
271};
272
274enum {
277
283
286
294
302
305
308};
309
314
317
320};
321
322
324struct bt_iso_cig;
325
330
337
343
351
360
366
373
374#if defined(CONFIG_BT_ISO_ADVANCED)
382 uint8_t c_to_p_ft;
383
391 uint8_t p_to_c_ft;
392
400 uint16_t iso_interval;
401#endif /* CONFIG_BT_ISO_ADVANCED */
402
403};
404
409
411 struct bt_conn *acl;
412};
413
415struct bt_iso_big;
416
421
428
434
442
448
455
458
472
473#if defined(CONFIG_BT_ISO_ADVANCED)
481 uint8_t irc;
482
489 uint8_t pto;
490
498 uint16_t iso_interval;
499#endif /* CONFIG_BT_ISO_ADVANCED */
500};
501
506
513
521
532
538
541
555};
556
561
564
567
570
573
576
579
582
585
588
591
594
597
600};
601
615 void (*connected)(struct bt_iso_chan *chan);
616
626 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
627
637 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
638
648 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
649 struct net_buf *buf);
650
658 void (*sent)(struct bt_iso_chan *chan);
659};
660
664 struct bt_conn *acl;
665
671
677};
678
681#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
686#endif /* CONFIG_BT_SMP */
687
698 int (*accept)(const struct bt_iso_accept_info *info,
699 struct bt_iso_chan **chan);
700};
701
713
723
738int bt_iso_cig_create(const struct bt_iso_cig_param *param,
739 struct bt_iso_cig **out_cig);
740
760int bt_iso_cig_reconfigure(struct bt_iso_cig *cig,
761 const struct bt_iso_cig_param *param);
762
771int bt_iso_cig_terminate(struct bt_iso_cig *cig);
772
809int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
810
830
854int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf,
855 uint16_t seq_num, uint32_t ts);
856
861
864
867
870
873};
874
879
882
885
888};
889
894
897
900
903
906
909
912};
913
918
921
924
927
930};
931
936
939
942
950
958
960 union {
961#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
966#endif /* CONFIG_BT_ISO_UNICAST */
967#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
972#endif /* CONFIG_BT_ISO_BROADCASTER */
973#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
978#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
979 };
980};
981
989int bt_iso_chan_get_info(const struct bt_iso_chan *chan,
990 struct bt_iso_info *info);
991
1006int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1007
1018int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1019 struct bt_iso_big **out_big);
1020
1027int bt_iso_big_terminate(struct bt_iso_big *big);
1028
1037int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1038 struct bt_iso_big **out_big);
1039
1040#ifdef __cplusplus
1041}
1042#endif
1043
1048#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_ */
Bluetooth data buffer API.
Bluetooth connection handling.
bt_security_t
Security level.
Definition: conn.h:352
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:107
int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info)
Get ISO channel info.
int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num, uint32_t ts)
Send data to ISO channel.
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_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:133
bt_iso_chan_type
ISO Channel Type.
Definition: iso.h:150
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:276
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition: iso.h:285
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition: iso.h:282
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition: iso.h:292
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition: iso.h:137
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition: iso.h:139
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition: iso.h:141
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: iso.h:143
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition: iso.h:135
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition: iso.h:151
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition: iso.h:153
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition: iso.h:154
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition: iso.h:152
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
__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:662
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition: iso.h:664
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition: iso.h:676
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition: iso.h:670
Broadcast Isochronous Group (BIG) creation parameters.
Definition: iso.h:418
bool encryption
Whether or not to encrypt the streams.
Definition: iso.h:457
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:420
uint32_t interval
Channel interval in us.
Definition: iso.h:433
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:427
uint8_t framing
Channel framing mode.
Definition: iso.h:454
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:471
uint16_t latency
Channel Latency in ms.
Definition: iso.h:441
uint8_t packing
Channel packing mode.
Definition: iso.h:447
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition: iso.h:503
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition: iso.h:520
uint32_t mse
Maximum subevents.
Definition: iso.h:531
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition: iso.h:537
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition: iso.h:540
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:512
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:554
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:505
Broadcast Isochronous Group (BIG) information.
Definition: iso.h:558
uint8_t framing
Channel framing mode.
Definition: iso.h:596
uint8_t num_bis
Number of BISes in the BIG.
Definition: iso.h:566
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition: iso.h:569
uint8_t phy
Channel PHY.
Definition: iso.h:593
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition: iso.h:587
uint8_t offset
Offset used for pre-transmissions.
Definition: iso.h:578
uint8_t sid
Advertiser SID.
Definition: iso.h:563
bool encryption
Whether or not the BIG is encrypted.
Definition: iso.h:599
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition: iso.h:581
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition: iso.h:590
const bt_addr_le_t * addr
Address of the advertiser.
Definition: iso.h:560
uint8_t burst_number
The number of new payloads in each BIS event.
Definition: iso.h:575
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition: iso.h:584
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition: iso.h:572
ISO Broadcaster Info Structure.
Definition: iso.h:891
uint8_t phy
The transport PHY
Definition: iso.h:905
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition: iso.h:893
uint32_t latency
The transport latency in us.
Definition: iso.h:896
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:899
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:902
uint8_t bn
The burst number.
Definition: iso.h:908
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:911
ISO Channel IO QoS structure.
Definition: iso.h:184
uint8_t phy
Channel PHY - See BT_GAP_LE_PHY for values.
Definition: iso.h:190
uint8_t rtn
Channel Retransmission Number.
Definition: iso.h:195
struct bt_iso_chan_path * path
Channel data path reference.
Definition: iso.h:201
uint16_t sdu
Channel SDU.
Definition: iso.h:186
ISO Channel operations structure.
Definition: iso.h:603
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition: iso.h:658
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition: iso.h:626
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition: iso.h:615
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition: iso.h:648
ISO Channel Data Path structure.
Definition: iso.h:256
uint8_t cc_len
Codec Configuration length.
Definition: iso.h:268
uint8_t format
Coding Format.
Definition: iso.h:260
uint8_t pid
Default path ID.
Definition: iso.h:258
uint16_t cid
Company ID.
Definition: iso.h:262
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition: iso.h:270
uint32_t delay
Controller Delay.
Definition: iso.h:266
uint16_t vid
Vendor-defined Codec ID.
Definition: iso.h:264
ISO Channel QoS structure.
Definition: iso.h:226
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition: iso.h:242
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition: iso.h:234
ISO Channel structure.
Definition: iso.h:158
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition: iso.h:162
enum bt_iso_state state
Channel state.
Definition: iso.h:166
bt_security_t required_sec_level
The required security level of the channel.
Definition: iso.h:177
struct bt_conn * iso
Channel connection reference.
Definition: iso.h:160
sys_snode_t node
Node used internally by the stack.
Definition: iso.h:180
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition: iso.h:164
Connected Isochronous Group (CIG) parameters.
Definition: iso.h:327
uint16_t latency
Channel Latency in ms.
Definition: iso.h:350
uint8_t packing
Channel packing mode.
Definition: iso.h:365
uint8_t framing
Channel framing mode.
Definition: iso.h:372
uint8_t num_cis
Number channels in cis_channels.
Definition: iso.h:336
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition: iso.h:359
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition: iso.h:329
uint32_t interval
Channel interval in us.
Definition: iso.h:342
ISO connection parameters structure.
Definition: iso.h:406
struct bt_conn * acl
The ACL connection.
Definition: iso.h:411
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition: iso.h:408
ISO channel Info Structure.
Definition: iso.h:933
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition: iso.h:941
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition: iso.h:965
bool can_send
True if the channel is able to send data.
Definition: iso.h:949
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition: iso.h:938
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition: iso.h:971
bool can_recv
True if the channel is able to recv data.
Definition: iso.h:957
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition: iso.h:977
enum bt_iso_chan_type type
Channel Type.
Definition: iso.h:935
ISO Meta Data structure for received ISO packets.
Definition: iso.h:296
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition: iso.h:307
uint32_t ts
ISO timestamp.
Definition: iso.h:301
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition: iso.h:304
ISO Server structure.
Definition: iso.h:680
bt_security_t sec_level
Required minimum security level.
Definition: iso.h:685
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition: iso.h:698
ISO Synchronized Receiver Info Structure.
Definition: iso.h:915
uint32_t latency
The transport latency in us.
Definition: iso.h:917
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:923
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:929
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:920
uint8_t bn
The burst number.
Definition: iso.h:926
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:311
uint32_t offset
Time offset, in microseconds.
Definition: iso.h:316
uint16_t seq_num
Packet sequence number.
Definition: iso.h:319
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition: iso.h:313
ISO Unicast Info Structure.
Definition: iso.h:876
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition: iso.h:878
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition: iso.h:887
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition: iso.h:884
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition: iso.h:881
ISO Unicast TX Info Structure.
Definition: iso.h:858
uint32_t latency
The transport latency in us.
Definition: iso.h:860
uint8_t phy
The transport PHY
Definition: iso.h:869
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition: iso.h:863
uint8_t bn
The burst number.
Definition: iso.h:872
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:866
Network buffer representation.
Definition: buf.h:906