1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

Merge pull request #14783 from maribu/xtimer_on_ztimer_fix

sys/{ztimer, xtimer}: Fix issues with xtimer_on_ztimer
This commit is contained in:
Francisco 2020-08-19 13:28:10 +02:00 committed by GitHub
commit 70fc19258f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -1050,7 +1050,7 @@ ifneq (,$(filter periph_uart_nonblocking,$(USEMODULE)))
endif
# include ztimer dependencies
ifneq (,$(filter ztimer%,$(USEMODULE)))
ifneq (,$(filter ztimer% %ztimer,$(USEMODULE)))
include $(RIOTBASE)/sys/ztimer/Makefile.dep
endif

View File

@ -590,14 +590,14 @@ static inline int xtimer_msg_receive_timeout64(msg_t *msg, uint64_t timeout);
*/
#define XTIMER_HZ_BASE (1000000ul)
#ifndef XTIMER_HZ
#if !defined(XTIMER_HZ) && !defined(MODULE_XTIMER_ON_ZTIMER)
/**
* @brief Frequency of the underlying hardware timer
*/
#define XTIMER_HZ XTIMER_HZ_BASE
#endif
#ifndef XTIMER_SHIFT
#if !defined(XTIMER_SHIFT) && !defined(MODULE_XTIMER_ON_ZTIMER)
#if (XTIMER_HZ == 32768ul)
/* No shift necessary, the conversion is not a power of two and is handled by
* functions in tick_conversion.h */
@ -634,7 +634,7 @@ static inline int xtimer_msg_receive_timeout64(msg_t *msg, uint64_t timeout);
#else
#error "XTIMER_SHIFT cannot be derived for given XTIMER_HZ, verify settings!"
#endif
#else
#elif !defined(MODULE_XTIMER_ON_ZTIMER)
#error "XTIMER_SHIFT is set relative to XTIMER_HZ, no manual define required!"
#endif

View File

@ -77,7 +77,7 @@ static inline uint64_t _xtimer_usec_from_ticks64(uint64_t ticks) {
return (ticks << XTIMER_SHIFT); /* multiply by power of two */
}
#endif /* defined(XTIMER_SHIFT) && (XTIMER_SHIFT != 0) */
#elif XTIMER_HZ == (1000000ul)
#elif (XTIMER_HZ == (1000000ul)) || defined(MODULE_XTIMER_ON_ZTIMER)
/* This is the most straightforward as the xtimer API is based around
* microseconds for representing time values. */
static inline uint32_t _xtimer_usec_from_ticks(uint32_t ticks) {

View File

@ -485,6 +485,7 @@ void ztimer_update_head_offset(ztimer_clock_t *clock);
*/
void ztimer_init(void);
#if defined(MODULE_ZTIMER_EXTEND) || defined(DOXYGEN)
/**
* @brief Initialize possible ztimer extension intermediate timer
*
@ -501,6 +502,7 @@ static inline void ztimer_init_extend(ztimer_clock_t *clock)
clock->ops->set(clock, clock->max_value >> 1);
}
}
#endif /* MODULE_ZTIMER_EXTEND */
/* default ztimer virtual devices */
/**