aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-04-14 14:41:17 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-04-14 14:41:17 +0000
commit47f6a35013b2c6a370e5dce29aa6da3a96844695 (patch)
tree3f5842347a696c92beb74bc255c9489e6c38f49d /LUFA/Drivers/USB/Class/Host/HIDClassHost.c
parente8570c4a37e41117e3fd1e989e0b41f1e9608f3c (diff)
downloadlufa-47f6a35013b2c6a370e5dce29aa6da3a96844695.tar.gz
lufa-47f6a35013b2c6a370e5dce29aa6da3a96844695.tar.bz2
lufa-47f6a35013b2c6a370e5dce29aa6da3a96844695.zip
Reintegrate the FullEPAddresses development branch into trunk.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/HIDClassHost.c')
-rw-r--r--LUFA/Drivers/USB/Class/Host/HIDClassHost.c68
1 files changed, 16 insertions, 52 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/HIDClassHost.c b/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
index f51bdf74f..dad6a5afc 100644
--- a/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
+++ b/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
@@ -94,55 +94,19 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
DataOUTEndpoint = EndpointData;
}
- 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 == HIDInterfaceInfo->Config.DataINPipeNumber)
- {
- Size = le16_to_cpu(DataINEndpoint->EndpointSize);
- EndpointAddress = DataINEndpoint->EndpointAddress;
- Token = PIPE_TOKEN_IN;
- Type = EP_TYPE_INTERRUPT;
- DoubleBanked = HIDInterfaceInfo->Config.DataINPipeDoubleBank;
- InterruptPeriod = DataINEndpoint->PollingIntervalMS;
-
- HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
- }
- else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
- {
- if (DataOUTEndpoint == NULL)
- continue;
-
- Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
- EndpointAddress = DataOUTEndpoint->EndpointAddress;
- Token = PIPE_TOKEN_OUT;
- Type = EP_TYPE_INTERRUPT;
- DoubleBanked = HIDInterfaceInfo->Config.DataOUTPipeDoubleBank;
- InterruptPeriod = DataOUTEndpoint->PollingIntervalMS;
-
- HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
- HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;
- }
- else
- {
- continue;
- }
-
- if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
- DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
- {
- return HID_ENUMERROR_PipeConfigurationFailed;
- }
-
- if (InterruptPeriod)
- Pipe_SetInterruptPeriod(InterruptPeriod);
- }
+ HIDInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize);
+ HIDInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress;
+ HIDInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_INTERRUPT;
+
+ HIDInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
+ HIDInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT;
+
+ if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1)))
+ return false;
+
+ if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1)))
+ return false;
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
HIDInterfaceInfo->State.HIDReportSize = LE16_TO_CPU(HIDDescriptor->HIDReportLength);
@@ -227,7 +191,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
uint8_t ErrorCode;
- Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
uint16_t ReportSize;
@@ -277,7 +241,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
{
uint8_t ErrorCode;
- Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipe.Address);
Pipe_Unfreeze();
if (ReportID)
@@ -320,7 +284,7 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
bool ReportReceived;
- Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
ReportReceived = Pipe_IsINReceived();