Whitespace corrections.

Make Printer Host mode Class driver interface descriptor search routine pre-cast the current interface descriptor to simplify the value checks.
pull/1469/head
Dean Camera 14 years ago
parent a1e453e900
commit 383d167125

@ -59,7 +59,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
if (NotificationEndpoint) if (NotificationEndpoint)
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return CDC_ENUMERROR_NoCompatibleInterfaceFound; return CDC_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -70,7 +70,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
else else
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return CDC_ENUMERROR_NoCompatibleInterfaceFound; return CDC_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -103,7 +103,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; CDCInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
@ -144,7 +144,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
if ((CurrentInterface->Class == CDC_CONTROL_CLASS) && if ((CurrentInterface->Class == CDC_CONTROL_CLASS) &&
(CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) && (CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) &&
(CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL)) (CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL))
{ {
return DESCRIPTOR_SEARCH_Found; return DESCRIPTOR_SEARCH_Found;
} }
@ -162,7 +162,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
if ((CurrentInterface->Class == CDC_DATA_CLASS) && if ((CurrentInterface->Class == CDC_DATA_CLASS) &&
(CurrentInterface->SubClass == CDC_DATA_SUBCLASS) && (CurrentInterface->SubClass == CDC_DATA_SUBCLASS) &&
(CurrentInterface->Protocol == CDC_DATA_PROTOCOL)) (CurrentInterface->Protocol == CDC_DATA_PROTOCOL))
{ {
return DESCRIPTOR_SEARCH_Found; return DESCRIPTOR_SEARCH_Found;
} }

@ -62,7 +62,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
do do
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return HID_ENUMERROR_NoCompatibleInterfaceFound; return HID_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -98,8 +98,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS); Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
@ -107,8 +107,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber) else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(PipeNum, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataOUTEndpoint->PollingIntervalMS); Pipe_SetInterruptPeriod(DataOUTEndpoint->PollingIntervalMS);
HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; HIDInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;

@ -56,7 +56,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return MIDI_ENUMERROR_NoCompatibleInterfaceFound; return MIDI_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -82,16 +82,16 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
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, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }

@ -56,7 +56,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
DCOMP_MS_Host_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_MS_Host_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MS_Host_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_MS_Host_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return MS_ENUMERROR_NoCompatibleInterfaceFound; return MS_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -82,16 +82,16 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
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, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }

@ -56,7 +56,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return PRNT_ENUMERROR_NoCompatibleInterfaceFound; return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -82,16 +82,16 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
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, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize; PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
} }
@ -108,9 +108,12 @@ static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor)
{ {
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{ {
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == PRINTER_CLASS) && USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == PRINTER_SUBCLASS) && USB_Descriptor_Interface_t);
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == PRINTER_PROTOCOL))
if ((CurrentInterface->Class == PRINTER_CLASS) &&
(CurrentInterface->SubClass == PRINTER_SUBCLASS) &&
(CurrentInterface->Protocol == PRINTER_PROTOCOL))
{ {
return DESCRIPTOR_SEARCH_Found; return DESCRIPTOR_SEARCH_Found;
} }

@ -105,7 +105,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
RNDISInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); RNDISInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; RNDISInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
@ -144,7 +144,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
if ((CurrentInterface->Class == RNDIS_CONTROL_CLASS) && if ((CurrentInterface->Class == RNDIS_CONTROL_CLASS) &&
(CurrentInterface->SubClass == RNDIS_CONTROL_SUBCLASS) && (CurrentInterface->SubClass == RNDIS_CONTROL_SUBCLASS) &&
(CurrentInterface->Protocol == RNDIS_CONTROL_PROTOCOL)) (CurrentInterface->Protocol == RNDIS_CONTROL_PROTOCOL))
{ {
return DESCRIPTOR_SEARCH_Found; return DESCRIPTOR_SEARCH_Found;
} }
@ -162,7 +162,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
if ((CurrentInterface->Class == RNDIS_DATA_CLASS) && if ((CurrentInterface->Class == RNDIS_DATA_CLASS) &&
(CurrentInterface->SubClass == RNDIS_DATA_SUBCLASS) && (CurrentInterface->SubClass == RNDIS_DATA_SUBCLASS) &&
(CurrentInterface->Protocol == RNDIS_DATA_PROTOCOL)) (CurrentInterface->Protocol == RNDIS_DATA_PROTOCOL))
{ {
return DESCRIPTOR_SEARCH_Found; return DESCRIPTOR_SEARCH_Found;
} }

@ -57,7 +57,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
DCOMP_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found) DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{ {
return SI_ENUMERROR_NoCompatibleInterfaceFound; return SI_ENUMERROR_NoCompatibleInterfaceFound;
} }
@ -91,7 +91,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber) if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber)
{ {
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE); SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; SIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;

Loading…
Cancel
Save