Device mode class driver callbacks are now fired before the control request status...
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 7 May 2010 06:54:08 +0000 (06:54 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 7 May 2010 06:54:08 +0000 (06:54 +0000)
Inlined currently unused MIDI ProcessControlRequest routine.

LUFA/Drivers/USB/Class/Device/CDC.c
LUFA/Drivers/USB/Class/Device/HID.c
LUFA/Drivers/USB/Class/Device/MIDI.c
LUFA/Drivers/USB/Class/Device/MIDI.h
LUFA/Drivers/USB/Class/Device/RNDIS.c
LUFA/ManPages/ChangeLog.txt

index e1cb554..f0c6edb 100644 (file)
@@ -65,9 +65,8 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceIn
                        {\r
                                Endpoint_ClearSETUP();\r
                                Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));\r
-                               Endpoint_ClearIN();\r
-\r
                                EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);\r
+                               Endpoint_ClearIN();\r
                        }\r
        \r
                        break;\r
@@ -77,7 +76,6 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceIn
                                Endpoint_ClearSETUP();\r
                                \r
                                CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue;\r
-                               \r
                                EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);\r
 \r
                                Endpoint_ClearStatusStage();\r
index 7ff3249..6766509 100644 (file)
@@ -79,9 +79,8 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                uint8_t  ReportID = (USB_ControlRequest.wValue & 0xFF);\r
 \r
                                Endpoint_Read_Control_Stream_LE(ReportOUTData, ReportOUTSize);\r
-                               Endpoint_ClearIN();\r
-                               \r
                                CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportOUTData, ReportOUTSize);\r
+                               Endpoint_ClearIN();                             \r
                        }\r
                        \r
                        break;\r
index d3f8f55..1a66dc8 100644 (file)
 #define  __INCLUDE_FROM_MIDI_DRIVER\r
 #include "MIDI.h"\r
 \r
-void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)\r
-{\r
-\r
-}\r
-\r
 bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)\r
 {\r
        memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));\r
index 11a05bf..00d34e0 100644 (file)
                         */\r
                        bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
-                       /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be\r
-                        *  linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.\r
-                        *\r
-                        *  \param[in,out] MIDIInterfaceInfo  Pointer to a structure containing a MIDI Class configuration and state\r
-                        */             \r
-                       void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
-\r
                        /** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded. Events are queued into the\r
                         *  endpoint bank until either the endpoint bank is full, or \ref MIDI_Device_Flush() is called. This allows for multiple\r
                         *  MIDI events to be packed into a single endpoint packet, increasing data throughput.\r
                        static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)\r
                        {\r
                                (void)MIDIInterfaceInfo;\r
-                       }               \r
+                       }\r
+                       \r
+                       /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be\r
+                        *  linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.\r
+                        *\r
+                        *  \param[in,out] MIDIInterfaceInfo  Pointer to a structure containing a MIDI Class configuration and state\r
+                        */             \r
+                       static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+                       static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)\r
+                       {\r
+                               (void)MIDIInterfaceInfo;\r
+                       }\r
 \r
        /* Disable C linkage for C++ Compilers: */\r
                #if defined(__cplusplus)\r
index 1961e7e..69e8e67 100644 (file)
@@ -83,9 +83,8 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
                                Endpoint_ClearSETUP();\r
 \r
                                Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength);\r
-                               Endpoint_ClearIN();\r
-\r
                                RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);\r
+                               Endpoint_ClearIN();\r
                        }\r
                        \r
                        break;\r
index 8e68183..4de0473 100644 (file)
@@ -39,6 +39,8 @@
   *    now be implemented via seperate programming headers\r
   *  - The CDC class bootloader now uses a watchdog reset rather than a soft-reset when exited to ensure that all hardware is\r
   *    properly reset to their defaults\r
+  *  - Device mode class driver callbacks are now fired before the control request status stage is sent to prevent the host from\r
+  *    timing out if another request is immediately fired and the device has a lengthy callback routine\r
   *\r
   *  <b>Fixed:</b>\r
   *  - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r