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.
pull/1469/head
Dean Camera 14 years ago
parent 1c74525d2f
commit ed9d77aeee

@ -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++) 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) if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = CDCInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; CDCInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }
else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber) else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Size = NotificationEndpoint->EndpointSize;
NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, EndpointAddress = NotificationEndpoint->EndpointAddress;
CDCInterfaceInfo->Config.NotificationPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Pipe_SetInterruptPeriod(NotificationEndpoint->PollingIntervalMS); Type = EP_TYPE_INTERRUPT;
DoubleBanked = CDCInterfaceInfo->Config.NotificationPipeDoubleBank;
InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
CDCInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize; 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; CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber;

@ -139,6 +139,7 @@
CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Function Prototypes: */

@ -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++) 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) if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS); Type = EP_TYPE_INTERRUPT;
DoubleBanked = HIDInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = DataINEndpoint->PollingIntervalMS;
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Pipe_SetInterruptPeriod(DataOUTEndpoint->PollingIntervalMS); Type = EP_TYPE_INTERRUPT;
DoubleBanked = HIDInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = DataOUTEndpoint->PollingIntervalMS;
HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true; 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; HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;

@ -145,6 +145,7 @@
HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Function Prototypes: */

@ -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++) 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) if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataINPipeDoubleBank;
MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank;
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; 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; MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber;

@ -114,6 +114,7 @@
MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Function Prototypes: */

@ -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++) 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) if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataINPipeDoubleBank;
MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = MSInterfaceInfo->Config.DataOUTPipeDoubleBank;
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; 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; MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber;

@ -131,6 +131,7 @@
MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Function Prototypes: */

@ -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++) 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) if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = PRNTInterfaceInfo->Config.DataINPipeDoubleBank;
PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank;
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; 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; PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber;

@ -114,6 +114,7 @@
PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Function Prototypes: */

@ -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++) 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) if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
RNDISInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; RNDISInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }
else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber) else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Size = NotificationEndpoint->EndpointSize;
NotificationEndpoint->EndpointAddress, NotificationEndpoint->EndpointSize, EndpointAddress = NotificationEndpoint->EndpointAddress;
RNDISInterfaceInfo->Config.NotificationPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Pipe_SetInterruptPeriod(NotificationEndpoint->PollingIntervalMS); Type = EP_TYPE_INTERRUPT;
DoubleBanked = RNDISInterfaceInfo->Config.NotificationPipeDoubleBank;
InterruptPeriod = NotificationEndpoint->PollingIntervalMS;
RNDISInterfaceInfo->State.NotificationPipeSize = NotificationEndpoint->EndpointSize; 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; RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber;

@ -128,6 +128,7 @@
RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ 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_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: */ /* Macros: */

@ -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++) 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) if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Size = DataINEndpoint->EndpointSize;
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, EndpointAddress = DataINEndpoint->EndpointAddress;
SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
DoubleBanked = SIInterfaceInfo->Config.DataINPipeDoubleBank;
InterruptPeriod = 0;
SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
} }
else if (PipeNum == SIInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == SIInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT, Size = DataOUTEndpoint->EndpointSize;
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, EndpointAddress = DataOUTEndpoint->EndpointAddress;
SIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
DoubleBanked = SIInterfaceInfo->Config.DataOUTPipeDoubleBank;
InterruptPeriod = 0;
SIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; SIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }
else if (PipeNum == SIInterfaceInfo->Config.EventsPipeNumber) else if (PipeNum == SIInterfaceInfo->Config.EventsPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Size = EventsEndpoint->EndpointSize;
EventsEndpoint->EndpointAddress, EventsEndpoint->EndpointSize, EndpointAddress = EventsEndpoint->EndpointAddress;
SIInterfaceInfo->Config.EventsPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); Token = PIPE_TOKEN_IN;
Pipe_SetInterruptPeriod(EventsEndpoint->PollingIntervalMS); Type = EP_TYPE_INTERRUPT;
DoubleBanked = SIInterfaceInfo->Config.EventsPipeDoubleBank;
InterruptPeriod = EventsEndpoint->PollingIntervalMS;
SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize; 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; SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;

@ -127,6 +127,7 @@
SI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's SI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's
* Configuration Descriptor. * Configuration Descriptor.
*/ */
SI_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */
}; };
/* Function Prototypes: */ /* Function Prototypes: */

@ -16,7 +16,8 @@
* *
* <b>Changed:</b> * <b>Changed:</b>
* - Core: * - Core:
* - None * - 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
* - Library Applications: * - Library Applications:
* - Changed the XPLAINBridge software UART to use the regular CTC mode instead of the alternative CTC mode * - Changed the XPLAINBridge software UART to use the regular CTC mode instead of the alternative CTC mode
* via the Input Capture register, to reduce user confusion * via the Input Capture register, to reduce user confusion

Loading…
Cancel
Save