Fix XPLAINBridge code broken during the changes to the Rescue Clock generation in the AVRISP-MKII clone project.
Change over all low level host mode project's descriptor comparator routines to perform the descriptor casting in a temp variable to make the code clearer and easier to modify (despite being more verbose).
This commit is contained in:
parent
3bf760ad7d
commit
5ce8380a7d
25 changed files with 380 additions and 287 deletions
|
|
@ -137,14 +137,15 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
|
||||
static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == CDC_CSCP_CDCClass) &&
|
||||
(CurrentInterface->SubClass == CDC_CSCP_ACMSubclass) &&
|
||||
(CurrentInterface->Protocol == CDC_CSCP_ATCommandProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == CDC_CSCP_CDCClass) &&
|
||||
(Interface->SubClass == CDC_CSCP_ACMSubclass) &&
|
||||
(Interface->Protocol == CDC_CSCP_ATCommandProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -155,14 +156,15 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
|
|||
|
||||
static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == CDC_CSCP_CDCDataClass) &&
|
||||
(CurrentInterface->SubClass == CDC_CSCP_NoDataSubclass) &&
|
||||
(CurrentInterface->Protocol == CDC_CSCP_NoDataProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == CDC_CSCP_CDCDataClass) &&
|
||||
(Interface->SubClass == CDC_CSCP_NoDataSubclass) &&
|
||||
(Interface->Protocol == CDC_CSCP_NoDataProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -173,20 +175,21 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
|
|||
|
||||
static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
}
|
||||
}
|
||||
|
||||
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
|
||||
HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
|
||||
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
|
||||
HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
|
||||
HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_CSCP_NonBootProtocol);
|
||||
HIDInterfaceInfo->State.LargestReportSize = 8;
|
||||
HIDInterfaceInfo->State.IsActive = true;
|
||||
|
|
@ -127,12 +127,13 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
|
||||
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (CurrentInterface->Class == HID_CSCP_HIDClass)
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if (Interface->Class == HID_CSCP_HIDClass)
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
||||
|
|
@ -141,9 +142,11 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
|
|||
|
||||
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (Header->Type == HID_DTYPE_HID)
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
else
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
|
|
@ -151,15 +154,16 @@ static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor)
|
|||
|
||||
static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,14 +105,15 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
|
|||
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == AUDIO_CSCP_AudioClass) &&
|
||||
(CurrentInterface->SubClass == AUDIO_CSCP_MIDIStreamingSubclass) &&
|
||||
(CurrentInterface->Protocol == AUDIO_CSCP_StreamingProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == AUDIO_CSCP_AudioClass) &&
|
||||
(Interface->SubClass == AUDIO_CSCP_MIDIStreamingSubclass) &&
|
||||
(Interface->Protocol == AUDIO_CSCP_StreamingProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -123,17 +124,18 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDes
|
|||
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if ((EndpointType == EP_TYPE_BULK) && !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
if ((EndpointType == EP_TYPE_BULK) && !(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,14 +105,15 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == MS_CSCP_MassStorageClass) &&
|
||||
(CurrentInterface->SubClass == MS_CSCP_SCSITransparentSubclass) &&
|
||||
(CurrentInterface->Protocol == MS_CSCP_BulkOnlyTransportProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == MS_CSCP_MassStorageClass) &&
|
||||
(Interface->SubClass == MS_CSCP_SCSITransparentSubclass) &&
|
||||
(Interface->Protocol == MS_CSCP_BulkOnlyTransportProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -123,20 +124,20 @@ static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor)
|
|||
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if ((EndpointType == EP_TYPE_BULK) &&
|
||||
(!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress))))
|
||||
if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress))))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
||||
uint16_t ConfigDescriptorSize,
|
||||
void* DeviceConfigDescriptor)
|
||||
void* ConfigDescriptorData)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
|
||||
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
|
||||
|
|
@ -46,22 +46,22 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
|
||||
memset(&PRNTInterfaceInfo->State, 0x00, sizeof(PRNTInterfaceInfo->State));
|
||||
|
||||
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)
|
||||
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
||||
return PRNT_ENUMERROR_InvalidConfigDescriptor;
|
||||
|
||||
while (!(DataINEndpoint) || !(DataOUTEndpoint))
|
||||
{
|
||||
if (!(PrinterInterface) ||
|
||||
USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
|
||||
USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
|
||||
PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
|
||||
PrinterInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
|
||||
|
||||
DataINEndpoint = NULL;
|
||||
DataOUTEndpoint = NULL;
|
||||
|
|
@ -69,7 +69,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
continue;
|
||||
}
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
DataINEndpoint = EndpointData;
|
||||
|
|
@ -106,14 +106,15 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == PRNT_CSCP_PrinterClass) &&
|
||||
(CurrentInterface->SubClass == PRNT_CSCP_PrinterSubclass) &&
|
||||
(CurrentInterface->Protocol == PRNT_CSCP_BidirectionalProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == PRNT_CSCP_PrinterClass) &&
|
||||
(Interface->SubClass == PRNT_CSCP_PrinterSubclass) &&
|
||||
(Interface->Protocol == PRNT_CSCP_BidirectionalProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -124,15 +125,18 @@ static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor)
|
|||
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if (EndpointType == EP_TYPE_BULK)
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,14 +137,15 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
|
|||
|
||||
static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == CDC_CSCP_CDCClass) &&
|
||||
(CurrentInterface->SubClass == CDC_CSCP_ACMSubclass) &&
|
||||
(CurrentInterface->Protocol == CDC_CSCP_VendorSpecificProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == CDC_CSCP_CDCClass) &&
|
||||
(Interface->SubClass == CDC_CSCP_ACMSubclass) &&
|
||||
(Interface->Protocol == CDC_CSCP_VendorSpecificProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -155,14 +156,16 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
|
|||
|
||||
static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == CDC_CSCP_CDCDataClass) &&
|
||||
(CurrentInterface->SubClass == CDC_CSCP_NoDataSubclass) &&
|
||||
(CurrentInterface->Protocol == CDC_CSCP_NoDataProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == CDC_CSCP_CDCDataClass) &&
|
||||
(Interface->SubClass == CDC_CSCP_NoDataSubclass) &&
|
||||
(Interface->Protocol == CDC_CSCP_NoDataProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -173,20 +176,21 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
|
|||
|
||||
static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,14 +123,15 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
|
||||
uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
if ((CurrentInterface->Class == SI_CSCP_StillImageClass) &&
|
||||
(CurrentInterface->SubClass == SI_CSCP_StillImageSubclass) &&
|
||||
(CurrentInterface->Protocol == SI_CSCP_BulkOnlyProtocol))
|
||||
if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
if ((Interface->Class == SI_CSCP_StillImageClass) &&
|
||||
(Interface->SubClass == SI_CSCP_StillImageSubclass) &&
|
||||
(Interface->Protocol == SI_CSCP_BulkOnlyProtocol))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -141,20 +142,21 @@ uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor)
|
|||
|
||||
uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
|
||||
{
|
||||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
if (Header->Type == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
(!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress))))
|
||||
(!(Pipe_IsEndpointBound(Endpoint->EndpointAddress))))
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
|
||||
else if (Header->Type == DTYPE_Interface)
|
||||
{
|
||||
return DESCRIPTOR_SEARCH_Fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue