Files
haiku-beta6/headers/private/kernel/interrupts.h
T
Augustin Cavalier a97c4affc9 kernel: Rename basic "int" functions to "interrupt" (or at least "intr").
"int" of course is also an abbrevation for "integer", so having
two abbreviations is sometimes confusing. The BeOS functions
just use "interrupt" (e.g. "install_io_interrupt_handler"); it
seems we inherited the "int" abbreviation from NewOS.

The basic kernel methods and files related to interrupts are
here adjusted to drop the abbreviation and just use "interrupt(s)".
The architecture-specific functions ("arch_int_*") are mostly
moment left alone for now, though of course architecture-specific
usages of the generic kernel methods are adjusted.

Change-Id: Ic113ea1280a3c78e25f8ca3cc55b24ed5f594eae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9119
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-12 01:58:33 +00:00

90 lines
1.9 KiB
C

/*
* Copyright 2003-2010, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_INTERRUPTS_H
#define _KERNEL_INTERRUPTS_H
#include <KernelExport.h>
#include <arch/int.h>
#include <util/list.h>
// private install_io_interrupt_handler() flags
#define B_NO_LOCK_VECTOR 0x100
#define B_NO_HANDLED_INFO 0x200
struct kernel_args;
enum interrupt_type {
INTERRUPT_TYPE_EXCEPTION,
INTERRUPT_TYPE_IRQ,
INTERRUPT_TYPE_LOCAL_IRQ,
INTERRUPT_TYPE_SYSCALL,
INTERRUPT_TYPE_ICI,
INTERRUPT_TYPE_UNKNOWN
};
struct irq_assignment {
list_link link;
uint32 irq;
uint32 count;
int32 handlers_count;
int32 load;
int32 cpu;
};
#ifdef __cplusplus
extern "C" {
#endif
status_t interrupts_init(struct kernel_args* args);
status_t interrupts_init_post_vm(struct kernel_args* args);
status_t interrupts_init_io(struct kernel_args* args);
status_t interrupts_init_post_device_manager(struct kernel_args* args);
int io_interrupt_handler(int vector, bool levelTriggered);
bool interrupts_enabled(void);
static inline void
enable_interrupts(void)
{
arch_int_enable_interrupts();
}
static inline bool
are_interrupts_enabled(void)
{
return arch_int_are_interrupts_enabled();
}
#ifdef __cplusplus
}
#endif
// map those directly to the arch versions, so they can be inlined
#define disable_interrupts() arch_int_disable_interrupts()
#define restore_interrupts(status) arch_int_restore_interrupts(status)
status_t reserve_io_interrupt_vectors(int32 count, int32 startVector,
enum interrupt_type type);
status_t allocate_io_interrupt_vectors(int32 count, int32 *startVector,
enum interrupt_type type);
void free_io_interrupt_vectors(int32 count, int32 startVector);
void assign_io_interrupt_to_cpu(int32 vector, int32 cpu);
#endif /* _KERNEL_INTERRUPTS_H */