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
impl TmdsLinkParams
Sourcepub const fn choose(
rate_khz: u32,
sink: SinkTmdsFacts,
source: SourceTmdsFacts,
policy: TmdsPolicy,
) -> Result<TmdsLinkParams, ParamsError>
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_Configvalue, nor does a plain link on a sink without scrambling support underTmdsConfigGate::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);Sourcepub const fn clock_ratio(&self) -> TmdsClockRatio
pub const fn clock_ratio(&self) -> TmdsClockRatio
The TMDS bit clock ratio.
Sourcepub const fn scrambling(&self) -> bool
pub const fn scrambling(&self) -> bool
Whether the link is scrambled: true for ScramblingDecision::Required and
ScramblingDecision::LowRate.
Sourcepub const fn scrambling_decision(&self) -> ScramblingDecision
pub const fn scrambling_decision(&self) -> ScramblingDecision
Why the link is or is not scrambled.
Sourcepub const fn sink_config(&self) -> Option<SinkTmdsConfig>
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.
Sourcepub const fn sink(&self) -> SinkTmdsFacts
pub const fn sink(&self) -> SinkTmdsFacts
The sink facts the link was chosen from: what the link assumes about the sink.
Sourcepub fn fits(&self, sink: SinkTmdsFacts) -> bool
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
impl Clone for TmdsLinkParams
Source§fn clone(&self) -> TmdsLinkParams
fn clone(&self) -> TmdsLinkParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more