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
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
136};
137
138
148
152 struct bt_conn *iso;
159#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
170#endif /* CONFIG_BT_SMP */
173};
174
194
195#if defined(CONFIG_BT_ISO_TEST_PARAMS)
207 uint16_t max_pdu;
208
213 uint8_t burst_number;
214#endif /* CONFIG_BT_ISO_TEST_PARAMS */
215};
216
235
236#if defined(CONFIG_BT_ISO_TEST_PARAMS)
243 uint8_t num_subevents;
244#endif /* CONFIG_BT_ISO_TEST_PARAMS */
245};
246
263};
264
266enum {
269
275
278
286
294
297
300};
301
306
309
312};
313
314
316struct bt_iso_cig;
317
322
329
335
341
349
357
366
372
379
380#if defined(CONFIG_BT_ISO_TEST_PARAMS)
388 uint8_t c_to_p_ft;
389
397 uint8_t p_to_c_ft;
398
406 uint16_t iso_interval;
407#endif /* CONFIG_BT_ISO_TEST_PARAMS */
408};
409
414
416 struct bt_conn *acl;
417};
418
420struct bt_iso_big;
421
426
433
439
447
453
460
463
477
478#if defined(CONFIG_BT_ISO_TEST_PARAMS)
486 uint8_t irc;
487
494 uint8_t pto;
495
503 uint16_t iso_interval;
504#endif /* CONFIG_BT_ISO_TEST_PARAMS */
505};
506
511
518
526
537
543
546
560};
561
566
569
572
575
578
581
584
587
590
593
596
599
602
605};
606
620 void (*connected)(struct bt_iso_chan *chan);
621
631 void (*disconnected)(struct bt_iso_chan *chan, uint8_t reason);
632
642 struct net_buf *(*alloc_buf)(struct bt_iso_chan *chan);
643
653 void (*recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
654 struct net_buf *buf);
655
665 void (*sent)(struct bt_iso_chan *chan);
666};
667
671 struct bt_conn *acl;
672
678
684};
685
688#if defined(CONFIG_BT_SMP) || defined(__DOXYGEN__)
693#endif /* CONFIG_BT_SMP */
694
705 int (*accept)(const struct bt_iso_accept_info *info,
706 struct bt_iso_chan **chan);
707};
708
720
730
745int bt_iso_cig_create(const struct bt_iso_cig_param *param,
746 struct bt_iso_cig **out_cig);
747
767int bt_iso_cig_reconfigure(struct bt_iso_cig *cig,
768 const struct bt_iso_cig_param *param);
769
778int bt_iso_cig_terminate(struct bt_iso_cig *cig);
779
816int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count);
817
837
856int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num);
857
879int bt_iso_chan_send_ts(struct bt_iso_chan *chan, struct net_buf *buf, uint16_t seq_num,
880 uint32_t ts);
881
886
889
892
895
898};
899
904
907
910
913};
914
919
922
925
928
931
934
937};
938
943
946
949
952
955};
956
961
964
967
975
983
985 union {
986#if defined(CONFIG_BT_ISO_UNICAST) || defined(__DOXYGEN__)
991#endif /* CONFIG_BT_ISO_UNICAST */
992#if defined(CONFIG_BT_ISO_BROADCASTER) || defined(__DOXYGEN__)
997#endif /* CONFIG_BT_ISO_BROADCASTER */
998#if defined(CONFIG_BT_ISO_SYNC_RECEIVER) || defined(__DOXYGEN__)
1003#endif /* CONFIG_BT_ISO_SYNC_RECEIVER */
1004 };
1005};
1006
1014int bt_iso_chan_get_info(const struct bt_iso_chan *chan,
1015 struct bt_iso_info *info);
1016
1031int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_info *info);
1032
1043int bt_iso_big_create(struct bt_le_ext_adv *padv, struct bt_iso_big_create_param *param,
1044 struct bt_iso_big **out_big);
1045
1052int bt_iso_big_terminate(struct bt_iso_big *big);
1053
1062int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_param *param,
1063 struct bt_iso_big **out_big);
1064
1065#ifdef __cplusplus
1066}
1067#endif
1068
1073#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: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_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:125
bt_iso_chan_type
ISO Channel Type.
Definition: iso.h:142
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:268
@ BT_ISO_FLAGS_LOST
The ISO packet was lost.
Definition: iso.h:277
@ BT_ISO_FLAGS_ERROR
The ISO packet may possibly contain errors.
Definition: iso.h:274
@ BT_ISO_FLAGS_TS
Timestamp is valid.
Definition: iso.h:284
@ BT_ISO_STATE_ENCRYPT_PENDING
Channel is pending ACL encryption before connecting.
Definition: iso.h:129
@ BT_ISO_STATE_CONNECTING
Channel in connecting state.
Definition: iso.h:131
@ BT_ISO_STATE_CONNECTED
Channel ready for upper layer traffic on it.
Definition: iso.h:133
@ BT_ISO_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: iso.h:135
@ BT_ISO_STATE_DISCONNECTED
Channel disconnected.
Definition: iso.h:127
@ BT_ISO_CHAN_TYPE_NONE
No channel type.
Definition: iso.h:143
@ BT_ISO_CHAN_TYPE_BROADCASTER
Isochronous broadcaster.
Definition: iso.h:145
@ BT_ISO_CHAN_TYPE_SYNC_RECEIVER
Synchronized receiver.
Definition: iso.h:146
@ BT_ISO_CHAN_TYPE_CONNECTED
Connected.
Definition: iso.h:144
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:669
struct bt_conn * acl
The ACL connection that is requesting authorization.
Definition: iso.h:671
uint8_t cis_id
The ID of the connected isochronous stream (CIS) on the central.
Definition: iso.h:683
uint8_t cig_id
The ID of the connected isochronous group (CIG) on the central.
Definition: iso.h:677
Broadcast Isochronous Group (BIG) creation parameters.
Definition: iso.h:423
bool encryption
Whether or not to encrypt the streams.
Definition: iso.h:462
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:425
uint32_t interval
Channel interval in us.
Definition: iso.h:438
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:432
uint8_t framing
Channel framing mode.
Definition: iso.h:459
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:476
uint16_t latency
Channel Latency in ms.
Definition: iso.h:446
uint8_t packing
Channel packing mode.
Definition: iso.h:452
Broadcast Isochronous Group (BIG) Sync Parameters.
Definition: iso.h:508
uint32_t bis_bitfield
Bitfield of the BISes to sync to.
Definition: iso.h:525
uint32_t mse
Maximum subevents.
Definition: iso.h:536
uint16_t sync_timeout
Synchronization timeout for the BIG (N * 10 MS)
Definition: iso.h:542
bool encryption
Whether or not the streams of the BIG are encrypted.
Definition: iso.h:545
uint8_t num_bis
Number channels in bis_channels.
Definition: iso.h:517
uint8_t bcode[16]
Broadcast code.
Definition: iso.h:559
struct bt_iso_chan ** bis_channels
Array of pointers to BIS channels.
Definition: iso.h:510
Broadcast Isochronous Group (BIG) information.
Definition: iso.h:563
uint8_t framing
Channel framing mode.
Definition: iso.h:601
uint8_t num_bis
Number of BISes in the BIG.
Definition: iso.h:571
uint8_t sub_evt_count
Maximum number of subevents in each isochronous event.
Definition: iso.h:574
uint8_t phy
Channel PHY.
Definition: iso.h:598
uint32_t sdu_interval
The interval, in microseconds, of periodic SDUs.
Definition: iso.h:592
uint8_t offset
Offset used for pre-transmissions.
Definition: iso.h:583
uint8_t sid
Advertiser SID.
Definition: iso.h:568
bool encryption
Whether or not the BIG is encrypted.
Definition: iso.h:604
uint8_t rep_count
The number of times a payload is transmitted in a BIS event.
Definition: iso.h:586
uint16_t max_sdu
Maximum size of an SDU, in octets.
Definition: iso.h:595
const bt_addr_le_t * addr
Address of the advertiser.
Definition: iso.h:565
uint8_t burst_number
The number of new payloads in each BIS event.
Definition: iso.h:580
uint16_t max_pdu
Maximum size, in octets, of the payload.
Definition: iso.h:589
uint16_t iso_interval
Interval between two BIG anchor point (N * 1.25 ms)
Definition: iso.h:577
ISO Broadcaster Info Structure.
Definition: iso.h:916
uint8_t phy
The transport PHY
Definition: iso.h:930
uint32_t sync_delay
The maximum time in us for all PDUs of all BIS in a BIG event.
Definition: iso.h:918
uint32_t latency
The transport latency in us.
Definition: iso.h:921
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:924
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:927
uint8_t bn
The burst number.
Definition: iso.h:933
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:936
ISO Channel IO QoS structure.
Definition: iso.h:176
uint8_t phy
Channel PHY - See BT_GAP_LE_PHY for values.
Definition: iso.h:182
uint8_t rtn
Channel Retransmission Number.
Definition: iso.h:187
struct bt_iso_chan_path * path
Channel data path reference.
Definition: iso.h:193
uint16_t sdu
Channel SDU.
Definition: iso.h:178
ISO Channel operations structure.
Definition: iso.h:608
void(* sent)(struct bt_iso_chan *chan)
Channel sent callback.
Definition: iso.h:665
void(* disconnected)(struct bt_iso_chan *chan, uint8_t reason)
Channel disconnected callback.
Definition: iso.h:631
void(* connected)(struct bt_iso_chan *chan)
Channel connected callback.
Definition: iso.h:620
void(* recv)(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info, struct net_buf *buf)
Channel recv callback.
Definition: iso.h:653
ISO Channel Data Path structure.
Definition: iso.h:248
uint8_t cc_len
Codec Configuration length.
Definition: iso.h:260
uint8_t format
Coding Format.
Definition: iso.h:252
uint8_t pid
Default path ID.
Definition: iso.h:250
uint16_t cid
Company ID.
Definition: iso.h:254
uint8_t * cc
Pointer to an array containing the Codec Configuration.
Definition: iso.h:262
uint32_t delay
Controller Delay.
Definition: iso.h:258
uint16_t vid
Vendor-defined Codec ID.
Definition: iso.h:256
ISO Channel QoS structure.
Definition: iso.h:218
struct bt_iso_chan_io_qos * tx
Channel Transmission QoS.
Definition: iso.h:234
struct bt_iso_chan_io_qos * rx
Channel Receiving QoS.
Definition: iso.h:226
ISO Channel structure.
Definition: iso.h:150
struct bt_iso_chan_ops * ops
Channel operations reference.
Definition: iso.h:154
enum bt_iso_state state
Channel state.
Definition: iso.h:158
bt_security_t required_sec_level
The required security level of the channel.
Definition: iso.h:169
struct bt_conn * iso
Channel connection reference.
Definition: iso.h:152
sys_snode_t node
Node used internally by the stack.
Definition: iso.h:172
struct bt_iso_chan_qos * qos
Channel QoS reference.
Definition: iso.h:156
Connected Isochronous Group (CIG) parameters.
Definition: iso.h:319
uint32_t p_to_c_interval
Channel interval in us for SDUs sent from Peripheral to Central.
Definition: iso.h:340
uint8_t packing
Channel packing mode.
Definition: iso.h:371
uint8_t framing
Channel framing mode.
Definition: iso.h:378
uint8_t num_cis
Number channels in cis_channels.
Definition: iso.h:328
uint8_t sca
Channel peripherals sleep clock accuracy Only for CIS.
Definition: iso.h:365
struct bt_iso_chan ** cis_channels
Array of pointers to CIS channels.
Definition: iso.h:321
uint16_t p_to_c_latency
Channel Latency in ms for SDUs sent from Peripheral to Central.
Definition: iso.h:356
uint32_t c_to_p_interval
Channel interval in us for SDUs sent from Central to Peripheral.
Definition: iso.h:334
uint16_t c_to_p_latency
Channel Latency in ms for SDUs sent from Central to Peripheral.
Definition: iso.h:348
ISO connection parameters structure.
Definition: iso.h:411
struct bt_conn * acl
The ACL connection.
Definition: iso.h:416
struct bt_iso_chan * iso_chan
The ISO channel to connect.
Definition: iso.h:413
ISO channel Info Structure.
Definition: iso.h:958
uint8_t max_subevent
The maximum number of subevents in each ISO event.
Definition: iso.h:966
struct bt_iso_unicast_info unicast
Unicast specific Info.
Definition: iso.h:990
bool can_send
True if the channel is able to send data.
Definition: iso.h:974
uint16_t iso_interval
The ISO interval (N * 1.25 ms)
Definition: iso.h:963
struct bt_iso_broadcaster_info broadcaster
Broadcaster specific Info.
Definition: iso.h:996
bool can_recv
True if the channel is able to recv data.
Definition: iso.h:982
struct bt_iso_sync_receiver_info sync_receiver
Sync receiver specific Info.
Definition: iso.h:1002
enum bt_iso_chan_type type
Channel Type.
Definition: iso.h:960
ISO Meta Data structure for received ISO packets.
Definition: iso.h:288
uint8_t flags
ISO packet flags bitfield (BT_ISO_FLAGS_*)
Definition: iso.h:299
uint32_t ts
ISO timestamp.
Definition: iso.h:293
uint16_t seq_num
ISO packet sequence number of the first fragment in the SDU.
Definition: iso.h:296
ISO Server structure.
Definition: iso.h:687
bt_security_t sec_level
Required minimum security level.
Definition: iso.h:692
int(* accept)(const struct bt_iso_accept_info *info, struct bt_iso_chan **chan)
Server accept callback.
Definition: iso.h:705
ISO Synchronized Receiver Info Structure.
Definition: iso.h:940
uint32_t latency
The transport latency in us.
Definition: iso.h:942
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:948
uint8_t irc
Number of times a payload is transmitted in a BIS event.
Definition: iso.h:954
uint32_t pto
Pre-transmission offset (N * 1.25 ms)
Definition: iso.h:945
uint8_t bn
The burst number.
Definition: iso.h:951
ISO Meta Data structure for transmitted ISO packets.
Definition: iso.h:303
uint32_t offset
Time offset, in microseconds.
Definition: iso.h:308
uint16_t seq_num
Packet sequence number.
Definition: iso.h:311
uint32_t ts
CIG reference point or BIG anchor point of a transmitted SDU, in microseconds.
Definition: iso.h:305
ISO Unicast Info Structure.
Definition: iso.h:901
uint32_t cig_sync_delay
The maximum time in us for all PDUs of all CIS in a CIG event.
Definition: iso.h:903
struct bt_iso_unicast_tx_info peripheral
TX information for the peripheral to central data.
Definition: iso.h:912
struct bt_iso_unicast_tx_info central
TX information for the central to peripheral data path.
Definition: iso.h:909
uint32_t cis_sync_delay
The maximum time in us for all PDUs of this CIS in a CIG event.
Definition: iso.h:906
ISO Unicast TX Info Structure.
Definition: iso.h:883
uint32_t latency
The transport latency in us.
Definition: iso.h:885
uint8_t phy
The transport PHY
Definition: iso.h:894
uint32_t flush_timeout
The flush timeout (N * 1.25 ms)
Definition: iso.h:888
uint8_t bn
The burst number.
Definition: iso.h:897
uint16_t max_pdu
The maximum PDU size in octets.
Definition: iso.h:891
Network buffer representation.
Definition: buf.h:1004