mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
ztimer: don't interact with pm_layered if ztimer_ondemand is used
This commit is contained in:
parent
ccbb304eae
commit
904dc0131f
@ -379,8 +379,9 @@ struct ztimer_clock {
|
||||
uint32_t lower_last; /**< timer value at last now() call */
|
||||
ztimer_now_t checkpoint; /**< cumulated time at last now() call */
|
||||
#endif
|
||||
#if MODULE_PM_LAYERED || DOXYGEN
|
||||
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run */
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND || DOXYGEN
|
||||
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run
|
||||
don't use in combination with ztimer_ondemand! */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -228,6 +228,12 @@ config MODULE_ZTIMER_MOCK
|
||||
manually fired to simulate different scenarios and test the ztimer
|
||||
implementation using this as a backing timer.
|
||||
|
||||
config MODULE_ZTIMER_ONDEMAND
|
||||
bool "Run ztimer clocks only on demand"
|
||||
help
|
||||
This ztimer extensions keeps track of ztimer users and may disable
|
||||
underlying peripherals if not users are requiring a ztimer clock.
|
||||
|
||||
config MODULE_ZTIMER_INIT
|
||||
bool
|
||||
|
||||
|
@ -46,7 +46,7 @@ void ztimer_convert_init(ztimer_convert_t *ztimer_convert,
|
||||
.arg = ztimer_convert,
|
||||
},
|
||||
.super.max_value = max_value,
|
||||
# ifdef MODULE_PM_LAYERED
|
||||
# if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
.super.block_pm_mode = ZTIMER_CLOCK_NO_REQUIRED_PM_MODE,
|
||||
# endif
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ void ztimer_convert_frac_init(ztimer_convert_frac_t *self,
|
||||
self->round = freq_self / freq_lower;
|
||||
self->super.super.max_value = UINT32_MAX;
|
||||
}
|
||||
#ifdef MODULE_PM_LAYERED
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
self->super.super.block_pm_mode = ZTIMER_CLOCK_NO_REQUIRED_PM_MODE;
|
||||
#endif
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "kernel_defines.h"
|
||||
#include "irq.h"
|
||||
#ifdef MODULE_PM_LAYERED
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
#include "pm_layered.h"
|
||||
#endif
|
||||
#include "ztimer.h"
|
||||
@ -127,7 +127,7 @@ static void _add_entry_to_list(ztimer_clock_t *clock, ztimer_base_t *entry)
|
||||
|
||||
ztimer_base_t *list = &clock->list;
|
||||
|
||||
#ifdef MODULE_PM_LAYERED
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
/* First timer on the clock's linked list */
|
||||
if (list->next == NULL &&
|
||||
clock->block_pm_mode != ZTIMER_CLOCK_NO_REQUIRED_PM_MODE) {
|
||||
@ -266,7 +266,7 @@ static bool _del_entry_from_list(ztimer_clock_t *clock, ztimer_base_t *entry)
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
#ifdef MODULE_PM_LAYERED
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
/* The last timer just got removed from the clock's linked list */
|
||||
if (clock->list.next == NULL &&
|
||||
clock->block_pm_mode != ZTIMER_CLOCK_NO_REQUIRED_PM_MODE) {
|
||||
@ -286,7 +286,7 @@ static ztimer_t *_now_next(ztimer_clock_t *clock)
|
||||
if (!entry->next) {
|
||||
/* The last timer just got removed from the clock's linked list */
|
||||
clock->last = NULL;
|
||||
#ifdef MODULE_PM_LAYERED
|
||||
#if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
if (clock->block_pm_mode != ZTIMER_CLOCK_NO_REQUIRED_PM_MODE) {
|
||||
pm_unblock(clock->block_pm_mode);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ void ztimer_init(void)
|
||||
CONFIG_ZTIMER_USEC_WIDTH);
|
||||
ztimer_periph_timer_init(&ZTIMER_TIMER, CONFIG_ZTIMER_USEC_DEV,
|
||||
ZTIMER_TIMER_FREQ, WIDTH_TO_MAXVAL(CONFIG_ZTIMER_USEC_WIDTH));
|
||||
# ifdef MODULE_PM_LAYERED
|
||||
# if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
LOG_DEBUG("ztimer_init(): ZTIMER_TIMER setting block_pm_mode to %i\n",
|
||||
CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE);
|
||||
ZTIMER_TIMER_CLK.block_pm_mode = CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE;
|
||||
@ -306,7 +306,7 @@ void ztimer_init(void)
|
||||
CONFIG_ZTIMER_LPTIMER_WIDTH);
|
||||
ztimer_periph_timer_init(&ZTIMER_LPTIMER, CONFIG_ZTIMER_LPTIMER_DEV,
|
||||
ZTIMER_LPTIMER_FREQ, WIDTH_TO_MAXVAL(CONFIG_ZTIMER_LPTIMER_WIDTH));
|
||||
# ifdef MODULE_PM_LAYERED
|
||||
# if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
LOG_DEBUG("ztimer_init(): ZTIMER_LPTIMER setting block_pm_mode to %i\n",
|
||||
CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE);
|
||||
ZTIMER_LPTIMER_CLK.block_pm_mode = CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE;
|
||||
@ -316,7 +316,7 @@ void ztimer_init(void)
|
||||
#if INIT_ZTIMER_RTT
|
||||
LOG_DEBUG("ztimer_init(): initializing rtt\n");
|
||||
ztimer_periph_rtt_init(&ZTIMER_RTT);
|
||||
# ifdef MODULE_PM_LAYERED
|
||||
# if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
LOG_DEBUG("ztimer_init(): ZTIMER_RTT setting block_pm_mode to %i\n",
|
||||
CONFIG_ZTIMER_RTT_BLOCK_PM_MODE);
|
||||
ZTIMER_RTT_CLK.block_pm_mode = CONFIG_ZTIMER_RTT_BLOCK_PM_MODE;
|
||||
@ -326,7 +326,7 @@ void ztimer_init(void)
|
||||
#if INIT_ZTIMER_RTC
|
||||
LOG_DEBUG("ztimer_init(): initializing rtc\n");
|
||||
ztimer_periph_rtc_init(&ZTIMER_RTC);
|
||||
# ifdef MODULE_PM_LAYERED
|
||||
# if MODULE_PM_LAYERED && !MODULE_ZTIMER_ONDEMAND
|
||||
LOG_DEBUG("ztimer_init(): ZTIMER_RTC setting block_pm_mode to %i\n",
|
||||
CONFIG_ZTIMER_RTC_BLOCK_PM_MODE);
|
||||
ZTIMER_RTC_CLK.block_pm_mode = CONFIG_ZTIMER_RTC_BLOCK_PM_MODE;
|
||||
|
Loading…
Reference in New Issue
Block a user