harness: configurable board model busy timings + findings

This commit is contained in:
SDD committed 2026-10-16 01:59:57 +03:00
1 parent a2f19b2d29
commit 2d7747a20d
3 files changed
+172 -1

No files matched your search

+23
View File
@@ -100,6 +100,28 @@ static void test_dma_pair_command_completes(void)
CHECK(b.read(VT1200_WIN1) == 0x0000); // completed
}
// The two timers the sweep tunes (window busy and DMA completion) must advance
// on the same tick(), or a later slower timer would silently stretch the other.
static void test_one_tick_advances_window_and_dma_timers(void)
{
vt1200_board b;
b.set_model_handshake(true);
b.set_window_busy_ticks(VT1200_WIN2, 2);
b.set_dma_ticks(2);
b.write(VT1200_WIN2 + VT1200_OFF_CMD, 0x0001); // arms WIN2's busy bit
b.write(VT1200_WIN0, 0x0000); // data port first
b.write(VT1200_WIN1, 0x0042); // then a DMA command
b.tick(); // one frame: both advance
CHECK((b.read(VT1200_WIN2 + VT1200_OFF_STATUS) & 1) == 1);
CHECK(b.read(VT1200_WIN1) == 0x0042);
b.tick();
CHECK((b.read(VT1200_WIN2 + VT1200_OFF_STATUS) & 1) == 0);
CHECK(b.read(VT1200_WIN1) == 0x0000);
}
int main(void)
{
test_default_read();
@@ -110,6 +132,7 @@ int main(void)
test_monitor_switch_accepts_raw_bits_or_position();
test_switch_mix_only_when_configured();
test_dma_pair_command_completes();
test_one_tick_advances_window_and_dma_timers();
std::printf(failures ? "%d FAILURE(S)\n" : "all board tests passed\n", failures);
return failures ? 1 : 0;
}