1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

150 Commits

Author SHA1 Message Date
Francisco Molina
dd03d8c362 sys/ztimer: ztimer_set return the now value 2021-12-13 11:21:23 +01:00
Leandro Lanzieri
1733953b49
sys/ztimer: fix backend selection 2021-12-10 09:57:05 +01:00
d959ce7eea
Merge pull request #16928 from kaspar030/ztimer64
sys/ztimer64: initial PR
2021-12-09 10:17:15 +01:00
Benjamin Valentin
64bd80d389 ztimer_periodic: make callback function return bool
The callback function of `ztimer_periodic` is only expected to have
two states.
So let it return `true` if the timer should keep repeating, `false`
otherwise.
2021-12-08 00:10:55 +01:00
Francisco Molina
b65ab31971 sys/ztimer/periodic: always set timer->last, no ztimer_now on last call 2021-12-07 19:42:45 +01:00
495a48af0f sys/ztimer: add ZTIMER_PERIPH_TIMER_OFFSET 2021-12-07 11:06:07 +01:00
Francisco
662aba4680
Merge pull request #17307 from leandrolanzieri/pr/sys/ztimer/kconfig/fix_compat_deps
sys/ztimer/kconfig: enable xtimer compat only with timer backend
2021-12-02 14:52:30 +01:00
b6cc07009f
Merge pull request #17284 from fjmolinas/pr_ztimer_no_periph_rtt
sys/ztimer: add 'ztimer_no_periph_rtt'
2021-12-02 11:02:24 +01:00
Leandro Lanzieri
004da59672
sys/ztimer/kconfig: enable xtimer compat only with timer backend
This also moves the selection of MODULE_ZTIMER_PERIPH_TIMER from
MODULE_ZTIMER_USEC to the visible symbol ZTIMER_USEC.
2021-12-02 09:38:06 +01:00
Francisco Molina
638373eec5 sys/ztimer: add ztimer_periph_rtt module conflict warning 2021-12-02 07:54:38 +01:00
Francisco Molina
7c3360e4d6 sys/ztimer: add 'ztimer_no_periph_rtt'
This is a temporary fix for Issue #17060. It allows to disable
auto inclusion of `ztimer_periph_rtt` in cases where another
module or application requires direct access.

Limitations:
- as ifeq are involved order of inclusion matters, therefore
  these modules should be included early in the build at application
  level and not in modules `Makefile.dep`
- this does not disallow direct inclusions of `ztimer_periph_rtt`,
  since this only disables auto inclusion of these modules

This is a temporary solution since this is already possible with
Kconfig, but not in make.
2021-12-02 07:54:38 +01:00
Francisco Molina
d0758b5a7e sys/ztimer: remove double ztimer indirection
To avoid confusions between `auto_init_ztimer` and `ztimer_auto_init`
rename `ztimer_auto_init` to `ztimer_init`.

This allows for similar handling as `saul_init_devs` and
`auto_init_devs`. Dependencies are therefore done against the USEMODULE
and not DEFAULT_MODULE or checking DISABLE_MODULE. For this, both
`ztimer_init` and `auto_init_ztimer` are added to DEFAULT_MODULE and
both need disabling if the user does not want that module in.

With this, the comment in Kconfig no longer applies.
2021-11-25 11:26:34 +01:00
4c03d10f7b
Merge pull request #17234 from fjmolinas/pr_cocci_ztimer_fixes
sys/ztimer/xtimer2ztimer.cocci: extend and fix api replacements
2021-11-19 15:18:07 +01:00
Francisco Molina
e6a79c8729 sys/ztimer/xtimer2ztimer.cocci: extend and fix api replacements 2021-11-18 18:27:23 +01:00
Karl Fessel
eb11e463df sys/ztimer: make internal head update static 2021-11-18 13:45:49 +01:00
Leandro Lanzieri
703e66b4c1
sys/ztimer/kconfig: change entry point 2021-11-09 15:32:34 +01:00
Leandro Lanzieri
3837286750
sys/{x,z}timer/Kconfig: fix compatibility modules 2021-11-09 15:32:33 +01:00
Francisco Molina
2e4dfa0aac sys/ztimer: don't default to rtc for ztimer_sec 2021-11-02 15:31:04 +01:00
Leandro Lanzieri
f64b166319
Merge pull request #16845 from MrKevinWeiss/pr/kconfig/supportstms
.murdock: Add nucleo boards to kconfig test
2021-11-01 09:55:22 +01:00
261a615439
ztimer: Use auto_init for manual init in bootloaders 2021-10-25 22:24:07 +02:00
MrKevinWeiss
9b6a63a951
drivers/kconfig: simplify shared rtt/rtc hardware in kconfig 2021-10-14 11:28:46 +02:00
MrKevinWeiss
c7820cf7e5
*/rtt|rtc: Fix Kconfig modeling 2021-10-14 11:28:44 +02:00
Leandro Lanzieri
34259e1e29
sys/ztimer: add dependencies for ztimer_sec 2021-10-01 11:26:12 +02:00
José Alamos
1ee57f80a0
Merge pull request #15030 from jia200x/pr/lora/remove_xtimer
drivers/sx127x: remove ZTIMER_USEC dependency
2021-09-27 11:41:22 +02:00
MrKevinWeiss
214b19551d
sys/ztimer: Fix stm32f1 naming for kconfig 2021-07-02 15:11:11 +02:00
Jose Alamos
94d46e756e
cpu/fe310: fix RTT frequency 2021-07-02 14:53:22 +02:00
Francisco
bc5810ea33
Merge pull request #16573 from kfessel/p-convert-ztimer-require-no-pm
sys/ztimer: convert clock do not require pm
2021-06-28 10:03:27 +02:00
Karl Fessel
a6a53c98f7 sys/ztimer: convert clock do not require pm
avoid blocking and unblocking of power_mode 0 for convert clocks
2021-06-21 13:56:03 +02:00
Francisco Molina
beee6fdffb
sys/ztimer: use highest frequency for nrf51 as well 2021-06-18 14:14:09 +02:00
Francisco Molina
c80390f28b
ztimer: pull ztimer_periph_rtt for ZTIMER_MSEC if available 2021-06-16 11:18:25 +02:00
88b509e56d ztimer: correctly unset timer->next (fix ztimer_is_set())
ztimer's machinery depends on figuring out if a timer is currently set
or not. It does that using _is_set(), which is also exposed as
ztimer_is_set().
Now when a timer expired and got taken of the timer queue using
_now_next(), the `next` pointer wasn't unset. This caused _is_set() to
wrongly return `true` for that timer.
Internally in ztimer, this didn't cause breakage, just an unnecessary
iteration of the timer queue by _delete_timer_from_list().
But this also broke the public ztimer_is_set().

This commit fixes the issue by correctly NULLing the timer's `next`
pointer when the timer triggers.
2021-04-22 11:06:04 +02:00
Karl Fessel
951fa14d70 sys/ztimer: rename required_pm_mode to block_pm_mode 2021-04-06 16:57:53 +02:00
Francisco
9d1d2f9e21
Merge pull request #16172 from kfessel/p-zimer-sec
sys/ztimer: add ZTIMER_SEC, improve auto_init
2021-04-02 08:32:38 +02:00
Karl Fessel
3f66735bde ztimer/periph_rtc: intialize struct tm to avoid TZ and IDST problems
{ .elem = 0 }  initializes the complete struct to 0
{} is not ISO C conform
2021-04-01 18:19:15 +02:00
Karl Fessel
9e7f1d0097 sys/ztimer: add ZTIMER_SEC to Kconfig 2021-04-01 18:19:15 +02:00
Karl Fessel
0b5709a853 ztimer/periph_rtc: count months from 0
contrary to the western civilised world struct tm requires
us to count months from 0
2021-04-01 18:19:15 +02:00
Karl Fessel
aa770fdd8c ztimer/auto_init: restructure for flexibitily, pm for ZTIMER_SEC
MSEC and SEC are now usable on TIMER(0) without having USEC
pm is configured by used hardware
    OLD configuration values are translated for backward compatibility
prefer rtt for ZTIMER_SEC

avoid doing partial ztimer setup if auto_init_ztimer is disabled

before this patch some const pointers might have been definend to values
that a user who disables auto_init for ztimer does not like.
2021-04-01 18:19:01 +02:00
Jnae
b1aaa974bd sys/ztimer: add periph_ptp backend 2021-03-28 15:50:19 +02:00
Marian Buschsieweke
da76ca68db sys/ztimer: add ZTIMER_SEC
wire up ZTIMER_SEC to the existing RTC backend, or RTT backend, or periph_timer
backend (in this order of preference).

Update sys/ztimer/auto_init.c

Co-authored-by: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
2021-03-08 15:11:53 +01:00
Leandro Lanzieri
6a0240d04b
sys/ztimer/kconfig: add defaults for backends 2021-03-04 10:48:27 +01:00
Martine Lenders
6da60c933d
Merge pull request #15802 from miri64/treewide/cleanup/cppcheck-whitelisted
treewide: re-uncrustify whitelisted files
2021-02-03 07:59:27 +01:00
Martine Lenders
7e3846b6a4
ztimer: apply uncrustify patches 2021-02-02 22:21:15 +01:00
Vincent Dupont
751a366931 ztimer: fix uncrustify issue in util.c 2021-02-02 10:52:10 +01:00
Vincent Dupont
fb4d2e509a ztimer: add ztimer_rmutex_lock_timeout()
Similar to xtimer_rmutex_lock_timeout()
2021-02-02 10:51:50 +01:00
Francisco
5c5ec632a5
Merge pull request #15716 from leandrolanzieri/pr/kconfig/ztimer
sys/ztimer: add modules to Kconfig
2021-01-20 15:31:20 +01:00
Hauke Petersen
f5de257d58 ztimer: expose ztimer_is_set() to public API 2021-01-18 17:50:50 +01:00
Leandro Lanzieri
6625a15bf6
sys/ztimer: add modules to Kconfig 2021-01-18 14:14:13 +01:00
Marian Buschsieweke
d48fac278b
sys/ztimer: drop unused internal typedef 2020-12-08 22:54:39 +01:00
Marian Buschsieweke
71a0c53df2
sys/ztimer: Add ztimer_mutex_lock_timeout() 2020-12-08 22:54:39 +01:00
7fe0d5cba8 sys/ztimer: add missing inttypes.h includes 2020-11-26 13:43:13 +01:00
Bas Stottelaar
922e2ac1c9 sys/*: replace #if ENABLE_DEBUG with IS_ACTIVE 2020-11-02 21:49:39 +01:00
Marian Buschsieweke
b48679e497
sys/ztimer: Use uint32_t for freq in periph_timer
Now that timer_init() of periph_timer uses uint32_t for the frequency, ztimer
should do the same.
2020-10-30 22:02:12 +01:00
Bas Stottelaar
1b35d06a51 sys/*: realign ENABLE_DEBUG 2020-10-23 11:27:48 +02:00
Bas Stottelaar
ffb929d811 sys/*: remove unused assert.h include 2020-10-22 11:29:27 +02:00
44f8d82571
sys/ztimer: fix typo 'functinality' -> 'functionality' 2020-10-02 08:16:14 +02:00
2dab6c7b30
Merge pull request #15111 from maribu/xtimer-assert
sys/{x,z}timer: assert() successful initialization of periph_timer
2020-09-30 08:52:34 +02:00
aa6e64316c
Merge pull request #15053 from kaspar030/ztimer_periodic
sys/ztimer: add periodic timers API
2020-09-29 23:58:51 +02:00
548c4f02fc sys/ztimer: add ztimer_periodic 2020-09-29 23:04:39 +02:00
Marian Buschsieweke
a6dc9bdb2d
sys/ztimer: assert() successful initialized
Use an `assert()` to make sure that `periph_timer` was successfully initialized.
2020-09-29 11:52:26 +02:00
Juergen Fitschen
62fb4a2ade
Merge pull request #13661 from jue89/feature/evtimer_on_ztimer
sys/evtimer: introduce ZTIMER_MSEC as timer backend
2020-09-27 14:07:04 +02:00
Juergen Fitschen
c3a20f8fb8 sys/evtimer: introduce ZTIMER_MSEC as timer backend 2020-09-24 11:30:26 +02:00
e719eaf97c
Merge pull request #15003 from kaspar030/ztimer_now64_tick
ztimer/core: ensure half-period tick when ztimer_now64 is used
2020-09-23 14:14:52 +02:00
18852cf30c ztimer/core: ensure half-period tick when ztimer_now64 is used 2020-09-23 13:11:29 +02:00
Francisco
f3a5ee69e0
Merge pull request #14936 from kaspar030/ztimer_sleep_adjust
sys/ztimer: allow compensation of ztimer_sleep() overhead
2020-09-22 14:56:56 +02:00
0ee2a8fa5f sys/ztimer: fix auto_init doc 2020-09-14 18:05:09 +02:00
ff1ea0bfb1 ztimer: use uint32_t in ztimer_periodic_wakeup
This ensures compatibility with xtimer_periodic_wakeup() in case
ztimer_now64 is used.
2020-09-10 23:39:48 +02:00
2fbd85b798 sys/ztimer: allow compensation of ztimer_sleep() overhead 2020-09-09 12:50:51 +02:00
Marian Buschsieweke
3b6fa61829
sys: Cleanup access to internal variables
Replace direct accesses to sched_active_thread and sched_active_pid with
the helper functions thread_getpid() and thread_get_active(). This serves
two purposes:

1. It makes accidental writes to those variable from outside core less likely.
2. Casting off the volatile qualifier is now well contained to those two
   functions
2020-08-24 20:28:11 +02:00
f1d5e98c81
sys/ztimer: fix ztimer msec convert for 250kHz timers 2020-08-20 13:41:40 +02:00
fa2c8b01f4
sys/ztimer: fix missing include for periph_rtt submodule 2020-07-17 20:10:27 +02:00
Francisco
a665fcc542
Merge pull request #14123 from jue89/fix/ztimer_pseudomodules
ztimer: relocate PSEUDOMODULES definitions
2020-06-24 22:56:07 +02:00
56962f86fb
Merge pull request #14293 from kaspar030/fix_ztimer_frac_slowdown_max_value
ztimer: convert_frac: use self->scale_now for max_value
2020-06-16 19:30:54 +02:00
1ff609167e ztimer: convert_frac: use self->scale_now for max_value
When using convert_frac to slow down a timer, the extension machinery is
used to prevent converting values that would be larger than, after
conversion, 2**32. In order to calculate the maximum value, UINT32_MAX
is converted.

Previously, this was mistakenly converted by multiplying with the
fraction used to scale up a value. E.g., when using convert_frac to
slow down a 1us timer to provide a 1ms timer, UINT32_MAX was multiplied
by 1000. As the result is used % UINT32_MAX, this lead to a wrong value
close to UINT32_MAX, as ((UINT32_MAX * N) % UINT32_MAX = (UINT32_MAX - N - 1)).

This PR fixes the calculation so max_value is determined by multiplying
with the fraction used to scale down a value.
2020-06-16 12:24:11 +02:00
Francisco Molina
8d329942df
drivers/periph/rtt: introduce RTT_MIN_OFFSET 2020-06-11 09:30:25 +02:00
Juergen Fitschen
b098108c99 ztimer_xtimer_compat: move PSEUDOMODULES definition to Makefile.include 2020-05-23 16:50:24 +02:00
Juergen Fitschen
5a54c29f09 xtimer_on_ztimer: move PSEUDOMODULES definition to pseudomodules.inc.mk 2020-05-23 16:37:45 +02:00
bf35edf3c6
Merge pull request #14036 from jue89/fix/xtimer_on_ztimer
ztimer: pull in xtimer_on_ztimer only if ztimer_periph_timer is used
2020-05-19 12:26:12 +02:00
ba9afe98c3 sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
Juergen Fitschen
bb0f7e5014 ztimer: pull in xtimer_on_ztimer only if ztimer_usec is used 2020-05-06 20:18:13 +02:00
Francisco Molina
95e2221003
sys/ztimer/auto_init: use default configuration header 2020-05-06 11:27:10 +02:00
Francisco Molina
a1f3a8d668
sys/ztimer: expose ZTIMER_MSEC/USEC_BASE
ztimer_clock are meant to be chained. At the end of the chaine
there is always a timer device object (periph_rtt/rtc/timer).

Since ZTIMER_MSEC and ZTIMER_USEC can be the scaled/shifted with
respect to the base periph_rtt/rtc/timer it makes sense to chain
other ZTIMER_XXX on top of the base rtc/timer/rtt in order to avoid
chained convertions.
2020-05-06 11:22:40 +02:00
benpicco
775b43fbd4
Merge pull request #13967 from fjmolinas/pr_ztimer_rtt_auto_init
sys/ztimer/auto_init: fix rtt auto_init
2020-05-05 14:34:48 +02:00
fc68d9c3a3 sys/ztimer: properly initialize intermediate extension callback 2020-05-04 17:25:27 +02:00
benpicco
f42b4b4d2f
Merge pull request #13722 from jue89/feature/ztimer_pm-layered
sys/ztimer: add power management for ztimer clocks
2020-05-01 14:12:45 +02:00
Juergen Fitschen
73e22612e2 sys/ztimer: add power management for ztimer clocks 2020-04-29 10:55:10 +02:00
Francisco Molina
da7e14dc66
sys/ztimer/auto_init: fix rtt auto_init 2020-04-28 09:11:44 +02:00
d8c129fc47 ztimer: periph_rtt: ensure RTT_MAX_VALUE is honored
Previously, ztimer would happily set an absolute RTT alarm value that exceeds
RTT's maximum value (though not a longer interval), as the `val` was
simply added to `rtt_get_counter()`.
This commit ensures that the target value wraps around RTT_MAX_VALUE.

Fixes #13920.
2020-04-23 16:19:25 +02:00
Francisco Molina
2331448644
Makefile: remove usage of SUBMODULES_NOFORCE
With #10970 only existing *.c files will be added to SRC when using
the SUBMODULES mechanism, so SUBMODULES_NOFORCE (used to filter out
non existing source files) is now redundant so remove the usage.
2020-04-15 12:11:44 +02:00
b45f4236de sys/ztimer: make ztimer_overhead() return signed value (int32_t) 2020-03-10 12:23:33 +01:00
c2f9700f5e
Merge pull request #13570 from kaspar030/ztimer_allow_adjust_config
sys/ztimer: allow "adjust" config for ztimer_usec, ztimer_msec
2020-03-10 11:58:21 +01:00
benpicco
d405cb7dd1
Merge pull request #13577 from kaspar030/fix_ztimer_rtt_logic
sys/ztimer: fix typo in rtt conversion selection
2020-03-09 19:11:07 +01:00
962679282e sys/ztimer: fix typo in rtt conversion selection 2020-03-06 14:49:56 +01:00
Juergen Fitschen
61334c3034 ztimer: fix RTT backend 2020-03-06 14:22:06 +01:00
2ad4ea67e9 sys/ztimer: allow configuring ZTIMER_[UM]SEC adjust value 2020-03-06 14:17:29 +01:00
c05d0bed66 sys/ztimer: make auto_init use LOG_DEBUG 2020-03-06 11:25:35 +01:00
dd218333c2 sys/ztimer: add xtimer_on_ztimer
This commit adds logic to make xtimer use ztimer_usec as backend
(instead of periph_timer). This allows ztimer_usec and xtimer to
coexist. It also allows xtimer to profit from eventually implemented
power mode blocking in ztimer's periph_timer backend.
2020-03-04 12:44:03 +01:00
21613b0aa6 sys/ztimer: adapt to DEFAULT_MODULE based auto_init scheme 2020-03-04 12:44:03 +01:00
8c1e577a06 sys/ztimer: move dependencies to sys/ztimer/Makefile.dep 2020-03-04 12:44:03 +01:00
eccb6e89ed sys/ztimer: add coccinelle script for xtimer -> ztimer conversion 2020-03-04 12:44:02 +01:00
6dd79366bb sys: add ztimer subsystem
Co-authored-by: Joakim Nohlgård <joakim.nohlgard@eistec.se>
2020-03-04 12:44:02 +01:00