1 /******************************************************************************
3 * Copyright (c) 2020 ICT/CAS.
5 * Licensed under the O-RAN Software License, Version 1.0 (the "Software License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * https://www.o-ran.org/software
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.
17 *******************************************************************************/
21 #ifndef __VOS_TIMER_H__
22 #define __VOS_TIMER_H__
23 #include "vos_types.h"
28 #endif /* __cplusplus */
31 /** VOS Timer 类型枚举值 */
34 VOS_TIMER_LOOP, ///< 循环执行的timer
35 VOS_TIMER_NO_LOOP, ///< 执行一次的timer
41 * @param[in] ulModuleId 模块ID
42 * @param[in] msgQId 如果pfTimerFunc非空则无效;如果pfTimerFunc为NULL,则向msgQId队列发送定时器超时消息
43 * @param[in] lMillSec 定时器的时间,毫秒
44 * @param[in] pfTimerFunc 超时回调函数
45 * @param[in] pArg 回调函数参数
46 * @param[in] enType 定时器类型
47 * @return 返回Timer ID,失败则返回VOS_ERROR
49 LONG VOS_TimerCreate(ULONG ulModuleId, ULONG msgQId, LONG lMillSec,
50 VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType);
54 * 改变定时器时间,不能在超时回调函数中调用
55 * @param[in] ulModuleId 模块ID
56 * @param[in] ulTimerId 定时器Id
57 * @param[in] lMillSec 定时器的时间,毫秒
58 * @return 成功返回VOS_OK,失败则返回VOS_ERROR
60 LONG VOS_TimerChange(ULONG ulModuleId, ULONG ulTimerId, LONG lMillSec);
65 * @param[in] ulModuleId 模块ID
66 * @param[in] ulTimerId 定时器Id
67 * @return 成功VOS_OK,失败则返回VOS_ERROR
69 LONG VOS_TimerDelete(ULONG ulModuleId, ULONG ulTimerId);
74 * @param[in] ulModuleId 模块ID
75 * @param[in] luSec 定时器的时间,微妙
76 * @param[in] pfTimerFunc 超时回调函数
77 * @param[in] pArg 回调函数参数
78 * @param[in] enType 定时器类型
79 * @param[in] cpuNum CPU个数
80 * @param[in] cpus CPU ID 数组
81 * @return 返回Timer ID,失败则返回VOS_ERROR
83 LONG VOS_usTimerCreate(ULONG ulModuleId,LONG luSec,VOID (*pfTimerFunc)(VOID *), VOID *pArg, VOS_TIMER_TYPE_EN enType,LONG cpuNum,LONG cpus[]);
89 * @param[in] ulModuleId 模块ID
90 * @param[in] ulTimerId Timer ID
91 * @return 成功VOS_OK,失败则返回VOS_ERROR
93 LONG VOS_usTimerDestroy(ULONG ulModuleId, ULONG ulTimerId);
98 #endif /* __cplusplus */
99 #endif /* __VOS_TIMER_H__ */