1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00
This commit is contained in:
Stephen Marz 2020-03-10 11:21:15 -04:00
commit f2f5c855cf

View File

@ -101,7 +101,14 @@ impl Uart {
pub fn put(&mut self, c: u8) {
let ptr = self.base_address as *mut u8;
loop {
// Wait until previous data is flushed
if unsafe { ptr.add(5).read_volatile() } & (1 << 5) != 0 {
break;
}
}
unsafe {
// Write data
ptr.add(0).write_volatile(c);
}
}