Code cleanup & documentation, bug fix.

1. Added documentation comments to internal HCI functions.
2. Organized functions logically.
3. Renamed wifi_init -> wlan_init for consistency with other wlan_ functions.
4. Removed unused #defines, cleaned up remainder.
5. Removed unused / unneeded global variables, made internal ones static.
6. Removed unused global variable listen_socket.
7. Moved variables to explicitly sized types.

Fixed a bug (symptomless as far as I know) where the first HCI command didn't properly initialize its payload size or padding state.
This should have resulted in a bad HCI communication sequence, but it somehow seemed to be working.