summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/bench_main.zig28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/bench_main.zig b/tools/bench_main.zig
index 18b204e..973c004 100644
--- a/tools/bench_main.zig
+++ b/tools/bench_main.zig
@@ -961,6 +961,34 @@ fn check(port: *serial.Port, o: Options, r: *Report) !void {
r.print(" and a later Peek still finds it {s}\n", .{if (still) "ok" else "FAILED"});
if (!still) failures += 1;
+ // 4. A PAD ACTUALLY FLIPS, AND THE FIRMWARE READS IT BACK RATHER THAN ASSUMING IT.
+ //
+ // `Gpio <pin>` crosses the whole seam this check exists for: the editor's word, the C ABI
+ // (`GpioFn`, which is why the ABI version is 2), the firmware's `hal.gpio` configure-and-drive,
+ // the pad, and the level read back out of the output register onto the message row. Nothing
+ // smaller exercises the ABI at all.
+ //
+ // The ORACLE IS THE ALTERNATION, not either answer alone. `0->1` on its own is what a firmware
+ // that printed a hardcoded string would also say; two runs reporting `0->1` then `1->0` can only
+ // come from a level that was stored somewhere and read again. Three runs, so the third confirms
+ // the second was not a coincidence of ordering.
+ //
+ // GPIO33 because `src/oracle/ledc_cases.zig` already documents it as a free pin on this board's
+ // JP1 header - pin 21. GPIO20 is the blink demo's pin and may have a wire on it.
+ var flips: [3][]const u8 = undefined;
+ var flip_text: [3][4096]u8 = undefined;
+ for (&flips, &flip_text) |*f, *dst| {
+ const raw = try runWord(port, &buf, "Gpio 33");
+ f.* = stripAnsi(dst, raw);
+ }
+ const first_low = std.mem.indexOf(u8, flips[0], "33: 0->1") != null;
+ const alternates = for (flips, 0..) |f, i| {
+ const want = if ((i % 2 == 0) == first_low) "33: 0->1" else "33: 1->0";
+ if (std.mem.indexOf(u8, f, want) == null) break false;
+ } else true;
+ r.print(" a pad flips and reads back {s}\n", .{if (alternates) "ok" else "FAILED"});
+ if (!alternates) failures += 1;
+
// A BURST IS NOT CHECKED HERE, deliberately. The bug it would cover - input lost while the
// transmitter was full - has a deterministic host test in `src/pardes/input_rescue.zig` that
// loses 67 bytes with the rescue removed and needs no board at all. Every hardware oracle for it