Skip to content

Commit 46464e8

Browse files
committed
fix(mmio): read data pointer after waiting for line status
Signed-off-by: Martin Kröning <[email protected]>
1 parent 0358f70 commit 46464e8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/mmio.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,18 @@ impl MmioSerialPort {
9090

9191
/// Sends a raw byte on the serial port, intended for binary data.
9292
pub fn send_raw(&mut self, data: u8) {
93-
let self_data = self.data.load(Ordering::Relaxed);
9493
wait_for!(self.line_sts().contains(LineStsFlags::OUTPUT_EMPTY));
94+
let self_data = self.data.load(Ordering::Relaxed);
9595
unsafe {
9696
self_data.write(data);
9797
}
9898
}
9999

100100
/// Receives a byte on the serial port.
101101
pub fn receive(&mut self) -> u8 {
102+
wait_for!(self.line_sts().contains(LineStsFlags::INPUT_FULL));
102103
let self_data = self.data.load(Ordering::Relaxed);
103-
unsafe {
104-
wait_for!(self.line_sts().contains(LineStsFlags::INPUT_FULL));
105-
self_data.read()
106-
}
104+
unsafe { self_data.read() }
107105
}
108106
}
109107

0 commit comments

Comments
 (0)