XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
swt.h
浏览该文件的文档.
1
13#ifndef __xwos_osal_swt_h__
14#define __xwos_osal_swt_h__
15
16#include <xwos/standard.h>
17#include <xwos/osal/jack/swt.h>
18
73struct xwos_swt {
74 struct xwosdl_swt osswt;
75};
76
80typedef void (* xwos_swt_f)(struct xwos_swt * /*swt*/, void * /*arg*/);
81
85typedef struct {
86 struct xwos_swt * swt;
89
93#define XWOS_SWT_NILD ((xwos_swt_d){NULL, 0,})
94
98#define XWOS_SWT_FLAG_NULL XWOSDL_SWT_FLAG_NULL
99
103#define XWOS_SWT_FLAG_RESTART XWOSDL_SWT_FLAG_RESTART
104
117{
118 return xwosdl_swt_init(&swt->osswt, flag);
119}
120
132{
133 return xwosdl_swt_fini(&swt->osswt);
134}
135
155{
156 return xwosdl_swt_grab(&swt->osswt);
157}
158
174{
175 return xwosdl_swt_put(&swt->osswt);
176}
177
188{
189 return xwosdl_swt_create((xwosdl_swt_d *)swtd, flag);
190}
191
201{
202 return xwosdl_swt_delete(&swtd.swt->osswt, swtd.tik);
203}
204
221{
222 return xwosdl_swt_acquire(&swtd.swt->osswt, swtd.tik);
223}
224
238{
239 return xwosdl_swt_release(&swtd.swt->osswt, swtd.tik);
240}
241
251{
252 return xwosdl_swt_get_tik(&swt->osswt);
253}
254
264{
265 xwos_swt_d swtd;
266
267 swtd.swt = swt;
268 swtd.tik = xwosdl_swt_get_tik(&swt->osswt);
269 return swtd;
270}
271
284xwer_t xwos_swt_start(struct xwos_swt * swt, xwtm_t origin, xwtm_t period,
285 xwos_swt_f callback, void * arg)
286{
287 return xwosdl_swt_start(&swt->osswt, origin, period,
288 // cppcheck-suppress [misra-c2012-11.1]
289 (xwosdl_swt_f)callback,
290 arg);
291}
292
302{
303 return xwosdl_swt_stop(&swt->osswt);
304}
305
310#endif /* xwos/osal/swt.h */
#define __xwos_inline_api
Definition compiler.h:179
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
signed long xwer_t
Definition type.h:554
unsigned long xwsq_t
Definition type.h:445
static xwer_t xwos_swt_put(struct xwos_swt *swt)
XWOS API:减少软件定时器对象的引用计数
Definition swt.h:173
static xwer_t xwos_swt_acquire(xwos_swt_d swtd)
XWOS API:检查软件定时器对象的标签并增加引用计数
Definition swt.h:220
static xwsq_t xwos_swt_get_tik(struct xwos_swt *swt)
XWOS API:获取软件定时器对象的标签
Definition swt.h:250
static xwos_swt_d xwos_swt_get_d(struct xwos_swt *swt)
XWOS API:获取软件定时器对象描述符
Definition swt.h:263
static xwer_t xwos_swt_start(struct xwos_swt *swt, xwtm_t origin, xwtm_t period, xwos_swt_f callback, void *arg)
XWOS API:启动软件定时器
Definition swt.h:284
static xwer_t xwos_swt_stop(struct xwos_swt *swt)
XWOS API:停止软件定时器
Definition swt.h:301
static xwer_t xwos_swt_release(xwos_swt_d swtd)
XWOS API:检查对象的标签并减少引用计数
Definition swt.h:237
static xwer_t xwos_swt_delete(xwos_swt_d swtd)
XWOS API:删除动态方式创建的软件定时器
Definition swt.h:200
static xwer_t xwos_swt_create(xwos_swt_d *swtd, xwsq_t flag)
XWOS API:动态方式创建软件定时器
Definition swt.h:187
static xwer_t xwos_swt_init(struct xwos_swt *swt, xwsq_t flag)
XWOS API:静态方式初始化软件定时器
Definition swt.h:116
static xwer_t xwos_swt_fini(struct xwos_swt *swt)
XWOS API:销毁静态方式初始化的软件定时器
Definition swt.h:131
void(* xwos_swt_f)(struct xwos_swt *, void *)
XWOS API:软件定时器回调函数指针类型
Definition swt.h:80
static xwer_t xwos_swt_grab(struct xwos_swt *swt)
XWOS API:增加软件定时器对象的引用计数
Definition swt.h:154
操作系统抽象层:软件定时器接口描述
XWOS API:软件定时器对象描述符
Definition swt.h:85
xwsq_t tik
Definition swt.h:87
struct xwos_swt * swt
Definition swt.h:86
XWOS API:软件定时器
Definition swt.h:73
struct xwmp_swt osswt
Definition swt.h:74
XWOS的标准头文件