Skip to main content

RawU32Slice

Type Alias RawU32Slice 

Source
pub type RawU32Slice = RawSlice<u32>;

Aliased Type§

pub struct RawU32Slice { /* private fields */ }

Trait Implementations§

Source§

impl ReadBuffer for RawU32Slice

This allows using Self in DMA based APIs which expect a embedded_dma::ReadBuffer.

However, the user still must ensure that any alignment rules for DMA buffers required by the hardware are met and than any MPU/MMU configuration necessary is also performed for this to work properly.

§Safety

  • The raw slice type erases the lifetime of slice. The caller MUST ensure that the lifetime of the slice is valid as long as the buffer is in-use by the DMA.
  • It is also imperitive that the DMA system you’re using returns the pointer only after a DMA transfer is complete. If you’re unsure check the docs and if nothing is mentioned in the docs please clarify it with a project maintainer.
  • If the raw slice wrapper is used on a stack allocated slice: Higher-level APIs oftentimes rely on Drop implementations to allow cancelling transfers on non-blocking APIs. Using core::mem::forget on such implementations can leak the underlying memory. HAL and firmware authors MUST either use this abstraction combined with 'static slices or ensure that the Drop implementations always runs properly.
Source§

type Word = u32

Source§

unsafe fn read_buffer(&self) -> (*const Self::Word, usize)

Provide a buffer usable for DMA reads. Read more