sys/ztimer: fix xtimer_compat

This commit is contained in:
Marian Buschsieweke 2020-12-14 10:18:45 +01:00
parent 581cc641ef
commit 2f7470b3fe
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -19,9 +19,13 @@
#ifndef ZTIMER_XTIMER_COMPAT_H
#define ZTIMER_XTIMER_COMPAT_H
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
/* make sure to overwrite potentially conflicting XTIMER_WIDTH definition from
* board.h by eagerly including it */
#include "board.h"
#include "div.h"
#include "timex.h"
#ifdef MODULE_CORE_MSG
@ -41,6 +45,13 @@ extern "C" {
*/
#ifndef DOXYGEN
/* ztimer clocks with width lower than 32 bit get extended to 32 bit in software
* via ztimer_extend. So no matter what was defined elsewhere, we overwrite it
*/
#ifdef XTIMER_WIDTH
#undef XTIMER_WIDTH
#endif
#define XTIMER_WIDTH (32)
#define XTIMER_MASK (0)
@ -185,6 +196,7 @@ static inline void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout)
static inline void xtimer_set_timeout_flag64(xtimer_t *t, uint64_t timeout)
{
assert(timeout <= UINT32_MAX);
xtimer_set_timeout_flag(t, timeout);
}