grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / timer / timer_intern.h
blobe8bc2fda3906a35a244f4125630bee655e5ac2ae
1 #ifndef _TIMER_INTERN_H
2 #define _TIMER_INTERN_H
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Internal information about the timer.device and HIDD's
9 Lang: english
12 #include <exec/execbase.h>
13 #include <exec/lists.h>
14 #include <exec/interrupts.h>
15 #include <exec/io.h>
16 #include <exec/devices.h>
17 #include <exec/interrupts.h>
18 #include <devices/timer.h>
19 #include <dos/bptr.h>
20 #include <hardware/intbits.h>
21 #include <aros/asmcall.h>
23 /* Platform-specific portion */
24 #include <timer_platform.h>
27 * First two of these correspond to UNIT_MICROHZ and UNIT_VBLANK.
28 * This is important.
30 #define TL_MICROHZ 0
31 #define TL_VBLANK 1
32 #define TL_WAITVBL 2
33 #define NUM_LISTS 3
35 struct TimerBase
37 /* Required by the system */
38 struct Device tb_Device; /* Our base */
39 APTR tb_KernelBase; /* kernel.resource base */
41 /* Time counters */
42 struct timeval tb_CurrentTime; /* Absolute system time. Can be set by TR_SETSYSTIME. */
43 struct timeval tb_Elapsed; /* Relative system time. Used for measuring intervals. */
45 /* This is required for hardware-specific code */
46 APTR tb_TimerIRQHandle; /* Timer IRQ handle */
47 struct Interrupt tb_VBlankInt; /* Used by older implementations, needs to be removed */
49 /* Request queues */
50 struct MinList tb_Lists[NUM_LISTS];
52 /* EClock counter */
53 UQUAD tb_ticks_total; /* Effective EClock value */
54 ULONG tb_ticks_sec; /* Fraction of second for CurrentTime in ticks */
55 ULONG tb_ticks_elapsed; /* Fraction of second for Elapsed in ticks */
56 ULONG tb_prev_tick; /* Hardware-specific */
57 ULONG tb_eclock_rate; /* EClock frequency */
59 #ifdef USE_VBLANK_EMU
60 struct timerequest tb_vblank_timerequest; /* VBlank emulation request */
61 #endif
63 struct PlatformTimer tb_Platform; /* Platform-specific data */
66 #define GetTimerBase(tb) ((struct TimerBase *)(tb))
67 #define GetDevice(tb) ((struct Device *)(tb))
69 BOOL common_BeginIO(struct timerequest *timereq, struct TimerBase *TimerBase);
70 void handleMicroHZ(struct TimerBase *TimerBase, struct ExecBase *SysBase);
71 void handleVBlank(struct TimerBase *TimerBase, struct ExecBase *SysBase);
72 void EClockUpdate(struct TimerBase *TimerBase);
73 void EClockSet(struct TimerBase *TimerBase);
75 /* Call exec VBlank vector, if present */
76 static inline void vblank_Cause(struct ExecBase *SysBase)
78 struct IntVector *iv = &SysBase->IntVects[INTB_VERTB];
80 if (iv->iv_Code)
81 AROS_INTC2(iv->iv_Code, iv->iv_Data, INTF_VERTB);
84 #endif /* _TIMER_INTERN_H */