• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #pragma once
17 
18 #include <components/log.h>
19 
20 #define SBC_TAG "sbc"
21 #define SBC_LOGI(...) BK_LOGI(SBC_TAG, ##__VA_ARGS__)
22 #define SBC_LOGW(...) BK_LOGW(SBC_TAG, ##__VA_ARGS__)
23 #define SBC_LOGE(...) BK_LOGE(SBC_TAG, ##__VA_ARGS__)
24 #define SBC_LOGD(...) BK_LOGD(SBC_TAG, ##__VA_ARGS__)
25 
26 /**
27  * @brief     SBC decoder memory initialize
28  *
29  * This API init the sbc decoder memory.
30  *
31  *
32  * @param
33  *    - None
34  *
35  *
36  * @return
37  *    - BK_OK: succeed
38  *    - others: other errors.
39  */
40 bk_err_t bk_sbc_decoder_mem_init(void);
41 
42 /**
43  * @brief     enable sbc decoder
44  *
45  * This API enable sbc decoder function.
46  *
47  *
48  * @param
49  *    - None
50  *
51  *
52  * @return
53  *    - BK_OK: succeed
54  *    - others: other errors.
55  */
56 bk_err_t bk_sbc_decoder_sbc_enable(void);
57 
58 /**
59  * @brief     get the sbc status to check whether is enable
60  *
61  * This API get the sbc status to check whether is enable.
62  *
63  *
64  * @param
65  *    - None
66  *
67  *
68  * @return
69  *    - BK_OK: succeed
70  *    - others: other errors.
71  */
72 bk_err_t bk_sbc_decoder_get_sbc_enable_status(void);
73 
74 /**
75  * @brief     get the configuration value of sbc decoder
76  *
77  * This API get the configuration value of sbc decoder.
78  *
79  *
80  * @param
81  *    - None
82  *
83  *
84  * @return
85  *    - BK_OK: succeed
86  *    - others: other errors.
87  */
88 bk_err_t bk_sbc_decoder_get_sbc_ctrl_value(void);
89 
90 /**
91  * @brief     clear sbc interrupt status
92  *
93  * This API clear sbc interrupt status.
94  *
95  *
96  * @param
97  *    - None
98  *
99  *
100  * @return
101  *    - BK_OK: succeed
102  *    - others: other errors.
103  */
104 bk_err_t bk_sbc_decoder_clear_interrupt_status(void);
105 
106 /**
107  * @brief     get sbc interrupt status
108  *
109  * This API get sbc interrupt status.
110  *
111  *
112  * @param
113  *    - None
114  *
115  *
116  * @return
117  *    - BK_OK: succeed
118  *    - others: other errors.
119  */
120 bk_err_t bk_sbc_decoder_get_interrupt_status(void);
121 
122 /**
123  * @brief     get the idle status of sbc decoder
124  *
125  * This API check whether the sbc is in idle status.
126  *
127  *
128  * @param
129  *    - None
130  *
131  *
132  * @return
133  *    - BK_OK: succeed
134  *    - others: other errors.
135  */
136 bk_err_t bk_sbc_decoder_get_idle_status(void);
137 
138 /**
139  * @brief     the low bit byte that SBC decoder need to resolve
140  *
141  * This API resolve the low bit byte.
142  *
143  *
144  * @param
145  *    - resl_value: the low bit value that need to resolve
146  *
147  *
148  * @return
149  *    - BK_OK: succeed
150  *    - others: other errors.
151  */
152 bk_err_t bk_sbc_decoder_set_res_bytel_value(uint32_t resl_value);
153 
154 /**
155  * @brief     the middle bit byte that SBC decoder need to resolve
156  *
157  * This API resolve the middle bit byte.
158  *
159  *
160  * @param
161  *    - resl_value: the middle bit value that need to resolve
162  *
163  *
164  * @return
165  *    - BK_OK: succeed
166  *    - others: other errors.
167  */
168 bk_err_t bk_sbc_decoder_set_res_bytem_value(uint32_t resm_value);
169 
170 /**
171  * @brief     the high bit byte that SBC decoder need to resolve
172  *
173  * This API resolve the high bit byte.
174  *
175  *
176  * @param
177  *    - resl_value: the high bit value that need to resolve
178  *
179  *
180  * @return
181  *    - BK_OK: succeed
182  *    - others: other errors.
183  */
184 bk_err_t bk_sbc_decoder_set_res_byteh_value(uint32_t resh_value);
185 
186 /**
187  * @brief     set sbc decoder bit number
188  *
189  * This API set sbc decoder bit number.
190  *
191  *
192  * @param
193  *    - bit_num: sbc decoder bit number
194  *
195  *
196  * @return
197  *    - BK_OK: succeed
198  *    - others: other errors.
199  */
200 bk_err_t bk_sbc_decoder_set_sbc_bit_num(uint32_t bit_num);
201 
202 /**
203  * @brief     set sbc decoder scale factor
204  *
205  * This API set sbc decoder scale factor.
206  *
207  *
208  * @param
209  *    - sf: sbc decoder scale factor
210  *
211  *
212  * @return
213  *    - BK_OK: succeed
214  *    - others: other errors.
215  */
216 bk_err_t bk_sbc_decoder_set_scale_factor(uint32_t sf);
217 
218 /**
219  * @brief     set sbc decoder level
220  *
221  * This API set sbc decoder level.
222  *
223  *
224  * @param
225  *    - level: sbc decoder level
226  *
227  *
228  * @return
229  *    - BK_OK: succeed
230  *    - others: other errors.
231  */
232 bk_err_t bk_sbc_decoder_set_sbc_level(uint32_t level);
233 
234 /**
235  * @brief     set sbc decoder resloved bit
236  *
237  * This API set sbc decoder resloved bit.
238  *
239  *
240  * @param
241  *    - res_bit: sbc decoder resolved bit
242  *
243  *
244  * @return
245  *    - BK_OK: succeed
246  *    - others: other errors.
247  */
248 bk_err_t bk_sbc_decoder_set_sbc_res_bit(uint32_t res_bit);
249 
250 /**
251  * @brief     start sbc decoding
252  *
253  * This API enable the sbc decoder function.
254  *
255  *
256  * @param
257  *    - None
258  *
259  *
260  * @return
261  *    - BK_OK: succeed
262  *    - others: other errors.
263  */
264 bk_err_t bk_sbc_decoder_start_decode(void);
265 
266 /**
267  * @brief     get sbc decoder status
268  *
269  * This API get sbc decoder status to check whether is decoding.
270  *
271  *
272  * @param
273  *    - sbc: sbc decoder context pointer
274  *
275  *
276  * @return
277  *    - the status of sbc decoder enable
278  */
279 uint32_t bk_sbc_decoder_get_decode_enable_value(void);
280 
281 /**
282  * @brief     get pcm data by sbc decoder
283  *
284  * This API get pcm data.
285  *
286  *
287  * @param
288  *    - None
289  *
290  *
291  * @return
292  *    - BK_OK: succeed
293  *    - others: other errors.
294  */
295 bk_err_t bk_sbc_decoder_get_pcm_data(void);
296 
297 
298