1 #ifndef _TIMER_INTERN_H
2 #define _TIMER_INTERN_H
5 Copyright © 1995-2017, 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 */
56 struct MinList tb_Lists
[NUM_LISTS
];
59 UQUAD tb_ticks_total
; /* Effective EClock value */
60 ULONG tb_ticks_sec
; /* Fraction of second for CurrentTime in ticks */
61 ULONG tb_ticks_elapsed
; /* Fraction of second for Elapsed in ticks */
62 ULONG tb_prev_tick
; /* Hardware-specific */
63 ULONG tb_eclock_rate
; /* EClock frequency */
66 struct timerequest tb_vblank_timerequest
; /* VBlank emulation request */
69 struct PlatformTimer tb_Platform
; /* Platform-specific data */
70 #if defined(__AROSEXEC_SMP__)
71 void *tb_ExecLockBase
;
76 #define GetTimerBase(tb) ((struct TimerBase *)(tb))
77 #define GetDevice(tb) ((struct Device *)(tb))
79 BOOL
common_BeginIO(struct timerequest
*timereq
, struct TimerBase
*TimerBase
);
80 void TimerProcessMicroHZ(struct TimerBase
*TimerBase
, struct ExecBase
*SysBase
, BOOL locked
);
81 void TimerProcessVBlank(struct TimerBase
*TimerBase
, struct ExecBase
*SysBase
, BOOL locked
);
82 #define handleMicroHZ(x,y) TimerProcessMicroHZ(x,y,FALSE)
83 #define handleVBlank(x,y) TimerProcessVBlank(x,y,FALSE)
84 void EClockUpdate(struct TimerBase
*TimerBase
);
85 void EClockSet(struct TimerBase
*TimerBase
);
87 /* Call exec VBlank vector, if present */
88 static inline void vblank_Cause(struct ExecBase
*SysBase
)
90 struct IntVector
*iv
= &SysBase
->IntVects
[INTB_VERTB
];
93 AROS_INTC2(iv
->iv_Code
, iv
->iv_Data
, INTF_VERTB
);
96 #endif /* _TIMER_INTERN_H */