macro_rules! dma_read {
($dma:expr, $($proj:tt)*) => { ... };
}Expand description
Reads a field of an item from an allocated region of structs.
The syntax is of the form kernel::dma_read!(dma, proj) where dma is an expression evaluating
to a CoherentAllocation and proj is a projection specification.
ยง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);