All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be seperately included.

All LowLevel demos changed to use the constants and types defined in the USB class drivers.
pull/1469/head
Dean Camera 14 years ago
parent 8f3bee7d86
commit b37d77eab3

@ -47,7 +47,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
#include "Descriptors.h"

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

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

@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
#include <avr/pgmspace.h>
@ -82,4 +81,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
@ -102,4 +101,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

@ -48,7 +48,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

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

@ -50,7 +50,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.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.

@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.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. */

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

@ -51,7 +51,6 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -40,7 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */

@ -44,7 +44,6 @@
#include <LUFA/Common/Common.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */

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

@ -51,7 +51,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -41,8 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */

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

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

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

@ -52,7 +52,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.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. */

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

@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <stdio.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include "EthernetProtocols.h"

@ -54,7 +54,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */

@ -50,7 +50,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.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,8 +40,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */

@ -50,8 +50,6 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.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. */

@ -185,7 +185,7 @@ void USB_Audio_Task(void)
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
AudioSample -= (SAMPLE_MAX_RANGE / 2);
#endif
#end if
#endif
/* Write the sample to the buffer */
Endpoint_Write_Word_LE(AudioSample);

@ -104,25 +104,25 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
sizeof(USB_Audio_InputTerminal_t) +
sizeof(USB_Audio_OutputTerminal_t)),
.TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
sizeof(USB_Audio_Descriptor_InputTerminal_t) +
sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
.InCollection = 1,
.InterfaceNumbers = {1},
.InterfaceNumber = 1,
},
.Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputTerminal,
.Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.TerminalID = 0x01,
.TerminalType = TERMINAL_IN_MIC,
.TerminalType = AUDIO_TERMINAL_IN_MIC,
.AssociatedOutputTerminal = 0x00,
.TotalChannels = 1,
@ -134,11 +134,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputTerminal,
.Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.TerminalID = 0x02,
.TerminalType = TERMINAL_STREAMING,
.TerminalType = AUDIO_TERMINAL_STREAMING,
.AssociatedInputTerminal = 0x00,
.SourceID = 0x01,
@ -180,8 +180,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.TerminalLink = 0x02,
@ -191,25 +191,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_Format,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x01,
.SubFrameSize = 0x02,
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
sizeof(Audio_SampleFreq_t)),
.SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.Audio_StreamEndpoint =
{
.Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM),
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
@ -223,10 +222,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
.Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
.LockDelayUnits = 0x00,
.LockDelay = 0x0000

@ -42,95 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */
#define DSUBTYPE_AudioHeader 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)
#define CHANNEL_RIGHT_FRONT (1 << 1)
#define CHANNEL_CENTER_FRONT (1 << 2)
#define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
#define CHANNEL_LEFT_SURROUND (1 << 4)
#define CHANNEL_RIGHT_SURROUND (1 << 5)
#define CHANNEL_LEFT_OF_CENTER (1 << 6)
#define CHANNEL_RIGHT_OF_CENTER (1 << 7)
#define CHANNEL_SURROUND (1 << 8)
#define CHANNEL_SIDE_LEFT (1 << 9)
#define CHANNEL_SIDE_RIGHT (1 << 10)
#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)
#define FEATURE_VOLUME (1 << 1)
#define FEATURE_BASS (1 << 2)
#define FEATURE_MID (1 << 3)
#define FEATURE_TREBLE (1 << 4)
#define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
#define FEATURE_AUTOMATIC_GAIN (1 << 6)
#define FEATURE_DELAY (1 << 7)
#define FEATURE_BASS_BOOST (1 << 8)
#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
#define TERMINAL_STREAMING 0x0101
#define TERMINAL_VENDOR 0x01FF
#define TERMINAL_IN_UNDEFINED 0x0200
#define TERMINAL_IN_MIC 0x0201
#define TERMINAL_IN_DESKTOP_MIC 0x0202
#define TERMINAL_IN_PERSONAL_MIC 0x0203
#define TERMINAL_IN_OMNIDIR_MIC 0x0204
#define TERMINAL_IN_MIC_ARRAY 0x0205
#define TERMINAL_IN_PROCESSING_MIC 0x0206
#define TERMINAL_IN_OUT_UNDEFINED 0x0300
#define TERMINAL_OUT_SPEAKER 0x0301
#define TERMINAL_OUT_HEADPHONES 0x0302
#define TERMINAL_OUT_HEAD_MOUNTED 0x0303
#define TERMINAL_OUT_DESKTOP 0x0304
#define TERMINAL_OUT_ROOM 0x0305
#define TERMINAL_OUT_COMMUNICATION 0x0306
#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[in] freq Required audio sampling frequency in HZ
*/
#define 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)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
@ -144,165 +55,23 @@
#define AUDIO_SAMPLE_FREQUENCY 48000
/* 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_Audio_Interface_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_Audio_FeatureUnit_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_Audio_InputTerminal_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_Audio_OutputTerminal_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_Audio_Interface_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 */
} Audio_SampleFreq_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 */
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_Audio_Format_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 synchronization information to, if needed (zero otherwise) */
} USB_Audio_StreamEndpoint_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_Audio_StreamEndpoint_Spc_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
USB_Audio_InputTerminal_t Audio_InputTerminal;
USB_Audio_OutputTerminal_t Audio_OutputTerminal;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
USB_Audio_Interface_AS_t Audio_StreamInterface_SPC;
USB_Audio_Format_t Audio_AudioFormat;
USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
USB_Audio_Descriptor_InputTerminal_t Audio_InputTerminal;
USB_Audio_Descriptor_OutputTerminal_t Audio_OutputTerminal;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
USB_Audio_Descriptor_Interface_AS_t Audio_StreamInterface_SPC;
USB_Audio_Descriptor_Format_t Audio_AudioFormat;
USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */

@ -104,29 +104,29 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
sizeof(USB_Audio_InputTerminal_t) +
sizeof(USB_Audio_OutputTerminal_t)),
.TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
sizeof(USB_Audio_Descriptor_InputTerminal_t) +
sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
.InCollection = 1,
.InterfaceNumbers = {1},
.InterfaceNumber = 1,
},
.Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputTerminal,
.Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.TerminalID = 0x01,
.TerminalType = TERMINAL_STREAMING,
.TerminalType = AUDIO_TERMINAL_STREAMING,
.AssociatedOutputTerminal = 0x00,
.TotalChannels = 2,
.ChannelConfig = (CHANNEL_LEFT_FRONT | CHANNEL_RIGHT_FRONT),
.ChannelConfig = (AUDIO_CHANNEL_LEFT_FRONT | AUDIO_CHANNEL_RIGHT_FRONT),
.ChannelStrIndex = NO_DESCRIPTOR,
.TerminalStrIndex = NO_DESCRIPTOR
@ -134,11 +134,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputTerminal,
.Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.TerminalID = 0x02,
.TerminalType = TERMINAL_OUT_SPEAKER,
.TerminalType = AUDIO_TERMINAL_OUT_SPEAKER,
.AssociatedInputTerminal = 0x00,
.SourceID = 0x01,
@ -180,8 +180,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.TerminalLink = 0x01,
@ -191,8 +191,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_Format,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x02,
@ -200,16 +200,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.SubFrameSize = 0x02,
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
sizeof(Audio_SampleFreq_t)),
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
.SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.Audio_StreamEndpoint =
{
.Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM),
.Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA),
@ -223,10 +222,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
.Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
.LockDelayUnits = 0x00,
.LockDelay = 0x0000

@ -42,95 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */
#define DSUBTYPE_AudioHeader 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)
#define CHANNEL_RIGHT_FRONT (1 << 1)
#define CHANNEL_CENTER_FRONT (1 << 2)
#define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
#define CHANNEL_LEFT_SURROUND (1 << 4)
#define CHANNEL_RIGHT_SURROUND (1 << 5)
#define CHANNEL_LEFT_OF_CENTER (1 << 6)
#define CHANNEL_RIGHT_OF_CENTER (1 << 7)
#define CHANNEL_SURROUND (1 << 8)
#define CHANNEL_SIDE_LEFT (1 << 9)
#define CHANNEL_SIDE_RIGHT (1 << 10)
#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)
#define FEATURE_VOLUME (1 << 1)
#define FEATURE_BASS (1 << 2)
#define FEATURE_MID (1 << 3)
#define FEATURE_TREBLE (1 << 4)
#define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
#define FEATURE_AUTOMATIC_GAIN (1 << 6)
#define FEATURE_DELAY (1 << 7)
#define FEATURE_BASS_BOOST (1 << 8)
#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
#define TERMINAL_STREAMING 0x0101
#define TERMINAL_VENDOR 0x01FF
#define TERMINAL_IN_UNDEFINED 0x0200
#define TERMINAL_IN_MIC 0x0201
#define TERMINAL_IN_DESKTOP_MIC 0x0202
#define TERMINAL_IN_PERSONAL_MIC 0x0203
#define TERMINAL_IN_OMNIDIR_MIC 0x0204
#define TERMINAL_IN_MIC_ARRAY 0x0205
#define TERMINAL_IN_PROCESSING_MIC 0x0206
#define TERMINAL_IN_OUT_UNDEFINED 0x0300
#define TERMINAL_OUT_SPEAKER 0x0301
#define TERMINAL_OUT_HEADPHONES 0x0302
#define TERMINAL_OUT_HEAD_MOUNTED 0x0303
#define TERMINAL_OUT_DESKTOP 0x0304
#define TERMINAL_OUT_ROOM 0x0305
#define TERMINAL_OUT_COMMUNICATION 0x0306
#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[in] freq Required audio sampling frequency in HZ
*/
#define 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)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
@ -144,165 +55,23 @@
#define AUDIO_SAMPLE_FREQUENCY 48000
/* 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_Audio_Interface_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_Audio_FeatureUnit_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_Audio_InputTerminal_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_Audio_OutputTerminal_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_Audio_Interface_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 */
} Audio_SampleFreq_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 */
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_Audio_Format_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 synchronization information to, if needed (zero otherwise) */
} USB_Audio_StreamEndpoint_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_Audio_StreamEndpoint_Spc_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
USB_Audio_InputTerminal_t Audio_InputTerminal;
USB_Audio_OutputTerminal_t Audio_OutputTerminal;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
USB_Audio_Interface_AS_t Audio_StreamInterface_SPC;
USB_Audio_Format_t Audio_AudioFormat;
USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
USB_Audio_Descriptor_InputTerminal_t Audio_InputTerminal;
USB_Audio_Descriptor_OutputTerminal_t Audio_OutputTerminal;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt0;
USB_Descriptor_Interface_t Audio_StreamInterface_Alt1;
USB_Audio_Descriptor_Interface_AS_t Audio_StreamInterface_SPC;
USB_Audio_Descriptor_Format_t Audio_AudioFormat;
USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */
@ -312,4 +81,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

@ -130,24 +130,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC1_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC1_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC1_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
@ -231,24 +231,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC2_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC2_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC2_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 2,
.SlaveInterfaceNumber = 3,

@ -42,23 +42,23 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPNUM 1
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPNUM 2
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 4
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPNUM 4
#define CDC2_TX_EPNUM 5
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPNUM 5
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 6
#define CDC2_RX_EPNUM 6
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8
@ -67,40 +67,6 @@
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
* contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
* See the CDC class 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 CDC class-specific descriptors. */
uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
* encoded in BCD format.
*/
} USB_Descriptor_CDC_FunctionalHeader_t;
/** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
* supports the CDC ACM subclass of the CDC specification. See the CDC class 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 CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class 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 CDC class-specific descriptors. */
uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
} USB_Descriptor_CDC_FunctionalUnion_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -110,18 +76,18 @@
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_Association_t CDC1_IAD;
USB_Descriptor_Interface_t CDC1_CCI_Interface;
USB_Descriptor_CDC_FunctionalHeader_t CDC1_Functional_Header;
USB_Descriptor_CDC_FunctionalACM_t CDC1_Functional_ACM;
USB_Descriptor_CDC_FunctionalUnion_t CDC1_Functional_Union;
USB_CDC_Descriptor_FunctionalHeader_t CDC1_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC1_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC1_Functional_Union;
USB_Descriptor_Endpoint_t CDC1_ManagementEndpoint;
USB_Descriptor_Interface_t CDC1_DCI_Interface;
USB_Descriptor_Endpoint_t CDC1_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC1_DataInEndpoint;
USB_Descriptor_Interface_Association_t CDC2_IAD;
USB_Descriptor_Interface_t CDC2_CCI_Interface;
USB_Descriptor_CDC_FunctionalHeader_t CDC2_Functional_Header;
USB_Descriptor_CDC_FunctionalACM_t CDC2_Functional_ACM;
USB_Descriptor_CDC_FunctionalUnion_t CDC2_Functional_Union;
USB_CDC_Descriptor_FunctionalHeader_t CDC2_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC2_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC2_Functional_Union;
USB_Descriptor_Endpoint_t CDC2_ManagementEndpoint;
USB_Descriptor_Interface_t CDC2_DCI_Interface;
USB_Descriptor_Endpoint_t CDC2_DataOutEndpoint;
@ -135,4 +101,3 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif

@ -44,10 +44,10 @@
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
CDC_Line_Coding_t LineEncoding1 = { .BaudRateBPS = 0,
.CharFormat = OneStopBit,
.ParityType = Parity_None,
.DataBits = 8 };
CDC_LineEncoding_t LineEncoding1 = { .BaudRateBPS = 0,
.CharFormat = CDC_LINEENCODING_OneStopBit,
.ParityType = CDC_PARITY_None,
.DataBits = 8 };
/** Contains the current baud rate and other settings of the second virtual serial port. While this demo does not use
* the physical USART and thus does not use these settings, they must still be retained and returned to the host
@ -57,10 +57,10 @@ CDC_Line_Coding_t LineEncoding1 = { .BaudRateBPS = 0,
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
CDC_Line_Coding_t LineEncoding2 = { .BaudRateBPS = 0,
.CharFormat = OneStopBit,
.ParityType = Parity_None,
.DataBits = 8 };
CDC_LineEncoding_t LineEncoding2 = { .BaudRateBPS = 0,
.CharFormat = CDC_LINEENCODING_OneStopBit,
.ParityType = CDC_PARITY_None,
.DataBits = 8 };
/** Main program entry point. This routine configures the hardware required by the application, then
@ -158,29 +158,29 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetLineEncoding:
case CDC_REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));
Endpoint_ClearOUT();
}
break;
case REQ_SetLineEncoding:
case CDC_REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));
Endpoint_ClearIN();
}
break;
case REQ_SetControlLineState:
case CDC_REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();

@ -51,15 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* 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
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -72,41 +63,6 @@
/** 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: */
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
* as set by the host via a class specific request.
*/
typedef 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 */
} CDC_Line_Coding_t;
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
OneStopBit = 0, /**< Each frame contains one stop bit */
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
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
{
Parity_None = 0, /**< No parity bit mode on each frame */
Parity_Odd = 1, /**< Odd parity bit mode on each frame */
Parity_Even = 2, /**< Even parity bit mode on each frame */
Parity_Mark = 3, /**< Mark parity bit mode on each frame */
Parity_Space = 4, /**< Space parity bit mode on each frame */
};
/* Function Prototypes: */
void CDC1_Task(void);
void CDC2_Task(void);

@ -130,12 +130,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_GenericHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(GenericReport)
},
@ -237,11 +237,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
case DTYPE_HID:
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case DTYPE_Report:
case HID_DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;

@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* 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;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
USB_Descriptor_HID_t HID_GenericHID;
USB_HID_Descriptor_HID_t HID_GenericHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
@ -87,12 +68,6 @@
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
/** 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
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -116,7 +116,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetReport:
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
uint8_t GenericData[GENERIC_REPORT_SIZE];
@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetReport:
case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
uint8_t GenericData[GENERIC_REPORT_SIZE];

@ -51,12 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class specific request to send the next HID report to the device. */
#define REQ_SetReport 0x09
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

@ -140,12 +140,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_JoystickHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(JoystickReport)
},
@ -239,7 +239,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
break;
case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_JoystickHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case DTYPE_Report:
Address = &JoystickReport;

@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* 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;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
USB_Descriptor_HID_t HID_JoystickHID;
USB_HID_Descriptor_HID_t HID_JoystickHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;

@ -112,7 +112,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetReport:
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_JoystickReport_Data_t JoystickReportData;

@ -52,9 +52,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

@ -147,12 +147,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_KeyboardHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
@ -254,11 +254,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
case DTYPE_HID:
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case DTYPE_Report:
case HID_DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;

@ -43,25 +43,6 @@
#include <avr/pgmspace.h>
/* 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;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -70,7 +51,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
USB_Descriptor_HID_t HID_KeyboardHID;
USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
@ -85,12 +66,6 @@
/** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8
/** 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
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -138,7 +138,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetReport:
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_KeyboardReport_Data_t KeyboardReportData;
@ -154,7 +154,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetReport:
case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -177,7 +177,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetProtocol:
case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -190,7 +190,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetProtocol:
case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -201,7 +201,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetIdle:
case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -212,7 +212,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetIdle:
case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -251,7 +251,7 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
memset(ReportData, 0, sizeof(USB_KeyboardReport_Data_t));
/* Make sent key uppercase by indicating that the left shift key is pressed */
ReportData->Modifier = KEYBOARD_MODIFER_LEFTSHIFT;
ReportData->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP)
ReportData->KeyCode[UsedKeyCodes++] = 0x04; // A
@ -278,13 +278,13 @@ void ProcessLEDReport(const uint8_t LEDReport)
{
uint8_t LEDMask = LEDS_LED2;
if (LEDReport & KEYBOARD_LED_NUMLOCK)
if (LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
if (LEDReport & KEYBOARD_LED_CAPSLOCK)
if (LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (LEDReport & KEYBOARD_LED_SCROLLLOCK)
if (LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
/* Set the status LEDs to the current Keyboard LED status */
@ -305,7 +305,7 @@ void SendNextReport(void)
SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
/* Check if the idle period is set and has elapsed */
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
if (IdleCount && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;

@ -54,63 +54,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */
/** Idle period indicating that reports should be sent only when the inputs have changed. */
#define HID_IDLE_CHANGESONLY 0
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class specific request to get the idle timeout period of the device. */
#define REQ_GetIdle 0x02
/** HID Class specific request to send the next HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class specific request to set the idle timeout period of the device. */
#define REQ_SetIdle 0x0A
/** HID Class specific request to get the current HID protocol in use, either report or boot. */
#define REQ_GetProtocol 0x03
/** HID Class specific request to set the current HID protocol in use, either report or boot. */
#define REQ_SetProtocol 0x0B
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTSHIFT (1 << 1)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTALT (1 << 2)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTGUI (1 << 3)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTCTRL (1 << 4)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTALT (1 << 6)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTGUI (1 << 7)
/** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
#define KEYBOARD_LED_NUMLOCK (1 << 0)
/** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
#define KEYBOARD_LED_CAPSLOCK (1 << 1)
/** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */
#define KEYBOARD_LED_SCROLLLOCK (1 << 2)
/** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
#define KEYBOARD_LED_KATANA (1 << 3)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -123,17 +66,6 @@
/** 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: */
/** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
*/
typedef struct
{
uint8_t Modifier; /**< Modifier mask byte, containing a mask of modifier keys set (such as shift or CTRL) */
uint8_t Reserved; /**< Reserved, always set as 0x00 */
uint8_t KeyCode[6]; /**< Array of up to six simultaneous key codes of pressed keys */
} USB_KeyboardReport_Data_t;
/* Function Prototypes: */
void SetupHardware(void);
void HID_Task(void);

@ -180,12 +180,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID1_KeyboardHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
@ -227,12 +227,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID2_MouseHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
@ -324,19 +324,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
case DTYPE_HID:
case HID_DTYPE_HID:
if (!(wIndex))
{
Address = &ConfigurationDescriptor.HID1_KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
}
else
{
Address = &ConfigurationDescriptor.HID2_MouseHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
}
break;
case DTYPE_Report:
case HID_DTYPE_Report:
if (!(wIndex))
{
Address = &KeyboardReport;

@ -43,25 +43,6 @@
#include <avr/pgmspace.h>
/* 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;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -70,11 +51,11 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID1_KeyboardInterface;
USB_Descriptor_HID_t HID1_KeyboardHID;
USB_HID_Descriptor_HID_t HID1_KeyboardHID;
USB_Descriptor_Endpoint_t HID1_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID1_ReportOUTEndpoint;
USB_Descriptor_Interface_t HID2_MouseInterface;
USB_Descriptor_HID_t HID2_MouseHID;
USB_HID_Descriptor_HID_t HID2_MouseHID;
USB_Descriptor_Endpoint_t HID2_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
@ -91,12 +72,6 @@
/** Size in bytes of each of the HID reporting IN and OUT endpoints. */
#define HID_EPSIZE 8
/** 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
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -129,7 +129,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetReport:
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -155,7 +155,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetReport:
case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -190,13 +190,13 @@ void Keyboard_ProcessLEDReport(const uint8_t LEDStatus)
{
uint8_t LEDMask = LEDS_LED2;
if (LEDStatus & KEYBOARD_LED_NUMLOCK)
if (LEDStatus & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
if (LEDStatus & KEYBOARD_LED_CAPSLOCK)
if (LEDStatus & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (LEDStatus & KEYBOARD_LED_SCROLLLOCK)
if (LEDStatus & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
/* Set the status LEDs to the current Keyboard LED status */
@ -219,7 +219,7 @@ void Keyboard_HID_Task(void)
if (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
/* Make sent key uppercase by indicating that the left shift key is pressed */
KeyboardReportData.Modifier = KEYBOARD_MODIFER_LEFTSHIFT;
KeyboardReportData.Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP)
KeyboardReportData.KeyCode[0] = 0x04; // A

@ -49,54 +49,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class specific request to send the next HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class specific request to get the current HID protocol in use, either report or boot. */
#define REQ_GetProtocol 0x03
/** HID Class specific request to set the current HID protocol in use, either report or boot. */
#define REQ_SetProtocol 0x0B
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTSHIFT (1 << 1)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTALT (1 << 2)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */
#define KEYBOARD_MODIFER_LEFTGUI (1 << 3)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTCTRL (1 << 4)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTALT (1 << 6)
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
#define KEYBOARD_MODIFER_RIGHTGUI (1 << 7)
/** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
#define KEYBOARD_LED_NUMLOCK (1 << 0)
/** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
#define KEYBOARD_LED_CAPSLOCK (1 << 1)
/** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */
#define KEYBOARD_LED_SCROLLLOCK (1 << 2)
/** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
#define KEYBOARD_LED_KATANA (1 << 3)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -109,27 +61,6 @@
/** 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: */
/** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
*/
typedef struct
{
uint8_t Modifier; /**< Modifier mask byte, containing a mask of modifier keys set (such as shift or CTRL) */
uint8_t Reserved; /**< Reserved, always set as 0x00 */
uint8_t KeyCode[6]; /**< Array of up to six simultaneous key codes of pressed keys */
} USB_KeyboardReport_Data_t;
/** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
*/
typedef struct
{
uint8_t Button; /**< Bit mask of the currently pressed mouse buttons */
int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
} USB_MouseReport_Data_t;
/* Function Prototypes: */
void SetupHardware(void);
void Keyboard_ProcessLEDReport(const uint8_t LEDStatus);

@ -104,14 +104,14 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
.AudioSpecification = VERSION_BCD(01.00),
.TotalLength = sizeof(USB_Audio_Interface_AC_t),
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = sizeof(USB_Audio_Descriptor_Interface_AC_t),
.InCollection = 1,
.InterfaceNumbers = {1},
.InterfaceNumber = 1,
},
.Audio_StreamInterface =
@ -132,8 +132,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_MIDI_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_AudioInterface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.AudioSpecification = VERSION_BCD(01.00),
@ -143,10 +143,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputJack,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.JackType = JACKTYPE_EMBEDDED,
.JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x01,
.JackStrIndex = NO_DESCRIPTOR
@ -154,10 +154,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputJack,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
.JackType = JACKTYPE_EXTERNAL,
.JackType = MIDI_JACKTYPE_External,
.JackID = 0x02,
.JackStrIndex = NO_DESCRIPTOR
@ -165,10 +165,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputJack,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.JackType = JACKTYPE_EMBEDDED,
.JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x03,
.NumberOfPins = 1,
@ -180,10 +180,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputJack,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
.JackType = JACKTYPE_EXTERNAL,
.JackType = MIDI_JACKTYPE_External,
.JackID = 0x04,
.NumberOfPins = 1,
@ -197,7 +197,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | MIDI_STREAM_OUT_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
@ -211,8 +211,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_In_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.TotalEmbeddedJacks = 0x01,
.AssociatedJackID = {0x01}
@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MIDI_STREAM_IN_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
@ -236,8 +236,8 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MIDI_Out_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
.Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
.TotalEmbeddedJacks = 0x01,
.AssociatedJackID = {0x03}

@ -42,24 +42,6 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific header descriptor. */
#define DSUBTYPE_AudioHeader 0x01
/** 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 subtype value for a general Audio class specific descriptor. */
#define DSUBTYPE_General 0x01
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
#define JACKTYPE_EMBEDDED 0x01
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define JACKTYPE_EXTERNAL 0x02
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 1
@ -70,110 +52,25 @@
#define MIDI_STREAM_EPSIZE 64
/* 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 AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific control 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_Audio_Interface_AC_t;
/** 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_Audio_Interface_MIDI_AS_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 synchronization information to, if needed (zero otherwise) */
} USB_Audio_StreamEndpoint_Std_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 the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Interface_AC_t Audio_ControlInterface_SPC;
USB_Descriptor_Interface_t Audio_StreamInterface;
USB_Audio_Interface_MIDI_AS_t Audio_StreamInterface_SPC;
USB_MIDI_In_Jack_t MIDI_In_Jack_Emb;
USB_MIDI_In_Jack_t MIDI_In_Jack_Ext;
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Emb;
USB_MIDI_Out_Jack_t MIDI_Out_Jack_Ext;
USB_Audio_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
USB_MIDI_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t Audio_ControlInterface;
USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
USB_Descriptor_Interface_t Audio_StreamInterface;
USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC;
USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb;
USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext;
USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb;
USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext;
USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
} USB_Descriptor_Configuration_t;
/* Function Prototypes: */

@ -160,7 +160,7 @@ void MIDI_Task(void)
/* Check if a MIDI command is to be sent */
if (MIDICommand)
{
USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
@ -187,7 +187,7 @@ void MIDI_Task(void)
/* Check if a MIDI command has been received */
if (Endpoint_IsOUTReceived())
{
USB_MIDI_EventPacket_t MIDIEvent;
MIDI_EventPacket_t MIDIEvent;
/* Read the MIDI event packet from the endpoint */
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));

@ -52,22 +52,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
/** MIDI command for a note on (activation) event. */
#define MIDI_COMMAND_NOTE_ON 0x90
/** MIDI command for a note off (deactivation) event. */
#define MIDI_COMMAND_NOTE_OFF 0x80
/** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
#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[in] channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) ((channel) - 1)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -80,18 +64,6 @@
/** 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: */
/** 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;
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Task(void);

@ -47,7 +47,6 @@
#include "MassStorage.h"
#include "Descriptors.h"
#include "DataflashManager.h"
#include "SCSI_Codes.h"
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
@ -109,7 +108,7 @@
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
} MS_SCSI_Inquiry_Response_t;
/** Type define for a SCSI sense structure to a SCSI REQUEST SENSE command. For details of the
* structure contents, refer to the SCSI specifications.
@ -133,7 +132,7 @@
uint8_t AdditionalSenseQualifier;
uint8_t FieldReplaceableUnitCode;
uint8_t SenseKeySpecific[3];
} SCSI_Request_Sense_Response_t;
} MS_SCSI_Request_Sense_Response_t;
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(void);

@ -1,87 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, 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.
*/
/** \file
*
* Header containing macros for possible SCSI commands and SENSE data. Refer to
* the SCSI standard documentation for more information on each SCSI command and
* the SENSE data.
*/
#ifndef _SCSI_CODES_H_
#define _SCSI_CODES_H_
/* Macros: */
#define SCSI_CMD_INQUIRY 0x12
#define SCSI_CMD_REQUEST_SENSE 0x03
#define SCSI_CMD_TEST_UNIT_READY 0x00
#define SCSI_CMD_READ_CAPACITY_10 0x25
#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D
#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
#define SCSI_CMD_WRITE_10 0x2A
#define SCSI_CMD_READ_10 0x28
#define SCSI_CMD_WRITE_6 0x0A
#define SCSI_CMD_READ_6 0x08
#define SCSI_CMD_VERIFY_10 0x2F
#define SCSI_CMD_MODE_SENSE_6 0x1A
#define SCSI_CMD_MODE_SENSE_10 0x5A
#define SCSI_SENSE_KEY_GOOD 0x00
#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01
#define SCSI_SENSE_KEY_NOT_READY 0x02
#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03
#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04
#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05
#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06
#define SCSI_SENSE_KEY_DATA_PROTECT 0x07
#define SCSI_SENSE_KEY_BLANK_CHECK 0x08
#define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09
#define SCSI_SENSE_KEY_COPY_ABORTED 0x0A
#define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B
#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define SCSI_SENSE_KEY_MISCOMPARE 0x0E
#define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00
#define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04
#define SCSI_ASENSE_INVALID_COMMAND 0x20
#define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21
#define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24
#define SCSI_ASENSE_WRITE_PROTECTED 0x27
#define SCSI_ASENSE_NOT_READY_TO_READY_CHANGE 0x28
#define SCSI_ASENSE_FORMAT_ERROR 0x31
#define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A
#define SCSI_ASENSEQ_NO_QUALIFIER 0x00
#define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01
#define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
#endif

@ -38,13 +38,13 @@
#include "MassStorage.h"
/** Structure to hold the latest Command Block Wrapper issued by the host, containing a SCSI command to execute. */
CommandBlockWrapper_t CommandBlock;
MS_CommandBlockWrapper_t CommandBlock;
/** Structure to hold the latest Command Status Wrapper to return to the host, containing the status of the last issued command. */
CommandStatusWrapper_t CommandStatus = { .Signature = CSW_SIGNATURE };
MS_CommandStatusWrapper_t CommandStatus = { .Signature = MS_CSW_SIGNATURE };
/** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */
volatile bool IsMassStoreReset = false;
volatile bool IsMassStoreReset = false;
/** Main program entry point. This routine configures the hardware required by the application, then
@ -129,7 +129,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process UFI specific control requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_MassStorageReset:
case MS_REQ_MassStorageReset:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -140,7 +140,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetMaxLUN:
case MS_REQ_GetMaxLUN:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -172,11 +172,11 @@ void MassStorage_Task(void)
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
/* Check direction of command, select Data IN endpoint if data is from the device */
if (CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)
if (CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
/* Decode the received SCSI command, set returned status code */
CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail;
CommandStatus.Status = SCSI_DecodeSCSICommand() ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
/* Load in the CBW tag into the CSW to link them together */
CommandStatus.Tag = CommandBlock.Tag;
@ -185,7 +185,7 @@ void MassStorage_Task(void)
CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;
/* Stall the selected data pipe if command failed (if data is still to be transferred) */
if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))
if ((CommandStatus.Status == MS_SCSI_COMMAND_Fail) && (CommandStatus.DataTransferResidue))
Endpoint_StallTransaction();
/* Return command status block to the host */
@ -237,11 +237,11 @@ static bool ReadInCommandBlock(void)
return false;
/* Verify the command block - abort if invalid */
if ((CommandBlock.Signature != CBW_SIGNATURE) ||
(CommandBlock.LUN >= TOTAL_LUNS) ||
(CommandBlock.Flags & 0x1F) ||
(CommandBlock.SCSICommandLength == 0) ||
(CommandBlock.SCSICommandLength > MAX_SCSI_COMMAND_LENGTH))
if ((CommandBlock.Signature != MS_CBW_SIGNATURE) ||
(CommandBlock.LUN >= TOTAL_LUNS) ||
(CommandBlock.Flags & 0x1F) ||
(CommandBlock.SCSICommandLength == 0) ||
(CommandBlock.SCSICommandLength > sizeof(CommandBlock.SCSICommandData)))
{
/* Stall both data pipes until reset by host */
Endpoint_StallTransaction();

@ -53,27 +53,6 @@
#include <LUFA/Drivers/Board/Dataflash.h>
/* 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
/** Maximum length of a SCSI command which can be issued by the device or host in a Mass Storage bulk wrapper. */
#define MAX_SCSI_COMMAND_LENGTH 16
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define CSW_SIGNATURE 0x53425355UL
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define COMMAND_DIRECTION_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 COMMAND_DIRECTION_DATA_IN (1 << 7)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -89,41 +68,10 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* 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[MAX_SCSI_COMMAND_LENGTH]; /**< 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
{
Command_Pass = 0, /**< Command completed with no error */
Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
/* Global Variables: */
extern CommandBlockWrapper_t CommandBlock;
extern CommandStatusWrapper_t CommandStatus;
extern volatile bool IsMassStoreReset;
extern MS_CommandBlockWrapper_t CommandBlock;
extern MS_CommandStatusWrapper_t CommandStatus;
extern volatile bool IsMassStoreReset;
/* Function Prototypes: */
void SetupHardware(void);

@ -140,12 +140,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HID_MouseHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
@ -237,11 +237,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
}
break;
case DTYPE_HID:
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
Size = sizeof(USB_Descriptor_HID_t);
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
case DTYPE_Report:
case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;

@ -42,25 +42,6 @@
#include <avr/pgmspace.h>
/* 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;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -69,7 +50,7 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t HID_Interface;
USB_Descriptor_HID_t HID_MouseHID;
USB_HID_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
@ -80,12 +61,6 @@
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/** 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
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,

@ -44,7 +44,7 @@ bool UsingReportProtocol = true;
/** Current Idle period. This is set by the host via a Set Idle HID class request to silence the device's reports
* for either the entire idle duration, or until the report status changes (e.g. the user moves the mouse).
*/
uint16_t IdleCount = HID_IDLE_CHANGESONLY;
uint16_t IdleCount = 0;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
* milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Handle HID Class specific requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetReport:
case HID_REQ_GetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_MouseReport_Data_t MouseReportData;
@ -154,7 +154,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetProtocol:
case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -167,7 +167,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetProtocol:
case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -178,7 +178,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_SetIdle:
case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -189,7 +189,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetIdle:
case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -261,7 +261,7 @@ void SendNextReport(void)
SendReport = true;
/* Check if the idle period is set and has elapsed */
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
if (IdleCount && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;

@ -53,27 +53,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
/* Macros: */
/** Idle period indicating that reports should be sent only when the inputs have changed */
#define HID_IDLE_CHANGESONLY 0
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class specific request to get the idle timeout period of the device. */
#define REQ_GetIdle 0x02
/** HID Class specific request to send the next HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class specific request to set the idle timeout period of the device. */
#define REQ_SetIdle 0x0A
/** HID Class specific request to get the current HID protocol in use, either report or boot. */
#define REQ_GetProtocol 0x03
/** HID Class specific request to set the current HID protocol in use, either report or boot. */
#define REQ_SetProtocol 0x0B
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -86,17 +65,6 @@
/** 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: */
/** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
*/
typedef struct
{
uint8_t Button; /**< Bit mask of the currently pressed mouse buttons */
int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
} USB_MouseReport_Data_t;
/* Function Prototypes: */
void SetupHardware(void);
void Mouse_Task(void);

@ -104,24 +104,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x00,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,

@ -58,40 +58,6 @@
#define CDC_NOTIFICATION_EPSIZE 8
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
* contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
* See the CDC class 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 CDC class-specific descriptors. */
uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
* encoded in BCD format.
*/
} USB_Descriptor_CDC_FunctionalHeader_t;
/** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
* supports the CDC ACM subclass of the CDC specification. See the CDC class 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 CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class 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 CDC class-specific descriptors. */
uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
} USB_Descriptor_CDC_FunctionalUnion_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -100,9 +66,9 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_Descriptor_CDC_FunctionalHeader_t CDC_Functional_Header;
USB_Descriptor_CDC_FunctionalACM_t CDC_Functional_ACM;
USB_Descriptor_CDC_FunctionalUnion_t CDC_Functional_Union;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;

@ -40,6 +40,8 @@
#include <avr/io.h>
#include <string.h>
#include <LUFA/Drivers/USB/USB.h>
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"

@ -81,14 +81,6 @@
#define NO_PROCESS -1
/* Type Defines: */
/** 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 an Ethernet frame header. */
typedef struct
{

@ -76,7 +76,7 @@
typedef struct
{
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
} MAC_Address_t;
} RNDIS_MAC_Address_t;
/** Type define for a protocol IP address of a device on a network. */
typedef struct

@ -264,7 +264,7 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
*ResponseSize = sizeof(uint32_t);
/* Always indicate hardware ready */
*((uint32_t*)ResponseData) = NdisHardwareStatusReady;
*((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
return true;
case OID_GEN_MEDIA_SUPPORTED:

@ -44,167 +44,6 @@
#include "RNDISConstants.h"
#include "Ethernet.h"
/* 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
/* 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
{
NdisHardwareStatusReady, /**< Hardware Ready to accept commands from the host */
NdisHardwareStatusInitializing, /**< Hardware busy initializing */
NdisHardwareStatusReset, /**< Hardware reset */
NdisHardwareStatusClosing, /**< Hardware currently closing */
NdisHardwareStatusNotReady /**< Hardware not ready to accept commands from the host */
};
/* Type Defines: */
/** 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 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_Message_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_Message_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_Complete_t;
/** Type define for a RNDIS Keep-alive command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
} RNDIS_KeepAlive_Message_t;
/** Type define for a RNDIS Keep-alive complete message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_KeepAlive_Complete_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_Complete_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_Message_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_Complete_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_Message_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_Complete_t;
/* External Variables: */
extern uint8_t RNDISMessageBuffer[];
extern RNDIS_Message_Header_t* MessageHeader;

@ -1,113 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, 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.
*/
/** \file
*
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
/* Macros: */
#define REMOTE_NDIS_PACKET_MSG 0x00000001UL
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL
#define REMOTE_NDIS_HALT_MSG 0x00000003UL
#define REMOTE_NDIS_QUERY_MSG 0x00000004UL
#define REMOTE_NDIS_SET_MSG 0x00000005UL
#define REMOTE_NDIS_RESET_MSG 0x00000006UL
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL
#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL
#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL
#define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
#define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL
#define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL
#define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL
#define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL
#define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL
#define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL
#define REMOTE_NDIS_PACKET_SMT 0x00000040UL
#define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
#define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
#define OID_GEN_MEDIA_IN_USE 0x00010104UL
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
#define OID_GEN_LINK_SPEED 0x00010107UL
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL
#define OID_GEN_VENDOR_ID 0x0001010CUL
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL
#define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL
#define OID_GEN_XMIT_OK 0x00020101UL
#define OID_GEN_RCV_OK 0x00020102UL
#define OID_GEN_XMIT_ERROR 0x00020103UL
#define OID_GEN_RCV_ERROR 0x00020104UL
#define OID_GEN_RCV_NO_BUFFER 0x00020105UL
#define OID_802_3_PERMANENT_ADDRESS 0x01010101UL
#define OID_802_3_CURRENT_ADDRESS 0x01010102UL
#define OID_802_3_MULTICAST_LIST 0x01010103UL
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif

@ -121,7 +121,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process RNDIS class commands */
switch (USB_ControlRequest.bRequest)
{
case REQ_SendEncapsulatedCommand:
case RNDIS_REQ_SendEncapsulatedCommand:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
break;
case REQ_GetEncapsulatedResponse:
case RNDIS_REQ_GetEncapsulatedResponse:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
/* Check if a response to the last message is ready */
@ -172,10 +172,10 @@ void RNDIS_Task(void)
/* Check if a message response is ready for the host */
if (Endpoint_IsINReady() && ResponseReady)
{
USB_Notification_t Notification = (USB_Notification_t)
USB_Request_Header_t Notification = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bNotification = NOTIF_RESPONSE_AVAILABLE,
.bRequest = RNDIS_NOTIF_ResponseAvailable,
.wValue = 0,
.wIndex = 0,
.wLength = 0,

@ -75,19 +75,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* Type Defines: */
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
* Endpoint.
*/
typedef struct
{
uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
uint16_t wValue; /**< Two byte notification value parameter */
uint16_t wIndex; /**< Two byte notification index parameter */
uint16_t wLength; /**< Size of data payload following the notification header */
} USB_Notification_t;
/* Function Prototypes: */
void SetupHardware(void);
void RNDIS_Task(void);

@ -116,24 +116,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
.CDCSpecification = VERSION_BCD(01.10),
},
.CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
.Capabilities = 0x06,
},
.CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,

@ -58,40 +58,6 @@
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
* contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
* See the CDC class 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 CDC class-specific descriptors. */
uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device,
* encoded in BCD format.
*/
} USB_Descriptor_CDC_FunctionalHeader_t;
/** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
* supports the CDC ACM subclass of the CDC specification. See the CDC class 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 CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class 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 CDC class-specific descriptors. */
uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
} USB_Descriptor_CDC_FunctionalUnion_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@ -100,9 +66,9 @@
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_Descriptor_CDC_FunctionalHeader_t CDC_Functional_Header;
USB_Descriptor_CDC_FunctionalACM_t CDC_Functional_ACM;
USB_Descriptor_CDC_FunctionalUnion_t CDC_Functional_Union;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;

@ -44,10 +44,10 @@
* It is possible to completely ignore these value or use other settings as the host is completely unaware of the physical
* serial link characteristics and instead sends and receives data in endpoint streams.
*/
CDC_Line_Coding_t LineEncoding = { .BaudRateBPS = 0,
.CharFormat = OneStopBit,
.ParityType = Parity_None,
.DataBits = 8 };
CDC_LineEncoding_t LineEncoding = { .BaudRateBPS = 0,
.CharFormat = CDC_LINEENCODING_OneStopBit,
.ParityType = CDC_PARITY_None,
.DataBits = 8 };
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
@ -131,29 +131,29 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest)
{
case REQ_GetLineEncoding:
case CDC_REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));
Endpoint_ClearOUT();
}
break;
case REQ_SetLineEncoding:
case CDC_REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
/* Read the line coding data in from the host into the global struct */
Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));
Endpoint_ClearIN();
}
break;
case REQ_SetControlLineState:
case CDC_REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
@ -180,29 +180,6 @@ void CDC_Task(void)
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
#if 0
/* NOTE: Here you can use the notification endpoint to send back line state changes to the host, for the special RS-232
* handshake signal lines (and some error states), via the CONTROL_LINE_IN_* masks and the following code:
*/
USB_Notification_Header_t Notification = (USB_Notification_Header_t)
{
.NotificationType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.Notification = NOTIF_SerialState,
.wValue = 0,
.wIndex = 0,
.wLength = sizeof(uint16_t),
};
uint16_t LineStateMask;
// Set LineStateMask here to a mask of CONTROL_LINE_IN_* masks to set the input handshake line states to send to the host
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));
Endpoint_ClearIN();
#endif
/* Determine if a joystick action has occurred */
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";

@ -51,66 +51,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
/* 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 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 CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
#define CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
#define CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
#define CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
#define CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the 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 CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the 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 CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the 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 CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -123,55 +63,6 @@
/** 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: */
/** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
* as set by the host via a class specific request.
*/
typedef 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 */
} CDC_Line_Coding_t;
/** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a
* change in the device state asynchronously.
*/
typedef struct
{
uint8_t NotificationType; /**< Notification type, a mask of REQDIR_*, REQTYPE_* and REQREC_* constants
* from the library StdRequestType.h header
*/
uint8_t Notification; /**< Notification value, a NOTIF_* constant */
uint16_t wValue; /**< Notification wValue, notification-specific */
uint16_t wIndex; /**< Notification wIndex, notification-specific */
uint16_t wLength; /**< Notification wLength, notification-specific */
} USB_Notification_Header_t;
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
OneStopBit = 0, /**< Each frame contains one stop bit */
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
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
{
Parity_None = 0, /**< No parity bit mode on each frame */
Parity_Odd = 1, /**< Odd parity bit mode on each frame */
Parity_Even = 2, /**< Even parity bit mode on each frame */
Parity_Mark = 3, /**< Mark parity bit mode on each frame */
Parity_Space = 4, /**< Space parity bit mode on each frame */
};
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Task(void);

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

@ -51,7 +51,6 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
#include "Descriptors.h"
#include "DeviceFunctions.h"

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -51,7 +51,6 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -50,7 +50,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

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

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

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

@ -49,7 +49,6 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

@ -212,7 +212,7 @@ void WriteNextReport(uint8_t* ReportOUTData,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetReport,
.bRequest = HID_REQ_SetReport,
.wValue = ((ReportType << 8) | ReportIndex),
.wIndex = 0,
.wLength = ReportLength,

@ -53,9 +53,6 @@
#include "ConfigDescriptor.h"
/* Macros: */
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1

@ -52,7 +52,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint16_t CurrConfigBytesRem;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
@ -95,7 +95,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
@ -178,7 +178,7 @@ uint8_t DComp_NextJoystickInterfaceDataEndpoint(void* CurrentDescriptor)
*/
uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
return DESCRIPTOR_SEARCH_NotFound;

@ -48,12 +48,6 @@
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define JOYSTICK_PROTOCOL 0x02
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1

@ -51,7 +51,7 @@ uint8_t GetHIDReportData(void)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
.bRequest = REQ_GetDescriptor,
.wValue = (DTYPE_Report << 8),
.wValue = (HID_DTYPE_Report << 8),
.wIndex = 0,
.wLength = HIDReportSize,
};

@ -38,25 +38,24 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
#include "JoystickHostWithParser.h"
/* Macros: */
/** HID Report Descriptor Usage for a Joystick. */
#define USAGE_JOYSTICK 0x04
/** HID Report Descriptor Usage Page value for a toggle button. */
#define USAGE_PAGE_BUTTON 0x09
/** HID Report Descriptor Usage Page value for a Generic Desktop Control. */
#define USAGE_PAGE_GENERIC_DCTRL 0x01
/** HID Report Descriptor Usage for a Joystick. */
#define USAGE_JOYSTICK 0x04
/** HID Report Descriptor Usage value for a X axis movement. */
#define USAGE_X 0x30
/** HID Report Descriptor Usage value for a Y axis movement. */
#define USAGE_Y 0x31
#define USAGE_Y 0x31
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
@ -67,21 +66,6 @@
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
uint16_t HIDReportLength; /**< Total size in bytes of the first HID report descriptor */
} USB_Descriptor_HID_t;
/* External Variables: */
extern uint16_t HIDReportSize;
extern HID_ReportInfo_t HIDReportInfo;

@ -65,7 +65,7 @@
/** 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)
/* Function Prototypes: */
void Joystick_HID_Task(void);
void SetupHardware(void);

@ -233,7 +233,7 @@ void Keyboard_HID_Task(void)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetProtocol,
.bRequest = HID_REQ_SetProtocol,
.wValue = 0,
.wIndex = 0,
.wLength = 0,

@ -53,9 +53,6 @@
#include "ConfigDescriptor.h"
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -68,15 +65,6 @@
/** 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: */
/** Type define for a standard Boot Protocol Keyboard report. */
typedef struct
{
uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (such as Shift, Control, etc.) */
uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */
uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys */
} USB_KeyboardReport_Data_t;
/* Function Prototypes: */
void Keyboard_HID_Task(void);
void SetupHardware(void);

@ -178,7 +178,7 @@ uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor)
*/
uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
return DESCRIPTOR_SEARCH_Fail;

@ -48,12 +48,6 @@
/** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
#define KEYBOARD_PROTOCOL 0x01
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
/** Pipe number for the keyboard report data pipe. */
#define KEYBOARD_DATA_IN_PIPE 1

@ -38,14 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
#include "KeyboardHostWithParser.h"
/* Macros: */
/** HID Report Descriptor Usage Page value for a desktop keyboard. */
#define USAGE_PAGE_KEYBOARD 0x07
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
enum KeyboardHostWithParser_GetHIDReportDataCodes_t
@ -55,21 +50,6 @@
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
uint16_t HIDReportLength; /**< Total size in bytes of the first HID report descriptor */
} USB_Descriptor_HID_t;
/* External Variables: */
extern uint16_t HIDReportSize;
extern HID_ReportInfo_t HIDReportInfo;

@ -179,7 +179,7 @@ void MIDI_Host_Task(void)
if (Pipe_IsINReceived())
{
USB_MIDI_EventPacket_t MIDIEvent;
MIDI_EventPacket_t MIDIEvent;
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
@ -244,7 +244,7 @@ void MIDI_Host_Task(void)
/* Check if a MIDI command is to be sent */
if (MIDICommand)
{
USB_MIDI_EventPacket_t MIDIEvent = (USB_MIDI_EventPacket_t)
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),

@ -55,22 +55,6 @@
#include "ConfigDescriptor.h"
/* Macros: */
/** MIDI command for a note on (activation) event. */
#define MIDI_COMMAND_NOTE_ON 0x90
/** MIDI command for a note off (deactivation) event. */
#define MIDI_COMMAND_NOTE_OFF 0x80
/** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
#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[in] channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) (channel - 1)
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -83,18 +67,6 @@
/** 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: */
/** 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;
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Host_Task(void);

@ -63,7 +63,7 @@ static uint32_t MassStore_Tag = 1;
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlock,
static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
@ -80,7 +80,7 @@ static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlo
Pipe_Unfreeze();
/* Write the CBW command to the OUT pipe */
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(CommandBlockWrapper_t))) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Send the data in the OUT pipe to the attached device */
@ -182,7 +182,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSICommandBlock,
static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
@ -238,7 +238,7 @@ static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSIComman
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum, or MASS_STORE_SCSI_COMMAND_FAILED if the SCSI command fails
*/
static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICommandStatus)
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSICommandStatus)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
@ -251,7 +251,7 @@ static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICom
Pipe_Unfreeze();
/* Load in the CSW from the attached device */
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Clear the data ready for next reception */
@ -261,7 +261,7 @@ static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICom
Pipe_Freeze();
/* Check to see if command failed */
if (SCSICommandStatus->Status != Command_Pass)
if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
ErrorCode = MASS_STORE_SCSI_COMMAND_FAILED;
return ErrorCode;
@ -277,7 +277,7 @@ uint8_t MassStore_MassStorageReset(void)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_MassStorageReset,
.bRequest = MS_REQ_MassStorageReset,
.wValue = 0,
.wIndex = 0,
.wLength = 0,
@ -307,7 +307,7 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetMaxLUN,
.bRequest = MS_REQ_GetMaxLUN,
.wValue = 0,
.wIndex = 0,
.wLength = 1,
@ -345,7 +345,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue INQUIRY command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Inquiry_Response_t),
@ -363,7 +363,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, InquiryPtr)) != PIPE_RWSTREAM_NoError)
@ -396,7 +396,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue REQUEST SENSE command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Request_Sense_Response_t),
@ -414,7 +414,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, SensePtr)) != PIPE_RWSTREAM_NoError)
@ -453,7 +453,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to read in the given blocks from the device */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = ((uint32_t)Blocks * BlockSize),
@ -475,7 +475,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, BufferPtr)) != PIPE_RWSTREAM_NoError)
@ -514,7 +514,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to write the given blocks to the device */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = ((uint32_t)Blocks * BlockSize),
@ -536,7 +536,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, BufferPtr)) != PIPE_RWSTREAM_NoError)
@ -567,7 +567,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue TEST UNIT READY command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = 0,
@ -585,7 +585,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
@ -618,7 +618,7 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue READ CAPACITY command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Capacity_t),
@ -640,7 +640,7 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, CapacityPtr)) != PIPE_RWSTREAM_NoError)
@ -678,7 +678,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue PREVENT ALLOW MEDIUM REMOVAL command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
.Signature = CBW_SIGNATURE,
.DataTransferLength = 0,
@ -696,7 +696,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
}
};
CommandStatusWrapper_t SCSICommandStatus;
MS_CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
if ((ErrorCode = MassStore_SendCommand(&SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)

@ -40,151 +40,24 @@
#include <avr/io.h>
#include "MassStorageHost.h"
#include "SCSI_Codes.h"
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Class specific request to reset the Mass Storage interface of the attached device. */
#define REQ_MassStorageReset 0xFF
/** Class specific request to retrieve the maximum Logical Unit Number (LUN) index of the attached device. */
#define REQ_GetMaxLUN 0xFE
/** Command Block Wrapper signature byte, for verification of valid CBW blocks. */
#define CBW_SIGNATURE 0x43425355UL
/** Command Static Wrapper signature byte, for verification of valid CSW blocks. */
#define CSW_SIGNATURE 0x53425355UL
/** Data direction mask for the Flags field of a CBW, indicating Host-to-Device transfer direction. */
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
/** Data direction mask for the Flags field of a CBW, indicating Device-to-Host transfer direction. */
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
/** Additional error code for Mass Storage functions when a device returns a logical command failure. */
#define MASS_STORE_SCSI_COMMAND_FAILED 0xC0
/* Type Defines: */
/** Type define for a Mass Storage class Command Block Wrapper, used to wrap SCSI
* commands for transport over the USB bulk endpoints to the device.
*/
typedef struct
{
uint32_t Signature; /**< Command block signature, always equal to CBW_SIGNATURE */
uint32_t Tag; /**< Current CBW tag, to positively associate a CBW with a CSW (filled automatically) */
uint32_t DataTransferLength; /**< Length of data to transfer, following the CBW */
uint8_t Flags; /**< Block flags, equal to one of the COMMAND_DIRECTION_DATA_* macros */
uint8_t LUN; /**< Logical Unit Number the CBW is addressed to in the device */
uint8_t SCSICommandLength; /**< Length of the SCSI command in the CBW */
uint8_t SCSICommandData[16]; /**< SCSI command to issue to the device */
} CommandBlockWrapper_t;
/** Type define for a Mass Storage class Command Status Wrapper, used to wrap SCSI
* responses for transport over the USB bulk endpoints from the device.
*/
typedef struct
{
uint32_t Signature; /**< Command status signature, always equal to CSW_SIGNATURE */
uint32_t Tag; /**< Current CBW tag, to positively associate a CBW with a CSW */
uint32_t DataTransferResidue; /**< Length of data not transferred */
uint8_t Status; /**< Command status, a value from the MassStorageHost_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
/** Type define for a SCSI Sense structure. Structures of this type are filled out by the
* device via the \ref MassStore_RequestSense() function, indicating the current sense data of the
* device (giving explicit error codes for the last issued command). For details of the
* structure contents, refer to the SCSI specifications.
*/
typedef struct
{
uint8_t ResponseCode;
uint8_t SegmentNumber;
unsigned char SenseKey : 4;
unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
uint8_t Information[4];
uint8_t AdditionalLength;
uint8_t CmdSpecificInformation[4];
uint8_t AdditionalSenseCode;
uint8_t AdditionalSenseQualifier;
uint8_t FieldReplaceableUnitCode;
uint8_t SenseKeySpecific[3];
} SCSI_Request_Sense_Response_t;
/** Type define for a SCSI Inquiry structure. Structures of this type are filled out by the
* device via the \ref MassStore_Inquiry() function, retrieving the attached device's information.
* For details of the structure contents, refer to the SCSI specifications.
*/
typedef struct
{
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
unsigned char Reserved : 7;
unsigned char Removable : 1;
uint8_t Version;
unsigned char ResponseDataFormat : 4;
unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
unsigned char TrmTsk : 1;
unsigned char AERC : 1;
uint8_t AdditionalLength;
uint8_t Reserved3[2];
unsigned char SoftReset : 1;
unsigned char CmdQue : 1;
unsigned char Reserved4 : 1;
unsigned char Linked : 1;
unsigned char Sync : 1;
unsigned char WideBus16Bit : 1;
unsigned char WideBus32Bit : 1;
unsigned char RelAddr : 1;
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
/** SCSI capacity structure, to hold the total capacity of the device in both the number
* of blocks in the current LUN, and the size of each block. This structure is filled by
* the device when the \ref MassStore_ReadCapacity() function is called.
*/
typedef struct
{
uint32_t Blocks; /**< Number of blocks in the addressed LUN of the device */
uint32_t BlockSize; /**< Number of bytes in each block in the addressed LUN */
} SCSI_Capacity_t;
/* Enums: */
/** CSW status return codes, indicating the overall status of the issued CBW. */
enum MassStorageHost_CommandStatusCodes_t
{
Command_Pass = 0, /**< Command completed successfully */
Command_Fail = 1, /**< Command failed to complete successfully */
Phase_Error = 2 /**< Phase error while processing the issued command */
};
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MASSSTORE_COMMANDS_C)
static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlock,
static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr);
static uint8_t MassStore_WaitForDataReceived(void);
static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSICommandBlock,
static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICommandStatus) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSICommandStatus) ATTR_NON_NULL_PTR_ARG(1);
#endif
uint8_t MassStore_MassStorageReset(void);

@ -1,87 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, 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.
*/
/** \file
*
* Header containing macros for possible SCSI commands and SENSE data. Refer to
* the SCSI standard documentation for more information on each SCSI command and
* the SENSE data.
*/
#ifndef _SCSI_CODES_H_
#define _SCSI_CODES_H_
/* Macros: */
#define SCSI_CMD_INQUIRY 0x12
#define SCSI_CMD_REQUEST_SENSE 0x03
#define SCSI_CMD_TEST_UNIT_READY 0x00
#define SCSI_CMD_READ_CAPACITY_10 0x25
#define SCSI_CMD_SEND_DIAGNOSTIC 0x1D
#define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
#define SCSI_CMD_WRITE_10 0x2A
#define SCSI_CMD_READ_10 0x28
#define SCSI_CMD_WRITE_6 0x0A
#define SCSI_CMD_READ_6 0x08
#define SCSI_CMD_VERIFY_10 0x2F
#define SCSI_CMD_MODE_SENSE_6 0x1A
#define SCSI_CMD_MODE_SENSE_10 0x5A
#define SCSI_SENSE_KEY_GOOD 0x00
#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01
#define SCSI_SENSE_KEY_NOT_READY 0x02
#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03
#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04
#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05
#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06
#define SCSI_SENSE_KEY_DATA_PROTECT 0x07
#define SCSI_SENSE_KEY_BLANK_CHECK 0x08
#define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09
#define SCSI_SENSE_KEY_COPY_ABORTED 0x0A
#define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B
#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define SCSI_SENSE_KEY_MISCOMPARE 0x0E
#define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00
#define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04
#define SCSI_ASENSE_INVALID_COMMAND 0x20
#define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21
#define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24
#define SCSI_ASENSE_WRITE_PROTECTED 0x27
#define SCSI_ASENSE_NOT_READY_TO_READY_CHANGE 0x28
#define SCSI_ASENSE_FORMAT_ERROR 0x31
#define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A
#define SCSI_ASENSEQ_NO_QUALIFIER 0x00
#define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01
#define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
#endif

@ -235,7 +235,7 @@ void Mouse_HID_Task(void)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetProtocol,
.bRequest = HID_REQ_SetProtocol,
.wValue = 0,
.wIndex = 0,
.wLength = 0,

@ -53,9 +53,6 @@
#include "ConfigDescriptor.h"
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@ -68,15 +65,6 @@
/** 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: */
/** Type define for a standard Boot Protocol Mouse report. */
typedef struct
{
uint8_t Button; /**< Button mask for currently pressed buttons in the mouse */
int8_t X; /**< Current delta X movement of the mouse */
int8_t Y; /**< Current delta Y movement on the mouse */
} USB_MouseReport_Data_t;
/* Function Prototypes: */
void Mouse_HID_Task(void);
void SetupHardware(void);

@ -52,7 +52,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint16_t CurrConfigBytesRem;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
@ -95,7 +95,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
@ -178,7 +178,7 @@ uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor)
*/
uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
return DESCRIPTOR_SEARCH_NotFound;

@ -48,12 +48,6 @@
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define MOUSE_PROTOCOL 0x02
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
/** Pipe number for the mouse report data pipe. */
#define MOUSE_DATA_IN_PIPE 1

@ -51,7 +51,7 @@ uint8_t GetHIDReportData(void)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
.bRequest = REQ_GetDescriptor,
.wValue = (DTYPE_Report << 8),
.wValue = (HID_DTYPE_Report << 8),
.wIndex = 0,
.wLength = HIDReportSize,
};

@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
#include "MouseHostWithParser.h"
@ -70,21 +69,6 @@
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
uint16_t HIDReportLength; /**< Total size in bytes of the first HID report descriptor */
} USB_Descriptor_HID_t;
/* External Variables: */
extern uint16_t HIDReportSize;
extern HID_ReportInfo_t HIDReportInfo;

@ -81,7 +81,7 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetDeviceID,
.bRequest = PRNT_REQ_GetDeviceID,
.wValue = 0,
.wIndex = PrinterInterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),
@ -128,7 +128,7 @@ uint8_t Printer_GetPortStatus(uint8_t* const PortStatus)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetPortStatus,
.bRequest = PRNT_REQ_GetPortStatus,
.wValue = 0,
.wIndex = PrinterInterfaceNumber,
.wLength = sizeof(uint8_t),
@ -149,7 +149,7 @@ uint8_t Printer_SoftReset(void)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SoftReset,
.bRequest = PRNT_REQ_SoftReset,
.wValue = 0,
.wIndex = PrinterInterfaceNumber,
.wLength = 0,

@ -44,16 +44,6 @@
#include "../PrinterHost.h"
/* Macros: */
/** Printer class-specific request to retrieve the printer's ID string. */
#define REQ_GetDeviceID 0
/** Printer class-specific request to retrieve the printer's virtual port status flags. */
#define REQ_GetPortStatus 1
/** Printer class-specific request to soft-reset the device. */
#define REQ_SoftReset 2
/* Function Prototypes: */
uint8_t Printer_SendData(const void* const PrinterCommands,
const uint16_t CommandSize);

@ -42,15 +42,6 @@
#include "RNDISEthernetHost.h"
/* Macros: */
/** Interface Class value for the CDC class. */
#define CDC_CONTROL_CLASS 0x02
/** Interface Class value for the CDC Communication Interface subclass. */
#define CDC_CONTROL_SUBCLASS 0x02
/** Interface Class value for the CDC RNDIS vendor specific protocol. */
#define CDC_CONTROL_PROTOCOL 0xFF
/** Interface Class value for the CDC data class. */
#define CDC_DATA_CLASS 0x0A

@ -53,7 +53,7 @@ uint8_t RNDIS_SendEncapsulatedCommand(void* const Buffer,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SendEncapsulatedCommand,
.bRequest = RNDIS_REQ_SendEncapsulatedCommand,
.wValue = 0,
.wIndex = 0,
.wLength = Length,
@ -78,7 +78,7 @@ uint8_t RNDIS_GetEncapsulatedResponse(void* const Buffer,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetEncapsulatedResponse,
.bRequest = RNDIS_REQ_GetEncapsulatedResponse,
.wValue = 0,
.wIndex = 0,
.wLength = Length,

@ -43,151 +43,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include "RNDISConstants.h"
#include "../RNDISEthernetHost.h"
/* Type Defines: */
/** 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 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_Message_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_Message_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_Complete_t;
/** Type define for a RNDIS Keep-alive command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
} RNDIS_KeepAlive_Message_t;
/** Type define for a RNDIS Keep-alive complete message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
} RNDIS_KeepAlive_Complete_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_Complete_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_Message_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_Complete_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_Message_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_Complete_t;
/* Macros: */
/** 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
/** Implemented RNDIS Version Major. */
#define REMOTE_NDIS_VERSION_MAJOR 0x01
/** Implemented RNDIS Version Minor. */
#define REMOTE_NDIS_VERSION_MINOR 0x00
/** Additional error code for RNDIS functions when a device returns a logical command failure. */
#define RNDIS_COMMAND_FAILED 0xC0

@ -1,113 +0,0 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, 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.
*/
/** \file
*
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
/* Macros: */
#define REMOTE_NDIS_PACKET_MSG 0x00000001UL
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL
#define REMOTE_NDIS_HALT_MSG 0x00000003UL
#define REMOTE_NDIS_QUERY_MSG 0x00000004UL
#define REMOTE_NDIS_SET_MSG 0x00000005UL
#define REMOTE_NDIS_RESET_MSG 0x00000006UL
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL
#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL
#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL
#define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
#define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL
#define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL
#define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL
#define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL
#define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL
#define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL
#define REMOTE_NDIS_PACKET_SMT 0x00000040UL
#define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
#define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
#define OID_GEN_MEDIA_IN_USE 0x00010104UL
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
#define OID_GEN_LINK_SPEED 0x00010107UL
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL
#define OID_GEN_VENDOR_ID 0x0001010CUL
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL
#define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL
#define OID_GEN_XMIT_OK 0x00020101UL
#define OID_GEN_RCV_OK 0x00020102UL
#define OID_GEN_XMIT_ERROR 0x00020103UL
#define OID_GEN_RCV_ERROR 0x00020104UL
#define OID_GEN_RCV_NO_BUFFER 0x00020105UL
#define OID_802_3_PERMANENT_ADDRESS 0x01010101UL
#define OID_802_3_CURRENT_ADDRESS 0x01010102UL
#define OID_802_3_MULTICAST_LIST 0x01010103UL
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif

@ -70,19 +70,6 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* Type Defines: */
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
* Endpoint.
*/
typedef struct
{
uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
uint16_t wValue; /**< Two byte notification value parameter */
uint16_t wIndex; /**< Two byte notification index parameter */
uint16_t wLength; /**< Size of data payload following the notification header */
} USB_Notification_t;
/* Function Prototypes: */
void SetupHardware(void);
void PrintIncomingPackets(void);

@ -41,12 +41,5 @@
#define PIMA_OPERATION_OPENSESSION 0x1002
#define PIMA_OPERATION_CLOSESESSION 0x1003
#define PIMA_RESPONSE_OK 0x2001
#define PIMA_RESPONSE_GENERALERROR 0x2002
#define PIMA_RESPONSE_SESSIONNOTOPEN 0x2003
#define PIMA_RESPONSE_INVALIDTRANSACTIONID 0x2004
#define PIMA_RESPONSE_OPERATIONNOTSUPPORTED 0x2005
#define PIMA_RESPONSE_PARAMETERNOTSUPPORTED 0x2006
#endif

@ -58,7 +58,7 @@ void SImage_SendBlockHeader(void)
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0));
/* If the block type is a command, send its parameters (if any) */
if (PIMA_SendBlock.Type == CType_CommandBlock)
if (PIMA_SendBlock.Type == PIMA_CONTAINER_CommandBlock)
{
/* Determine the size of the parameters in the block via the data length attribute */
uint8_t ParamBytes = (PIMA_SendBlock.DataLength - PIMA_COMMAND_SIZE(0));
@ -169,7 +169,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0));
/* Check if the returned block type is a response block */
if (PIMA_ReceivedBlock.Type == CType_ResponseBlock)
if (PIMA_ReceivedBlock.Type == PIMA_CONTAINER_ResponseBlock)
{
/* Determine the size of the parameters in the block via the data length attribute */
uint8_t ParamBytes = (PIMA_ReceivedBlock.DataLength - PIMA_COMMAND_SIZE(0));

@ -43,54 +43,9 @@
#include "../StillImageHost.h"
/* Macros: */
/** Length in bytes of a given Unicode string's character length.
*
* \param[in] chars Total number of Unicode characters in the string
*/
#define UNICODE_STRING_LENGTH(chars) ((chars) << 1)
/** Timeout period between the issuing of a command to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
*
* \param[in] params Number of parameters which are to be sent in the Param field of the container
*/
#define PIMA_COMMAND_SIZE(params) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + \
((params) * sizeof(PIMA_SendBlock.Params[0])))
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a data container.
*
* \param[in] datalen Length in bytes of the data in the container
*/
#define PIMA_DATA_SIZE(datalen) ((sizeof(PIMA_SendBlock) - sizeof(PIMA_SendBlock.Params)) + datalen)
/* Type Defines: */
/** Type define for a PIMA container, use to send commands and receive responses to and from an
* attached Still Image device.
*/
typedef struct
{
uint32_t DataLength; /**< Length of the container and data, in bytes */
uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */
uint16_t Code; /**< Command, event or response code of the container */
uint32_t TransactionID; /**< Unique container ID to link blocks together */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} PIMA_Container_t;
/* Enums: */
/** Enum for the possible PIMA contains types. */
enum PIMA_Container_Types_t
{
CType_Undefined = 0, /**< Undefined container type */
CType_CommandBlock = 1, /**< Command Block container type */
CType_DataBlock = 2, /**< Data Block container type */
CType_ResponseBlock = 3, /**< Response container type */
CType_EventBlock = 4, /**< Event Block container type */
};
/* External Variables: */
extern PIMA_Container_t PIMA_SendBlock;
extern PIMA_Container_t PIMA_ReceivedBlock;

@ -180,7 +180,7 @@ void StillImage_Task(void)
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(0),
.Type = CType_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = PIMA_OPERATION_GETDEVICEINFO,
.TransactionID = 0x00000000,
.Params = {},
@ -252,7 +252,7 @@ void StillImage_Task(void)
}
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
if ((PIMA_ReceivedBlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
@ -265,7 +265,7 @@ void StillImage_Task(void)
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = CType_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = PIMA_OPERATION_OPENSESSION,
.TransactionID = 0x00000000,
.Params = {0x00000001},
@ -284,7 +284,7 @@ void StillImage_Task(void)
}
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
if ((PIMA_ReceivedBlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
@ -297,7 +297,7 @@ void StillImage_Task(void)
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = CType_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = PIMA_OPERATION_CLOSESESSION,
.TransactionID = 0x00000001,
.Params = {0x00000001},
@ -316,7 +316,7 @@ void StillImage_Task(void)
}
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
if ((PIMA_ReceivedBlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);

@ -45,7 +45,6 @@
#include "ConfigDescriptor.h"
#include "Lib/PIMACodes.h"
#include "Lib/StillImageCommands.h"
#include <LUFA/Drivers/Misc/TerminalCodes.h>

File diff suppressed because one or more lines are too long

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassAudio Audio Class Driver - LUFA/Drivers/Class/Audio.h
* @defgroup Group_USBClassAudio Audio Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -59,16 +59,12 @@
#define _AUDIO_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_AUDIO_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_AUDIO_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/Audio.h"
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassCDC CDC-ACM (Virtual Serial) Class Driver - LUFA/Drivers/Class/CDC.h
* @defgroup Group_USBClassCDC CDC-ACM (Virtual Serial) Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -60,16 +60,12 @@
#define _CDC_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_CDC_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_CDC_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/CDC.h"
#endif

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB Audio 1.0 Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/Audio.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassAudio
@ -51,7 +51,7 @@
#define _AUDIO_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
@ -62,7 +62,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_AUDIO_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Audio.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB CDC Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/CDC.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassCDC
@ -51,7 +51,7 @@
#define _CDC_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
@ -62,7 +62,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */
@ -308,6 +308,21 @@
uint8_t bMasterInterface; /**< Interface number of the CDC Control interface. */
uint8_t bSlaveInterface0; /**< Interface number of the CDC Data interface. */
} USB_CDC_StdDescriptor_FunctionalUnion_t;
/** Type define for a CDC Line Encoding structure, used to hold the various encoding parameters for a virtual
* serial port.
*/
typedef 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
* \ref CDC_LineEncodingFormats_t enum.
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* \ref CDC_LineEncodingParity_t enum.
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} CDC_LineEncoding_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB HID Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/HID.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassHID
@ -51,13 +51,13 @@
#define _HID_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_HID_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB MIDI Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MIDI.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMIDI
@ -54,7 +54,7 @@
#define __INCLUDE_FROM_AUDIO_DRIVER
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include "Audio.h"
#include <string.h>
@ -66,7 +66,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB Mass Storage Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MassStorage.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMS
@ -51,7 +51,7 @@
#define _MS_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
@ -62,7 +62,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB Printer Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/Printer.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassPrinter
@ -51,7 +51,7 @@
#define _PRINTER_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
@ -62,7 +62,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */
@ -75,6 +75,22 @@
/** Port status mask for a printer device, indicating that the device is currently out of paper. */
#define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5)
/* Enums: */
/** Enum for the Printer class specific control requests that can be issued by the USB bus host. */
enum PRNT_ClassRequests_t
{
PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID
* string of the device, containing the device's name, manufacturer
* and supported printer languages.
*/
PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the
* virtual printer port, for device selection and ready states.
*/
PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new
* printer commands.
*/
};
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB RNDIS Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassRNDIS
@ -54,7 +54,7 @@
#define __INCLUDE_FROM_CDC_DRIVER
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include "RNDISConstants.h"
#include "CDC.h"
@ -67,7 +67,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */

@ -33,8 +33,8 @@
*
* Common RNDIS class constant definitions.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/Audio.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \file

@ -33,8 +33,8 @@
*
* Common definitions and declarations for the library USB Still Image Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/StillImage.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassSI
@ -51,7 +51,7 @@
#define _SI_CLASS_COMMON_H_
/* Includes: */
#include "../../USB.h"
#include "../../HighLevel/StdDescriptors.h"
#include <string.h>
@ -62,7 +62,7 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_SI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */
@ -79,42 +79,42 @@
*
* \param[in] Params Number of parameters which are to be sent in the Param field of the container.
*/
#define PIMA_COMMAND_SIZE(Params) ((sizeof(SI_PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t)))
#define PIMA_COMMAND_SIZE(Params) ((sizeof(PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t)))
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a data container.
*
* \param[in] DataLen Length in bytes of the data in the container.
*/
#define PIMA_DATA_SIZE(DataLen) ((sizeof(SI_PIMA_Container_t) - 12) + (DataLen))
#define PIMA_DATA_SIZE(DataLen) ((sizeof(PIMA_Container_t) - 12) + (DataLen))
/* Enums: */
/** Enum for the possible PIMA contains types. */
enum SI_PIMA_Container_Types_t
enum PIMA_Container_Types_t
{
SI_PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */
SI_PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */
SI_PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */
SI_PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */
SI_PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */
PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */
PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */
PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */
PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */
PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */
};
/* Enums: */
/** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */
enum SI_PIMA_ResponseCodes_t
enum PIMA_ResponseCodes_t
{
SI_PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */
SI_PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the
PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */
PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the
* issued command.
*/
SI_PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open
PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open
* session before being issued.
*/
SI_PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */
SI_PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported
PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */
PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported
* by the attached device.
*/
SI_PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's
PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's
* parameters are not supported by the device.
*/
};
@ -128,11 +128,11 @@
typedef struct
{
uint32_t DataLength; /**< Length of the container and data, in bytes. */
uint16_t Type; /**< Container type, a value from the \ref SI_PIMA_Container_Types_t enum. */
uint16_t Type; /**< Container type, a value from the \ref PIMA_Container_Types_t enum. */
uint16_t Code; /**< Command, event or response code of the container. */
uint32_t TransactionID; /**< Unique container ID to link blocks together. */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */
} SI_PIMA_Container_t;
} PIMA_Container_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)

@ -33,6 +33,7 @@
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_AUDIO_DRIVER
#define __INCLUDE_FROM_AUDIO_DEVICE_C
#include "Audio.h"
void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB Audio 1.0 Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/Audio.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassAudio
@ -66,7 +66,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_AUDIO_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Audio.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_AUDIO_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_CDC_CLASS_DEVICE_C
#define __INCLUDE_FROM_CDC_DRIVER
#define __INCLUDE_FROM_CDC_DEVICE_C
#include "CDC.h"
void CDC_Device_Event_Stub(void)

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB CDC Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/CDC.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassCDC
@ -84,7 +84,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_CDC_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -128,19 +132,10 @@
*/
} ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and 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
* \ref CDC_LineEncodingFormats_t enum.
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* \ref CDC_LineEncodingParity_t enum.
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. This is generally
* only used if the virtual serial port data is to be reconstructed on a physical UART.
*/
CDC_LineEncoding_t LineEncoding; /** Line encoding used in the virtual serial port, for the device's information.
* This is generally only used if the virtual serial port data is to be
* reconstructed on a physical UART.
*/
} State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated.
*/
@ -318,7 +313,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_CDC_CLASS_DEVICE_C)
#if defined(__INCLUDE_FROM_CDC_DEVICE_C)
static int CDC_Device_putchar(char c,
FILE* Stream) ATTR_NON_NULL_PTR_ARG(2);
static int CDC_Device_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);

@ -33,6 +33,7 @@
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_HID_DRIVER
#define __INCLUDE_FROM_HID_DEVICE_C
#include "HID.h"
void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB HID Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/HID.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassHID
@ -66,9 +66,14 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_HID_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_HID_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief HID Class Device Mode Configuration and State Structure.

@ -33,6 +33,7 @@
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_MIDI_DRIVER
#define __INCLUDE_FROM_MIDI_DEVICE_C
#include "MIDI.h"
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB MIDI Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MIDI.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMIDI
@ -66,7 +66,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MIDI_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_MS_CLASS_DEVICE_C
#define __INCLUDE_FROM_MS_DRIVER
#define __INCLUDE_FROM_MASSSTORAGE_DEVICE_C
#include "MassStorage.h"
static volatile bool* CallbackIsResetSource;

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB Mass Storage Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MassStorage.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMS
@ -66,7 +66,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -154,7 +158,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_MS_CLASS_DEVICE_C)
#if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C)
static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define __INCLUDE_FROM_RNDIS_CLASS_DEVICE_C
#define __INCLUDE_FROM_RNDIS_DRIVER
#define __INCLUDE_FROM_RNDIS_DEVICE_C
#include "RNDIS.h"
static const uint32_t PROGMEM AdapterSupportedOIDList[] =

@ -33,8 +33,8 @@
*
* Device mode driver for the library USB RNDIS Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassRNDIS
@ -66,9 +66,14 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_RNDIS_DEVICE_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief RNDIS Class Device Mode Configuration and State Structure.
@ -151,7 +156,7 @@
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
#if defined(__INCLUDE_FROM_RNDIS_DEVICE_C)
static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1);
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassHID HID Class Driver - LUFA/Drivers/Class/HID.h
* @defgroup Group_USBClassHID HID Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -61,16 +61,12 @@
#define _HID_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_HID_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_HID_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/HID.h"
#endif

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_CDC_CLASS_HOST_C
#define __INCLUDE_FROM_CDC_DRIVER
#define __INCLUDE_FROM_CDC_HOST_C
#include "CDC.h"
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB CDC Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/CDC.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassCDC
@ -67,9 +67,13 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_CDC_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief CDC Class Host Mode Configuration and State Structure.
@ -116,21 +120,12 @@
*/
} ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and 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
* \ref CDC_LineEncodingFormats_t enum.
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* \ref CDC_LineEncodingParity_t enum.
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information. This is generally
* only used if the virtual serial port data is to be reconstructed on a physical UART. When set
* by the host application, the \ref CDC_Host_SetLineEncoding() function must be called to push
* the changes to the device.
*/
CDC_LineEncoding_t LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information.
* This is generally only used if the virtual serial port data is to be
* reconstructed on a physical UART. When set by the host application, the
* \ref CDC_Host_SetLineEncoding() function must be called to push the changes
* to the device.
*/
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
@ -320,7 +315,7 @@
#define CDC_DATA_PROTOCOL 0x00
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_CDC_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_CDC_HOST_C)
static int CDC_Host_putchar(char c,
FILE* Stream) ATTR_NON_NULL_PTR_ARG(2);
static int CDC_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_HID_CLASS_HOST_C
#define __INCLUDE_FROM_HID_DRIVER
#define __INCLUDE_FROM_HID_HOST_C
#include "HID.h"
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB HID Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/HID.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassHID
@ -66,9 +66,14 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_HID_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_HID_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some HID Host functions, indicating a logical (and not hardware) error. */
@ -296,7 +301,7 @@
#define HID_INTERFACE_CLASS 0x03
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_HID_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_HID_HOST_C)
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);

@ -32,6 +32,7 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_HID_DRIVER
#include "HIDParser.h"
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,

@ -58,10 +58,6 @@
#ifndef __HIDPARSER_H__
#define __HIDPARSER_H__
/* Macros: */
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_HID_DRIVER
/* Includes: */
#include <string.h>
#include <stdbool.h>

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_MIDI_CLASS_HOST_C
#define __INCLUDE_FROM_MIDI_DRIVER
#define __INCLUDE_FROM_MIDI_HOST_C
#include "MIDI.h"
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB MIDI Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MIDI.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMIDI
@ -64,7 +64,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MIDI_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -190,7 +194,7 @@
#define MIDI_STREAMING_PROTOCOL 0x00
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_MIDI_HOST_C)
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_MS_CLASS_HOST_C
#define __INCLUDE_FROM_MS_DRIVER
#define __INCLUDE_FROM_MASSSTORAGE_HOST_C
#include "MassStorage.h"
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
@ -309,7 +309,7 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_MassStorageReset,
.bRequest = MS_REQ_MassStorageReset,
.wValue = 0,
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
@ -328,7 +328,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetMaxLUN,
.bRequest = MS_REQ_GetMaxLUN,
.wValue = 0,
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
.wLength = 1,

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB Mass Storage Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/MassStorage.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassMS
@ -64,7 +64,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_MS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -313,9 +317,6 @@
#define MASS_STORE_SUBCLASS 0x06
#define MASS_STORE_PROTOCOL 0x50
#define REQ_MassStorageReset 0xFF
#define REQ_GetMaxLUN 0xFE
#define CBW_SIGNATURE 0x43425355UL
#define CSW_SIGNATURE 0x53425355UL
@ -325,7 +326,7 @@
#define COMMAND_DATA_TIMEOUT_MS 10000
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C)
static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_PRINTER_CLASS_HOST_C
#define __INCLUDE_FROM_PRINTER_DRIVER
#define __INCLUDE_FROM_PRINTER_HOST_C
#include "Printer.h"
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
@ -175,7 +175,7 @@ uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceIn
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetPortStatus,
.bRequest = PRNT_REQ_GetPortStatus,
.wValue = 0,
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
.wLength = sizeof(uint8_t),
@ -191,7 +191,7 @@ uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SoftReset,
.bRequest = PRNT_REQ_SoftReset,
.wValue = 0,
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
@ -345,7 +345,7 @@ uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetDeviceID,
.bRequest = PRNT_REQ_GetDeviceID,
.wValue = 0,
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB Printer Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/Printer.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassPrinter
@ -64,7 +64,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_PRINTER_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -265,12 +269,8 @@
#define PRINTER_SUBCLASS 0x01
#define PRINTER_PROTOCOL 0x02
#define REQ_GetDeviceID 0
#define REQ_GetPortStatus 1
#define REQ_SoftReset 2
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_PRINTER_HOST_C)
static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_RNDIS_CLASS_HOST_C
#define __INCLUDE_FROM_RNDIS_DRIVER
#define __INCLUDE_FROM_RNDIS_HOST_C
#include "RNDIS.h"
uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB RNDIS Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassRNDIS
@ -68,7 +68,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_RNDIS_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -267,7 +271,7 @@
#define RNDIS_DATA_PROTOCOL 0x00
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_RNDIS_HOST_C)
static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
void* Buffer,
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)

@ -32,8 +32,8 @@
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#define __INCLUDE_FROM_SI_CLASS_HOST_C
#define __INCLUDE_FROM_SI_DRIVER
#define __INCLUDE_FROM_STILLIMAGE_HOST_C
#include "StillImage.h"
uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
@ -163,7 +163,7 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
}
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader)
PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
@ -194,7 +194,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
}
uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader)
PIMA_Container_t* const PIMAHeader)
{
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
@ -243,7 +243,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock)
if (PIMAHeader->Type == PIMA_CONTAINER_ResponseBlock)
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
@ -316,7 +316,7 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
}
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader)
PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
@ -326,7 +326,7 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(SI_PIMA_Container_t), NO_STREAM_CALLBACK);
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NO_STREAM_CALLBACK);
Pipe_ClearIN();
Pipe_Freeze();
@ -344,10 +344,10 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
SIInterfaceInfo->State.TransactionID = 0;
SIInterfaceInfo->State.IsSessionOpen = false;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = SI_PIMA_CONTAINER_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = 0x1002,
.Params = {1},
};
@ -358,7 +358,7 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
SIInterfaceInfo->State.IsSessionOpen = true;
@ -373,10 +373,10 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
.Type = SI_PIMA_CONTAINER_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = 0x1003,
.Params = {1},
};
@ -389,7 +389,7 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
SIInterfaceInfo->State.IsSessionOpen = false;
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;
@ -405,10 +405,10 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(TotalParams),
.Type = SI_PIMA_CONTAINER_CommandBlock,
.Type = PIMA_CONTAINER_CommandBlock,
.Code = Operation,
};
@ -423,7 +423,7 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock;
PIMA_Container_t PIMABlock;
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
@ -431,7 +431,7 @@ uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;

@ -33,8 +33,8 @@
*
* Host mode driver for the library USB Still Image Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the class driver
* dispatch header located in LUFA/Drivers/USB/Class/StillImage.h.
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassSI
@ -64,7 +64,11 @@
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_SI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
#if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C) && defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
/* Public Interface - May be used in end-application: */
@ -184,7 +188,7 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
@ -199,7 +203,7 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
@ -256,7 +260,7 @@
* returned a logical command failure.
*/
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
@ -314,7 +318,7 @@
#define COMMAND_DATA_TIMEOUT_MS 10000
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_SI_CLASS_HOST_C)
#if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C)
static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassMIDI MIDI Class Driver - LUFA/Drivers/Class/MIDI.h
* @defgroup Group_USBClassMIDI MIDI Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -63,16 +63,12 @@
#define _MIDI_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_MIDI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_MIDI_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/MIDI.h"
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassMS Mass Storage Class Driver - LUFA/Drivers/Class/MassStorage.h
* @defgroup Group_USBClassMS Mass Storage Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -60,16 +60,12 @@
#define _MS_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_MS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_MS_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/MassStorage.h"
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassPrinter Printer Class Driver - LUFA/Drivers/Class/Printer.h
* @defgroup Group_USBClassPrinter Printer Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -61,16 +61,12 @@
#define _PRINTER_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_PRINTER_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_PRINTER_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/Printer.h"
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassRNDIS RNDIS (Networking) Class Driver - LUFA/Drivers/Class/RNDIS.h
* @defgroup Group_USBClassRNDIS RNDIS (Networking) Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -60,16 +60,12 @@
#define _RNDIS_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_RNDIS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_RNDIS_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_DEVICE)
#include "Device/RNDIS.h"
#endif

@ -38,7 +38,7 @@
*/
/** \ingroup Group_USBClassDrivers
* @defgroup Group_USBClassSI Still Image Class Driver - LUFA/Drivers/Class/StillImage.h
* @defgroup Group_USBClassSI Still Image Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
@ -59,16 +59,12 @@
#define _SI_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_SI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_SI_DRIVER
/* Includes: */
#include "../HighLevel/USBMode.h"
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
#if defined(USB_CAN_BE_HOST)
#include "Host/StillImage.h"
#endif

@ -394,6 +394,15 @@
#if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)
#include "LowLevel/OTG.h"
#endif
#include "Class/Audio.h"
#include "Class/CDC.h"
#include "Class/HID.h"
#include "Class/MassStorage.h"
#include "Class/MIDI.h"
#include "Class/Printer.h"
#include "Class/RNDIS.h"
#include "Class/StillImage.h"
#endif

@ -54,6 +54,9 @@
* - Moved the USB mode specifier constants into a new enum, so that they are semantically related to one another
* - Renamed ENDPOINT_DOUBLEBANK_SUPPORTED() to ENDPOINT_BANKS_SUPPORTED() and changed it to return the maximum number of supported banks for
* the given endpoint
* - Better algorithm to extract and convert the internal device serial number into a string descriptor (if present)
* - All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be seperately included
* - All LowLevel demos changed to use the constants and types defined in the USB class drivers
*
* <b>Fixed:</b>
* - Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist

@ -21,6 +21,9 @@
* specified, the controller will default to UID selection mode.
* - The USB mode specifier constants have been moved into a new enum and renamed. Existing projects should use the equivalent
* value in the new \ref USB_Modes_t enum.
* - All class driver headers are now included as part of the standard LUFA/Drivers/USB/USB.h master dispatch header, and should
* no longer be included seperately. Class driver module source files must still be added as a seperate module in the project's
* makefile if used.
*
* <b>Device Mode</b>
* - Endpoints MUST be allocated in ascending order to ensure that bank corruption does not occur. Ensure that your user application

@ -48,7 +48,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate TX activity. */

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

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

@ -44,7 +44,6 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Function Prototypes: */
#if defined(USB_CAN_BE_DEVICE)

@ -44,7 +44,6 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
/* External Variables: */
#if defined(USB_CAN_BE_HOST)

@ -43,7 +43,6 @@
#include "Descriptors.h"
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */

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

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

@ -49,7 +49,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Function Prototypes: */
void SetupHardware(void);

@ -41,7 +41,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
/* Macros: */
/** Total number of tracks which can be read from the card, between 1 and 3. */

@ -283,7 +283,7 @@ void WriteNextReport(uint8_t* const ReportOUTData,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SetReport,
.bRequest = HID_REQ_SetReport,
.wValue = 0x02,
.wIndex = 0x01,
.wLength = ReportLength,

@ -54,23 +54,20 @@
#include "ConfigDescriptor.h"
/* Macros: */
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** 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)
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/** Size of the Launcher report command buffer. */
#define LAUNCHER_CMD_BUFFER_SIZE 64
#define LAUNCHER_CMD_BUFFER_SIZE 64
/* Function Prototypes: */
void SetupHardware(void);

@ -54,7 +54,7 @@
#define RELAY2 (1 << 6)
#define RELAY3 (1 << 5)
#define RELAY4 (1 << 4)
#define ALL_RELAYS (RELAY1|RELAY2|RELAY3|RELAY4)
#define ALL_RELAYS (RELAY1 | RELAY2 | RELAY3 | RELAY4)
/* Function Prototypes: */
void SetupHardware(void);

@ -13,8 +13,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/USB/Class/HID.h>
#include "TempDataLogger.h"

@ -44,7 +44,6 @@
#include <LUFA/Common/Common.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */

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

@ -55,8 +55,6 @@
#include <LUFA/Drivers/Board/Temperature.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.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. */

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

@ -50,7 +50,6 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/USB/USB.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,6 @@
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */

@ -43,7 +43,6 @@
#include <LUFA/Common/Common.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/Board/Dataflash.h>
/* Preprocessor Checks: */

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

@ -37,7 +37,7 @@
#define _UIP_MANAGEMENT_H_
/* Includes: */
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include <LUFA/Drivers/USB/USB.h>
#include <uip.h>
#include <uip_arp.h>

@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include "Webserver.h"
#include "Descriptors.h"

@ -38,7 +38,6 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include "Webserver.h"
#include "Lib/uIPManagement.h"

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

@ -52,7 +52,6 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.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. */

Loading…
Cancel
Save