embassy-usb-driver

Crates

git

Versions

default

Flavors

Skip to main content

IsoSchedule

Struct IsoSchedule 

Source
pub struct IsoSchedule { /* private fields */ }
Expand description

Next isochronous IN slot, aligned to the bus frame clock and host polling phase.

Service intervals occur every interval ticks of a frame counter of modulus span (2048 at full speed, 16384 at high speed). interval should divide span (true for all USB power-of-two intervals).

For interval == 1, every tick is a service interval and the phase is trivially 0. For interval > 1, the USB host chooses an arbitrary phase in 0..interval when scheduling the endpoint. Until lock_phase is called with the frame of a completed IN transfer, the schedule paces at interval ticks with provisional phase 0. Once locked, all subsequent slots align to frame % interval == phase until reset.

A gap of more than one revolution of the frame counter is counted as a single wrap.

Implementations§

Source§

impl IsoSchedule

Source

pub const fn new() -> Self

A schedule that has not offered a slot yet.

Source

pub fn reset(&mut self)

Clear all tracking state, including any locked host phase.

Call when the endpoint is disabled or the bus resets.

Source

pub const fn phase(&self) -> Option<u32>

The locked polling phase in 0..interval, if known.

Source

pub fn lock_phase(&mut self, frame: u32, interval: u32)

Lock the host polling phase from a completed IN transfer at frame.

Subsequent calls while already locked have no effect until reset.

Source

pub fn offer(&mut self, now: u32, interval: u32, span: u32) -> IsoOffer

Offer the next slot when the frame counter reads now.

interval is the service interval in frame-counter ticks, at least 1 and less than span. span is the counter modulus. now is taken modulo span.

Source

pub fn accept(&mut self)

Mark the most recently offered slot as queued.

Later offers will not count that interval as empty.

Trait Implementations§

Source§

impl Clone for IsoSchedule

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IsoSchedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IsoSchedule

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.