summaryrefslogtreecommitdiff
path: root/stmhal/stm32_it.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-11-24 16:18:07 +0000
committerDamien George <damien.p.george@gmail.com>2015-11-24 16:18:07 +0000
commite99e6c883d70eda894aba124c8ee0495dc90c350 (patch)
tree3899eb1ef11b86fa1316999eaaedc8f1a2798104 /stmhal/stm32_it.c
parent3cfb02f1663fbf3a6d7ae367974d0984d3424806 (diff)
stmhal: Move flash storage idle tick handler from TIM3 to SysTick.
Using SysTick to do the counting and dispatch of the flash storage idle handler is more efficient than requiring a dedicated hardware timer. No new counter is needed, just the existing uwTick variable. The processing is not actually done in the SysTick IRQ, it is deferred to the flash IRQ (which runs at lower priority).
Diffstat (limited to 'stmhal/stm32_it.c')
-rw-r--r--stmhal/stm32_it.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c
index aaa1aaca7..90826a570 100644
--- a/stmhal/stm32_it.c
+++ b/stmhal/stm32_it.c
@@ -269,10 +269,15 @@ void SysTick_Handler(void) {
// work properly.
SysTick->CTRL;
- // Right now we just have the DMA controllers to process during this
- // interrupt and we use a custom dispatch handler. If this needs to
+ // Right now we have the storage and DMA controllers to process during
+ // this interrupt and we use custom dispatch handlers. If this needs to
// be generalised in the future then a dispatch table can be used as
// follows: ((void(*)(void))(systick_dispatch[uwTick & 0xf]))();
+
+ if (STORAGE_IDLE_TICK(uwTick)) {
+ NVIC->STIR = FLASH_IRQn;
+ }
+
if (DMA_IDLE_ENABLED() && DMA_IDLE_TICK(uwTick)) {
dma_idle_handler(uwTick);
}