Add code to read and decrypt OSTC3 firmware files

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Lift the OSTC3 INIT out of open

This lifts the OSTC3 INIT command out from the open function and does
that separately. This is refactoring to be able to enter service mode so
we can access service mode commands.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add a helper to put the OSTC3 into servicemode

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add utility functions to convert uints to bytes

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add a function to erase the memory of the OSTC3

This is the fist step in the firmware upgrade process.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add function to read the rom from the OSTC3

This is necessary to verify that the memory written got transfered
correctly.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add code to write rom of the OSTC3

This is how you transfer a new firmware to the OSTC3.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add code to send upgrade firmware command to OSTC3

This function triggers a reboot into the bootloader which flashes the
new firmware to Prom.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Firmware upgrade for OSTC3

This connects the bits and implements firmware upgrade for the OSTC3.

This code is inspired by JeanDo ostc-companion.

Reviewed-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Teach examples/ostc-fwupdate about OSTC3

This teaches the example firmware upgrader about how to upgrade the
OSTC3's.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add Anton to copyright notice.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Remove unused imports

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Simplify state switching and checking for OSTC3

This simplifies the code to check and handle state switching for the
OSTC3.

Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Anton Lundin <glance@acc.umu.se>