PCem

view src/timer.h @ 111:912e602b3406

Moved PIT to common timer API.
author TomW
date Thu Jun 19 21:02:59 2014 +0100
parents 9c201151bb4b
children fdffe4113922
line source
1 extern int timer_start;
3 #define timer_start_period(cycles) \
4 timer_start = cycles;
6 #define timer_end_period(cycles) \
7 do \
8 { \
9 int diff = timer_start - cycles; \
10 timer_count -= diff; \
11 timer_start = cycles; \
12 if (timer_count <= 0) \
13 { \
14 timer_process(); \
15 timer_update_outstanding(); \
16 } \
17 } while (0)
19 #define timer_clock() timer_end_period(cycles)
21 void timer_process();
22 void timer_update_outstanding();
23 void timer_reset();
24 int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv);
25 void timer_set_callback(int timer, void (*callback)(void *priv));
27 #define TIMER_ALWAYS_ENABLED &timer_one
29 extern int timer_count;
30 extern int timer_one;
32 #define TIMER_SHIFT 6
34 extern int TIMER_USEC;