|
ginnOS
The reference: libc, the libraries and the kernel
|
kernel IRQ handler manager. More...
#include "irq.h"#include "common/stdio.h"#include "drivers/pci/pci_irq.h"#include "kernel/cpu/cpu.h"#include "kernel/klog/klog.h"#include "kernel/random/random.h"Macros | |
| #define | IRQ_LINE_COUNT 16 |
| #define | IDLE_WAIT_SPINS 1000000u |
Functions | |
| void | irq_manager_init (void) |
| initialize the IRQ manager. | |
| irq_handle_t * | irq_request (uint32_t irq, irq_handler_fn handler, uint32_t flags, const char *name) |
| register a handler on an IRQ line, sharing it with any existing handlers. | |
| void | irq_free (irq_handle_t *handle) |
| remove a previously requested handler. | |
| void | irq_handler_set_enabled (irq_handle_t *handle, bool enabled) |
| enable or disable a single handler without removing it. | |
| void | irq_dump (void) |
| print the registered handlers per line (debugging aid). | |
| bool | irq_set_cpu (uint32_t irq, uint32_t cpu) |
| send the interrupts of an IRQ line to a core (arch_irq_set_cpu). | |
| uint32_t | irq_line_cpu (uint32_t irq) |
| the core that handles an IRQ line. | |
| void | irq_spread (void) |
| spread the device interrupts over the cores that run the scheduler: each IRQ line that has a handler, and each PCI device that uses MSI or MSI-X, goes to the next core in turn, as Linux gives each interrupt one core. | |
kernel IRQ handler manager.
one dispatcher is registered with the arch layer per line; it walks that line's handler list and invokes every enabled handler. handler storage is a fixed pool so there is no allocation on the interrupt path.
| #define IRQ_LINE_COUNT 16 |
| #define IDLE_WAIT_SPINS 1000000u |
| void irq_manager_init | ( | void | ) |
initialize the IRQ manager.
must run before any irq_request() call.
| irq_handle_t * irq_request | ( | uint32_t | irq, |
| irq_handler_fn | handler, | ||
| uint32_t | flags, | ||
| const char * | name ) |
register a handler on an IRQ line, sharing it with any existing handlers.
the handler starts enabled and the line is unmasked automatically.
| irq | the IRQ line. |
| handler | the function to call when the line fires. |
| flags | reserved for future use; pass IRQ_FLAG_NONE. |
| name | short human-readable owner name (for debugging), may be NULL. |
| void irq_free | ( | irq_handle_t * | handle | ) |
remove a previously requested handler.
if it was the last enabled handler on its line, the line is masked.
| handle | the handle returned by irq_request() (NULL is ignored). |
| void irq_handler_set_enabled | ( | irq_handle_t * | handle, |
| bool | enabled ) |
enable or disable a single handler without removing it.
masks the line when no enabled handlers remain, unmasks it otherwise.
| handle | the handler to toggle. |
| enabled | true to enable, false to disable. |
| void irq_dump | ( | void | ) |
print the registered handlers per line (debugging aid).
send the interrupts of an IRQ line to a core (arch_irq_set_cpu).
| irq | the IRQ line (0 to 15). |
| cpu | the index of the core (cpu_t.index). |
the core that handles an IRQ line.
| irq | the IRQ line (0 to 15). |
| void irq_spread | ( | void | ) |
spread the device interrupts over the cores that run the scheduler: each IRQ line that has a handler, and each PCI device that uses MSI or MSI-X, goes to the next core in turn, as Linux gives each interrupt one core.
IRQ 0 (the PIT) stays on the boot core. call it once, after smp_init().