Files
templates/c/logic-scope/README.md
T
Andrey 0b743c97f9 docs: собери справочник API и описания аппаратных портов
Свяжи инструкции библиотек и портов с общим справочником. Расширь сборку Doxygen и документируй публичные интерфейсы.
2026-12-02 11:33:46 +03:00

30 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Logic inputs in a native Scope UI
`include/logic_scope.h` is the portable, allocation-free C model for eight
logic inputs and PWM duty reconstruction. The FPGA register mapping and
framebuffer UI belong to the board application.
- `LogicScope`: bounded sample buffer, per-channel OFF/LOGIC/PWM mode,
sample clock/divider, capture origin, and retained snapshot.
- `logic_scope_plan`: chooses a count/divider for a requested duration;
limits are 65,536 samples and divider 65,535. Longer requested intervals
produce shorter captures; the UI must not stretch them to fill the view.
- `logic_scope_pwm`: emits midpoint/value pairs for complete active-high
PWM periods. Value is `2 * high_samples / period_samples - 1`. Initial
and final incomplete periods are omitted; constant levels have no PWM
period and emit no points. This is normalized modulation, not voltage.
The RK7020 consumer is `zynq_7020_OSC/demo/hdmi_usb_menu/`.
Its `tests/test_logic_scope.c` checks the capture plan, phase-shifted PWM,
constant inputs, menu selection, retained snapshots, and renderer bounds.
`include/scope_decoders.h` contains the portable DSView catalogue/configuration/annotation model; the isolated ARM adapter is in `tools/scope-decoders`. The framebuffer UI and UIO acquisition live in the Zynq board project.
`include/logic_stream.h` assembles contiguous stream blocks into bounded windows, checks block sequence, preserves trigger edges across block boundaries, and stops after one window in SINGLE. FREE/RISE/FALL/HIGH/LOW use an explicitly selected D0-D7 input. Frame publication is independent of how many windows the display renders. The board integration owns DMA acknowledgement, overflow handling and exclusive UIO access.
## API библиотеки
Подберите делитель и число выборок через logic_scope_plan(). logic_scope_pwm() вычисляет по полным периодам нормированное значение `2 × high / period − 1`. При постоянном уровне точек PWM нет.
Передавайте последовательные блоки в logic_stream_feed(), сбрасывайте состояние при разрыве источника через logic_stream_reset(). Отдельный `scope_decoders.h` описывает каталог декодеров, их параметры и результаты, а приложение владеет захватом и отрисовкой. [Контракт процесса декодирования](../../tools/scope-decoders/README.md).