1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-28 23:29:45 +01:00

sys/ztimer: Remove the deprecated ztimer_now64

This has been scheduled for removal after 2022.10, and its replacement
ztimer64_now has long been available.
This commit is contained in:
chrysn 2024-08-20 20:52:37 +02:00
parent 6a9154cdc5
commit a26366371d
9 changed files with 9 additions and 159 deletions

View File

@ -7,4 +7,3 @@ DEPRECATED_MODULES += gnrc_nettype_gomach
DEPRECATED_MODULES += gnrc_nettype_lorawan
DEPRECATED_MODULES += gnrc_nettype_lwmac
DEPRECATED_MODULES += sema_deprecated
DEPRECATED_MODULES += ztimer_now64

View File

@ -301,27 +301,13 @@ struct ztimer_base {
uint32_t offset; /**< offset from last timer in list */
};
/**
* @defgroup sys_ztimer_now64 ztimer_now64
* @brief 64-bit timestamp support
*
* @deprecated use @ref ztimer_now() returning uint32_t or alternatively use
* module `ztimer64` with @ref ztimer64_now() returning uint64_t.
* Will be removed after 2022.10 release.
*/
/**
* @typedef ztimer_now_t
* @brief type for ztimer_now() result
*
* @deprecated use @ref ztimer_now() returning uint32_t or alternatively use
* module `ztimer64` with @ref ztimer64_now() returning uint64_t.
* Will be removed after 2022.10 release.
* This is always uint32_t.
*/
#if MODULE_ZTIMER_NOW64
typedef uint64_t ztimer_now_t;
#else
typedef uint32_t ztimer_now_t;
#endif
/**
* @brief ztimer structure
@ -393,7 +379,7 @@ struct ztimer_clock {
stopped state */
uint16_t users; /**< user count of this clock */
#endif
#if MODULE_ZTIMER_EXTEND || MODULE_ZTIMER_NOW64 || DOXYGEN
#if MODULE_ZTIMER_EXTEND || DOXYGEN
/* values used for checkpointed intervals and 32bit extension */
uint32_t max_value; /**< maximum relative timer value */
uint32_t lower_last; /**< timer value at last now() call */
@ -570,7 +556,7 @@ void _ztimer_assert_clock_active(ztimer_clock_t *clock);
*
* There are several caveats to consider when using values returned by
* `ztimer_now()` (or comparing those values to results of @ref ztimer_set,
* which are compatible unless MODULE_ZTMIER_NOW64 is in use):
* which are compatible):
*
* * A single value has no meaning of its own. Meaningful results are only ever
* produced when subtracting values from each other (in the wrapping fashion
@ -604,7 +590,7 @@ void _ztimer_assert_clock_active(ztimer_clock_t *clock);
*
* If the clock was active, then the difference between the second value and
* the first is then the elapsed time in the clock's unit, **modulo 2³²
* ticks** (or 2 when using the ZTIMER_NOW64 module).
* ticks**.
*
* * A difference between two values (calculated in the usual wrapping way) is
* guaranteed to be exactly the elapsed time (not just modulo 2³²) if there
@ -683,9 +669,7 @@ static inline ztimer_now_t ztimer_now(ztimer_clock_t *clock)
_ztimer_assert_clock_active(clock);
#endif
#if MODULE_ZTIMER_NOW64
if (1) {
#elif MODULE_ZTIMER_EXTEND
#if MODULE_ZTIMER_EXTEND
if (clock->max_value < UINT32_MAX) {
#else
if (0) {

View File

@ -424,13 +424,7 @@ static void _ztimer_update(ztimer_clock_t *clock)
clock->ops->set(clock, clock->list.next->offset);
}
else {
if (IS_USED(MODULE_ZTIMER_NOW64)) {
/* ensure there's at least one ISR per half period */
clock->ops->set(clock, clock->max_value >> 1);
}
else {
clock->ops->cancel(clock);
}
clock->ops->cancel(clock);
}
}
}
@ -445,8 +439,8 @@ void ztimer_handler(ztimer_clock_t *clock)
_ztimer_print(clock);
}
#if MODULE_ZTIMER_EXTEND || MODULE_ZTIMER_NOW64
if (IS_USED(MODULE_ZTIMER_NOW64) || clock->max_value < UINT32_MAX) {
#if MODULE_ZTIMER_EXTEND
if (clock->max_value < UINT32_MAX) {
/* calling now triggers checkpointing */
uint32_t now = ztimer_now(clock);

View File

@ -95,7 +95,7 @@ identifier i;
@@
- xtimer_now_usec64()
+ ztimer_now64()
+ ztimer64_now()
@@
identifier i;

View File

@ -1,34 +0,0 @@
include ../Makefile.sys_common
USEMODULE += fmt
USEMODULE += xtimer
USEMODULE += xtimer_no_ztimer_default
# This test randomly fails on `native` so disable it from CI
TEST_ON_CI_BLACKLIST += native native64
# Boards that can't run only on xtimer or that always select ztimer
BOARD_BLACKLIST += \
esp32s2-wemos-mini \
feather-nrf52840 \
hamilton \
mulle \
pinetime \
ruuvitag \
seeedstudio-gd32 \
sipeed-longan-nano \
sipeed-longan-nano-tft \
stm32f429i-disco \
stm32f4discovery \
thingy52 \
waspmote-pro \
weact-f401cc \
weact-f401ce \
weact-f411ce \
blackpill-stm32f103cb \
bluepill-stm32f103cb \
#
# microbit qemu failing currently
TEST_ON_CI_BLACKLIST += microbit
include $(RIOTBASE)/Makefile.include

View File

@ -1,3 +0,0 @@
BOARD_INSUFFICIENT_MEMORY := \
atmega8 \
#

View File

@ -1,6 +0,0 @@
Description
===========
This test measures the difference of two consecutive calls to xtimer_now64()
100k times. If the max or average difference is larger than 1000us the test
fails, otherwise it succeeds.

View File

@ -1,64 +0,0 @@
/*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
* 2017 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief xtimer_now64 continuity test application
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Sebastian Meiling <s@mlng.net>
*
* @}
*/
#include <stdint.h>
#include "xtimer.h"
#include "fmt.h"
#define ITERATIONS (100000LU)
#define MAXDIFF (1000U)
int main(void)
{
uint32_t n = ITERATIONS;
uint64_t diff_min = UINT64_MAX;
uint64_t diff_max = 0;
uint64_t diff_sum = 0;
print_str("[START]\n");
xtimer_ticks64_t before = xtimer_now64();
while(--n) {
xtimer_ticks64_t now = xtimer_now64();
xtimer_ticks64_t diff = xtimer_diff64(now, before);
if (diff.ticks64 > diff_max) {
diff_max = diff.ticks64;
}
if (diff.ticks64 < diff_min) {
diff_min = diff.ticks64;
}
diff_sum += diff.ticks64;
before = now;
}
print_str("[RESULTS] min=");
print_u64_dec(diff_min);
print_str(", avg=");
print_u64_dec(diff_sum/ITERATIONS);
print_str(", max=");
print_u64_dec(diff_max);
print_str("\n");
if ((diff_max > MAXDIFF) || (diff_sum/ITERATIONS > MAXDIFF)) {
print_str("[FAILURE]\n");
return 1;
}
print_str("[SUCCESS]\n");
return 0;
}

View File

@ -1,20 +0,0 @@
#!/usr/bin/env python3
# Copyright (C) 2017 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
child.expect_exact("[START]")
child.expect(r"\[RESULTS\] min=\d+, avg=\d+, max=\d+")
child.expect_exact("[SUCCESS]")
if __name__ == "__main__":
sys.exit(run(testfunc))