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 #include <os/mem.h>
16 #include "adc_hw.h"
17 #include "adc_statis.h"
18
19
20 #if CONFIG_ADC_STATIS
21
22 #define TAG "adc_statis"
23
24 static adc_statis_t s_adc_statis = {0};
25
adc_statis_init(void)26 bk_err_t adc_statis_init(void)
27 {
28 os_memset(&s_adc_statis, 0, sizeof(s_adc_statis));
29 return BK_OK;
30 }
31
32
adc_statis_get_statis(void)33 adc_statis_t* adc_statis_get_statis(void)
34 {
35 return &(s_adc_statis);
36 }
37
adc_statis_dump(void)38 void adc_statis_dump(void)
39 {
40 BK_LOGI(TAG, "dump adc statis:\r\n");
41 BK_LOGI(TAG, "adc_isr_cnt: %d\r\n", s_adc_statis.adc_isr_cnt);
42 BK_LOGI(TAG, "adc_rx_total_cnt: %d\r\n", s_adc_statis.adc_rx_total_cnt);
43 BK_LOGI(TAG, "adc_rx_succ_cnt: %d\r\n", s_adc_statis.adc_rx_succ_cnt);
44 BK_LOGI(TAG, "adc_rx_drop_cnt: %d\r\n", s_adc_statis.adc_rx_drop_cnt);
45 }
46
47 #endif
48