Skip to main content

RawBufSliceMut

Type Alias RawBufSliceMut 

Source
pub type RawBufSliceMut = RawU8SliceMut;

Aliased Type§

pub struct RawBufSliceMut { /* private fields */ }

Trait Implementations§

Source§

impl WriteBuffer for RawBufSliceMut

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

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 was also performed.

§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, allowing hardware to write to invalid memory locations. 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 write_buffer(&mut self) -> (*mut Self::Word, usize)

Provide a buffer usable for DMA writes. Read more