WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_timer.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved.
3 * Description: OS Abstract Layer.
4 */
5
9#ifndef __OSAL_TIMER_H__
10#define __OSAL_TIMER_H__
11
12#ifdef __cplusplus
13#if __cplusplus
14extern "C" {
15#endif
16#endif
17
18typedef struct {
19 void *timer;
20 void (*handler)(unsigned long);
21 unsigned long data; // data for handler
22 unsigned int interval; // timer timing duration, unit: ms.
24
25typedef struct {
26 long tv_sec;
27 long tv_usec;
29
30typedef struct {
31 int tm_sec;
32 int tm_min;
35 int tm_mon;
41
61int osal_timer_init(osal_timer *timer);
62
83
100int osal_timer_mod(osal_timer *timer, unsigned int interval);
101
118int osal_timer_start_on(osal_timer *timer, unsigned long delay, int cpu);
119
136int osal_timer_stop(osal_timer *timer);
137
156
172unsigned long osal_timer_get_private_data(const void *sys_data);
173
195
208unsigned long long osal_sched_clock(void);
209
222unsigned long long osal_get_jiffies(void);
223
237unsigned long osal_msecs_to_jiffies(const unsigned int m);
238
254unsigned int osal_jiffies_to_msecs(const unsigned int n);
255
268unsigned int osal_get_cycle_per_tick(void);
269
283
284
285/* Return values for the timer callback function */
286typedef enum {
287 OSAL_HRTIMER_NORESTART, /* < The timer will not be restarted. */
288 OSAL_HRTIMER_RESTART /* < The timer must be restarted. */
290
291/* hrtimer struct */
292typedef struct osal_hrtimer {
293 void *timer;
295 unsigned long interval; /* Unit ms */
297
318
334
352
353#ifdef __cplusplus
354#if __cplusplus
355}
356#endif
357#endif
358#endif /* __OSAL_TIMER_H__ */
unsigned int osal_jiffies_to_msecs(const unsigned int n)
Convert Ticks/jiffies to milliseconds.
Definition osal_timer.c:222
void osal_gettimeofday(osal_timeval *tv)
Obtaining the Current System Kernel Time.
Definition osal_timer.c:197
int osal_timer_mod(osal_timer *timer, unsigned int interval)
modify a timer's timeout.
Definition osal_timer.c:112
unsigned int osal_get_cycle_per_tick(void)
Obtain the number of cycles in one tick.
Definition osal_timer.c:227
int osal_timer_stop(osal_timer *timer)
Deactivate a timer.
Definition osal_timer.c:159
int osal_timer_start_on(osal_timer *timer, unsigned long delay, int cpu)
Start a timer on a particular CPU.
int osal_timer_destroy(osal_timer *timer)
destroy the timer.
Definition osal_timer.c:177
int osal_hrtimer_start(osal_hrtimer *hrtimer)
Start a high-resolution timer.
int osal_hrtimer_destroy(osal_hrtimer *hrtimer)
Delete an existing high-resolution timer.
unsigned long long osal_get_jiffies(void)
Obtain the number of Ticks(in liteos) or jiffies(in linux).
Definition osal_timer.c:212
int osal_timer_start(osal_timer *timer)
start a timer.
Definition osal_timer.c:144
int osal_timer_init(osal_timer *timer)
Initialize the timer.
Definition osal_timer.c:88
unsigned long osal_msecs_to_jiffies(const unsigned int m)
Convert milliseconds to Ticks/jiffies.
Definition osal_timer.c:217
int osal_hrtimer_create(osal_hrtimer *hrtimer)
Create a high-resolution timer.
int osal_timer_destroy_sync(osal_timer *timer)
deactivate a timer and wait for the handler to finish.
unsigned long long osal_sched_clock(void)
Obtain system time in nanoseconds.
Definition osal_timer.c:192
unsigned long osal_timer_get_private_data(const void *sys_data)
get_private_data by timer.
Definition osal_timer.c:83
osal_hrtimer_restart
Definition osal_timer.h:286
@ OSAL_HRTIMER_RESTART
Definition osal_timer.h:288
@ OSAL_HRTIMER_NORESTART
Definition osal_timer.h:287
Definition osal_timer.h:292
unsigned long interval
Definition osal_timer.h:295
osal_hrtimer_restart(* handler)(void *timer)
Definition osal_timer.h:294
void * timer
Definition osal_timer.h:293
Definition osal_timer.h:30
int tm_mon
Definition osal_timer.h:35
int tm_yday
Definition osal_timer.h:38
int tm_mday
Definition osal_timer.h:34
int tm_min
Definition osal_timer.h:32
int tm_hour
Definition osal_timer.h:33
int tm_year
Definition osal_timer.h:36
int tm_isdst
Definition osal_timer.h:39
int tm_wday
Definition osal_timer.h:37
int tm_sec
Definition osal_timer.h:31
Definition osal_timer.h:18
unsigned int interval
Definition osal_timer.h:22
unsigned long data
Definition osal_timer.h:21
void * timer
Definition osal_timer.h:19
Definition osal_timer.h:25
long tv_sec
Definition osal_timer.h:26
long tv_usec
Definition osal_timer.h:27