Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / Demos / Device / RNDISEthernet / RNDISEthernet.c
index d573a76..5e14bb7 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
@@ -162,13 +156,13 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                        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
@@ -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
@@ -247,7 +241,7 @@ 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
@@ -262,7 +256,7 @@ TASK(RNDIS_Task)
                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,7 +272,7 @@ 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
@@ -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