1 #ifndef _TIMER_INTERN_H
2 #define _TIMER_INTERN_H
5 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
8 Desc: Internal information about the timer.device and HIDD's
12 #include <aros/config.h>
14 #include <exec/execbase.h>
15 #include <exec/lists.h>
16 #include <exec/interrupts.h>
18 #include <exec/devices.h>
19 #include <exec/interrupts.h>
20 #include <devices/timer.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>
33 * First two of these correspond to UNIT_MICROHZ and UNIT_VBLANK.
43 /* Required by the system */
44 struct Device tb_Device
; /* Our base */
45 APTR tb_KernelBase
; /* kernel.resource base */
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 */
57 struct MinList tb_Lists
[NUM_LISTS
];
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 */
67 struct timerequest tb_vblank_timerequest
; /* VBlank emulation request */
70 struct PlatformTimer tb_Platform
; /* Platform-specific data */
71 #if defined(__AROSEXEC_SMP__)
72 void *tb_ExecLockBase
;
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
];
94 AROS_INTC2(iv
->iv_Code
, iv
->iv_Data
, INTF_VERTB
);
97 #endif /* _TIMER_INTERN_H */