forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.h
More file actions
77 lines (59 loc) · 1.99 KB
/
timer.h
File metadata and controls
77 lines (59 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2018 Intel Corporation. All rights reserved.
*
* Author: Janusz Jankowski <janusz.jankowski@linux.intel.com>
*/
#ifndef __SOF_DRIVERS_TIMER_H__
#define __SOF_DRIVERS_TIMER_H__
#include <arch/drivers/timer.h>
#include <sof/sof.h>
#include <stdint.h>
struct comp_dev;
struct sof_ipc_stream_posn;
#define TIMER0 0
#define TIMER1 1
#define TIMER2 2
#define TIMER3 3
#define TIMER4 4
int timer_register(struct timer *timer, void (*handler)(void *arg), void *arg);
void timer_unregister(struct timer *timer, void *arg);
void timer_enable(struct timer *timer, void *arg, int core);
void timer_disable(struct timer *timer, void *arg, int core);
static inline struct timer *timer_get(void)
{
return sof_get()->platform_timer;
}
static inline struct timer *cpu_timer_get(void)
{
return sof_get()->cpu_timer;
}
static inline int64_t timer_set(struct timer *timer, uint64_t ticks)
{
return arch_timer_set(timer, ticks);
}
void timer_set_ms(struct timer *timer, unsigned int ms);
static inline void timer_clear(struct timer *timer)
{
arch_timer_clear(timer);
}
unsigned int timer_get_count(struct timer *timer);
unsigned int timer_get_count_delta(struct timer *timer);
static inline uint64_t timer_get_system(struct timer *timer)
{
return arch_timer_get_system(timer);
}
int64_t platform_timer_set(struct timer *timer, uint64_t ticks);
void platform_timer_clear(struct timer *timer);
uint64_t platform_timer_get(struct timer *timer);
void platform_timer_start(struct timer *timer);
void platform_timer_stop(struct timer *timer);
/* get timestamp for host stream DMA position */
void platform_host_timestamp(struct comp_dev *host,
struct sof_ipc_stream_posn *posn);
/* get timestamp for DAI stream DMA position */
void platform_dai_timestamp(struct comp_dev *dai,
struct sof_ipc_stream_posn *posn);
/* get current wallclock for componnent */
void platform_dai_wallclock(struct comp_dev *dai, uint64_t *wallclock);
#endif /* __SOF_DRIVERS_TIMER_H__ */