1 /*
2  * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 
8 #include "btc/btc_task.h"
9 #include "osi/thread.h"
10 
11 #if BTC_DYNAMIC_MEMORY == FALSE
12 void *btc_profile_cb_tab[BTC_PID_NUM] = {};
13 #else
14 void **btc_profile_cb_tab;
15 #endif
16 
esp_profile_cb_reset(void)17 void esp_profile_cb_reset(void)
18 {
19     int i;
20 
21     for (i = 0; i < BTC_PID_NUM; i++) {
22         btc_profile_cb_tab[i] = NULL;
23     }
24 }
25 
btc_profile_cb_set(btc_pid_t profile_id,void * cb)26 int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
27 {
28     if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
29         return -1;
30     }
31 
32     btc_profile_cb_tab[profile_id] = cb;
33 
34     return 0;
35 }
36 
btc_profile_cb_get(btc_pid_t profile_id)37 void *btc_profile_cb_get(btc_pid_t profile_id)
38 {
39     if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
40         return NULL;
41     }
42 
43     return btc_profile_cb_tab[profile_id];
44 }
45