|
Kernelite 0.1.0
Kernelite is a minimalist, educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction.
|
Implementation of the Interrupt Controller Unit (ICU) helpers. More...
#include "icu/icu.h"#include "fdt/fdt.h"#include "linker/symbols.h"#include "page_table/page_table.h"#include "utils/kprintf.h"#include "utils/string.h"#include "../drivers/gicv3.h"#include <stdint.h>
Functions | |
| void | icu_init (const void *fdt) |
| Initialize the interrupt controller unit. | |
| bool | icu_register_irq (uint32_t irq_num, handler_data_t handler_data) |
| Register a handler for a hardware interrupt source and enable it. | |
| void | icu_unregister_irq (uint32_t irq_num) |
| Unregister a handler for a hardware interrupt source and disable it. | |
| void | icu_handle_irq (void) |
| Top-level IRQ dispatch entry point. | |
Implementation of the Interrupt Controller Unit (ICU) helpers.
Reads the interrupt controller's compatible string from the FDT and dispatches initialization and IRQ (un)registration to the matching platform driver. Currently only "arm,gic-v3" is supported.
| void icu_handle_irq | ( | void | ) |
Top-level IRQ dispatch entry point.
Called directly from the EL1 IRQ exception vector. Delegates to the GICv3 handler which acknowledges the interrupt via ICC_IAR1_EL1, dispatches based on INTID, and signals EOI via ICC_EOIR1_EL1.
This indirection layer allows the ICU (Interrupt Controller Unit) interface to remain decoupled from the underlying GIC implementation, making it straightforward to swap in a different interrupt controller without modifying the vector table or exception entry code.
| void icu_init | ( | const void * | fdt | ) |
Initialize the interrupt controller unit.
Performs any platform-specific ICU startup required before the kernel can enable and service hardware interrupts.
| fdt | Pointer to the Flattened Device Tree (FDT) blob, which may be used to discover interrupt controller properties and configuration. |
| bool icu_register_irq | ( | uint32_t | irq_num, |
| handler_data_t | handler_data | ||
| ) |
Register a handler for a hardware interrupt source and enable it.
| irq_num | Physical interrupt irq_num to register. |
| handler_data | Handler function and private data to register. |
| void icu_unregister_irq | ( | uint32_t | irq_num | ) |
Unregister a handler for a hardware interrupt source and disable it.
Disables the interrupt in the GIC and clears the corresponding entry in the dispatch table. After this call the irq_num will no longer fire and any previously registered handler will not be invoked.
| irq_num | Physical interrupt irq_num to unregister. |