Added 'Resident' field to ensure that the handler is included in the
[AROS.git] / rom / timer / timervblank.c
blobb24863c70a24511edb7d973854a0e8b06c5f2552
1 #include <aros/asmcall.h>
2 #include <hardware/intbits.h>
3 #include <proto/exec.h>
5 #include <timer_intern.h>
6 #include "timervblank.h"
8 /* Define this in timer_platform.h in order to make use of this code */
9 #ifdef USE_VBLANK_INT
11 /* exec.library VBlank interrupt handler */
12 AROS_INTH1(VBlankInt, struct TimerBase *, TimerBase)
14 AROS_INTFUNC_INIT
16 /* UpdateEClock and process VBlank timer*/
17 EClockUpdate(TimerBase);
18 handleVBlank(TimerBase, SysBase);
20 /* exec should continue with other servers */
21 return 0;
23 AROS_INTFUNC_EXIT
26 int vblank_Init(struct TimerBase *LIBBASE)
28 LIBBASE->tb_VBlankInt.is_Node.ln_Pri = 0;
29 LIBBASE->tb_VBlankInt.is_Node.ln_Type = NT_INTERRUPT;
30 LIBBASE->tb_VBlankInt.is_Node.ln_Name = LIBBASE->tb_Device.dd_Library.lib_Node.ln_Name;
31 LIBBASE->tb_VBlankInt.is_Code = (VOID_FUNC)VBlankInt;
32 LIBBASE->tb_VBlankInt.is_Data = LIBBASE;
34 AddIntServer(INTB_VERTB, &LIBBASE->tb_VBlankInt);
35 return TRUE; /* We can't fail */
39 * We intentionally don't ADD2INITLIB() here because some architectures may
40 * want to use VBlank interrupt conditionally.
43 static int vblank_Expunge(struct TimerBase *base)
45 /* ln_Succ will ne non-empty if this Node was added to a list */
46 if (base->tb_VBlankInt.is_Node.ln_Succ)
47 RemIntServer(INTB_VERTB, &base->tb_VBlankInt);
49 return TRUE;
52 ADD2EXPUNGELIB(vblank_Expunge, 0)
54 #endif