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

44 Commits

Author SHA1 Message Date
Bas Stottelaar
80d9da90df sys/*: add missing include of assert.h 2020-10-22 11:13:09 +02:00
Marian Buschsieweke
6deb89f887
sys/xtimer: assert() successful initialized
Use an `assert()` to make sure that `periph_timer` was successfully initialized.
2020-09-29 11:52:26 +02:00
Martine S. Lenders
085c62ecdc
xtimer_core: piggy-back style fixes 2020-04-10 12:42:32 +02:00
Martine S. Lenders
212fe15786
xtimer: set now pointer correctly in _update_short_timers() loop
This fixes `xtimer` to use `xtimer_now64()` instead of `xtimer_now()`
for updating the `*now` variable during the iteration in
`_update_short_timers()` function. The same function is used to
initialize `*now` in `_timer_callback()` below.

While using `xtimer_now()` in this iteration step does not hinder the
proper execution of all timers in the short term timers (for those the
`xtimer` module only looks at the `start_time` member, not the
`long_start_time` member) at least for the current long term time window
(I did not test higher cases), it sets the `long_start_time` member to 0
for all timers following in the list of timers after this iteration
step. However, external modules that rely on this to be correct,
e.g. evtimer [1], fail their calculations when trying to compare to
the current value to `xtimer_now64()`.

[1] https://github.com/RIOT-OS/RIOT/blob/11f3d68/sys/evtimer/evtimer.c#L118-L121

Co-Authored-By: Cenk Gündoğan <mail+dev@gundogan.net>
2020-04-10 00:02:33 +02: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
Hyungsin
eadd4c9f72 sys/xtimer: compare two offsets rather than absolute times 2020-01-29 10:52:43 -08:00
Hyungsin
387344775b sys: xtimer concurrency/robustness improvement 2020-01-10 10:06:16 -08:00
2ea1b24eae sys/xtimer: fix typos 2019-11-23 22:39:38 +01:00
Josarn
672368954e xtimer: timer & target overflow, hang resolved.
1. When the 32 bit target of the xtimer overflowed the timer was not placed in the right list.
2. When the hardware timer overflowed the comparison was wrong for setting next target.

3. Backoff condition
2018-11-01 16:48:20 +01:00
josar
f770d17e12 xtimer_core: uncrustify 2018-09-18 16:13:18 +02:00
7d013eb2b6 sys: fix doxygen grouping 2018-06-11 19:12:02 +02:00
Joakim Nohlgård
8e10e6e3fa xtimer: Use {} for empty while loops 2017-06-10 06:34:24 +02:00
185c7ac11b some (ptr == 0) -> (ptr == NULL) fixes (found by coccinelle) 2017-04-20 23:31:32 +02:00
Martine Lenders
712bd09b2c xtimer: fix for DEBUG 2017-01-18 19:38:05 +01:00
Oleg Hahm
24c205d3a3 xtimer: fix formatter for xtimer_now in DEBUG 2017-01-18 16:20:02 +01:00
Joakim Nohlgård
63e91151cd xtimer: Add tick conversion 2016-11-28 11:00:42 +01:00
Joakim Nohlgård
da8cd11816 xtimer: Move xtimer_spin_until into xtimer_core.c 2016-07-06 22:23:07 +02:00
Joakim Nohlgård
7c70d3bc4f xtimer: Add Eistec copyright and author 2016-07-06 22:23:05 +02:00
Joakim Nohlgård
4d862955c2 xtimer: Rename XTIMER -> XTIMER_DEV 2016-07-06 22:23:04 +02:00
Joakim Nohlgård
2f832117f8 xtimer: prefix _lltimer_now, _lltimer_mask with _xtimer 2016-07-06 22:23:04 +02:00
DipSwitch
0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 2016-03-20 16:47:34 +01:00
9e3081849e sys: xtimer: fix some race conditions 2016-03-09 01:51:59 +01:00
Ian Martin
856c5e1539 s/XTIMER_RSHIFT/XTIMER_USEC_TO_TICKS/g
s/XTIMER_LSHIFT/XTIMER_TICKS_TO_USEC/g
2016-03-01 15:18:45 -05:00
Ian Martin
f86c118594 xtimer: define XTIMER_RSHIFT() and XTIMER_LSHIFT() macros to avoid using XTIMER_SHIFT directly. 2016-03-01 15:15:19 -05:00
Hauke Petersen
e9d79a37d6 sys/xtimer: adapted to timer API changes 2016-02-29 14:45:00 +01:00
malo
9b8fe52d5d xtimer: Fixed _add_timer_to_long_list since timer could be added at the wrong position.
Signed-off-by: malo <malo@25cmsquare.io>
2016-02-26 12:32:45 +01:00
malo
93eb56c612 xtimer: Fixed case when _xtimer_set_absolute called with target < now and target has _this_high_period .
Signed-off-by: malo <malo@25cmsquare.io>
2016-02-26 12:27:15 +01:00
Joakim Nohlgård
df416c1b76 sys/xtimer: Update to match timer_init API changes 2016-02-13 21:29:36 +01:00
Joakim Nohlgård
d1b4e7a70b xtimer: Rename _xtimer_now() -> _lltimer_now()
This matches _lltimer_set() and _lltimer_mask()
2015-10-28 13:54:54 +01:00
Joakim Nohlgård
d432bb42b0 xtimer: rename _mask -> _lltimer_mask 2015-10-28 13:52:25 +01:00
Joakim Nohlgård
fb0322ee1b xtimer: Add spaces for readability 2015-10-28 13:51:23 +01:00
Joakim Nohlgård
e8f33c2ca0 xtimer: Add parentheses to condition 2015-10-28 13:51:23 +01:00
c2f6417bea sys: xtimer: add another safeguard against setting a timer in the past 2015-10-07 18:56:31 +02:00
Joakim Nohlgård
b365ab45cb sys/xtimer: Avoid race incrementing multiple periods in _timer_callback
On a fast CPU with a slow timer (e.g. XTIMER_SHIFT > 0) it is possible
that now == _xtimer_now() when spinning for the overflow. In the extreme
case When this happens _next_period() will be called more than once
until the timer overflows for real.

Fault observed in real life when running on a 32.768 kHz timer on a
~96 MHz clocked mulle (Kinetis K60, Cortex-M4). _next_period() was
called 9 times during the same ISR call before the 32 kHz timer
overflowed.
2015-09-30 10:21:33 +02:00
Joakim Nohlgård
983b299745 sys/xtimer: xtimer_set: Reduce scope on target variable 2015-09-28 14:23:23 +02:00
Joakim Nohlgård
75d0281ef3 xtimer-core: Use xtimer_now as reference time instead of future timer target 2015-09-25 16:12:06 +02:00
a719e7d61f sys: xtimer: some updates
- more robust underflow protection in xtimer_usleep_until()
- use relative target in xtimer_spin()
- honour reference in isr when spinning until timer target
- add XTIMER_BACKOFF to xtimer_spin_until() target when backing off in
  _timer_set_absolute()
- doxygen updates
2015-09-16 12:34:31 +02:00
40812e722e sys: xtimer: use relative spin in absolute set functions 2015-09-16 11:13:42 +02:00
48611c0572 sys: xtimer: avoid setting timers multiple times from within ISR 2015-09-16 11:13:41 +02:00
a0d78cf989 sys: xtimer: disable timer before shooting in isr handler 2015-09-16 10:58:56 +02:00
691fe95546 sys: xtimer: use XTIMER_SHIFT in mask, add doxygen 2015-09-16 10:58:56 +02:00
cb0337d77e sys: xtimer: xtimer_set(): shoot directly if offset <= 1 2015-09-16 10:58:56 +02:00
383ada9349 sys: xtimer: always set long_target, even for short timers 2015-09-05 09:13:26 +02:00
808a8bc899 sys: xtimer: introduce new timer subsystem 2015-08-25 13:20:35 +02:00