Doc comments for hal and lib.

Just leaves `drivers` (and `platformtree`) to go.
It isn't currently (I had a quick check before I submitted). But I'll do a find/replace tonight.