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.
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
icu.h File Reference

Interrupt Controller Unit (ICU) interface. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for icu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  handler_data_t
 Interrupt handler registration entry. More...
 

Typedefs

typedef struct handler_data_t handler_data_t
 Interrupt handler registration entry.
 

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.
 

Detailed Description

Interrupt Controller Unit (ICU) interface.

Provides declarations for early interrupt controller setup and simple interrupt management operations used by the kernel during bootstrap.

Author
Abhin Parekadan Jose
Date
2026-06-07

Typedef Documentation

◆ handler_data_t

Interrupt handler registration entry.

Pairs a handler function with its opaque private data pointer. Stored in the dispatch table indexed by INTID. When an interrupt fires, the dispatcher calls handler(private_data) for the corresponding entry.

Function Documentation

◆ icu_handle_irq()

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.

◆ icu_init()

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.

Parameters
fdtPointer to the Flattened Device Tree (FDT) blob, which may be used to discover interrupt controller properties and configuration.

◆ icu_register_irq()

bool icu_register_irq ( uint32_t  irq_num,
handler_data_t  handler_data 
)

Register a handler for a hardware interrupt source and enable it.

Parameters
irq_numPhysical interrupt irq_num to register.
handler_dataHandler function and private data to register.
Returns
true if the handler was registered and the interrupt enabled successfully, false if the irq_num is out of range or already registered.

◆ icu_unregister_irq()

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.

Parameters
irq_numPhysical interrupt irq_num to unregister.