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, X: Cancel> TmdsLink<S, P, K, D, X>
impl<S: TmdsScdc, P: TmdsPhy, K: Clock, D: Delay, X: Cancel> TmdsLink<S, P, K, D, X>
Sourcepub fn with_cancel<X2: Cancel>(self, cancel: X2) -> TmdsLink<S, P, K, D, X2>
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.
Sourcepub fn into_parts(self) -> (S, P, K, D, X)
pub fn into_parts(self) -> (S, P, K, D, X)
The parts back.
Sourcepub fn scdc_mut(&mut self) -> &mut S
pub fn scdc_mut(&mut self) -> &mut S
The SCDC client, mutably: between procedures, for reads of the caller’s own.
Sourcepub fn phy_mut(&mut self) -> &mut P
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.
Sourcepub fn clock(&self) -> &K
pub fn clock(&self) -> &K
The clock the procedures stamp their events from, so a caller can stamp its own on the same timebase.
Sourcepub 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>>
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.
Sourcepub 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>>
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>>
Sourcepub 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>>
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.
Sourcepub 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>>
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>>
Sourcepub async fn check_reconnect(
&mut self,
link: &TmdsLinkParams,
current_sink: SinkTmdsFacts,
) -> ReconnectCheck<S::Error>
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.
Sourcepub async fn check_reconnect_with_events(
&mut self,
link: &TmdsLinkParams,
current_sink: SinkTmdsFacts,
record: &mut impl FnMut(TmdsEvent),
) -> ReconnectCheck<S::Error>
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.
Sourcepub 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>>
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.
Sourcepub 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>>
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.