aboutsummaryrefslogtreecommitdiff
path: root/LUFA/Drivers/USB/Class
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-06-09 04:08:03 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-06-09 04:08:03 +0000
commitfcf6fac322890da8720cd50782adbca36779da86 (patch)
tree886a528a8ba721733735c1cded2462e6992e11f6 /LUFA/Drivers/USB/Class
parent336e2642c00c972bfe4d17b8a65d300509b938a6 (diff)
Add new Audio Class Driver Host demos.
Fix errors in the new Audio Host mode Class Driver, which would have prevented data from being sent or received properly by the device. Add microphone/square wave generation compile time switch to the Low Level AudioOutput Host demo. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1794 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/USB/Class')
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.h47
2 files changed, 39 insertions, 10 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c
index 0da1eb66..80ab2d1e 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.c
+++ b/LUFA/Drivers/USB/Class/Host/Audio.c
@@ -209,7 +209,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte
const uint8_t EndpointProperty,
const uint8_t EndpointControl,
uint16_t const DataLength,
- uint8_t* Data)
+ void* const Data)
{
uint8_t RequestType;
uint8_t EndpointAddress;
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.h b/LUFA/Drivers/USB/Class/Host/Audio.h
index 7e9a48d8..1cac3e7a 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.h
+++ b/LUFA/Drivers/USB/Class/Host/Audio.h
@@ -159,8 +159,8 @@
const uint8_t DataPipeIndex,
const uint8_t EndpointProperty,
const uint8_t EndpointControl,
- uint16_t* const DataLength,
- uint8_t* Data);
+ uint16_t const DataLength,
+ void* const Data);
/* Inline Functions: */
/** General management task for a given Audio host class interface, required for the correct operation of
@@ -192,8 +192,13 @@
if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
return false;
+ bool SampleReceived = false;
+
Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
- return Pipe_IsINReceived();
+ Pipe_Unfreeze();
+ SampleReceived = Pipe_IsINReceived();
+ Pipe_Freeze();
+ return SampleReceived;
}
/** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects
@@ -237,7 +242,11 @@
Sample = Pipe_Read_8();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -262,7 +271,11 @@
Sample = (int16_t)Pipe_Read_16_LE();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -287,7 +300,11 @@
Sample = (((uint32_t)Pipe_Read_8() << 16) | Pipe_Read_16_LE());
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -308,7 +325,11 @@
Pipe_Write_8(Sample);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/** Writes the next 16-bit audio sample to the current audio interface.
@@ -327,7 +348,11 @@
Pipe_Write_16_LE(Sample);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/** Writes the next 24-bit audio sample to the current audio interface.
@@ -347,7 +372,11 @@
Pipe_Write_8(Sample >> 16);
if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_Freeze();
+ }
}
/* Private Interface - For use in library only: */