2022-08-08 12:07:43 -05:00
|
|
|
use kernel::device_interface::CharacterDevice;
|
2022-03-16 05:39:01 -05:00
|
|
|
|
|
|
|
pub struct Serial {
|
|
|
|
pub base: usize,
|
|
|
|
}
|
2022-04-11 17:23:11 -05:00
|
|
|
|
2022-03-16 05:39:01 -05:00
|
|
|
impl CharacterDevice for Serial {
|
|
|
|
fn can_read(&self) -> bool {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
fn can_write(&self) -> bool {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
fn read_char(&mut self) -> Option<char> {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
2022-04-11 15:51:54 -05:00
|
|
|
fn write_char(&mut self, _c: char) -> bool {
|
2022-03-16 05:39:01 -05:00
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn reset(&mut self) {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn initialize(&mut self) -> bool {
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
2022-04-11 17:23:11 -05:00
|
|
|
|
2022-03-16 05:39:01 -05:00
|
|
|
pub fn new_serial_test() {
|
|
|
|
let mut serial = Serial { base: 0x3F8 };
|
|
|
|
serial.initialize();
|
|
|
|
serial.write_char('a');
|
2021-11-16 00:09:27 -06:00
|
|
|
}
|