Skip to main content

TmdsLinkParams

Struct TmdsLinkParams 

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

The chosen TMDS link: clock ratio, scrambling, and the sink’s TMDS_Config.

Built only by choose, so the sink’s value always matches the link the source runs.

Implementations§

Source§

impl TmdsLinkParams

Source

pub const fn choose( rate_khz: u32, sink: SinkTmdsFacts, source: SourceTmdsFacts, policy: TmdsPolicy, ) -> Result<TmdsLinkParams, ParamsError>

Chooses the link for a TMDS character rate.

rate_khz is the TMDS character rate in kHz, rounded up: truncating would put a rate just above 340 000 kHz on the wrong side of the threshold.

  • Above the policy’s threshold, the link is 1/40 and scrambled, on a sink with SCDC and scrambling support.
  • At or below it, the link is 1/10, and scrambled when the source, the sink (SCDC, scrambling support and LTE_340Mcsc_scramble) and the policy all allow it; otherwise every reason is reported.
  • At exactly 340 000 kHz with ScramblingThreshold::AtOrAbove340, a sink without SCDC or scrambling support, or a source without a scrambler, gets the plain 1/10 link, and the flag that says why.
  • A source without a scrambler is treated as a sink that cannot take scrambling: refused above 340 000 kHz, unscrambled at or below.
  • A sink without SCDC gets no TMDS_Config value, nor does a plain link on a sink without scrambling support under TmdsConfigGate::ScramblingSink.
§Errors

ParamsError::AboveSourceMaximum for a rate above the source’s own maximum, checked first. ParamsError::ScramblingUnsupported for a rate above 340 000 kHz on a sink without SCDC or scrambling support, or from a source without a scrambler.

§Example
use spiritlevel::{
    ClockRatio, ScramblingDecision, SinkTmdsFacts, SourceTmdsFacts, TmdsLinkParams,
    TmdsPolicy,
};

// 4K at 60 Hz, 8 bpc RGB: 594 MHz.
let sink = SinkTmdsFacts::new(true, true, false);
let source = SourceTmdsFacts::new(false);
let link = TmdsLinkParams::choose(594_000, sink, source, TmdsPolicy::DEFAULT)?;

assert_eq!(link.clock_ratio(), ClockRatio::Div40);
assert_eq!(link.scrambling_decision(), ScramblingDecision::Required);
let config = link.sink_config().expect("the sink has SCDC");
assert!(config.scrambling_enable && config.high_tmds_clock_ratio);
Source

pub const fn rate_khz(&self) -> u32

The TMDS character rate the link was chosen for, in kHz.

Source

pub const fn clock_ratio(&self) -> TmdsClockRatio

The TMDS bit clock ratio.

Source

pub const fn scrambling(&self) -> bool

Whether the link is scrambled: true for ScramblingDecision::Required and ScramblingDecision::LowRate.

Source

pub const fn scrambling_decision(&self) -> ScramblingDecision

Why the link is or is not scrambled.

Source

pub const fn sink_config(&self) -> Option<SinkTmdsConfig>

What the sink’s TMDS_Config must hold; None exactly when no write is due: a sink without SCDC, or a plain link the policy’s TmdsConfigGate leaves unwritten.

Source

pub const fn sink(&self) -> SinkTmdsFacts

The sink facts the link was chosen from: what the link assumes about the sink.

Source

pub fn fits(&self, sink: SinkTmdsFacts) -> bool

Whether the link still fits a sink with the facts sink: choose, with the source facts and the policy this link was chosen with, gives the same clock ratio, scrambling and TMDS_Config value. A fact the link does not depend on (such as SinkTmdsFacts::frl_capable, or LTE_340Mcsc_scramble on a 1/40 link) may differ.

Trait Implementations§

Source§

impl Clone for TmdsLinkParams

Source§

fn clone(&self) -> TmdsLinkParams

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 Copy for TmdsLinkParams

Source§

impl Debug for TmdsLinkParams

Source§

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

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

impl Eq for TmdsLinkParams

Source§

impl Hash for TmdsLinkParams

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TmdsLinkParams

Source§

fn eq(&self, other: &TmdsLinkParams) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TmdsLinkParams

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.