Skip to main content

ax_driver/
lib.rs

1//! rdrive + rdif host driver registration collection.
2
3#![no_std]
4#![feature(used_with_arg)]
5
6extern crate alloc;
7
8pub use rdrive::{DriverGeneric, IrqId, KError, PlatformDevice, ProbeError, probe, register};
9#[doc(hidden)]
10pub use rdrive_macros::__mod_maker;
11
12#[macro_export]
13macro_rules! model_register {
14    (
15        $($i:ident : $t:expr),+,
16    ) => {
17        $crate::__mod_maker! {
18            pub mod some {
19                #[allow(unused_imports)]
20                use super::*;
21                use $crate::register::*;
22
23                /// Static instance of driver registration information.
24                ///
25                /// This static variable is placed in the `.driver.register` linker section
26                /// so that the driver manager can automatically discover and load it during
27                /// system startup.
28                #[unsafe(link_section = ".driver.register")]
29                #[unsafe(no_mangle)]
30                #[used(linker)]
31                pub static DRIVER: DriverRegister = DriverRegister {
32                    $($i : $t),+
33                };
34            }
35        }
36    };
37}
38
39crate::model_register!(
40    name: "ax-driver macro placeholder",
41    level: ProbeLevel::PostKernel,
42    priority: ProbePriority::DEFAULT,
43    probe_kinds: &[],
44);
45
46pub mod error;
47pub mod mmio;
48
49#[cfg(feature = "block")]
50pub mod block;
51#[cfg(feature = "display")]
52pub mod display;
53#[cfg(feature = "input")]
54pub mod input;
55#[cfg(feature = "net")]
56pub mod net;
57#[cfg(feature = "vsock")]
58pub mod vsock;
59
60pub mod pci;
61#[cfg(feature = "rknpu")]
62pub mod rknpu;
63#[cfg(feature = "serial")]
64pub mod serial;
65#[cfg(any(
66    feature = "rockchip-soc",
67    feature = "rockchip-pm",
68    feature = "sg2002-placeholder",
69    feature = "rockchip-dwmmc"
70))]
71pub mod soc;
72#[cfg(all(any(target_arch = "aarch64", target_arch = "riscv64"), plat_dyn))]
73pub mod time;
74#[cfg(feature = "usb")]
75pub mod usb;
76#[cfg(virtio_dev)]
77pub mod virtio;
78
79pub use error::{Error, Result};