pub struct RingWriter<R> { /* private fields */ }Expand description
The firmware end of a CDBG ring: appends frames, never waits.
Implementations§
Source§impl<R: Region> RingWriter<R>
impl<R: Region> RingWriter<R>
Sourcepub unsafe fn init(region: R) -> Result<Self, RingError>
pub unsafe fn init(region: R) -> Result<Self, RingError>
Reset region to a fresh, empty ring and write into it.
Debug SRAM often survives a warm reset, so the data area is zeroed before the cursors are parked: a stale packet header that still parses as valid would otherwise read as unread data and refuse the first real frames.
§Safety
This must be the ring’s only writer for as long as it lives: two writers
would race on write_ptr and the packet data.
Sourcepub fn into_region(self) -> R
pub fn into_region(self) -> R
The region back.
Sourcepub fn snapshot(&self) -> Descriptor
pub fn snapshot(&self) -> Descriptor
A point-in-time copy of the descriptor.
Sourcepub fn mark_panic(&mut self)
pub fn mark_panic(&mut self)
Latch Flags::Panic, keeping every other flag, so the reader can tell a
crash from a clean end of stream.
Trait Implementations§
Source§impl<R: Region> TransportError for RingWriter<R>
impl<R: Region> TransportError for RingWriter<R>
Source§impl<R: Region> TrySendTransport for RingWriter<R>
Appends one frame as one packet.
impl<R: Region> TrySendTransport for RingWriter<R>
Appends one frame as one packet.
Ok: the frame is in the ring andFlags::Overflowis cleared.TryError::WouldBlock: the ring is full of unread frames; the frame was dropped andOverflowlatched. A later attempt succeeds once the reader drains.RingError::FrameTooLarge: the frame can never fit; dropped,Overflowlatched.RingError::Faulted: the writer latchedFlags::Error; nothing written.
Logs nothing: it runs inside the defmt logger, which must not re-enter
defmt.
Auto Trait Implementations§
impl<R> Forget for RingWriter<R>
impl<R> Freeze for RingWriter<R>where
R: Freeze,
impl<R> RefUnwindSafe for RingWriter<R>where
R: RefUnwindSafe,
impl<R> Send for RingWriter<R>where
R: Send,
impl<R> Sync for RingWriter<R>where
R: Sync,
impl<R> Unpin for RingWriter<R>where
R: Unpin,
impl<R> UnsafeUnpin for RingWriter<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for RingWriter<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more