Commit Graph

22078 Commits (3d605b672a0ba55eca24faeb24dc73ab59812d72)

Author SHA1 Message Date
Russ Butler 3d605b672a Require USB classes to implement descriptor
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.
2019-01-29 12:27:27 -06:00
Russ Butler 6984060b9f Update USBHID and USBCDC for new AsyncOp
Update USB classes to use the new AsyncOp API.
2019-01-29 12:27:27 -06:00
Russ Butler bfa9992c7d Refactor AsyncOp class
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.
2019-01-29 12:27:27 -06:00
Maciej Bocianski 6959485857 USB basic test documentation update 2019-01-29 12:27:27 -06:00
Maciej Bocianski 8df154bfe5 USB basic test update
disable suspend/resume test
disable sync frame test
improve reset test
2019-01-29 12:27:26 -06:00
jeromecoutant e4e6152610 STM32F4: replace CLOCK_SOURCE_USB by DEVICE_USBDEVICE 2019-01-29 12:27:26 -06:00
jeromecoutant 9deed441c3 NUCLEO_F103RB: replace CLOCK_SOURCE_USB by DEVICE_USBDEVICE 2019-01-29 12:27:26 -06:00
Maciej Bocianski 1d82a78bed Update usb test to connect and block itself
Update the basic usb test so it does blocking itself since blocking
connect was removed from USBDevice.
2019-01-29 12:27:26 -06:00
Russ Butler f1c00e48fe Update the USBHID classes
Update the USB classes USBHID, USBKeyboard, USBMouse and
USBMouseKeyboard from the unsupported folder.
2019-01-29 12:27:26 -06:00
Russ Butler f1c21c1796 Fix typo in USBTester.h
Fix the spelling of product_release.
2019-01-29 12:27:26 -06:00
Russ Butler 67b3993974 Cleanup USBSerial
Make the following changes
-Make blocking the first parameter in the constructor
-Add destructor and proper cleanup
-Add ready and wait_ready functions
2019-01-29 12:27:26 -06:00
Russ Butler beddff36e9 Add USBDevice destructor
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.
2019-01-29 12:27:26 -06:00
Russ Butler 0c52350540 Remove extra USBDevice constructor
Remove the second USBDevice constructor since it does not provide
any new functionality.
2019-01-29 12:27:26 -06:00
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 3c46367634 pyusb_basic test update
test code refactoring
align test to use device multiconfiguration
2019-01-29 12:27:26 -06:00
Maciej Bocianski 9c067409da pyusb_basic test add helper functions 2019-01-29 12:27:25 -06:00
Maciej Bocianski 4bd67af6ea pyusb_basic test formatting fixes 2019-01-29 12:27:25 -06:00
Maciej Bocianski 54f21c3526 Extend USB test class configuration 2019-01-29 12:27:25 -06:00
Russ Butler af5c99d5c1 Explicitly specify USBPhy used for testing
Add a parameter to the USBPhy class so mock or wrapper USBPhy classes
can be used.
2019-01-29 12:27:25 -06:00
Russ Butler da46ea2b9c Make USB disconnect + connect time explicit
Create the define MIN_DISCONNECT_TIME_US to be used as the amount of
time that must pass between connect and disconnect for the host to
reliably detect reconnection. Replace the wait calls delaying for this
value to wait_us to indicate the precision required. Finally, remove
the unnecessary calls to wait_ms in
repeated_construction_destruction_test.
2019-01-29 12:27:25 -06:00
Russ Butler bdb8b5f342 Fix Kinetis USB disconnect
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.
2019-01-29 12:27:25 -06:00
Russ Butler 0ae8defc60 Prevent Kinetis USB setup packets at wrong time
When disconnecting USB clear all pending interrupts. This ensures that
pending setup packets are dropped rather than being triggered after
disconnect.
2019-01-29 12:27:25 -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
Maciej Bocianski bfa3dc4962 USBDevice - add support for deconfiguration 2019-01-29 12:27:24 -06:00
Maciej Bocianski 2cacae9411 USB reset test fix 2019-01-29 12:27:24 -06:00
Maciej Bocianski bcec6455a6 target: arch_pro enable USBDEVICE support 2019-01-29 12:27:24 -06:00
Russ Butler 977c571606 Fix USB tests
Change the direction used in set interface to match the USB
specification. This allows USB tests to pass on OSX.
2019-01-29 12:27:24 -06:00
Russ Butler c85f0dc249 Skip USB reset tests on OSX
OSX machines don't allow you to reset USB devices. Skip this test on
OSX so testing can still be used.
2019-01-29 12:27:24 -06:00
Maciej Bocianski 75a7e38e9e Fix for USB set_clear_feature_test for OSX 2019-01-29 12:27:24 -06:00
Russ Butler 4b4cea9f59 Update USBTester product name
Change the name reported by USBTester from CDC DEVICE to
MBED TEST DEVICE.
2019-01-29 12:27:24 -06:00
Russ Butler 56e6b17757 Add pyusb to requirements
Add pyusb to requirements so the greentea USB tests work.
2019-01-29 12:27:24 -06:00
Russ Butler 06250319cf Add USBPhy template
Add a template for implementing a USBPhy.
2019-01-29 12:27:23 -06:00
Russ Butler 8b0517de8e Move USBPhy and related files to USB directory
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/*
2019-01-29 12:27:23 -06:00
Maciej Bocianski 5f4e84a726 USB generic tests 2019-01-29 12:27:23 -06:00
Russ Butler b9f004fc87 Improve LPC1768 USB stability
Make the following changes to improve stability:
-When disconnecting set address to disabled to prevent nacks
-Clear EP_SLOW one and only once for every interrupt where it is set_address
-Disable and clear control endpoint interrupts when disconnecting
2019-01-29 12:27:23 -06:00
Russ Butler 7e0a3fd8ec Disable endpoints when disconnecting on Kinetis
Even thought the USB phy is disabled during disconnect, endpoints
still nack packets sent. This patch disables all endpoints so after
disconnect no USB traffic will be sent. This allows brief disconnects
of ~200us (or more) to be reliably detected by the host PC.
2019-01-29 12:27:23 -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 c443a259dc Correct Kinetis 256 byte ctrl transfers
Correctly handle control transfers which are a multiple of 256 bytes
by checking for a non-zero value in the upper byte of size.
2019-01-29 12:27:23 -06:00
Russ Butler 0f2b808c88 Fix Kinetis endpoint initialization
Fully setup endpoint before enabling it in endpoint_add. This prevents
undefined behavior due to previous configuration.
2019-01-29 12:27:23 -06:00
Russ Butler 58f49940e8 Remove the USB directory from mbed 2 travis
Don't include the USB directory when testing mbed 2 on travis.
2019-01-29 12:27:23 -06:00
Russ Butler 58f9b02517 Update USBCDC and USBSerial
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.
2019-01-29 12:27:23 -06:00
Russ Butler a6c249b223 Add USB utility classes
Add an allocation free linked list implementation. Additionally add
the class AsyncOp which provides blocking and wakeup funcionality
to simplify making asynchronous operations block.
2019-01-29 12:27:22 -06:00
Russ Butler cf6cbfec00 Update USBPhy doxygen
Update USBPhy doxygen to pull in handbook copyedits. Also update the
docs to reflect the enhanced USBPhy API.
2019-01-29 12:27:22 -06:00
Russ Butler 392ceae16d Update the Kinetis USB driver to the new API
Update this driver to match the new zero-copy API.
2019-01-29 12:27:22 -06:00
Russ Butler f30ecb77a3 Update the LPC17XX driver to the new API
Update this driver to match the new zero-copy API.
2019-01-29 12:27:22 -06:00
Russ Butler 9b09f43f04 Update USBTester for the new USB API
Update the class USBTester so it works with the new zero-copy
USBDevice API.
2019-01-29 12:27:22 -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