Skip to main content

FrlTrainer

Struct FrlTrainer 

Source
pub struct FrlTrainer<C, P> { /* private fields */ }
Expand description

The central async training type. Owns an async ScdcClient and an async HdmiPhy.

The async counterpart to plumbob::FrlTrainer: it runs plumbob’s state machine, plumbob::lts::run, awaiting each SCDC and PHY operation, so it yields to the executor wherever the I/O waits. Reusable across training attempts; use into_parts to recover the SCDC client and PHY.

§Cancellation

train is not cancel-safe. Dropping its future — a select! against a hot-unplug, a timeout — stops training wherever it is: the sink may be configured for an FRL rate and the PHY driving training patterns, and no LTS:L runs, since a future cannot await anything once dropped. Call exit_to_tmds afterwards to return both ends to TMDS. Bounding training is better left to the poll limits in TrainingConfig, which end every attempt in a defined state.

Implementations§

Source§

impl<C: ScdcClient, P: HdmiPhy> FrlTrainer<C, P>

Source

pub fn new(scdc: C, phy: P) -> Self

Constructs a new FrlTrainer owning the given async SCDC client and PHY.

Source

pub fn into_parts(self) -> (C, P)

Consumes the trainer and returns the SCDC client and PHY.

Source

pub fn scdc(&self) -> &C

The SCDC client.

Source

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

The SCDC client, mutably.

Source

pub fn phy(&self) -> &P

The PHY.

Source

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

The PHY, mutably: after Success, for example, to start video with set_frl_output(FrlOutput::Active).

Source

pub async fn exit_to_tmds( &mut self, ) -> Result<(), ExitError<C::Error, P::Error>>

LTS:L on demand: stops the training patterns, returns the PHY to TMDS, turns FRL off in Config_1 and clears FLT_update if it is set.

The async counterpart to plumbob::FrlTrainer::exit_to_tmds: for taking an FRL link down when the display is disabled or unplugged, before a mode change, after an error that did not lead to LTS:L (TmdsExit::Skipped or HeldUnderTest), and after a dropped train future (see Cancellation). Safe to call in any state, and again. Every step is attempted even when one fails.

Source

pub async fn train_at_rate( &mut self, rate: HdmiForumFrl, config: &TrainingConfig, ) -> Result<Trained, TrainingError<<C as ScdcClient>::Error, <P as HdmiPhy>::Error>>

Trains at a single rate: train(&[rate], config).

Source

pub async fn train( &mut self, rates: &[HdmiForumFrl], config: &TrainingConfig, ) -> Result<Trained, TrainingError<<C as ScdcClient>::Error, <P as HdmiPhy>::Error>>

Trains over rates in order, stepping down when the sink requests it.

The async counterpart to plumbob::FrlTrainer::train, with the same outcomes and errors. Not cancel-safe: see Cancellation.

Source

pub async fn train_with_events<F: FnMut(TrainingEvent)>( &mut self, rates: &[HdmiForumFrl], config: &TrainingConfig, record: &mut F, ) -> Result<Trained, TrainingError<<C as ScdcClient>::Error, <P as HdmiPhy>::Error>>

Like train, calling record with each TrainingEvent as it occurs: the events train_traced (with alloc) collects, without an allocator. record is a plain callback; it is called between I/O operations, never while one is awaited.

Auto Trait Implementations§

§

impl<C, P> Freeze for FrlTrainer<C, P>
where C: Freeze, P: Freeze,

§

impl<C, P> RefUnwindSafe for FrlTrainer<C, P>

§

impl<C, P> Send for FrlTrainer<C, P>
where C: Send, P: Send,

§

impl<C, P> Sync for FrlTrainer<C, P>
where C: Sync, P: Sync,

§

impl<C, P> Unpin for FrlTrainer<C, P>
where C: Unpin, P: Unpin,

§

impl<C, P> UnsafeUnpin for FrlTrainer<C, P>
where C: UnsafeUnpin, P: UnsafeUnpin,

§

impl<C, P> UnwindSafe for FrlTrainer<C, P>
where C: UnwindSafe, P: UnwindSafe,

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.