Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
timer: Align SOF timer API with Zephyr#5393
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4fa1082
wait: Add functions to wait ms and us
aa2b11d
clk: Add new function clock_ns_to_ticks
ff56b23
dma-trace: Move log time delta from timer to dma_trace_buf struct.
52bea87
zephyr_domain_init: Remove unused timer parameter
4a80e60
timer: Separate xtos timer API and add wrappers for Zephyr timer API
1757106
timer: Use Zephyr timer API
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| add_subdirectory(${ARCH}) | ||
| if(NOT CONFIG_ZEPHYR_SOF_MODULE) | ||
| add_subdirectory("xtos-wrapper") | ||
| endif() |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| add_local_sources(sof interrupt.c timer.c cache_attr.c) | ||
| add_local_sources(sof interrupt.c cache_attr.c) | ||
| if(NOT CONFIG_ZEPHYR_SOF_MODULE) | ||
| add_local_sources(sof timer.c) | ||
| endif() |
This file contains hidden or 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 @@ | ||
| target_include_directories(sof_public_headers INTERFACE include) |
41 changes: 41 additions & 0 deletions
41 src/include/sof/drivers/timer.h → .../xtos-wrapper/include/sof/drivers/timer.h
This file contains hidden or 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 |
|---|---|---|
| @@ -11,6 +11,7 @@ | ||
| #include <arch/drivers/timer.h> | ||
| #include <sof/lib/cpu.h> | ||
| #include <sof/sof.h> | ||
| #include <sof/platform.h> | ||
| #include <stdint.h> | ||
| struct comp_dev; | ||
| @@ -76,6 +77,46 @@ static inline uint64_t platform_safe_get_time(struct timer *timer) | ||
| void platform_timer_start(struct timer *timer); | ||
| void platform_timer_stop(struct timer *timer); | ||
| static inline uint64_t k_ms_to_cyc_ceil64(uint64_t ms) | ||
| { | ||
| return clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, ms); | ||
| } | ||
| static inline uint64_t k_us_to_cyc_ceil64(uint64_t us) | ||
| { | ||
| return clock_us_to_ticks(PLATFORM_DEFAULT_CLOCK, us); | ||
| } | ||
softwarecki marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| static inline uint64_t k_ns_to_cyc_near64(uint64_t ns) | ||
| { | ||
| return clock_ns_to_ticks(PLATFORM_DEFAULT_CLOCK, ns); | ||
| } | ||
| static inline uint64_t k_cyc_to_ms_near64(uint64_t ticks) | ||
| { | ||
| return ticks / clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1); | ||
| } | ||
| static inline uint64_t k_cyc_to_us_near64(uint64_t ticks) | ||
| { | ||
| return ticks / clock_us_to_ticks(PLATFORM_DEFAULT_CLOCK, 1); | ||
| } | ||
| static inline uint64_t k_cycle_get_64(void) | ||
| { | ||
| return platform_timer_get(timer_get()); | ||
| } | ||
| static inline uint64_t k_cycle_get_64_atomic(void) | ||
| { | ||
| return platform_timer_get_atomic(timer_get()); | ||
| } | ||
| static inline uint64_t k_cycle_get_64_safe(void) | ||
| { | ||
| return platform_safe_get_time(timer_get()); | ||
| } | ||
| /* get timestamp for host stream DMA position */ | ||
| void platform_host_timestamp(struct comp_dev *host, | ||
| struct sof_ipc_stream_posn *posn); | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.