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
......@@ -49,11 +49,6 @@ USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface =
.DataINEndpointNumber = AUDIO_STREAM_EPNUM,
.DataINEndpointSize = AUDIO_STREAM_EPSIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -49,11 +49,6 @@ USB_ClassInfo_Audio_Device_t Speaker_Audio_Interface =
.DataINEndpointNumber = AUDIO_STREAM_EPNUM,
.DataINEndpointSize = AUDIO_STREAM_EPSIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -55,11 +55,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
......
......@@ -56,11 +56,6 @@ USB_ClassInfo_CDC_Device_t VirtualSerial1_CDC_Interface =
.NotificationEndpointNumber = CDC1_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** LUFA CDC Class driver interface configuration and state information. This structure is
......
......@@ -51,11 +51,6 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.ReportINBufferSize = GENERIC_REPORT_SIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -51,11 +51,6 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface =
.ReportINBufferSize = sizeof(USB_JoystickReport_Data_t),
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -52,11 +52,6 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
},
.State =
{
.IdleCount = 500,
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -53,11 +53,6 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
},
.State =
{
.IdleCount = 500,
}
};
/** LUFA HID Class driver interface configuration and state information. This structure is
......
......@@ -52,11 +52,6 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
.DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
.DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -54,11 +54,6 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
.TotalLUNs = TOTAL_LUNS,
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -51,11 +51,6 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
.ReportINBufferSize = sizeof(USB_MouseReport_Data_t),
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -58,11 +58,6 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
.AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDRESS},
},
.State =
{
// Leave all state values to their defaults
}
};
/** Main program entry point. This routine contains the overall program flow, including initial
......
......@@ -61,11 +61,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
......
......@@ -48,11 +48,6 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface =
.DataOUTPipeNumber = 2,
.NotificationPipeNumber = 3,
},
.State =
{
// Leave all state values to their defaults
}
};
......
......@@ -50,11 +50,6 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.MatchInterfaceProtocol = true,
.HIDInterfaceProtocol = 0x02,
},
.State =
{
// Leave all state values to their defaults
}
};
......
......@@ -59,6 +59,8 @@ void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const Audio
bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo)
{
memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State));
if (AudioInterfaceInfo->Config.DataINEndpointNumber)
{
if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_ISOCHRONOUS,
......@@ -78,7 +80,7 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfac
return false;
}
}
return true;
}
......
......@@ -91,8 +91,7 @@
* of the Audio Streaming interface.
*/
} 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_Audio_Device_t;
......
......@@ -87,6 +87,8 @@ void CDC_Device_ProcessControlPacket(USB_ClassInfo_CDC_Device_t* CDCInterfaceInf
bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)
{
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.DataINEndpointSize,
ENDPOINT_BANK_SINGLE)))
......
......@@ -102,8 +102,7 @@
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} LineEncoding;
} 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_CDC_Device_t;
......
......@@ -135,6 +135,8 @@ void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* const HIDInterf
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
HIDInterfaceInfo->State.IdleCount = 500;
HIDInterfaceInfo->State.UsingReportProtocol = true;
if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
......
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