driver_interface/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![cfg_attr(not(test), no_std)]

extern crate alloc;

pub use fdt_parser as fdt;

pub(crate) mod _macro;
pub mod intc;
pub mod io;
mod register;
pub mod timer;
pub mod uart;
pub use register::*;
pub(crate) mod err;
pub use err::{DriverError, DriverResult};
pub use intc::IrqConfig;

pub trait DriverGeneric: Send {
    fn open(&mut self) -> DriverResult;
    fn close(&mut self) -> DriverResult;
}

#[derive(Debug, Clone, Copy)]
pub struct RegAddress {
    pub addr: usize,
    pub size: Option<usize>,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum IrqHandleResult {
    Handled,
    Unhandled,
}