another polish locale.
[AROS.git] / rom / timer / timer_intern.h
blob82cdd9c340a61e891d5ac1250fe36fcdcecd323e
1 #ifndef _TIMER_INTERN_H
2 #define _TIMER_INTERN_H
4 /*
5 Copyright © 1995-2018, 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 <aros/config.h>
14 #include <exec/execbase.h>
15 #include <exec/lists.h>
16 #include <exec/interrupts.h>
17 #include <exec/io.h>
18 #include <exec/devices.h>
19 #include <exec/interrupts.h>
20 #include <devices/timer.h>
21 #include <dos/bptr.h>
22 #include <hardware/intbits.h>
23 #include <aros/asmcall.h>
25 /* Platform-specific portion */
26 #include <timer_platform.h>
28 #if defined(__AROSEXEC_SMP__)
29 #include <aros/types/spinlock_s.h>
30 #endif
33 * First two of these correspond to UNIT_MICROHZ and UNIT_VBLANK.
34 * This is important.
36 #define TL_MICROHZ 0
37 #define TL_VBLANK 1
38 #define TL_WAITVBL 2
39 #define NUM_LISTS 3
41 struct TimerBase
43 /* Required by the system */
44 struct Device tb_Device; /* Our base */
45 APTR tb_KernelBase; /* kernel.resource base */
47 /* Time counters */
48 struct timeval tb_CurrentTime; /* Absolute system time. Can be set by TR_SETSYSTIME. */
49 struct timeval tb_Elapsed; /* Relative system time. Used for measuring intervals. */
51 /* This is required for hardware-specific code */
52 APTR tb_TimerIRQHandle; /* Timer IRQ handle */
53 struct Interrupt tb_VBlankInt; /* Used by older implementations, needs to be removed */
54 struct Interrupt tb_ResetHandler; /* Stops interrupt generation before a reboot */
56 /* Request queues */
57 struct MinList tb_Lists[NUM_LISTS];
59 /* EClock counter */
60 UQUAD tb_ticks_total; /* Effective EClock value */
61 ULONG tb_ticks_sec; /* Fraction of second for CurrentTime in ticks */
62 ULONG tb_ticks_elapsed; /* Fraction of second for Elapsed in ticks */
63 ULONG tb_prev_tick; /* Hardware-specific */
64 ULONG tb_eclock_rate; /* EClock frequency */
66 #ifdef USE_VBLANK_EMU
67 struct timerequest tb_vblank_timerequest; /* VBlank emulation request */
68 #endif
70 struct PlatformTimer tb_Platform; /* Platform-specific data */
71 #if defined(__AROSEXEC_SMP__)
72 void *tb_ExecLockBase;
73 void *tb_ListLock;
74 #endif
77 #define GetTimerBase(tb) ((struct TimerBase *)(tb))
78 #define GetDevice(tb) ((struct Device *)(tb))
80 BOOL common_BeginIO(struct timerequest *timereq, struct TimerBase *TimerBase);
81 void TimerProcessMicroHZ(struct TimerBase *TimerBase, struct ExecBase *SysBase, BOOL locked);
82 void TimerProcessVBlank(struct TimerBase *TimerBase, struct ExecBase *SysBase, BOOL locked);
83 #define handleMicroHZ(x,y) TimerProcessMicroHZ(x,y,FALSE)
84 #define handleVBlank(x,y) TimerProcessVBlank(x,y,FALSE)
85 void EClockUpdate(struct TimerBase *TimerBase);
86 void EClockSet(struct TimerBase *TimerBase);
88 /* Call exec VBlank vector, if present */
89 static inline void vblank_Cause(struct ExecBase *SysBase)
91 struct IntVector *iv = &SysBase->IntVects[INTB_VERTB];
93 if (iv->iv_Code)
94 AROS_INTC2(iv->iv_Code, iv->iv_Data, INTF_VERTB);
97 #endif /* _TIMER_INTERN_H */