From 05d33b068d2a11b703cd8401e57bfbcb6ece1293 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Wed, 25 Jul 2018 10:57:08 -0500 Subject: [PATCH] Remove unnecessary low power ticker rescheduling Schedule the next OS tick inside of the ticker interrupt rather than in the systick interrupt. Scheduling this while the ticker is dispatching prevents an unnecissary rescheduling since this rescheduling is done anyway when dispatching is finished. This is particularly useful for the low power ticker on devices with LPTICKER_DELAY_TICKS set to a non-zero value. This is because the low power ticker cannot be reschduled immediately and needs to fall back onto the microsecond ticker which temporarily locks deep sleep. Note - the optimization in this commit is made possible by the commit: "Don't reschedule ticker while dispatching" --- rtos/TARGET_CORTEX/SysTimer.cpp | 1 + rtos/TARGET_CORTEX/mbed_rtx_idle.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rtos/TARGET_CORTEX/SysTimer.cpp b/rtos/TARGET_CORTEX/SysTimer.cpp index 0882b7cfb1..d3bcfc689a 100644 --- a/rtos/TARGET_CORTEX/SysTimer.cpp +++ b/rtos/TARGET_CORTEX/SysTimer.cpp @@ -178,6 +178,7 @@ void SysTimer::handler() } else { _set_irq_pending(); _increment_tick(); + schedule_tick(); } core_util_critical_section_exit(); diff --git a/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp b/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp index 83db8253aa..62a78475b5 100644 --- a/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp +++ b/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp @@ -63,7 +63,7 @@ void OS_Tick_Disable (void) /// Acknowledge System Timer IRQ. void OS_Tick_AcknowledgeIRQ (void) { - os_timer->schedule_tick(); + } /// Get System Timer count.