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 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 typedef volatile struct { 22 struct { 23 uint32_t timer_cnt[SOC_TIMER_CHAN_NUM_PER_GROUP]; 24 25 union { 26 struct { 27 uint32_t timer0_en: 1; /**< bit[0] */ 28 uint32_t timer1_en: 1; /**< bit[1] */ 29 uint32_t timer2_en: 1; /**< bit[2] */ 30 uint32_t clk_div: 4; /**< bit[3:6] */ 31 uint32_t timer0_int_en: 1; /**< bit[7] */ 32 uint32_t timer1_int_en: 1; /**< bit[8] */ 33 uint32_t timer2_int_en: 1; /**< bit[9] */ 34 }; 35 uint32_t v; 36 } ctrl; 37 38 union { 39 struct { 40 uint32_t timer_cnt_read: 1; /**< bit[0] software write 1, HW clear it after finish read */ 41 uint32_t reserved0: 1; /**< bit[1] */ 42 uint32_t timer_index: 2; /**< bit[2:3] timer index for read */ 43 uint32_t reserved1: 28; /**< bit[4:31] */ 44 }; 45 uint32_t v; 46 } read_ctrl; 47 48 uint32_t timer_read_value; /**< It is valid just when timer_cnt_read is cleared to 0 */ 49 50 uint32_t reserved[0x3FC000 - 0x5 - 1]; 51 } group[SOC_TIMER_GROUP_NUM]; 52 } timer_hw_t; 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58