axplat/irq.rs
1//! Interrupt request (IRQ) handling.
2
3pub use handler_table::HandlerTable;
4
5/// The type if an IRQ handler.
6pub type IrqHandler = handler_table::Handler;
7
8/// IRQ management interface.
9#[def_plat_interface]
10pub trait IrqIf {
11 /// Enables or disables the given IRQ.
12 fn set_enable(irq: usize, enabled: bool);
13
14 /// Registers an IRQ handler for the given IRQ.
15 ///
16 /// It also enables the IRQ if the registration succeeds. It returns `false`
17 /// if the registration failed.
18 fn register(irq: usize, handler: IrqHandler) -> bool;
19
20 /// Unregisters the IRQ handler for the given IRQ.
21 ///
22 /// It also disables the IRQ if the unregistration succeeds. It returns the
23 /// existing handler if it is registered, `None` otherwise.
24 fn unregister(irq: usize) -> Option<IrqHandler>;
25
26 /// Handles the IRQ.
27 ///
28 /// It is called by the common interrupt handler. It should look up in the
29 /// IRQ handler table and calls the corresponding handler. If necessary, it
30 /// also acknowledges the interrupt controller after handling.
31 fn handle(irq: usize);
32}