mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 02:16:19 +04:00
Add data flush in uart put function
This commit is contained in:
parent
e8e379e557
commit
2474df886c
@ -101,7 +101,14 @@ impl Uart {
|
|||||||
|
|
||||||
pub fn put(&mut self, c: u8) {
|
pub fn put(&mut self, c: u8) {
|
||||||
let ptr = self.base_address as *mut 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 {
|
unsafe {
|
||||||
|
// Write data
|
||||||
ptr.add(0).write_volatile(c);
|
ptr.add(0).write_volatile(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user