diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-12-02 01:56:06 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-12-02 01:56:06 +0000 |
commit | ed9d77aeee3a192852ca2419b7cfa58d39073036 (patch) | |
tree | c704acafd6e964edadc79bb04cf68d6927f23238 /LUFA/Drivers/USB/Class/Host/RNDIS.c | |
parent | 1c74525d2f606b13faafc5fdee389ab452a50f6c (diff) | |
download | lufa-ed9d77aeee3a192852ca2419b7cfa58d39073036.tar.gz lufa-ed9d77aeee3a192852ca2419b7cfa58d39073036.tar.bz2 lufa-ed9d77aeee3a192852ca2419b7cfa58d39073036.zip |
Refactored Host mode Class Driver *_Host_ConfigurePipes() routines to be more space efficient when compiled.
Added new *_ENUMERROR_PipeConfigurationFailed error codes for the *_Host_ConfigurePipes() routines.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/RNDIS.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/RNDIS.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c index e3948ec6c..aae445a91 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c @@ -102,31 +102,59 @@ 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) { - Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, - DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, - RNDISInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); + Size = 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) { - Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, - DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, - RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); + Size = 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) { - Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, - NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, - RNDISInterfaceInfo->Config.NotificationPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); - Pipe_SetInterruptPeriod(NotificationEndpoint->PollingIntervalMS); + Size = 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; + } + + if (InterruptPeriod) + Pipe_SetInterruptPeriod(InterruptPeriod); } RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber; |