1d8e29bffSR0ronoa use alloc::sync::Arc; 2d8e29bffSR0ronoa use system_error::SystemError; 3d8e29bffSR0ronoa 4d8e29bffSR0ronoa use crate::driver::base::device::bus::{bus_register, Bus}; 5d8e29bffSR0ronoa 6d8e29bffSR0ronoa use self::subsys::SerioBus; 7d8e29bffSR0ronoa 8*9993c0fcSR0ronoa pub mod i8042; 9d8e29bffSR0ronoa pub mod serio_device; 10d8e29bffSR0ronoa pub mod serio_driver; 11d8e29bffSR0ronoa pub mod subsys; 12d8e29bffSR0ronoa 13d8e29bffSR0ronoa static mut SERIO_BUS: Option<Arc<SerioBus>> = None; 14d8e29bffSR0ronoa 15d8e29bffSR0ronoa #[allow(dead_code)] 16d8e29bffSR0ronoa #[inline(always)] serio_bus() -> Arc<SerioBus>17d8e29bffSR0ronoapub fn serio_bus() -> Arc<SerioBus> { 18d8e29bffSR0ronoa unsafe { SERIO_BUS.clone().unwrap() } 19d8e29bffSR0ronoa } 20d8e29bffSR0ronoa 21d8e29bffSR0ronoa /// # 函数的功能 22a381e482SR0ronoa /// 初始化Serio总线 23d8e29bffSR0ronoa /// 24d8e29bffSR0ronoa /// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/drivers/input/serio/serio.c#1024 serio_bus_init() -> Result<(), SystemError>25d8e29bffSR0ronoapub fn serio_bus_init() -> Result<(), SystemError> { 26d8e29bffSR0ronoa let serio_bus = SerioBus::new(); 27d8e29bffSR0ronoa let r = bus_register(serio_bus.clone() as Arc<dyn Bus>); 28d8e29bffSR0ronoa unsafe { SERIO_BUS = Some(serio_bus) }; 29d8e29bffSR0ronoa 30d8e29bffSR0ronoa return r; 31d8e29bffSR0ronoa } 32