tools/genmodule: Fix error in tests/clib/execl; should also fix gcc
[AROS.git] / rom / timer / timervblank.c
blob683f9babff0ee9094e81b20fddc6001036a2f595
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_UFH4(static ULONG, VBlankInt,
13 AROS_UFHA(ULONG, dummy, A0),
14 AROS_UFHA(struct TimerBase *, TimerBase, A1),
15 AROS_UFHA(ULONG, dummy2, A5),
16 AROS_UFHA(struct ExecBase *, SysBase, A6))
18 AROS_USERFUNC_INIT
20 /* UpdateEClock and process VBlank timer*/
21 EClockUpdate(TimerBase);
22 handleVBlank(TimerBase, SysBase);
24 /* exec should continue with other servers */
25 return 0;
27 AROS_USERFUNC_EXIT
30 int vblank_Init(struct TimerBase *LIBBASE)
32 LIBBASE->tb_VBlankInt.is_Node.ln_Pri = 0;
33 LIBBASE->tb_VBlankInt.is_Node.ln_Type = NT_INTERRUPT;
34 LIBBASE->tb_VBlankInt.is_Node.ln_Name = LIBBASE->tb_Device.dd_Library.lib_Node.ln_Name;
35 LIBBASE->tb_VBlankInt.is_Code = (APTR)VBlankInt;
36 LIBBASE->tb_VBlankInt.is_Data = LIBBASE;
38 AddIntServer(INTB_VERTB, &LIBBASE->tb_VBlankInt);
39 return TRUE; /* We can't fail */
43 * We intentionally don't ADD2INITLIB() here because some architectures may
44 * want to use VBlank interrupt conditionally.
47 static int vblank_Expunge(struct TimerBase *base)
49 /* ln_Succ will ne non-empty if this Node was added to a list */
50 if (base->tb_VBlankInt.is_Node.ln_Succ)
51 RemIntServer(INTB_VERTB, &base->tb_VBlankInt);
53 return TRUE;
56 ADD2EXPUNGELIB(vblank_Expunge, 0)
58 #endif