pub struct DmaBuffer {
pub physical_addr: u64,
pub virtual_addr: u64,
pub size: usize,
}Expand description
DMA-capable buffer
Fields§
§physical_addr: u64Physical address (for DMA)
virtual_addr: u64Virtual address (for CPU access)
size: usizeBuffer size
Implementations§
Source§impl DmaBuffer
impl DmaBuffer
Sourcepub fn new(size: usize) -> Result<Self, KernelError>
pub fn new(size: usize) -> Result<Self, KernelError>
Create new DMA buffer by allocating a physical frame.
Allocates a frame from the frame allocator and maps it via the kernel’s
direct physical memory mapping. The frame provides at least size bytes
of DMA-capable memory.
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8]
pub fn as_mut_slice(&mut self) -> &mut [u8]
Get mutable slice