Russ Butler
bbb22d54f4
Limit USB control transfer size
...
Limit the size of control reads to the max packet size of endpoint
zero. This fixes the handling of large transfers.
2018-03-27 14:32:00 +02:00
Russ Butler
7f3de3e23e
Add abort API to USBDevice
...
Add the function endpoint_abort and ensure ongoing transfer are
aborted when an endpoint is removed.
2018-03-27 14:31:59 +02:00
Russ Butler
601bc24010
Update USBDevice to reflect the updated USBPhy
...
Update USBDevice so the USB buffers are user supplied.
2018-03-27 14:31:59 +02:00
Russ Butler
14f34360c7
Call disconnect when uninitializing USB
...
Disconnect USB when uninitializing USB so it is in a well defined
state.
2018-03-27 14:31:59 +02:00
Russ Butler
4259f148ee
Explicitly return when endpoint 0 is stalled
...
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.
2018-03-27 14:31:59 +02:00
Russ Butler
94f056b2cb
Allow transfer to start when configuring USB
...
Allow reads and writes to be started when entering the configured
state.
2018-03-27 14:31:59 +02:00
Russ Butler
a1eb310bcc
Move USBDevice processing out of user callbacks
...
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.
2018-03-27 14:31:59 +02:00
Russ Butler
1b0a91a5ef
Update stall state on set and clear feature
...
Call USBDevice::endpoint_stall/unstall in the request to set/clear
halt so the endpoint state is properly updated in the array
_endpoint_info.
2018-03-27 14:31:59 +02:00
Russ Butler
f1e46b8545
Fix USB init problems
...
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.
2018-03-27 14:31:59 +02:00
Russ Butler
05aafac28b
Update USBTester for simplified read handling
...
Remove read_start and replace read_finish with read to match the new
USBDevice API.
2018-03-27 14:31:59 +02:00
Russ Butler
311e8b7d0d
Change USBDevice read handling
...
Remove the USBDevice function read_start and automatically start all
reads internally in USBDevice. This patch also renames the function
read_finish to read.
2018-03-27 14:31:59 +02:00
Russ Butler
4aba910249
Add and assert USB callback completion
...
Assert that when a callback is completed it is the active callback.
2018-03-27 14:31:59 +02:00
Russ Butler
1440603b1f
Update USBDevice and configure to use a USBPhy
...
Update the USBDevice class API so it matches mbed-os's naming
conventions, has a more robust API and uses USBPhy as its backend.
2018-03-27 14:31:58 +02:00
Russ Butler
b6a2141645
Update USB licenses and format code
...
Update USB licenses from MIT to Apache 2 and run astyle on the code.
2018-03-27 14:31:58 +02:00
Russ Butler
a64f663a43
Copy USBDevice from unsupported
...
Copy the USBDevice code out of unsupported and into a top level USB
folder in preparation for development.
squash
2018-03-27 14:31:58 +02:00
Russ Butler
9c4611faae
Add USBPhy, USB HAL and Utility class
...
Add the USBPhy and USBPhyEvents abstract classes, the HAL header using
this class and the EndpointResolver utility class.
2018-03-27 14:31:58 +02:00