macro_rules! dma_read {
($dma:expr, $idx: expr, $($field:tt)*) => { ... };
($dma:ident [ $idx:expr ] $($field:tt)* ) => { ... };
($($dma:ident).* [ $idx:expr ] $($field:tt)* ) => { ... };
}
Expand description
Reads a field of an item from an allocated region of structs.
ยงExamples
use kernel::device::Device;
use kernel::dma::{attrs::*, CoherentAllocation};
struct MyStruct { field: 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{};
let whole = kernel::dma_read!(alloc[2]);
let field = kernel::dma_read!(alloc[1].field);