Skip to content

examples: add GPIO drive strength config parser and htool gpio sweep … - #309

Open
qwerty-10434 wants to merge 1 commit into
google:mainfrom
qwerty-10434:gpio-sweep
Open

qwerty-10434 wants to merge 1 commit into
google:mainfrom
qwerty-10434:gpio-sweep

Conversation

@qwerty-10434

Copy link
Copy Markdown

…command

Add a zero-dependency configuration file parser and an interactive 'htool gpio sweep' subcommand in examples/htool_gpio.{c,h} to step through GPIO drive strengths (0..3) across SPI interfaces (spidev, spihost0, spihost1) for signal integrity (SI) validation.

  • Parse per-interface 6-signal pad mappings (.clk, .cs, .d0, .d1, .d2, .d3) using DIO0..DIO15 and MIO0..MIO46 pad names (matching 'htool gpio set_drive_strength --dio/--mio') and drive strength lists (.drive_strengths).
  • Require all 6 SPI signals to be explicitly mapped for each configured interface, and reject unrecognised keys, invalid values, or lines exceeding the maximum line length.
  • Read back each pad immediately after setting its drive strength and warn on stderr if the readback value does not match.
  • Save the initial drive strengths of all 6 pads before sweeping and restore them on every exit path (normal completion, 'q', EOF, a failed set, or SIGINT/SIGTERM/SIGHUP).
  • Support '--dry_run' ('-n') to step through combinations without connecting to a RoT device or sending host commands.
  • Add unit tests in examples/htool_gpio_test.cc and a reference configuration file in examples/gpio_sweep.conf.example.

…command

Add a zero-dependency configuration file parser and an interactive
'htool gpio sweep' subcommand in examples/htool_gpio.{c,h} to step
through GPIO drive strengths (0..3) across SPI interfaces (spidev,
spihost0, spihost1) for signal integrity (SI) validation.

- Parse per-interface 6-signal pad mappings (<spi>.clk, .cs, .d0, .d1,
  .d2, .d3) using DIO0..DIO15 and MIO0..MIO46 pad names (matching
  'htool gpio set_drive_strength --dio/--mio') and drive strength
  lists (<spi>.drive_strengths).
- Require all 6 SPI signals to be explicitly mapped for each configured
  interface, and reject unrecognised keys, invalid values, or lines
  exceeding the maximum line length.
- Read back each pad immediately after setting its drive strength and
  warn on stderr if the readback value does not match.
- Save the initial drive strengths of all 6 pads before sweeping and
  restore them on every exit path (normal completion, 'q', EOF, a
  failed set, or SIGINT/SIGTERM/SIGHUP).
- Support '--dry_run' ('-n') to step through combinations without
  connecting to a RoT device or sending host commands.
- Add unit tests in examples/htool_gpio_test.cc and a reference
  configuration file in examples/gpio_sweep.conf.example.
@qwerty-10434
qwerty-10434 marked this pull request as ready for review October 12, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant