pub trait InterruptController {
type InterruptHandler: Copy + Sync + Send + 'static;
// Required methods
fn enable_interrupt(irq: u32);
fn disable_interrupt(irq: u32);
fn userspace_interrupt_ack(irq: u32);
fn userspace_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32);
fn userspace_interrupt_handler_exit<K: Kernel>(
kernel: K,
irq: u32,
guard: InterruptGuard<K>,
);
fn kernel_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32);
fn kernel_interrupt_handler_exit<K: Kernel>(
kernel: K,
irq: u32,
guard: InterruptGuard<K>,
);
fn enable_interrupts();
fn disable_interrupts();
fn interrupts_enabled() -> bool;
fn trigger_interrupt(irq: u32);
// Provided method
fn early_init(&self) { ... }
}Expand description
This trait provides a generic interface to an architecture’s interrupt controller, such as a RISC-V PLIC or an Arm NVIC.
Required Associated Types§
type InterruptHandler: Copy + Sync + Send + 'static
Required Methods§
Sourcefn enable_interrupt(irq: u32)
fn enable_interrupt(irq: u32)
Enable a specific interrupt by its IRQ number.
Sourcefn disable_interrupt(irq: u32)
fn disable_interrupt(irq: u32)
Disable a specific interrupt by its IRQ number.
Sourcefn userspace_interrupt_ack(irq: u32)
fn userspace_interrupt_ack(irq: u32)
Userspace handling of the interrupt is complete. Called
from [syscall_defs::interrupt_ack(object_handle: u32, signal_mask: Signals)]
Sourcefn userspace_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32)
fn userspace_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32)
Userspace interrupt handlers call [userspace_interrupt_handler_enter(kernel: K, irq: u32)]
to mask the interrupt prior to the interrupt object being signalled. The interrupt
is unmasked from userspace by [userspace_interrupt_ack(irq: u32)].
Sourcefn userspace_interrupt_handler_exit<K: Kernel>(
kernel: K,
irq: u32,
guard: InterruptGuard<K>,
)
fn userspace_interrupt_handler_exit<K: Kernel>( kernel: K, irq: u32, guard: InterruptGuard<K>, )
Userspace interrupt handler is complete.
This consumes the InterruptGuard by value. When it goes out of scope,
its Drop implementation will handle thread termination checks and
deferred rescheduling.
Sourcefn kernel_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32)
fn kernel_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32)
Kernel interrupt handler has started.
Sourcefn kernel_interrupt_handler_exit<K: Kernel>(
kernel: K,
irq: u32,
guard: InterruptGuard<K>,
)
fn kernel_interrupt_handler_exit<K: Kernel>( kernel: K, irq: u32, guard: InterruptGuard<K>, )
Kernel interrupt handler is complete.
This consumes the InterruptGuard by value. When it goes out of scope,
its Drop implementation will handle thread termination checks and
deferred rescheduling.
Sourcefn enable_interrupts()
fn enable_interrupts()
Globally enable interrupts.
Sourcefn disable_interrupts()
fn disable_interrupts()
Globally disable interrupts.
Sourcefn interrupts_enabled() -> bool
fn interrupts_enabled() -> bool
Returns true if interrupts are globally enabled.
Sourcefn trigger_interrupt(irq: u32)
fn trigger_interrupt(irq: u32)
Trigger an interrupt by IRQ. This may not be supported on all interrupt controllers.
Provided Methods§
Sourcefn early_init(&self)
fn early_init(&self)
Called early in the kernel::main() function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".