51 lines
1.2 KiB
Text
51 lines
1.2 KiB
Text
#![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
|
|
}
|