PCem

view src/timer.h @ 123:fdffe4113922

Fixed PIT timer reads.
author TomW
date Thu Jul 10 21:32:49 2014 +0100
parents 912e602b3406
children
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() \
20 do \
21 { \
22 int diff = timer_start - cycles; \
23 timer_count -= diff; \
24 timer_start = cycles; \
25 timer_process(); \
26 timer_update_outstanding(); \
27 } while (0)
29 void timer_process();
30 void timer_update_outstanding();
31 void timer_reset();
32 int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv);
33 void timer_set_callback(int timer, void (*callback)(void *priv));
35 #define TIMER_ALWAYS_ENABLED &timer_one
37 extern int timer_count;
38 extern int timer_one;
40 #define TIMER_SHIFT 6
42 extern int TIMER_USEC;