1/** 2 * @file hi_systick.h 3 * 4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18/** 19 * @defgroup systick System Tick Status 20 * @ingroup drivers 21 */ 22#ifndef __HI_SYSTICK_H__ 23#define __HI_SYSTICK_H__ 24#include <hi_types_base.h> 25 26/** 27* @ingroup systick 28* @brief Obtains systick currect value. CNcomment:获取systick当前计数值。CNend 29* 30* @par 描述: 31* @li Obtains the current count value of systick. The time of each value is determined by the systick clock source. 32* The systick clock is 32Khz, and the tick value is 1/32000 seconds.CNcomment:获取systick当前计数值。 33每个值的时间由systick时钟源决定。systick时钟为32Khz,一个tick值为1/32000秒。CNend 34* $li After the system is powered on, systick immediately adds a count from 0.CNcomment:系统上电运行后, 35systick立刻从0开始递增加一计数。CNend 36* 37* @attention The delay interface is invoked in the interface. Therefore, it is prohibited to invoke this interface in 38* the interrupt context.CNcomment:接口内调用了延时接口,所以禁止在中断上下文中调用该接口。CNend 39* @param None 40* 41* @retval #hi_u64 Indicates the obtained current count value.CNcomment:获取到的当前计数值。CNend 42* 43* @par 依赖: 44* @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend 45* @see hi_systick_clear。 46*/ 47hi_u64 hi_systick_get_cur_tick(hi_void); 48 49/** 50* @ingroup systick 51* @brief The value of systick is cleared.CNcomment:将systick计数值清零。CNend 52* 53* @par 描述: 54* The value of systick is cleared.CNcomment:将systick计数值清零。CNend 55* 56* @attention After the interface is returned, the clock cycles of three systick clocks need to be cleared. 57CNcomment:接口返回后需要等三个systick的时钟周期才会完成清零。CNend 58* @param None 59* 60* @retval None 61* @par 依赖: 62* @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend 63* @see hi_systick_get_cur_tick。 64*/ 65hi_void hi_systick_clear(hi_void); 66 67/** 68* @ingroup systick 69* @brief Get the millisecond value counted by systick. CNcomment:获取以systick计数的毫秒值。CNend 70* 71* @par 描述: 72* @li Calculate the current millisecond value according to the current value of systick and the actual frequency of 7332K.CNcomment:根据systick的当前值与32K实际的频率计算当前的毫秒值。CNend 74* 75* @attention The delay interface is invoked in the interface. Therefore, it is prohibited to invoke this interface in 76* the interrupt context.CNcomment:接口内调用了延时接口,所以禁止在中断上下文中调用该接口。CNend 77* @param None 78* 79* @retval #hi_u64 Indicates the obtained current millisecond.CNcomment:获取到的当前毫秒计数值。CNend 80* 81* @par 依赖: 82* @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend 83* @see hi_systick_get_cur_ms。 84*/ 85hi_u64 hi_systick_get_cur_ms(hi_void); 86 87/** 88* @ingroup systick 89* @brief Sets the real time of the system, base on systick, not effect by deep sleep. 90CNcomment:设置系统实时时间,基于systick,不受深睡影响。CNend 91* 92* @par 描述: 93* Sets the real time of the system.CNcomment:设置系统实时时间。CNend 94* 95* @attention None 96* @param seconds [IN] type #hi_u32,set the real time of the system to this value. 97CNcomment:将系统实时时间设置为该值。CNend 98* 99* @retval None. 100* @par 依赖: 101* @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend 102*/ 103hi_void hi_systick_set_real_time(hi_u32 sec); 104 105/** 106* @ingroup systick 107* @brief Obtains the real time of the system, base on systick, not effect by deep sleep 108CNcomment:获取系统实时时间(单位:s),基于systick,不受深睡影响。CNend 109* 110* @par 描述: 111* Obtains the real time of the system (unit: s).CNcomment:获取系统实时时间(单位:s)。CNend 112* 113* @attention None 114* @param None 115* 116* @retval #hi_u32 Real time of the system.CNcomment: 系统实时时间。CNend 117* @par 依赖: 118* @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend 119*/ 120hi_u32 hi_systick_get_real_time(hi_void); 121 122#endif 123