xref: /haiku/headers/os/drivers/interrupt_controller.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef _INTERRUPT_CONTROLLER_H
6 #define _INTERRUPT_CONTROLLER_H
7 
8 #include <device_manager.h>
9 
10 enum {
11 	IRQ_TYPE_LEVEL	= 0,
12 	IRQ_TYPE_EDGE	= 1,
13 };
14 
15 typedef struct interrupt_controller_info {
16 	int	cpu_count;		// number of supported CPUs
17 	int	irq_count;		// number of supported IRQs
18 } interrupt_controller_info;
19 
20 // interrupt controller drivers
21 typedef struct interrupt_controller_module_info {
22 	driver_module_info info;
23 
24 	status_t	(*get_controller_info)(void *cookie,
25 					interrupt_controller_info *info);
26 
27 	status_t	(*enable_io_interrupt)(void *cookie, int irq, int type);
28 	status_t	(*disable_io_interrupt)(void *cookie, int irq);
29 
30 	// Returns the IRQ number or a negative value, if the interrupt shall be
31 	// ignore (spurious interrupts). Since more than one interrupt can be
32 	// pending, the function should be called in a loop until it returns a
33 	// negative value.
34 	// Must be called with CPU interrupts disabled.
35 	int			(*acknowledge_io_interrupt)(void *cookie);
36 
37 } interrupt_controller_module_info;
38 
39 #endif	// _INTERRUPT_CONTROLLER_H
40