You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
5 years ago
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||
|
//
|
||
3 years ago
|
// Copyright (c) 2020-2022 Andre Richter <andre.o.richter@gmail.com>
|
||
5 years ago
|
|
||
|
//! Timer primitives.
|
||
|
|
||
|
#[cfg(target_arch = "aarch64")]
|
||
|
#[path = "_arch/aarch64/time.rs"]
|
||
|
mod arch_time;
|
||
4 years ago
|
|
||
|
//--------------------------------------------------------------------------------------------------
|
||
|
// Architectural Public Reexports
|
||
|
//--------------------------------------------------------------------------------------------------
|
||
|
pub use arch_time::time_manager;
|
||
5 years ago
|
|
||
|
//--------------------------------------------------------------------------------------------------
|
||
|
// Public Definitions
|
||
|
//--------------------------------------------------------------------------------------------------
|
||
|
|
||
|
/// Timekeeping interfaces.
|
||
|
pub mod interface {
|
||
|
use core::time::Duration;
|
||
|
|
||
|
/// Time management functions.
|
||
|
pub trait TimeManager {
|
||
|
/// The timer's resolution.
|
||
|
fn resolution(&self) -> Duration;
|
||
|
|
||
|
/// The uptime since power-on of the device.
|
||
|
///
|
||
|
/// This includes time consumed by firmware and bootloaders.
|
||
|
fn uptime(&self) -> Duration;
|
||
|
|
||
|
/// Spin for a given duration.
|
||
|
fn spin_for(&self, duration: Duration);
|
||
|
}
|
||
|
}
|