Commit 864196c8 authored by Dean Camera's avatar Dean Camera
Browse files

State information for class drivers is now zeroed out during enumeration (both...

State information for class drivers is now zeroed out during enumeration (both in device and host mode) to ensure sane values after each enumeration. User code should no longer explicitly set state information as this is no longer preserved.
parent b9dd51cd
......@@ -83,8 +83,7 @@
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapsed - this should be
* decremented by the user application if non-zero each millisecond */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_HID_Device_t;
......
......@@ -40,6 +40,8 @@ void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInt
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
if (MIDIInterfaceInfo->Config.DataINEndpointNumber)
{
if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
......
......@@ -80,8 +80,7 @@
{
// No state information for this class yet
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_MIDI_Device_t;
......
......@@ -74,6 +74,8 @@ void MS_Device_ProcessControlPacket(USB_ClassInfo_MS_Device_t* const MSInterface
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, MSInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE)))
......
......@@ -89,8 +89,7 @@
* and that all current Mass Storage operations should immediately abort
*/
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_MS_Device_t;
......
......@@ -112,6 +112,8 @@ void RNDIS_Device_ProcessControlPacket(USB_ClassInfo_RNDIS_Device_t* const RNDIS
bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
{
memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State));
if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE)))
......
......@@ -97,8 +97,7 @@
* user application
*/
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_RNDIS_Device_t;
......
......@@ -39,6 +39,8 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint
{
uint8_t FoundEndpoints = 0;
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return CDC_ENUMERROR_InvalidConfigDescriptor;
......
......@@ -39,6 +39,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint
{
uint8_t FoundEndpoints = 0;
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return HID_ENUMERROR_InvalidConfigDescriptor;
......
......@@ -62,7 +62,7 @@
* to only unfreeze and check one data pipe at a time) to prevent incorrect device enumerations and freezes while trasferring data
* - Make Pipe_ConfigurePipe() mask the given endpoint number against PIPE_EPNUM_MASK to ensure the endpoint IN direction bit is
* cleared to prevent endpoint type corruption
* - Fix documentation mentioning Pipe_GetCurrentToken() function when real name is Pipe_GetPipeToken()
* - Fixed documentation mentioning Pipe_GetCurrentToken() function when correct function name is Pipe_GetPipeToken()
* - Fixed ADC driver for the ATMEGA32U4 and ATMEGA16U4 (thanks to Opendous Inc.)
* - Fixed CDCHost demo unfreezing the pipes at the point of configuration, rather than use
* - Fixed MassStorage demo not clearing the reset flag when a Mass Storage Reset is issued while not processing a command
......
......@@ -33,7 +33,7 @@
*
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible only with
* the AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 USB AVR models, such as the AT90USB1287. Its contents should <b>not</b> be
* included by the user application - the dispatch header file located in the parent AT90USBXXX directory should be used
* included by the user application - the dispatch header file located in the parent directory should be used
* instead.
*
* \dir LUFA/Drivers/USB
......
......@@ -35,7 +35,7 @@
* - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that
* descriptors in mixed memory spaces can be used. The previous functionality can be returned by defining the USE_FLASH_DESCRIPTORS
* token in the project makefile to fix all descriptors into FLASH space and remove the extra function parameter.
* - Removed USB_IsSuspended - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead.
* - The USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead.
*
*
* \section Sec_Migration090605 Migrating from 090510 to 090605
......
......@@ -67,11 +67,6 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -60,11 +60,6 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment