From cda4ca95821f17e3bd8597fafc2d1d2d761b3f8c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 7 Feb 2006 02:31:07 +0000 Subject: [PATCH] Module interface for interrupt controllers. Might change later. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16269 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/interrupt_controller.h | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 headers/os/drivers/interrupt_controller.h diff --git a/headers/os/drivers/interrupt_controller.h b/headers/os/drivers/interrupt_controller.h new file mode 100644 index 0000000000..45458de12a --- /dev/null +++ b/headers/os/drivers/interrupt_controller.h @@ -0,0 +1,39 @@ +/* + * Copyright 2006, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _INTERRUPT_CONTROLLER_H +#define _INTERRUPT_CONTROLLER_H + +#include + +enum { + IRQ_TYPE_LEVEL = 0, + IRQ_TYPE_EDGE = 1, +}; + +typedef struct interrupt_controller_info { + int cpu_count; // number of supported CPUs + int irq_count; // number of supported IRQs +} interrupt_controller_info; + +// interrupt controller drivers +typedef struct interrupt_controller_module_info { + driver_module_info info; + + status_t (*get_controller_info)(void *cookie, + interrupt_controller_info *info); + + status_t (*enable_io_interrupt)(void *cookie, int irq, int type); + status_t (*disable_io_interrupt)(void *cookie, int irq); + + // Returns the IRQ number or a negative value, if the interrupt shall be + // ignore (spurious interrupts). Since more than one interrupt can be + // pending, the function should be called in a loop until it returns a + // negative value. + // Must be called with CPU interrupts disabled. + int (*acknowledge_io_interrupt)(void *cookie); + +} interrupt_controller_module_info; + +#endif // _INTERRUPT_CONTROLLER_H