Buffer
Component Type: Program
Status: Implemented
Overview
CProgBuffer stores notify-driven source samples in program-owned
history RAM and exposes selected samples or selected sample chunks plus
selector/status registers through program-owned virtual IO channels.
src: notify sourceout: selected sample/chunk (same dtype as source)sel: selector (0newest,1previous, …)stat: status words (count/depth/head/overflow/flags)
Implementation
CProgBuffer is a notify-driven program that stores samples in internal RAM
and serves selected history entries on demand.
Virtual IO ownership is role-specific:
srcis a consumer-side input and must already have a valid fixed shape beforebufferstartsout,sel, andstatare output-side roles whose shape may be defined bybufferitself and may therefore target deferredvirtobjectschunk_sizecontrols how many source samples are exposed throughoutper read;bufferinitializesoutwithsrc.dim * chunk_sizeelements
Configuration
Kconfig
CONFIG_DAWN_PROG_BUFFER: enables the Buffer program.
YAML
programs:
- id: buffer1
type: buffer
config:
iobind:
- src: src1
out: out1
sel: sel1
stat: stat1
depth: 16
flags: 1
chunk_size: 4
ios:
- id: out1
type: virt
dtype: uint32
Descriptor fields:
iobind: one entry withsrc,out,sel,statIDsdepth: sample capacitychunk_size: number of samples returned throughoutper selected read (defaults to 1)flags: - bit0: auto-start capture - bit1: one-shot mode (stop capture when full) - bit2: keep data on stop
Chunk Output
out provides a bulk-read view over the captured ring when chunk_size is
greater than 1. The selector value is the first history offset in the chunk.
With scalar src and chunk_size: 32, selector 0 returns offsets
0..31 (newest to older), selector 32 returns offsets 32..63, and
so on.
If the selected range reaches past the number of captured samples,
CProgBuffer zero-fills the remainder of the chunk. Readers should use the
stat count/depth words to determine how much returned data is valid.
External Control
ControlIO: supported.
CProgBuffer supports runtime start/stop control via CIOControl.
Start/stop controls capture activity. Data retention on stop depends on
flags bit2.
TriggerIO: supported.
resetclears stored samples.trigger1starts capture.trigger2stops capture without stopping the program object.
Brainstorming & Future Ideas
Notes
One
CProgBufferinstance supports a single binding.selout-of-range returns error and keeps previous selected sample.Existing descriptors with scalar
outkeep the original single-sample behavior.