mbed-os/usb/device/USBDevice
Russ Butler 2c4686f468 Update USBDevice endpoint checks to fix asserts
Only assert if disabled endpoints are used when USBDevice is
configured. USBDevice can leave the configured state due to a
reset at any time, which disables all endpoints. Because this
can happen at any time, thread processing could be performing
any endpoint operation. The endpoint operation should return
failure and do nothing in this case, rather than asserting
as this is not an application error.

An assert should only be triggered when an invalid endpoint is
used after the use of USBDevice acknoledges the switch to
configured mode by complete_set_configuration.

In specific this PR fixes the assert caused with the following
sequence:

-ISR: OUT event sent
-ISR: USB reset event
-ISR: USB configure request start
-Thread: OUT event processed on thread and next read starts
        ***endpoint is used while disabled causing an invalid assert***
-Thread: reset event processed
-Thread: configure event processed

This patch fixes this problem by making the following changes:
1. Operations done on disabled endpoints only assert when in the configured state
2. Adding and removing endpoints is only allowed when
    the flag _endpoint_add_remove_allowed is set
3. The flag _endpoint_add_remove_allowed is set on the set
    configuration request and cleared if the request is aborted  or
    fails
2019-01-29 12:27:28 -06:00
..
EndpointResolver.cpp Fix various USB warnings 2019-01-29 12:27:28 -06:00
EndpointResolver.h Add USBPhy, USB HAL and Utility class 2019-01-29 12:27:20 -06:00
USBDescriptor.h Update USBDevice and configure to use a USBPhy 2019-01-29 12:27:20 -06:00
USBDevice.cpp Update USBDevice endpoint checks to fix asserts 2019-01-29 12:27:28 -06:00
USBDevice.h Update USBDevice endpoint checks to fix asserts 2019-01-29 12:27:28 -06:00
USBDevice_Types.h Update USBDevice and configure to use a USBPhy 2019-01-29 12:27:20 -06:00