• 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 #include "hal_config.h"
16 #include "timer_hw.h"
17 #include "timer_hal.h"
18 #include "timer_ll.h"
19 
20 #if CFG_HAL_DEBUG_TIMER
21 
timer_struct_dump(void)22 void timer_struct_dump(void)
23 {
24     timer_hw_t *hw = (timer_hw_t *)TIMER_LL_REG_BASE(0);
25     SOC_LOGI("base=%x\r\n", (uint32_t)hw);
26 
27     for (int group = 0; group < SOC_TIMER_GROUP_NUM; group++) {
28         SOC_LOGI("group(%x)\r\n", group);
29         for (int chan = 0; chan < SOC_TIMER_CHAN_NUM_PER_GROUP; chan++) {
30             SOC_LOGI("  timer%x_val addr=%x value=%x\r\n", chan, &hw->group[group].timer_cnt[chan], hw->group[group].timer_cnt[chan]);
31         }
32 
33         SOC_LOGI("\n");
34         SOC_LOGI("  ctrl addr=%x value=%x\n", &hw->group[group].ctrl, hw->group[group].ctrl.v);
35         SOC_LOGI("    timer0_en:  %x\n", hw->group[group].ctrl.timer0_en);
36         SOC_LOGI("    timer1_en:  %x\n", hw->group[group].ctrl.timer1_en);
37         SOC_LOGI("    timer2_en:  %x\n", hw->group[group].ctrl.timer2_en);
38         SOC_LOGI("    clk_div:    %x\n", hw->group[group].ctrl.clk_div);
39         SOC_LOGI("    timer0_int: %x\n", hw->group[group].ctrl.timer0_int_en);
40         SOC_LOGI("    timer1_int: %x\n", hw->group[group].ctrl.timer1_int_en);
41         SOC_LOGI("    timer2_int: %x\n", hw->group[group].ctrl.timer2_int_en);
42 
43         SOC_LOGI("\n");
44         SOC_LOGI("  read_ctrl addr=%x value=%x\n", &hw->group[group].read_ctrl, hw->group[group].read_ctrl.v);
45         SOC_LOGI("    timer_cnt_read: %x\n", hw->group[group].read_ctrl.timer_cnt_read);
46         SOC_LOGI("    timer_index:    %x\n", hw->group[group].read_ctrl.timer_index);
47 
48         SOC_LOGI("\n");
49         SOC_LOGI("  timer_cnt addr=%x value=%x\n", &hw->group[group].timer_read_value, hw->group[group].timer_read_value);
50         SOC_LOGI("\n");
51     }
52 }
53 
54 #endif
55