Add host mode USB Class driver stubs, add beginnings of a CDC host class driver.

Split out common defines/types from class drivers into a seperate common class driver directory.

Make central USB Class driver dispatch headers, used for both device and host modes.
pull/1469/head
Dean Camera 16 years ago
parent 9fdc53d765
commit afe6ae1402

@ -48,7 +48,7 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/Audio.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
/* Macros: */
/** ADC channel number for the microphone input. */

@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/Audio.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
#include <avr/pgmspace.h>

@ -136,6 +136,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/Audio.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/Audio.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -48,7 +48,7 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/Audio.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
/* Macros: */
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))

@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/Audio.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
#include <avr/pgmspace.h>

@ -136,6 +136,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/Audio.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/Audio.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -48,7 +48,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */

@ -136,6 +136,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */

@ -48,7 +48,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -136,6 +136,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/** Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -49,7 +49,7 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -136,6 +136,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -49,7 +49,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.

@ -136,6 +136,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -41,7 +41,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -52,7 +52,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.

@ -136,6 +136,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -41,7 +41,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -46,7 +46,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -136,6 +136,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/MIDI.h>
#include <LUFA/Drivers/USB/Class/MIDI.h>
#include <avr/pgmspace.h>

@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/MIDI.h>
#include <LUFA/Drivers/USB/Class/MIDI.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -136,6 +136,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MIDI.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MIDI.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -64,8 +64,10 @@
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
/* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_t* MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks);
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_t* MSInterfaceInfo, const uint32_t BlockAddress, uint16_t TotalBlocks);
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_t* MSInterfaceInfo, const uint32_t BlockAddress,
uint16_t TotalBlocks);
void DataflashManager_ReadBlocks(USB_ClassInfo_MS_t* MSInterfaceInfo, const uint32_t BlockAddress,
uint16_t TotalBlocks);
void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t TotalBlocks,

@ -41,7 +41,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/MassStorage.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include "MassStorage.h"
#include "Descriptors.h"

@ -51,7 +51,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/MassStorage.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -138,6 +138,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -51,7 +51,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.

@ -136,7 +136,10 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -40,7 +40,7 @@
#include <avr/io.h>
#include <string.h>
#include <LUFA/Drivers/USB/Class/Device/RNDIS.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include "EthernetProtocols.h"
#include "ProtocolDecoders.h"

@ -55,7 +55,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/RNDIS.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -40,7 +40,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */

@ -51,7 +51,7 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */

@ -137,6 +137,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -50,7 +50,6 @@ int main(void)
for (;;)
{
CDC_Host_Task();
USB_USBTask();
}
}
@ -121,111 +120,3 @@ void EVENT_USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t Su
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/** Task to set the configuration of the attached device after it has been enumerated, and to read in
* data received from the attached CDC device and print it to the serial port.
*/
void CDC_Host_Task(void)
{
uint8_t ErrorCode;
switch (USB_HostState)
{
case HOST_STATE_Addressed:
/* Standard request to set the device configuration to configuration 1 */
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_SetConfiguration,
.wValue = 1,
.wIndex = 0,
.wLength = 0,
};
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
/* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Control Error (Set Configuration).\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
/* Wait until USB device disconnected */
while (USB_IsConnected);
break;
}
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
puts_P(PSTR("Getting Config Data.\r\n"));
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
if (ErrorCode == ControlError)
puts_P(PSTR("Control Error (Get Configuration).\r\n"));
else
puts_P(PSTR("Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
/* Wait until USB device disconnected */
while (USB_IsConnected);
break;
}
puts_P(PSTR("CDC Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Ready;
break;
case HOST_STATE_Ready:
/* Select and the data IN pipe */
Pipe_SelectPipe(CDC_DATAPIPE_IN);
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
/* Check if data is in the pipe */
if (Pipe_IsReadWriteAllowed())
{
/* Get the length of the pipe data, and create a new buffer to hold it */
uint16_t BufferLength = Pipe_BytesInPipe();
uint8_t Buffer[BufferLength];
/* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength);
/* Print out the buffer contents to the USART */
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
putchar(Buffer[BufferByte]);
}
/* Clear the pipe after it is read, ready for the next packet */
Pipe_ClearIN();
}
/* Select and unfreeze the notification pipe */
Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);
Pipe_Unfreeze();
/* Check if a packet has been received */
if (Pipe_IsINReceived())
{
/* Discard the unused event notification */
Pipe_ClearIN();
}
/* Freeze notification IN pipe after use */
Pipe_Freeze();
break;
}
}

@ -45,22 +45,12 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Misc/TerminalCodes.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include "ConfigDescriptor.h"
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/CDC.h>
/* Macros: */
/** Pipe number for the CDC data IN pipe */
#define CDC_DATAPIPE_IN 1
/** Pipe number for the CDC data OUT pipe */
#define CDC_DATAPIPE_OUT 2
/** Pipe number for the CDC notification pipe */
#define CDC_NOTIFICATIONPIPE 3
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -75,7 +65,6 @@
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Host_Task(void);
void EVENT_USB_HostError(const uint8_t ErrorCode);
void EVENT_USB_DeviceAttached(void);

@ -124,7 +124,6 @@ LUFA_PATH = ../../../..
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c \
$(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
@ -137,7 +136,9 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -137,6 +137,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \

@ -137,7 +137,9 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -138,8 +138,10 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -138,6 +138,8 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/MassStorage.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/MassStorage.c \
# List C++ source files here. (C dependencies are automatically generated.)

@ -137,7 +137,10 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -138,8 +138,10 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -137,7 +137,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/StillImage.c \
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =

@ -73,6 +73,40 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each CDC interface
* within the user application, and passed to each of the CDC class driver functions as the
* CDCInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
uint8_t ControlLineState; /**< Current control line states, as set by the host */
struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} LineEncoding;
} USB_ClassInfo_CDC_Host_t;
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Host_Task(void);

File diff suppressed because one or more lines are too long

@ -4,30 +4,30 @@
* documentation pages. It is not a project source file.
*/
/** \dir Common
/** \dir LUFA/Common
* \brief Common library header files.
*
* This folder contains header files which are common to all parts of the LUFA library. They may be used freely in
* user applications.
*
* \dir Drivers
* \dir LUFA/Drivers
* \brief Library hardware and software drivers.
*
* This folder contains all the library hardware and software drivers for each supported board and USB AVR
* microcontroller model.
*
* \dir Drivers/Misc
* \dir LUFA/Drivers/Misc
* \brief Miscellaneous driver files.
*
* This folder contains drivers for aspects other than the USB interface, board hardware or AVR peripherals.
*
* \dir Drivers/Peripheral
* \dir LUFA/Drivers/Peripheral
* \brief USB AVR peripheral driver files.
*
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible with
* all USB AVR models.
*
* \dir Drivers/Peripheral/AT90USBXXX67
* \dir LUFA/Drivers/Peripheral/AT90USBXXX67
* \brief AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 AVR model peripheral driver files. Its original name is due to legacy
* reasons.
*
@ -36,7 +36,7 @@
* included by the user application - the dispatch header file located in the parent AT90USBXXX directory should be used
* instead.
*
* \dir Drivers/USB
* \dir LUFA/Drivers/USB
* \brief USB controller peripheral driver files.
*
* This folder contains the main header files required to implement the USB interface in the USB supporting AVR models.
@ -44,76 +44,76 @@
* functionality, and the appropriate C source files in the LowLevel and HighLevel driver folders added to the compile
* and link stages.
*
* \dir Drivers/USB/LowLevel
* \dir LUFA/Drivers/USB/LowLevel
* \brief Low level USB driver files.
*
* This folder contains low level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir Drivers/USB/HighLevel
* \dir LUFA/Drivers/USB/HighLevel
* \brief High level USB driver files.
*
* This folder contains high level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir Drivers/USB/Class
* \dir LUFA/Drivers/USB/Class
* \brief USB Class helper driver files.
*
* This folder contains drivers for implementing functionality of standardized USB classes. These are not used directly by the library,
* but provide a standard and library-maintained way of implementing functionality from some of the defined USB classes without extensive
* development effort. Is is recommended that these drivers be used where possible to reduce maintenance of user applications.
*
* \dir Drivers/USB/Class/Device
* \dir LUFA/Drivers/USB/Class/Device
* \brief USB Device Class helper driver files.
*
* Device mode drivers for the standard USB classes.
*
* \dir Drivers/USB/Class/Host
* \dir LUFA/Drivers/USB/Class/Host
* \brief USB Host Class helper driver files.
*
* Host mode drivers for the standard USB classes.
*
* \dir Drivers/Board
* \dir LUFA/Drivers/Board
* \brief Board hardware driver files.
*
* This folder contains drivers for interfacing with the physical hardware on supported commercial boards, primarily from
* the Atmel corporation. Header files in this folder should be included in user applications requiring the functionality of
* hardware placed on supported boards.
*
* \dir Drivers/Board/USBKEY
* \dir LUFA/Drivers/Board/USBKEY
* \brief USBKEY board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel USBKEY demonstration board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/STK526
* \dir LUFA/Drivers/Board/STK526
* \brief STK526 board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel STK526 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/STK525
* \dir LUFA/Drivers/Board/STK525
* \brief STK525 board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel STK525 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir Drivers/Board/RZUSBSTICK
* \dir LUFA/Drivers/Board/RZUSBSTICK
* \brief RZUSBSTICK board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel RZUSBSTICK board, as used in the Atmel "Raven" wireless kits. The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir Drivers/Board/ATAVRUSBRF01
* \dir LUFA/Drivers/Board/ATAVRUSBRF01
* \brief ATAVRUSBRF01 board hardware driver files.
*
* This folder contains drivers for hardware on the Atmel ATAVRUSBRF01 board, as used in several Atmel wireless demo kits. The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir DriverStubs
* \dir LUFA/DriverStubs
* \brief Driver stub header files for custom boards, to allow the LUFA board drivers to operate.
*
* This contains stub files for the LUFA board drivers. If the LUFA board drivers are used with board hardware other than those

@ -0,0 +1,62 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassAudio Audio Device Class Driver - LUFA/Drivers/Class/Audio.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/Audio.c
* - LUFA/Drivers/USB/Class/Host/Audio.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Audio Class interfaces
* within a USB device.
*
* @{
*/
#ifndef _AUDIO_CLASS_H_
#define _AUDIO_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/Audio.h"
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/Audio.h"
#endif
#endif
/** @} */

@ -0,0 +1,62 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassCDC CDC Device Class Driver - LUFA/Drivers/Class/CDC.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/CDC.c
* - LUFA/Drivers/USB/Class/Host/CDC.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB CDC Class interfaces
* within a USB device, for the implementation of CDC-ACM virtual serial ports.
*
* @{
*/
#ifndef _CDC_CLASS_H_
#define _CDC_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/CDC.h"
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/CDC.h"
#endif
#endif
/** @} */

@ -0,0 +1,381 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassAudio
* @{
*/
#ifndef _AUDIO_CLASS_COMMON_H_
#define _AUDIO_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** Descriptor header constant to indicate a Audio class interface descriptor. */
#define DTYPE_AudioInterface 0x24
/** Descriptor header constant to indicate a Audio class endpoint descriptor. */
#define DTYPE_AudioEndpoint 0x25
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */
#define DSUBTYPE_Header 0x01
/** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */
#define DSUBTYPE_InputTerminal 0x02
/** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */
#define DSUBTYPE_OutputTerminal 0x03
/** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */
#define DSUBTYPE_FeatureUnit 0x06
/** Audio class descriptor subtype value for a general Audio class specific descriptor. */
#define DSUBTYPE_General 0x01
/** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
#define DSUBTYPE_Format 0x02
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_FRONT (1 << 0)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_FRONT (1 << 1)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_CENTER_FRONT (1 << 2)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_SURROUND (1 << 4)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_SURROUND (1 << 5)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_OF_CENTER (1 << 6)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_OF_CENTER (1 << 7)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SURROUND (1 << 8)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SIDE_LEFT (1 << 9)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SIDE_RIGHT (1 << 10)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_TOP (1 << 11)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_MUTE (1 << 0)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_VOLUME (1 << 1)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS (1 << 2)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_MID (1 << 3)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_TREBLE (1 << 4)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_AUTOMATIC_GAIN (1 << 6)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_DELAY (1 << 7)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS_BOOST (1 << 8)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS_LOUDNESS (1 << 9)
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_UNDEFINED 0x0100
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_STREAMING 0x0101
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_VENDOR 0x01FF
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_UNDEFINED 0x0200
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_MIC 0x0201
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_DESKTOP_MIC 0x0202
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_PERSONAL_MIC 0x0203
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_OMNIDIR_MIC 0x0204
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_MIC_ARRAY 0x0205
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_PROCESSING_MIC 0x0206
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_OUT_UNDEFINED 0x0300
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_SPEAKER 0x0301
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_HEADPHONES 0x0302
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_HEAD_MOUNTED 0x0303
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_DESKTOP 0x0304
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_ROOM 0x0305
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_COMMUNICATION 0x0306
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_LOWFREQ 0x0307
/** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
*
* \param freq Required audio sampling frequency in HZ
*/
#define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
*/
#define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* will accept partially filled endpoint packets of audio samples.
*/
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
/* Type Defines: */
/** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more
* details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
} USB_AudioInterface_AC_t;
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
* specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioFeatureUnit_t;
/** Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioInputTerminal_t;
/** Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioOutputTerminal_t;
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
* how audio streams within the device are formatted. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
} USB_AudioInterface_AS_t;
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
*/
typedef struct
{
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
} AudioSampleFreq_t;
/** Type define for an Audio class specific audio format descriptor. This is used to give the host full details
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
* in the device's audio streams. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
uint8_t Channels; /**< Total number of discrete channels in the stream */
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
AudioSampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_AudioFormat_t;
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */
uint8_t Refresh; /**< Always set to zero */
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
} USB_AudioStreamEndpoint_Std_t;
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
* class specific extended endpoint descriptor. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
} USB_AudioStreamEndpoint_Spc_t;
/** Class state structure. An instance of this structure should be made for each Audio interface
* within the user application, and passed to each of the Audio class driver functions as the
* AudioInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available (zero if unused) */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available (zero if unused) */
bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints
* of the Audio Streaming interface
*/
} USB_ClassInfo_Audio_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,184 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassCDC
* @{
*/
#ifndef _CDC_CLASS_COMMON_H_
#define _CDC_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
#define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
#define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that the DTR line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that theRTS line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads, thus cannot be represented accurately by
* a single typedef struct. A macro is used instead so that functional descriptors can be created
* easily by specifying the size of the payload. This allows sizeof() to work correctly.
*
* \param DataSize Size in bytes of the CDC functional descriptor's data payload
*/
#define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
struct \
{ \
USB_Descriptor_Header_t Header; \
uint8_t SubType; \
uint8_t Data[DataSize]; \
}
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */
CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */
CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */
CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each CDC interface
* within the user application, and passed to each of the CDC class driver functions as the
* CDCInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
uint8_t ControlLineState; /**< Current control line states, as set by the host */
struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} LineEncoding;
} USB_ClassInfo_CDC_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,112 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassHID
* @{
*/
#ifndef _HID_CLASS_COMMON_H_
#define _HID_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include <string.h>
/* Macros: */
/** HID Class Specific Request to get the current HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class Specific Request to get the current device idle count. */
#define REQ_GetIdle 0x02
/** HID Class Specific Request to set the current HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class Specific Request to set the device's idle count. */
#define REQ_SetIdle 0x0A
/** HID Class Specific Request to get the current HID report protocol mode. */
#define REQ_GetProtocol 0x03
/** HID Class Specific Request to set the current HID report protocol mode. */
#define REQ_SetProtocol 0x0B
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
/* Type Defines: */
/** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
* specification for details on the structure elements.
*/
typedef struct
{
USB_Descriptor_Header_t Header;
uint16_t HIDSpec;
uint8_t CountryCode;
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
uint16_t HIDReportLength;
} USB_Descriptor_HID_t;
/** Type define for the data type used to store HID report descriptor elements. */
typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
/** Class state structure. An instance of this structure should be made for each HID interface
* within the user application, and passed to each of the HID class driver functions as the
* HIDInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*
* Note that for the HID class driver, host-to-device reports are received via HID class requests
* rather than a dedicated endpoint to simplify the driver and its interface.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */
uint8_t ReportINBufferSize; /**< Size of the largest possible report to send to the host, for buffer allocation purposes */
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapses */
} USB_ClassInfo_HID_t;
#endif
/** @} */

@ -0,0 +1,171 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassMIDI
* @{
*/
#ifndef _MIDI_CLASS_COMMON_H_
#define _MIDI_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "Audio.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
#define DSUBTYPE_InputJack 0x02
/** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */
#define DSUBTYPE_OutputJack 0x03
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EMBEDDED 0x01
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EXTERNAL 0x02
/** MIDI command for a note on (activation) event */
#define MIDI_COMMAND_NOTE_ON 0x09
/** MIDI command for a note off (deactivation) event */
#define MIDI_COMMAND_NOTE_OFF 0x08
/** Standard key press velocity value used for all note events */
#define MIDI_STANDARD_VELOCITY 64
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
* \param channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) (channel - 1)
/* Type Defines: */
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors.
* See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
} USB_AudioInterface_MIDI_AS_t;
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_In_Jack_t;
/** Type define for an Audio class specific MIDI OUT jack. This gives information to the host on a MIDI output, either
* a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_Out_Jack_t;
/** Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information
* on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
* class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint */
uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint */
} USB_MIDI_Jack_Endpoint_t;
/** Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. */
typedef struct
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
/** Class state structure. An instance of this structure should be made for each MIDI interface
* within the user application, and passed to each of the MIDI class driver functions as the
* MIDIInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
} USB_ClassInfo_MIDI_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,135 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassMS
* @{
*/
#ifndef _MS_CLASS_COMMON_H_
#define _MS_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
#define REQ_MassStorageReset 0xFF
/** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
#define REQ_GetMaxLUN 0xFE
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CSW_SIGNATURE 0x53425355UL
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define MS_COMMAND_DIR_DATA_OUT (0 << 7)
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
#define MS_COMMAND_DIR_DATA_IN (1 << 7)
/* Type defines: */
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferLength; /** Length of the optional data portion of the issued command, in bytes */
uint8_t Flags; /**< Command block flags, indicating command data direction */
uint8_t LUN; /**< Logical Unit number this command is issued to */
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
} CommandBlockWrapper_t;
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
/* Enums: */
/** Enum for the possible command status wrapper return status codes. */
enum MassStorage_CommandStatusCodes_t
{
SCSI_Command_Pass = 0, /**< Command completed with no error */
SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each Mass Storage interface
* within the user application, and passed to each of the Mass Storage class driver functions as the
* MSInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */
CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, used internally
* by the class driver
*/
CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, used internally
* by the class driver
*/
bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset
* and that all current Mass Storage operations should immediately abort
*/
} USB_ClassInfo_MS_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,274 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassRNDIS
* @{
*/
#ifndef _RNDIS_CLASS_COMMON_H_
#define _RNDIS_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** Implemented RNDIS Version Major */
#define REMOTE_NDIS_VERSION_MAJOR 0x01
/** Implemented RNDIS Version Minor */
#define REMOTE_NDIS_VERSION_MINOR 0x00
/** RNDIS request to issue a host-to-device NDIS command */
#define REQ_SendEncapsulatedCommand 0x00
/** RNDIS request to issue a device-to-host NDIS response */
#define REQ_GetEncapsulatedResponse 0x01
/** Maximum size in bytes of a RNDIS control message which can be sent or received */
#define RNDIS_MESSAGE_BUFFER_SIZE 128
/** Maximum size in bytes of an Ethernet frame which can be sent or received */
#define ETHERNET_FRAME_SIZE_MAX 1500
/** Notification request value for a RNDIS Response Available notification */
#define NOTIF_ResponseAvailable 1
/* Enums: */
/** Enum for the possible NDIS adapter states. */
enum RNDIS_States_t
{
RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */
RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */
RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */
};
/** Enum for the NDIS hardware states */
enum NDIS_Hardware_Status_t
{
NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host */
NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing */
NDIS_HardwareStatus_Reset, /**< Hardware reset */
NDIS_HardwareStatus_Closing, /**< Hardware currently closing */
NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host */
};
/* Type Defines: */
/** Type define for a physical MAC address of a device on a network */
typedef struct
{
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
} MAC_Address_t;
/** Type define for a RNDIS message header, sent before RNDIS messages */
typedef struct
{
uint32_t MessageType; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */
} RNDIS_Message_Header_t;
/** Type define for an Ethernet frame buffer. */
typedef struct
{
uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents */
uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer */
bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */
} Ethernet_Frame_Info_t;
/** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t DataOffset;
uint32_t DataLength;
uint32_t OOBDataOffset;
uint32_t OOBDataLength;
uint32_t NumOOBDataElements;
uint32_t PerPacketInfoOffset;
uint32_t PerPacketInfoLength;
uint32_t VcHandle;
uint32_t Reserved;
} RNDIS_PACKET_MSG_t;
/** Type define for a RNDIS Initialize command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_INITIALIZE_MSG_t;
/** Type define for a RNDIS Initialize complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
uint32_t Medium;
uint32_t MaxPacketsPerTransfer;
uint32_t MaxTransferSize;
uint32_t PacketAlignmentFactor;
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_INITIALIZE_CMPLT_t;
/** Type define for a RNDIS Keepalive command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
} RNDIS_KEEPALIVE_MSG_t;
/** Type define for a RNDIS Keepalive complete message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_KEEPALIVE_CMPLT_t;
/** Type define for a RNDIS Reset complete message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t Status;
uint32_t AddressingReset;
} RNDIS_RESET_CMPLT_t;
/** Type define for a RNDIS Set command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_SET_MSG_t;
/** Type define for a RNDIS Set complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_SET_CMPLT_t;
/** Type define for a RNDIS Query command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_QUERY_MSG_t;
/** Type define for a RNDIS Query complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_QUERY_CMPLT_t;
/** Class state structure. An instance of this structure should be made for each RNDIS interface
* within the user application, and passed to each of the RNDIS class driver functions as the
* RNDISInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
char* AdapterVendorDescription; /**< String description of the adapter vendor */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */
uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host,
* managed by the class driver
*/
bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host */
uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum */
uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver */
Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user
* processing
*/
Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the
* user application
*/
} USB_ClassInfo_RNDIS_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Audio.h"
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
@ -157,3 +160,5 @@ bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo
Endpoint_SelectEndpoint(AudioInterfaceInfo->DataINEndpointNumber);
return Endpoint_IsINReady();
}
#endif

@ -28,26 +28,22 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassAudioDevice Audio Device Class Driver - LUFA/Drivers/Class/Device/Audio.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/Audio.c
/** \ingroup Group_USBClassAudio
* @defgroup Group_USBClassAudioDevice Audio Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Audio Class interfaces
* within a USB device.
* Device Mode USB Class driver framework interface, for the Audio USB Class driver.
*
* @{
*/
#ifndef _AUDIO_CLASS_H_
#define _AUDIO_CLASS_H_
#ifndef _AUDIO_CLASS_DEVICE_H_
#define _AUDIO_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/Audio.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
@ -55,332 +51,6 @@
extern "C" {
#endif
/* Macros: */
/** Descriptor header constant to indicate a Audio class interface descriptor. */
#define DTYPE_AudioInterface 0x24
/** Descriptor header constant to indicate a Audio class endpoint descriptor. */
#define DTYPE_AudioEndpoint 0x25
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */
#define DSUBTYPE_Header 0x01
/** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */
#define DSUBTYPE_InputTerminal 0x02
/** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */
#define DSUBTYPE_OutputTerminal 0x03
/** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */
#define DSUBTYPE_FeatureUnit 0x06
/** Audio class descriptor subtype value for a general Audio class specific descriptor. */
#define DSUBTYPE_General 0x01
/** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
#define DSUBTYPE_Format 0x02
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_FRONT (1 << 0)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_FRONT (1 << 1)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_CENTER_FRONT (1 << 2)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_SURROUND (1 << 4)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_SURROUND (1 << 5)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_LEFT_OF_CENTER (1 << 6)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_RIGHT_OF_CENTER (1 << 7)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SURROUND (1 << 8)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SIDE_LEFT (1 << 9)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_SIDE_RIGHT (1 << 10)
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define CHANNEL_TOP (1 << 11)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_MUTE (1 << 0)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_VOLUME (1 << 1)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS (1 << 2)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_MID (1 << 3)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_TREBLE (1 << 4)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_AUTOMATIC_GAIN (1 << 6)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_DELAY (1 << 7)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS_BOOST (1 << 8)
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define FEATURE_BASS_LOUDNESS (1 << 9)
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_UNDEFINED 0x0100
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_STREAMING 0x0101
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_VENDOR 0x01FF
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_UNDEFINED 0x0200
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_MIC 0x0201
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_DESKTOP_MIC 0x0202
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_PERSONAL_MIC 0x0203
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_OMNIDIR_MIC 0x0204
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_MIC_ARRAY 0x0205
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_PROCESSING_MIC 0x0206
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_IN_OUT_UNDEFINED 0x0300
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_SPEAKER 0x0301
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_HEADPHONES 0x0302
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_HEAD_MOUNTED 0x0303
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_DESKTOP 0x0304
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_ROOM 0x0305
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_COMMUNICATION 0x0306
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define TERMINAL_OUT_LOWFREQ 0x0307
/** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
*
* \param freq Required audio sampling frequency in HZ
*/
#define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
*/
#define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* will accept partially filled endpoint packets of audio samples.
*/
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
/* Type Defines: */
/** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more
* details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
} USB_AudioInterface_AC_t;
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
* specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioFeatureUnit_t;
/** Type define for an Audio class specific input terminal descriptor. This indicates to the host that the device
* contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioInputTerminal_t;
/** Type define for an Audio class specific output terminal descriptor. This indicates to the host that the device
* contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example,
* a USB endpoint). See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_AudioOutputTerminal_t;
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
* how audio streams within the device are formatted. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
} USB_AudioInterface_AS_t;
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
*/
typedef struct
{
uint16_t LowWord; /**< Low 16 bits of the 24-bit value */
uint8_t HighByte; /**< Upper 8 bits of the 24-bit value */
} AudioSampleFreq_t;
/** Type define for an Audio class specific audio format descriptor. This is used to give the host full details
* about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used
* in the device's audio streams. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
uint8_t Channels; /**< Total number of discrete channels in the stream */
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
AudioSampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_AudioFormat_t;
/** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint */
uint8_t Refresh; /**< Always set to zero */
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronisation information to, if needed (zero otherwise) */
} USB_AudioStreamEndpoint_Std_t;
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
* class specific extended endpoint descriptor. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
} USB_AudioStreamEndpoint_Spc_t;
/** Class state structure. An instance of this structure should be made for each Audio interface
* within the user application, and passed to each of the Audio class driver functions as the
* AudioInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming Audio Streaming data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming Audio Streaming data endpoint, if available (zero if unused) */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available (zero if unused) */
bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints
* of the Audio Streaming interface
*/
} USB_ClassInfo_Audio_t;
/* Function Prototypes: */
/** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the

@ -28,7 +28,10 @@
this software.
*/
#define INCLUDE_FROM_CDC_CLASS_C
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_CDC_CLASS_DEVICE_C
#include "CDC.h"
void CDC_Device_Event_Stub(void)
@ -195,3 +198,5 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
}
#endif

@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassCDCDevice CDC Device Class Driver - LUFA/Drivers/Class/Device/CDC.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/CDC.c
/** \ingroup Group_USBClassCDC
* @defgroup Group_USBClassCDCDevice CDC Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB CDC Class interfaces
* within a USB device, for the implementation of CDC-ACM virtual serial ports.
* Device Mode USB Class driver framework interface, for the CDC USB Class driver.
*
* @{
*/
#ifndef _CDC_CLASS_H_
#define _CDC_CLASS_H_
#ifndef _CDC_CLASS_DEVICE_H_
#define _CDC_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/CDC.h"
#include <string.h>
@ -55,137 +51,8 @@
extern "C" {
#endif
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
#define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
#define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that the DTR line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that theRTS line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads, thus cannot be represented accurately by
* a single typedef struct. A macro is used instead so that functional descriptors can be created
* easily by specifying the size of the payload. This allows sizeof() to work correctly.
*
* \param DataSize Size in bytes of the CDC functional descriptor's data payload
*/
#define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
struct \
{ \
USB_Descriptor_Header_t Header; \
uint8_t SubType; \
uint8_t Data[DataSize]; \
}
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */
CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */
CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */
CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each CDC interface
* within the user application, and passed to each of the CDC class driver functions as the
* CDCInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
uint8_t ControlLineState; /**< Current control line states, as set by the host */
struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} LineEncoding;
} USB_ClassInfo_CDC_t;
/* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_C)
#if defined(INCLUDE_FROM_CDC_CLASS_DEVICE_C)
void CDC_Device_Event_Stub(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);

@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "HID.h"
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
@ -172,3 +175,5 @@ void HID_Device_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
Endpoint_ClearIN();
}
}
#endif

@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassHIDDevice HID Device Class Driver - LUFA/Drivers/Class/Device/HID.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/HID.c
/** \ingroup Group_USBClassHID
* @defgroup Group_USBClassHIDDevice HID Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB HID Class interfaces
* within a USB device.
* Device Mode USB Class driver framework interface, for the HID USB Class driver.
*
* @{
*/
#ifndef _HID_CLASS_H_
#define _HID_CLASS_H_
#ifndef _HID_CLASS_DEVICE_H_
#define _HID_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/HID.h"
#include <string.h>
@ -55,73 +51,6 @@
extern "C" {
#endif
/* Macros: */
/** HID Class Specific Request to get the current HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class Specific Request to get the current device idle count. */
#define REQ_GetIdle 0x02
/** HID Class Specific Request to set the current HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class Specific Request to set the device's idle count. */
#define REQ_SetIdle 0x0A
/** HID Class Specific Request to get the current HID report protocol mode. */
#define REQ_GetProtocol 0x03
/** HID Class Specific Request to set the current HID report protocol mode. */
#define REQ_SetProtocol 0x0B
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
/* Type Defines: */
/** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
* specification for details on the structure elements.
*/
typedef struct
{
USB_Descriptor_Header_t Header;
uint16_t HIDSpec;
uint8_t CountryCode;
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
uint16_t HIDReportLength;
} USB_Descriptor_HID_t;
/** Type define for the data type used to store HID report descriptor elements. */
typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
/** Class state structure. An instance of this structure should be made for each HID interface
* within the user application, and passed to each of the HID class driver functions as the
* HIDInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*
* Note that for the HID class driver, host-to-device reports are received via HID class requests
* rather than a dedicated endpoint to simplify the driver and its interface.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */
uint8_t ReportINBufferSize; /**< Size of the largest possible report to send to the host, for buffer allocation purposes */
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapses */
} USB_ClassInfo_HID_t;
/* Function Prototypes: */
/** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration

@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "MIDI.h"
void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
@ -94,3 +97,5 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB
return true;
}
#endif

@ -28,26 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassMIDIDevice MIDI Device Class Driver - LUFA/Drivers/Class/Device/MIDI.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MIDI.c
/** \ingroup Group_USBClassMIDI
* @defgroup Group_USBClassMIDIDevice MIDI Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB MIDI Class interfaces
* within a USB device. Note that the MIDI class is actually a special case of the regular Audio class,
* thus this module depends on structure definitions from the \ref Group_USBClassAudioDevice class driver module.
* Device Mode USB Class driver framework interface, for the MIDI USB Class driver.
*
* @{
*/
#ifndef _MIDI_CLASS_H_
#define _MIDI_CLASS_H_
#ifndef _MIDI_CLASS_DEVICE_H_
#define _MIDI_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/MIDI.h"
#include "Audio.h"
#include <string.h>
@ -57,121 +52,6 @@
extern "C" {
#endif
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
#define DSUBTYPE_InputJack 0x02
/** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */
#define DSUBTYPE_OutputJack 0x03
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EMBEDDED 0x01
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EXTERNAL 0x02
/** MIDI command for a note on (activation) event */
#define MIDI_COMMAND_NOTE_ON 0x09
/** MIDI command for a note off (deactivation) event */
#define MIDI_COMMAND_NOTE_OFF 0x08
/** Standard key press velocity value used for all note events */
#define MIDI_STANDARD_VELOCITY 64
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
* \param channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) (channel - 1)
/* Type Defines: */
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors.
* See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
} USB_AudioInterface_MIDI_AS_t;
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_In_Jack_t;
/** Type define for an Audio class specific MIDI OUT jack. This gives information to the host on a MIDI output, either
* a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_Out_Jack_t;
/** Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information
* on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
* class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint */
uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint */
} USB_MIDI_Jack_Endpoint_t;
/** Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. */
typedef struct
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
/** Class state structure. An instance of this structure should be made for each MIDI interface
* within the user application, and passed to each of the MIDI class driver functions as the
* MIDIInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
} USB_ClassInfo_MIDI_t;
/* Function Prototypes: */
/** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration

@ -28,7 +28,10 @@
this software.
*/
#define INCLUDE_FROM_MS_CLASS_C
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_MS_CLASS_DEVICE_C
#include "MassStorage.h"
static USB_ClassInfo_MS_t* CallbackMSInterfaceInfo;
@ -206,3 +209,5 @@ static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
else
return STREAMCALLBACK_Continue;
}
#endif

@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassMSDevice Mass Storage Device Class Driver - LUFA/Drivers/Class/Device/MassStorage.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MassStorage.c
/** \ingroup Group_USBClassMS
* @defgroup Group_USBClassMSDevice Mass Storage Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Mass Storage Class interfaces
* within a USB device.
* Device Mode USB Class driver framework interface, for the Mass Storage USB Class driver.
*
* @{
*/
#ifndef _MS_CLASS_H_
#define _MS_CLASS_H_
#ifndef _MS_CLASS_DEVICE_H_
#define _MS_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/MassStorage.h"
#include <string.h>
@ -55,88 +51,8 @@
extern "C" {
#endif
/* Macros: */
/** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
#define REQ_MassStorageReset 0xFF
/** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
#define REQ_GetMaxLUN 0xFE
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CSW_SIGNATURE 0x53425355UL
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define MS_COMMAND_DIR_DATA_OUT (0 << 7)
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
#define MS_COMMAND_DIR_DATA_IN (1 << 7)
/* Type defines: */
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferLength; /** Length of the optional data portion of the issued command, in bytes */
uint8_t Flags; /**< Command block flags, indicating command data direction */
uint8_t LUN; /**< Logical Unit number this command is issued to */
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
} CommandBlockWrapper_t;
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
/* Enums: */
/** Enum for the possible command status wrapper return status codes. */
enum MassStorage_CommandStatusCodes_t
{
SCSI_Command_Pass = 0, /**< Command completed with no error */
SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each Mass Storage interface
* within the user application, and passed to each of the Mass Storage class driver functions as the
* MSInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */
CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, used internally
* by the class driver
*/
CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, used internally
* by the class driver
*/
bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset
* and that all current Mass Storage operations should immediately abort
*/
} USB_ClassInfo_MS_t;
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MS_CLASS_C)
#if defined(INCLUDE_FROM_MS_CLASS_DEVICE_C)
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_t* MSInterfaceInfo);
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo);
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);

@ -28,7 +28,10 @@
this software.
*/
#define INCLUDE_FROM_RNDIS_CLASS_C
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_RNDIS_CLASS_DEVICE_C
#include "RNDIS.h"
static const uint32_t PROGMEM AdapterSupportedOIDList[] =
@ -454,3 +457,5 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_t* RNDISInterfaceInf
return false;
}
}
#endif

@ -28,255 +28,32 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassRNDISDevice RNDIS Device Class Driver - LUFA/Drivers/Class/Device/RNDIS.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/RNDIS.c
/** \ingroup Group_USBClassRNDIS
* @defgroup Group_USBClassRNDISDevice RNDIS Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB RNDIS Ethernet
* interfaces within a USB device.
* Device Mode USB Class driver framework interface, for the RNDIS USB Class driver.
*
* @{
*/
#ifndef _RNDIS_CLASS_H_
#define _RNDIS_CLASS_H_
#ifndef _RNDIS_CLASS_DEVICE_H_
#define _RNDIS_CLASS_DEVICE_H_
/* Includes: */
#include <string.h>
#include "../../USB.h"
#include "../Common/RNDIS.h"
#include "RNDISConstants.h"
#include <string.h>
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Macros: */
/** Implemented RNDIS Version Major */
#define REMOTE_NDIS_VERSION_MAJOR 0x01
/** Implemented RNDIS Version Minor */
#define REMOTE_NDIS_VERSION_MINOR 0x00
/** RNDIS request to issue a host-to-device NDIS command */
#define REQ_SendEncapsulatedCommand 0x00
/** RNDIS request to issue a device-to-host NDIS response */
#define REQ_GetEncapsulatedResponse 0x01
/** Maximum size in bytes of a RNDIS control message which can be sent or received */
#define RNDIS_MESSAGE_BUFFER_SIZE 128
/** Maximum size in bytes of an Ethernet frame which can be sent or received */
#define ETHERNET_FRAME_SIZE_MAX 1500
/** Notification request value for a RNDIS Response Available notification */
#define NOTIF_ResponseAvailable 1
/* Enums: */
/** Enum for the possible NDIS adapter states. */
enum RNDIS_States_t
{
RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */
RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */
RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */
};
/** Enum for the NDIS hardware states */
enum NDIS_Hardware_Status_t
{
NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host */
NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing */
NDIS_HardwareStatus_Reset, /**< Hardware reset */
NDIS_HardwareStatus_Closing, /**< Hardware currently closing */
NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host */
};
/* Type Defines: */
/** Type define for a physical MAC address of a device on a network */
typedef struct
{
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
} MAC_Address_t;
/** Type define for a RNDIS message header, sent before RNDIS messages */
typedef struct
{
uint32_t MessageType; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */
} RNDIS_Message_Header_t;
/** Type define for an Ethernet frame buffer. */
typedef struct
{
uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents */
uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer */
bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */
} Ethernet_Frame_Info_t;
/** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t DataOffset;
uint32_t DataLength;
uint32_t OOBDataOffset;
uint32_t OOBDataLength;
uint32_t NumOOBDataElements;
uint32_t PerPacketInfoOffset;
uint32_t PerPacketInfoLength;
uint32_t VcHandle;
uint32_t Reserved;
} RNDIS_PACKET_MSG_t;
/** Type define for a RNDIS Initialize command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_INITIALIZE_MSG_t;
/** Type define for a RNDIS Initialize complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
uint32_t Medium;
uint32_t MaxPacketsPerTransfer;
uint32_t MaxTransferSize;
uint32_t PacketAlignmentFactor;
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_INITIALIZE_CMPLT_t;
/** Type define for a RNDIS Keepalive command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
} RNDIS_KEEPALIVE_MSG_t;
/** Type define for a RNDIS Keepalive complete message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_KEEPALIVE_CMPLT_t;
/** Type define for a RNDIS Reset complete message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t Status;
uint32_t AddressingReset;
} RNDIS_RESET_CMPLT_t;
/** Type define for a RNDIS Set command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_SET_MSG_t;
/** Type define for a RNDIS Set complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_SET_CMPLT_t;
/** Type define for a RNDIS Query command message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_QUERY_MSG_t;
/** Type define for a RNDIS Query complete response message */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_QUERY_CMPLT_t;
/** Class state structure. An instance of this structure should be made for each RNDIS interface
* within the user application, and passed to each of the RNDIS class driver functions as the
* RNDISInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
char* AdapterVendorDescription; /**< String description of the adapter vendor */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter */
uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host,
* managed by the class driver
*/
bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host */
uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the RNDIS_States_t enum */
uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver */
Ethernet_Frame_Info_t FrameIN; /**< Structure holding the last received Ethernet frame from the host, for user
* processing
*/
Ethernet_Frame_Info_t FrameOUT; /**< Structure holding the next Ethernet frame to send to the host, populated by the
* user application
*/
} USB_ClassInfo_RNDIS_t;
/* Function Prototypes: */
#if defined(INCLUDE_FROM_RNDIS_CLASS_C)
#if defined(INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo,
uint32_t OId, void* QueryData, uint16_t QuerySize,

@ -34,8 +34,8 @@
* constants, please refer to the Microsoft RNDIS specification.
*/
#ifndef _RNDIS_CONSTANTS_H_
#define _RNDIS_CONSTANTS_H_
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
/* Macros: */
#define REMOTE_NDIS_PACKET_MSG 0x00000001UL

@ -0,0 +1,63 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassHID HID Device Class Driver - LUFA/Drivers/Class/HID.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/HID.c
* - LUFA/Drivers/USB/Class/Host/HID.c
* - LUFA/Drivers/USB/Class/Host/HIDParser.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB HID Class interfaces
* within a USB device.
*
* @{
*/
#ifndef _HID_CLASS_H_
#define _HID_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/HID.h"
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/HID.h"
#endif
#endif
/** @} */

@ -0,0 +1,36 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "Audio.h"
#endif

@ -0,0 +1,61 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassAudio
* @defgroup Group_USBClassAudioHost Audio Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the Audio USB Class driver.
*
* @{
*/
#ifndef __AUDIO_CLASS_HOST_H__
#define __AUDIO_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/Audio.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,231 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define INCLUDE_FROM_CDC_CLASS_HOST_C
#include "CDC.h"
static uint8_t CDC_Host_ProcessConfigDescriptor(void)
{
uint8_t* ConfigDescriptorData;
uint16_t ConfigDescriptorSize;
uint8_t FoundEndpoints = 0;
if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)
return ControlError;
if (ConfigDescriptorSize > MAX_CONFIG_DESCRIPTOR_SIZE)
return DescriptorTooLarge;
ConfigDescriptorData = alloca(ConfigDescriptorSize);
USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, ConfigDescriptorData);
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return InvalidConfigDataReturned;
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return NoCDCInterfaceFound;
}
while (FoundEndpoints != ((1 << CDC_NOTIFICATIONPIPE) | (1 << CDC_DATAPIPE_IN) | (1 << CDC_DATAPIPE_OUT)))
{
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_CDC_Host_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Check to see if the control interface's notification pipe has been found, if so search for the data interface */
if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE))
{
/* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoCDCInterfaceFound;
}
}
else
{
FoundEndpoints = 0;
Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);
Pipe_DisablePipe();
Pipe_SelectPipe(CDC_DATAPIPE_IN);
Pipe_DisablePipe();
Pipe_SelectPipe(CDC_DATAPIPE_OUT);
Pipe_DisablePipe();
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return NoCDCInterfaceFound;
}
}
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DComp_CDC_Host_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
return NoEndpointFound;
}
}
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
{
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
Pipe_ConfigurePipe(CDC_NOTIFICATIONPIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInfiniteINRequests();
Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS);
FoundEndpoints |= (1 << CDC_NOTIFICATIONPIPE);
}
}
else
{
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
Pipe_ConfigurePipe(CDC_DATAPIPE_IN, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInfiniteINRequests();
Pipe_Unfreeze();
FoundEndpoints |= (1 << CDC_DATAPIPE_IN);
}
else
{
Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
Pipe_Unfreeze();
FoundEndpoints |= (1 << CDC_DATAPIPE_OUT);
}
}
}
return SuccessfulConfigRead;
}
static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct control interface found */
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CONTROL_CLASS) &&
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CONTROL_SUBCLASS) &&
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CONTROL_PROTOCOL))
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
}
static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */
if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_DATA_CLASS) &&
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&
(DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_DATA_PROTOCOL))
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
}
static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
return DESCRIPTOR_SEARCH_Fail;
}
return DESCRIPTOR_SEARCH_NotFound;
}
void CDC_Host_Task(void)
{
uint8_t ErrorCode;
switch (USB_HostState)
{
case HOST_STATE_Addressed:
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_SetConfiguration,
.wValue = 1,
.wIndex = 0,
.wLength = 0,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{
USB_HostState = HOST_STATE_Unattached;
}
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
if ((ErrorCode = CDC_Host_ProcessConfigDescriptor()) != SuccessfulConfigRead)
{
USB_HostState = HOST_STATE_Unattached;
}
USB_HostState = HOST_STATE_Ready;
break;
}
}
#endif

@ -0,0 +1,69 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassCDC
* @defgroup Group_USBClassCDCHost CDC Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the CDC USB Class driver.
*
* @{
*/
#ifndef __CDC_CLASS_HOST_H__
#define __CDC_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/CDC.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_HOST_C)
static uint8_t CDC_Host_ProcessConfigDescriptor(void);
static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor);
static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor);
static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor);
#endif
void CDC_Host_Task(void);
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,36 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "HID.h"
#endif

@ -0,0 +1,61 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassHID
* @defgroup Group_USBClassHIDHost HID Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the HID USB Class driver.
*
* @{
*/
#ifndef __HID_CLASS_HOST_H__
#define __HID_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/HID.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -29,6 +29,7 @@
*/
#include "HIDParser.h"
#if defined(CAN_BE_HOST)
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_ReportInfo_t* const ParserData)
{
@ -324,3 +325,5 @@ void USB_SetHIDReportItemInfo(uint8_t* ReportData, const HID_ReportItem_t* Repor
BitMask <<= 1;
}
}
#endif

@ -0,0 +1,36 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "MIDI.h"
#endif

@ -0,0 +1,61 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassMIDI
* @defgroup Group_USBClassMIDIHost MIDI Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the MIDI USB Class driver.
*
* @{
*/
#ifndef __MIDI_CLASS_HOST_H__
#define __MIDI_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/MIDI.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,36 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "HID.h"
#endif

@ -0,0 +1,61 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassMassStorage
* @defgroup Group_USBClassMassStorageHost Mass Storage Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the Mass Storage USB Class driver.
*
* @{
*/
#ifndef __MS_CLASS_HOST_H__
#define __MS_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/MassStorage.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,36 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "StillImage.h"
#endif

@ -0,0 +1,61 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassStillImage
* @defgroup Group_USBClassStillImageHost Still Image Class Host Mode Driver
*
* \section Module Description
* Host Mode USB Class driver framework interface, for the Still Image USB Class driver.
*
* @{
*/
#ifndef __SI_CLASS_HOST_H__
#define __SI_CLASS_HOST_H__
/* Includes: */
#include "../../USB.h"
#include "../Common/StillImage.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Function Prototypes: */
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */

@ -0,0 +1,63 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassMIDI MIDI Device Class Driver - LUFA/Drivers/Class/MIDI.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MIDI.c
* - LUFA/Drivers/USB/Class/Host/MIDI.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB MIDI Class interfaces
* within a USB device. Note that the MIDI class is actually a special case of the regular Audio class,
* thus this module depends on structure definitions from the \ref Group_USBClassAudioDevice class driver module.
*
* @{
*/
#ifndef _MIDI_CLASS_H_
#define _MIDI_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/MIDI.h"
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/MIDI.h"
#endif
#endif
/** @} */

@ -0,0 +1,62 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassMS Mass Storage Device Class Driver - LUFA/Drivers/Class/MassStorage.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MassStorage.c
* - LUFA/Drivers/USB/Class/Host/MassStorage.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Mass Storage Class interfaces
* within a USB device.
*
* @{
*/
#ifndef _MS_CLASS_H_
#define _MS_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/MassStorage.h"
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/MassStorage.h"
#endif
#endif
/** @} */

@ -0,0 +1,57 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassRNDIS RNDIS Device Class Driver - LUFA/Drivers/Class/RNDIS.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/RNDIS.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB RNDIS Ethernet
* interfaces within a USB device.
*
* @{
*/
#ifndef _RNDIS_CLASS_H_
#define _RNDIS_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Device/RNDIS.h"
#endif
#endif
/** @} */

@ -0,0 +1,57 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2009.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassSI Still Image Device Class Driver - LUFA/Drivers/Class/StillImage.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Host/StillImage.c
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Still Image Class interfaces
* within a USB device.
*
* @{
*/
#ifndef _SI_CLASS_H_
#define _SI_CLASS_H_
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "Host/StillImage.h"
#endif
#endif
/** @} */

@ -67,20 +67,6 @@
* same class driver.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBDeviceClassDrivers Device Class Drivers
*
* Device mode drivers for the standard USB classes. These drivers all implement one of the standard USB
* classes, allowing for the class to be easily implemented in a user project.
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBHostClassDrivers Host Class Drivers
*
* Host mode drivers for the standard USB classes. These drivers all implement one of the standard USB
* classes, allowing for the class to be easily implemented in a user project.
*/
#ifndef __USB_H__
#define __USB_H__

@ -18,6 +18,19 @@ LUFA_SRC_FILES = ./Drivers/USB/LowLevel/DevChapter9.c \
./Drivers/USB/HighLevel/USBInterrupt.c \
./Drivers/USB/HighLevel/USBTask.c \
./Drivers/USB/HighLevel/ConfigDescriptor.c \
./Drivers/USB/Class/Device/Audio.c \
./Drivers/USB/Class/Device/CDC.c \
./Drivers/USB/Class/Device/HID.c \
./Drivers/USB/Class/Device/MIDI.c \
./Drivers/USB/Class/Device/MassStorage.c \
./Drivers/USB/Class/Device/RNDIS.c \
./Drivers/USB/Class/Host/Audio.c \
./Drivers/USB/Class/Host/CDC.c \
./Drivers/USB/Class/Host/HID.c \
./Drivers/USB/Class/Host/HIDParser.c \
./Drivers/USB/Class/Host/MIDI.c \
./Drivers/USB/Class/Host/MassStorage.c \
./Drivers/USB/Class/Host/StillImage.c \
./Drivers/Board/Temperature.c \
./Drivers/Peripheral/Serial.c \
./Drivers/Peripheral/SerialStream.c \

@ -41,7 +41,7 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -46,7 +46,7 @@ BitBuffer_t TrackDataBuffers[3];
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_HID_t Keyboard_HID_Interface =
USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
{
.InterfaceNumber = 0,
@ -157,7 +157,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
*
* \return Number of bytes in the created report
*/
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
static bool IsKeyReleaseReport;
static bool IsNewlineReport;
@ -204,7 +204,7 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
* \param ReportData Pointer to the report buffer where the received report is stored
* \param ReportSize Size in bytes of the report received from the host
*/
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports

@ -48,7 +48,7 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** HID keyboard keycode to indicate that the "1" key is currently pressed. */
@ -79,7 +79,8 @@
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID,
void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);

@ -137,6 +137,7 @@ SRC = $(TARGET).c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c \
$(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c \
# List C++ source files here. (C dependencies are automatically generated.)

Loading…
Cancel
Save