Fix build errors in Joystick device demo and library LEDs driver (on *nix systems).
[pub/USBasp.git] / Demos / Device / RNDISEthernet / RNDISEthernet.c
index 5e14bb7..8338cdd 100644 (file)
 /* Scheduler Task List */\r
 TASK_LIST\r
 {\r
-       { Task: USB_USBTask          , TaskStatus: TASK_STOP },\r
-       { Task: Ethernet_Task        , TaskStatus: TASK_STOP },\r
-       { Task: TCP_Task             , TaskStatus: TASK_STOP },\r
-       { Task: RNDIS_Task           , TaskStatus: TASK_STOP },\r
+       { .Task = USB_USBTask          , .TaskStatus = TASK_STOP },\r
+       { .Task = Ethernet_Task        , .TaskStatus = TASK_STOP },\r
+       { .Task = TCP_Task             , .TaskStatus = TASK_STOP },\r
+       { .Task = RNDIS_Task           , .TaskStatus = TASK_STOP },\r
 };\r
 \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
@@ -150,19 +150,19 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
        uint16_t wLength = Endpoint_Read_Word_LE();\r
 \r
        /* Process RNDIS class commands */\r
-       switch (bRequest)\r
+       switch (USB_ControlRequest.bRequest)\r
        {\r
                case REQ_SendEncapsulatedCommand:\r
-                       if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
+                       if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
                                /* Clear the SETUP packet, ready for data transfer */\r
-                               Endpoint_ClearControlSETUP();\r
+                               Endpoint_ClearSETUP();\r
                                \r
                                /* Read in the RNDIS message into the message buffer */\r
                                Endpoint_Read_Control_Stream_LE(RNDISMessageBuffer, wLength);\r
 \r
                                /* Finalize the stream transfer to clear the last packet from the host */\r
-                               Endpoint_ClearControlIN();\r
+                               Endpoint_ClearIN();\r
 \r
                                /* Process the RNDIS message */\r
                                ProcessRNDISControlMessage();\r
@@ -170,8 +170,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                        \r
                        break;\r
                case REQ_GetEncapsulatedResponse:\r
-                       if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
+                       if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
+                               /* Clear the SETUP packet, ready for data transfer */\r
+                               Endpoint_ClearSETUP();\r
+                               \r
                                /* Check if a response to the last message is ready */\r
                                if (!(MessageHeader->MessageLength))\r
                                {\r
@@ -180,18 +183,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                        MessageHeader->MessageLength = 1;\r
                                }\r
 \r
-                               /* Check if less than the requested number of bytes to transfer */\r
-                               if (MessageHeader->MessageLength < wLength)\r
-                                 wLength = MessageHeader->MessageLength;\r
-\r
-                               /* Clear the SETUP packet, ready for data transfer */\r
-                               Endpoint_ClearControlSETUP();\r
-                               \r
                                /* Write the message response data to the endpoint */\r
-                               Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, wLength);\r
+                               Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);\r
                                \r
                                /* Finalize the stream transfer to send the last packet or clear the host abort */\r
-                               Endpoint_ClearControlOUT();\r
+                               Endpoint_ClearOUT();\r
 \r
                                /* Reset the message header once again after transmission */\r
                                MessageHeader->MessageLength = 0;\r
@@ -245,11 +241,11 @@ TASK(RNDIS_Task)
        {\r
                USB_Notification_t Notification = (USB_Notification_t)\r
                        {\r
-                               bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),\r
-                               bNotification: NOTIF_RESPONSE_AVAILABLE,\r
-                               wValue:        0,\r
-                               wIndex:        0,\r
-                               wLength:       0,\r
+                               .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),\r
+                               .bNotification = NOTIF_RESPONSE_AVAILABLE,\r
+                               .wValue        = 0,\r
+                               .wIndex        = 0,\r
+                               .wLength       = 0,\r
                        };\r
                \r
                /* Indicate that a message response is ready for the host */\r