Skip to content

Commit 3136e01

Browse files
bors[bot]cbiffle
andauthored
Merge #219
219: ITM: don't test reserved bits in is_fifo_ready r=adamgreig a=cbiffle On ARMv7-M, bits 31:1 of the value read from STIMx are reserved, so comparing them against zero is a bad idea. On ARMv8-M, bit 1 has been repurposed to indicate DISABLED. This means that the is_fifo_ready impl hangs forever when ITM is disabled on a Cortex-M33 (for example). Changed to test only the FIFOREADY bit. @bcantrill Co-authored-by: Cliff L. Biffle <[email protected]>
2 parents fc19f3e + 97141b9 commit 3136e01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/peripheral/itm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ impl Stim {
5555
/// Returns `true` if the stimulus port is ready to accept more data
5656
#[inline]
5757
pub fn is_fifo_ready(&self) -> bool {
58-
unsafe { ptr::read_volatile(self.register.get()) == 1 }
58+
unsafe { ptr::read_volatile(self.register.get()) & 1 == 1 }
5959
}
6060
}

0 commit comments

Comments
 (0)