diff options
Diffstat (limited to 'embassy-executor/src')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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")] |
| 582 | embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue); | 582 | embassy_time_queue_driver::timer_queue_impl!(static TIMER_QUEUE: TimerQueue = TimerQueue); |
| 583 | 583 | ||
| 584 | #[cfg(all(feature = "rtos-trace", feature = "integrated-timers"))] | ||
| 585 | const 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")] |
| 585 | impl rtos_trace::RtosTraceOSCallbacks for Executor { | 594 | impl 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 { |
