Minor correction to MagStripe demo to fix build problems.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / Audio.c
index b0800ba..d117bed 100644 (file)
   this software.\r
 */\r
 \r
+#include "../../HighLevel/USBMode.h"\r
+#if defined(USB_CAN_BE_DEVICE)\r
+\r
 #include "Audio.h"\r
 \r
-void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)\r
+void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)\r
 {\r
        if (!(Endpoint_IsSETUPReceived()))\r
          return;\r
          \r
-//     if (USB_ControlRequest.wIndex != AudioInterfaceInfo->InterfaceNumber)\r
-//       return;\r
+       if (USB_ControlRequest.wIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)\r
+         return;\r
 \r
        switch (USB_ControlRequest.bRequest)\r
        {\r
@@ -45,7 +48,7 @@ void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
                        {\r
                                Endpoint_ClearSETUP();\r
                                \r
-                               AudioInterfaceInfo->InterfaceEnabled = (USB_ControlRequest.wValue != 0);\r
+                               AudioInterfaceInfo->State.InterfaceEnabled = (USB_ControlRequest.wValue != 0);\r
                                  \r
                                while (!(Endpoint_IsINReady()));\r
                                Endpoint_ClearIN();\r
@@ -55,22 +58,22 @@ void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
        }\r
 }\r
 \r
-bool USB_Audio_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo)\r
+bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* AudioInterfaceInfo)\r
 {\r
-       if (AudioInterfaceInfo->DataINEndpointNumber)\r
+       if (AudioInterfaceInfo->Config.DataINEndpointNumber)\r
        {\r
-               if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->DataINEndpointNumber, EP_TYPE_ISOCHRONOUS,\r
-                                                                                ENDPOINT_DIR_IN, AudioInterfaceInfo->DataINEndpointSize,\r
+               if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_ISOCHRONOUS,\r
+                                                                                ENDPOINT_DIR_IN, AudioInterfaceInfo->Config.DataINEndpointSize,\r
                                                                                 ENDPOINT_BANK_DOUBLE)))\r
                {\r
                        return false;\r
                }\r
        }\r
 \r
-       if (AudioInterfaceInfo->DataOUTEndpointNumber)\r
+       if (AudioInterfaceInfo->Config.DataOUTEndpointNumber)\r
        {\r
-               if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->DataOUTEndpointNumber, EP_TYPE_ISOCHRONOUS,\r
-                                                                                ENDPOINT_DIR_OUT, AudioInterfaceInfo->DataOUTEndpointSize,\r
+               if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_ISOCHRONOUS,\r
+                                                                                ENDPOINT_DIR_OUT, AudioInterfaceInfo->Config.DataOUTEndpointSize,\r
                                                                                 ENDPOINT_BANK_DOUBLE)))\r
                {\r
                        return false;\r
@@ -80,7 +83,12 @@ bool USB_Audio_ConfigureEndpoints(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
        return true;\r
 }\r
 \r
-int8_t USB_Audio_ReadSample8(void)\r
+void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)\r
+{\r
+\r
+}\r
+\r
+int8_t Audio_Device_ReadSample8(void)\r
 {\r
        int8_t Sample;\r
 \r
@@ -92,7 +100,7 @@ int8_t USB_Audio_ReadSample8(void)
        return Sample;\r
 }\r
 \r
-int16_t USB_Audio_ReadSample16(void)\r
+int16_t Audio_Device_ReadSample16(void)\r
 {\r
        int16_t Sample;\r
 \r
@@ -104,7 +112,7 @@ int16_t USB_Audio_ReadSample16(void)
        return Sample;\r
 }\r
 \r
-int32_t USB_Audio_ReadSample24(void)\r
+int32_t Audio_Device_ReadSample24(void)\r
 {\r
        int32_t Sample;\r
 \r
@@ -116,7 +124,7 @@ int32_t USB_Audio_ReadSample24(void)
        return Sample;\r
 }\r
 \r
-void USB_Audio_WriteSample8(int8_t Sample)\r
+void Audio_Device_WriteSample8(const int8_t Sample)\r
 {\r
        Endpoint_Write_Byte(Sample);\r
 \r
@@ -124,7 +132,7 @@ void USB_Audio_WriteSample8(int8_t Sample)
          Endpoint_ClearIN();\r
 }\r
 \r
-void USB_Audio_WriteSample16(int16_t Sample)\r
+void Audio_Device_WriteSample16(const int16_t Sample)\r
 {\r
        Endpoint_Write_Word_LE(Sample);\r
 \r
@@ -132,7 +140,7 @@ void USB_Audio_WriteSample16(int16_t Sample)
          Endpoint_ClearIN();\r
 }\r
 \r
-void USB_Audio_WriteSample24(int32_t Sample)\r
+void Audio_Device_WriteSample24(const int32_t Sample)\r
 {\r
        Endpoint_Write_Byte(Sample >> 16);\r
        Endpoint_Write_Word_LE(Sample);\r
@@ -141,14 +149,16 @@ void USB_Audio_WriteSample24(int32_t Sample)
          Endpoint_ClearIN();\r
 }\r
 \r
-bool USB_Audio_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo)\r
+bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)\r
 {\r
-       Endpoint_SelectEndpoint(AudioInterfaceInfo->DataOUTEndpointNumber);\r
+       Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);\r
        return Endpoint_IsOUTReceived();\r
 }\r
 \r
-bool USB_Audio_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo)\r
+bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)\r
 {\r
-       Endpoint_SelectEndpoint(AudioInterfaceInfo->DataINEndpointNumber);\r
+       Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);\r
        return Endpoint_IsINReady();\r
 }\r
+\r
+#endif
\ No newline at end of file