Skip to content
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

cpu/native: Add support for periph_timer_query_freqs #20306

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

Wer-Wolf
Copy link
Contributor

@Wer-Wolf Wer-Wolf commented Jan 28, 2024

Contribution description

This pull request adds support for the periph_timer_query_freqs feature to the native platform.
The feature allows software to query the supported frequency of the timer, which in this case is
a fixed frequency used internally for time conversions.

This allows software which depends on this feature to run on the native board. Since the periph/timer
test expects all timers supporting this feature to also define TIMER_CHANNEL_NUMOF, the necessary define
was added to the CPU configuration.

Testing procedure

Build:
make BOARD=native -C tests/periph/timer flash test

TIMER 0

  • supported frequencies:
    0: 1000000
  • Calling timer_init(0, 1000000)
    initialization successful
  • timer_stop(0): stopped
  • timer_set(0, 0, 5000)
    Successfully set timeout 5000 for channel 0
  • timer_start(0)
  • Results:
    • channel 0 fired at SW count 237578 - init: 237578
  • Validating no spurious IRQs are triggered:
    OK (no spurious IRQs)

TEST SUCCEEDED
{ "threads": [{ "name": "idle", "stack_size": 8192, "stack_used": 436 }]}

@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: cpu Area: CPU/MCU ports labels Jan 28, 2024
@benpicco benpicco requested a review from maribu January 29, 2024 09:38
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 29, 2024
@riot-ci
Copy link

riot-ci commented Jan 29, 2024

Murdock results

✔️ PASSED

6070c57 cpu/native: Add support for periph_timer_query_freqs

Success Failures Total Runtime
8629 0 8629 11m:59s

Artifacts

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this. The CI has same nitpicks, feel free to amend directly rather than using --fixup= commits.

Btw: This is excellent first PR (unless I overlooked other PRs of you)!

assert(dev < TIMER_NUMOF);

if (index > 0) {
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 0;
return 0;

@@ -49,7 +49,8 @@ extern "C" {
* @name Timer peripheral configuration
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_NUMOF (1U)
#define TIMER_CHANNEL_NUMOF (1U)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define TIMER_CHANNEL_NUMOF (1U)
#define TIMER_CHANNEL_NUMOF (1U) /**< number of timer channels */

I'm well aware that the name is pretty self-documenting, but the CI insists on having this documented. The alternative would be to add this to the list of exceptions, but that is IMHO more effort that just documenting the obvious.

Add support for querying the frequency supported by
`periph_timer`. This allows applications which require
this feature to run on the `native` board.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
@maribu maribu enabled auto-merge January 30, 2024 08:08
@maribu maribu added this pull request to the merge queue Jan 30, 2024
Merged via the queue into RIOT-OS:master with commit 57cd430 Jan 30, 2024
26 checks passed
@Wer-Wolf Wer-Wolf deleted the native_timer_freq branch January 30, 2024 15:12
@MrKevinWeiss MrKevinWeiss added this to the Release 2024.04 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: native Platform: This PR/issue effects the native platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants