Commit Graph

31 Commits (9676edd36bbdee99d3680f78b00a7e0186598898)

Author SHA1 Message Date
Cruz Monrreal II a1c047aba4 Added missing astyle corrections for usb/device/targets/* 2019-03-20 12:57:36 -05:00
Russ Butler 8ffbe5c603 Lock sleep when USB is initialized
None of the USB drivers currently support entering deep sleep mode
while USB is active. To protect USB from malfunctioning lock deep
sleep in USBPhyHw::init.
2019-02-28 15:21:23 -06:00
Russ Butler 6527cf2bad Update files to include SPDX-License-Identifier
Update the header of all files to use a newer license template which
includes SPDX-License-Identifier.
2019-02-22 10:53:24 -06:00
bcostm a98eb739b1 STM32F7 USB: add NUCLEO_F756ZG in pins definition 2019-02-22 10:53:23 -06:00
bcostm e96b8a4803 STM32F7 USB: change VBUS pin for DISCO_F746NG FS 2019-02-22 10:53:22 -06:00
bcostm 82498cf3f8 STM32L4 USB: add pins definition for STM32L496/L4R5 MCUs 2019-02-22 10:53:22 -06:00
TomoYamanaka b3dec25ceb Renesas : Implement USB Device feature
I implemented USB Device feature for Renesas mbed boards.
The code referenced the following code as a starting point and is implemented it by inheritting USBPhy same as other boards.
(mbed-os\features\unsupported\USBDevice\targets\TARGET_RENESAS)
2019-02-22 10:53:22 -06:00
bcostm becb32061d STM32F4 USB: remove useless macro 2019-02-22 10:53:22 -06:00
Russ Butler 468df713fc Ignore disabled Kinetis USB endpoint interrupts
Ignore interrupts on disabled USB endpoints. This prevents handling
interrupts when in the wrong state.

Prior to this patch when running the serial test on a K64F the assert
on line 908 of USBDevice.cpp would sometimes be triggered. This
assert indicates that an endpoint 0 IN interrupt occurred before
the device was ready.

This occurs during the test_cdc_usb_reconnect test when the host sends
a "Set Control Line State" USB request and the device acknowledges it
just before USB is disconnected.
2019-02-22 10:53:20 -06:00
Russ Butler 130927068c Remove HAL_GetTick from ST USBPhy
Remove the function HAL_GetTick from the ST USBPhy driver. This is no
longer needed as that change has been made on master.
2019-02-22 10:53:20 -06:00
Russ Butler 6b0e9400b0 Fix ST test failures due to endpoint reconfiguration
Also always use the max endpoint size for SetTxFifo
since re-configuring fifos when endpoints are added or removed
causes tests to fail.
2019-02-22 10:53:18 -06:00
Russ Butler 5fde071509 Implement endpoint_abort for STM32
Make use of the added function HAL_PCD_EP_Abort to implement
endpoint_abort.
2019-02-22 10:53:18 -06:00
Russ Butler c4cf19ee3b Revert "Create HAL_PCD_EP_Abort"
Revert the patch "Create HAL_PCD_EP_Abort" in preparation for an
alternate fix.
2019-02-22 10:53:18 -06:00
Russ Butler 0f70912028 Reset data toggle on Kinetis when unstalling
Data toggle must be reset to DATA0 when an endpoint is unstalled.
This patch makes that change.
2019-02-22 10:53:18 -06:00
Russ Butler c76d80e36e Alternate Kinetis USB stuck sending bug fix
If an IN endpoint is stalled during a transfer then the data being
sent will repeated and flood the USB bus. This patch prevents
endpoints from being stalled in the middle of a transfer by control
requests by keeping USB suspended until the setup phase of the
control request is done.
2019-02-22 10:53:18 -06:00
Russ Butler a75b40a778 Revert "Fix Kinetis bug causing USB to get stuck"
Revert the commit "Fix Kinetis bug causing USB to get stuck sending"
since this change causes stalls to be missed sometimes.
2019-02-22 10:53:18 -06:00
Russ Butler 9a35bc7184 Fix Kinetis bug causing USB to get stuck sending
If an IN endpoint is stalled during a transfer by writing to the
USB ENDPOINT register then the data being sent will repeat and flood
the USB bus. This patch prevents the register write from occurring by
instead writing to the buffer descriptor in RAM and letting the USB
hardware handle setting the stall bit.

Note - Control requests on endpoint 0 do still set the STALL bit
directly. This is not a problem since control endpoints cannot be
stalled externally while a transfer is ongoing.
2019-02-22 10:53:17 -06:00
Russ Butler da77f3885b Fix isochronous endpoints on LPC1768
Perform isochronous endpoint processing from the frame interrupt
rather than the endpoint interrupt. Isochronous endpoints to not
generate interrupts normally and are intended to be handled from
the start of frame interrupt.
2019-02-22 10:53:17 -06:00
Russ Butler 2fedc706e6 Fix USB on Kinetis devices
Set correct SYSMPU register for proper USB operation.  This bug was
introduced when the SYSMPU register names and defines were updated
in the commit:
"K64F: Updated the SYSMPU SDK driver"
93f8cfed05
2019-02-22 10:53:17 -06:00
Russ Butler 7ba6314157 Only build in USBPhy_STM32 for supported devices
Define USBSTM_HAL_UNSUPPORTED if DEVICE_USBDEVICE is undefined or
defined to 0.
2019-02-22 10:53:16 -06:00
Russ Butler 3f45a81a81 Fix return code check in endpoint abort
Assert that HAL_PCD_EP_Abort returns HAL_OK rather that something else.
2019-02-22 10:53:16 -06:00
Michel Jaouen ced1cbd0ed Create HAL_PCD_EP_Abort 2019-02-22 10:53:16 -06:00
Russ Butler 17b61daf21 Remove unnecessary USB receive buffer
Remove receive buffer from USBPhy_STM32 and instead passed buffers in
directly.
2019-02-22 10:53:16 -06:00
Russ Butler 57fa607432 Remove ep0_write from set_address
The USBDevice stack automatically sends control endpoint status
so this does not and should not be done from the call to set_address.
2019-02-22 10:53:16 -06:00
Russ Butler a47c383233 Update the STM32 USB driver to the new API
Take the code from
mbed-os\features\unsupported\USBDevice\targets\TARGET_STM
as a starting point and use it to fill in the USBPhy template for STM32
devices.
2019-02-22 10:53:16 -06:00
Russ Butler 67498e384a Implement LPC1768 USB abort function
Implement the USB abort function so interrupts wont fire for a
transfer that has been aborted. The transfer may still take place
but the buffer passed into endpoint_write or endpoint_read will not
be used.
2019-02-22 10:53:16 -06:00
Russ Butler 044804200b Fix LPC1768 test failures
Reset endpoints when they are removed. This ensures buffers and the
data toggle bit get reset back to zero.
2019-02-22 10:53:16 -06:00
Russ Butler 7245a33164 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-02-22 10:53:14 -06:00
Russ Butler 630e6292c9 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-02-22 10:53:14 -06:00
Russ Butler dc29fdefcc Add USBPhy template
Add a template for implementing a USBPhy.
2019-02-22 10:52:35 -06:00
Russ Butler 76aa7e0b6d 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-02-22 10:52:35 -06:00