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 i8042; 9 pub mod serio_device; 10 pub mod serio_driver; 11 pub mod subsys; 12 13 static mut SERIO_BUS: Option<Arc<SerioBus>> = None; 14 15 #[allow(dead_code)] 16 #[inline(always)] 17 pub fn serio_bus() -> Arc<SerioBus> { 18 unsafe { SERIO_BUS.clone().unwrap() } 19 } 20 21 /// # 函数的功能 22 /// 初始化Serio总线 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