1 /* 2 File Name : yc_systick.h 3 Author : Yichip 4 Version : V1.0 5 Date : 2018/03/27 6 Description : systick encapsulation. 7 */ 8 9 #ifndef __YC_SYSTICK_H__ 10 #define __YC_SYSTICK_H__ 11 #include "../core/yc3121.h" 12 13 #define SYSTICK_SYSCLOCK 1 14 #define SYSTICK_HALF_SYSCLOCK 0 15 16 #define IS_RELOAD_VALUE(x) (x>0&&x<=0xffffff) 17 18 typedef int32_t tick; 19 #define TICK_MAX_VALUE (int32_t)0x7FFFFFFF 20 21 22 void Systick_Dealy_Ms(uint32_t MS); 23 24 /** 25 * @brief Initialize systick and start systick 26 * 27 * @param ReloadValue : the systick reload value 28 * 29 * @retval 0:succeed 1:error 30 */ 31 uint32_t SysTick_Config(uint32_t ReloadValue); 32 33 34 /** 35 * @brief get the current value of SystickCount(SystickCount plus one for every overflow interrupt) 36 * 37 * @param none 38 * 39 * @retval current value of SystickCount 40 */ 41 tick SysTick_GetTick(void); 42 43 /** 44 * @brief Determine whether the timeout that millisecond. 45 * 46 * @param start_tick:start tick 47 * 48 * @param interval:time interval(ms) 49 * 50 * @retval TRUE is timeout ,FALSE is not timeout 51 */ 52 Boolean SysTick_IsTimeOut(tick start_tick,int interval); 53 54 55 /** 56 * @brief get relative time . 57 * 58 * @param start_tick:start tick(start time) 59 * 60 * @retval the relative time(millisecond) 61 */ 62 uint32_t SysTick_GetRelativeTime(tick start_tick); 63 64 #endif /* __YC_SYSTICK_H__ */ 65