Adapted by Steve Underwood <steveu@coppice.org> from the source code
supplied by Broadcom.