aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpennae <[email protected]>2023-05-02 20:39:19 +0200
committerpennae <[email protected]>2023-05-03 08:53:34 +0200
commit1e8da91defc2b5b328d733dedffc25893c786c1f (patch)
tree43942604e6620dc7935def987ae391e1a314b7e3
parent2afa08c9236d386cae7920d9e7f20803a2c6b433 (diff)
rp/pio: make free_instr unsafe
we can't prove that some instruction memory is not used as long as state machines are alive, and we can pass instance memory handles between instances as well. mark free_instr unsafe, with documentation for this caveat.
-rw-r--r--embassy-rp/src/pio.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs
index 5433d3f21..0616f6fc0 100644
--- a/embassy-rp/src/pio.rs
+++ b/embassy-rp/src/pio.rs
@@ -827,8 +827,10 @@ impl<'d, PIO: PioInstance> PioCommon<'d, PIO> {
827 } 827 }
828 } 828 }
829 829
830 // TODO make instruction memory that is currently in use unfreeable 830 /// Free instruction memory previously allocated with [`PioCommon::write_instr`].
831 pub fn free_instr(&mut self, instrs: PioInstanceMemory<PIO>) { 831 /// This is always possible but unsafe if any state machine is still using this
832 /// bit of memory.
833 pub unsafe fn free_instr(&mut self, instrs: PioInstanceMemory<PIO>) {
832 self.instructions_used &= !instrs.used_mask; 834 self.instructions_used &= !instrs.used_mask;
833 } 835 }
834 836