btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / kernel / int.h
blob91608a478225103e3ccda14e871cde1c52f0fd99
1 /*
2 * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
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
12 #include <KernelExport.h>
13 #include <arch/int.h>
15 #include <util/list.h>
17 // private install_io_interrupt_handler() flags
18 #define B_NO_LOCK_VECTOR 0x100
19 #define B_NO_HANDLED_INFO 0x200
21 struct kernel_args;
24 enum interrupt_type {
25 INTERRUPT_TYPE_EXCEPTION,
26 INTERRUPT_TYPE_IRQ,
27 INTERRUPT_TYPE_LOCAL_IRQ,
28 INTERRUPT_TYPE_SYSCALL,
29 INTERRUPT_TYPE_ICI,
30 INTERRUPT_TYPE_UNKNOWN
33 struct irq_assignment {
34 list_link link;
36 uint32 irq;
37 uint32 count;
39 int32 handlers_count;
41 int32 load;
42 int32 cpu;
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
50 status_t int_init(struct kernel_args* args);
51 status_t int_init_post_vm(struct kernel_args* args);
52 status_t int_init_io(struct kernel_args* args);
53 status_t int_init_post_device_manager(struct kernel_args* args);
54 int int_io_interrupt_handler(int vector, bool levelTriggered);
56 bool interrupts_enabled(void);
58 static inline void
59 enable_interrupts(void)
61 arch_int_enable_interrupts();
64 static inline bool
65 are_interrupts_enabled(void)
67 return arch_int_are_interrupts_enabled();
70 #ifdef __cplusplus
72 #endif
75 // map those directly to the arch versions, so they can be inlined
76 #define disable_interrupts() arch_int_disable_interrupts()
77 #define restore_interrupts(status) arch_int_restore_interrupts(status)
80 status_t reserve_io_interrupt_vectors(long count, long startVector,
81 enum interrupt_type type);
82 status_t allocate_io_interrupt_vectors(long count, long *startVector,
83 enum interrupt_type type);
84 void free_io_interrupt_vectors(long count, long startVector);
86 void assign_io_interrupt_to_cpu(long vector, int32 cpu);
88 #endif /* _KERNEL_INT_H */