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 #define TIMER_CLOCK_FREQ_26M 26000 22 #define TIMER_CLOCK_FREQ_32K 32 23 24 typedef enum { 25 TIMER_SCLK_CLK32 = 0, /**< TIMER source clock dco */ 26 TIMER_SCLK_XTAL, /**< TIMER source clock xtal 26M */ 27 } timer_src_clk_t; 28 29 typedef enum 30 { 31 SYS_SEL_TIMER0 = 0, 32 SYS_SEL_TIMER1, 33 } sys_sel_timer_t; 34 35 /** 36 * @brief Timer APIs 37 * @addtogroup bk_api_timer_defs Timer API group 38 * @{ 39 */ 40 41 typedef uint8_t timer_unit_t; /**< Timer uint id */ 42 43 typedef enum { 44 TIMER_ID0 = 0, /**< TIMER id 0 */ 45 TIMER_ID1, /**< TIMER id 1 */ 46 TIMER_ID2, /**< TIMER id 2 */ 47 TIMER_ID3, /**< TIMER id 3 */ 48 TIMER_ID4, /**< TIMER id 4 */ 49 TIMER_ID5, /**< TIMER id 5 */ 50 TIMER_ID_MAX /**< TIMER id max */ 51 } timer_id_t; 52 53 typedef enum{ 54 TIMER_UNIT_MS = 0, /**< TIMER unit type is ms */ 55 TIMER_UNIT_US /**< TIMER unit type is us */ 56 } timer_value_unit_t; 57 58 /** 59 * @} 60 */ 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66