Skip to main content

TmdsLink

Struct TmdsLink 

Source
pub struct TmdsLink<S, P, K, D, X = NoCancel> { /* private fields */ }
Expand description

The TMDS procedures over async parts: the sink’s SCDC, the PHY, a clock and a delay, and a cancel flag (NoCancel unless with_cancel gives one).

The API is spiritlevel::TmdsLink‘s, with the procedures async: each .awaits the parts’ calls and the delay, so a procedure yields to the executor wherever the I/O or a wait does. The driver keeps no state between procedures.

One clock-and-delay value can serve as both: implement Clock and Delay for a reference to it, and pass the reference twice. For a Send future the shared value must then be Sync (an atomic rather than a Cell), or the clock and the delay kept separate.

Implementations§

Source§

impl<S: TmdsScdc, P: TmdsPhy, K: Clock, D: Delay> TmdsLink<S, P, K, D, NoCancel>

Source

pub fn new(scdc: S, phy: P, clock: K, delay: D) -> Self

The driver over its parts, never cancelled.

Source§

impl<S: TmdsScdc, P: TmdsPhy, K: Clock, D: Delay, X: Cancel> TmdsLink<S, P, K, D, X>

Source

pub fn with_cancel<X2: Cancel>(self, cancel: X2) -> TmdsLink<S, P, K, D, X2>

The same driver with cancel as its cancel flag.

A flag shared with another task is passed by reference, as &AtomicBool: Cancel is implemented for the AtomicBool and references to it, not for an Arc of one.

Source

pub fn into_parts(self) -> (S, P, K, D, X)

The parts back.

Source

pub fn scdc(&self) -> &S

The SCDC client.

Source

pub fn scdc_mut(&mut self) -> &mut S

The SCDC client, mutably: between procedures, for reads of the caller’s own.

Source

pub fn phy(&self) -> &P

The PHY.

Source

pub fn phy_mut(&mut self) -> &mut P

The PHY, mutably: between procedures, to power it on or off, read its capabilities, or drive it in another mode.

Source

pub fn clock(&self) -> &K

The clock the procedures stamp their events from, so a caller can stamp its own on the same timebase.

Source

pub async fn tear_down( &mut self, link: &TmdsLinkParams, config: &TearDownConfig, presence: SinkPresence, ) -> Result<TornDown<<S as TmdsScdc>::Error>, TearDownError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

Stops the TMDS link link describes; see procedure::tear_down.

Not stopped by the cancel flag: tear-down is the recovery. If its future is dropped before it completes, call it again.

§Errors

TearDownError when a PHY step failed; every step was still attempted.

Source

pub async fn tear_down_with_events( &mut self, link: &TmdsLinkParams, config: &TearDownConfig, presence: SinkPresence, record: &mut impl FnMut(TmdsEvent), ) -> Result<TornDown<<S as TmdsScdc>::Error>, TearDownError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

tear_down, calling record with each event, at most MAX_TEAR_DOWN_EVENTS.

§Errors

As tear_down.

Source

pub async fn bring_up( &mut self, link: &TmdsLinkParams, video: TmdsVideo, config: &BringUpConfig, ) -> Result<BringUpOutcome<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>, BringUpError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

Brings up the TMDS link link describes, carrying video; see procedure::bring_up, which says where the cancel flag is read and what each outcome leaves.

Stop it through the cancel flag, never by dropping its future: a dropped bring-up stops at whichever .await it was suspended on, with no tear-down, and may leave the sink holding a new TMDS_Config and the PHY configured or transmitting. After one, call tear_down with the same link before anything else.

§Errors

BringUpError when a step failed in a way that stops the bring-up.

Source

pub async fn bring_up_with_events( &mut self, link: &TmdsLinkParams, video: TmdsVideo, config: &BringUpConfig, record: &mut impl FnMut(TmdsEvent), ) -> Result<BringUpOutcome<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>, BringUpError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

bring_up, calling record with each event, at most MAX_BRING_UP_EVENTS.

§Errors

As bring_up.

Source

pub async fn check_reconnect( &mut self, link: &TmdsLinkParams, current_sink: SinkTmdsFacts, ) -> ReconnectCheck<S::Error>

Checks whether the sink still holds the TMDS_Config link needs, given the sink’s facts now; see procedure::check_reconnect.

Not stopped by the cancel flag: it is one read. A dropped check needs nothing done after it, since it only reads.

Source

pub async fn check_reconnect_with_events( &mut self, link: &TmdsLinkParams, current_sink: SinkTmdsFacts, record: &mut impl FnMut(TmdsEvent), ) -> ReconnectCheck<S::Error>

check_reconnect, calling record with each event, at most MAX_RECONNECT_CHECK_EVENTS.

Source

pub async fn quick_restore( &mut self, link: &TmdsLinkParams, config: &BringUpConfig, ) -> Result<Restored<<S as TmdsScdc>::Error>, RestoreError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

Restores the sink’s TMDS_Config on the running link link without a new bring-up; see procedure::quick_restore, which says which settings of config it reads.

The cancel flag stops only its scrambling check, read before each of the check’s reads: the write and the scrambler call always run, and a cancelled check is CheckResult::Cancelled, with the link left running. Never stop it by dropping its future; after a dropped one, call tear_down with the same link before anything else, or call quick_restore again.

§Errors

RestoreError when the sink’s write or the scrambler call failed in a way that stops it; no tear-down follows.

Source

pub async fn quick_restore_with_events( &mut self, link: &TmdsLinkParams, config: &BringUpConfig, record: &mut impl FnMut(TmdsEvent), ) -> Result<Restored<<S as TmdsScdc>::Error>, RestoreError<<S as TmdsScdc>::Error, <P as TmdsPhy>::Error>>

quick_restore, calling record with each event, at most MAX_QUICK_RESTORE_EVENTS.

§Errors

As quick_restore.

Trait Implementations§

Source§

impl<S: Debug, P: Debug, K: Debug, D: Debug, X: Debug> Debug for TmdsLink<S, P, K, D, X>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S, P, K, D, X> Forget for TmdsLink<S, P, K, D, X>

§

impl<S, P, K, D, X> Freeze for TmdsLink<S, P, K, D, X>
where S: Freeze, P: Freeze, K: Freeze, D: Freeze, X: Freeze,

§

impl<S, P, K, D, X> Move for TmdsLink<S, P, K, D, X>

§

impl<S, P, K, D, X> RefUnwindSafe for TmdsLink<S, P, K, D, X>

§

impl<S, P, K, D, X> Send for TmdsLink<S, P, K, D, X>
where X: Send, D: Send, K: Send, P: Send, S: Send,

§

impl<S, P, K, D, X> Sync for TmdsLink<S, P, K, D, X>
where X: Sync, D: Sync, K: Sync, P: Sync, S: Sync,

§

impl<S, P, K, D, X> Unpin for TmdsLink<S, P, K, D, X>
where X: Unpin, D: Unpin, K: Unpin, P: Unpin, S: Unpin,

§

impl<S, P, K, D, X> UnsafeUnpin for TmdsLink<S, P, K, D, X>

§

impl<S, P, K, D, X> UnwindSafe for TmdsLink<S, P, K, D, X>

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> 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.