Mark build test makefiles as being incompatible with parallel make builds, as they...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / RNDISClassHost.c
index a5093d1..e457b5d 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 /*
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -101,62 +101,26 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
                }
        }
 
                }
        }
 
-       for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
-       {
-               uint16_t Size;
-               uint8_t  Type;
-               uint8_t  Token;
-               uint8_t  EndpointAddress;
-               uint8_t  InterruptPeriod;
-               bool     DoubleBanked;
-
-               if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
-               {
-                       Size            = le16_to_cpu(DataINEndpoint->EndpointSize);
-                       EndpointAddress = DataINEndpoint->EndpointAddress;
-                       Token           = PIPE_TOKEN_IN;
-                       Type            = EP_TYPE_BULK;
-                       DoubleBanked    = RNDISInterfaceInfo->Config.DataINPipeDoubleBank;
-                       InterruptPeriod = 0;
-
-                       RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
-               }
-               else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber)
-               {
-                       Size            = le16_to_cpu(DataOUTEndpoint->EndpointSize);
-                       EndpointAddress = DataOUTEndpoint->EndpointAddress;
-                       Token           = PIPE_TOKEN_OUT;
-                       Type            = EP_TYPE_BULK;
-                       DoubleBanked    = RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank;
-                       InterruptPeriod = 0;
-
-                       RNDISInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
-               }
-               else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber)
-               {
-                       Size            = le16_to_cpu(NotificationEndpoint->EndpointSize);
-                       EndpointAddress = NotificationEndpoint->EndpointAddress;
-                       Token           = PIPE_TOKEN_IN;
-                       Type            = EP_TYPE_INTERRUPT;
-                       DoubleBanked    = RNDISInterfaceInfo->Config.NotificationPipeDoubleBank;
-                       InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
-
-                       RNDISInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize;
-               }
-               else
-               {
-                       continue;
-               }
-
-               if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
-                                        DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
-               {
-                       return CDC_ENUMERROR_PipeConfigurationFailed;
-               }
+       RNDISInterfaceInfo->Config.DataINPipe.Size  = le16_to_cpu(DataINEndpoint->EndpointSize);
+       RNDISInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
+       RNDISInterfaceInfo->Config.DataINPipe.Type  = EP_TYPE_BULK;
+       
+       RNDISInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
+       RNDISInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
+       RNDISInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK;
+       
+       RNDISInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
+       RNDISInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress;
+       RNDISInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT;
+
+       if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataINPipe, 1)))
+         return false;
+       
+       if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataOUTPipe, 1)))
+         return false;
 
 
-               if (InterruptPeriod)
-                 Pipe_SetInterruptPeriod(InterruptPeriod);
-       }
+       if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.NotificationPipe, 1)))
+         return false;
 
        RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber;
        RNDISInterfaceInfo->State.IsActive = true;
 
        RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber;
        RNDISInterfaceInfo->State.IsActive = true;
@@ -419,7 +383,7 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
        if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
          return false;
 
        if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
          return false;
 
-       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
+       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address);
 
        Pipe_Unfreeze();
        PacketWaiting = Pipe_IsINReceived();
 
        Pipe_Unfreeze();
        PacketWaiting = Pipe_IsINReceived();
@@ -437,7 +401,7 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
        if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
          return PIPE_READYWAIT_DeviceDisconnected;
 
        if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))
          return PIPE_READYWAIT_DeviceDisconnected;
 
-       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
+       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address);
        Pipe_Unfreeze();
 
        if (!(Pipe_IsReadWriteAllowed()))
        Pipe_Unfreeze();
 
        if (!(Pipe_IsReadWriteAllowed()))
@@ -491,7 +455,7 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
        DeviceMessage.DataOffset    = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
        DeviceMessage.DataLength    = cpu_to_le32(PacketLength);
 
        DeviceMessage.DataOffset    = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
        DeviceMessage.DataLength    = cpu_to_le32(PacketLength);
 
-       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);
+       Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipe.Address);
        Pipe_Unfreeze();
 
        if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),
        Pipe_Unfreeze();
 
        if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),