Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
25#include <zephyr/sys/atomic.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
37#define BT_ISO_CHAN_SEND_RESERVE BT_BUF_ISO_SIZE(0)
38
47#define BT_ISO_SDU_BUF_SIZE(mtu) BT_BUF_ISO_SIZE(mtu)
48
50#define BT_ISO_DATA_PATH_HCI 0x00
51
53#define BT_ISO_SDU_INTERVAL_MIN 0x0000FFU
55#define BT_ISO_SDU_INTERVAL_MAX 0x0FFFFFU
57#define BT_ISO_ISO_INTERVAL_MIN 0x0004U
59#define BT_ISO_ISO_INTERVAL_MAX 0x0C80U
61#define BT_ISO_LATENCY_MIN 0x0005
63#define BT_ISO_LATENCY_MAX 0x0FA0
65#define BT_ISO_PACKING_SEQUENTIAL 0x00
67#define BT_ISO_PACKING_INTERLEAVED 0x01
69#define BT_ISO_FRAMING_UNFRAMED 0x00
71#define BT_ISO_FRAMING_FRAMED 0x01
73#define BT_ISO_MAX_GROUP_ISO_COUNT 0x1F
75#define BT_ISO_MIN_SDU 0x0001
77#define BT_ISO_MAX_SDU 0x0FFF
79#define BT_ISO_CONNECTED_PDU_MIN 0x0000U
81#define BT_ISO_BROADCAST_PDU_MIN 0x0001U
83#define BT_ISO_PDU_MAX 0x00FBU
85#define BT_ISO_BN_MIN 0x01U
87#define BT_ISO_BN_MAX 0x0FU
89#define BT_ISO_FT_MIN 0x01U
91#define BT_ISO_FT_MAX 0xFFU
93#define BT_ISO_NSE_MIN 0x01U
95#define BT_ISO_NSE_MAX 0x1FU
97#define BT_ISO_SYNC_TIMEOUT_MIN 0x000A
99#define BT_ISO_SYNC_TIMEOUT_MAX 0x4000
101#define BT_ISO_SYNC_MSE_ANY 0x00
103#define BT_ISO_SYNC_MSE_MIN 0x01
105#define BT_ISO_SYNC_MSE_MAX 0x1F
107#define BT_ISO_CONNECTED_RTN_MAX 0xFF
109#define BT_ISO_BROADCAST_RTN_MAX 0x1E
111#define BT_ISO_BROADCAST_CODE_SIZE 16
113#define BT_ISO_BIS_INDEX_MIN 0x01
115#define BT_ISO_BIS_INDEX_MAX 0x1F
117#define BT_ISO_IRC_MIN 0x01U
119#define BT_ISO_IRC_MAX 0x0FU
121#define BT_ISO_PTO_MIN 0x00U
123#define BT_ISO_PTO_MAX 0x0FU
124
140};
141
142
152
156 struct bt_conn *iso;
163#if (defined(CONFIG_BT_SMP) && defined(CONFIG_BT_ISO_UNICAST)) || defined(__DOXYGEN__)
174#endif /* CONFIG_BT_SMP && CONFIG_BT_ISO_UNICAST */
177};
178
198
199#if defined(CONFIG_BT_ISO_TEST_PARAMS)
211 uint16_t max_pdu;
212
217 uint8_t burst_number;
218#endif /* CONFIG_BT_ISO_TEST_PARAMS */
219};
220
239
240#if defined(CONFIG_BT_ISO_TEST_PARAMS)
247 uint8_t num_subevents;
248#endif /* CONFIG_BT_ISO_TEST_PARAMS */
249};
250
267};
268
270enum {
273
279
282
290
298
301
304};
305
310
313
316};
317
318
320struct bt_iso_cig;
321
326
333
339
345
353
361
370
376
383
384#if defined(CONFIG_BT_ISO_TEST_PARAMS)
392 uint8_t c_to_p_ft;
393
401 uint8_t p_to_c_ft;
402
410 uint16_t iso_interval;
411#endif /* CONFIG_BT_ISO_TEST_PARAMS */
412};
413
418
420 struct bt_conn *acl;
421};
422
424struct bt_iso_big;
425
430
437
443
451
457
464
467
481
482#if defined(CONFIG_BT_ISO_TEST_PARAMS)
490 uint8_t irc;
491
498 uint8_t pto;
499
507 uint16_t iso_interval;
508#endif /* CONFIG_BT_ISO_TEST_PARAMS */
509};
510
515
522
530
541
547
550
564};
565
570
573
576
579
582
585
588
591
594
597
600
603
606
609};
610
624 void (*connected)(struct bt_iso_chan *chan);
625
635 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
636
646 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
647
657 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
658 struct net_buf *buf);
659
669 void (*sent)(struct bt_iso_chan *chan);
670};
671
675 struct bt_conn *acl;
676
682
688};
689
692#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
697#endif /* CONFIG_BT_SMP */
698
709 int (*accept)(const struct bt_iso_accept_info *info,
710 struct bt_iso_chan **chan);
711};
712
724
734
749int bt_iso_cig_create(const struct bt_iso_cig_param *param,
750 struct bt_iso_cig **out_cig);
751
771int bt_iso_cig_reconfigure(struct bt_iso_cig *cig,
772 const struct bt_iso_cig_param *param);
773
782int bt_iso_cig_terminate(struct bt_iso_cig *cig);
783
820int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
821
841
860int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num);
861
883int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
884 uint32_t ts);
885
890
893
896
899
902};
903
908
911
914
917};
918
923
926
929
932
935
938
941};
942
947
950
953
956
959};
960
965
968
971
979
987
989 union {
990#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
995#endif /* CONFIG_BT_ISO_UNICAST */
996#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
1001#endif /* CONFIG_BT_ISO_BROADCASTER */
1002#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
1007#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
1008 };
1009};
1010
1018int bt_iso_chan_get_info(const struct bt_iso_chan *chan,
1019 struct bt_iso_info *info);
1020
1035int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1036
1047int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1048 struct bt_iso_big **out_big);
1049
1056int bt_iso_big_terminate(struct bt_iso_big *big);
1057
1066int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1067 struct bt_iso_big **out_big);
1068
1069#ifdef __cplusplus
1070}
1071#endif
1072
1077#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ISO_H_ */
Bluetooth data buffer API.
Bluetooth connection handling.
bt_security_t
Security level.
Definition: conn.h:408
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:111
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:129
bt_iso_chan_type
ISO Channel Type.
Definition: iso.h:146
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:272
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition: iso.h:281
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition: iso.h:278
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition: iso.h:288
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition: iso.h:133
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition: iso.h:135
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition: iso.h:137
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: iso.h:139
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition: iso.h:131
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition: iso.h:147
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition: iso.h:149
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition: iso.h:150
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition: iso.h:148
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:673
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition: iso.h:675
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition: iso.h:687
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition: iso.h:681
Broadcast Isochronous Group (BIG) creation parameters.
Definition: iso.h:427
bool encryption
Whether or not to encrypt the streams.
Definition: iso.h:466
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:429
uint32_t interval
Channel interval in us.
Definition: iso.h:442
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:436
uint8_t framing
Channel framing mode.
Definition: iso.h:463
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:480
uint16_t latency
Channel Latency in ms.
Definition: iso.h:450
uint8_t packing
Channel packing mode.
Definition: iso.h:456
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition: iso.h:512
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition: iso.h:529
uint32_t mse
Maximum subevents.
Definition: iso.h:540
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition: iso.h:546
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition: iso.h:549
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:521
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:563
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:514
Broadcast Isochronous Group (BIG) information.
Definition: iso.h:567
uint8_t framing
Channel framing mode.
Definition: iso.h:605
uint8_t num_bis
Number of BISes in the BIG.
Definition: iso.h:575
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition: iso.h:578
uint8_t phy
Channel PHY.
Definition: iso.h:602
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition: iso.h:596
uint8_t offset
Offset used for pre-transmissions.
Definition: iso.h:587
uint8_t sid
Advertiser SID.
Definition: iso.h:572
bool encryption
Whether or not the BIG is encrypted.
Definition: iso.h:608
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition: iso.h:590
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition: iso.h:599
const bt_addr_le_t * addr
Address of the advertiser.
Definition: iso.h:569
uint8_t burst_number
The number of new payloads in each BIS event.
Definition: iso.h:584
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition: iso.h:593
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition: iso.h:581
ISO Broadcaster Info Structure.
Definition: iso.h:920
uint8_t phy
The transport PHY
Definition: iso.h:934
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition: iso.h:922
uint32_t latency
The transport latency in us.
Definition: iso.h:925
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:928
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:931
uint8_t bn
The burst number.
Definition: iso.h:937
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:940
ISO Channel IO QoS structure.
Definition: iso.h:180
uint8_t phy
Channel PHY - See BT_GAP_LE_PHY for values.
Definition: iso.h:186
uint8_t rtn
Channel Retransmission Number.
Definition: iso.h:191
struct bt_iso_chan_path * path
Channel data path reference.
Definition: iso.h:197
uint16_t sdu
Channel SDU.
Definition: iso.h:182
ISO Channel operations structure.
Definition: iso.h:612
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition: iso.h:669
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition: iso.h:635
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition: iso.h:624
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition: iso.h:657
ISO Channel Data Path structure.
Definition: iso.h:252
uint8_t cc_len
Codec Configuration length.
Definition: iso.h:264
uint8_t format
Coding Format.
Definition: iso.h:256
uint8_t pid
Default path ID.
Definition: iso.h:254
uint16_t cid
Company ID.
Definition: iso.h:258
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition: iso.h:266
uint32_t delay
Controller Delay.
Definition: iso.h:262
uint16_t vid
Vendor-defined Codec ID.
Definition: iso.h:260
ISO Channel QoS structure.
Definition: iso.h:222
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition: iso.h:238
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition: iso.h:230
ISO Channel structure.
Definition: iso.h:154
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition: iso.h:158
enum bt_iso_state state
Channel state.
Definition: iso.h:162
bt_security_t required_sec_level
The required security level of the channel.
Definition: iso.h:173
struct bt_conn * iso
Channel connection reference.
Definition: iso.h:156
sys_snode_t node
Node used internally by the stack.
Definition: iso.h:176
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition: iso.h:160
Connected Isochronous Group (CIG) parameters.
Definition: iso.h:323
uint32_t p_to_c_interval
Channel interval in us for SDUs sent from Peripheral to Central.
Definition: iso.h:344
uint8_t packing
Channel packing mode.
Definition: iso.h:375
uint8_t framing
Channel framing mode.
Definition: iso.h:382
uint8_t num_cis
Number channels in cis_channels.
Definition: iso.h:332
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition: iso.h:369
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition: iso.h:325
uint16_t p_to_c_latency
Channel Latency in ms for SDUs sent from Peripheral to Central.
Definition: iso.h:360
uint32_t c_to_p_interval
Channel interval in us for SDUs sent from Central to Peripheral.
Definition: iso.h:338
uint16_t c_to_p_latency
Channel Latency in ms for SDUs sent from Central to Peripheral.
Definition: iso.h:352
ISO connection parameters structure.
Definition: iso.h:415
struct bt_conn * acl
The ACL connection.
Definition: iso.h:420
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition: iso.h:417
ISO channel Info Structure.
Definition: iso.h:962
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition: iso.h:970
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition: iso.h:994
bool can_send
True if the channel is able to send data.
Definition: iso.h:978
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition: iso.h:967
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition: iso.h:1000
bool can_recv
True if the channel is able to recv data.
Definition: iso.h:986
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition: iso.h:1006
enum bt_iso_chan_type type
Channel Type.
Definition: iso.h:964
ISO Meta Data structure for received ISO packets.
Definition: iso.h:292
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition: iso.h:303
uint32_t ts
ISO timestamp.
Definition: iso.h:297
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition: iso.h:300
ISO Server structure.
Definition: iso.h:691
bt_security_t sec_level
Required minimum security level.
Definition: iso.h:696
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition: iso.h:709
ISO Synchronized Receiver Info Structure.
Definition: iso.h:944
uint32_t latency
The transport latency in us.
Definition: iso.h:946
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:952
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:958
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:949
uint8_t bn
The burst number.
Definition: iso.h:955
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:307
uint32_t offset
Time offset, in microseconds.
Definition: iso.h:312
uint16_t seq_num
Packet sequence number.
Definition: iso.h:315
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition: iso.h:309
ISO Unicast Info Structure.
Definition: iso.h:905
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition: iso.h:907
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition: iso.h:916
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition: iso.h:913
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition: iso.h:910
ISO Unicast TX Info Structure.
Definition: iso.h:887
uint32_t latency
The transport latency in us.
Definition: iso.h:889
uint8_t phy
The transport PHY
Definition: iso.h:898
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition: iso.h:892
uint8_t bn
The burst number.
Definition: iso.h:901
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:895
Network buffer representation.
Definition: buf.h:1004