aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host')
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c48
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c48
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.c32
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c34
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.c32
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c48
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.h1
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c48
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h1
14 files changed, 236 insertions, 61 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index e48d487ce..40fe3fd86 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -100,31 +100,59 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
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 == CDCInterfaceInfo->Config.DataINPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataINEndpoint->EndpointSize;
+ EndpointAddress = DataINEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = CDCInterfaceInfo->Config.DataINPipeDoubleBank;
+ InterruptPeriod = 0;
CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataOUTEndpoint->EndpointSize;
+ EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = CDCInterfaceInfo->Config.DataOUTPipeDoubleBank;
+ InterruptPeriod = 0;
CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
- NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize,
- CDCInterfaceInfo->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 = CDCInterfaceInfo->Config.NotificationPipeDoubleBank;
+ InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
CDCInterfaceInfo->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);
}
CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h
index fdbc7aee5..016f4a5d1 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.h
+++ b/LUFA/Drivers/USB/Class/Host/CDC.h
@@ -139,6 +139,7 @@
CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
CDC_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor. */
+ CDC_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index bb10ee2dd..e6c575e21 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -95,25 +95,49 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
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)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
- Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
- HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
+ Size = 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)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
- Pipe_SetInterruptPeriod(DataOUTEndpoint->PollingIntervalMS);
-
- HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
+ Size = 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->State.InterfaceNumber = HIDInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h
index 200cbda40..d1392c94b 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.h
+++ b/LUFA/Drivers/USB/Class/Host/HID.h
@@ -145,6 +145,7 @@
HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
HID_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor. */
+ HID_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c
index 87e429010..3dd98be10 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.c
@@ -79,22 +79,42 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Token;
+ uint8_t EndpointAddress;
+ bool DoubleBanked;
+
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataINEndpoint->EndpointSize;
+ EndpointAddress = DataINEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MIDIInterfaceInfo->Config.DataINPipeDoubleBank;
MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataOUTEndpoint->EndpointSize;
+ EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank;
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
+ else
+ {
+ continue;
+ }
+
+ if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
+ DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
+ {
+ return MIDI_ENUMERROR_PipeConfigurationFailed;
+ }
}
MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h
index 83b08d1ae..7ac4ab7c4 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.h
@@ -114,6 +114,7 @@
MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MIDI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor. */
+ MIDI_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index ef8053bc3..682a6964c 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -79,22 +79,42 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Token;
+ uint8_t EndpointAddress;
+ bool DoubleBanked;
+
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataINEndpoint->EndpointSize;
+ EndpointAddress = DataINEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MSInterfaceInfo->Config.DataINPipeDoubleBank;
MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
+ Size = DataOUTEndpoint->EndpointSize;
+ EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MSInterfaceInfo->Config.DataOUTPipeDoubleBank;
+
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
+ else
+ {
+ continue;
+ }
+
+ if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
+ DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
+ {
+ return MS_ENUMERROR_PipeConfigurationFailed;
+ }
}
MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h
index bef26fd13..5779a4721 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h
@@ -131,6 +131,7 @@
MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */
+ MS_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c
index f08ee5bd9..922992241 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.c
+++ b/LUFA/Drivers/USB/Class/Host/Printer.c
@@ -79,22 +79,42 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Token;
+ uint8_t EndpointAddress;
+ bool DoubleBanked;
+
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataINEndpoint->EndpointSize;
+ EndpointAddress = DataINEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = PRNTInterfaceInfo->Config.DataINPipeDoubleBank;
PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataOUTEndpoint->EndpointSize;
+ EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank;
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
+ else
+ {
+ continue;
+ }
+
+ if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
+ DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
+ {
+ return PRNT_ENUMERROR_PipeConfigurationFailed;
+ }
}
PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h
index b44ea561e..99df01fa4 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.h
+++ b/LUFA/Drivers/USB/Class/Host/Printer.h
@@ -114,6 +114,7 @@
PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
PRNT_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor. */
+ PRNT_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */
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;
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h
index b7f844e42..6eaf131ea 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h
@@ -128,6 +128,7 @@
RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
RNDIS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor. */
+ RNDIS_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Macros: */
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index d3dda8fe3..45c3872bb 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -88,31 +88,59 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
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 == SIInterfaceInfo->Config.DataINPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
- DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
- SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataINEndpoint->EndpointSize;
+ EndpointAddress = DataINEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = SIInterfaceInfo->Config.DataINPipeDoubleBank;
+ InterruptPeriod = 0;
SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == SIInterfaceInfo->Config.DataOUTPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
- SIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+ Size = DataOUTEndpoint->EndpointSize;
+ EndpointAddress = DataOUTEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = SIInterfaceInfo->Config.DataOUTPipeDoubleBank;
+ InterruptPeriod = 0;
SIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
else if (PipeNum == SIInterfaceInfo->Config.EventsPipeNumber)
{
- Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
- EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize,
- SIInterfaceInfo->Config.EventsPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
- Pipe_SetInterruptPeriod(EventsEndpoint->PollingIntervalMS);
+ Size = EventsEndpoint->EndpointSize;
+ EndpointAddress = EventsEndpoint->EndpointAddress;
+ Token = PIPE_TOKEN_IN;
+ Type = EP_TYPE_INTERRUPT;
+ DoubleBanked = SIInterfaceInfo->Config.EventsPipeDoubleBank;
+ InterruptPeriod = EventsEndpoint->PollingIntervalMS;
SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize;
}
+ else
+ {
+ continue;
+ }
+
+ if (!(Pipe_ConfigurePipe(PipeNum, Type, Token, EndpointAddress, Size,
+ DoubleBanked ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE)))
+ {
+ return SI_ENUMERROR_PipeConfigurationFailed;
+ }
+
+ if (InterruptPeriod)
+ Pipe_SetInterruptPeriod(InterruptPeriod);
}
SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index 2d1b41e2d..39ab65ddf 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -127,6 +127,7 @@
SI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's
* Configuration Descriptor.
*/
+ SI_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
};
/* Function Prototypes: */