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