aboutsummaryrefslogtreecommitdiff
path: root/stmhal/stm32_it.c
diff options
context:
space:
mode:
authorDave Hylands2015-11-15 17:02:43 -0800
committerDamien George2015-11-24 09:37:25 +0000
commitb677f03407c1b35fcfc4d6948a34a4281033865a (patch)
tree3ee39f6ccda7e24676fc7257876a43ceaf5f03ba /stmhal/stm32_it.c
parent9f5486c7e2928435362b7ae06f0d678a4798693a (diff)
stmhal: Turn off DMA clocks when idle for 100 msec
Turning on each DMA block increases the current consumption by about 8 mA. This code adds an idle timer for each DMA block and turns off the clocks when no streams are in use for 128 msec. Having a small timeout allows for improved performance when back-to-back transfers are being performed. The 128 msec is basically a guess.
Diffstat (limited to 'stmhal/stm32_it.c')
-rw-r--r--stmhal/stm32_it.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c
index 14049fe6d..8a00c1469 100644
--- a/stmhal/stm32_it.c
+++ b/stmhal/stm32_it.c
@@ -77,6 +77,7 @@
#include "uart.h"
#include "storage.h"
#include "can.h"
+#include "dma.h"
extern void __fatal_error(const char*);
extern PCD_HandleTypeDef pcd_handle;
@@ -267,6 +268,10 @@ void SysTick_Handler(void) {
// the COUNTFLAG bit, which makes the logic in sys_tick_get_microseconds
// work properly.
SysTick->CTRL;
+
+ if (DMA_IDLE_ENABLED() && DMA_IDLE_TICK(uwTick)) {
+ dma_idle_handler();
+ }
}
/******************************************************************************/