class Buffer
Defined at line 31 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
Concrete class for DMA buffers providing safe cache management and memory access.
Public Methods
void Buffer (void *virt,size_tsize,CacheOptionscache_options)
Defined at line 33 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
size_t size ()
Defined at line 36 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
void * virt ()
Defined at line 37 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
bool enable_cache ()
Defined at line 39 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
CacheOptions cache_options ()
Defined at line 40 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
template <typename T>
zx::result<> WriteStruct (const T & val, size_t offset)
Helper for writing a trivially copyable struct/value with automatic cache flush.
Defined at line 61 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
template <typename T>
zx::result<T> ReadStruct (size_t offset)
Helper for reading a trivially copyable struct/value with automatic cache invalidation.
Defined at line 69 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
template <typename Fn>
zx::result<> ExecuteReadOps (size_toffset,size_tlength,Fn &&fn)
Executes a read closure on the given byte range after automatically invalidating CPU cache.
Defined at line 82 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
template <typename Fn>
zx::result<> ExecuteWriteOps (size_toffset,size_tlength,Fn &&fn)
Executes a write closure on the given byte range and automatically flushes CPU cache.
Defined at line 105 of file ../../src/devices/lib/dma-buffer/include/lib/dma-buffer/buffer.h
zx::result<> CacheFlush (size_t offset, size_t length)
Flushes CPU data cache lines (clean to memory) for the given byte range.
Use after CPU writes to buffer so that DMA hardware can read from physical RAM
(DMA_TO_DEVICE).
Defined at line 210 of file ../../src/devices/lib/dma-buffer/dma-buffer.cc
zx::result<> CacheFlushInvalidate (size_t offset, size_t length)
Flushes and invalidates CPU data cache lines for the given byte range.
Use before CPU reads memory after DMA hardware writes to physical RAM (DMA_FROM_DEVICE).
Defined at line 224 of file ../../src/devices/lib/dma-buffer/dma-buffer.cc
zx::result<> Write (const void *src,size_toffset,size_tlength)
Safely writes memory to the buffer from the CPU and automatically flushes CPU cache so DMA
hardware can read from RAM (DMA_TO_DEVICE).
Defined at line 239 of file ../../src/devices/lib/dma-buffer/dma-buffer.cc
zx::result<> Read (size_toffset,size_tlength,void *dest)
Safely invalidates CPU cache and reads memory from the buffer after DMA hardware writes to RAM
(DMA_FROM_DEVICE).
Defined at line 259 of file ../../src/devices/lib/dma-buffer/dma-buffer.cc