Skip to main content

CircRead

Struct CircRead 

Source
pub struct CircRead<'a, T: Copy, const N: usize> { /* private fields */ }
Expand description

Continuous DMA-read typestate handle.

The DMA engine reads the buffer in circular mode (typically double-buffer for audio TX, video stream-out, etc.). The CPU is the producer and may fill the inactive half through a HalfGuard<Read, _, _> obtained from CircRead::half_guard.

Implementations§

Source§

impl<'a, T: Copy, const N: usize> CircRead<'a, T, N>

Source

pub fn dma_addr(&self) -> DmaAddr

DMA bus address of the buffer (stable for the typestate’s lifetime; equal to the address returned during the start_circular_* transition).

Source

pub fn half_guard<'b, C: DcaCache>( &'b mut self, _ctx: &mut DcaCacheCtx<'_, C>, half: Half, ) -> HalfGuard<'b, Read, T, N>

Acquire a guard over the inactive half.

half names which half is currently safe to access — the caller knows from the engine’s stream-position register (NDTR for STM32 DMA, LIVR for SAI, etc.) which half the DMA is currently servicing. Per DCB-00 §6 INV-D7, releasing the guard with HalfGuard::release re-checks the stream-position.

No cache op is emitted at construction. Per DCB-00 §5 (DCB-01b-A 2026-05-03 amendment), the Read direction’s cache op fires at release — the CPU is about to write new data via the guard’s slice, so cleaning now would publish stale data. The clean at release publishes the just-completed CPU writes before the engine wraps to this half on its next pass.

ctx is unused at construction for Read direction (kept in the signature for symmetry with CircWrite::half_guard, which uses it for the entry-side invalidate).

Source

pub fn stop_circular<C: DcaCache>( self, ctx: &mut DcaCacheCtx<'_, C>, ) -> Cpu<'a, T, N>

Stop the circular transfer and transition back to Cpu.

Caller MUST stop the engine before calling. Cache op: DcaCache::clean over the full padded extent, ensuring any CPU-written data still in cache is published to RAM before the buffer leaves DCB ownership.

Auto Trait Implementations§

§

impl<'a, T, const N: usize> !RefUnwindSafe for CircRead<'a, T, N>

§

impl<'a, T, const N: usize> !UnwindSafe for CircRead<'a, T, N>

§

impl<'a, T, const N: usize> Freeze for CircRead<'a, T, N>

§

impl<'a, T, const N: usize> Send for CircRead<'a, T, N>
where T: Send,

§

impl<'a, T, const N: usize> Sync for CircRead<'a, T, N>
where T: Send,

§

impl<'a, T, const N: usize> Unpin for CircRead<'a, T, N>

§

impl<'a, T, const N: usize> UnsafeUnpin for CircRead<'a, T, N>

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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.