-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys/wait: add module for backend agnostic waits #19719
Open
maribu
wants to merge
4
commits into
RIOT-OS:master
Choose a base branch
from
maribu:delay
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_arm7_common | ||
* @{ | ||
* | ||
* @file | ||
* @brief ARM7 specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
/* ARM7 uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_avr8_common | ||
* @{ | ||
* | ||
* @file | ||
* @brief AVR specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
#include "time_units.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
#define HAS_WAIT_US_SPINNING | ||
|
||
static inline void wait_us_spinning(uint32_t usecs) | ||
{ | ||
uint32_t cycles = usecs * (uint64_t)CLOCK_CORECLOCK / US_PER_SEC; | ||
|
||
__builtin_avr_delay_cycles(cycles); | ||
} | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_cortexm_common | ||
* @{ | ||
* | ||
* @file | ||
* @brief Cortex-M specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
#if defined(CPU_CORE_CORTEX_M4) || defined(CPU_CORE_CORTEX_M4F) | ||
# define CPU_CYCLES_PER_WAIT_LOOP_ITERATION 4U | ||
#endif | ||
|
||
#if defined(CPU_CORE_CORTEX_M3) | ||
# define CPU_CYCLES_PER_WAIT_LOOP_ITERATION 7U | ||
#endif | ||
|
||
/* Cortex M uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_esp32 | ||
* @{ | ||
* | ||
* @file | ||
* @brief ESP32 specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
/* ESP32 uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_esp8266 | ||
* @{ | ||
* | ||
* @file | ||
* @brief ESP8266 specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
/* ESP8266 uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_msp430_common | ||
* @{ | ||
* | ||
* @file | ||
* @brief MSP430 specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
/* MSP430 uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg | ||
* | ||
* 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 cpu_native | ||
* @{ | ||
* | ||
* @file | ||
* @brief "native" specific busy wait | ||
* | ||
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net> | ||
* | ||
*/ | ||
|
||
#ifndef WAIT_ARCH_H | ||
#define WAIT_ARCH_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "board.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifndef DOXYGEN | ||
|
||
/* ARM7 uses ztimer_spin for busy wait */ | ||
|
||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* WAIT_ARCH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to provide this dummy file if you use