Rust XHCI Implementation.
This commit is contained in:
parent
0b95098748
commit
2c271360ce
25 changed files with 1288 additions and 202 deletions
51
'
Normal file
51
'
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
mod xhci;
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use mammoth::{
|
||||
cap::Capability,
|
||||
debug, define_entry,
|
||||
sync::Mutex,
|
||||
task::{Executor, Task},
|
||||
zion::z_err_t,
|
||||
};
|
||||
use pci::PciDevice;
|
||||
use xhci::driver::XHCIDriver;
|
||||
|
||||
define_entry!();
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn main() -> z_err_t {
|
||||
#[cfg(feature = "debug")]
|
||||
debug!("Voyageurs Starting.");
|
||||
|
||||
let yellowstone = yellowstone_yunq::from_init_endpoint();
|
||||
|
||||
let xhci_info = yellowstone
|
||||
.get_xhci_info()
|
||||
.expect("Failed to get XHCI info from yellowstone.");
|
||||
|
||||
let pci_device = PciDevice::from_cap(Capability::take(xhci_info.xhci_region)).unwrap();
|
||||
|
||||
let xhci_driver = Arc::new(XHCIDriver::from_pci_device(pci_device));
|
||||
|
||||
let executor = Arc::new(Mutex::new(Executor::new()));
|
||||
|
||||
let driver_clone = xhci_driver.clone();
|
||||
let interrupt_thread = mammoth::thread::spawn(move || driver_clone.interrupt_loop());
|
||||
|
||||
let driver_clone = xhci_driver.clone();
|
||||
executor
|
||||
.clone()
|
||||
.lock()
|
||||
.spawn(Task::new((|| xhci_driver.clone().startup())()));
|
||||
|
||||
executor.clone().lock().run();
|
||||
interrupt_thread.join().unwrap();
|
||||
|
||||
0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue