Skip to main content

RawBufSlice

Type Alias RawBufSlice 

Source
pub type RawBufSlice = RawU8Slice;

Aliased Type§

pub struct RawBufSlice { /* private fields */ }

Trait Implementations§

Source§

impl ReadBuffer for RawBufSlice

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

Source§

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

Provide a buffer usable for DMA reads. Read more