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