forked from mfulz_github/qmk_firmware
Added new ENDPOINT_*_BusSuspended error code to the Endpoint function, so that the stream functions early-abort if the bus is suspended before or during a transfer.
This commit is contained in:
parent
5c0c0327d5
commit
eed7d4df6a
|
@ -120,6 +120,8 @@ uint8_t Endpoint_WaitUntilReady(void)
|
||||||
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||||
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
||||||
|
else if (USB_DeviceState == DEVICE_STATE_Suspended)
|
||||||
|
return ENDPOINT_READYWAIT_BusSuspended;
|
||||||
else if (Endpoint_IsStalled())
|
else if (Endpoint_IsStalled())
|
||||||
return ENDPOINT_READYWAIT_EndpointStalled;
|
return ENDPOINT_READYWAIT_EndpointStalled;
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,11 @@
|
||||||
ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while
|
ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while
|
||||||
* waiting for the endpoint to become ready.
|
* waiting for the endpoint to become ready.
|
||||||
*/
|
*/
|
||||||
ENDPOINT_READYWAIT_Timeout = 3, /**< The host failed to accept or send the next packet
|
ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and
|
||||||
|
* no USB endpoint traffic can occur until the bus
|
||||||
|
* has resumed.
|
||||||
|
*/
|
||||||
|
ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet
|
||||||
* within the software timeout period set by the
|
* within the software timeout period set by the
|
||||||
* \ref USB_STREAM_TIMEOUT_MS macro.
|
* \ref USB_STREAM_TIMEOUT_MS macro.
|
||||||
*/
|
*/
|
||||||
|
@ -462,11 +466,15 @@
|
||||||
ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
|
ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
|
||||||
* the transfer.
|
* the transfer.
|
||||||
*/
|
*/
|
||||||
ENDPOINT_RWSTREAM_Timeout = 3, /**< The host failed to accept or send the next packet
|
ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
|
||||||
|
* no USB endpoint traffic can occur until the bus
|
||||||
|
* has resumed.
|
||||||
|
*/
|
||||||
|
ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet
|
||||||
* within the software timeout period set by the
|
* within the software timeout period set by the
|
||||||
* \ref USB_STREAM_TIMEOUT_MS macro.
|
* \ref USB_STREAM_TIMEOUT_MS macro.
|
||||||
*/
|
*/
|
||||||
ENDPOINT_RWSTREAM_CallbackAborted = 4, /**< Indicates that the stream's callback function
|
ENDPOINT_RWSTREAM_CallbackAborted = 5, /**< Indicates that the stream's callback function
|
||||||
* aborted the transfer early.
|
* aborted the transfer early.
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
@ -482,6 +490,10 @@
|
||||||
ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
|
ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
|
||||||
* the transfer.
|
* the transfer.
|
||||||
*/
|
*/
|
||||||
|
ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
|
||||||
|
* no USB endpoint traffic can occur until the bus
|
||||||
|
* has resumed.
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Inline Functions: */
|
/* Inline Functions: */
|
||||||
|
|
|
@ -12,6 +12,8 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||||
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||||
|
else if (USB_DeviceState == DEVICE_STATE_Suspended)
|
||||||
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||||
|
|
||||||
if (Endpoint_IsOUTReceived())
|
if (Endpoint_IsOUTReceived())
|
||||||
{
|
{
|
||||||
|
@ -29,6 +31,8 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||||
{
|
{
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||||
|
else if (USB_DeviceState == DEVICE_STATE_Suspended)
|
||||||
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENDPOINT_RWCSTREAM_NoError;
|
return ENDPOINT_RWCSTREAM_NoError;
|
||||||
|
|
|
@ -18,6 +18,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
|
||||||
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||||
|
else if (USB_DeviceState == DEVICE_STATE_Suspended)
|
||||||
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||||
|
|
||||||
if (Endpoint_IsINReady())
|
if (Endpoint_IsINReady())
|
||||||
{
|
{
|
||||||
|
@ -39,6 +41,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
|
||||||
{
|
{
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||||
|
else if (USB_DeviceState == DEVICE_STATE_Suspended)
|
||||||
|
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENDPOINT_RWCSTREAM_NoError;
|
return ENDPOINT_RWCSTREAM_NoError;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
* - Added new Relay Controller Board project (thanks to OBinou)
|
* - Added new Relay Controller Board project (thanks to OBinou)
|
||||||
* - Added board hardware driver support for the Teensy, USBTINY MKII, Benito and JM-DB-U2 lines of third party USB AVR boards
|
* - Added board hardware driver support for the Teensy, USBTINY MKII, Benito and JM-DB-U2 lines of third party USB AVR boards
|
||||||
* - Added new ATTR_NO_INIT variable attribute for global variables that should not be automatically cleared on startup
|
* - Added new ATTR_NO_INIT variable attribute for global variables that should not be automatically cleared on startup
|
||||||
|
* - Added new ENDPOINT_*_BusSuspended error code to the Endpoint function, so that the stream functions early-abort if the bus
|
||||||
|
* is suspended before or during a transfer
|
||||||
*
|
*
|
||||||
* <b>Changed:</b>
|
* <b>Changed:</b>
|
||||||
* - AVRISP programmer project now has a more robust timeout system, allowing for an increase of the software USART speed
|
* - AVRISP programmer project now has a more robust timeout system, allowing for an increase of the software USART speed
|
||||||
|
@ -32,7 +34,7 @@
|
||||||
* for them to be enabled (thanks to Andrei Krainev)
|
* for them to be enabled (thanks to Andrei Krainev)
|
||||||
* - The Audio_Device_IsSampleReceived() and Audio_Device_IsReadyForNextSample() functions are now inline, to reduce overhead
|
* - The Audio_Device_IsSampleReceived() and Audio_Device_IsReadyForNextSample() functions are now inline, to reduce overhead
|
||||||
* - Removed the cast to uint16_t on the set baud rate in the USBtoSerial project, so that the higher >1M baud rates can be
|
* - Removed the cast to uint16_t on the set baud rate in the USBtoSerial project, so that the higher >1M baud rates can be
|
||||||
* selected (thanks to Steffan)
|
* selected (thanks to Steffan Woltjer)
|
||||||
*
|
*
|
||||||
* <b>Fixed:</b>
|
* <b>Fixed:</b>
|
||||||
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin
|
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
* -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class
|
* -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class
|
||||||
* -# USB Test and Measurement Class
|
* -# USB Test and Measurement Class
|
||||||
* -# Finish BluetoothHost demo
|
* -# Finish BluetoothHost demo
|
||||||
* -# Finish MIDI class Bootloader
|
|
||||||
* -# Finish SideShow demo
|
* -# Finish SideShow demo
|
||||||
* -# Finish StandaloneProgrammer project
|
* -# Finish StandaloneProgrammer project
|
||||||
* -# Finish MIDIToneGenerator project
|
* -# Finish MIDIToneGenerator project
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
|
* - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig
|
||||||
* - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
|
* - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/
|
||||||
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
|
* - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/
|
||||||
|
* - EMUCOMBOX, a USB-RS422 adapter for E-Mu Emax samplers: http://users.skynet.be/emxp/EMUCOMBOX.htm
|
||||||
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/
|
* - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/
|
||||||
* - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master
|
* - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master
|
||||||
* - Generic HID Device Creator: http://generichid.sourceforge.net/
|
* - Generic HID Device Creator: http://generichid.sourceforge.net/
|
||||||
|
|
|
@ -165,9 +165,9 @@ void XPROGTarget_EnableTargetPDI(void)
|
||||||
BITBANG_PDIDATA_DDR |= BITBANG_PDIDATA_MASK;
|
BITBANG_PDIDATA_DDR |= BITBANG_PDIDATA_MASK;
|
||||||
BITBANG_PDICLOCK_DDR |= BITBANG_PDICLOCK_MASK;
|
BITBANG_PDICLOCK_DDR |= BITBANG_PDICLOCK_MASK;
|
||||||
|
|
||||||
/* Set DATA line low for at least 90ns to ensure that the device is ready for PDI mode to be entered */
|
/* Set DATA line low for at least 1ms to ensure that the device is ready for PDI mode to be entered */
|
||||||
BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
|
BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;
|
||||||
_delay_us(1);
|
_delay_ms(1);
|
||||||
|
|
||||||
/* Set DATA line high for at least 90ns to disable /RESET functionality */
|
/* Set DATA line high for at least 90ns to disable /RESET functionality */
|
||||||
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
|
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
http://www.fourwalledcubicle.com/LUFA.php
|
http://www.fourwalledcubicle.com/LUFA.php
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
LUFA IS DONATION SUPPORTED. To support LUFA,
|
LUFA is donation supported. To support LUFA,
|
||||||
please donate at http://www.fourwalledcubicle.com.
|
please donate at http://www.fourwalledcubicle.com.
|
||||||
|
|
||||||
For Commercial Licensing information, see
|
For Commercial Licensing information, see
|
||||||
|
|
Loading…
Reference in New Issue