pub struct DeferredCall { /* private fields */ }
Implementations§
Source§impl DeferredCall
impl DeferredCall
Sourcepub fn register<DC: DeferredCallClient>(&self, client: &'static DC)
pub fn register<DC: DeferredCallClient>(&self, client: &'static DC)
This function registers the passed client with this deferred call, such
that calls to DeferredCall::set()
will schedule a callback on the
handle_deferred_call()
method of the passed client.
Sourcepub fn set(&self)
pub fn set(&self)
Schedule a deferred callback on the client associated with this deferred call.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if a deferred callback has been set and not yet serviced on this deferred call.
Sourcepub fn service_next_pending() -> Option<usize>
pub fn service_next_pending() -> Option<usize>
Services and clears the next pending DeferredCall
, returns which
index was serviced.
Sourcepub fn has_tasks() -> bool
pub fn has_tasks() -> bool
Returns true if any deferred calls are waiting to be serviced, false otherwise.
Sourcepub fn verify_setup()
pub fn verify_setup()
This function should be called at the beginning of the kernel loop to verify that deferred calls have been correctly initialized. This function verifies two things:
-
That <= [
DEFCALLS.len()
] deferred calls have been created, which is the maximum this interface supports. -
That exactly as many deferred calls were registered as were created, which helps to catch bugs if board maintainers forget to call
register()
on a createdDeferredCall
.
Neither of these checks are necessary for soundness, but they are
necessary for confirming that DeferredCall
s will actually be
delivered as expected. This function costs about 300 bytes, so you can
remove it if you are confident your setup will not exceed 32 deferred
calls, and that all of your components register their deferred calls.