X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/ed031c1df2f5b053b9cd9f48c63e66a42b7c049e..6a7c298c0f7119e44e18de15d714cd8b938e3bef:/Demos/Host/MassStorageHost/ConfigDescriptor.c diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.c b/Demos/Host/MassStorageHost/ConfigDescriptor.c index 53e448757..c951c797e 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.c @@ -49,11 +49,10 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t* ConfigDescriptorData; uint16_t ConfigDescriptorSize; - uint8_t ErrorCode; uint8_t FoundEndpoints = 0; /* Get Configuration Descriptor size from the device */ - if (USB_Host_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) + if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) return ControlError; /* Ensure that the Configuration Descriptor isn't too large */ @@ -64,15 +63,15 @@ uint8_t ProcessConfigurationDescriptor(void) ConfigDescriptorData = alloca(ConfigDescriptorSize); /* Retrieve the entire configuration descriptor into the allocated buffer */ - USB_Host_GetDeviceConfigDescriptor(&ConfigDescriptorSize, ConfigDescriptorData); + USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, ConfigDescriptorData); /* Validate returned data - ensure first entry is a configuration header descriptor */ if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) return InvalidConfigDataReturned; /* Get the mass storage interface from the configuration descriptor */ - if ((ErrorCode = USB_Host_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_Host_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; }