Skip to content

Commit

Permalink
[stm32] [dma] [irq] Check for pointer first for speed
Browse files Browse the repository at this point in the history
In case of IRQ for transferComplete is used and halfTransferComplete is
not used:

HT_Flag is always/mostly set when TC_Flag is set.
So checking the flag first is wasting time.

In case that TC_Flag is set and halfTransferComplete is used, IRQ
latency stays the same with this change.
  • Loading branch information
strongly-typed committed Feb 28, 2023
1 parent 756b0a5 commit d982a85
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modm/platform/dma/stm32/dma.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,12 @@ public:
if (transferError)
transferError();
}
if ((isr & HT_Flag) and halfTransferComplete)
if (halfTransferComplete and (isr & HT_Flag)) {
halfTransferComplete();
if ((isr & TC_Flag) and transferComplete)
}
if (transferComplete and (isr & TC_Flag)) {
transferComplete();
}

ControlHal::clearInterruptFlags(InterruptFlags::Global, ChannelID);
}
Expand Down

0 comments on commit d982a85

Please sign in to comment.