1 /* 2 * Copyright (C) 2017-2020 Alibaba Group Holding Limited 3 */ 4 5 /****************************************************************************** 6 * @file tick.h 7 * @brief Header File for TICK Driver 8 * @version V1.0 9 * @date 28. Sep 2020 10 ******************************************************************************/ 11 12 #ifndef _DRV_TICK_H_ 13 #define _DRV_TICK_H_ 14 15 #include <stdint.h> 16 #include <stdint.h> 17 #include <drv/common.h> 18 19 #ifndef CONFIG_SYSTICK_HZ 20 #define CONFIG_SYSTICK_HZ 100U 21 #endif 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 \brief Initializes the resources needed for the TICK interface 29 \return error code \ref csi_error_t 30 */ 31 csi_error_t csi_tick_init(void); 32 33 /** 34 \brief De-initialize TICK Interface 35 */ 36 void csi_tick_uninit(void); 37 38 /** 39 \brief Get the sys-tick, one tick == (1000 / CONFIG_SYSTICK_HZ) ms 40 \return the sys-tick 41 */ 42 uint32_t csi_tick_get(void); 43 44 /** 45 \brief Get the time which start from csi_tick_init 46 \return The time which start from csi_tick_init (ms) 47 */ 48 uint32_t csi_tick_get_ms(void); 49 50 /** 51 \brief Get the time which start from csi_tick_init 52 \return The time which start from csi_tick_init (us) 53 */ 54 uint64_t csi_tick_get_us(void); 55 56 /** 57 \brief Increase the sys-tick 58 */ 59 void csi_tick_increase(void); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif /*_DRV_TICK_H_*/ 66