X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Include%2Fvos_timer.h;fp=Include%2Fvos_timer.h;h=66a137823ab921e23eeb5d0e671c889dd1b72edd;hb=1f71b9a76eacf92b39c1ce6f782f8404a34f60a9;hp=0000000000000000000000000000000000000000;hpb=254694245736881ecfff4eb0d1503bf3f49a21be;p=scp%2Focu%2F5gnr.git diff --git a/Include/vos_timer.h b/Include/vos_timer.h new file mode 100644 index 0000000..66a1378 --- /dev/null +++ b/Include/vos_timer.h @@ -0,0 +1,87 @@ +/****************************************************************************** +############################################################################### +# Copyright (c) [2017-2020] [ICT/CAS] # +# Licensed under the ORAN Software License v1.0 (License) # +############################################################################### +******************************************************************************/ + + +#ifndef __VOS_TIMER_H__ +#define __VOS_TIMER_H__ +#include "vos_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + +/** VOS Timer 类型枚举值 */ +typedef enum +{ + VOS_TIMER_LOOP, ///< 循环执行的timer + VOS_TIMER_NO_LOOP, ///< 执行一次的timer +}VOS_TIMER_TYPE_EN; + + +/** + * 创建定时器 + * @param[in] ulModuleId 模块ID + * @param[in] msgQId 如果pfTimerFunc非空则无效;如果pfTimerFunc为NULL,则向msgQId队列发送定时器超时消息 + * @param[in] lMillSec 定时器的时间,毫秒 + * @param[in] pfTimerFunc 超时回调函数 + * @param[in] pArg 回调函数参数 + * @param[in] enType 定时器类型 + * @return 返回Timer ID,失败则返回VOS_ERROR + */ +LONG VOS_TimerCreate(ULONG ulModuleId, ULONG msgQId, LONG lMillSec, + VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType); + + +/** +* 改变定时器时间,不能在超时回调函数中调用 +* @param[in] ulModuleId 模块ID +* @param[in] ulTimerId 定时器Id +* @param[in] lMillSec 定时器的时间,毫秒 +* @return 成功返回VOS_OK,失败则返回VOS_ERROR +*/ +LONG VOS_TimerChange(ULONG ulModuleId, ULONG ulTimerId, LONG lMillSec); + + +/** +* 删除定时器 +* @param[in] ulModuleId 模块ID +* @param[in] ulTimerId 定时器Id +* @return 成功VOS_OK,失败则返回VOS_ERROR +*/ +LONG VOS_TimerDelete(ULONG ulModuleId, ULONG ulTimerId); + + +/** + * 创建微秒定时器,必须绑核 + * @param[in] ulModuleId 模块ID + * @param[in] luSec 定时器的时间,微妙 + * @param[in] pfTimerFunc 超时回调函数 + * @param[in] pArg 回调函数参数 + * @param[in] enType 定时器类型 + * @param[in] cpuNum CPU个数 + * @param[in] cpus CPU ID 数组 + * @return 返回Timer ID,失败则返回VOS_ERROR + */ +LONG VOS_usTimerCreate(ULONG ulModuleId,LONG luSec,VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType,LONG cpuNum,LONG cpus[]); + + + +/** + * 创建微秒定时器,必须绑核 + * @param[in] ulModuleId 模块ID + * @param[in] ulTimerId Timer ID + * @return 成功VOS_OK,失败则返回VOS_ERROR + */ +LONG VOS_usTimerDestroy(ULONG ulModuleId, ULONG ulTimerId); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __VOS_TIMER_H__ */