From 410f2dd5a1d8efb7dc74e8f913212f3f282dcc6f Mon Sep 17 00:00:00 2001 From: fenugrec Date: Mon, 27 Jul 2015 17:27:25 -0400 Subject: [PATCH] STM32 timers: avoid RMW when clearing interrupt flags All defined bits are rc_w0. The paranoid version of this would write 0 to the reserved bits (0 is the "reset value"), but this would require knowing which flags are valid on the actual platform, and adding the corresponding macros. --- lib/stm32/common/timer_common_all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stm32/common/timer_common_all.c b/lib/stm32/common/timer_common_all.c index c24bd6ba..3619a234 100644 --- a/lib/stm32/common/timer_common_all.c +++ b/lib/stm32/common/timer_common_all.c @@ -280,7 +280,8 @@ tim_reg_base void timer_clear_flag(uint32_t timer_peripheral, uint32_t flag) { - TIM_SR(timer_peripheral) &= ~flag; + /* All defined bits are rc_w0 */ + TIM_SR(timer_peripheral) = ~flag; } /*---------------------------------------------------------------------------*/