Fix errors in the KeyboardHost demo which prevented correct compilation.
[pub/USBasp.git] / Demos / Device / RNDISEthernet / RNDISEthernet.c
index 3f9bb18..d77cc45 100644 (file)
 \r
 #include "RNDISEthernet.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA RNDIS App");\r
-BUTTLOADTAG(BuildTime,   __TIME__);\r
-BUTTLOADTAG(BuildDate,   __DATE__);\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);\r
-\r
 /* 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
@@ -99,7 +93,7 @@ EVENT_HANDLER(USB_Connect)
 }\r
 \r
 /** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
- *  the status LEDs and stops all the relevent tasks.\r
+ *  the status LEDs and stops all the relevant tasks.\r
  */\r
 EVENT_HANDLER(USB_Disconnect)\r
 {\r
@@ -114,7 +108,7 @@ EVENT_HANDLER(USB_Disconnect)
 }\r
 \r
 /** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration\r
- *  of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevent tasks.\r
+ *  of the USB device after enumeration, and configures the RNDIS device endpoints and starts the relevant tasks.\r
  */\r
 EVENT_HANDLER(USB_ConfigurationChanged)\r
 {\r
@@ -158,24 +152,24 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
        /* Process RNDIS class commands */\r
        switch (bRequest)\r
        {\r
-               case SEND_ENCAPSULATED_COMMAND:\r
+               case REQ_SendEncapsulatedCommand:\r
                        if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
                                /* Clear the SETUP packet, ready for data transfer */\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\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_ClearSetupIN();\r
+                               Endpoint_ClearControlIN();\r
 \r
                                /* Process the RNDIS message */\r
                                ProcessRNDISControlMessage();\r
                        }\r
                        \r
                        break;\r
-               case GET_ENCAPSULATED_RESPONSE:\r
+               case REQ_GetEncapsulatedResponse:\r
                        if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
                                /* Check if a response to the last message is ready */\r
@@ -191,13 +185,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                                  wLength = MessageHeader->MessageLength;\r
 \r
                                /* Clear the SETUP packet, ready for data transfer */\r
-                               Endpoint_ClearSetupReceived();\r
+                               Endpoint_ClearControlSETUP();\r
                                \r
                                /* Write the message response data to the endpoint */\r
                                Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, wLength);\r
                                \r
                                /* Finalize the stream transfer to send the last packet or clear the host abort */\r
-                               Endpoint_ClearSetupOUT();\r
+                               Endpoint_ClearControlOUT();\r
 \r
                                /* Reset the message header once again after transmission */\r
                                MessageHeader->MessageLength = 0;\r
@@ -238,7 +232,7 @@ void UpdateStatus(uint8_t CurrentStatus)
 }\r
 \r
 /** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS\r
- *  wrapper from recieved Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper\r
+ *  wrapper from received Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper\r
  *  to a frame in the FrameOUT global before sending the buffer contents to the host.\r
  */\r
 TASK(RNDIS_Task)\r
@@ -247,22 +241,22 @@ TASK(RNDIS_Task)
        Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);\r
 \r
        /* Check if a message response is ready for the host */\r
-       if (Endpoint_ReadWriteAllowed() && ResponseReady)\r
+       if (Endpoint_IsINReady() && ResponseReady)\r
        {\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
                Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));\r
 \r
                /* Finalize the stream transfer to send the last packet */\r
-               Endpoint_ClearCurrentBank();\r
+               Endpoint_ClearIN();\r
 \r
                /* Indicate a response is no longer ready */\r
                ResponseReady = false;\r
@@ -278,13 +272,13 @@ TASK(RNDIS_Task)
                Endpoint_SelectEndpoint(CDC_RX_EPNUM);\r
                \r
                /* Check if the data OUT endpoint contains data, and that the IN buffer is empty */\r
-               if (Endpoint_ReadWriteAllowed() && !(FrameIN.FrameInBuffer))\r
+               if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer))\r
                {\r
                        /* Read in the packet message header */\r
                        Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_PACKET_MSG_t));\r
 \r
                        /* Stall the request if the data is too large */\r
-                       if (RNDISPacketHeader.MessageLength > ETHERNET_FRAME_SIZE_MAX)\r
+                       if (RNDISPacketHeader.DataLength > ETHERNET_FRAME_SIZE_MAX)\r
                        {\r
                                Endpoint_StallTransaction();\r
                                return;\r
@@ -294,7 +288,7 @@ TASK(RNDIS_Task)
                        Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength);\r
 \r
                        /* Finalize the stream transfer to send the last packet */\r
-                       Endpoint_ClearCurrentBank();\r
+                       Endpoint_ClearOUT();\r
                        \r
                        /* Store the size of the Ethernet frame */\r
                        FrameIN.FrameLength = RNDISPacketHeader.DataLength;\r
@@ -307,7 +301,7 @@ TASK(RNDIS_Task)
                Endpoint_SelectEndpoint(CDC_TX_EPNUM);\r
                \r
                /* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */\r
-               if (Endpoint_ReadWriteAllowed() && FrameOUT.FrameInBuffer)\r
+               if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer)\r
                {\r
                        /* Clear the packet header with all 0s so that the relevant fields can be filled */\r
                        memset(&RNDISPacketHeader, 0, sizeof(RNDIS_PACKET_MSG_t));\r
@@ -325,7 +319,7 @@ TASK(RNDIS_Task)
                        Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength);\r
                        \r
                        /* Finalize the stream transfer to send the last packet */\r
-                       Endpoint_ClearCurrentBank();\r
+                       Endpoint_ClearIN();\r
                        \r
                        /* Indicate Ethernet OUT buffer no longer full */\r
                        FrameOUT.FrameInBuffer = false;\r