2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include "lowlevel_intern.h"
11 #include <aros/libcall.h>
12 #include <exec/types.h>
13 #include <libraries/lowlevel.h>
14 #include <hardware/intbits.h>
16 /*****************************************************************************
20 AROS_LH2(APTR
, AddVBlankInt
,
23 AROS_LHA(APTR
, intRoutine
, A0
),
24 AROS_LHA(APTR
, intData
, A1
),
27 struct LowLevelBase
*, LowLevelBase
, 18, LowLevel
)
31 Add a callback function that should be executed every vertical blank.
32 If your program can exit without rebooting the machine, RemVBlankInt()
33 has to be called prior to exiting.
34 Only one interrupt routine may be added; always check the return
35 value of this function in case some other program already has used this
40 intRoutine -- the callback function to invoke each vertical blank
41 intData -- data passed to the callback function
45 A handle used to manipulate the interrupt or NULL if the call failed.
55 *****************************************************************************/
61 if (intRoutine
== NULL
)
66 ObtainSemaphore(&LowLevelBase
->ll_Lock
);
68 if (LowLevelBase
->ll_VBlank
.is_Code
== NULL
)
70 LowLevelBase
->ll_VBlank
.is_Code
= intRoutine
;
71 LowLevelBase
->ll_VBlank
.is_Data
= intData
;
73 AddIntServer(INTB_VERTB
, &LowLevelBase
->ll_VBlank
);
74 result
= (APTR
)&LowLevelBase
->ll_VBlank
;
81 ReleaseSemaphore(&LowLevelBase
->ll_Lock
);