Wednesday, October 1, 2008

Explore Your Hardware: iotools and prettyprint

By Tim Hockin and Aaron Durbin, Platforms Software Team

One of the most difficult and tedious things we do here in the Platforms Team is figure out what is going wrong with a new piece of hardware. Generally that means we need to examine a bunch of hardware registers and see how the device is configured. If you've never had to do this, let us assure you - it isn't much fun, especially when you have a few hundred bit fields to decode.

We're software guys, so the solution, of course, was to write some code! We thought some of you out there might find our work useful, so we're happy to release these tools.

The first piece is iotools - a suite of simple command line tools which allow you to read and write hardware registers. With iotools you can write simple shell scripts to read the device information Cmockery: Easier Unit Tests for C Applicationsyou need, process it, and write it back to the hardware. Currently iotools includes support for PCI, IO, memory mapped IO, MSR, CPUID, TSC, SMBus, and CMOS. It also includes a bunch of simple arithmetic and logical tools to make your scripting even easier.

The second piece is prettyprint - a library and set of tools which allow you extract hardware data in human-readable form. prettyprint includes a simple device description "language". Once a device has been described, prettyprint can find any instances of the device and produce a tree of objects which can be read from and written to symbolically. Never again will you have to remember that bits [8:6] of the wibble register contain the frobnicator amplification factor, encoded in 1/2 dB units. prettyprint will just tell you.

These tools have proven to be useful to us in the platforms team at Google. We hope some of you find them useful too. Patches are welcome!

To find out more, please visit the iotools home page or iotools discussion group and the prettyprint home page or prettyprint discussion group.

Link - from Google Open Source Blog

No comments: