11bd4fe43Sopenharmony_ci/**
21bd4fe43Sopenharmony_ci * @file hi_systick.h
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
101bd4fe43Sopenharmony_ci *
111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
151bd4fe43Sopenharmony_ci * limitations under the License.
161bd4fe43Sopenharmony_ci */
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci/**
191bd4fe43Sopenharmony_ci * @defgroup systick System Tick Status
201bd4fe43Sopenharmony_ci * @ingroup drivers
211bd4fe43Sopenharmony_ci */
221bd4fe43Sopenharmony_ci#ifndef __HI_SYSTICK_H__
231bd4fe43Sopenharmony_ci#define __HI_SYSTICK_H__
241bd4fe43Sopenharmony_ci#include <hi_types_base.h>
251bd4fe43Sopenharmony_ci
261bd4fe43Sopenharmony_ci/**
271bd4fe43Sopenharmony_ci* @ingroup  systick
281bd4fe43Sopenharmony_ci* @brief  Obtains systick currect value. CNcomment:获取systick当前计数值。CNend
291bd4fe43Sopenharmony_ci*
301bd4fe43Sopenharmony_ci* @par 描述:
311bd4fe43Sopenharmony_ci* @li   Obtains the current count value of systick. The time of each value is determined by the systick clock source.
321bd4fe43Sopenharmony_ci*       The systick clock is 32Khz, and the tick value is 1/32000 seconds.CNcomment:获取systick当前计数值。
331bd4fe43Sopenharmony_ci每个值的时间由systick时钟源决定。systick时钟为32Khz,一个tick值为1/32000秒。CNend
341bd4fe43Sopenharmony_ci* $li   After the system is powered on, systick immediately adds a count from 0.CNcomment:系统上电运行后,
351bd4fe43Sopenharmony_cisystick立刻从0开始递增加一计数。CNend
361bd4fe43Sopenharmony_ci*
371bd4fe43Sopenharmony_ci* @attention The delay interface is invoked in the interface. Therefore, it is prohibited to invoke this interface in
381bd4fe43Sopenharmony_ci*            the interrupt context.CNcomment:接口内调用了延时接口,所以禁止在中断上下文中调用该接口。CNend
391bd4fe43Sopenharmony_ci* @param  None
401bd4fe43Sopenharmony_ci*
411bd4fe43Sopenharmony_ci* @retval #hi_u64 Indicates the obtained current count value.CNcomment:获取到的当前计数值。CNend
421bd4fe43Sopenharmony_ci*
431bd4fe43Sopenharmony_ci* @par 依赖:
441bd4fe43Sopenharmony_ci*           @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend
451bd4fe43Sopenharmony_ci* @see  hi_systick_clear。
461bd4fe43Sopenharmony_ci*/
471bd4fe43Sopenharmony_cihi_u64 hi_systick_get_cur_tick(hi_void);
481bd4fe43Sopenharmony_ci
491bd4fe43Sopenharmony_ci/**
501bd4fe43Sopenharmony_ci* @ingroup  systick
511bd4fe43Sopenharmony_ci* @brief  The value of systick is cleared.CNcomment:将systick计数值清零。CNend
521bd4fe43Sopenharmony_ci*
531bd4fe43Sopenharmony_ci* @par 描述:
541bd4fe43Sopenharmony_ci*         The value of systick is cleared.CNcomment:将systick计数值清零。CNend
551bd4fe43Sopenharmony_ci*
561bd4fe43Sopenharmony_ci* @attention After the interface is returned, the clock cycles of three systick clocks need to be cleared.
571bd4fe43Sopenharmony_ciCNcomment:接口返回后需要等三个systick的时钟周期才会完成清零。CNend
581bd4fe43Sopenharmony_ci* @param  None
591bd4fe43Sopenharmony_ci*
601bd4fe43Sopenharmony_ci* @retval None
611bd4fe43Sopenharmony_ci* @par 依赖:
621bd4fe43Sopenharmony_ci*           @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend
631bd4fe43Sopenharmony_ci* @see  hi_systick_get_cur_tick。
641bd4fe43Sopenharmony_ci*/
651bd4fe43Sopenharmony_cihi_void hi_systick_clear(hi_void);
661bd4fe43Sopenharmony_ci
671bd4fe43Sopenharmony_ci/**
681bd4fe43Sopenharmony_ci* @ingroup  systick
691bd4fe43Sopenharmony_ci* @brief Get the millisecond value counted by systick. CNcomment:获取以systick计数的毫秒值。CNend
701bd4fe43Sopenharmony_ci*
711bd4fe43Sopenharmony_ci* @par 描述:
721bd4fe43Sopenharmony_ci* @li   Calculate the current millisecond value according to the current value of systick and the actual frequency of
731bd4fe43Sopenharmony_ci32K.CNcomment:根据systick的当前值与32K实际的频率计算当前的毫秒值。CNend
741bd4fe43Sopenharmony_ci*
751bd4fe43Sopenharmony_ci* @attention The delay interface is invoked in the interface. Therefore, it is prohibited to invoke this interface in
761bd4fe43Sopenharmony_ci*            the interrupt context.CNcomment:接口内调用了延时接口,所以禁止在中断上下文中调用该接口。CNend
771bd4fe43Sopenharmony_ci* @param  None
781bd4fe43Sopenharmony_ci*
791bd4fe43Sopenharmony_ci* @retval #hi_u64 Indicates the obtained current millisecond.CNcomment:获取到的当前毫秒计数值。CNend
801bd4fe43Sopenharmony_ci*
811bd4fe43Sopenharmony_ci* @par 依赖:
821bd4fe43Sopenharmony_ci*           @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend
831bd4fe43Sopenharmony_ci* @see  hi_systick_get_cur_ms。
841bd4fe43Sopenharmony_ci*/
851bd4fe43Sopenharmony_cihi_u64 hi_systick_get_cur_ms(hi_void);
861bd4fe43Sopenharmony_ci
871bd4fe43Sopenharmony_ci/**
881bd4fe43Sopenharmony_ci* @ingroup  systick
891bd4fe43Sopenharmony_ci* @brief  Sets the real time of the system, base on systick, not effect by deep sleep.
901bd4fe43Sopenharmony_ciCNcomment:设置系统实时时间,基于systick,不受深睡影响。CNend
911bd4fe43Sopenharmony_ci*
921bd4fe43Sopenharmony_ci* @par 描述:
931bd4fe43Sopenharmony_ci*           Sets the real time of the system.CNcomment:设置系统实时时间。CNend
941bd4fe43Sopenharmony_ci*
951bd4fe43Sopenharmony_ci* @attention None
961bd4fe43Sopenharmony_ci* @param  seconds            [IN] type #hi_u32,set the real time of the system to this value.
971bd4fe43Sopenharmony_ciCNcomment:将系统实时时间设置为该值。CNend
981bd4fe43Sopenharmony_ci*
991bd4fe43Sopenharmony_ci* @retval None.
1001bd4fe43Sopenharmony_ci* @par 依赖:
1011bd4fe43Sopenharmony_ci*           @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend
1021bd4fe43Sopenharmony_ci*/
1031bd4fe43Sopenharmony_cihi_void hi_systick_set_real_time(hi_u32 sec);
1041bd4fe43Sopenharmony_ci
1051bd4fe43Sopenharmony_ci/**
1061bd4fe43Sopenharmony_ci* @ingroup  systick
1071bd4fe43Sopenharmony_ci* @brief  Obtains the real time of the system, base on systick, not effect by deep sleep
1081bd4fe43Sopenharmony_ciCNcomment:获取系统实时时间(单位:s),基于systick,不受深睡影响。CNend
1091bd4fe43Sopenharmony_ci*
1101bd4fe43Sopenharmony_ci* @par 描述:
1111bd4fe43Sopenharmony_ci*           Obtains the real time of the system (unit: s).CNcomment:获取系统实时时间(单位:s)。CNend
1121bd4fe43Sopenharmony_ci*
1131bd4fe43Sopenharmony_ci* @attention None
1141bd4fe43Sopenharmony_ci* @param None
1151bd4fe43Sopenharmony_ci*
1161bd4fe43Sopenharmony_ci* @retval #hi_u32 Real time of the system.CNcomment: 系统实时时间。CNend
1171bd4fe43Sopenharmony_ci* @par 依赖:
1181bd4fe43Sopenharmony_ci*           @li hi_systick.h:Describes systick APIs.CNcomment:文件用于描述SYSTICK相关接口。CNend
1191bd4fe43Sopenharmony_ci*/
1201bd4fe43Sopenharmony_cihi_u32 hi_systick_get_real_time(hi_void);
1211bd4fe43Sopenharmony_ci
1221bd4fe43Sopenharmony_ci#endif
123