Skip to content

Commit

Permalink
msp432: dma: moved clearing interrupt out of unsafe context
Browse files Browse the repository at this point in the history
  • Loading branch information
lebakassemmerl committed Aug 28, 2020
1 parent eb71fb9 commit dcc10c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chips/msp432/src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,11 @@ pub fn handle_interrupt(int_nr: isize) {
for i in 0..AVAILABLE_DMA_CHANNELS {
let bit = (1 << i) as u32;
if (bit & int) > 0 {
unsafe {
// Clear interrupt-bit
DMA_BASE.int0_clrflg.set(bit);
// Clear interrupt-bit
DMA_BASE.int0_clrflg.set(bit);

// This access must be unsafe because DMA_CHANNELS is a global mutable variable
unsafe {
DMA_CHANNELS[i].handle_interrupt();
}
}
Expand Down

0 comments on commit dcc10c2

Please sign in to comment.