Created
March 21, 2018 09:52
-
-
Save utzig/0e7c77d0e7e39ae99b66acfe4adbd61a to your computer and use it in GitHub Desktop.
Do not disable tick interrupt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h b/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h | |
index 0b24798dc..7c0f41287 100644 | |
index 0b24798dc..7c0f41287 100644 | |
--- a/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h | |
+++ b/hw/mcu/stm/stm32f3xx/include/mcu/stm32f3xx_mynewt_hal.h | |
@@ -27,21 +27,23 @@ | |
extern "C" { | |
#endif | |
+/* PendSV has the highest prio, followed by SysTick */ | |
+#define OS_TICK_PRIO ((1 << __NVIC_PRIO_BITS) - 2) | |
+ | |
/* Helper functions to enable/disable interrupts. */ | |
#define __HAL_DISABLE_INTERRUPTS(x) \ | |
do { \ | |
- x = __get_PRIMASK(); \ | |
- __disable_irq(); \ | |
+ x = __get_BASEPRI(); \ | |
+ __set_BASEPRI(OS_TICK_PRIO + 1); \ | |
} while(0); | |
#define __HAL_ENABLE_INTERRUPTS(x) \ | |
do { \ | |
if (!x) { \ | |
- __enable_irq(); \ | |
+ __set_BASEPRI(0); \ | |
} \ | |
} while(0); | |
- | |
int hal_gpio_init_stm(int pin, GPIO_InitTypeDef *cfg); | |
int hal_gpio_deinit_stm(int pin, GPIO_InitTypeDef *cfg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment