IrqManager

Struct IrqManager 

Source
pub struct IrqManager {
    root: bool,
    mapping: BTreeMap<usize, Vec<Arc<dyn Driver>>>,
    all: Vec<Arc<dyn Driver>>,
}
Expand description

中断管理器结构体

Fields§

§root: bool

是否为根中断管理器

§mapping: BTreeMap<usize, Vec<Arc<dyn Driver>>>

中断号到驱动程序列表的映射 每个中断号可以对应多个驱动程序

§all: Vec<Arc<dyn Driver>>

全局驱动程序列表 这些驱动程序会处理所有中断

Implementations§

Source§

impl IrqManager

Source

pub fn new(root: bool) -> IrqManager

创建一个新的中断管理器

§参数:
  • root - 是否为根中断管理器
§返回值:

新创建的中断管理器实例

Source

pub fn register_irq(&mut self, irq: usize, driver: Arc<dyn Driver>)

注册中断号与驱动程序的映射

§参数:
  • irq - 中断号
  • driver - 要注册的驱动程序
Source

pub fn register_all(&mut self, driver: Arc<dyn Driver>)

注册全局驱动程序

§参数:
  • driver - 要注册的驱动程序
Source

pub fn register_opt(&mut self, irq_opt: Option<usize>, driver: Arc<dyn Driver>)

注册可选的中断号与驱动程序的映射

§参数:
  • irq_opt - 可选的中断号
  • driver - 要注册的驱动程序
Source

pub fn deregister_irq(&mut self, irq: usize, driver: Arc<dyn Driver>)

注销中断号与驱动程序的映射

§参数:
  • irq - 要注销的中断号
  • driver - 要注销的驱动程序
Source

pub fn deregister_all(&mut self, driver: Arc<dyn Driver>)

注销全局驱动程序

§参数:
  • driver - 要注销的驱动程序
Source

pub fn try_handle_interrupt(&self, irq_opt: Option<usize>) -> bool

处理中断

§参数:
  • irq_opt - 可选的中断号
§返回值:

如果中断被处理则返回 true,否则返回 false

Auto Trait Implementations§

§

impl Freeze for IrqManager

§

impl !RefUnwindSafe for IrqManager

§

impl Send for IrqManager

§

impl Sync for IrqManager

§

impl Unpin for IrqManager

§

impl !UnwindSafe for IrqManager

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.