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

Merge pull request #17319 from aabadie/pr/sys/trace_ztimer

sys/trace: migrate to ztimer
This commit is contained in:
Alexandre Abadie 2021-12-06 23:07:04 +01:00 committed by GitHub
commit 3ca1a10217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 3 deletions

View File

@ -76,6 +76,7 @@ tests/periph_*
tests/pkg_elk
tests/pkg_uzlib
tests/prng_*
tests/trace
tests/xtimer_*
tests/ztimer_*
examples/hello-world

View File

@ -76,6 +76,7 @@ rsource "seq/Kconfig"
rsource "shell/Kconfig"
rsource "test_utils/Kconfig"
rsource "timex/Kconfig"
rsource "trace/Kconfig"
rsource "tsrb/Kconfig"
rsource "uri_parser/Kconfig"
rsource "usb/Kconfig"

View File

@ -73,7 +73,8 @@ ifneq (,$(filter rtt_cmd,$(USEMODULE)))
endif
ifneq (,$(filter trace,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_usec
endif
ifneq (,$(filter ssp,$(USEMODULE)))

13
sys/trace/Kconfig Normal file
View File

@ -0,0 +1,13 @@
# Copyright (c) 2021 Inria
#
# 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.
#
config MODULE_TRACE
bool "Trace program flows"
depends on TEST_KCONFIG
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
select MODULE_ZTIMER_PERIPH_TIMER

View File

@ -23,7 +23,7 @@
#include <stdio.h>
#include "irq.h"
#include "xtimer.h"
#include "ztimer.h"
#ifndef CONFIG_TRACE_BUFSIZE
#define CONFIG_TRACE_BUFSIZE 512
@ -42,7 +42,7 @@ void trace(uint32_t val)
unsigned state = irq_disable();
tracebuf[tracebuf_pos % CONFIG_TRACE_BUFSIZE] =
(tracebuf_entry_t){ .time = xtimer_now_usec(), .val = val };
(tracebuf_entry_t){ .time = ztimer_now(ZTIMER_USEC), .val = val };
tracebuf_pos++;
irq_restore(state);
}

View File

@ -0,0 +1,3 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_TRACE=y