mbed-os/hal/source
Kevin Bracey 904d4e4d2b Make ticker computation use shift-by-0
Runtime code that analysed clock frequency to determine numerator and
denominator for conversion to standard 1MHz failed to handle the case
of either being 1 correctly.

Although it would spot other values that could be performed as shifts,
it failed to spot that 1 is "shift by 0", so would end up doing runtime
multiply and/or divide by 1. The runtime divide by 1 could be slow on a
Cortex-M0 device, increasing interrupt latency.

UART character loss on STM32F0 devices has been traced to this incorrect
code.

Correct the `exact_log2` routine so that `exact_log2(1)` returns 0 to
fix this.

Original code had a single special no-multiply-or-divide case for
hardware clock frequency being exactly 1MHz, as USTICKER is on STM32F0 -
this code lacks that but has a more general special case that covers all
shift-convertible frequencies like 500kHz or 8MHz, which should be
similar speed as shifts are cheap.
2021-04-12 09:46:42 +03:00
..
mpu Change MBED_STATIC_ASSERTs version for built-in 2020-10-27 08:30:40 -05:00
LowPowerTickerWrapper.cpp Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_compat.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_critical_section_api.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_flash_api.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_gpio.c New lines 2021-03-18 17:01:54 +00:00
mbed_gpio_irq.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_itm_api.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_lp_ticker_api.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_lp_ticker_wrapper.cpp Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_pinmap_common.c Refactor hal directory 2020-08-25 14:57:07 +01:00
mbed_pinmap_default.cpp Rename USBTX/RX to CONSOLE_TX/RX 2021-03-18 17:01:54 +00:00
mbed_ticker_api.c Make ticker computation use shift-by-0 2021-04-12 09:46:42 +03:00
mbed_us_ticker_api.c Refactor hal directory 2020-08-25 14:57:07 +01:00
static_pinmap.cpp add opsi driver 2020-09-16 11:27:23 +08:00