X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/023838fe4aad5b5f0da00b767afd1400d4e40b4c..205b35d131a1cc8196786de4370cb90fec17835e:/LUFA/Drivers/USB/Class/Host/MassStorage.c?ds=inline diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index ba281cfa4..678c070c0 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -45,7 +45,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_ return MS_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor, - DComp_NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DComp_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return MS_ENUMERROR_NoMSInterfaceFound; } @@ -60,7 +60,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_ while (FoundEndpoints != (MS_FOUND_DATAPIPE_IN | MS_FOUND_DATAPIPE_OUT)) { if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor, - DComp_NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DComp_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { return MS_ENUMERROR_EndpointsNotFound; } @@ -91,13 +91,16 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_ return MS_ENUMERROR_NoError; } -static uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor) +static uint8_t DComp_NextMSInterface(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == MASS_STORE_CLASS) && - (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == MASS_STORE_SUBCLASS) && - (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MASS_STORE_PROTOCOL)) + USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, + USB_Descriptor_Interface_t); + + if ((CurrentInterface->Class == MASS_STORE_CLASS) && + (CurrentInterface->SubClass == MASS_STORE_SUBCLASS) && + (CurrentInterface->Protocol == MASS_STORE_PROTOCOL)) { return DESCRIPTOR_SEARCH_Found; } @@ -106,12 +109,14 @@ static uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor) +static uint8_t DComp_NextMSInterfaceEndpoint(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { - uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor, - USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK); + USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor, + USB_Descriptor_Endpoint_t); + + uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK); if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))) @@ -137,7 +142,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, MS_ { uint8_t ErrorCode = PIPE_RWSTREAM_NoError; - SCSICommandBlock->Tag = MSInterfaceInfo->State.TransactionTag++; + SCSICommandBlock->Tag = ++MSInterfaceInfo->State.TransactionTag; if (MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF) MSInterfaceInfo->State.TransactionTag = 1;