diff options
Diffstat (limited to 'Demos/Device')
-rw-r--r-- | Demos/Device/CDC/CDC.c | 6 | ||||
-rw-r--r-- | Demos/Device/GenericHID/GenericHID.c | 8 | ||||
-rw-r--r-- | Demos/Device/Joystick/Joystick.c | 6 | ||||
-rw-r--r-- | Demos/Device/Keyboard/Keyboard.c | 4 | ||||
-rw-r--r-- | Demos/Device/KeyboardMouse/KeyboardMouse.c | 4 | ||||
-rw-r--r-- | Demos/Device/Mouse/Mouse.c | 4 | ||||
-rw-r--r-- | Demos/Device/RNDISEthernet/RNDISEthernet.c | 6 | ||||
-rw-r--r-- | Demos/Device/USBtoSerial/USBtoSerial.c | 10 |
8 files changed, 24 insertions, 24 deletions
diff --git a/Demos/Device/CDC/CDC.c b/Demos/Device/CDC/CDC.c index 28bce1ebc..59aa98ceb 100644 --- a/Demos/Device/CDC/CDC.c +++ b/Demos/Device/CDC/CDC.c @@ -193,14 +193,14 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
+ /* Acknowledge the SETUP packet, ready for data transfer */
+ Endpoint_ClearSETUP();
+
/* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake
lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the
CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code:
*/
- /* Acknowledge the SETUP packet, ready for data transfer */
- Endpoint_ClearSETUP();
-
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearIN();
diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c index 245ddaafc..695342d0e 100644 --- a/Demos/Device/GenericHID/GenericHID.c +++ b/Demos/Device/GenericHID/GenericHID.c @@ -165,10 +165,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
+ uint8_t GenericData[GENERIC_REPORT_SIZE];
+
Endpoint_ClearSETUP();
- uint8_t GenericData[GENERIC_REPORT_SIZE];
-
CreateGenericHIDReport(GenericData);
/* Write the report data to the control endpoint */
@@ -182,13 +182,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
+ uint8_t GenericData[GENERIC_REPORT_SIZE];
+
Endpoint_ClearSETUP();
/* Wait until the generic report has been sent by the host */
while (!(Endpoint_IsOUTReceived()));
- uint8_t GenericData[GENERIC_REPORT_SIZE];
-
Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData));
ProcessGenericHIDReport(GenericData);
diff --git a/Demos/Device/Joystick/Joystick.c b/Demos/Device/Joystick/Joystick.c index ee4bc6ad0..a5c3242fe 100644 --- a/Demos/Device/Joystick/Joystick.c +++ b/Demos/Device/Joystick/Joystick.c @@ -129,11 +129,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket) {
USB_JoystickReport_Data_t JoystickReportData;
+ Endpoint_ClearSETUP();
+
/* Create the next HID report to send to the host */
GetNextReport(&JoystickReportData);
-
- Endpoint_ClearSETUP();
-
+
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
diff --git a/Demos/Device/Keyboard/Keyboard.c b/Demos/Device/Keyboard/Keyboard.c index 088943bce..33545bff6 100644 --- a/Demos/Device/Keyboard/Keyboard.c +++ b/Demos/Device/Keyboard/Keyboard.c @@ -200,11 +200,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket) {
USB_KeyboardReport_Data_t KeyboardReportData;
+ Endpoint_ClearSETUP();
+
/* Create the next keyboard report for transmission to the host */
CreateKeyboardReport(&KeyboardReportData);
- Endpoint_ClearSETUP();
-
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.c b/Demos/Device/KeyboardMouse/KeyboardMouse.c index a85a3786d..dc039eec0 100644 --- a/Demos/Device/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/KeyboardMouse/KeyboardMouse.c @@ -144,6 +144,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
+ Endpoint_ClearSETUP();
+
/* Determine if it is the mouse or the keyboard data that is being requested */
if (!(USB_ControlRequest.wIndex))
{
@@ -156,8 +158,6 @@ EVENT_HANDLER(USB_UnhandledControlPacket) ReportSize = sizeof(MouseReportData);
}
- Endpoint_ClearSETUP();
-
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c index 2e5f05b42..669b576a6 100644 --- a/Demos/Device/Mouse/Mouse.c +++ b/Demos/Device/Mouse/Mouse.c @@ -190,10 +190,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket) {
USB_MouseReport_Data_t MouseReportData;
+ Endpoint_ClearSETUP();
+
/* Create the next mouse report for transmission to the host */
CreateMouseReport(&MouseReportData);
-
- Endpoint_ClearSETUP();
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&MouseReportData, sizeof(MouseReportData));
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.c b/Demos/Device/RNDISEthernet/RNDISEthernet.c index 7b81ad85f..8338cdd00 100644 --- a/Demos/Device/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/RNDISEthernet/RNDISEthernet.c @@ -172,6 +172,9 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_GetEncapsulatedResponse:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
+ /* Clear the SETUP packet, ready for data transfer */
+ Endpoint_ClearSETUP();
+
/* Check if a response to the last message is ready */
if (!(MessageHeader->MessageLength))
{
@@ -180,9 +183,6 @@ EVENT_HANDLER(USB_UnhandledControlPacket) MessageHeader->MessageLength = 1;
}
- /* Clear the SETUP packet, ready for data transfer */
- Endpoint_ClearSETUP();
-
/* Write the message response data to the endpoint */
Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.c b/Demos/Device/USBtoSerial/USBtoSerial.c index dbf4b1b0d..ea8dcd599 100644 --- a/Demos/Device/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/USBtoSerial/USBtoSerial.c @@ -188,15 +188,15 @@ EVENT_HANDLER(USB_UnhandledControlPacket) break;
case REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
+ /* Acknowledge the SETUP packet, ready for data transfer */
+ Endpoint_ClearSETUP();
+
/* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake
lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the
CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code:
*/
-
- /* Acknowledge the SETUP packet, ready for data transfer */
- Endpoint_ClearSETUP();
-
+
/* Acknowledge status stage */
while (!(Endpoint_IsINReady()));
Endpoint_ClearIN();
|