Skip to main content

TmdsScdc

Trait TmdsScdc 

Source
pub trait TmdsScdc {
    type Error: DdcError;

    // Required methods
    async fn write_tmds_config(
        &mut self,
        config: SinkTmdsConfig,
    ) -> Result<(), Self::Error>;
    async fn update_tmds_config(
        &mut self,
        config: SinkTmdsConfig,
    ) -> Result<(), UpdateError<Self::Error>>;
    async fn read_tmds_config(
        &mut self,
    ) -> Result<TmdsConfigReading, Self::Error>;
    async fn read_scrambling_status(
        &mut self,
    ) -> Result<ScramblingStatus, Self::Error>;
    async fn read_sink_version(&mut self) -> Result<u8, Self::Error>;
    async fn write_source_version(
        &mut self,
        version: u8,
    ) -> Result<(), Self::Error>;
    async fn clear_frl_rate(&mut self) -> Result<(), Self::Error>;
    async fn clear_flt_update(
        &mut self,
    ) -> Result<bool, UpdateError<Self::Error>>;
}
Expand description

The sink’s SCDC registers, as the TMDS procedures use them, async.

Each method has the contract of its namesake in spiritlevel::TmdsScdc, whose documentation says which procedure step makes each call, which register each touches and what each returns; here the methods are async.

§Errors

Error is a DdcError: its kind tells the procedures which failures to poll through and which to stop on, as with the sync trait. An operation made of a read and a write returns UpdateError, saying which of the two failed.

§Bounded calls

Each call completes in bounded time. The procedures read the cancel flag between calls, not during one, so a call that never returns (a transfer the bus never finishes) cannot be cancelled. An implementation bounds its calls and reports a transfer that does not finish as an error of kind DdcErrorKind::Timeout.

§Cancellation

If a call’s future is dropped before it completes, whether a write reached the sink is unknown, and a caller that needs to know reads the register back. The procedures never drop one: they are stopped through the driver’s cancel flag. The clause matters only to other code that calls the trait.

§Send

The futures are not required to be Send, so implementations for single-threaded executors may hold !Send state across an .await. Code that spawns a procedure on a multi-threaded executor bounds its SCDC implementation by SendTmdsScdc instead.

Required Associated Types§

Source

type Error: DdcError

The error of one transfer, classified by DdcError::kind.

Required Methods§

Source

async fn write_tmds_config( &mut self, config: SinkTmdsConfig, ) -> Result<(), Self::Error>

Source

async fn update_tmds_config( &mut self, config: SinkTmdsConfig, ) -> Result<(), UpdateError<Self::Error>>

See spiritlevel::TmdsScdc::update_tmds_config.

§Errors

UpdateError::Read when the read failed (nothing written), UpdateError::Write when the write failed.

Source

async fn read_tmds_config(&mut self) -> Result<TmdsConfigReading, Self::Error>

Source

async fn read_scrambling_status( &mut self, ) -> Result<ScramblingStatus, Self::Error>

Source

async fn read_sink_version(&mut self) -> Result<u8, Self::Error>

Source

async fn write_source_version(&mut self, version: u8) -> Result<(), Self::Error>

Source

async fn clear_frl_rate(&mut self) -> Result<(), Self::Error>

Source

async fn clear_flt_update(&mut self) -> Result<bool, UpdateError<Self::Error>>

See spiritlevel::TmdsScdc::clear_flt_update.

§Errors

UpdateError::Read when the read failed (nothing known, nothing written), UpdateError::Write when the flag was set and the clear failed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: ScdcTransport> TmdsScdc for &mut Scdc<T>

Available on crate feature culvert-async only.

The client lent to the driver, so one client serves the SCDC setup, FRL training, TMDS bring-up and health reads in turn without being moved. Its futures are Send under the same conditions as the client’s.

Source§

impl<T: ScdcTransport> TmdsScdc for Scdc<T>

Available on crate feature culvert-async only.

culvert-async’s client, as spiritlevel’s culvert adapter implements the sync trait for culvert’s: update_tmds_config is the client’s read-modify-write, and the bytes read reach TmdsConfigReading::raw and ScramblingStatus::raw.

The plain trait, not the twin: implementing both for one type would conflict with the blanket implementation. Its futures are Send all the same where the compiler can see the transport: in code generic over T: SendScdcTransport that names Scdc<T>, the driver’s futures are Send under the conditions the crate root gives (“Send futures”).

The client has inherent methods named like five of these (read_tmds_config, write_tmds_config, update_tmds_config, read_sink_version, write_source_version), with culvert’s types, and a method call picks those over the trait’s: with TmdsScdc in scope, scdc.read_tmds_config() still returns culvert’s reading. Call the trait’s through the trait, TmdsScdc::read_tmds_config(&mut scdc), as the driver does.

Source§

impl<T: SendTmdsScdc> TmdsScdc for T