aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-06-09 04:08:03 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-06-09 04:08:03 +0000
commit1f1d0710f379a8b08ef646cbadb63d92c35e47fb (patch)
tree886a528a8ba721733735c1cded2462e6992e11f6 /LUFA
parent0bf5064aec5ac43ba2b25d44528bebb27db2f117 (diff)
downloadlufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.tar.gz
lufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.tar.bz2
lufa-1f1d0710f379a8b08ef646cbadb63d92c35e47fb.zip
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.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.h47
-rw-r--r--LUFA/ManPages/LibraryApps.txt6
3 files changed, 43 insertions, 12 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c
index 0da1eb664..80ab2d1e5 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 7e9a48d89..1cac3e7ac 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: */
diff --git a/LUFA/ManPages/LibraryApps.txt b/LUFA/ManPages/LibraryApps.txt
index 354ccb306..e3f20f51c 100644
--- a/LUFA/ManPages/LibraryApps.txt
+++ b/LUFA/ManPages/LibraryApps.txt
@@ -66,6 +66,8 @@
* Measurement class
* - <b>Host</b>
* - <b>ClassDriver</b>
+ * - <b>AudioInputHost</b> - Audio Input host demo, using the library USB Audio Class driver framework
+ * - <b>AudioOutputHost</b> - Audio Output host demo, using the library USB Audio Class driver framework
* - <b>JoystickHostWithParser</b> - Joystick host demo with HID Descriptor parser, using the library USB HID Class driver framework
* - <b>KeyboardHost</b> - USB Keyboard host demo, using the library USB HID Class driver framework
* - <b>KeyboardHostWithParser</b> - USB Keyboard host demo with HID Descriptor parser, using the library USB HID Class
@@ -77,8 +79,8 @@
* - <b>StillImageHost</b> - Still Image Camera host demo, using the library USB Still Image Class driver framework
* - <b>VirtualSerialHost</b> - Virtual Serial Port host demo, using the library USB CDC Class driver framework
* - <b>LowLevel</b>
- * - <b>AudioInputHost</b> - Incomplete Audio Input host demo, using the low level LUFA APIs to implement a USB microphone host
- * - <b>AudioOutputHost</b> - Incomplete Audio Output host demo, using the low level LUFA APIs to implement a USB speaker host
+ * - <b>AudioInputHost</b> - Audio Input host demo, using the low level LUFA APIs to implement the USB Audio class
+ * - <b>AudioOutputHost</b> - Audio Output host demo, using the low level LUFA APIs to implement the USB Audio class
* - <b>GenericHIDHost</b> - Generic HID host demo, using the low level LUFA APIs to implement the USB HID class
* - <b>JoystickHostWithParser</b> - Joystick host demo with HID Descriptor parser, using the low level LUFA APIs to implement
* the USB HID class