xref: /haiku/headers/private/kernel/int.h (revision 229ad83bf822e945bc4bf81979cead51463652ba)
152a38012Sejakowatz /*
252a38012Sejakowatz ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
352a38012Sejakowatz ** Distributed under the terms of the NewOS License.
452a38012Sejakowatz */
552a38012Sejakowatz #ifndef _KERNEL_INT_H
652a38012Sejakowatz #define _KERNEL_INT_H
752a38012Sejakowatz 
85cdacbaaSlillo #include <KernelExport.h>
952a38012Sejakowatz 
10564cba31SAxel Dörfler #include <arch/int.h>
11c6aa0539SDavid Reid 
12564cba31SAxel Dörfler struct kernel_args;
13c6aa0539SDavid Reid 
14564cba31SAxel Dörfler /* adds the handler but don't change whether or not the interrupt is currently enabled */
15c6aa0539SDavid Reid #define B_NO_ENABLE_COUNTER	1
16c6aa0539SDavid Reid 
17*229ad83bSAxel Dörfler /* during kernel startup, interrupts are disabled */
18*229ad83bSAxel Dörfler extern bool kernel_startup;
19*229ad83bSAxel Dörfler 
20*229ad83bSAxel Dörfler 
21*229ad83bSAxel Dörfler #ifdef __cplusplus
22*229ad83bSAxel Dörfler extern "C" {
23*229ad83bSAxel Dörfler #endif
24*229ad83bSAxel Dörfler 
25564cba31SAxel Dörfler int  int_init(struct kernel_args *ka);
26564cba31SAxel Dörfler int  int_init2(struct kernel_args *ka);
2752a38012Sejakowatz int  int_io_interrupt_handler(int vector);
28c6aa0539SDavid Reid long install_interrupt_handler(long, interrupt_handler,	void *);
29c6aa0539SDavid Reid long remove_interrupt_handler (long, interrupt_handler,	void *);
3052a38012Sejakowatz 
31*229ad83bSAxel Dörfler static inline void
32*229ad83bSAxel Dörfler enable_interrupts(void)
33*229ad83bSAxel Dörfler {
34*229ad83bSAxel Dörfler 	arch_int_enable_interrupts();
35*229ad83bSAxel Dörfler }
3652a38012Sejakowatz 
37*229ad83bSAxel Dörfler static inline bool
38*229ad83bSAxel Dörfler are_interrupts_enabled(void)
39*229ad83bSAxel Dörfler {
40*229ad83bSAxel Dörfler 	return arch_int_are_interrupts_enabled();
41*229ad83bSAxel Dörfler }
42*229ad83bSAxel Dörfler 
43*229ad83bSAxel Dörfler #ifdef __cplusplus
44*229ad83bSAxel Dörfler }
45*229ad83bSAxel Dörfler #endif
467991b1a0Sbeveloper 
47ca91310aSDavid Reid #endif /* _KERNEL_INT_H */
48