Make the function configuration_desc pure virtual inside USBDevice.
This should be a compile time error since no subclass will work
without a configuration descriptor.
Add the OperationList class to simplify managing async operations.
Add a callback to the AsyncOp class so completion can be signaled with
another mechanism. Finally rework the lock handling so AsyncOp::wait
is passed the lock to use rather than taking it in a constructor.
Make the following changes
-Make blocking the first parameter in the constructor
-Add destructor and proper cleanup
-Add ready and wait_ready functions
Add a destructor to USBDevice to ensure that resources have been
properly released. Additionally add an assert in the destructor that
deinit has already been called. If it has not been called then
interrupts can still occur which may cause a crash.
Remove the option to block in USBDevice::connect since this
should be handled at a higher level. Also call init to ensure that
the USBDevice has been initalized.
When disconnecting in the middle of a setup packet USB stops working
even after being re-connected. This is because the setup packet
suspended endpoint events but nothing resumed endpoint events.
This patch adds code to resume endpoint events in the reset handler.
Add the helper function endpoint_remove_all which removes all added
endpoints. This is useful for class drivers switching between
different USB configurations.
Move the USBPhy header files into usb/device/USBPhy. Also move hal
and target USB files since mbed 2 does not compile when these files
are present without the USBPhy headers.
Directory restructure summary:
platform/USBPhy*
to usb/device/USBPhy/USBPhy*
hal/*
to usb/device/hal/*
targets/TARGET_Freescale/usb/*
to usb/device/targets/TARGET_Freescale/*
targets/TARGET_NXP/TARGET_LPC176X/usb/*
to usb/device/targets/TARGET_NXP/*
Update the USBCDC and USBSerial classes to the new API. This patch also
updates the blocking behavior to unblock at the appropriate times and
to let the processor sleep when blocking rather than busy waiting.
Add an allocation free linked list implementation. Additionally add
the class AsyncOp which provides blocking and wakeup funcionality
to simplify making asynchronous operations block.
Stalling endpoint 0 indicates the end of a control transfer.
Return immediately when this occurs rather than continuing processing.
In particular, this patch prevents status from erroneously being
sent when _request_setup returns false inside _complete_request.
Perform processing triggered by user callbacks when USB is being
unlocked rather than synchronously. This prevents recursive callbacks
which reduces stack usage. This also prevents state change inside
the user callback which makes the code easier to reason about.
Initialize the _transfer structure so the behavior is the same
regardless of prior memory contents. This fixes a hang during
USB testing when CI flags are used.
Remove the USBDevice function read_start and automatically start all
reads internally in USBDevice. This patch also renames the function
read_finish to read.