aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-05-14 12:20:28 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-05-31 17:24:18 -0400
commit7d1fc98ab041c646767295088952bdabbf941756 (patch)
tree6c14821439cdcfea492fc5c61bffbfa9b2adb896 /libmaple
parentef9ff361423d9788614607864a01bbb708b32664 (diff)
downloadlibrambutan-7d1fc98ab041c646767295088952bdabbf941756.tar.gz
librambutan-7d1fc98ab041c646767295088952bdabbf941756.zip
STM32F1: Fix nvic_irq_disable_all() on some MCUs.
The current implementation only disables the first 64 IRQ lines. This covers all the chips we currently support, but it'll be a nasty surprise if anyone decides to add e.g. connectivity line MCUs (which have more IRQs) in the future. We already have the infrastructure to fix it in a clean way, so we might as well do it now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/stm32f1/include/series/nvic.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/libmaple/stm32f1/include/series/nvic.h b/libmaple/stm32f1/include/series/nvic.h
index acabd93..cdac737 100644
--- a/libmaple/stm32f1/include/series/nvic.h
+++ b/libmaple/stm32f1/include/series/nvic.h
@@ -37,6 +37,7 @@ extern "C"{
#endif
#include <libmaple/libmaple_types.h>
+#include <libmaple/stm32.h>
/**
* @brief STM32F1 interrupt vector table interrupt numbers.
@@ -156,16 +157,13 @@ typedef enum nvic_irq_num {
} nvic_irq_num;
static inline void nvic_irq_disable_all(void) {
- /* Note: This only works up to XL density. The fix for
- * connectivity line is:
- *
- * NVIC_BASE->ICER[2] = 0xF;
- *
- * We don't support connectivity line devices (yet), so leave it
- * alone for now.
- */
+ /* Even low-density devices have over 32 interrupt lines. */
NVIC_BASE->ICER[0] = 0xFFFFFFFF;
NVIC_BASE->ICER[1] = 0xFFFFFFFF;
+#if STM32_NR_INTERRUPTS > 64
+ /* Only some have over 64; e.g. connectivity line MCUs. */
+ NVIC_BASE->ICER[2] = 0xFFFFFFFF;
+#endif
}
#ifdef __cplusplus