11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_ 
   12#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_AUDIO_H_ 
   34#define BT_AUDIO_BROADCAST_ID_SIZE               3  
   36#define BT_AUDIO_BROADCAST_ID_MAX                0xFFFFFFU 
   38#define BT_AUDIO_PD_PREF_NONE                    0x000000U 
   40#define BT_AUDIO_PD_MAX                          0xFFFFFFU 
   42#define BT_AUDIO_BROADCAST_CODE_SIZE             16 
   67#define BT_AUDIO_CONTEXT_TYPE_ANY        (BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED | \ 
   68                                          BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | \ 
   69                                          BT_AUDIO_CONTEXT_TYPE_MEDIA | \ 
   70                                          BT_AUDIO_CONTEXT_TYPE_GAME | \ 
   71                                          BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL | \ 
   72                                          BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS | \ 
   73                                          BT_AUDIO_CONTEXT_TYPE_LIVE | \ 
   74                                          BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS | \ 
   75                                          BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS | \ 
   76                                          BT_AUDIO_CONTEXT_TYPE_RINGTONE | \ 
   77                                          BT_AUDIO_CONTEXT_TYPE_ALERTS | \ 
   78                                          BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM) 
  177#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL    0x00 
  178#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED   0x01 
  196#define BT_CODEC_DATA(_type, _bytes...) \ 
  198                .data = BT_DATA(_type, ((uint8_t []) { _bytes }), \ 
  199                                sizeof((uint8_t []) { _bytes })) \ 
  211#define BT_CODEC(_id, _cid, _vid, _data, _meta) \ 
  214                .path_id = BT_ISO_DATA_PATH_HCI, \ 
  218                .data_count = ARRAY_SIZE(((struct bt_codec_data[]) _data)), \ 
  220                .meta_count = ARRAY_SIZE(((struct bt_codec_data[]) _meta)), \ 
  263#define BT_AUDIO_LOCATION_ANY (BT_AUDIO_LOCATION_FRONT_LEFT | \ 
  264                               BT_AUDIO_LOCATION_FRONT_RIGHT | \ 
  265                               BT_AUDIO_LOCATION_FRONT_CENTER | \ 
  266                               BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 | \ 
  267                               BT_AUDIO_LOCATION_BACK_LEFT | \ 
  268                               BT_AUDIO_LOCATION_BACK_RIGHT | \ 
  269                               BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER | \ 
  270                               BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER | \ 
  271                               BT_AUDIO_LOCATION_BACK_CENTER | \ 
  272                               BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 | \ 
  273                               BT_AUDIO_LOCATION_SIDE_LEFT | \ 
  274                               BT_AUDIO_LOCATION_SIDE_RIGHT | \ 
  275                               BT_AUDIO_LOCATION_TOP_FRONT_LEFT | \ 
  276                               BT_AUDIO_LOCATION_TOP_FRONT_RIGHT | \ 
  277                               BT_AUDIO_LOCATION_TOP_FRONT_CENTER | \ 
  278                               BT_AUDIO_LOCATION_TOP_CENTER | \ 
  279                               BT_AUDIO_LOCATION_TOP_BACK_LEFT | \ 
  280                               BT_AUDIO_LOCATION_TOP_BACK_RIGHT | \ 
  281                               BT_AUDIO_LOCATION_TOP_SIDE_LEFT | \ 
  282                               BT_AUDIO_LOCATION_TOP_SIDE_RIGHT | \ 
  283                               BT_AUDIO_LOCATION_TOP_BACK_CENTER | \ 
  284                               BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER | \ 
  285                               BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT | \ 
  286                               BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT | \ 
  287                               BT_AUDIO_LOCATION_FRONT_LEFT_WIDE | \ 
  288                               BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE | \ 
  289                               BT_AUDIO_LOCATION_LEFT_SURROUND | \ 
  290                               BT_AUDIO_LOCATION_RIGHT_SURROUND) 
  306#if defined(CONFIG_BT_CODEC_MAX_DATA_COUNT) 
  312#if defined(CONFIG_BT_CODEC_MAX_METADATA_COUNT) 
  316        struct bt_codec_data meta[CONFIG_BT_CODEC_MAX_METADATA_COUNT];
 
  337#define BT_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, \ 
  340                .interval = _interval, \ 
  341                .framing = _framing, \ 
  345                .latency = _latency, \ 
  371#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \ 
  372        BT_CODEC_QOS(_interval, BT_CODEC_QOS_UNFRAMED, BT_CODEC_QOS_2M, _sdu, \ 
  384#define BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \ 
  385        BT_CODEC_QOS(_interval, BT_CODEC_QOS_FRAMED, BT_CODEC_QOS_2M, _sdu, \ 
  402#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || defined(CONFIG_BT_BAP_UNICAST) 
  433#define BT_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, \ 
  434                          _pd_max, _pref_pd_min, _pref_pd_max) \ 
  436                .unframed_supported = _unframed_supported, \ 
  439                .latency = _latency, \ 
  442                .pref_pd_min = _pref_pd_min, \ 
  443                .pref_pd_max = _pref_pd_max, \ 
  511                                   uint8_t *buf, 
size_t buf_size);
 
Bluetooth data buffer API.
 
ZTEST_BMEM int count
Definition: main.c:33
 
Bluetooth connection handling.
 
Generic Attribute Profile handling.
 
bt_audio_codec_parse_err
Codec parser error codes for Codec config parsing APIs.
Definition: audio.h:525
 
int bt_codec_cfg_get_octets_per_frame(const struct bt_codec *codec)
Extract frame size in octets from BT codec config.
 
int bt_codec_cfg_get_frame_blocks_per_sdu(const struct bt_codec *codec, bool fallback_to_default)
Extract number of audio frame blockss in each SDU from BT codec config.
 
bool bt_codec_get_val(const struct bt_codec *codec, uint8_t type, const struct bt_codec_data **data)
Lookup a specific value based on type.
 
int bt_codec_cfg_get_freq(const struct bt_codec *codec)
Extract the frequency from a codec configuration.
 
int bt_codec_cfg_get_chan_allocation_val(const struct bt_codec *codec, enum bt_audio_location *chan_allocation)
Extract channel allocation from BT codec config.
 
int bt_codec_cfg_get_frame_duration_us(const struct bt_codec *codec)
Extract frame duration from BT codec config.
 
@ BT_AUDIO_CODEC_PARSE_ERR_SUCCESS
The requested type is not present in the data set.
Definition: audio.h:528
 
@ BT_AUDIO_CODEC_PARSE_ERR_TYPE_NOT_FOUND
The requested type is not present in the data set.
Definition: audio.h:531
 
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_VALUE_FOUND
The value found is invalid.
Definition: audio.h:534
 
@ BT_AUDIO_CODEC_PARSE_ERR_INVALID_PARAM
The parameters specified to the function call are not valid.
Definition: audio.h:537
 
bt_audio_active_state
Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com).
Definition: audio.h:106
 
bt_audio_dir
Audio Capability type.
Definition: audio.h:321
 
bt_audio_location
Location values for BT Audio.
Definition: audio.h:228
 
bt_audio_parental_rating
Parental rating defined by the Generic Audio assigned numbers (bluetooth.com).
Definition: audio.h:86
 
#define BT_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Framed bt_codec_qos.
Definition: audio.h:384
 
#define BT_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd)
Helper to declare Input Unframed bt_codec_qos.
Definition: audio.h:371
 
bt_audio_metadata_type
Codec metadata type IDs.
Definition: audio.h:116
 
ssize_t bt_audio_codec_data_to_buf(const struct bt_codec_data *codec_data, size_t count, uint8_t *buf, size_t buf_size)
Turns an array of bt_codec_data to a flat LTV encoded uint8_t array.
 
bt_audio_context
Audio Context Type for Generic Audio.
Definition: audio.h:48
 
@ BT_AUDIO_ACTIVE_STATE_ENABLED
Definition: audio.h:108
 
@ BT_AUDIO_ACTIVE_STATE_DISABLED
Definition: audio.h:107
 
@ BT_CODEC_QOS_2M
Definition: audio.h:358
 
@ BT_CODEC_QOS_CODED
Definition: audio.h:359
 
@ BT_CODEC_QOS_1M
Definition: audio.h:357
 
@ BT_AUDIO_DIR_SINK
Definition: audio.h:322
 
@ BT_AUDIO_DIR_SOURCE
Definition: audio.h:323
 
@ BT_AUDIO_LOCATION_FRONT_CENTER
Definition: audio.h:232
 
@ BT_AUDIO_LOCATION_TOP_BACK_LEFT
Definition: audio.h:246
 
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2
Definition: audio.h:239
 
@ BT_AUDIO_LOCATION_TOP_SIDE_RIGHT
Definition: audio.h:249
 
@ BT_AUDIO_LOCATION_FRONT_RIGHT
Definition: audio.h:231
 
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT
Definition: audio.h:253
 
@ BT_AUDIO_LOCATION_BACK_RIGHT
Definition: audio.h:235
 
@ BT_AUDIO_LOCATION_TOP_CENTER
Definition: audio.h:245
 
@ BT_AUDIO_LOCATION_LEFT_SURROUND
Definition: audio.h:256
 
@ BT_AUDIO_LOCATION_TOP_FRONT_RIGHT
Definition: audio.h:243
 
@ BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER
Definition: audio.h:237
 
@ BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE
Definition: audio.h:255
 
@ BT_AUDIO_LOCATION_TOP_BACK_RIGHT
Definition: audio.h:247
 
@ BT_AUDIO_LOCATION_BACK_LEFT
Definition: audio.h:234
 
@ BT_AUDIO_LOCATION_RIGHT_SURROUND
Definition: audio.h:257
 
@ BT_AUDIO_LOCATION_SIDE_RIGHT
Definition: audio.h:241
 
@ BT_AUDIO_LOCATION_TOP_FRONT_LEFT
Definition: audio.h:242
 
@ BT_AUDIO_LOCATION_SIDE_LEFT
Definition: audio.h:240
 
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT
Definition: audio.h:252
 
@ BT_AUDIO_LOCATION_TOP_FRONT_CENTER
Definition: audio.h:244
 
@ BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1
Definition: audio.h:233
 
@ BT_AUDIO_LOCATION_FRONT_LEFT
Definition: audio.h:230
 
@ BT_AUDIO_LOCATION_FRONT_LEFT_WIDE
Definition: audio.h:254
 
@ BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER
Definition: audio.h:251
 
@ BT_AUDIO_LOCATION_PROHIBITED
Definition: audio.h:229
 
@ BT_AUDIO_LOCATION_BACK_CENTER
Definition: audio.h:238
 
@ BT_AUDIO_LOCATION_TOP_SIDE_LEFT
Definition: audio.h:248
 
@ BT_AUDIO_LOCATION_TOP_BACK_CENTER
Definition: audio.h:250
 
@ BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER
Definition: audio.h:236
 
@ BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE
Definition: audio.h:102
 
@ BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE
Definition: audio.h:99
 
@ BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE
Definition: audio.h:94
 
@ BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE
Definition: audio.h:91
 
@ BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE
Definition: audio.h:100
 
@ BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE
Definition: audio.h:101
 
@ BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE
Definition: audio.h:89
 
@ BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE
Definition: audio.h:92
 
@ BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE
Definition: audio.h:97
 
@ BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE
Definition: audio.h:93
 
@ BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE
Definition: audio.h:95
 
@ BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE
Definition: audio.h:96
 
@ BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE
Definition: audio.h:90
 
@ BT_AUDIO_PARENTAL_RATING_AGE_ANY
Definition: audio.h:88
 
@ BT_AUDIO_PARENTAL_RATING_NO_RATING
Definition: audio.h:87
 
@ BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE
Definition: audio.h:98
 
@ BT_AUDIO_METADATA_TYPE_PROGRAM_INFO
Definition: audio.h:140
 
@ BT_AUDIO_METADATA_TYPE_EXTENDED
Definition: audio.h:170
 
@ BT_AUDIO_METADATA_TYPE_VENDOR
Definition: audio.h:173
 
@ BT_AUDIO_METADATA_TYPE_CCID_LIST
Definition: audio.h:149
 
@ BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE
Definition: audio.h:167
 
@ BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI
Definition: audio.h:158
 
@ BT_AUDIO_METADATA_TYPE_PARENTAL_RATING
Parental rating.
Definition: audio.h:155
 
@ BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT
Streaming audio context.
Definition: audio.h:137
 
@ BT_AUDIO_METADATA_TYPE_PREF_CONTEXT
Preferred audio context.
Definition: audio.h:126
 
@ BT_AUDIO_METADATA_TYPE_STREAM_LANG
Stream language.
Definition: audio.h:146
 
@ BT_AUDIO_METADATA_TYPE_AUDIO_STATE
Audio active state.
Definition: audio.h:164
 
@ BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS
Definition: audio.h:58
 
@ BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM
Definition: audio.h:61
 
@ BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL
Definition: audio.h:54
 
@ BT_AUDIO_CONTEXT_TYPE_PROHIBITED
Definition: audio.h:49
 
@ BT_AUDIO_CONTEXT_TYPE_RINGTONE
Definition: audio.h:59
 
@ BT_AUDIO_CONTEXT_TYPE_LIVE
Definition: audio.h:56
 
@ BT_AUDIO_CONTEXT_TYPE_MEDIA
Definition: audio.h:52
 
@ BT_AUDIO_CONTEXT_TYPE_GAME
Definition: audio.h:53
 
@ BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS
Definition: audio.h:57
 
@ BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS
Definition: audio.h:55
 
@ BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL
Definition: audio.h:51
 
@ BT_AUDIO_CONTEXT_TYPE_ALERTS
Definition: audio.h:60
 
@ BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED
Definition: audio.h:50
 
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
 
Bluetooth LC3 codec handling.
 
__SIZE_TYPE__ ssize_t
Definition: types.h:28
 
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
 
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
 
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
 
Codec configuration structure.
Definition: audio.h:181
 
struct bt_data data
Definition: audio.h:182
 
uint8_t value[CONFIG_BT_CODEC_MAX_DATA_LEN]
Definition: audio.h:183
 
Audio Stream Quality of Service Preference structure.
Definition: audio.h:447
 
bool unframed_supported
Unframed PDUs supported.
Definition: audio.h:453
 
uint32_t pd_min
Minimum Presentation Delay in microseconds.
Definition: audio.h:472
 
uint32_t pref_pd_min
Preferred minimum Presentation Delay.
Definition: audio.h:488
 
uint32_t pd_max
Maximum Presentation Delay.
Definition: audio.h:482
 
uint8_t rtn
Definition: audio.h:459
 
uint8_t phy
Definition: audio.h:456
 
uint16_t latency
Definition: audio.h:462
 
uint32_t pref_pd_max
Preferred maximum Presentation Delay.
Definition: audio.h:494
 
Codec QoS structure.
Definition: audio.h:389
 
uint8_t phy
Definition: audio.h:391
 
uint8_t framing
Definition: audio.h:394
 
uint32_t pd
QoS Presentation Delay in microseconds.
Definition: audio.h:418
 
uint32_t interval
Definition: audio.h:412
 
uint8_t rtn
Definition: audio.h:397
 
uint16_t sdu
Definition: audio.h:400
 
Codec structure.
Definition: audio.h:293
 
uint16_t cid
Definition: audio.h:303
 
uint8_t id
Definition: audio.h:301
 
uint16_t vid
Definition: audio.h:305
 
uint8_t path_id
Definition: audio.h:299
 
Bluetooth data.
Definition: bluetooth.h:433
 
static fdata_t data[2]
Definition: test_fifo_contexts.c:15