Synchronise with the 090605 release.
[pub/USBasp.git] / Demos / Host / MouseHost / ConfigDescriptor.c
index 4a7c3ca..0f6ab59 100644 (file)
@@ -51,7 +51,7 @@ uint8_t ProcessConfigurationDescriptor(void)
        uint16_t ConfigDescriptorSize;\r
        \r
        /* Get Configuration Descriptor size from the device */\r
-       if (USB_Host_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
+       if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
          return ControlError;\r
        \r
        /* Ensure that the Configuration Descriptor isn't too large */\r
@@ -62,22 +62,23 @@ uint8_t ProcessConfigurationDescriptor(void)
        ConfigDescriptorData = alloca(ConfigDescriptorSize);\r
 \r
        /* Retrieve the entire configuration descriptor into the allocated buffer */\r
-       USB_Host_GetDeviceConfigDescriptor(&ConfigDescriptorSize, ConfigDescriptorData);\r
+       USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, ConfigDescriptorData);\r
        \r
        /* Validate returned data - ensure first entry is a configuration header descriptor */\r
        if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)\r
          return InvalidConfigDataReturned;\r
        \r
        /* Get the mouse interface from the configuration descriptor */\r
-       if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface))\r
+       if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+                                     DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
        {\r
                /* Descriptor not found, error out */\r
                return NoHIDInterfaceFound;\r
        }\r
 \r
        /* Get the mouse interface's data endpoint descriptor */\r
-       if (USB_Host_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
-                                                       NextInterfaceMouseDataEndpoint))\r
+       if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+                                     DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
        {\r
                /* Descriptor not found, error out */\r
                return NoEndpointFound;\r
@@ -91,13 +92,6 @@ uint8_t ProcessConfigurationDescriptor(void)
                           EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
 \r
        Pipe_SetInfiniteINRequests();\r
-\r
-       #if defined(INTERRUPT_DATA_PIPE)\r
-       Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS);\r
-\r
-       /* Enable the pipe IN interrupt for the data pipe */\r
-       USB_INT_Enable(PIPE_INT_IN);    \r
-       #endif\r
                        \r
        /* Valid data found, return success */\r
        return SuccessfulConfigRead;\r
@@ -111,7 +105,7 @@ uint8_t ProcessConfigurationDescriptor(void)
  *\r
  *  \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
  */\r
-DESCRIPTOR_COMPARATOR(NextMouseInterface)\r
+uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)\r
 {\r
        /* Determine if the current descriptor is an interface descriptor */\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
@@ -121,12 +115,12 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface)
                    (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MOUSE_PROTOCOL))\r
                {\r
                        /* Indicate that the descriptor being searched for has been found */\r
-                       return Descriptor_Search_Found;\r
+                       return DESCRIPTOR_SEARCH_Found;\r
                }\r
        }\r
        \r
        /* Current descriptor does not match what this comparator is looking for */\r
-       return Descriptor_Search_NotFound;\r
+       return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
 /** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's\r
@@ -138,7 +132,7 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface)
  *\r
  *  \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
  */\r
-DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)\r
+uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor)\r
 {\r
        /* Determine the type of the current descriptor */\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
@@ -147,15 +141,15 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint)
                if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Endpoint_t).EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
                {\r
                        /* Indicate that the descriptor being searched for has been found */\r
-                       return Descriptor_Search_Found;\r
+                       return DESCRIPTOR_SEARCH_Found;\r
                }\r
        }\r
        else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
        {\r
                /* Indicate that the search has failed prematurely and should be aborted */\r
-               return Descriptor_Search_Fail;\r
+               return DESCRIPTOR_SEARCH_Fail;\r
        }\r
 \r
        /* Current descriptor does not match what this comparator is looking for */\r
-       return Descriptor_Search_NotFound;\r
+       return DESCRIPTOR_SEARCH_NotFound;\r
 }\r