Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / lowlevel / addvblankint.c
blob57433d975b2e3b6a09aabed7a98ba0762fdce500
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
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 /*****************************************************************************
18 NAME */
20 AROS_LH2(APTR, AddVBlankInt,
22 /* SYNOPSIS */
23 AROS_LHA(APTR, intRoutine, A0),
24 AROS_LHA(APTR, intData, A1),
26 /* LOCATION */
27 struct LowLevelBase *, LowLevelBase, 23, LowLevel)
29 /* FUNCTION
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
36 function.
38 INPUTS
40 intRoutine -- the callback function to invoke each vertical blank
41 intData -- data passed to the callback function
43 RESULT
45 A handle used to manipulate the interrupt or NULL if the call failed.
47 BUGS
49 SEE ALSO
51 RemVBlankInt()
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 APTR result;
63 if (intRoutine == NULL)
65 return NULL;
68 ObtainSemaphore(&LowLevelBase->ll_Lock);
70 if (LowLevelBase->ll_VBlank.is_Code == NULL)
72 LowLevelBase->ll_VBlank.is_Code = intRoutine;
73 LowLevelBase->ll_VBlank.is_Data = intData;
75 AddIntServer(INTB_VERTB, &LowLevelBase->ll_VBlank);
76 result = (APTR)&LowLevelBase->ll_VBlank;
78 else
80 result = NULL;
83 ReleaseSemaphore(&LowLevelBase->ll_Lock);
85 return result;
87 AROS_LIBFUNC_EXIT
88 } /* AddVBlankInt */