Skip to main content

Crate spiritlevel

Crate spiritlevel 

Source
Expand description

TMDS link bring-up for HDMI sources.

spiritlevel decides a TMDS link’s bit clock ratio and scrambling from the TMDS character rate, the sink’s and source’s facts and the caller’s policy, and states what the sink’s TMDS_Config must hold (TmdsLinkParams::choose, a pure, I/O-free function). Its procedures carry that out over the PHY and the sink’s SCDC: bring-up, tear-down, the reconnect check after a hotplug, and the quick restore.

The procedures are written once as an I/O-free core over procedure::TmdsIo, and TmdsLink drives them synchronously over a TmdsScdc, hdmi-hal’s TmdsPhy, a Clock and a Delay, with an optional Cancel flag. Each makes one attempt per call, leaving retries to the caller, and records every step as a TmdsEvent in its _with_events form.

§Features

  • display-types (default) — From conversions from display-types’ HdmiForumSinkCap into the sink facts. Without it the caller fills the sink facts itself.
  • culvert — TmdsScdc for culvert’s SCDC client, with its errors as CulvertError.

Modules§

procedure
The procedures’ I/O-free core: TmdsIo, the I/O they need, and the procedures over it, written once as async fn.

Structs§

BringUpConfig
Bring-up and quick-restore settings.
ConfigError
What BringUpConfig::validate found: every problem, at least one.
CulvertErrorculvert
culvert’s error, as TmdsScdc for culvert::Scdc<T> returns it.
FailedRead
A failed read of the check, and when it came.
HdmiForumSinkCapdisplay-types
The sink capabilities the sink facts convert from, re-exported from display-types. Decoded HDMI Forum Sink Capability Data Block (HF-SCDB, extended tag 0x79).
LinkUp
A link that is up: steps up to the output’s start completed. Whether the sink reports scrambling is the check’s, part of the outcome rather than a condition of it.
NoCancel
The cancel flag, re-exported from hdmi-hal, so one flag stops TMDS bring-up and FRL training alike. Implemented for AtomicBool and any reference to a flag. Never cancels.
Restored
A quick restore that ran to its end.
Scdcculvert
culvert’s client, its errors and the transport it runs over, re-exported for the adapter’s users. Typed client for the HDMI 2.1 SCDC (Status and Control Data Channel) register map.
ScramblingCheck
What the scrambling check found, and how.
ScramblingOff
Every condition that keeps a 1/10 link unscrambled.
ScramblingStatus
What the sink reports in Scrambling_Status (SCDC offset 0x21): whether it detects scrambled TMDS, and the byte that was read.
SinkTmdsConfig
The two fields of the sink’s TMDS_Config (SCDC offset 0x20): what is written, and what a read decodes to.
SinkTmdsFacts
What the sink declares about TMDS scrambling.
SourceTmdsFacts
What the source’s PHY can do.
TearDownConfig
Tear-down settings.
TearDownError
A tear-down in which at least one PHY step failed. Every step was still attempted, so a failed scrambler call does not leave the output running; each field holds the first failure of its step.
Timestamp
A point in time: microseconds from an arbitrary monotonic epoch.
TmdsConfigReading
What a read of the sink’s TMDS_Config returned: the two fields the SCDC implementation decoded, and the byte as read, reserved bits included, so a sink that sets them stays visible to a diagnostic tool.
TmdsEvent
One step or decision of a procedure, stamped by the procedure from its own clock.
TmdsLink
The TMDS procedures over sync parts: the sink’s SCDC, the PHY, a clock and a delay, and a cancel flag (NoCancel unless with_cancel gives one).
TmdsLinkParams
The chosen TMDS link: clock ratio, scrambling, and the sink’s TMDS_Config.
TmdsPhyCapabilities
What a TMDS PHY can do, as TmdsPhy::capabilities reports it.
TmdsPhyConfig
What TmdsPhy::configure sets.
TmdsPolicy
The caller’s choices where HDMI sources differ.
TmdsVideo
The video a TMDS link carries, as far as a PHY may need it.
TornDown
A tear-down in which every PHY step succeeded: the output is stopped.
Warnings
The warnings a bring-up gathered, in the order they arose. Fixed storage, so no alloc, and never full: each kind occurs at most once.

Enums§

BringUpError
Why a bring-up stopped.
BringUpOutcome
How a bring-up ended without an error.
BringUpWarning
What went wrong without stopping a bring-up. Each kind occurs at most once per attempt.
CancelPoint
Where a bring-up saw the caller’s cancel flag.
CheckResult
How the scrambling check ended.
Cleanup
What happened after a bring-up’s error or cancellation.
ClearFrl
Which sinks get the FRL clear (Config_1 and FLT_update) before a bring-up.
ClockRatio
The TMDS bit clock ratio, hdmi-hal’s TmdsClockRatio: the TMDS clock runs at the bit rate divided by 10 or by 40. One type, so the link parameters pass straight to TmdsPhy::configure. The TMDS bit clock ratio, as the sink’s TMDS_Bit_Clock_Ratio bit selects it.
ColorBitDepth
The colour depth and format phy::TmdsVideo carries; re-exported from display-types so that implementations name the same types hdmi-hal does. Color bit depth per primary color channel, decoded from EDID base block byte 0x14 bits 6–4.
ColorFormat
The colour depth and format phy::TmdsVideo carries; re-exported from display-types so that implementations name the same types hdmi-hal does. A single color encoding format, used to describe a specific negotiated or candidate configuration.
DdcErrorKind
The hdmi-hal types the procedures’ signatures use, re-exported so that callers and implementations name the same versions spiritlevel does without depending on hdmi-hal themselves: the PHY trait and its configuration, the clock, delay and timestamp, the SCDC error classification, and the colour depth and format a TmdsVideo carries. The kind of a DdcBus failure.
FrlClearSkip
Why the FRL clear before a bring-up was skipped.
NoAcknowledgeSource
The hdmi-hal types the procedures’ signatures use, re-exported so that callers and implementations name the same versions spiritlevel does without depending on hdmi-hal themselves: the PHY trait and its configuration, the clock, delay and timestamp, the SCDC error classification, and the colour depth and format a TmdsVideo carries. Which byte of a transaction was not acknowledged.
OnTmdsConfigFailure
What a failed TMDS_Config write does to the bring-up.
OutputDuringSinkWrite
Whether the output is stopped while the sink’s TMDS_Config is written.
OutputState
Whether the output may be running. Exhaustive: it is stopped or it may not be.
ParamsError
Why TmdsLinkParams::choose refused the inputs.
ProtocolErrorculvert
culvert’s client, its errors and the transport it runs over, re-exported for the adapter’s users. What culvert refuses because it would violate the SCDC protocol.
ReconnectCheck
What the reconnect check found.
RestoreError
A quick restore that stopped. Nothing is torn down: the link was running.
ScdcErrorculvert
culvert’s client, its errors and the transport it runs over, re-exported for the adapter’s users. Errors returned by Scdc register operations.
ScramblerOff
When the source’s scrambler is turned off in a tear-down, relative to the sink.
ScramblingDecision
Why the link is or is not scrambled.
ScramblingThreshold
Which TMDS character rate first requires scrambling and the 1/40 clock ratio.
SinkClear
What became of the sink’s TMDS_Config in a tear-down.
SinkClearSkip
Why a tear-down did not clear the sink’s TMDS_Config.
SinkClearTiming
When the sink’s TMDS_Config is cleared in a tear-down, relative to stopping the output.
SinkPresence
Whether the sink is still there, as the caller knows from hotplug.
SourceVersionSkip
Why Source_Version was not written.
SourceVersionWrite
When the source writes Source_Version before a bring-up.
TmdsConfigGate
Which sinks get the TMDS_Config write on a plain link. A scrambled link always writes it: the sink must be told.
TmdsConfigSkip
Why a bring-up did not write the sink’s TMDS_Config.
TmdsConfigWrite
How TMDS_Config is written.
TmdsEventKind
What a procedure did, decided or saw.
TmdsStep
A step of a procedure, as an event or an error names it.
UpdateError
The error of an SCDC operation made of a read and a write, saying which of them failed: a read-modify-write of TMDS_Config, or the clear of FLT_update.

Constants§

MAX_BRING_UP_EVENTS
The most events one bring-up records: its start; two each for the FRL clear and Source_Version; one for stopping the output; two for the sink’s TMDS_Config (the write and a plain link’s read-back); one for the PHY’s configuration; two for the scrambler (off, then on, when unscrambled output runs through the write); one each for the wait, the output’s start, the deadline, the scrambling check and a cancellation; the tear-down after an error or a cancellation (MAX_TEAR_DOWN_EVENTS); and its end. One more than any bring-up records: a plain link’s read-back and a scrambled link’s deadline and check never come together.
MAX_QUICK_RESTORE_EVENTS
The most events one quick restore records: its start, one each for the sink’s write, the scrambler and the scrambling check, and its end.
MAX_RECONNECT_CHECK_EVENTS
The most events one reconnect check records: its start, the read (or its failure), and its end.
MAX_TEAR_DOWN_EVENTS
The most events one tear-down records: its start, one each for the sink, the scrambler and the output, and its end.

Traits§

Cancel
The cancel flag, re-exported from hdmi-hal, so one flag stops TMDS bring-up and FRL training alike. Implemented for AtomicBool and any reference to a flag. A flag the caller sets to ask a procedure to stop.
Clock
A monotonic clock.
DdcError
The hdmi-hal types the procedures’ signatures use, re-exported so that callers and implementations name the same versions spiritlevel does without depending on hdmi-hal themselves: the PHY trait and its configuration, the clock, delay and timestamp, the SCDC error classification, and the colour depth and format a TmdsVideo carries. An error of a DdcBus, classified.
Delay
A delay.
ScdcTransportculvert
culvert’s client, its errors and the transport it runs over, re-exported for the adapter’s users. The transport Scdc<T> is generic over, re-exported from hdmi-hal. Raw register access to the SCDC register map over DDC/I²C.
TmdsPhy
TMDS control of an HDMI transmitter PHY.
TmdsScdc
The sink’s SCDC registers, as the TMDS procedures use them.