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 852a38012Sejakowatz #include <stage2.h> 952a38012Sejakowatz #include <arch/int.h> 105cdacbaaSlillo #include <KernelExport.h> 1152a38012Sejakowatz 12c6aa0539SDavid Reid /** 13c6aa0539SDavid Reid * @defgroup kernelint Interrupts 14c6aa0539SDavid Reid * @ingroup OpenBeOS_Kernel 15c6aa0539SDavid Reid * @brief Interrupts for the kernel and device drivers 16c6aa0539SDavid Reid * @{ 17c6aa0539SDavid Reid */ 18c6aa0539SDavid Reid 19c6aa0539SDavid Reid /** 20c6aa0539SDavid Reid * @defgroup Intreturns Interrupt Handler return codes 21c6aa0539SDavid Reid * @ingroup kernelint 22c6aa0539SDavid Reid * @{ 23c6aa0539SDavid Reid */ 24c6aa0539SDavid Reid /** @def B_UNHANDLED_INTERRUPT interrupt wasn't handled by this handler */ 25c6aa0539SDavid Reid /** @def B_HANDLED_INTERRUPT the handler handled the interrupt */ 26c6aa0539SDavid Reid /** @def B_INVOKE_SCHEDULER the handler handled the interrupt and wants the 27c6aa0539SDavid Reid * scheduler invoked 28c6aa0539SDavid Reid */ 29c6aa0539SDavid Reid #define B_UNHANDLED_INTERRUPT 0 30c6aa0539SDavid Reid #define B_HANDLED_INTERRUPT 1 31c6aa0539SDavid Reid #define B_INVOKE_SCHEDULER 2 32c6aa0539SDavid Reid /** @} */ 33c6aa0539SDavid Reid 34c6aa0539SDavid Reid /** @def B_NO_ENABLE_COUNTER add the handler but don't change whether or 35c6aa0539SDavid Reid * not the interrupt is currently enabled 36c6aa0539SDavid Reid */ 37c6aa0539SDavid Reid #define B_NO_ENABLE_COUNTER 1 38c6aa0539SDavid Reid 3952a38012Sejakowatz int int_init(kernel_args *ka); 4052a38012Sejakowatz int int_init2(kernel_args *ka); 4152a38012Sejakowatz int int_io_interrupt_handler(int vector); 42c6aa0539SDavid Reid long install_interrupt_handler(long, interrupt_handler, void *); 43c6aa0539SDavid Reid long remove_interrupt_handler (long, interrupt_handler, void *); 4452a38012Sejakowatz 452ba192e3SDavid Reid #define enable_interrupts arch_int_enable_interrupts 462ba192e3SDavid Reid #define are_interrupts_enabled arch_int_is_interrupts_enabled 4752a38012Sejakowatz 482ba192e3SDavid Reid /** @fn long install_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data, ulong flags); 492ba192e3SDavid Reid * 502ba192e3SDavid Reid * @note This function is used for devices that can generate an "actual" 512ba192e3SDavid Reid * interrupt, i.e. where IRQ < 16 522ba192e3SDavid Reid */ 532ba192e3SDavid Reid long install_io_interrupt_handler(long, 542ba192e3SDavid Reid interrupt_handler, 552ba192e3SDavid Reid void *, ulong); 56ca91310aSDavid Reid 572ba192e3SDavid Reid /** @fn long remove_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data); 582ba192e3SDavid Reid * 592ba192e3SDavid Reid * @note This function is used for devices that can generate an "actual" 602ba192e3SDavid Reid * interrupt, i.e. where IRQ < 16 612ba192e3SDavid Reid */ 622ba192e3SDavid Reid long remove_io_interrupt_handler (long, 632ba192e3SDavid Reid interrupt_handler, 642ba192e3SDavid Reid void *); 65ca91310aSDavid Reid 66c6aa0539SDavid Reid /** @} */ 67c6aa0539SDavid Reid 68*7991b1a0Sbeveloper /* during kernel startup, interrupts are disabled */ 69*7991b1a0Sbeveloper extern bool kernel_startup; 70*7991b1a0Sbeveloper 71ca91310aSDavid Reid #endif /* _KERNEL_INT_H */ 72