hdmi_hal/ddc/mod.rs
1//! The DDC bus: one trait for every target on it.
2//!
3//! An HDMI connector carries one DDC line, an I²C bus, shared by several targets: the
4//! sink's EDID at [`EDID`] (with the E-DDC segment pointer at [`SEGMENT_POINTER`]), its
5//! DisplayID at [`DISPLAYID`], SCDC at [`SCDC`], HDCP at [`HDCP_PRIMARY`] and
6//! [`HDCP_SECONDARY`], and DDC/CI at [`DDC_CI`]. [`DdcBus`] is the contract for that bus;
7//! code that talks to one target (SCDC through `ScdcTransport`, an EDID reader, an HDCP
8//! implementation) runs over it.
9//!
10//! The hardware below differs widely: general I²C controllers, DDC masters driven by
11//! segment, address and offset registers, engines that can only read EDID, controllers
12//! shared with firmware. [`DdcCapabilities`] says what an implementation can do, and an
13//! operation it cannot do fails with [`DdcErrorKind::Unsupported`] before it reaches the bus.
14
15use core::convert::Infallible;
16use core::ops::Deref;
17
18/// The E-DDC segment pointer (8-bit address 60h), written before an EDID or DisplayID read
19/// of segment 1 or higher (VESA E-DDC 1.3, 2.2.5).
20pub const SEGMENT_POINTER: u8 = 0x30;
21
22/// HDCP's primary link port (8-bit address 74h; VESA E-DDC 1.3, Table 2-2; Linux's
23/// `DRM_HDCP_DDC_ADDR` and amdgpu's primary port, torvalds/linux `e774d5f1b`,
24/// `include/drm/display/drm_hdcp.h:30`, `drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c:128`).
25pub const HDCP_PRIMARY: u8 = 0x3A;
26
27/// HDCP's secondary link port (8-bit address 76h; VESA E-DDC 1.3, Table 2-2; amdgpu's
28/// secondary port, torvalds/linux `e774d5f1b`, `drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c:129`).
29pub const HDCP_SECONDARY: u8 = 0x3B;
30
31/// DDC/CI, the display's command interface (8-bit address 6Eh; VESA DDC/CI 1.1, 2.3).
32pub const DDC_CI: u8 = 0x37;
33
34/// The EDID structure (8-bit address A0h; VESA E-DDC 1.3, 2.2.1).
35pub const EDID: u8 = 0x50;
36
37/// The DisplayID structure (8-bit address A4h; VESA E-DDC 1.3, 2.2.1).
38pub const DISPLAYID: u8 = 0x52;
39
40/// SCDC, the status and control data channel (8-bit address A8h; Linux's SCDC helper and
41/// amdgpu, torvalds/linux `e774d5f1b`, `drivers/gpu/drm/display/drm_scdc_helper.c:56`,
42/// `drivers/gpu/drm/amd/display/dc/dc_hdmi_types.h:58`).
43pub const SCDC: u8 = 0x54;
44
45/// The highest E-DDC segment (VESA E-DDC 1.3, Tables 5-1 and 5-2: 00h–7Fh).
46pub const MAX_SEGMENT: u8 = 0x7F;
47
48/// Whether `addr` is a 7-bit address a [`DdcBus`] may be asked to reach: not above 0x7F,
49/// and outside I²C's reserved ranges 0x00–0x07 and 0x78–0x7F.
50///
51/// An implementation returns [`DdcErrorKind::Unsupported`], without bus activity, for an
52/// address this rejects.
53pub const fn is_usable_address(addr: u8) -> bool {
54 addr >= 0x08 && addr <= 0x77
55}
56
57/// Access to the DDC bus of one connector.
58///
59/// # Operations
60///
61/// | Method | On the wire |
62/// |---|---|
63/// | [`write`](Self::write) | START, address + W, `bytes`, STOP |
64/// | [`write_read`](Self::write_read) | START, address + W, `bytes`, repeated START, address + R, `buf.len()` bytes, STOP |
65/// | [`read`](Self::read) | START, address + R, `buf.len()` bytes, STOP |
66/// | [`read_segmented`](Self::read_segmented) | an E-DDC read: for segment 1 and higher a write of the segment to [`SEGMENT_POINTER`], then as `write_read` with the offset to the target, with no STOP in between; for segment 0, no write to the pointer |
67///
68/// Register-style targets (SCDC, HDCP) take a register offset as the first byte of
69/// `bytes`.
70///
71/// # One call, one transaction
72///
73/// [`write`](Self::write), [`write_read`](Self::write_read) and [`read`](Self::read) each
74/// run as one transaction or return an error: an implementation never splits them into
75/// several transfers. Where the hardware does so anyway (one byte per hardware
76/// operation), the implementation says so through [`DdcCapabilities::splits_reads`].
77///
78/// [`read_segmented`](Self::read_segmented) may be split into several E-DDC transactions,
79/// each writing the segment pointer and the offset again (the display resets the pointer
80/// on STOP or NACK: VESA E-DDC 1.3, 2.2.5, 8.1.1); an implementation that splits reports
81/// its piece size through [`DdcCapabilities::segmented_piece`]. A split read can span a
82/// hotplug and return a block made of two EDIDs: the block checksum is the check.
83///
84/// Between two calls, another user's transaction may run: nothing here holds the bus
85/// across calls.
86///
87/// # Sharing
88///
89/// Every method takes `&self`, so several users (an EDID reader, an SCDC client, an HDCP
90/// implementation) share one bus through references or shared pointers. The
91/// implementation serializes concurrent calls, one transaction at a time, and never panics
92/// doing so; one that cannot serialize returns an error for the second call and says so in
93/// its documentation.
94///
95/// # Arguments
96///
97/// Checked before any bus activity:
98///
99/// - `addr` outside [`is_usable_address`]: [`DdcErrorKind::Unsupported`].
100/// - An empty `buf` (in `read`, `write_read`, `read_segmented`): `Ok`, no bus activity.
101/// - `write_read` with empty `bytes` is a [`read`](Self::read).
102/// - `write` with empty `bytes`: [`DdcErrorKind::Unsupported`] (a zero-length write is
103/// I²C's address probe, which many adapters reject).
104/// - `read_segmented` with `segment` above [`MAX_SEGMENT`], or `offset + buf.len()` above
105/// 256: [`DdcErrorKind::Unsupported`].
106/// - Anything [`capabilities`](Self::capabilities) rules out (a length, an address, a
107/// target, a segment): [`DdcErrorKind::Unsupported`].
108///
109/// # E-DDC
110///
111/// For segment 1 and higher, a missing acknowledge of the pointer value fails the read: the
112/// display has no such segment (VESA E-DDC 1.3, 6.4, 6.5). For segment 0 an implementation
113/// does not need to write the pointer, and a display without one still answers (8.1.2);
114/// hardware whose engine writes it anyway conforms all the same. A read across the
115/// 128-byte block boundary is allowed, but whether the display continues past it is the
116/// display's (2.2.6).
117///
118/// # Errors
119///
120/// Every error carries a [`DdcErrorKind`]. An implementation adds no retries of its own;
121/// retries in the layer below it (an OS bus layer, a fallback in the driver) are named in
122/// its documentation, since they multiply with the caller's. After an error the bus is
123/// usable for the next call as far as the hardware allows: the implementation recovers it
124/// (clock pulses, an abort, a reset) or says what is needed. The contents of `buf` after
125/// an error are unspecified.
126///
127/// # Example
128///
129/// A bus that reaches nothing but an EDID store, as an EDID-only engine does:
130///
131/// ```
132/// use hdmi_hal::ddc::{DdcBus, DdcCapabilities, DdcError, DdcErrorKind, EddcTarget};
133///
134/// #[derive(Debug)]
135/// struct Unsupported;
136///
137/// impl DdcError for Unsupported {
138/// fn kind(&self) -> DdcErrorKind {
139/// DdcErrorKind::Unsupported
140/// }
141/// }
142///
143/// /// Two blocks of EDID, segment 0 only.
144/// struct EdidEngine {
145/// edid: [u8; 256],
146/// }
147///
148/// impl DdcBus for EdidEngine {
149/// type Error = Unsupported;
150///
151/// fn capabilities(&self) -> DdcCapabilities {
152/// DdcCapabilities::none()
153/// .with_eddc_target(EddcTarget::Edid, true)
154/// .with_max_segment(Some(0))
155/// }
156///
157/// fn write(&self, _addr: u8, _bytes: &[u8]) -> Result<(), Unsupported> {
158/// Err(Unsupported)
159/// }
160///
161/// fn write_read(&self, _addr: u8, _bytes: &[u8], _buf: &mut [u8]) -> Result<(), Unsupported> {
162/// Err(Unsupported)
163/// }
164///
165/// fn read(&self, _addr: u8, _buf: &mut [u8]) -> Result<(), Unsupported> {
166/// Err(Unsupported)
167/// }
168///
169/// fn read_segmented(
170/// &self,
171/// target: EddcTarget,
172/// segment: u8,
173/// offset: u8,
174/// buf: &mut [u8],
175/// ) -> Result<(), Unsupported> {
176/// let start = usize::from(offset);
177/// if target != EddcTarget::Edid || segment != 0 || start + buf.len() > 256 {
178/// return Err(Unsupported);
179/// }
180/// buf.copy_from_slice(&self.edid[start..start + buf.len()]);
181/// Ok(())
182/// }
183/// }
184///
185/// let bus = EdidEngine { edid: [0; 256] };
186/// let mut header = [0u8; 8];
187/// bus.read_segmented(EddcTarget::Edid, 0, 0, &mut header).unwrap();
188/// assert!(!bus.capabilities().reaches(hdmi_hal::ddc::SCDC));
189/// ```
190pub trait DdcBus {
191 /// The error type, classified by [`DdcError::kind`].
192 type Error: DdcError;
193
194 /// What this implementation can do. Never more than it can: what it cannot vouch for,
195 /// it reports as unavailable.
196 fn capabilities(&self) -> DdcCapabilities;
197
198 /// Write `bytes` to `addr` in one transaction.
199 fn write(&self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>;
200
201 /// Write `bytes` to `addr`, then read `buf.len()` bytes from it after a repeated START,
202 /// in one transaction.
203 fn write_read(&self, addr: u8, bytes: &[u8], buf: &mut [u8]) -> Result<(), Self::Error>;
204
205 /// Read `buf.len()` bytes from `addr` in one transaction, with no write before it.
206 fn read(&self, addr: u8, buf: &mut [u8]) -> Result<(), Self::Error>;
207
208 /// Read `buf.len()` bytes of `target`'s structure from `segment`, starting at `offset`
209 /// within it: an E-DDC read (see "E-DDC" above).
210 fn read_segmented(
211 &self,
212 target: EddcTarget,
213 segment: u8,
214 offset: u8,
215 buf: &mut [u8],
216 ) -> Result<(), Self::Error>;
217}
218
219/// A handle to a [`DdcBus`]: what code that shares the bus holds.
220///
221/// Implemented for every handle that dereferences to a bus (`&B`, `&'static B`, `Rc<B>`,
222/// `Arc<B>`), with no `alloc` needed. A handle that is itself a cheap, `Copy` view of a bus
223/// (a test double's, for instance) implements it for itself, so it is passed by value:
224///
225/// ```
226/// use hdmi_hal::ddc::{DdcBus, DdcCapabilities, DdcHandle, EddcTarget};
227///
228/// /// A `Copy` view of some bus.
229/// #[derive(Clone, Copy)]
230/// struct View;
231///
232/// impl DdcBus for View {
233/// type Error = hdmi_hal::ddc::DdcErrorKind;
234/// fn capabilities(&self) -> DdcCapabilities {
235/// DdcCapabilities::none()
236/// }
237/// fn write(&self, _: u8, _: &[u8]) -> Result<(), Self::Error> {
238/// Ok(())
239/// }
240/// fn write_read(&self, _: u8, _: &[u8], _: &mut [u8]) -> Result<(), Self::Error> {
241/// Ok(())
242/// }
243/// fn read(&self, _: u8, _: &mut [u8]) -> Result<(), Self::Error> {
244/// Ok(())
245/// }
246/// fn read_segmented(&self, _: EddcTarget, _: u8, _: u8, _: &mut [u8]) -> Result<(), Self::Error> {
247/// Ok(())
248/// }
249/// }
250///
251/// impl DdcHandle for View {
252/// type Bus = Self;
253/// fn bus(&self) -> &Self {
254/// self
255/// }
256/// }
257/// ```
258pub trait DdcHandle {
259 /// The bus it is a handle to.
260 type Bus: DdcBus + ?Sized;
261
262 /// The bus.
263 fn bus(&self) -> &Self::Bus;
264}
265
266impl<H> DdcHandle for H
267where
268 H: Deref,
269 H::Target: DdcBus,
270{
271 type Bus = H::Target;
272
273 fn bus(&self) -> &H::Target {
274 self
275 }
276}
277
278/// An error of a [`DdcBus`], classified.
279///
280/// Implemented for [`Infallible`] and `()` (kind [`DdcErrorKind::Other`]), so test doubles
281/// can use either, and for [`DdcErrorKind`] itself.
282pub trait DdcError: core::fmt::Debug {
283 /// What kind of failure this is.
284 fn kind(&self) -> DdcErrorKind;
285}
286
287/// The kind of a [`DdcBus`] failure.
288///
289/// What a kind means to a caller: [`NoAcknowledge`](Self::NoAcknowledge) usually means
290/// nothing answers at that address, not always (a passive adapter may refuse a first
291/// transaction); [`Timeout`](Self::Timeout), [`Busy`](Self::Busy) and
292/// [`Other`](Self::Other) may be transient; [`Unsupported`](Self::Unsupported) and
293/// [`Detached`](Self::Detached) are not.
294#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
295#[non_exhaustive]
296pub enum DdcErrorKind {
297 /// A byte was not acknowledged.
298 NoAcknowledge(NoAcknowledgeSource),
299 /// The transaction did not complete in time: a clock held low too long, a stuck bus,
300 /// or the implementation's own limit.
301 Timeout,
302 /// The bus or the controller is held by someone else: lost arbitration, another
303 /// master, firmware or a hardware engine.
304 Busy,
305 /// An operation, address, target, segment or length this implementation cannot do,
306 /// refused before bus activity.
307 Unsupported,
308 /// The bus is gone: its adapter removed, the device unplugged.
309 Detached,
310 /// Any other failure, including one the implementation cannot classify.
311 Other,
312}
313
314/// Which byte of a transaction was not acknowledged.
315#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
316#[non_exhaustive]
317pub enum NoAcknowledgeSource {
318 /// The address byte: usually, nothing answers at that address.
319 Address,
320 /// A data byte.
321 Data,
322 /// Not known: many controllers do not report which byte it was.
323 Unknown,
324}
325
326/// The structures an E-DDC read reaches, each with its own address and the shared segment
327/// pointer (VESA E-DDC 1.3, 2.2.1, 2.2.4).
328#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
329#[non_exhaustive]
330pub enum EddcTarget {
331 /// The EDID structure, at [`EDID`].
332 Edid,
333 /// The DisplayID structure, at [`DISPLAYID`].
334 DisplayId,
335}
336
337impl EddcTarget {
338 /// The target's 7-bit address.
339 pub const fn address(self) -> u8 {
340 match self {
341 EddcTarget::Edid => EDID,
342 EddcTarget::DisplayId => DISPLAYID,
343 }
344 }
345
346 const fn bit(self) -> u8 {
347 match self {
348 EddcTarget::Edid => 0b01,
349 EddcTarget::DisplayId => 0b10,
350 }
351 }
352}
353
354impl DdcError for Infallible {
355 fn kind(&self) -> DdcErrorKind {
356 match *self {}
357 }
358}
359
360impl DdcError for () {
361 fn kind(&self) -> DdcErrorKind {
362 DdcErrorKind::Other
363 }
364}
365
366/// A kind is an error of its own kind, for an implementation with nothing more to report
367/// (as embedded-hal's `ErrorKind` is its own `Error`).
368impl DdcError for DdcErrorKind {
369 fn kind(&self) -> DdcErrorKind {
370 *self
371 }
372}
373
374/// The addresses [`is_usable_address`] accepts, as a set (bit `n` for address `n`).
375const USABLE_ADDRESSES: u128 = {
376 let mut set = 0u128;
377 let mut addr = 0u8;
378 while addr <= 0x7F {
379 if is_usable_address(addr) {
380 set |= 1u128 << addr;
381 }
382 addr += 1;
383 }
384 set
385};
386
387/// What a [`DdcBus`] implementation can do.
388///
389/// It may under-state, never over-state: what an implementation cannot vouch for, it
390/// reports as unavailable, and the operation returns [`DdcErrorKind::Unsupported`] before
391/// it reaches the bus.
392///
393/// Built from [`general`](Self::general) or [`none`](Self::none) and the `with_*`
394/// setters, all `const`:
395///
396/// ```
397/// use hdmi_hal::ddc::{DdcCapabilities, DDC_CI, SCDC};
398///
399/// // An SMBus-style adapter: one-byte offsets, 32-byte block reads, single-byte plain reads.
400/// const SMBUS: DdcCapabilities = DdcCapabilities::general()
401/// .with_write_max(33)
402/// .with_write_read_max(1, 32)
403/// .with_read_max(1)
404/// .with_max_segment(Some(0))
405/// .with_segmented_piece(Some(32));
406///
407/// assert_eq!(SMBUS.write_read_max(), (1, 32));
408/// assert!(SMBUS.reaches(SCDC));
409///
410/// // A controller that cannot reach DDC/CI.
411/// let caps = DdcCapabilities::general().with_address_reachable(DDC_CI, false);
412/// assert!(!caps.reaches(DDC_CI));
413/// ```
414#[derive(Debug, Clone, Copy, PartialEq, Eq)]
415pub struct DdcCapabilities {
416 write_max: u16,
417 write_read_write_max: u16,
418 write_read_read_max: u16,
419 read_max: u16,
420 reachable: u128,
421 eddc_targets: u8,
422 max_segment: Option<u8>,
423 segmented_piece: Option<u16>,
424 splits_reads: bool,
425 stretch_timeout_us: Option<u32>,
426}
427
428impl DdcCapabilities {
429 /// Everything: every usable address, no length limit below `u16::MAX`, both E-DDC
430 /// targets up to [`MAX_SEGMENT`], reads in one transaction, stretch timeout unknown.
431 pub const fn general() -> Self {
432 DdcCapabilities {
433 write_max: u16::MAX,
434 write_read_write_max: u16::MAX,
435 write_read_read_max: u16::MAX,
436 read_max: u16::MAX,
437 reachable: USABLE_ADDRESSES,
438 eddc_targets: EddcTarget::Edid.bit() | EddcTarget::DisplayId.bit(),
439 max_segment: Some(MAX_SEGMENT),
440 segmented_piece: None,
441 splits_reads: false,
442 stretch_timeout_us: None,
443 }
444 }
445
446 /// Nothing: no operation, no address, no E-DDC target.
447 pub const fn none() -> Self {
448 DdcCapabilities {
449 write_max: 0,
450 write_read_write_max: 0,
451 write_read_read_max: 0,
452 read_max: 0,
453 reachable: 0,
454 eddc_targets: 0,
455 max_segment: None,
456 segmented_piece: None,
457 splits_reads: false,
458 stretch_timeout_us: None,
459 }
460 }
461
462 /// The longest [`write`](DdcBus::write), offset byte included; `0`: not available.
463 pub const fn with_write_max(mut self, len: u16) -> Self {
464 self.write_max = len;
465 self
466 }
467
468 /// The longest write part (offset byte included) and read part of a
469 /// [`write_read`](DdcBus::write_read); `0` in either: not available.
470 pub const fn with_write_read_max(mut self, write: u16, read: u16) -> Self {
471 self.write_read_write_max = write;
472 self.write_read_read_max = read;
473 self
474 }
475
476 /// The longest [`read`](DdcBus::read); `0`: not available.
477 pub const fn with_read_max(mut self, len: u16) -> Self {
478 self.read_max = len;
479 self
480 }
481
482 /// The addresses [`write`](DdcBus::write), [`write_read`](DdcBus::write_read) and
483 /// [`read`](DdcBus::read) reach, as a set (bit `n` for address `n`). Addresses
484 /// [`is_usable_address`] rejects are removed.
485 pub const fn with_reachable_addresses(mut self, set: u128) -> Self {
486 self.reachable = set & USABLE_ADDRESSES;
487 self
488 }
489
490 /// Whether `addr` is reachable; ignored for an address [`is_usable_address`] rejects.
491 pub const fn with_address_reachable(mut self, addr: u8, reachable: bool) -> Self {
492 if is_usable_address(addr) {
493 if reachable {
494 self.reachable |= 1u128 << addr;
495 } else {
496 self.reachable &= !(1u128 << addr);
497 }
498 }
499 self
500 }
501
502 /// Whether [`read_segmented`](DdcBus::read_segmented) reaches `target`.
503 pub const fn with_eddc_target(mut self, target: EddcTarget, reads: bool) -> Self {
504 if reads {
505 self.eddc_targets |= target.bit();
506 } else {
507 self.eddc_targets &= !target.bit();
508 }
509 self
510 }
511
512 /// The highest segment [`read_segmented`](DdcBus::read_segmented) reads (`None`: no
513 /// segmented reads; `Some(0)`: segment 0 only); capped at [`MAX_SEGMENT`].
514 pub const fn with_max_segment(mut self, max: Option<u8>) -> Self {
515 self.max_segment = match max {
516 Some(segment) if segment > MAX_SEGMENT => Some(MAX_SEGMENT),
517 other => other,
518 };
519 self
520 }
521
522 /// The piece size [`read_segmented`](DdcBus::read_segmented) splits a read into, each
523 /// piece its own E-DDC transaction (`None`: one transaction).
524 pub const fn with_segmented_piece(mut self, piece: Option<u16>) -> Self {
525 self.segmented_piece = piece;
526 self
527 }
528
529 /// Whether [`write_read`](DdcBus::write_read) and [`read`](DdcBus::read) reach the wire
530 /// as several transactions (a byte per hardware operation, for example).
531 pub const fn with_splits_reads(mut self, splits: bool) -> Self {
532 self.splits_reads = splits;
533 self
534 }
535
536 /// How long a clock stretch is tolerated before [`DdcErrorKind::Timeout`], in
537 /// microseconds (`None`: unknown). DDC/CI 1.1 requires its host to give up after 2 ms
538 /// (6.6).
539 pub const fn with_stretch_timeout_us(mut self, timeout: Option<u32>) -> Self {
540 self.stretch_timeout_us = timeout;
541 self
542 }
543
544 /// The longest [`write`](DdcBus::write), offset byte included; `0`: not available.
545 pub const fn write_max(&self) -> u16 {
546 self.write_max
547 }
548
549 /// The longest write part and read part of a [`write_read`](DdcBus::write_read).
550 pub const fn write_read_max(&self) -> (u16, u16) {
551 (self.write_read_write_max, self.write_read_read_max)
552 }
553
554 /// The longest [`read`](DdcBus::read); `0`: not available.
555 pub const fn read_max(&self) -> u16 {
556 self.read_max
557 }
558
559 /// The reachable addresses, as a set (bit `n` for address `n`).
560 pub const fn reachable_addresses(&self) -> u128 {
561 self.reachable
562 }
563
564 /// Whether [`write`](DdcBus::write), [`write_read`](DdcBus::write_read) and
565 /// [`read`](DdcBus::read) reach `addr`.
566 pub const fn reaches(&self, addr: u8) -> bool {
567 addr <= 0x7F && self.reachable & (1u128 << addr) != 0
568 }
569
570 /// Whether [`read_segmented`](DdcBus::read_segmented) reaches `target`.
571 pub const fn reads_target(&self, target: EddcTarget) -> bool {
572 self.eddc_targets & target.bit() != 0
573 }
574
575 /// The highest segment [`read_segmented`](DdcBus::read_segmented) reads (`None`: no
576 /// segmented reads).
577 pub const fn max_segment(&self) -> Option<u8> {
578 self.max_segment
579 }
580
581 /// The piece size of a split [`read_segmented`](DdcBus::read_segmented) (`None`: one
582 /// transaction).
583 pub const fn segmented_piece(&self) -> Option<u16> {
584 self.segmented_piece
585 }
586
587 /// Whether reads reach the wire as several transactions.
588 pub const fn splits_reads(&self) -> bool {
589 self.splits_reads
590 }
591
592 /// The stretch timeout in microseconds (`None`: unknown).
593 pub const fn stretch_timeout_us(&self) -> Option<u32> {
594 self.stretch_timeout_us
595 }
596}
597
598#[cfg(test)]
599mod tests;