Line data Source code
1 1 : /**
2 : * @file
3 : * @brief Header for Bluetooth GMAP LC3 presets.
4 : *
5 : * Copyright (c) 2023-2024 Nordic Semiconductor ASA
6 : *
7 : * SPDX-License-Identifier: Apache-2.0
8 : */
9 :
10 : #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_LC3_PRESET_
11 : #define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_LC3_PRESET_
12 :
13 : /**
14 : * @brief Gaming Audio Profile (GMAP) LC3 Presets
15 : *
16 : * @defgroup bt_gmap_lc3_preset Gaming Audio Profile (GMAP) LC3 Presets
17 : *
18 : * @since 3.5
19 : * @version 0.8.0
20 : *
21 : * @ingroup bluetooth
22 : * @{
23 : *
24 : * These APIs provide presets for codec configuration and QoS based on values supplied by the
25 : * codec configurations from table 3.16 in the GMAP v1.0 specification
26 : */
27 :
28 : #include <zephyr/bluetooth/audio/audio.h>
29 : #include <zephyr/bluetooth/audio/bap_lc3_preset.h>
30 : #include <zephyr/bluetooth/audio/lc3.h>
31 :
32 : #ifdef __cplusplus
33 : extern "C" {
34 : #endif
35 :
36 : /**
37 : * @brief Helper to declare LC3 32_1_gr codec configuration
38 : *
39 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
40 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
41 : */
42 1 : #define BT_GMAP_LC3_PRESET_32_1_GR(_loc, _stream_context) \
43 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \
44 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \
45 : _stream_context), \
46 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 60U, 1U, 15U, 10000U))
47 :
48 : /**
49 : * @brief Helper to declare LC3 32_2_gr codec configuration
50 : *
51 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
52 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
53 : */
54 1 : #define BT_GMAP_LC3_PRESET_32_2_GR(_loc, _stream_context) \
55 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \
56 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \
57 : _stream_context), \
58 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 80U, 1U, 20U, 10000U))
59 :
60 : /**
61 : * @brief Helper to declare LC3 48_1_gr codec configuration
62 : *
63 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
64 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
65 : */
66 1 : #define BT_GMAP_LC3_PRESET_48_1_GR(_loc, _stream_context) \
67 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
68 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \
69 : _stream_context), \
70 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 15U, 10000U))
71 :
72 : /**
73 : * @brief Helper to declare LC3 48_2_gr codec configuration
74 : *
75 : * Mandatory to support as both unicast client and server
76 : *
77 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
78 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
79 : */
80 1 : #define BT_GMAP_LC3_PRESET_48_2_GR(_loc, _stream_context) \
81 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
82 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \
83 : _stream_context), \
84 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 20U, 10000U))
85 :
86 : /**
87 : * @brief Helper to declare LC3 48_3_gr codec configuration
88 : *
89 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
90 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
91 : */
92 1 : #define BT_GMAP_LC3_PRESET_48_3_GR(_loc, _stream_context) \
93 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
94 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \
95 : _stream_context), \
96 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 90U, 1U, 15U, 10000U))
97 :
98 : /**
99 : * @brief Helper to declare LC3 48_4_gr codec configuration
100 : *
101 : * Mandatory to support as unicast server
102 : *
103 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
104 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
105 : */
106 1 : #define BT_GMAP_LC3_PRESET_48_4_GR(_loc, _stream_context) \
107 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
108 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \
109 : _stream_context), \
110 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 120U, 1U, 20U, 10000U))
111 :
112 : /**
113 : * @brief Helper to declare LC3 16_1_gs codec configuration
114 : *
115 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
116 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
117 : */
118 1 : #define BT_GMAP_LC3_PRESET_16_1_GS(_loc, _stream_context) \
119 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \
120 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \
121 : _stream_context), \
122 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 30U, 1U, 15U, 60000U))
123 :
124 : /**
125 : * @brief Helper to declare LC3 16_2_gs codec configuration
126 : *
127 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
128 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
129 : */
130 1 : #define BT_GMAP_LC3_PRESET_16_2_GS(_loc, _stream_context) \
131 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \
132 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \
133 : _stream_context), \
134 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 40U, 1U, 20U, 60000U))
135 :
136 : /**
137 : * @brief Helper to declare LC3 32_1_gs codec configuration
138 : *
139 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
140 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
141 : */
142 1 : #define BT_GMAP_LC3_PRESET_32_1_GS(_loc, _stream_context) \
143 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \
144 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \
145 : _stream_context), \
146 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 60U, 1U, 15U, 60000U))
147 :
148 : /**
149 : * @brief Helper to declare LC3 32_2_gs codec configuration
150 : *
151 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
152 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
153 : */
154 1 : #define BT_GMAP_LC3_PRESET_32_2_GS(_loc, _stream_context) \
155 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \
156 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \
157 : _stream_context), \
158 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 80U, 1U, 20U, 60000U))
159 :
160 : /**
161 : * @brief Helper to declare LC3 48_1_gs codec configuration
162 : *
163 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
164 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
165 : */
166 1 : #define BT_GMAP_LC3_PRESET_48_1_GS(_loc, _stream_context) \
167 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
168 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \
169 : _stream_context), \
170 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 15U, 60000U))
171 :
172 : /**
173 : * @brief Helper to declare LC3 48_2_gs codec configuration
174 : *
175 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
176 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
177 : */
178 1 : #define BT_GMAP_LC3_PRESET_48_2_GS(_loc, _stream_context) \
179 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
180 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \
181 : _stream_context), \
182 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 20U, 60000U))
183 :
184 : /* GMAP LC3 broadcast presets defined by table 3.22 in the GMAP v1.0 specification */
185 :
186 : /**
187 : * @brief Helper to declare LC3 48_1_g codec configuration
188 : *
189 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
190 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
191 : */
192 1 : #define BT_GMAP_LC3_PRESET_48_1_G(_loc, _stream_context) \
193 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
194 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \
195 : _stream_context), \
196 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 8U, 10000U))
197 :
198 : /**
199 : * @brief Helper to declare LC3 48_2_g codec configuration
200 : *
201 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
202 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
203 : */
204 1 : #define BT_GMAP_LC3_PRESET_48_2_G(_loc, _stream_context) \
205 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
206 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \
207 : _stream_context), \
208 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 10U, 10000U))
209 :
210 : /**
211 : * @brief Helper to declare LC3 48_3_g codec configuration
212 : *
213 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
214 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
215 : */
216 1 : #define BT_GMAP_LC3_PRESET_48_3_G(_loc, _stream_context) \
217 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
218 : BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \
219 : _stream_context), \
220 : BT_BAP_QOS_CFG_UNFRAMED(7500u, 90U, 1U, 8U, 10000U))
221 :
222 : /**
223 : * @brief Helper to declare LC3 48_4_g codec configuration
224 : *
225 : * @param _loc Audio channel location bitfield (@ref bt_audio_location)
226 : * @param _stream_context Stream context (``BT_AUDIO_CONTEXT_*``)
227 : */
228 1 : #define BT_GMAP_LC3_PRESET_48_4_G(_loc, _stream_context) \
229 : BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \
230 : BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \
231 : _stream_context), \
232 : BT_BAP_QOS_CFG_UNFRAMED(10000u, 120U, 1U, 10U, 10000U))
233 :
234 : #ifdef __cplusplus
235 : }
236 : #endif
237 : /** @} */
238 :
239 : #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_GMAP_LC3_PRESET_ */
|