Skip to content

Commit

Permalink
Add more compiler fences.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Apr 16, 2024
1 parent 4502182 commit b6cc800
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nrf-hal-common/src/twim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ where
}

fn write_part(&mut self, buffer: &[u8], final_operation: bool) -> Result<(), Error> {
compiler_fence(SeqCst);
unsafe { self.set_tx_buffer(buffer)? };

// Set appropriate lasttx shortcut.
Expand All @@ -413,6 +414,7 @@ where
self.0.tasks_resume.write(|w| unsafe { w.bits(1) });

self.wait();
compiler_fence(SeqCst);
self.read_errorsrc()?;
if self.0.txd.amount.read().bits() != buffer.len() as u32 {
return Err(Error::Transmit);
Expand All @@ -435,6 +437,7 @@ where
self.0.tasks_resume.write(|w| unsafe { w.bits(1) });

self.wait();
compiler_fence(SeqCst);
self.read_errorsrc()?;
if self.0.rxd.amount.read().bits() != buffer.len() as u32 {
return Err(Error::Receive);
Expand Down

0 comments on commit b6cc800

Please sign in to comment.