1 /* 2 * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_INT_H 9 #define _KERNEL_INT_H 10 11 12 #include <KernelExport.h> 13 #include <arch/int.h> 14 15 // private install_io_interrupt_handler() flags 16 #define B_NO_LOCK_VECTOR 0x100 17 #define B_NO_HANDLED_INFO 0x200 18 19 struct kernel_args; 20 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 status_t int_init(struct kernel_args* args); 27 status_t int_init_post_vm(struct kernel_args* args); 28 status_t int_init_io(struct kernel_args* args); 29 status_t int_init_post_device_manager(struct kernel_args* args); 30 int int_io_interrupt_handler(int vector, bool levelTriggered); 31 32 bool interrupts_enabled(void); 33 34 static inline void 35 enable_interrupts(void) 36 { 37 arch_int_enable_interrupts(); 38 } 39 40 static inline bool 41 are_interrupts_enabled(void) 42 { 43 return arch_int_are_interrupts_enabled(); 44 } 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 51 // map those directly to the arch versions, so they can be inlined 52 #define disable_interrupts() arch_int_disable_interrupts() 53 #define restore_interrupts(status) arch_int_restore_interrupts(status) 54 55 56 status_t reserve_io_interrupt_vectors(long count, long startVector); 57 status_t allocate_io_interrupt_vectors(long count, long *startVector); 58 void free_io_interrupt_vectors(long count, long startVector); 59 60 #endif /* _KERNEL_INT_H */ 61