[][src]Trait embedded_dma::WriteBuffer

pub unsafe trait WriteBuffer {
    type Word;
    unsafe fn write_buffer(&mut self) -> (*mut Self::Word, usize);
}

Trait for buffers that can be given to DMA for writing.

Safety

The implementing type must be safe to use for DMA writes. This means:

  • It must be a pointer that references the actual buffer.
  • Target must be a type that is valid for any possible byte pattern.
  • As long as no &mut self method, except for write_buffer, is called on the implementing object:
    • write_buffer must always return the same value, if called multiple times.
    • The memory specified by the pointer and size returned by write_buffer must not be freed as long as self is not dropped.

Associated Types

type Word

Loading content...

Required methods

unsafe fn write_buffer(&mut self) -> (*mut Self::Word, usize)

Provide a buffer usable for DMA writes.

The return value is:

  • pointer to the start of the buffer
  • buffer size in words

Safety

Once this method has been called, it is unsafe to call any &mut self methods, except for write_buffer, on this object as long as the returned value is in use (by DMA).

Loading content...

Implementors

impl<B, T: ?Sized> WriteBuffer for B where
    B: DerefMut<Target = T> + StableDeref,
    T: WriteTarget
[src]

type Word = T::Word

Loading content...