Macro dma_write

Source
macro_rules! dma_write {
    ($dma:ident [ $idx:expr ] $($field:tt)*) => { ... };
    ($($dma:ident).* [ $idx:expr ] $($field:tt)* ) => { ... };
    ($dma:expr, $idx: expr, = $val:expr) => { ... };
    ($dma:expr, $idx: expr, $(.$field:ident)* = $val:expr) => { ... };
}
Expand description

Writes to a field of an item from an allocated region of structs.

ยงExamples

use kernel::device::Device;
use kernel::dma::{attrs::*, CoherentAllocation};

struct MyStruct { member: u32, }

// SAFETY: All bit patterns are acceptable values for `MyStruct`.
unsafe impl kernel::transmute::FromBytes for MyStruct{};
// SAFETY: Instances of `MyStruct` have no uninitialized portions.
unsafe impl kernel::transmute::AsBytes for MyStruct{};

kernel::dma_write!(alloc[2].member = 0xf);
kernel::dma_write!(alloc[1] = MyStruct { member: 0xf });