Lines Matching +full:soft +full:- +full:start
1 // SPDX-License-Identifier: GPL-2.0
12 //! - Stopped: initialized but not started, or cancelled, or not restarted.
13 //! - Started: initialized and started or restarted.
14 //! - Running: executing the callback.
18 //! * Start
30 //! +---------------------------------------------------------------------+
35 //! | +------------------------+ |
39 //! +-----------------+ Start +------------------+ +--------+-----+--+
40 //! | +---------------->| | | |
42 //! --------->| Stopped | | Started +---------->| Running |
44 //! | |<----------------+ | | |
45 //! +-----------------+ +---------------+--+ +-----------------+
48 //! +---------+
54 //! **started** by the `start` operation, with an **expiry** time. After the
55 //! `start` operation, the timer is in the **started** state. When the timer
68 //! `start` operation.
75 /// A type-alias to refer to the [`Instant<C>`] for a given `T` from [`HrTimer<T>`].
103 pub fn new() -> impl PinInit<Self>
110 timer <- Opaque::ffi_init(move |place: *mut bindings::hrtimer| {
135 unsafe fn raw_get(this: *const Self) -> *mut bindings::hrtimer {
147 /// Note that the timer might be started by a concurrent start operation. If
161 pub(crate) unsafe fn raw_cancel(this: *const Self) -> bool {
176 /// - `self_ptr` must point to a valid `Self`.
177 /// - The caller must either have exclusive access to the data pointed at by `self_ptr`, or be
180 unsafe fn raw_forward(self_ptr: *mut Self, now: HrTimerInstant<T>, interval: Delta) -> u64
204 pub fn forward(self: Pin<&mut Self>, now: HrTimerInstant<T>, interval: Delta) -> u64
220 pub fn forward_now(self: Pin<&mut Self>, interval: Delta) -> u64
231 pub fn expires(&self) -> HrTimerInstant<T>
239 // - Timers cannot have negative ktime_t values as their expiration time.
240 // - There's no actual locking here, a racy read is fine and expected
254 /// thread of execution (hard or soft interrupt context).
257 /// the timer. Note that it is OK to call the start function repeatedly, and
277 /// Start the timer with expiry after `expires` time units. If the timer was
279 fn start(self, expires: <Self::TimerMode as HrTimerMode>::Expires) -> Self::TimerHandle;
283 /// [`HrTimerHandle`] returned by `start` would be unsound. This is the case for
308 /// Start the timer after `expires` time units. If the timer was already
315 unsafe fn start(self, expires: <Self::TimerMode as HrTimerMode>::Expires) -> Self::TimerHandle;
330 /// Start the timer to run after `expires` time units and immediately
332 fn start_scoped<T, F>(self, expires: <Self::TimerMode as HrTimerMode>::Expires, f: F) -> T
334 F: FnOnce() -> T;
338 // handle returned by [`UnsafeHrTimerPointer::start`] ensures that the timer is
350 ) -> U
352 F: FnOnce() -> U,
355 let handle = unsafe { UnsafeHrTimerPointer::start(self, expires) };
375 /// to the `bindings::hrtimer` structure that was used to start the timer.
376 unsafe extern "C" fn run(this: *mut bindings::hrtimer) -> bindings::hrtimer_restart;
389 ) -> HrTimerRestart
411 /// Note that the timer might be started by a concurrent start operation. If
416 fn cancel(&mut self) -> bool;
444 unsafe fn raw_get_timer(this: *const Self) -> *const HrTimer<T>;
455 unsafe fn timer_container_of(ptr: *mut HrTimer<T>) -> *mut Self
467 unsafe fn c_timer_ptr(this: *const Self) -> *const bindings::hrtimer {
475 /// Start the timer contained in the `Self` pointed to by `self_ptr`. If
480 /// - `this` must point to a valid `Self`.
481 /// - Caller must ensure that the pointee of `this` lives until the timer
483 unsafe fn start(this: *const Self, expires: <Self::TimerMode as HrTimerMode>::Expires) {
507 fn into_c(self) -> bindings::hrtimer_restart {
519 fn as_nanos(&self) -> i64;
524 fn as_nanos(&self) -> i64 {
531 fn as_nanos(&self) -> i64 {
605 /// Timer with absolute expiration, handled in soft irq context.
614 /// Timer with relative expiration, handled in soft irq context.
623 /// Timer with absolute expiration, pinned to CPU and handled in soft irq context.
632 /// Timer with absolute expiration, pinned to CPU and handled in soft irq context.
677 /// Privileged smart-pointer for a [`HrTimer`] callback context.
706 pub(crate) unsafe fn from_raw(timer: *mut HrTimer<T>) -> Self {
718 pub fn forward(&mut self, now: HrTimerInstant<T>, interval: Delta) -> u64 {
720 // - We are guaranteed to be within the context of a timer callback by our type invariants
721 // - By our type invariants, `self.0` always points to a valid `HrTimer<T>`
729 pub fn forward_now(&mut self, duration: Delta) -> u64 {
759 ) -> *const $crate::time::hrtimer::HrTimer<$timer_type> {
767 ) -> *mut Self {