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;
47#[cfg(any(
48    all(feature = "serial", plat_dyn),
49    all(any(target_arch = "aarch64", target_arch = "riscv64"), plat_dyn),
50    all(feature = "rockchip-soc", plat_dyn),
51    all(feature = "rockchip-pm", plat_dyn),
52    all(feature = "sg2002-placeholder", plat_dyn),
53    all(feature = "rockchip-dwmmc", plat_dyn),
54    all(feature = "rockchip-sdhci", plat_dyn),
55    all(feature = "phytium-mci", plat_dyn),
56    all(feature = "k230-sdhci", plat_dyn),
57    all(feature = "rk3588-pcie", plat_dyn),
58    all(feature = "rknpu", plat_dyn),
59    all(feature = "xhci-mmio", target_os = "none", plat_dyn),
60    all(feature = "xhci-pci", target_os = "none"),
61    all(virtio_dev, plat_dyn)
62))]
63pub mod mmio;
64
65#[cfg(feature = "block")]
66pub mod block;
67#[cfg(feature = "display")]
68pub mod display;
69#[cfg(feature = "input")]
70pub mod input;
71#[cfg(feature = "net")]
72pub mod net;
73#[cfg(feature = "vsock")]
74pub mod vsock;
75
76pub mod pci;
77#[cfg(feature = "rknpu")]
78pub mod rknpu;
79#[cfg(feature = "serial")]
80pub mod serial;
81#[cfg(any(
82    feature = "rockchip-soc",
83    feature = "rockchip-pm",
84    feature = "sg2002-placeholder",
85    feature = "rockchip-dwmmc"
86))]
87pub mod soc;
88#[cfg(all(any(target_arch = "aarch64", target_arch = "riscv64"), plat_dyn))]
89pub mod time;
90#[cfg(feature = "usb")]
91pub mod usb;
92#[cfg(virtio_dev)]
93pub mod virtio;
94
95pub use error::{Error, Result};