Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lc3.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2020 Intel Corporation
7 * Copyright (c) 2022 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_LC3_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_LC3_H_
13
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
34/* COND_CODE_1 is used to omit an LTV entry in case the _frames_per_sdu is 1.
35 * COND_CODE_1 will evaluate to second argument if the flag parameter(first argument) is 1
36 * - removing one layer of paranteses.
37 * If the flags argument is != 1 it will evaluate to the third argument which inserts a LTV
38 * entry for the max_frames_per_sdu value.
39 */
40
41#define BT_AUDIO_CODEC_CAP_LC3_DATA(_freq, _duration, _chan_count, _len_min, _len_max, \
42 _max_frames_per_sdu) \
43 { \
44 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CAP_TYPE_FREQ, BT_BYTES_LIST_LE16(_freq)), \
45 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CAP_TYPE_DURATION, (_duration)), \
46 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT, (_chan_count)), \
47 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN, \
48 BT_BYTES_LIST_LE16(_len_min), \
49 BT_BYTES_LIST_LE16(_len_max)), \
50 COND_CODE_1(_max_frames_per_sdu, (), \
51 (BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT, \
52 (_max_frames_per_sdu)))) \
53 }
54
58#define BT_AUDIO_CODEC_CAP_LC3_META(_prefer_context) \
59 { \
60 BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_PREF_CONTEXT, \
61 BT_BYTES_LIST_LE16(_prefer_context)) \
62 }
63
76#define BT_AUDIO_CODEC_CAP_LC3(_freq, _duration, _chan_count, _len_min, _len_max, \
77 _max_frames_per_sdu, _prefer_context) \
78 BT_AUDIO_CODEC_CAP(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, \
79 BT_AUDIO_CODEC_CAP_LC3_DATA(_freq, _duration, _chan_count, _len_min, \
80 _len_max, _max_frames_per_sdu), \
81 BT_AUDIO_CODEC_CAP_LC3_META(_prefer_context))
82
93#define BT_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, _len, _frames_per_sdu) \
94 { \
95 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_FREQ, (_freq)), \
96 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_DURATION, (_duration)), \
97 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_CHAN_ALLOC, BT_BYTES_LIST_LE32(_loc)), \
98 BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_FRAME_LEN, BT_BYTES_LIST_LE16(_len)), \
99 COND_CODE_1(_frames_per_sdu, (), \
100 (BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU, \
101 (_frames_per_sdu)))) \
102 }
103
107#define BT_AUDIO_CODEC_CFG_LC3_META(_stream_context) \
108 { \
109 BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT, \
110 BT_BYTES_LIST_LE16(_stream_context)) \
111 }
112
123#define BT_AUDIO_CODEC_LC3_CONFIG(_freq, _duration, _loc, _len, _frames_per_sdu, _stream_context) \
124 BT_AUDIO_CODEC_CFG( \
125 BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, \
126 BT_AUDIO_CODEC_CFG_LC3_DATA(_freq, _duration, _loc, _len, _frames_per_sdu), \
127 BT_AUDIO_CODEC_CFG_LC3_META(_stream_context))
128
129#ifdef __cplusplus
130}
131#endif
132
137#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_LC3_H_ */
Bluetooth byteorder API.
Macro utilities.