mirror of
https://github.com/sgmarz/osblog.git
synced 2024-11-24 02:16:19 +04:00
Merge pull request #13 from skyzh/patch-1
Add data flush in uart put function
This commit is contained in:
commit
a36db7e8aa
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user