X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/32e735b2b2eefb74e0415a5826692f7ba8c0a984..6a7c298c0f7119e44e18de15d714cd8b938e3bef:/Demos/Host/MassStorageHost/ConfigDescriptor.c?ds=inline diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.c b/Demos/Host/MassStorageHost/ConfigDescriptor.c index 1540590ff..c951c797e 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.c @@ -49,7 +49,6 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t* ConfigDescriptorData; uint16_t ConfigDescriptorSize; - uint8_t ErrorCode; uint8_t FoundEndpoints = 0; /* Get Configuration Descriptor size from the device */ @@ -71,8 +70,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the mass storage interface from the configuration descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextMassStorageInterface))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DComp_NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoInterfaceFound; @@ -82,8 +81,8 @@ uint8_t ProcessConfigurationDescriptor(void) while (FoundEndpoints != ((1 << MASS_STORE_DATA_IN_PIPE) | (1 << MASS_STORE_DATA_OUT_PIPE))) { /* Fetch the next bulk endpoint from the current mass storage interface */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceBulkDataEndpoint))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DComp_NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; @@ -128,7 +127,7 @@ uint8_t ProcessConfigurationDescriptor(void) * * \return A value from the DSEARCH_Return_ErrorCodes_t enum */ -DESCRIPTOR_COMPARATOR(NextMassStorageInterface) +uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -137,11 +136,11 @@ DESCRIPTOR_COMPARATOR(NextMassStorageInterface) (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == MASS_STORE_SUBCLASS) && (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MASS_STORE_PROTOCOL)) { - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; } /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's @@ -153,7 +152,7 @@ DESCRIPTOR_COMPARATOR(NextMassStorageInterface) * * \return A value from the DSEARCH_Return_ErrorCodes_t enum */ -DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint) +uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { @@ -162,12 +161,12 @@ DESCRIPTOR_COMPARATOR(NextInterfaceBulkDataEndpoint) /* Check the endpoint type, break out if correct BULK type endpoint found */ if (EndpointType == EP_TYPE_BULK) - return Descriptor_Search_Found; + return DESCRIPTOR_SEARCH_Found; } else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { - return Descriptor_Search_Fail; + return DESCRIPTOR_SEARCH_Fail; } - return Descriptor_Search_NotFound; + return DESCRIPTOR_SEARCH_NotFound; }