diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-08 03:12:14 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-08 03:12:14 +0000 |
commit | 071e02c6b6b4837fa9cf0b6d4c749994e02638d7 (patch) | |
tree | 960446788703b69f0bb285450be80c5b3d8cc22c /LUFA/Drivers/USB/Class/Common | |
parent | e331b531c6e6d93eb0eee42b9002074e8090ad18 (diff) | |
download | lufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.tar.gz lufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.tar.bz2 lufa-071e02c6b6b4837fa9cf0b6d4c749994e02638d7.zip |
Add svn:eol-style property to source files, so that the line endings are correctly converted to the target system's native end of line style.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Common')
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/Audio.h | 812 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/CDC.h | 358 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/HID.h | 390 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/MIDI.h | 378 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/MassStorage.h | 636 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/Printer.h | 170 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/RNDIS.h | 606 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/RNDISConstants.h | 242 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/StillImage.h | 292 |
9 files changed, 1942 insertions, 1942 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/Audio.h b/LUFA/Drivers/USB/Class/Common/Audio.h index 512758866..7b9e9f5da 100644 --- a/LUFA/Drivers/USB/Class/Common/Audio.h +++ b/LUFA/Drivers/USB/Class/Common/Audio.h @@ -1,406 +1,406 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB Audio Class driver.
- *
- * Common definitions and declarations for the library USB Audio 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.
- */
-
-/** \ingroup Group_USBClassAudio
- * @defgroup Group_USBClassAudioCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * Audio Class.
- *
- * @{
- */
-
-#ifndef _AUDIO_CLASS_COMMON_H_
-#define _AUDIO_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_AUDIO_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/Audio.h instead.
- #endif
-
- /* Macros: */
- #if !defined(AUDIO_TOTAL_SAMPLE_RATES) || defined(__DOXYGEN__)
- /** Total number of discrete audio sample rates supported by the device. This value can be overridden by defining this
- * token in the project makefile to the desired value, and passing it to the compiler via the -D switch.
- */
- #define AUDIO_TOTAL_SAMPLE_RATES 1
- #endif
-
- /** Descriptor header constant to indicate a Audio class interface descriptor. */
- #define DTYPE_AudioInterface 0x24
-
- /** Descriptor header constant to indicate a Audio class endpoint descriptor. */
- #define DTYPE_AudioEndpoint 0x25
-
- /** Audio class descriptor subtype value for a Audio class specific header descriptor. */
- #define DSUBTYPE_Header 0x01
-
- /** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */
- #define DSUBTYPE_InputTerminal 0x02
-
- /** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */
- #define DSUBTYPE_OutputTerminal 0x03
-
- /** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */
- #define DSUBTYPE_FeatureUnit 0x06
-
- /** Audio class descriptor subtype value for a general Audio class specific descriptor. */
- #define DSUBTYPE_General 0x01
-
- /** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
- #define DSUBTYPE_Format 0x02
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_LEFT_FRONT (1 << 0)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_RIGHT_FRONT (1 << 1)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_CENTER_FRONT (1 << 2)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_LEFT_SURROUND (1 << 4)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_RIGHT_SURROUND (1 << 5)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_LEFT_OF_CENTER (1 << 6)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_RIGHT_OF_CENTER (1 << 7)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_SURROUND (1 << 8)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_SIDE_LEFT (1 << 9)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_SIDE_RIGHT (1 << 10)
-
- /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define CHANNEL_TOP (1 << 11)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_MUTE (1 << 0)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_VOLUME (1 << 1)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_BASS (1 << 2)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_MID (1 << 3)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_TREBLE (1 << 4)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_GRAPHIC_EQUALIZER (1 << 5)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_AUTOMATIC_GAIN (1 << 6)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_DELAY (1 << 7)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_BASS_BOOST (1 << 8)
-
- /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
- #define FEATURE_BASS_LOUDNESS (1 << 9)
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_UNDEFINED 0x0100
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_STREAMING 0x0101
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_VENDOR 0x01FF
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_UNDEFINED 0x0200
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_MIC 0x0201
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_DESKTOP_MIC 0x0202
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_PERSONAL_MIC 0x0203
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_OMNIDIR_MIC 0x0204
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_MIC_ARRAY 0x0205
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_PROCESSING_MIC 0x0206
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_IN_OUT_UNDEFINED 0x0300
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_SPEAKER 0x0301
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_HEADPHONES 0x0302
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_HEAD_MOUNTED 0x0303
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_DESKTOP 0x0304
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_ROOM 0x0305
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_COMMUNICATION 0x0306
-
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
- #define TERMINAL_OUT_LOWFREQ 0x0307
-
- /** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number.
- *
- * \param[in] freq Required audio sampling frequency in HZ
- */
- #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * accepts only filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7)
-
- /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
- * will accept partially filled endpoint packets of audio samples.
- */
- #define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
-
- /* Type Defines: */
- /** \brief Audio Class Specific Interface Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Feature Unit Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Input Terminal Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Output Terminal Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Streaming Audio Interface Descriptor.
- *
- * 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;
-
- /** \brief 24-Bit Audio Frequency Structure.
- *
- * 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 */
- } USB_Audio_SampleFreq_t;
-
- /** \brief Audio Class Specific Format Descriptor.
- *
- * 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 */
- USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device */
- } USB_Audio_Format_t;
-
- /** \brief Audio Class Specific Streaming Endpoint Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Extended Endpoint Descriptor.
- *
- * 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;
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB Audio Class driver. + * + * Common definitions and declarations for the library USB Audio 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. + */ + +/** \ingroup Group_USBClassAudio + * @defgroup Group_USBClassAudioCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Audio Class. + * + * @{ + */ + +#ifndef _AUDIO_CLASS_COMMON_H_ +#define _AUDIO_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/Audio.h instead. + #endif + + /* Macros: */ + #if !defined(AUDIO_TOTAL_SAMPLE_RATES) || defined(__DOXYGEN__) + /** Total number of discrete audio sample rates supported by the device. This value can be overridden by defining this + * token in the project makefile to the desired value, and passing it to the compiler via the -D switch. + */ + #define AUDIO_TOTAL_SAMPLE_RATES 1 + #endif + + /** Descriptor header constant to indicate a Audio class interface descriptor. */ + #define DTYPE_AudioInterface 0x24 + + /** Descriptor header constant to indicate a Audio class endpoint descriptor. */ + #define DTYPE_AudioEndpoint 0x25 + + /** Audio class descriptor subtype value for a Audio class specific header descriptor. */ + #define DSUBTYPE_Header 0x01 + + /** Audio class descriptor subtype value for an Output Terminal Audio class specific descriptor. */ + #define DSUBTYPE_InputTerminal 0x02 + + /** Audio class descriptor subtype value for an Input Terminal Audio class specific descriptor. */ + #define DSUBTYPE_OutputTerminal 0x03 + + /** Audio class descriptor subtype value for a Feature Unit Audio class specific descriptor. */ + #define DSUBTYPE_FeatureUnit 0x06 + + /** Audio class descriptor subtype value for a general Audio class specific descriptor. */ + #define DSUBTYPE_General 0x01 + + /** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */ + #define DSUBTYPE_Format 0x02 + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_LEFT_FRONT (1 << 0) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_RIGHT_FRONT (1 << 1) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_CENTER_FRONT (1 << 2) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_LOW_FREQ_ENHANCE (1 << 3) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_LEFT_SURROUND (1 << 4) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_RIGHT_SURROUND (1 << 5) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_LEFT_OF_CENTER (1 << 6) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_RIGHT_OF_CENTER (1 << 7) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_SURROUND (1 << 8) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_SIDE_LEFT (1 << 9) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_SIDE_RIGHT (1 << 10) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define CHANNEL_TOP (1 << 11) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_MUTE (1 << 0) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_VOLUME (1 << 1) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_BASS (1 << 2) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_MID (1 << 3) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_TREBLE (1 << 4) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_GRAPHIC_EQUALIZER (1 << 5) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_AUTOMATIC_GAIN (1 << 6) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_DELAY (1 << 7) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_BASS_BOOST (1 << 8) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define FEATURE_BASS_LOUDNESS (1 << 9) + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_UNDEFINED 0x0100 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_STREAMING 0x0101 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_VENDOR 0x01FF + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_UNDEFINED 0x0200 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_MIC 0x0201 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_DESKTOP_MIC 0x0202 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_PERSONAL_MIC 0x0203 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_OMNIDIR_MIC 0x0204 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_MIC_ARRAY 0x0205 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_PROCESSING_MIC 0x0206 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_IN_OUT_UNDEFINED 0x0300 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_SPEAKER 0x0301 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_HEADPHONES 0x0302 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_HEAD_MOUNTED 0x0303 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_DESKTOP 0x0304 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_ROOM 0x0305 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_COMMUNICATION 0x0306 + + /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define TERMINAL_OUT_LOWFREQ 0x0307 + + /** Convenience macro, to fill a 24-bit AudioSampleFreq_t structure with the given sample rate as a 24-bit number. + * + * \param[in] freq Required audio sampling frequency in HZ + */ + #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)} + + /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint + * accepts only filled endpoint packets of audio samples. + */ + #define EP_ACCEPTS_ONLY_FULL_PACKETS (1 << 7) + + /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint + * will accept partially filled endpoint packets of audio samples. + */ + #define EP_ACCEPTS_SMALL_PACKETS (0 << 7) + + /* Type Defines: */ + /** \brief Audio Class Specific Interface Descriptor. + * + * 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; + + /** \brief Audio Class Specific Feature Unit Descriptor. + * + * 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; + + /** \brief Audio Class Specific Input Terminal Descriptor. + * + * 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; + + /** \brief Audio Class Specific Output Terminal Descriptor. + * + * 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; + + /** \brief Audio Class Specific Streaming Audio Interface Descriptor. + * + * 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; + + /** \brief 24-Bit Audio Frequency Structure. + * + * 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 */ + } USB_Audio_SampleFreq_t; + + /** \brief Audio Class Specific Format Descriptor. + * + * 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 */ + USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device */ + } USB_Audio_Format_t; + + /** \brief Audio Class Specific Streaming Endpoint Descriptor. + * + * 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; + + /** \brief Audio Class Specific Extended Endpoint Descriptor. + * + * 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; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/CDC.h b/LUFA/Drivers/USB/Class/Common/CDC.h index 9fb1202bc..b6ab82a81 100644 --- a/LUFA/Drivers/USB/Class/Common/CDC.h +++ b/LUFA/Drivers/USB/Class/Common/CDC.h @@ -1,179 +1,179 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB CDC Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassCDC
- * @defgroup Group_USBClassCDCCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * CDC Class.
- *
- * @{
- */
-
-#ifndef _CDC_CLASS_COMMON_H_
-#define _CDC_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_CDC_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
- #endif
-
- /* Macros: */
- /** CDC Class specific request to get the current virtual serial port configuration settings. */
- #define REQ_GetLineEncoding 0x21
-
- /** CDC Class specific request to set the current virtual serial port configuration settings. */
- #define REQ_SetLineEncoding 0x20
-
- /** CDC Class specific request to set the current virtual serial port handshake line states. */
- #define REQ_SetControlLineState 0x22
-
- /** CDC Class specific request to send a break to the receiver via the carrier channel. */
- #define REQ_SendBreak 0x23
-
- /** CDC Class specific request to send an encapsulated command to the device. */
- #define REQ_SendEncapsulatedCommand 0x00
-
- /** CDC Class specific request to retrieve an encapsulated command response from the device. */
- #define REQ_GetEncapsulatedResponse 0x01
-
- /** Notification type constant for a change in the virtual serial port handshake line states, for
- * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
- * notification endpoint.
- */
- #define NOTIF_SerialState 0x20
-
- /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
- * from the host, to indicate that the DTR line state should be high.
- */
- #define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
-
- /** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
- * from the host, to indicate that theRTS line state should be high.
- */
- #define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
-
- /** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the DCD line state is currently high.
- */
- #define CDC_CONTROL_LINE_IN_DCD (1 << 0)
-
- /** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the DSR line state is currently high.
- */
- #define CDC_CONTROL_LINE_IN_DSR (1 << 1)
-
- /** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the BREAK line state is currently high.
- */
- #define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
-
- /** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
- * from the device to the host, to indicate that the RING line state is currently high.
- */
- #define CDC_CONTROL_LINE_IN_RING (1 << 3)
-
- /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a framing error has occurred on the virtual serial port.
- */
- #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
-
- /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a parity error has occurred on the virtual serial port.
- */
- #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
-
- /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
- * to indicate that a data overrun error has occurred on the virtual serial port.
- */
- #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
-
- /** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
- * uniform structure but variable sized data payloads, thus cannot be represented accurately by
- * a single typedef struct. A macro is used instead so that functional descriptors can be created
- * easily by specifying the size of the payload. This allows sizeof() to work correctly.
- *
- * \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload
- */
- #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
- struct \
- { \
- USB_Descriptor_Header_t Header; \
- uint8_t SubType; \
- uint8_t Data[DataSize]; \
- }
-
- /* Enums: */
- /** Enum for the possible line encoding formats of a virtual serial port. */
- enum CDC_LineCodingFormats_t
- {
- CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */
- CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
- CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */
- };
-
- /** Enum for the possible line encoding parity settings of a virtual serial port. */
- enum CDC_LineCodingParity_t
- {
- CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
- CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */
- CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */
- CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */
- CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */
- };
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB CDC Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassCDC + * @defgroup Group_USBClassCDCCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * CDC Class. + * + * @{ + */ + +#ifndef _CDC_CLASS_COMMON_H_ +#define _CDC_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_CDC_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead. + #endif + + /* Macros: */ + /** CDC Class specific request to get the current virtual serial port configuration settings. */ + #define REQ_GetLineEncoding 0x21 + + /** CDC Class specific request to set the current virtual serial port configuration settings. */ + #define REQ_SetLineEncoding 0x20 + + /** CDC Class specific request to set the current virtual serial port handshake line states. */ + #define REQ_SetControlLineState 0x22 + + /** CDC Class specific request to send a break to the receiver via the carrier channel. */ + #define REQ_SendBreak 0x23 + + /** CDC Class specific request to send an encapsulated command to the device. */ + #define REQ_SendEncapsulatedCommand 0x00 + + /** CDC Class specific request to retrieve an encapsulated command response from the device. */ + #define REQ_GetEncapsulatedResponse 0x01 + + /** Notification type constant for a change in the virtual serial port handshake line states, for + * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC + * notification endpoint. + */ + #define NOTIF_SerialState 0x20 + + /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request + * from the host, to indicate that the DTR line state should be high. + */ + #define CDC_CONTROL_LINE_OUT_DTR (1 << 0) + + /** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request + * from the host, to indicate that theRTS line state should be high. + */ + #define CDC_CONTROL_LINE_OUT_RTS (1 << 1) + + /** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification + * from the device to the host, to indicate that the DCD line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_DCD (1 << 0) + + /** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification + * from the device to the host, to indicate that the DSR line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_DSR (1 << 1) + + /** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification + * from the device to the host, to indicate that the BREAK line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_BREAK (1 << 2) + + /** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification + * from the device to the host, to indicate that the RING line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_RING (1 << 3) + + /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, + * to indicate that a framing error has occurred on the virtual serial port. + */ + #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4) + + /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, + * to indicate that a parity error has occurred on the virtual serial port. + */ + #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5) + + /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host, + * to indicate that a data overrun error has occurred on the virtual serial port. + */ + #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6) + + /** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a + * uniform structure but variable sized data payloads, thus cannot be represented accurately by + * a single typedef struct. A macro is used instead so that functional descriptors can be created + * easily by specifying the size of the payload. This allows sizeof() to work correctly. + * + * \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload + */ + #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \ + struct \ + { \ + USB_Descriptor_Header_t Header; \ + uint8_t SubType; \ + uint8_t Data[DataSize]; \ + } + + /* Enums: */ + /** Enum for the possible line encoding formats of a virtual serial port. */ + enum CDC_LineCodingFormats_t + { + CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */ + CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */ + CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */ + }; + + /** Enum for the possible line encoding parity settings of a virtual serial port. */ + enum CDC_LineCodingParity_t + { + CDC_PARITY_None = 0, /**< No parity bit mode on each frame */ + CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */ + CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */ + CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */ + CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */ + }; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index 0c908c5b5..d7b6983b6 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -1,195 +1,195 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB HID Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassHID
- * @defgroup Group_USBClassHIDCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * HID Class.
- *
- * @{
- */
-
-#ifndef _HID_CLASS_COMMON_H_
-#define _HID_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.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.
- #endif
-
- /* Macros: */
- /** HID Class Specific Request to get the current HID report from the device. */
- #define REQ_GetReport 0x01
-
- /** HID Class Specific Request to get the current device idle count. */
- #define REQ_GetIdle 0x02
-
- /** HID Class Specific Request to set the current HID report to the device. */
- #define REQ_SetReport 0x09
-
- /** HID Class Specific Request to set the device's idle count. */
- #define REQ_SetIdle 0x0A
-
- /** HID Class Specific Request to get the current HID report protocol mode. */
- #define REQ_GetProtocol 0x03
-
- /** HID Class Specific Request to set the current HID report protocol mode. */
- #define REQ_SetProtocol 0x0B
-
- /** Descriptor header type value, to indicate a HID class HID descriptor. */
- #define DTYPE_HID 0x21
-
- /** Descriptor header type value, to indicate a HID class HID report descriptor. */
- #define DTYPE_Report 0x22
-
- /** Constant for the protocol value of a HID interface descriptor, indicating that the interface does not support
- * any HID class boot protocol (see HID Class Specification).
- */
- #define HID_NON_BOOT_PROTOCOL 0x00
-
- /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the
- * HID class Keyboard boot protocol (see HID Class Specification).
- */
- #define HID_BOOT_KEYBOARD_PROTOCOL 0x01
-
- /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the
- * HID class Mouse boot protocol (see HID Class Specification).
- */
- #define HID_BOOT_MOUSE_PROTOCOL 0x02
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_LEFTSHIFT (1 << 1)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_LEFTALT (1 << 2)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_LEFTGUI (1 << 3)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_RIGHTCTRL (1 << 4)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */
- #define HID_KEYBOARD_MODIFER_RIGHTALT (1 << 6)
-
- /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
- #define HID_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 HID_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 HID_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 HID_KEYBOARD_LED_SCROLLLOCK (1 << 2)
-
- /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
- #define HID_KEYBOARD_LED_KATANA (1 << 3)
-
- /* Type Defines: */
- /** Enum for the different types of HID reports. */
- enum HID_ReportItemTypes_t
- {
- REPORT_ITEM_TYPE_In = 0, /**< Indicates that the item is an IN report type. */
- REPORT_ITEM_TYPE_Out = 1, /**< Indicates that the item is an OUT report type. */
- REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */
- };
-
- /** \brief HID Class Specific HID Descriptor.
- *
- * 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_HID_Descriptor_t;
-
- /** \brief Standard HID Boot Protocol Mouse Report.
- *
- * 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;
-
- /** \brief Standard HID Boot Protocol Keyboard Report.
- *
- * Type define for a standard Boot Protocol Keyboard report
- */
- typedef struct
- {
- uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of
- * HID_KEYBOARD_MODIFER_* masks)
- */
- 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;
-
- /** Type define for the data type used to store HID report descriptor elements. */
- typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB HID Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassHID + * @defgroup Group_USBClassHIDCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * HID Class. + * + * @{ + */ + +#ifndef _HID_CLASS_COMMON_H_ +#define _HID_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.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. + #endif + + /* Macros: */ + /** HID Class Specific Request to get the current HID report from the device. */ + #define REQ_GetReport 0x01 + + /** HID Class Specific Request to get the current device idle count. */ + #define REQ_GetIdle 0x02 + + /** HID Class Specific Request to set the current HID report to the device. */ + #define REQ_SetReport 0x09 + + /** HID Class Specific Request to set the device's idle count. */ + #define REQ_SetIdle 0x0A + + /** HID Class Specific Request to get the current HID report protocol mode. */ + #define REQ_GetProtocol 0x03 + + /** HID Class Specific Request to set the current HID report protocol mode. */ + #define REQ_SetProtocol 0x0B + + /** Descriptor header type value, to indicate a HID class HID descriptor. */ + #define DTYPE_HID 0x21 + + /** Descriptor header type value, to indicate a HID class HID report descriptor. */ + #define DTYPE_Report 0x22 + + /** Constant for the protocol value of a HID interface descriptor, indicating that the interface does not support + * any HID class boot protocol (see HID Class Specification). + */ + #define HID_NON_BOOT_PROTOCOL 0x00 + + /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the + * HID class Keyboard boot protocol (see HID Class Specification). + */ + #define HID_BOOT_KEYBOARD_PROTOCOL 0x01 + + /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the + * HID class Mouse boot protocol (see HID Class Specification). + */ + #define HID_BOOT_MOUSE_PROTOCOL 0x02 + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_LEFTCTRL (1 << 0) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_LEFTSHIFT (1 << 1) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_LEFTALT (1 << 2) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_LEFTGUI (1 << 3) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_RIGHTCTRL (1 << 4) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_RIGHTSHIFT (1 << 5) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */ + #define HID_KEYBOARD_MODIFER_RIGHTALT (1 << 6) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */ + #define HID_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 HID_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 HID_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 HID_KEYBOARD_LED_SCROLLLOCK (1 << 2) + + /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */ + #define HID_KEYBOARD_LED_KATANA (1 << 3) + + /* Type Defines: */ + /** Enum for the different types of HID reports. */ + enum HID_ReportItemTypes_t + { + REPORT_ITEM_TYPE_In = 0, /**< Indicates that the item is an IN report type. */ + REPORT_ITEM_TYPE_Out = 1, /**< Indicates that the item is an OUT report type. */ + REPORT_ITEM_TYPE_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ + }; + + /** \brief HID Class Specific HID Descriptor. + * + * 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_HID_Descriptor_t; + + /** \brief Standard HID Boot Protocol Mouse Report. + * + * 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; + + /** \brief Standard HID Boot Protocol Keyboard Report. + * + * Type define for a standard Boot Protocol Keyboard report + */ + typedef struct + { + uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of + * HID_KEYBOARD_MODIFER_* masks) + */ + 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; + + /** Type define for the data type used to store HID report descriptor elements. */ + typedef uint8_t USB_Descriptor_HIDReport_Datatype_t; + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h index aa843827b..6910d50f1 100644 --- a/LUFA/Drivers/USB/Class/Common/MIDI.h +++ b/LUFA/Drivers/USB/Class/Common/MIDI.h @@ -1,189 +1,189 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB MIDI Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassMIDI
- * @defgroup Group_USBClassMIDICommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * MIDI Class.
- *
- * @{
- */
-
-#ifndef _MIDI_CLASS_COMMON_H_
-#define _MIDI_CLASS_COMMON_H_
-
- /* Macros: */
- #define __INCLUDE_FROM_AUDIO_DRIVER
-
- /* Includes: */
- #include "../../USB.h"
- #include "Audio.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_MIDI_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
- #endif
-
- /* Macros: */
- /** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
- #define DSUBTYPE_InputJack 0x02
-
- /** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */
- #define DSUBTYPE_OutputJack 0x03
-
- /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
- #define MIDI_JACKTYPE_EMBEDDED 0x01
-
- /** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
- #define MIDI_JACKTYPE_EXTERNAL 0x02
-
- /** MIDI command for a note on (activation) event */
- #define MIDI_COMMAND_NOTE_ON 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 */
- #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)
-
- /* Type Defines: */
- /** \brief MIDI Class Specific Streaming Interface Descriptor.
- *
- * 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_MIDI_AudioInterface_AS_t;
-
- /** \brief MIDI Class Specific Input Jack Descriptor.
- *
- * 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;
-
- /** \brief MIDI Class Specific Output Jack Descriptor.
- *
- * 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;
-
- /** \brief Audio Class Specific Jack Endpoint Descriptor.
- *
- * 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;
-
- /** \brief MIDI Class Driver Event Packet.
- *
- * 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; /**< Upper nibble of the 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 */
- } MIDI_EventPacket_t;
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB MIDI Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassMIDI + * @defgroup Group_USBClassMIDICommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * MIDI Class. + * + * @{ + */ + +#ifndef _MIDI_CLASS_COMMON_H_ +#define _MIDI_CLASS_COMMON_H_ + + /* Macros: */ + #define __INCLUDE_FROM_AUDIO_DRIVER + + /* Includes: */ + #include "../../USB.h" + #include "Audio.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MIDI_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead. + #endif + + /* Macros: */ + /** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */ + #define DSUBTYPE_InputJack 0x02 + + /** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */ + #define DSUBTYPE_OutputJack 0x03 + + /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ + #define MIDI_JACKTYPE_EMBEDDED 0x01 + + /** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */ + #define MIDI_JACKTYPE_EXTERNAL 0x02 + + /** MIDI command for a note on (activation) event */ + #define MIDI_COMMAND_NOTE_ON 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 */ + #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) + + /* Type Defines: */ + /** \brief MIDI Class Specific Streaming Interface Descriptor. + * + * 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_MIDI_AudioInterface_AS_t; + + /** \brief MIDI Class Specific Input Jack Descriptor. + * + * 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; + + /** \brief MIDI Class Specific Output Jack Descriptor. + * + * 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; + + /** \brief Audio Class Specific Jack Endpoint Descriptor. + * + * 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; + + /** \brief MIDI Class Driver Event Packet. + * + * 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; /**< Upper nibble of the 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 */ + } MIDI_EventPacket_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/MassStorage.h b/LUFA/Drivers/USB/Class/Common/MassStorage.h index b5e590ea3..bc56f2239 100644 --- a/LUFA/Drivers/USB/Class/Common/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Common/MassStorage.h @@ -1,318 +1,318 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB Mass Storage Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassMS
- * @defgroup Group_USBClassMSCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * Mass Storage Class.
- *
- * @{
- */
-
-#ifndef _MS_CLASS_COMMON_H_
-#define _MS_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_MS_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
- #endif
-
- /* Macros: */
- /** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
- #define REQ_MassStorageReset 0xFF
-
- /** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
- #define REQ_GetMaxLUN 0xFE
-
- /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define MS_CBW_SIGNATURE 0x43425355UL
-
- /** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define MS_CSW_SIGNATURE 0x53425355UL
-
- /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
- #define MS_COMMAND_DIR_DATA_OUT (0 << 7)
-
- /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
- #define MS_COMMAND_DIR_DATA_IN (1 << 7)
-
- /** SCSI Command Code for an INQUIRY command. */
- #define SCSI_CMD_INQUIRY 0x12
-
- /** SCSI Command Code for a REQUEST SENSE command. */
- #define SCSI_CMD_REQUEST_SENSE 0x03
-
- /** SCSI Command Code for a TEST UNIT READY command. */
- #define SCSI_CMD_TEST_UNIT_READY 0x00
-
- /** SCSI Command Code for a READ CAPACITY (10) command. */
- #define SCSI_CMD_READ_CAPACITY_10 0x25
-
- /** SCSI Command Code for a SEND DIAGNOSTIC command. */
- #define SCSI_CMD_SEND_DIAGNOSTIC 0x1D
-
- /** SCSI Command Code for a PREVENT ALLOW MEDIUM REMOVAL command. */
- #define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
-
- /** SCSI Command Code for a WRITE (10) command. */
- #define SCSI_CMD_WRITE_10 0x2A
-
- /** SCSI Command Code for a READ (10) command. */
- #define SCSI_CMD_READ_10 0x28
-
- /** SCSI Command Code for a WRITE (6) command. */
- #define SCSI_CMD_WRITE_6 0x0A
-
- /** SCSI Command Code for a READ (6) command. */
- #define SCSI_CMD_READ_6 0x08
-
- /** SCSI Command Code for a VERIFY (10) command. */
- #define SCSI_CMD_VERIFY_10 0x2F
-
- /** SCSI Command Code for a MODE SENSE (6) command. */
- #define SCSI_CMD_MODE_SENSE_6 0x1A
-
- /** SCSI Command Code for a MODE SENSE (10) command. */
- #define SCSI_CMD_MODE_SENSE_10 0x5A
-
- /** SCSI Sense Code to indicate no error has occurred. */
- #define SCSI_SENSE_KEY_GOOD 0x00
-
- /** SCSI Sense Code to indicate that the device has recovered from an error. */
- #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01
-
- /** SCSI Sense Code to indicate that the device is not ready for a new command. */
- #define SCSI_SENSE_KEY_NOT_READY 0x02
-
- /** SCSI Sense Code to indicate an error whilst accessing the medium. */
- #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03
-
- /** SCSI Sense Code to indicate a hardware has occurred. */
- #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04
-
- /** SCSI Sense Code to indicate that an illegal request has been issued. */
- #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05
-
- /** SCSI Sense Code to indicate that the unit requires attention from the host to indicate
- * a reset event, medium removal or other condition.
- */
- #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06
-
- /** SCSI Sense Code to indicate that a write attempt on a protected block has been made. */
- #define SCSI_SENSE_KEY_DATA_PROTECT 0x07
-
- /** SCSI Sense Code to indicate an error while trying to write to a write-once medium. */
- #define SCSI_SENSE_KEY_BLANK_CHECK 0x08
-
- /** SCSI Sense Code to indicate a vendor specific error has occurred. */
- #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09
-
- /** SCSI Sense Code to indicate that an EXTENDED COPY command has aborted due to an error. */
- #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A
-
- /** SCSI Sense Code to indicate that the device has aborted the issued command. */
- #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B
-
- /** SCSI Sense Code to indicate an attempt to write past the end of a partition has been made. */
- #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D
-
- /** SCSI Sense Code to indicate that the source data did not match the data read from the medium. */
- #define SCSI_SENSE_KEY_MISCOMPARE 0x0E
-
- /** SCSI Additional Sense Code to indicate no additional sense information is available. */
- #define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00
-
- /** SCSI Additional Sense Code to indicate that the logical unit (LUN) addressed is not ready. */
- #define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04
-
- /** SCSI Additional Sense Code to indicate an invalid field was encountered while processing the issued command. */
- #define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24
-
- /** SCSI Additional Sense Code to indicate that an attempt to write to a protected area was made. */
- #define SCSI_ASENSE_WRITE_PROTECTED 0x27
-
- /** SCSI Additional Sense Code to indicate an error whilst formatting the device medium. */
- #define SCSI_ASENSE_FORMAT_ERROR 0x31
-
- /** SCSI Additional Sense Code to indicate an invalid command was issued. */
- #define SCSI_ASENSE_INVALID_COMMAND 0x20
-
- /** SCSI Additional Sense Code to indicate a write to a block out outside of the medium's range was issued. */
- #define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21
-
- /** SCSI Additional Sense Code to indicate that no removable medium is inserted into the device. */
- #define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A
-
- /** SCSI Additional Sense Qualifier Code to indicate no additional sense qualifier information is available. */
- #define SCSI_ASENSEQ_NO_QUALIFIER 0x00
-
- /** SCSI Additional Sense Qualifier Code to indicate that a medium format command failed to complete. */
- #define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01
-
- /** SCSI Additional Sense Qualifier Code to indicate that an initializing command must be issued before the issued
- * command can be executed.
- */
- #define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02
-
- /** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */
- #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
-
- /* Type defines: */
- /** \brief Mass Storage Class Command Block Wrapper.
- *
- * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
- typedef struct
- {
- uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */
- uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
- uint32_t DataTransferLength; /** Length of the optional data portion of the issued command, in bytes */
- uint8_t Flags; /**< Command block flags, indicating command data direction */
- uint8_t LUN; /**< Logical Unit number this command is issued to */
- uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
- uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
- } MS_CommandBlockWrapper_t;
-
- /** \brief Mass Storage Class Command Status Wrapper.
- *
- * 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 */
- } MS_CommandStatusWrapper_t;
-
- /** \brief Mass Storage Class SCSI Sense Structure
- *
- * Type define for a SCSI Sense structure. Structures of this type are filled out by the
- * device via the 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 _RESERVED1 : 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;
-
- /** \brief Mass Storage Class SCSI Inquiry Structure.
- *
- * Type define for a SCSI Inquiry structure. Structures of this type are filled out by the
- * device via the 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 _RESERVED1 : 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;
-
- /* Enums: */
- /** Enum for the possible command status wrapper return status codes. */
- enum MassStorage_CommandStatusCodes_t
- {
- SCSI_Command_Pass = 0, /**< Command completed with no error */
- SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
- SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
- };
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB Mass Storage Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassMS + * @defgroup Group_USBClassMSCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Mass Storage Class. + * + * @{ + */ + +#ifndef _MS_CLASS_COMMON_H_ +#define _MS_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead. + #endif + + /* Macros: */ + /** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */ + #define REQ_MassStorageReset 0xFF + + /** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */ + #define REQ_GetMaxLUN 0xFE + + /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */ + #define MS_CBW_SIGNATURE 0x43425355UL + + /** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */ + #define MS_CSW_SIGNATURE 0x53425355UL + + /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */ + #define MS_COMMAND_DIR_DATA_OUT (0 << 7) + + /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */ + #define MS_COMMAND_DIR_DATA_IN (1 << 7) + + /** SCSI Command Code for an INQUIRY command. */ + #define SCSI_CMD_INQUIRY 0x12 + + /** SCSI Command Code for a REQUEST SENSE command. */ + #define SCSI_CMD_REQUEST_SENSE 0x03 + + /** SCSI Command Code for a TEST UNIT READY command. */ + #define SCSI_CMD_TEST_UNIT_READY 0x00 + + /** SCSI Command Code for a READ CAPACITY (10) command. */ + #define SCSI_CMD_READ_CAPACITY_10 0x25 + + /** SCSI Command Code for a SEND DIAGNOSTIC command. */ + #define SCSI_CMD_SEND_DIAGNOSTIC 0x1D + + /** SCSI Command Code for a PREVENT ALLOW MEDIUM REMOVAL command. */ + #define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E + + /** SCSI Command Code for a WRITE (10) command. */ + #define SCSI_CMD_WRITE_10 0x2A + + /** SCSI Command Code for a READ (10) command. */ + #define SCSI_CMD_READ_10 0x28 + + /** SCSI Command Code for a WRITE (6) command. */ + #define SCSI_CMD_WRITE_6 0x0A + + /** SCSI Command Code for a READ (6) command. */ + #define SCSI_CMD_READ_6 0x08 + + /** SCSI Command Code for a VERIFY (10) command. */ + #define SCSI_CMD_VERIFY_10 0x2F + + /** SCSI Command Code for a MODE SENSE (6) command. */ + #define SCSI_CMD_MODE_SENSE_6 0x1A + + /** SCSI Command Code for a MODE SENSE (10) command. */ + #define SCSI_CMD_MODE_SENSE_10 0x5A + + /** SCSI Sense Code to indicate no error has occurred. */ + #define SCSI_SENSE_KEY_GOOD 0x00 + + /** SCSI Sense Code to indicate that the device has recovered from an error. */ + #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 + + /** SCSI Sense Code to indicate that the device is not ready for a new command. */ + #define SCSI_SENSE_KEY_NOT_READY 0x02 + + /** SCSI Sense Code to indicate an error whilst accessing the medium. */ + #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 + + /** SCSI Sense Code to indicate a hardware has occurred. */ + #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 + + /** SCSI Sense Code to indicate that an illegal request has been issued. */ + #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 + + /** SCSI Sense Code to indicate that the unit requires attention from the host to indicate + * a reset event, medium removal or other condition. + */ + #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 + + /** SCSI Sense Code to indicate that a write attempt on a protected block has been made. */ + #define SCSI_SENSE_KEY_DATA_PROTECT 0x07 + + /** SCSI Sense Code to indicate an error while trying to write to a write-once medium. */ + #define SCSI_SENSE_KEY_BLANK_CHECK 0x08 + + /** SCSI Sense Code to indicate a vendor specific error has occurred. */ + #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09 + + /** SCSI Sense Code to indicate that an EXTENDED COPY command has aborted due to an error. */ + #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A + + /** SCSI Sense Code to indicate that the device has aborted the issued command. */ + #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B + + /** SCSI Sense Code to indicate an attempt to write past the end of a partition has been made. */ + #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D + + /** SCSI Sense Code to indicate that the source data did not match the data read from the medium. */ + #define SCSI_SENSE_KEY_MISCOMPARE 0x0E + + /** SCSI Additional Sense Code to indicate no additional sense information is available. */ + #define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00 + + /** SCSI Additional Sense Code to indicate that the logical unit (LUN) addressed is not ready. */ + #define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04 + + /** SCSI Additional Sense Code to indicate an invalid field was encountered while processing the issued command. */ + #define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24 + + /** SCSI Additional Sense Code to indicate that an attempt to write to a protected area was made. */ + #define SCSI_ASENSE_WRITE_PROTECTED 0x27 + + /** SCSI Additional Sense Code to indicate an error whilst formatting the device medium. */ + #define SCSI_ASENSE_FORMAT_ERROR 0x31 + + /** SCSI Additional Sense Code to indicate an invalid command was issued. */ + #define SCSI_ASENSE_INVALID_COMMAND 0x20 + + /** SCSI Additional Sense Code to indicate a write to a block out outside of the medium's range was issued. */ + #define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21 + + /** SCSI Additional Sense Code to indicate that no removable medium is inserted into the device. */ + #define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A + + /** SCSI Additional Sense Qualifier Code to indicate no additional sense qualifier information is available. */ + #define SCSI_ASENSEQ_NO_QUALIFIER 0x00 + + /** SCSI Additional Sense Qualifier Code to indicate that a medium format command failed to complete. */ + #define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01 + + /** SCSI Additional Sense Qualifier Code to indicate that an initializing command must be issued before the issued + * command can be executed. + */ + #define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02 + + /** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */ + #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07 + + /* Type defines: */ + /** \brief Mass Storage Class Command Block Wrapper. + * + * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */ + typedef struct + { + uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */ + uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */ + uint32_t DataTransferLength; /** Length of the optional data portion of the issued command, in bytes */ + uint8_t Flags; /**< Command block flags, indicating command data direction */ + uint8_t LUN; /**< Logical Unit number this command is issued to */ + uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */ + uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */ + } MS_CommandBlockWrapper_t; + + /** \brief Mass Storage Class Command Status Wrapper. + * + * 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 */ + } MS_CommandStatusWrapper_t; + + /** \brief Mass Storage Class SCSI Sense Structure + * + * Type define for a SCSI Sense structure. Structures of this type are filled out by the + * device via the 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 _RESERVED1 : 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; + + /** \brief Mass Storage Class SCSI Inquiry Structure. + * + * Type define for a SCSI Inquiry structure. Structures of this type are filled out by the + * device via the 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 _RESERVED1 : 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; + + /* Enums: */ + /** Enum for the possible command status wrapper return status codes. */ + enum MassStorage_CommandStatusCodes_t + { + SCSI_Command_Pass = 0, /**< Command completed with no error */ + SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */ + SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */ + }; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/Printer.h b/LUFA/Drivers/USB/Class/Common/Printer.h index eba7c3ad0..87cf67695 100644 --- a/LUFA/Drivers/USB/Class/Common/Printer.h +++ b/LUFA/Drivers/USB/Class/Common/Printer.h @@ -1,85 +1,85 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB Printer Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassMS
- * @defgroup Group_USBClassPrinterCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * Printer Class.
- *
- * @{
- */
-
-#ifndef _PRINTER_CLASS_COMMON_H_
-#define _PRINTER_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
- #endif
-
- /* Macros: */
- /** Port status mask for a printer device, indicating that an error has *not* occurred. */
- #define PRNT_PORTSTATUS_NOTERROR (1 << 3)
-
- /** Port status mask for a printer device, indicating that the device is currently selected. */
- #define PRNT_PORTSTATUS_SELECT (1 << 4)
-
- /** Port status mask for a printer device, indicating that the device is currently out of paper. */
- #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5)
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB Printer Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassMS + * @defgroup Group_USBClassPrinterCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Printer Class. + * + * @{ + */ + +#ifndef _PRINTER_CLASS_COMMON_H_ +#define _PRINTER_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead. + #endif + + /* Macros: */ + /** Port status mask for a printer device, indicating that an error has *not* occurred. */ + #define PRNT_PORTSTATUS_NOTERROR (1 << 3) + + /** Port status mask for a printer device, indicating that the device is currently selected. */ + #define PRNT_PORTSTATUS_SELECT (1 << 4) + + /** Port status mask for a printer device, indicating that the device is currently out of paper. */ + #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5) + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/RNDIS.h b/LUFA/Drivers/USB/Class/Common/RNDIS.h index 74e22bd56..ecbff5122 100644 --- a/LUFA/Drivers/USB/Class/Common/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Common/RNDIS.h @@ -1,303 +1,303 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB RNDIS Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassRNDIS
- * @defgroup Group_USBClassRNDISCommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * RNDIS Class.
- *
- * @{
- */
-
-#ifndef _RNDIS_CLASS_COMMON_H_
-#define _RNDIS_CLASS_COMMON_H_
-
- /* Macros: */
- #define __INCLUDE_FROM_CDC_DRIVER
-
- /* Includes: */
- #include "../../USB.h"
- #include "RNDISConstants.h"
- #include "CDC.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
- #endif
-
- /* Macros: */
- /** Implemented RNDIS Version Major */
- #define REMOTE_NDIS_VERSION_MAJOR 0x01
-
- /** Implemented RNDIS Version Minor */
- #define REMOTE_NDIS_VERSION_MINOR 0x00
-
- /** RNDIS request to issue a host-to-device NDIS command */
- #define REQ_SendEncapsulatedCommand 0x00
-
- /** RNDIS request to issue a device-to-host NDIS response */
- #define REQ_GetEncapsulatedResponse 0x01
-
- /** Maximum size in bytes of a RNDIS control message which can be sent or received */
- #define RNDIS_MESSAGE_BUFFER_SIZE 128
-
- /** Maximum size in bytes of an Ethernet frame according to the Ethernet standard */
- #define ETHERNET_FRAME_SIZE_MAX 1500
-
- /** Notification request value for a RNDIS Response Available notification */
- #define NOTIF_ResponseAvailable 1
-
- /* Enums: */
- /** Enum for the possible NDIS adapter states. */
- enum RNDIS_States_t
- {
- RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */
- RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */
- RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */
- };
-
- /** Enum for the NDIS hardware states */
- enum NDIS_Hardware_Status_t
- {
- NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host */
- NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing */
- NDIS_HardwareStatus_Reset, /**< Hardware reset */
- NDIS_HardwareStatus_Closing, /**< Hardware currently closing */
- NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host */
- };
-
- /* Type Defines: */
- /** \brief MAC Address Structure.
- *
- * Type define for a physical MAC address of a device on a network
- */
- typedef struct
- {
- uint8_t Octets[6]; /**< Individual bytes of a MAC address */
- } MAC_Address_t;
-
- /** \brief RNDIS Ethernet Frame Packet Information Structure.
- *
- * Type define for an Ethernet frame buffer data and information structure.
- */
- 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;
-
- /** \brief RNDIS Common Message Header Structure.
- *
- * 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;
-
- /** \brief RNDIS Message Structure.
- *
- * 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;
-
- /** \brief RNDIS Initialization Message Structure.
- *
- * 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;
-
- /** \brief RNDIS Initialize Complete Message Structure.
- *
- * 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;
-
- /** \brief RNDIS Keep Alive Message Structure.
- *
- * Type define for a RNDIS Keep Alive command message.
- */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- } RNDIS_KeepAlive_Message_t;
-
- /** \brief RNDIS Keep Alive Complete Message Structure.
- *
- * Type define for a RNDIS Keep Alive Complete response message.
- */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
- } RNDIS_KeepAlive_Complete_t;
-
- /** \brief RNDIS Reset Complete Message Structure.
- *
- * Type define for a RNDIS Reset Complete response message.
- */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t Status;
-
- uint32_t AddressingReset;
- } RNDIS_Reset_Complete_t;
-
- /** \brief RNDIS OID Property Set Message Structure.
- *
- * Type define for a RNDIS OID Property 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;
-
- /** \brief RNDIS OID Property Set Complete Message Structure.
- *
- * Type define for a RNDIS OID Property Set Complete response message.
- */
- typedef struct
- {
- uint32_t MessageType;
- uint32_t MessageLength;
- uint32_t RequestId;
- uint32_t Status;
- } RNDIS_Set_Complete_t;
-
- /** \brief RNDIS OID Property Query Message Structure.
- *
- * Type define for a RNDIS OID Property 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;
-
- /** \brief RNDIS OID Property Query Complete Message Structure.
- *
- * Type define for a RNDIS OID Property 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;
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB RNDIS Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassRNDIS + * @defgroup Group_USBClassRNDISCommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * RNDIS Class. + * + * @{ + */ + +#ifndef _RNDIS_CLASS_COMMON_H_ +#define _RNDIS_CLASS_COMMON_H_ + + /* Macros: */ + #define __INCLUDE_FROM_CDC_DRIVER + + /* Includes: */ + #include "../../USB.h" + #include "RNDISConstants.h" + #include "CDC.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead. + #endif + + /* Macros: */ + /** Implemented RNDIS Version Major */ + #define REMOTE_NDIS_VERSION_MAJOR 0x01 + + /** Implemented RNDIS Version Minor */ + #define REMOTE_NDIS_VERSION_MINOR 0x00 + + /** RNDIS request to issue a host-to-device NDIS command */ + #define REQ_SendEncapsulatedCommand 0x00 + + /** RNDIS request to issue a device-to-host NDIS response */ + #define REQ_GetEncapsulatedResponse 0x01 + + /** Maximum size in bytes of a RNDIS control message which can be sent or received */ + #define RNDIS_MESSAGE_BUFFER_SIZE 128 + + /** Maximum size in bytes of an Ethernet frame according to the Ethernet standard */ + #define ETHERNET_FRAME_SIZE_MAX 1500 + + /** Notification request value for a RNDIS Response Available notification */ + #define NOTIF_ResponseAvailable 1 + + /* Enums: */ + /** Enum for the possible NDIS adapter states. */ + enum RNDIS_States_t + { + RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized */ + RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers */ + RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */ + }; + + /** Enum for the NDIS hardware states */ + enum NDIS_Hardware_Status_t + { + NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host */ + NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing */ + NDIS_HardwareStatus_Reset, /**< Hardware reset */ + NDIS_HardwareStatus_Closing, /**< Hardware currently closing */ + NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host */ + }; + + /* Type Defines: */ + /** \brief MAC Address Structure. + * + * Type define for a physical MAC address of a device on a network + */ + typedef struct + { + uint8_t Octets[6]; /**< Individual bytes of a MAC address */ + } MAC_Address_t; + + /** \brief RNDIS Ethernet Frame Packet Information Structure. + * + * Type define for an Ethernet frame buffer data and information structure. + */ + 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; + + /** \brief RNDIS Common Message Header Structure. + * + * 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; + + /** \brief RNDIS Message Structure. + * + * 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; + + /** \brief RNDIS Initialization Message Structure. + * + * 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; + + /** \brief RNDIS Initialize Complete Message Structure. + * + * 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; + + /** \brief RNDIS Keep Alive Message Structure. + * + * Type define for a RNDIS Keep Alive command message. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + } RNDIS_KeepAlive_Message_t; + + /** \brief RNDIS Keep Alive Complete Message Structure. + * + * Type define for a RNDIS Keep Alive Complete response message. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + } RNDIS_KeepAlive_Complete_t; + + /** \brief RNDIS Reset Complete Message Structure. + * + * Type define for a RNDIS Reset Complete response message. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t Status; + + uint32_t AddressingReset; + } RNDIS_Reset_Complete_t; + + /** \brief RNDIS OID Property Set Message Structure. + * + * Type define for a RNDIS OID Property 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; + + /** \brief RNDIS OID Property Set Complete Message Structure. + * + * Type define for a RNDIS OID Property Set Complete response message. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + } RNDIS_Set_Complete_t; + + /** \brief RNDIS OID Property Query Message Structure. + * + * Type define for a RNDIS OID Property 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; + + /** \brief RNDIS OID Property Query Complete Message Structure. + * + * Type define for a RNDIS OID Property 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; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ diff --git a/LUFA/Drivers/USB/Class/Common/RNDISConstants.h b/LUFA/Drivers/USB/Class/Common/RNDISConstants.h index c940a034f..7cd80aba7 100644 --- a/LUFA/Drivers/USB/Class/Common/RNDISConstants.h +++ b/LUFA/Drivers/USB/Class/Common/RNDISConstants.h @@ -1,121 +1,121 @@ -/*
- 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
- * \brief Common RNDIS class constant definitions.
- *
- * 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.
- */
-
-/** \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
+/* + 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 + * \brief Common RNDIS class constant definitions. + * + * 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. + */ + +/** \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 diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h index 1648431d6..7be75067d 100644 --- a/LUFA/Drivers/USB/Class/Common/StillImage.h +++ b/LUFA/Drivers/USB/Class/Common/StillImage.h @@ -1,146 +1,146 @@ -/*
- 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
- * \brief Common definitions and declarations for the library USB Still Image Class driver.
- *
- * 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.
- */
-
-/** \ingroup Group_USBClassSI
- * @defgroup Group_USBClassSICommon Common Class Definitions
- *
- * \section Module Description
- * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
- * Still Image Class.
- *
- * @{
- */
-
-#ifndef _SI_CLASS_COMMON_H_
-#define _SI_CLASS_COMMON_H_
-
- /* Includes: */
- #include "../../USB.h"
-
- #include <string.h>
-
- /* Enable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- extern "C" {
- #endif
-
- /* Preprocessor Checks: */
- #if !defined(__INCLUDE_FROM_SI_DRIVER)
- #error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
- #endif
-
- /* Macros: */
- /** Length in bytes of a given Unicode string's character length
- *
- * \param[in] chars Total number of Unicode characters in the string
- *
- * \return Number of bytes of the given unicode string
- */
- #define UNICODE_STRING_LENGTH(chars) ((chars) << 1)
-
- /** 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(SI_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))
-
- /* Enums: */
- /** Enum for the possible PIMA contains types. */
- enum SI_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 */
- };
-
- /* 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
- {
- 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
- */
- PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open
- * session before being issued
- */
- 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
- */
- PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's
- * parameters are not supported by the device
- */
- };
-
- /* Type Defines: */
- /** \brief PIMA Still Image Device Command/Response Container.
- *
- * 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) */
- } SI_PIMA_Container_t;
-
- /* Disable C linkage for C++ Compilers: */
- #if defined(__cplusplus)
- }
- #endif
-
-#endif
-
-/** @} */
+/* + 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 + * \brief Common definitions and declarations for the library USB Still Image Class driver. + * + * 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. + */ + +/** \ingroup Group_USBClassSI + * @defgroup Group_USBClassSICommon Common Class Definitions + * + * \section Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Still Image Class. + * + * @{ + */ + +#ifndef _SI_CLASS_COMMON_H_ +#define _SI_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../USB.h" + + #include <string.h> + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_SI_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead. + #endif + + /* Macros: */ + /** Length in bytes of a given Unicode string's character length + * + * \param[in] chars Total number of Unicode characters in the string + * + * \return Number of bytes of the given unicode string + */ + #define UNICODE_STRING_LENGTH(chars) ((chars) << 1) + + /** 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(SI_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)) + + /* Enums: */ + /** Enum for the possible PIMA contains types. */ + enum SI_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 */ + }; + + /* 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 + { + 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 + */ + PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open + * session before being issued + */ + 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 + */ + PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's + * parameters are not supported by the device + */ + }; + + /* Type Defines: */ + /** \brief PIMA Still Image Device Command/Response Container. + * + * 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) */ + } SI_PIMA_Container_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ |