Add macro guards to the templated C files to prevent compile errors if they are mista...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / Audio.c
index 5760b6a..1d590e8 100644 (file)
@@ -51,18 +51,19 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
        if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)\r
          return AUDIO_ENUMERROR_InvalidConfigDescriptor;\r
 \r
        if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)\r
          return AUDIO_ENUMERROR_InvalidConfigDescriptor;\r
 \r
-       while (!(DataINEndpoint) || !(DataOUTEndpoint))\r
+       while ((AudioInterfaceInfo->Config.DataINPipeNumber  && !(DataINEndpoint)) ||\r
+              (AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint)))\r
        {\r
                if (!(AudioControlInterface) ||\r
                    USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
        {\r
                if (!(AudioControlInterface) ||\r
                    USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
-                                             DComp_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                             DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
                {\r
                        if (!(AudioControlInterface) ||\r
                            USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
                {\r
                        if (!(AudioControlInterface) ||\r
                            USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
-                                                     DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                                     DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
                        {\r
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
                        {\r
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
-                                                             DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                                             DCOMP_Audio_Host_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
                                {\r
                                        return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
                                }\r
                                {\r
                                        return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
                                }\r
@@ -70,13 +71,16 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
                                AudioControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);                     \r
 \r
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
                                AudioControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);                     \r
 \r
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
-                                                             DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                                             DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
                                {\r
                                        return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
                                }\r
                        }\r
 \r
                        AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);\r
                                {\r
                                        return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
                                }\r
                        }\r
 \r
                        AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);\r
+                       \r
+                       DataINEndpoint  = NULL;\r
+                       DataOUTEndpoint = NULL;\r
 \r
                        continue;\r
                }\r
 \r
                        continue;\r
                }\r
@@ -137,7 +141,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
        return AUDIO_ENUMERROR_NoError;\r
 }\r
 \r
        return AUDIO_ENUMERROR_NoError;\r
 }\r
 \r
-static uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor)\r
+static uint8_t DCOMP_Audio_Host_NextAudioControlInterface(void* CurrentDescriptor)\r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
@@ -156,7 +160,7 @@ static uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor)
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
-static uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor)\r
+static uint8_t DCOMP_Audio_Host_NextAudioStreamInterface(void* CurrentDescriptor)\r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
@@ -175,7 +179,7 @@ static uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor)
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
-static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)\r
+static uint8_t DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)\r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
 {\r
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);\r
 \r
@@ -195,7 +199,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
 }\r
 \r
 uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
 }\r
 \r
 uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,\r
-                                                 bool EnableStreaming)\r
+                                                 const bool EnableStreaming)\r
 {\r
        if (!(AudioInterfaceInfo->State.IsActive))\r
          return HOST_SENDCONTROL_DeviceDisconnected;\r
 {\r
        if (!(AudioInterfaceInfo->State.IsActive))\r
          return HOST_SENDCONTROL_DeviceDisconnected;\r
@@ -208,7 +212,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte
                                                 const uint8_t DataPipeIndex,\r
                                                 const uint8_t EndpointProperty,\r
                                                 const uint8_t EndpointControl,\r
                                                 const uint8_t DataPipeIndex,\r
                                                 const uint8_t EndpointProperty,\r
                                                 const uint8_t EndpointControl,\r
-                                                uint16_t const DataLength,\r
+                                                const uint16_t DataLength,\r
                                                 void* const Data)\r
 {\r
        if (!(AudioInterfaceInfo->State.IsActive))\r
                                                 void* const Data)\r
 {\r
        if (!(AudioInterfaceInfo->State.IsActive))\r