From 7d1fc98ab041c646767295088952bdabbf941756 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 14 May 2012 12:20:28 -0400 Subject: 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 --- libmaple/stm32f1/include/series/nvic.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libmaple/stm32f1') 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 +#include /** * @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 -- cgit v1.2.3