This code was previously passing a pointer to stack
data into PIOS_USBHOOK_CtrlTx() which may be sending
this data asynchronously. Now pass a pointer to
static data so that the asynchronous send doesn't
tx random stack contents.
CDC and USART device drivers were not all clearing their
device structs before using them.
This specifically caused crashes in the case where the upper
COM layer was binding only a Tx path. The Rx path callback
in the lower driver was uninitialized random data and would
result in the lower driver faulting when it tried to call the
callback.
Conflicts:
flight/PiOS/STM32F30x/pios_usart.c
flight/PiOS/STM32F30x/pios_usb_cdc.c
flight/PiOS/STM32F30x/pios_usb_hid.c
The req parameter is passed to the OUT stage as a convenience.
Since the OUT callback is called *after* the transfer has occurred,
modifying the req would have absolutely no effect. Marking this
as const makes this expectation clear.
This move and rework also breaks the dependency of the task monitor on the UAVO subsystem,
and pushes the responsibility for updating the TaskInfo UAVO into the System module.
+review OPReview