summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-02-01 00:32:43 -0800
committerKeith Packard <keithp@keithp.com>2014-02-08 20:13:38 -0800
commit324073d14ed8215b74d9df51f2229827cd4401d0 (patch)
treef8b14b6b2e07c6c1d36d79e4d34a03c2eba376de
parentd6d56c20465455b759f60a03fc96aa228ab9102e (diff)
altos/stm: Block interrupts while reprogramming flash
Wouldn't work well to get interrupted... Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/stm/ao_flash_stm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stm/ao_flash_stm.c b/src/stm/ao_flash_stm.c
index 38b1c2d8..39dc8144 100644
--- a/src/stm/ao_flash_stm.c
+++ b/src/stm/ao_flash_stm.c
@@ -83,12 +83,14 @@ _ao_flash_erase_page(uint32_t *page)
void
ao_flash_erase_page(uint32_t *page)
{
+ ao_arch_block_interrupts();
ao_flash_pecr_unlock();
ao_flash_pgr_unlock();
_ao_flash_erase_page(page);
ao_flash_lock();
+ ao_arch_release_interrupts();
}
static void __attribute__ ((section(".ramtext"), noinline))
@@ -116,6 +118,8 @@ ao_flash_page(uint32_t *page, uint32_t *src)
uint8_t h;
ao_flash_erase_page(page);
+
+ ao_arch_block_interrupts();
ao_flash_pecr_unlock();
ao_flash_pgr_unlock();
for (h = 0; h < 2; h++) {
@@ -124,4 +128,5 @@ ao_flash_page(uint32_t *page, uint32_t *src)
src += 32;
}
ao_flash_lock();
+ ao_arch_release_interrupts();
}