root / qemu-timer.h @ 9b686843
History | View | Annotate | Download (1.6 kB)
1 | 87ecb68b | pbrook | #ifndef QEMU_TIMER_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define QEMU_TIMER_H
|
3 | 87ecb68b | pbrook | |
4 | 87ecb68b | pbrook | /* timers */
|
5 | 87ecb68b | pbrook | |
6 | 87ecb68b | pbrook | typedef struct QEMUClock QEMUClock; |
7 | 87ecb68b | pbrook | typedef void QEMUTimerCB(void *opaque); |
8 | 87ecb68b | pbrook | |
9 | 87ecb68b | pbrook | /* The real time clock should be used only for stuff which does not
|
10 | 87ecb68b | pbrook | change the virtual machine state, as it is run even if the virtual
|
11 | 87ecb68b | pbrook | machine is stopped. The real time clock has a frequency of 1000
|
12 | 87ecb68b | pbrook | Hz. */
|
13 | 87ecb68b | pbrook | extern QEMUClock *rt_clock;
|
14 | 87ecb68b | pbrook | |
15 | 87ecb68b | pbrook | /* The virtual clock is only run during the emulation. It is stopped
|
16 | 87ecb68b | pbrook | when the virtual machine is stopped. Virtual timers use a high
|
17 | 87ecb68b | pbrook | precision clock, usually cpu cycles (use ticks_per_sec). */
|
18 | 87ecb68b | pbrook | extern QEMUClock *vm_clock;
|
19 | 87ecb68b | pbrook | |
20 | 87ecb68b | pbrook | int64_t qemu_get_clock(QEMUClock *clock); |
21 | 87ecb68b | pbrook | |
22 | 87ecb68b | pbrook | QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
|
23 | 87ecb68b | pbrook | void qemu_free_timer(QEMUTimer *ts);
|
24 | 87ecb68b | pbrook | void qemu_del_timer(QEMUTimer *ts);
|
25 | 87ecb68b | pbrook | void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
|
26 | 87ecb68b | pbrook | int qemu_timer_pending(QEMUTimer *ts);
|
27 | 87ecb68b | pbrook | |
28 | 87ecb68b | pbrook | extern int64_t ticks_per_sec;
|
29 | 87ecb68b | pbrook | |
30 | 87ecb68b | pbrook | void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
|
31 | 87ecb68b | pbrook | void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
|
32 | 87ecb68b | pbrook | |
33 | 87ecb68b | pbrook | /* ptimer.c */
|
34 | 87ecb68b | pbrook | typedef struct ptimer_state ptimer_state; |
35 | 87ecb68b | pbrook | typedef void (*ptimer_cb)(void *opaque); |
36 | 87ecb68b | pbrook | |
37 | 87ecb68b | pbrook | ptimer_state *ptimer_init(QEMUBH *bh); |
38 | 87ecb68b | pbrook | void ptimer_set_period(ptimer_state *s, int64_t period);
|
39 | 87ecb68b | pbrook | void ptimer_set_freq(ptimer_state *s, uint32_t freq);
|
40 | 87ecb68b | pbrook | void ptimer_set_limit(ptimer_state *s, uint64_t limit, int reload); |
41 | 87ecb68b | pbrook | uint64_t ptimer_get_count(ptimer_state *s); |
42 | 87ecb68b | pbrook | void ptimer_set_count(ptimer_state *s, uint64_t count);
|
43 | 87ecb68b | pbrook | void ptimer_run(ptimer_state *s, int oneshot); |
44 | 87ecb68b | pbrook | void ptimer_stop(ptimer_state *s);
|
45 | 87ecb68b | pbrook | void qemu_put_ptimer(QEMUFile *f, ptimer_state *s);
|
46 | 87ecb68b | pbrook | void qemu_get_ptimer(QEMUFile *f, ptimer_state *s);
|
47 | 87ecb68b | pbrook | |
48 | 87ecb68b | pbrook | #endif |