Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. InterruptController

InterruptController

Trait InterruptController 

Source
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§

Source

type InterruptHandler: Copy + Sync + Send + 'static

Required Methods§

Source

fn enable_interrupt(irq: u32)

Enable a specific interrupt by its IRQ number.

Source

fn disable_interrupt(irq: u32)

Disable a specific interrupt by its IRQ number.

Source

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)]

Source

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)].

Source

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.

Source

fn kernel_interrupt_handler_enter<K: Kernel>(kernel: K, irq: u32)

Kernel interrupt handler has started.

Source

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.

Source

fn enable_interrupts()

Globally enable interrupts.

Source

fn disable_interrupts()

Globally disable interrupts.

Source

fn interrupts_enabled() -> bool

Returns true if interrupts are globally enabled.

Source

fn trigger_interrupt(irq: u32)

Trigger an interrupt by IRQ. This may not be supported on all interrupt controllers.

Provided Methods§

Source

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".

Implementors§