chipset_device/interrupt.rs
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Interrupt handling for devices.
5
6use std::ops::RangeInclusive;
7
8/// A device that can act as a target for a line interrupt.
9pub trait LineInterruptTarget {
10 /// Set an interrupt line state.
11 fn set_irq(&mut self, vector: u32, high: bool);
12
13 /// Returns the valid vector ranges for this target.
14 fn valid_lines(&self) -> &[RangeInclusive<u32>];
15}
16
17/// A device that can handle an EOI initiated from a processor-specific
18/// interrupt controller interface.
19pub trait HandleEoi {
20 /// EOI the interrupt.
21 fn handle_eoi(&mut self, vector: u32);
22}
23
24/// A device that can handle an x86 PIC interrupt request.
25pub trait AcknowledgePicInterrupt {
26 /// Gets the current pending IRQ and sets it in service.
27 fn acknowledge_interrupt(&mut self) -> Option<u8>;
28}