aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorxgroleau🐢 <[email protected]>2024-02-06 15:50:28 -0500
committerxgroleau🐢 <[email protected]>2024-02-08 08:59:06 -0500
commitd48620d58f588936a5c74840063fe422764b749f (patch)
tree0440b4e8db9447af865a9377cd52021ad49d9dc3 /embassy-executor
parent5f36108896d909ed990a587941d74e0488bcd190 (diff)
fix: compilation for rtos trace
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/Cargo.toml4
-rw-r--r--embassy-executor/src/raw/mod.rs12
2 files changed, 11 insertions, 5 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index 0762e2434..409df0d75 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -34,7 +34,6 @@ log = { version = "0.4.14", optional = true }
34rtos-trace = { version = "0.1.2", optional = true } 34rtos-trace = { version = "0.1.2", optional = true }
35 35
36embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macros" } 36embassy-executor-macros = { version = "0.4.0", path = "../embassy-executor-macros" }
37embassy-time = { version = "0.3.0", path = "../embassy-time", optional = true }
38embassy-time-driver = { version = "0.1.0", path = "../embassy-time-driver", optional = true } 37embassy-time-driver = { version = "0.1.0", path = "../embassy-time-driver", optional = true }
39embassy-time-queue-driver = { version = "0.1.0", path = "../embassy-time-queue-driver", optional = true } 38embassy-time-queue-driver = { version = "0.1.0", path = "../embassy-time-queue-driver", optional = true }
40critical-section = "1.1" 39critical-section = "1.1"
@@ -72,9 +71,6 @@ turbowakers = []
72## Use the executor-integrated `embassy-time` timer queue. 71## Use the executor-integrated `embassy-time` timer queue.
73integrated-timers = ["dep:embassy-time-driver", "dep:embassy-time-queue-driver"] 72integrated-timers = ["dep:embassy-time-driver", "dep:embassy-time-queue-driver"]
74 73
75# Support for rtos trace require time
76rtos-trace = ["dep:rtos-trace", "dep:embassy-time"]
77
78#! ### Architecture 74#! ### Architecture
79_arch = [] # some arch was picked 75_arch = [] # some arch was picked
80## std 76## std
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index fbc0481c2..3d221c94b 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -581,6 +581,15 @@ impl embassy_time_queue_driver::TimerQueue for TimerQueue {
581#[cfg(feature = "integrated-timers")] 581#[cfg(feature = "integrated-timers")]
582embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue); 582embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue);
583 583
584#[cfg(all(feature = "rtos-trace", feature = "integrated-timers"))]
585const fn gcd(a: u64, b: u64) -> u64 {
586 if b == 0 {
587 a
588 } else {
589 gcd(b, a % b)
590 }
591}
592
584#[cfg(feature = "rtos-trace")] 593#[cfg(feature = "rtos-trace")]
585impl rtos_trace::RtosTraceOSCallbacks for Executor { 594impl rtos_trace::RtosTraceOSCallbacks for Executor {
586 fn task_list() { 595 fn task_list() {
@@ -588,7 +597,8 @@ impl rtos_trace::RtosTraceOSCallbacks for Executor {
588 } 597 }
589 #[cfg(feature = "integrated-timers")] 598 #[cfg(feature = "integrated-timers")]
590 fn time() -> u64 { 599 fn time() -> u64 {
591 embassy_time::Instant::now().as_millis() 600 const GCD_1M: u64 = gcd(embassy_time_driver::TICK_HZ, 1_000_000);
601 embassy_time_driver::now() * (1_000_00 / GCD_1M) / (embassy_time_driver::TICK_HZ / GCD_1M);
592 } 602 }
593 #[cfg(not(feature = "integrated-timers"))] 603 #[cfg(not(feature = "integrated-timers"))]
594 fn time() -> u64 { 604 fn time() -> u64 {