redox/drivers/ps2d/src/main.rs

43 lines
805 B
Rust
Raw Normal View History

#![feature(asm)]
2016-09-20 01:19:49 +02:00
#[macro_use]
extern crate bitflags;
extern crate io;
extern crate syscall;
use std::thread;
use syscall::iopl;
2016-09-20 01:19:49 +02:00
mod controller;
mod keyboard;
2016-09-19 18:24:19 +02:00
mod keymap;
2016-09-20 01:19:49 +02:00
mod mouse;
2016-09-20 01:19:49 +02:00
fn main() {
unsafe {
iopl(3).expect("ps2d: failed to get I/O permission");
asm!("cli" :::: "intel", "volatile");
2016-09-19 18:24:19 +02:00
}
2016-09-20 01:19:49 +02:00
let extra_packet = controller::Ps2::new().init();
2016-09-19 18:24:19 +02:00
thread::spawn(|| {
unsafe {
2016-09-20 01:19:49 +02:00
iopl(3).expect("ps2d: failed to get I/O permission");
asm!("cli" :::: "intel", "volatile");
}
2016-09-20 01:19:49 +02:00
keyboard::keyboard();
2016-09-19 18:24:19 +02:00
});
2016-09-20 01:19:49 +02:00
thread::spawn(move || {
2016-09-19 18:24:19 +02:00
unsafe {
2016-09-20 01:19:49 +02:00
iopl(3).expect("ps2d: failed to get I/O permission");
2016-09-19 18:24:19 +02:00
asm!("cli" :::: "intel", "volatile");
}
2016-09-20 01:19:49 +02:00
mouse::mouse(extra_packet);
2016-09-19 18:24:19 +02:00
});
}