Zephyr API Documentation  3.7.0-rc3
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 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 <zephyr/sys/atomic.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
38#define BT_ISO_CHAN_SEND_RESERVE BT_BUF_ISO_SIZE(0)
39
48#define BT_ISO_SDU_BUF_SIZE(mtu) BT_BUF_ISO_SIZE(mtu)
49
51#define BT_ISO_DATA_PATH_HCI 0x00
52
54#define BT_ISO_SDU_INTERVAL_MIN 0x0000FFU
56#define BT_ISO_SDU_INTERVAL_MAX 0x0FFFFFU
58#define BT_ISO_ISO_INTERVAL_MIN 0x0004U
60#define BT_ISO_ISO_INTERVAL_MAX 0x0C80U
62#define BT_ISO_LATENCY_MIN 0x0005
64#define BT_ISO_LATENCY_MAX 0x0FA0
66#define BT_ISO_PACKING_SEQUENTIAL 0x00
68#define BT_ISO_PACKING_INTERLEAVED 0x01
70#define BT_ISO_FRAMING_UNFRAMED 0x00
72#define BT_ISO_FRAMING_FRAMED 0x01
74#define BT_ISO_MAX_GROUP_ISO_COUNT 0x1F
76#define BT_ISO_MIN_SDU 0x0001
78#define BT_ISO_MAX_SDU 0x0FFF
80#define BT_ISO_CONNECTED_PDU_MIN 0x0000U
82#define BT_ISO_BROADCAST_PDU_MIN 0x0001U
84#define BT_ISO_PDU_MAX 0x00FBU
86#define BT_ISO_BN_MIN 0x01U
88#define BT_ISO_BN_MAX 0x0FU
90#define BT_ISO_FT_MIN 0x01U
92#define BT_ISO_FT_MAX 0xFFU
94#define BT_ISO_NSE_MIN 0x01U
96#define BT_ISO_NSE_MAX 0x1FU
98#define BT_ISO_SYNC_TIMEOUT_MIN 0x000A
100#define BT_ISO_SYNC_TIMEOUT_MAX 0x4000
102#define BT_ISO_SYNC_MSE_ANY 0x00
104#define BT_ISO_SYNC_MSE_MIN 0x01
106#define BT_ISO_SYNC_MSE_MAX 0x1F
108#define BT_ISO_CONNECTED_RTN_MAX 0xFF
110#define BT_ISO_BROADCAST_RTN_MAX 0x1E
112#define BT_ISO_BROADCAST_CODE_SIZE 16
114#define BT_ISO_BIS_INDEX_MIN 0x01
116#define BT_ISO_BIS_INDEX_MAX 0x1F
118#define BT_ISO_IRC_MIN 0x01U
120#define BT_ISO_IRC_MAX 0x0FU
122#define BT_ISO_PTO_MIN 0x00U
124#define BT_ISO_PTO_MAX 0x0FU
125
141};
142
143
153
157 struct bt_conn *iso;
164#if (defined(CONFIG_BT_SMP) && defined(CONFIG_BT_ISO_UNICAST)) || defined(__DOXYGEN__)
176#endif /* CONFIG_BT_SMP && CONFIG_BT_ISO_UNICAST */
179};
180
208
209#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
220
227#endif /* CONFIG_BT_ISO_TEST_PARAMS */
228};
229
249
250#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
259#endif /* CONFIG_BT_ISO_TEST_PARAMS */
260};
261
278};
279
281enum {
284
291
294
303
312
315
318};
319
324
327
330};
331
332
334struct bt_iso_cig;
335
340
347
354
361
370
379
388
395
402
403#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
413
423
432#endif /* CONFIG_BT_ISO_TEST_PARAMS */
433};
434
439
441 struct bt_conn *acl;
442};
443
445struct bt_iso_big;
446
451
458
465
474
481
488
491
505
506#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
515
524
533#endif /* CONFIG_BT_ISO_TEST_PARAMS */
534};
535
540
547
556
568
575
578
592};
593
598
601
604
607
610
613
616
619
622
625
628
631
634
637};
638
652 void (*connected)(struct bt_iso_chan *chan);
653
664 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
665
676 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
677
688 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
689 struct net_buf *buf);
690
701 void (*sent)(struct bt_iso_chan *chan);
702};
703
707 struct bt_conn *acl;
708
715
722};
723
726#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
733#endif /* CONFIG_BT_SMP */
734
745 int (*accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan);
746};
747
760
771
786int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig);
787
808int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param *param);
809
819int bt_iso_cig_terminate(struct bt_iso_cig *cig);
820
858int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
859
880
900int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num);
901
924int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
925 uint32_t ts);
926
931
934
937
940
943};
944
949
952
955
958};
959
964
967
970
973
976
979
982};
983
988
991
994
997
1000};
1001
1006
1009
1012
1020
1028
1030 union {
1031#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
1036#endif /* CONFIG_BT_ISO_UNICAST */
1037#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
1042#endif /* CONFIG_BT_ISO_BROADCASTER */
1043#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
1048#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
1049 };
1050};
1051
1060int bt_iso_chan_get_info(const struct bt_iso_chan *chan, struct bt_iso_info *info);
1061
1077int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1078
1090int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1091 struct bt_iso_big **out_big);
1092
1100int bt_iso_big_terminate(struct bt_iso_big *big);
1101
1111int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1112 struct bt_iso_big **out_big);
1113
1114#ifdef __cplusplus
1115}
1116#endif
1117
1122#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_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:112
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:130
bt_iso_chan_type
ISO Channel Type.
Definition: iso.h:147
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:283
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition: iso.h:293
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition: iso.h:290
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition: iso.h:301
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition: iso.h:134
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition: iso.h:136
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition: iso.h:138
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: iso.h:140
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition: iso.h:132
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition: iso.h:148
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition: iso.h:150
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition: iso.h:151
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition: iso.h:149
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:705
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition: iso.h:707
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition: iso.h:721
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition: iso.h:714
Broadcast Isochronous Group (BIG) creation parameters.
Definition: iso.h:448
bool encryption
Whether or not to encrypt the streams.
Definition: iso.h:490
uint16_t iso_interval
ISO interval.
Definition: iso.h:532
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:450
uint32_t interval
Channel interval in us.
Definition: iso.h:464
uint8_t num_bis
Number of channels in bis_channels.
Definition: iso.h:457
uint8_t framing
Channel framing mode.
Definition: iso.h:487
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:504
uint16_t latency
Channel Latency in ms.
Definition: iso.h:473
uint8_t packing
Channel packing mode.
Definition: iso.h:480
uint8_t irc
Immediate Repetition Count.
Definition: iso.h:514
uint8_t pto
Pre-transmission offset.
Definition: iso.h:523
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition: iso.h:537
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition: iso.h:555
uint32_t mse
Maximum subevents.
Definition: iso.h:567
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition: iso.h:574
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition: iso.h:577
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:546
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:591
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:539
Broadcast Isochronous Group (BIG) information.
Definition: iso.h:595
uint8_t framing
Channel framing mode.
Definition: iso.h:633
uint8_t num_bis
Number of BISes in the BIG.
Definition: iso.h:603
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition: iso.h:606
uint8_t phy
Channel PHY.
Definition: iso.h:630
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition: iso.h:624
uint8_t offset
Offset used for pre-transmissions.
Definition: iso.h:615
uint8_t sid
Advertiser SID.
Definition: iso.h:600
bool encryption
Whether or not the BIG is encrypted.
Definition: iso.h:636
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition: iso.h:618
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition: iso.h:627
const bt_addr_le_t * addr
Address of the advertiser.
Definition: iso.h:597
uint8_t burst_number
The number of new payloads in each BIS event.
Definition: iso.h:612
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition: iso.h:621
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition: iso.h:609
ISO Broadcaster Info Structure.
Definition: iso.h:961
uint8_t phy
The transport PHY
Definition: iso.h:975
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition: iso.h:963
uint32_t latency
The transport latency in us.
Definition: iso.h:966
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:969
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:972
uint8_t bn
The burst number.
Definition: iso.h:978
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:981
ISO Channel IO QoS structure.
Definition: iso.h:182
uint8_t phy
Channel PHY - See the BT_GAP_LE_PHY_* values.
Definition: iso.h:194
uint8_t rtn
Channel Retransmission Number.
Definition: iso.h:200
struct bt_iso_chan_path * path
Channel data path reference.
Definition: iso.h:207
uint8_t burst_number
Burst number.
Definition: iso.h:226
uint16_t sdu
Channel SDU.
Definition: iso.h:188
uint16_t max_pdu
Maximum PDU size.
Definition: iso.h:219
ISO Channel operations structure.
Definition: iso.h:640
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition: iso.h:701
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition: iso.h:664
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition: iso.h:652
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition: iso.h:688
ISO Channel Data Path structure.
Definition: iso.h:263
uint8_t cc_len
Codec Configuration length.
Definition: iso.h:275
uint8_t format
Coding Format.
Definition: iso.h:267
uint8_t pid
Default path ID.
Definition: iso.h:265
uint16_t cid
Company ID.
Definition: iso.h:269
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition: iso.h:277
uint32_t delay
Controller Delay.
Definition: iso.h:273
uint16_t vid
Vendor-defined Codec ID.
Definition: iso.h:271
ISO Channel QoS structure.
Definition: iso.h:231
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition: iso.h:248
uint8_t num_subevents
Number of subevents.
Definition: iso.h:258
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition: iso.h:239
ISO Channel structure.
Definition: iso.h:155
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition: iso.h:159
enum bt_iso_state state
Channel state.
Definition: iso.h:163
bt_security_t required_sec_level
The required security level of the channel.
Definition: iso.h:175
struct bt_conn * iso
Channel connection reference.
Definition: iso.h:157
sys_snode_t node
Definition: iso.h:178
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition: iso.h:161
Connected Isochronous Group (CIG) parameters.
Definition: iso.h:337
uint32_t p_to_c_interval
Channel interval in us for SDUs sent from Peripheral to Central.
Definition: iso.h:360
uint8_t packing
Channel packing mode.
Definition: iso.h:394
uint8_t framing
Channel framing mode.
Definition: iso.h:401
uint8_t num_cis
Number of channels in cis_channels.
Definition: iso.h:346
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition: iso.h:387
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition: iso.h:339
uint16_t iso_interval
ISO interval.
Definition: iso.h:431
uint8_t c_to_p_ft
Central to Peripheral flush timeout.
Definition: iso.h:412
uint8_t p_to_c_ft
Peripheral to Central flush timeout.
Definition: iso.h:422
uint16_t p_to_c_latency
Channel Latency in ms for SDUs sent from Peripheral to Central.
Definition: iso.h:378
uint32_t c_to_p_interval
Channel interval in us for SDUs sent from Central to Peripheral.
Definition: iso.h:353
uint16_t c_to_p_latency
Channel Latency in ms for SDUs sent from Central to Peripheral.
Definition: iso.h:369
ISO connection parameters structure.
Definition: iso.h:436
struct bt_conn * acl
The ACL connection.
Definition: iso.h:441
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition: iso.h:438
ISO channel Info Structure.
Definition: iso.h:1003
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition: iso.h:1011
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition: iso.h:1035
bool can_send
True if the channel is able to send data.
Definition: iso.h:1019
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition: iso.h:1008
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition: iso.h:1041
bool can_recv
True if the channel is able to recv data.
Definition: iso.h:1027
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition: iso.h:1047
enum bt_iso_chan_type type
Channel Type.
Definition: iso.h:1005
ISO Meta Data structure for received ISO packets.
Definition: iso.h:305
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition: iso.h:317
uint32_t ts
ISO timestamp.
Definition: iso.h:311
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition: iso.h:314
ISO Server structure.
Definition: iso.h:725
bt_security_t sec_level
Required minimum security level.
Definition: iso.h:732
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition: iso.h:745
ISO Synchronized Receiver Info Structure.
Definition: iso.h:985
uint32_t latency
The transport latency in us.
Definition: iso.h:987
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:993
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:999
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:990
uint8_t bn
The burst number.
Definition: iso.h:996
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:321
uint32_t offset
Time offset, in microseconds.
Definition: iso.h:326
uint16_t seq_num
Packet sequence number.
Definition: iso.h:329
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition: iso.h:323
ISO Unicast Info Structure.
Definition: iso.h:946
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition: iso.h:948
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition: iso.h:957
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition: iso.h:954
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition: iso.h:951
ISO Unicast TX Info Structure.
Definition: iso.h:928
uint32_t latency
The transport latency in us.
Definition: iso.h:930
uint8_t phy
The transport PHY
Definition: iso.h:939
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition: iso.h:933
uint8_t bn
The burst number.
Definition: iso.h:942
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:936
Network buffer representation.
Definition: buf.h:1004