xref: /haiku/headers/private/kernel/int.h (revision 32b8ee2e940cad78263723c8fd52062db2478dea)
1 /*
2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #ifndef _KERNEL_INT_H
6 #define _KERNEL_INT_H
7 
8 #include <stage2.h>
9 #include <arch/int.h>
10 #include <KernelExport.h>
11 
12 /**
13  * @defgroup kernelint Interrupts
14  * @ingroup OpenBeOS_Kernel
15  * @brief Interrupts for the kernel and device drivers
16  * @{
17  */
18 
19 /**
20  * @defgroup Intreturns Interrupt Handler return codes
21  * @ingroup kernelint
22  * @{
23  */
24 /** @def B_UNHANDLED_INTERRUPT interrupt wasn't handled by this handler */
25 /** @def B_HANDLED_INTERRUPT the handler handled the interrupt */
26 /** @def B_INVOKE_SCHEDULER the handler handled the interrupt and wants the
27  *  scheduler invoked
28  */
29 #define B_UNHANDLED_INTERRUPT		0
30 #define B_HANDLED_INTERRUPT			1
31 #define B_INVOKE_SCHEDULER			2
32 /** @} */
33 
34 /** @def B_NO_ENABLE_COUNTER add the handler but don't change whether or
35  * not the interrupt is currently enabled
36  */
37 #define B_NO_ENABLE_COUNTER         1
38 
39 int  int_init(kernel_args *ka);
40 int  int_init2(kernel_args *ka);
41 int  int_io_interrupt_handler(int vector);
42 long install_interrupt_handler(long, interrupt_handler,	void *);
43 long remove_interrupt_handler (long, interrupt_handler,	void *);
44 
45 #define enable_interrupts		  arch_int_enable_interrupts
46 #define are_interrupts_enabled    arch_int_is_interrupts_enabled
47 
48 /** @fn long install_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data, ulong flags);
49  *
50  * @note This function is used for devices that can generate an "actual"
51  *       interrupt, i.e. where IRQ < 16
52  */
53 long 	install_io_interrupt_handler(long,
54                                      interrupt_handler,
55                                      void *, ulong);
56 
57 /** @fn long remove_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data);
58  *
59  * @note This function is used for devices that can generate an "actual"
60  *       interrupt, i.e. where IRQ < 16
61  */
62 long 	remove_io_interrupt_handler (long,
63                                      interrupt_handler,
64                                      void *);
65 
66 /** @} */
67 
68 #endif /* _KERNEL_INT_H */
69