[riot-notifications] [RIOT] xtimer: Add support for arbitrary frequency hardware timers (32768 Hz support) (#3990)

Joakim NohlgÄrd notifications at github.com
Wed Sep 30 11:07:54 CEST 2015


> +    /* Same principle as the 32 bit version. */
> +    /* Magic number taken from a disassembly of GCC's output on x86_64 for the
> +     * below line:
> +     *
> +     * return (usec * 512) / 15625;
> +     */
> +    /* Saves around 1400 bytes of ROM on Cortex-M platforms (both ARMv6 and
> +     * ARMv7) from avoiding linking against __aeabi_uldivmod and related helpers
> +     */
> +    return ((uint64_t)(us << 9) * 0x431bde82d7b634dbull) >> 12;
> +}
> +
> +inline static uint32_t _xtimer_ticks_to_us(uint32_t ticks) {
> +    /* Using 64 bit multiplication to avoid truncating the top 9 bits */
> +    uint64_t us = (uint64_t)ticks * 15625ul;
> +    return us >> 9;

Right-o, will update

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3990/files#r40772612
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150930/8a642dce/attachment-0001.html>


More information about the notifications mailing list