forked from mfulz_github/qmk_firmware
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.
This commit is contained in:
parent
1c74525d2f
commit
ed9d77aeee
|
@ -134,7 +134,7 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
|
|||
}
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
}
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
}
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
|
|||
}
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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);
|
||||
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;
|
||||
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);
|
||||
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.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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
*
|
||||
* <b>Changed:</b>
|
||||
* - 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:
|
||||
* - 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
|
||||
|
|
Loading…
Reference in New Issue