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