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