mbed-os/hal
Przemyslaw Stekiel 869585a196 Ticker common layer: run interrupt reschedule if the inserted event has already expired.
On some platforms, if low power ticker interrupt is set to very close value (e.g. timestamp < current tick + 3), then interrupt may not fire. This is one use case of lp ticker wrapper, but not all platforms use the wrapper. Some platforms cheat a bit and in this case, simply schedules interrupt a bit later. The problem has been found while working on the low-level lp ticker wrapper for ST boards which run lp ticker using LPTIM. These platforms have such limitation.

Failing test: tests-mbed_drivers-lp_timeout (Test Case: Zero delay)

In the test scenarion, the lp ticker callback is attached with 0.0 s delay in the loop. The new events are put in the front of the lp ticker event list and interrupt reschedule is performed. Usually, the new event is already expired, interrupt fires immediately and next event from the list is then scheduled (e.g. system tick). When the next event (e.g. system tick) is very close to the current time it might be scheduled a bit later (because of lp ticker limitation). Let's assume that system tick has been delayed by 3 ticks and while inserting new zero delay event, absolute system tick time on the event list has already expired. In this case, zero delay event may be added after the expired system tick event and no reschedule is performed (because the head of the list has not changed). Interrupt also didn't fire yet since it has been delayed, so after return from attach_callback(0) we are still waiting for the delayed interrupt and zero delay callback has not been called instantly.

This may also affect other platforms which use such delays (Cypress, NORDIC, etc.).

The proposition is to add extra condition while adding an event to the event list. If the inserted event is already expired, then perform reschedule immediately.
2019-06-04 08:50:22 +02:00
..
TARGET_FLASH_CMSIS_ALGO hal: add spdx license 2018-11-28 10:39:51 +00:00
mpu Fix target.mpu-rom-end setting, for ARMv8-M too 2018-12-12 15:44:21 +02:00
storage_abstraction Removed bad \ref tag, but left in the tag name. Updated old param names in gpio_api.h and added new params in ticker_api.h 2017-06-08 15:52:31 -05:00
LowPowerTickerWrapper.cpp Update Ticker wrapper to handle early interrupts 2018-12-03 17:55:22 -06:00
LowPowerTickerWrapper.h hal: add spdx license 2018-11-28 10:39:51 +00:00
analogin_api.h Add HAL API for analog in pinmap 2019-02-08 09:09:51 -06:00
analogout_api.h Add HAL API for analog out pinmap 2019-02-08 09:10:05 -06:00
buffer.h hal: add spdx license 2018-11-28 10:39:51 +00:00
can_api.h Add HAL API for can pinmap 2019-02-08 09:10:10 -06:00
can_helper.h hal: add spdx license 2018-11-28 10:39:51 +00:00
crc_api.h Don't use define checks on DEVICE_FOO macros (mbed code) 2018-12-20 10:16:42 +11:00
critical_section_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
dma_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
ethernet_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
flash_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
gpio_api.h Add GPIO NC test 2019-05-02 16:12:21 +03:00
gpio_irq_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
i2c_api.h Add HAL API for i2c pinmap 2019-02-08 09:10:12 -06:00
itm_api.h Don't use define checks on DEVICE_FOO macros (mbed code) 2018-12-20 10:16:42 +11:00
lp_ticker_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
mbed_critical_section_api.c critical sections: remove unnecessary volatile 2019-01-03 11:06:44 +02:00
mbed_flash_api.c hal: add spdx license 2018-11-28 10:39:51 +00:00
mbed_gpio.c hal: add spdx license 2018-11-28 10:39:51 +00:00
mbed_itm_api.c Don't use define checks on DEVICE_FOO macros (mbed code) 2018-12-20 10:16:42 +11:00
mbed_lp_ticker_api.c Timer: remove hard-coded lp_ticker knowledge 2019-03-20 10:18:49 +02:00
mbed_lp_ticker_wrapper.cpp Timer: remove hard-coded lp_ticker knowledge 2019-03-20 10:18:49 +02:00
mbed_lp_ticker_wrapper.h hal: add spdx license 2018-11-28 10:39:51 +00:00
mbed_pinmap_common.c Add pinmap utility functions 2019-02-08 09:10:44 -06:00
mbed_pinmap_default.c Add form factor pinmap support 2019-02-08 09:10:45 -06:00
mbed_ticker_api.c Ticker common layer: run interrupt reschedule if the inserted event has already expired. 2019-06-04 08:50:22 +02:00
mbed_us_ticker_api.c Merge pull request #10150 from kjbracey-arm/timer_sleepcheck 2019-03-28 17:09:36 -05:00
mpu_api.h Save ROM by specifying initial MPU state 2018-12-10 15:53:34 +02:00
pinmap.h Add form factor pinmap support 2019-02-08 09:10:45 -06:00
port_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
pwmout_api.h Add HAL API for pwmout pinmap 2019-02-08 09:10:19 -06:00
qspi_api.h Add HAL API for qspi pinmap 2019-02-08 09:10:25 -06:00
rtc_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
serial_api.h Add HAL API for serial pinmap 2019-02-08 09:10:28 -06:00
sleep_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
spi_api.h Rename SPI_COUNT to DEVICE_SPI_COUNT 2019-03-01 14:37:04 +02:00
spm_api.h set proper groups for spm and HAL 2018-11-28 12:17:37 +02:00
ticker_api.h Timer: remove hard-coded lp_ticker knowledge 2019-03-20 10:18:49 +02:00
trng_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00
us_ticker_api.h hal: add spdx license 2018-11-28 10:39:51 +00:00