Commit Graph

20 Commits (7df887fe69d6dabe975299b45c8b99f8e74f63c0)

Author SHA1 Message Date
Russ Butler 7df887fe69 Remove blocking option from USB connect
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.
2019-01-29 12:27:26 -06:00
Maciej Bocianski 0bdeb0450e USBDevice: endpoint_add/read_start functions return value fix 2019-01-29 12:27:25 -06:00
Russ Butler 6c427ee369 Add endpoint_remove_all helper function
Add the helper function endpoint_remove_all which removes all added
endpoints. This is useful for class drivers switching between
different USB configurations.
2019-01-29 12:27:25 -06:00
Maciej Bocianski 5d40f34c33 code formatting fixes 2019-01-29 12:27:25 -06:00
Maciej Bocianski e515a52ffa USBDevice - add multiconfiguration support 2019-01-29 12:27:25 -06:00
Russ Butler 72cc182aa4 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.
2019-01-29 12:27:23 -06:00
Russ Butler b8995e8c29 Add abort API to USBDevice
Add the function endpoint_abort and ensure ongoing transfer are
aborted when an endpoint is removed.
2019-01-29 12:27:22 -06:00
Russ Butler 3c42cd7bd1 Update USBDevice to reflect the updated USBPhy
Update USBDevice so the USB buffers are user supplied.
2019-01-29 12:27:22 -06:00
Russ Butler bf2dd81784 Call disconnect when uninitializing USB
Disconnect USB when uninitializing USB so it is in a well defined
state.
2019-01-29 12:27:22 -06:00
Russ Butler cb3c9d5ed7 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.
2019-01-29 12:27:22 -06:00
Russ Butler 38ab9b502f Allow transfer to start when configuring USB
Allow reads and writes to be started when entering the configured
state.
2019-01-29 12:27:22 -06:00
Russ Butler 3dd9b7a8dc 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.
2019-01-29 12:27:21 -06:00
Russ Butler 1730b497c9 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.
2019-01-29 12:27:21 -06:00
Russ Butler 22f1dbe14c 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.
2019-01-29 12:27:21 -06:00
Russ Butler 2c202ac224 Update USBTester for simplified read handling
Remove read_start and replace read_finish with read to match the new
USBDevice API.
2019-01-29 12:27:21 -06:00
Russ Butler 679ca0dc0a 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.
2019-01-29 12:27:21 -06:00
Russ Butler a8ac294f34 Add and assert USB callback completion
Assert that when a callback is completed it is the active callback.
2019-01-29 12:27:21 -06:00
Russ Butler c855577662 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.
2019-01-29 12:27:20 -06:00
Russ Butler 14b0c313ed Update USB licenses and format code
Update USB licenses from MIT to Apache 2 and run astyle on the code.
2019-01-29 12:27:20 -06:00
Russ Butler 61a575af23 Copy USBDevice from unsupported
Copy the USBDevice code out of unsupported and into a top level USB
folder in preparation for development.

squash
2019-01-29 12:27:20 -06:00