Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda
This commit is contained in:
parent
a8871c7fba
commit
5a4def7478
760 changed files with 12883 additions and 12164 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
*
|
||||
* \section Module Description
|
||||
* Audio Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for Device
|
||||
* USB mode only. User applications can use this class driver instead of implementing the Audio class manually via
|
||||
* USB mode only. User applications can use this class driver instead of implementing the Audio class manually via
|
||||
* the low-level LUFA APIs.
|
||||
*
|
||||
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
||||
#if defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
|
@ -72,7 +72,8 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "Device/Audio.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CDC_CLASS_H_
|
||||
#define _CDC_CLASS_H_
|
||||
|
||||
|
|
@ -73,11 +73,12 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "Device/CDC.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/CDC.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
*/
|
||||
#define AUDIO_TOTAL_SAMPLE_RATES 1
|
||||
#endif
|
||||
|
||||
|
||||
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_CHANNEL_LEFT_FRONT (1 << 0)
|
||||
|
||||
|
|
@ -139,58 +139,58 @@
|
|||
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9)
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_UNDEFINED 0x0100
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_STREAMING 0x0101
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_VENDOR 0x01FF
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_UNDEFINED 0x0200
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_MIC 0x0201
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_SPEAKER 0x0301
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_DESKTOP 0x0304
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_ROOM 0x0305
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306
|
||||
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
|
||||
#define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307
|
||||
|
||||
/** Convenience macro to fill a 24-bit \ref USB_Audio_SampleFreq_t structure with the given sample rate as a 24-bit number.
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
* \param[in] freq Required audio sampling frequency in HZ
|
||||
*/
|
||||
#define AUDIO_SAMPLE_FREQ(freq) {((uint32_t)freq & 0x00FFFF), (((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.
|
||||
*/
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
* will accept partially filled endpoint packets of audio samples.
|
||||
*/
|
||||
#define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7)
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Audio class specific interface description subtypes, for the Audio Control interface. */
|
||||
enum Audio_CSInterface_AC_SubTypes_t
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
{
|
||||
AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions).
|
||||
*
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal.
|
||||
*/
|
||||
|
||||
|
||||
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
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
*/
|
||||
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_Descriptor_InputTerminal_t;
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
*/
|
||||
uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
|
||||
uint16_t wChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */
|
||||
|
||||
|
||||
uint8_t iChannelNames; /**< Index of a string descriptor describing this channel within the device. */
|
||||
uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
|
||||
} USB_Audio_StdDescriptor_InputTerminal_t;
|
||||
|
|
@ -310,14 +310,14 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal.
|
||||
*/
|
||||
|
||||
|
||||
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_Descriptor_OutputTerminal_t;
|
||||
|
||||
|
|
@ -346,7 +346,7 @@
|
|||
* such as the speaker and microphone of a phone handset.
|
||||
*/
|
||||
uint8_t bSourceID; /**< ID value of the unit this terminal's audio is sourced from. */
|
||||
|
||||
|
||||
uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
|
||||
} USB_Audio_StdDescriptor_OutputTerminal_t;
|
||||
|
||||
|
|
@ -367,7 +367,7 @@
|
|||
|
||||
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 Streaming interfaces linked to this Audio Control interface (must be 1). */
|
||||
uint8_t InterfaceNumber; /**< Interface number of the associated Audio Streaming interface. */
|
||||
} USB_Audio_Descriptor_Interface_AC_t;
|
||||
|
|
@ -394,11 +394,11 @@
|
|||
|
||||
uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
|
||||
uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
|
||||
|
||||
|
||||
uint8_t bInCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */
|
||||
uint8_t bInterfaceNumbers; /**< Interface number of the associated Audio Streaming interface. */
|
||||
} USB_Audio_StdDescriptor_Interface_AC_t;
|
||||
|
||||
|
||||
/** \brief Audio class-specific Feature Unit Descriptor (LUFA naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features
|
||||
|
|
@ -413,13 +413,13 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* must be \ref AUDIO_DSUBTYPE_CSInterface_Feature.
|
||||
*/
|
||||
|
||||
|
||||
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_Descriptor_FeatureUnit_t;
|
||||
|
||||
|
|
@ -442,16 +442,16 @@
|
|||
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* must be \ref AUDIO_DSUBTYPE_CSInterface_Feature.
|
||||
*/
|
||||
|
||||
|
||||
uint8_t bUnitID; /**< ID value of this feature unit - must be a unique value within the device. */
|
||||
uint8_t bSourceID; /**< Source ID value of the audio source input into this feature unit. */
|
||||
|
||||
|
||||
uint8_t bControlSize; /**< Size of each element in the ChanelControlls array. */
|
||||
uint8_t bmaControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
|
||||
|
||||
|
||||
uint8_t iFeature; /**< Index of a string descriptor describing this descriptor within the device. */
|
||||
} USB_Audio_StdDescriptor_FeatureUnit_t;
|
||||
|
||||
|
||||
/** \brief Audio class-specific Streaming Audio Interface Descriptor (LUFA naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific streaming interface descriptor. This indicates to the host
|
||||
|
|
@ -465,9 +465,9 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* a value from the \ref Audio_CSInterface_AS_SubTypes_t enum.
|
||||
*/
|
||||
|
||||
|
||||
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_Descriptor_Interface_AS_t;
|
||||
|
|
@ -490,13 +490,13 @@
|
|||
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* a value from the \ref Audio_CSInterface_AS_SubTypes_t enum.
|
||||
*/
|
||||
|
||||
|
||||
uint8_t bTerminalLink; /**< ID value of the output terminal this descriptor is describing. */
|
||||
|
||||
|
||||
uint8_t bDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
|
||||
uint16_t wFormatTag; /**< Format of the audio stream, see Audio Device Formats specification. */
|
||||
} USB_Audio_StdDescriptor_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,
|
||||
|
|
@ -522,14 +522,14 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType.
|
||||
*/
|
||||
|
||||
|
||||
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. */
|
||||
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 (must be 24-bit). */
|
||||
} USB_Audio_Descriptor_Format_t;
|
||||
|
||||
|
|
@ -555,17 +555,17 @@
|
|||
|
||||
uint8_t bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
|
||||
uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */
|
||||
|
||||
|
||||
uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
|
||||
uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */
|
||||
|
||||
uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
|
||||
uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
|
||||
uint8_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES * 3]; /**< Sample frequencies supported by the device (must be 24-bit). */
|
||||
} USB_Audio_StdDescriptor_Format_t;
|
||||
|
||||
|
||||
/** \brief Audio class-specific Streaming Endpoint Descriptor (LUFA naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
|
||||
* 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.
|
||||
*
|
||||
* \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Std_t for the version of this type with standard element names.
|
||||
|
|
@ -580,7 +580,7 @@
|
|||
|
||||
/** \brief Audio class-specific Streaming Endpoint Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
|
||||
* 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.
|
||||
*
|
||||
* \see \ref USB_Audio_Descriptor_StreamEndpoint_Std_t for the version of this type with non-standard LUFA specific
|
||||
|
|
@ -592,10 +592,10 @@
|
|||
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a
|
||||
* value given by the specific class.
|
||||
*/
|
||||
uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
|
||||
uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
|
||||
* configuration, including direction mask.
|
||||
*/
|
||||
uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
|
||||
uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
|
||||
* and attributes (ENDPOINT_ATTR_*) masks.
|
||||
*/
|
||||
uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
|
||||
|
|
@ -604,7 +604,7 @@
|
|||
uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or
|
||||
* ISOCHRONOUS type.
|
||||
*/
|
||||
|
||||
|
||||
uint8_t bRefresh; /**< Always set to zero for Audio class devices. */
|
||||
uint8_t bSynchAddress; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */
|
||||
} USB_Audio_StdDescriptor_StreamEndpoint_Std_t;
|
||||
|
|
@ -623,7 +623,7 @@
|
|||
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* a value from the \ref Audio_CSEndpoint_SubTypes_t enum.
|
||||
*/
|
||||
|
||||
|
||||
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. */
|
||||
|
|
@ -649,18 +649,19 @@
|
|||
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
|
||||
* a value from the \ref Audio_CSEndpoint_SubTypes_t enum.
|
||||
*/
|
||||
|
||||
|
||||
uint8_t bmAttributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */
|
||||
|
||||
uint8_t bLockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
|
||||
uint16_t wLockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */
|
||||
} USB_Audio_StdDescriptor_StreamEndpoint_Spc_t;
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CDC_CLASS_COMMON_H_
|
||||
#define _CDC_CLASS_COMMON_H_
|
||||
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros: */
|
||||
/** Mask for the DTR handshake line for use with the \ref CDC_REQ_SetControlLineState class-specific request
|
||||
* from the host, to indicate that the DTR line state should be high.
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
* from the host, to indicate that the RTS line state should be high.
|
||||
*/
|
||||
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
|
||||
|
||||
|
||||
/** Mask for the DCD handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification
|
||||
* from the device to the host, to indicate that the DCD line state is currently high.
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
* 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
|
||||
|
|
@ -125,19 +125,19 @@
|
|||
uint8_t SubType; \
|
||||
uint8_t Data[DataSize]; \
|
||||
}
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the CDC class specific control requests that can be issued by the USB bus host. */
|
||||
enum CDC_ClassRequests_t
|
||||
{
|
||||
{
|
||||
CDC_REQ_SendEncapsulatedCommand = 0x00, /**< CDC class-specific request to send an encapsulated command to the device. */
|
||||
CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */
|
||||
CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */
|
||||
CDC_REQ_SetLineEncoding = 0x20, /**< CDC class-specific request to set the current virtual serial port configuration settings. */
|
||||
CDC_REQ_GetLineEncoding = 0x21, /**< CDC class-specific request to get the current virtual serial port configuration settings. */
|
||||
CDC_REQ_SetControlLineState = 0x22, /**< CDC class-specific request to set the current virtual serial port handshake line states. */
|
||||
CDC_REQ_SendBreak = 0x23, /**< CDC class-specific request to send a break to the receiver via the carrier channel. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the CDC class specific notification requests that can be issued by a CDC device to a host. */
|
||||
enum CDC_ClassNotifications_t
|
||||
{
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
* endpoint.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the CDC class specific interface descriptor subtypes. */
|
||||
enum CDC_DescriptorSubtypes_t
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
CDC_DSUBTYPE_CSInterface_Ethernet = 0x0F, /**< CDC class-specific Ethernet functional descriptor. */
|
||||
CDC_DSUBTYPE_CSInterface_ATM = 0x10, /**< CDC class-specific Asynchronous Transfer Mode functional descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the possible line encoding formats of a virtual serial port. */
|
||||
enum CDC_LineEncodingFormats_t
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
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_LineEncodingParity_t
|
||||
{
|
||||
|
|
@ -270,7 +270,7 @@
|
|||
* to the CDC ACM specification.
|
||||
*/
|
||||
} USB_CDC_StdDescriptor_FunctionalACM_t;
|
||||
|
||||
|
||||
/** \brief CDC class-specific Functional Union Descriptor (LUFA naming conventions).
|
||||
*
|
||||
* Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
|
||||
uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
|
||||
} USB_CDC_Descriptor_FunctionalUnion_t;
|
||||
|
||||
|
||||
/** \brief CDC class-specific Functional Union Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
|
||||
|
|
@ -313,7 +313,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HID_CLASS_COMMON_H_
|
||||
#define _HID_CLASS_COMMON_H_
|
||||
|
||||
|
|
@ -59,8 +59,8 @@
|
|||
#if !defined(__INCLUDE_FROM_HID_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
|
||||
#endif
|
||||
|
||||
/* Macros: */
|
||||
|
||||
/* Macros: */
|
||||
/** 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)
|
||||
|
||||
|
|
@ -84,10 +84,10 @@
|
|||
|
||||
/** 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)
|
||||
|
||||
|
|
@ -108,14 +108,14 @@
|
|||
HID_REQ_GetProtocol = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */
|
||||
HID_REQ_SetProtocol = 0x0B, /**< HID class-specific Request to set the current HID report protocol mode. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the HID class specific descriptor types. */
|
||||
enum HID_DescriptorTypes_t
|
||||
{
|
||||
HID_DTYPE_HID = 0x21, /**< Descriptor header type value, to indicate a HID class HID descriptor. */
|
||||
HID_DTYPE_Report = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the HID class boot protocols that may be supported by HID devices. */
|
||||
enum HID_BootProtocols_t
|
||||
{
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
* Specification).
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the different types of HID reports. */
|
||||
enum HID_ReportItemTypes_t
|
||||
{
|
||||
|
|
@ -151,10 +151,10 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
|
||||
|
||||
|
||||
uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */
|
||||
uint8_t CountryCode; /**< Country code of the localized device, or zero if universal. */
|
||||
|
||||
|
||||
uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */
|
||||
|
||||
uint8_t HIDReportType; /**< Type of HID report, set to \ref HID_DTYPE_Report. */
|
||||
|
|
@ -175,10 +175,10 @@
|
|||
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
|
||||
* given by the specific class.
|
||||
*/
|
||||
|
||||
|
||||
uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */
|
||||
uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */
|
||||
|
||||
|
||||
uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */
|
||||
|
||||
uint8_t bDescriptorType2; /**< Type of HID report, set to \ref HID_DTYPE_Report. */
|
||||
|
|
@ -195,7 +195,7 @@
|
|||
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
|
||||
|
|
@ -215,3 +215,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros: */
|
||||
/** MIDI command for a note on (activation) event. */
|
||||
#define MIDI_COMMAND_NOTE_ON 0x90
|
||||
|
|
@ -78,21 +78,21 @@
|
|||
|
||||
/** 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)
|
||||
|
||||
|
||||
/* Enums: */
|
||||
enum MIDI_JackTypes_t
|
||||
{
|
||||
MIDI_JACKTYPE_Embedded = 0x01, /**< MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
|
||||
MIDI_JACKTYPE_External = 0x02, /**< MIDI class descriptor jack type value for an external (physical) MIDI input or output jack. */
|
||||
};
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief MIDI class-specific Streaming Interface Descriptor (LUFA naming conventions).
|
||||
*
|
||||
|
|
@ -106,13 +106,13 @@
|
|||
{
|
||||
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_Descriptor_AudioInterface_AS_t;
|
||||
|
||||
|
||||
/** \brief MIDI class-specific Streaming Interface Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific MIDI streaming interface descriptor. This indicates to the host
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
*/
|
||||
|
||||
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
|
||||
|
||||
|
||||
uint16_t bcdMSC; /**< Binary coded decimal value, indicating the supported MIDI Class specification version. */
|
||||
uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
|
||||
} USB_MIDI_StdDescriptor_AudioInterface_AS_t;
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
|
||||
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_Descriptor_InputJack_t;
|
||||
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
|
||||
uint8_t bJackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
|
||||
uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */
|
||||
|
||||
|
||||
uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */
|
||||
} USB_MIDI_StdDescriptor_InputJack_t;
|
||||
|
||||
|
|
@ -190,14 +190,14 @@
|
|||
|
||||
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_Descriptor_OutputJack_t;
|
||||
|
||||
|
||||
/** \brief MIDI class-specific Output Jack Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either
|
||||
|
|
@ -217,11 +217,11 @@
|
|||
|
||||
uint8_t bJackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
|
||||
uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */
|
||||
|
||||
|
||||
uint8_t bNrInputPins; /**< Number of output channels within the jack, either physical or logical. */
|
||||
uint8_t baSourceID[1]; /**< ID of each output pin's source data jack. */
|
||||
uint8_t baSourcePin[1]; /**< Pin number in the input jack of each output pin's source data. */
|
||||
|
||||
|
||||
uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */
|
||||
} USB_MIDI_StdDescriptor_OutputJack_t;
|
||||
|
||||
|
|
@ -272,17 +272,18 @@
|
|||
{
|
||||
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. */
|
||||
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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -64,14 +64,14 @@
|
|||
#if !defined(__INCLUDE_FROM_MS_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros: */
|
||||
/** 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)
|
||||
|
||||
|
|
@ -203,7 +203,7 @@
|
|||
|
||||
/** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */
|
||||
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */
|
||||
enum MS_ClassRequests_t
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
* ready for the next command.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the possible command status wrapper return status codes. */
|
||||
enum MS_CommandStatusCodes_t
|
||||
{
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
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.
|
||||
|
|
@ -252,9 +252,9 @@
|
|||
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 \ref MS_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 \ref MS_Host_RequestSense() function, indicating the current sense data of the
|
||||
* device (giving explicit error codes for the last issued command). For details of the
|
||||
|
|
@ -265,13 +265,13 @@
|
|||
uint8_t ResponseCode;
|
||||
|
||||
uint8_t SegmentNumber;
|
||||
|
||||
|
||||
unsigned char SenseKey : 4;
|
||||
unsigned char Reserved : 1;
|
||||
unsigned char ILI : 1;
|
||||
unsigned char EOM : 1;
|
||||
unsigned char FileMark : 1;
|
||||
|
||||
|
||||
uint8_t Information[4];
|
||||
uint8_t AdditionalLength;
|
||||
uint8_t CmdSpecificInformation[4];
|
||||
|
|
@ -293,12 +293,12 @@
|
|||
{
|
||||
unsigned char DeviceType : 5;
|
||||
unsigned char PeripheralQualifier : 3;
|
||||
|
||||
|
||||
unsigned char Reserved : 7;
|
||||
unsigned char Removable : 1;
|
||||
|
||||
|
||||
uint8_t Version;
|
||||
|
||||
|
||||
unsigned char ResponseDataFormat : 4;
|
||||
unsigned char Reserved2 : 1;
|
||||
unsigned char NormACA : 1;
|
||||
|
|
@ -316,17 +316,18 @@
|
|||
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;
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
#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)
|
||||
|
|
@ -74,12 +74,13 @@
|
|||
|
||||
/** 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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -57,9 +57,9 @@
|
|||
#include "../../USB.h"
|
||||
#include "RNDISConstants.h"
|
||||
#include "CDC.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -69,20 +69,20 @@
|
|||
#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
|
||||
|
||||
|
||||
/** 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
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the RNDIS class specific control requests that can be issued by the USB bus host. */
|
||||
enum RNDIS_ClassRequests_t
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
RNDIS_REQ_SendEncapsulatedCommand = 0x00, /**< RNDIS request to issue a host-to-device NDIS command. */
|
||||
RNDIS_REQ_GetEncapsulatedResponse = 0x01, /**< RNDIS request to issue a device-to-host NDIS response. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the possible NDIS adapter states. */
|
||||
enum RNDIS_States_t
|
||||
{
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
NDIS_HardwareStatus_Closing, /**< Hardware currently closing. */
|
||||
NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host. */
|
||||
};
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief MAC Address Structure.
|
||||
*
|
||||
|
|
@ -174,12 +174,12 @@
|
|||
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.
|
||||
|
|
@ -190,7 +190,7 @@
|
|||
uint32_t MessageLength;
|
||||
uint32_t RequestId;
|
||||
uint32_t Status;
|
||||
|
||||
|
||||
uint32_t MajorVersion;
|
||||
uint32_t MinorVersion;
|
||||
uint32_t DeviceFlags;
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
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.
|
||||
|
|
@ -237,7 +237,7 @@
|
|||
|
||||
uint32_t AddressingReset;
|
||||
} RNDIS_Reset_Complete_t;
|
||||
|
||||
|
||||
/** \brief RNDIS OID Property Set Message Structure.
|
||||
*
|
||||
* Type define for a RNDIS OID Property Set command message.
|
||||
|
|
@ -247,7 +247,7 @@
|
|||
uint32_t MessageType;
|
||||
uint32_t MessageLength;
|
||||
uint32_t RequestId;
|
||||
|
||||
|
||||
uint32_t Oid;
|
||||
uint32_t InformationBufferLength;
|
||||
uint32_t InformationBufferOffset;
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
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.
|
||||
|
|
@ -275,13 +275,13 @@
|
|||
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.
|
||||
|
|
@ -292,16 +292,17 @@
|
|||
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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
* 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_
|
||||
|
||||
|
|
@ -61,19 +61,19 @@
|
|||
#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
|
||||
|
||||
|
|
@ -88,8 +88,8 @@
|
|||
#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 REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
|
||||
|
|
@ -119,3 +119,4 @@
|
|||
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
#include "../../USB.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
#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.
|
||||
*
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
* \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.
|
||||
*
|
||||
|
|
@ -97,8 +97,8 @@
|
|||
SI_PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */
|
||||
SI_PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */
|
||||
SI_PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/* 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
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
* parameters are not supported by the device.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief PIMA Still Image Device Command/Response Container.
|
||||
*
|
||||
|
|
@ -133,12 +133,13 @@
|
|||
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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -39,7 +39,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
|
|||
{
|
||||
if (!(Endpoint_IsSETUPReceived()))
|
||||
return;
|
||||
|
||||
|
||||
if (USB_ControlRequest.wIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)
|
||||
return;
|
||||
|
||||
|
|
@ -84,14 +84,14 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioIn
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size, ENDPOINT_BANK_DOUBLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/Audio.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
*/
|
||||
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
|
||||
* (zero if unused).
|
||||
*/
|
||||
*/
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
|
|
@ -108,9 +108,9 @@
|
|||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* are reset to their defaults when the interface is enumerated.
|
||||
*/
|
||||
*/
|
||||
} USB_ClassInfo_Audio_Device_t;
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library
|
||||
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
|
||||
|
|
@ -132,8 +132,8 @@
|
|||
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
|
||||
*/
|
||||
void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
/* Inline Functions: */
|
||||
|
||||
/* Inline Functions: */
|
||||
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should
|
||||
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
|
||||
*
|
||||
|
|
@ -162,8 +162,8 @@
|
|||
{
|
||||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
|
||||
return false;
|
||||
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
return Endpoint_IsOUTReceived();
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
{
|
||||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
|
||||
return false;
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
|
||||
return Endpoint_IsINReady();
|
||||
}
|
||||
|
|
@ -202,14 +202,14 @@
|
|||
static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
|
||||
{
|
||||
int8_t Sample;
|
||||
|
||||
|
||||
(void)AudioInterfaceInfo;
|
||||
|
||||
Sample = Endpoint_Read_Byte();
|
||||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
return Sample;
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
(void)AudioInterfaceInfo;
|
||||
|
||||
Sample = (int16_t)Endpoint_Read_Word_LE();
|
||||
|
||||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
(void)AudioInterfaceInfo;
|
||||
|
||||
Sample = (((uint32_t)Endpoint_Read_Byte() << 16) | Endpoint_Read_Word_LE());
|
||||
|
||||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
|
@ -325,7 +325,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -45,7 +45,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
|
|||
{
|
||||
if (!(Endpoint_IsSETUPReceived()))
|
||||
return;
|
||||
|
||||
|
||||
if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)
|
||||
return;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
|
|||
Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case CDC_REQ_SetLineEncoding:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -69,11 +69,11 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
|
|||
|
||||
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case CDC_REQ_SetControlLineState:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_ClearStatusStage();
|
||||
|
||||
|
|
@ -81,11 +81,11 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
|
|||
|
||||
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case CDC_REQ_SendBreak:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_ClearStatusStage();
|
||||
|
||||
|
|
@ -132,14 +132,14 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
|||
{
|
||||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return;
|
||||
|
||||
|
||||
CDC_Device_Flush(CDCInterfaceInfo);
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo
|
|||
{
|
||||
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
|
||||
return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
|
||||
}
|
||||
|
|
@ -195,11 +195,11 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
|||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
return ENDPOINT_READYWAIT_NoError;
|
||||
|
||||
|
||||
bool BankFull = !(Endpoint_IsReadWriteAllowed());
|
||||
|
||||
|
||||
Endpoint_ClearIN();
|
||||
|
||||
|
||||
if (BankFull)
|
||||
{
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
|
||||
|
|
@ -207,7 +207,7 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
|||
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -244,16 +244,16 @@ int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInf
|
|||
int16_t ReceivedByte = -1;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
if (Endpoint_BytesInEndpoint())
|
||||
ReceivedByte = Endpoint_Read_Byte();
|
||||
|
||||
|
||||
if (!(Endpoint_BytesInEndpoint()))
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
|
||||
|
||||
return ReceivedByte;
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC
|
|||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);
|
||||
|
||||
|
||||
USB_Request_Header_t Notification = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
|
||||
|
|
@ -313,17 +313,18 @@ static int CDC_Device_getchar(FILE* Stream)
|
|||
static int CDC_Device_getchar_Blocking(FILE* Stream)
|
||||
{
|
||||
int16_t ReceivedByte;
|
||||
|
||||
|
||||
while ((ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))) < 0)
|
||||
{
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return _FDEV_EOF;
|
||||
|
||||
|
||||
CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));
|
||||
USB_USBTask();
|
||||
USB_USBTask();
|
||||
}
|
||||
|
||||
return ReceivedByte;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
* \note There are several major drawbacks to the CDC-ACM standard USB class, however
|
||||
* it is very standardized and thus usually available as a built-in driver on
|
||||
* most platforms, and so is a better choice than a proprietary serial class.
|
||||
*
|
||||
*
|
||||
* One major issue with CDC-ACM is that it requires two Interface descriptors,
|
||||
* which will upset most hosts when part of a multi-function "Composite" USB
|
||||
* device, as each interface will be loaded into a separate driver instance. To
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CDC_CLASS_DEVICE_H_
|
||||
#define _CDC_CLASS_DEVICE_H_
|
||||
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** \brief CDC Class Device Mode Configuration and State Structure.
|
||||
|
|
@ -140,13 +140,13 @@
|
|||
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
|
||||
} LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. This is generally
|
||||
* only used if the virtual serial port data is to be reconstructed on a physical UART.
|
||||
*/
|
||||
*/
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* are reset to their defaults when the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_CDC_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library
|
||||
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing
|
||||
* the given CDC interface is selected.
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
|
||||
*/
|
||||
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a
|
||||
* control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the
|
||||
* user program by declaring a handler function with the same name and parameters listed here. The new control line states
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
|
||||
/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
|
||||
* string is discarded. Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the
|
||||
* \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* packed into a single endpoint packet, increasing data throughput.
|
||||
*
|
||||
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
|
||||
|
|
@ -220,10 +220,10 @@
|
|||
uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
|
||||
const char* const Data,
|
||||
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
|
||||
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
|
||||
* byte is discarded. Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the
|
||||
* \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* packed into a single endpoint packet, increasing data throughput.
|
||||
*
|
||||
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
*/
|
||||
uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
|
||||
const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read. This indicates the number
|
||||
* of bytes in the OUT endpoint bank only, and thus the number of calls to \ref CDC_Device_ReceiveByte() which are guaranteed to
|
||||
* succeed immediately. If multiple bytes are to be received, they should be buffered by the user application, as the endpoint
|
||||
|
|
@ -250,7 +250,7 @@
|
|||
* \return Total number of buffered bytes received from the host.
|
||||
*/
|
||||
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function
|
||||
* returns a negative value. The \ref CDC_Device_BytesReceived() function may be queried in advance to determine how many
|
||||
* bytes are currently buffered in the CDC interface's data receive endpoint bank, and thus how many repeated calls to this
|
||||
|
|
@ -264,7 +264,7 @@
|
|||
* \return Next received byte from the host, or a negative value if no data received.
|
||||
*/
|
||||
int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
|
||||
*
|
||||
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
|
||||
|
|
@ -275,10 +275,10 @@
|
|||
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial
|
||||
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notifications to the host. Line states persist
|
||||
* until they are cleared via a second notification. This should be called each time the CDC class driver's
|
||||
* until they are cleared via a second notification. This should be called each time the CDC class driver's
|
||||
* ControlLineStates.DeviceToHost value is updated to push the new states to the USB host.
|
||||
*
|
||||
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
|
||||
|
|
@ -323,7 +323,7 @@
|
|||
FILE* Stream) ATTR_NON_NULL_PTR_ARG(2);
|
||||
static int CDC_Device_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static int CDC_Device_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
void CDC_Device_Event_Stub(void);
|
||||
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
|
||||
ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Device_Event_Stub);
|
||||
|
|
@ -335,12 +335,13 @@
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -39,7 +39,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
{
|
||||
if (!(Endpoint_IsSETUPReceived()))
|
||||
return;
|
||||
|
||||
|
||||
if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber)
|
||||
return;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
memset(ReportData, 0, sizeof(ReportData));
|
||||
|
||||
CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize);
|
||||
|
||||
|
||||
if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
|
||||
memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, HIDInterfaceInfo->Config.PrevReportINBufferSize);
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HID_REQ_SetReport:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -82,7 +82,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
|
||||
CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, ReportData, ReportSize);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HID_REQ_GetProtocol:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -92,7 +92,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
Endpoint_ClearIN();
|
||||
Endpoint_ClearStatusStage();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HID_REQ_SetProtocol:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -100,9 +100,9 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
Endpoint_ClearSETUP();
|
||||
Endpoint_ClearStatusStage();
|
||||
|
||||
HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
|
||||
HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HID_REQ_SetIdle:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -112,11 +112,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
|
||||
HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HID_REQ_GetIdle:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_Write_Byte(HIDInterfaceInfo->State.IdleCount >> 2);
|
||||
Endpoint_ClearIN();
|
||||
|
|
@ -139,17 +139,17 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
||||
{
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
|
||||
|
||||
|
||||
if (Endpoint_IsReadWriteAllowed())
|
||||
{
|
||||
uint8_t ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize];
|
||||
|
|
@ -162,7 +162,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
|||
ReportINData, &ReportINSize);
|
||||
bool StatesChanged = false;
|
||||
bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));
|
||||
|
||||
|
||||
if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
|
||||
{
|
||||
StatesChanged = (memcmp(ReportINData, HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize) != 0);
|
||||
|
|
@ -179,10 +179,11 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
|||
Endpoint_Write_Byte(ReportID);
|
||||
|
||||
Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HID_CLASS_DEVICE_H_
|
||||
#define _HID_CLASS_DEVICE_H_
|
||||
|
||||
|
|
@ -88,14 +88,14 @@
|
|||
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */
|
||||
|
||||
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint. */
|
||||
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
|
||||
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
|
||||
bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking. */
|
||||
|
||||
|
||||
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be
|
||||
* stored by the driver, for comparison purposes to detect report changes that
|
||||
* must be sent immediately to the host. This should point to a buffer big enough
|
||||
* to hold the largest HID input report sent from the HID interface. If this is set
|
||||
* to NULL, it is up to the user to force transfers when needed in the
|
||||
* to NULL, it is up to the user to force transfers when needed in the
|
||||
* \ref CALLBACK_HID_Device_CreateHIDReport() callback function.
|
||||
*
|
||||
* \note Due to the single buffer, the internal driver can only correctly compare
|
||||
|
|
@ -111,18 +111,18 @@
|
|||
*/
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
*/
|
||||
struct
|
||||
{
|
||||
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode. */
|
||||
uint16_t IdleCount; /**< Report idle period, in milliseconds, set by the host. */
|
||||
uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this
|
||||
* should be decremented by the user application if non-zero each millisecond. */
|
||||
uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this
|
||||
* should be decremented by the user application if non-zero each millisecond. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* are reset to their defaults when the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_HID_Device_t;
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
|
||||
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
|
||||
|
|
@ -137,12 +137,12 @@
|
|||
* \return Boolean true if the endpoints were successfully configured, false otherwise.
|
||||
*/
|
||||
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Processes incoming control requests from the host, that are directed to the given HID class interface. This should be
|
||||
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
|
||||
*
|
||||
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
|
||||
*/
|
||||
*/
|
||||
void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
/** General management task for a given HID class interface, required for the correct operation of the interface. This should
|
||||
|
|
@ -151,13 +151,13 @@
|
|||
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
|
||||
*/
|
||||
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** HID class driver callback for the user creation of a HID IN report. This callback may fire in response to either
|
||||
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
|
||||
* user is responsible for the creation of the next HID input report to be sent to the host.
|
||||
*
|
||||
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
|
||||
* \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero,
|
||||
* \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero,
|
||||
* this should be set to the report ID of the generated HID input report (if any). If multiple
|
||||
* reports are not sent via the given HID interface, this parameter should be ignored.
|
||||
* \param[in] ReportType Type of HID report to generate, either \ref HID_REPORT_ITEM_In or \ref HID_REPORT_ITEM_Feature.
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
void* ReportData,
|
||||
uint16_t* const ReportSize) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(4) ATTR_NON_NULL_PTR_ARG(5);
|
||||
|
||||
|
||||
/** HID class driver callback for the user processing of a received HID OUT report. This callback may fire in response to
|
||||
* either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
|
||||
* the user is responsible for the processing of the received HID output report from the host.
|
||||
|
|
@ -205,12 +205,13 @@
|
|||
if (HIDInterfaceInfo->State.IdleMSRemaining)
|
||||
HIDInterfaceInfo->State.IdleMSRemaining--;
|
||||
}
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -64,14 +64,14 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
{
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
|
||||
|
||||
if (Endpoint_IsReadWriteAllowed())
|
||||
|
|
@ -93,7 +93,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
|
|||
{
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return ENDPOINT_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
|
||||
|
|
@ -122,18 +122,19 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
|
|||
{
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return false;
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
return false;
|
||||
|
||||
Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -92,15 +92,15 @@
|
|||
bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
*/
|
||||
*/
|
||||
struct
|
||||
{
|
||||
// No state information for this class
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* are reset to their defaults when the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_MIDI_Device_t;
|
||||
|
||||
} USB_ClassInfo_MIDI_Device_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library
|
||||
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
* \return Boolean true if the endpoints were successfully configured, false otherwise.
|
||||
*/
|
||||
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded. Events are queued into the
|
||||
* endpoint bank until either the endpoint bank is full, or \ref MIDI_Device_Flush() is called. This allows for multiple
|
||||
* MIDI events to be packed into a single endpoint packet, increasing data throughput.
|
||||
|
|
@ -166,12 +166,12 @@
|
|||
{
|
||||
(void)MIDIInterfaceInfo;
|
||||
}
|
||||
|
||||
|
||||
/** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be
|
||||
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
|
||||
*
|
||||
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
|
||||
*/
|
||||
*/
|
||||
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
|
||||
{
|
||||
|
|
@ -182,7 +182,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -42,7 +42,7 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
{
|
||||
if (!(Endpoint_IsSETUPReceived()))
|
||||
return;
|
||||
|
||||
|
||||
if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber)
|
||||
return;
|
||||
|
||||
|
|
@ -62,11 +62,11 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac
|
|||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_Write_Byte(MSInterfaceInfo->Config.TotalLUNs - 1);
|
||||
Endpoint_ClearIN();
|
||||
Endpoint_Write_Byte(MSInterfaceInfo->Config.TotalLUNs - 1);
|
||||
Endpoint_ClearIN();
|
||||
Endpoint_ClearStatusStage();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,14 +100,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -117,14 +117,14 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
|
||||
|
||||
if (Endpoint_IsReadWriteAllowed())
|
||||
{
|
||||
if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
|
||||
{
|
||||
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
|
||||
|
||||
MSInterfaceInfo->State.CommandStatus.Status = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ?
|
||||
MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
|
||||
MSInterfaceInfo->State.CommandStatus.Signature = MS_CSW_SIGNATURE;
|
||||
|
|
@ -136,16 +136,16 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
|
|||
{
|
||||
Endpoint_StallTransaction();
|
||||
}
|
||||
|
||||
|
||||
MS_Device_ReturnCommandStatus(MSInterfaceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (MSInterfaceInfo->State.IsMassStoreReset)
|
||||
{
|
||||
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
|
||||
Endpoint_ClearStall();
|
||||
Endpoint_ResetDataToggle();
|
||||
|
|
@ -168,7 +168,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
|
||||
(MSInterfaceInfo->State.CommandBlock.LUN >= MSInterfaceInfo->Config.TotalLUNs) ||
|
||||
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
|
||||
|
|
@ -178,7 +178,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
Endpoint_StallTransaction();
|
||||
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
|
||||
Endpoint_StallTransaction();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
|
|||
}
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -216,11 +216,11 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
|
|||
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
|
||||
USB_USBTask();
|
||||
#endif
|
||||
|
||||
|
||||
if (MSInterfaceInfo->State.IsMassStoreReset)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
|
||||
if (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
|
||||
StreamCallback_MS_Device_AbortOnMassStoreReset))
|
||||
|
|
@ -244,3 +244,4 @@ static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/MassStorage.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/* Type Defines: */
|
||||
/** \brief Mass Storage Class Device Mode Configuration and State Structure.
|
||||
*
|
||||
* Class state structure. An instance of this structure should be made for each Mass Storage interface
|
||||
|
|
@ -125,12 +125,12 @@
|
|||
* \return Boolean true if the endpoints were successfully configured, false otherwise.
|
||||
*/
|
||||
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Processes incoming control requests from the host, that are directed to the given Mass Storage class interface. This should be
|
||||
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
|
||||
*
|
||||
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
|
||||
*/
|
||||
*/
|
||||
void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
/** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state.
|
||||
*/
|
||||
void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the
|
||||
* host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible
|
||||
* for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
* \return Boolean true if the SCSI command was successfully processed, false otherwise.
|
||||
*/
|
||||
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Function Prototypes: */
|
||||
|
|
@ -159,14 +159,15 @@
|
|||
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -71,7 +71,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
|
|||
{
|
||||
if (!(Endpoint_IsSETUPReceived()))
|
||||
return;
|
||||
|
||||
|
||||
if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber)
|
||||
return;
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
|
|||
|
||||
RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case RNDIS_REQ_GetEncapsulatedResponse:
|
||||
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
|
||||
|
|
@ -100,12 +100,12 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
|
|||
}
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, MessageHeader->MessageLength);
|
||||
Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, MessageHeader->MessageLength);
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
MessageHeader->MessageLength = 0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -146,14 +146,14 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
|
||||
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -176,14 +176,14 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
|
|||
.wIndex = 0,
|
||||
.wLength = 0,
|
||||
};
|
||||
|
||||
|
||||
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
|
||||
|
||||
Endpoint_ClearIN();
|
||||
|
||||
RNDISInterfaceInfo->State.ResponseReady = false;
|
||||
}
|
||||
|
||||
|
||||
if ((RNDISInterfaceInfo->State.CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
|
||||
{
|
||||
RNDIS_Packet_Message_t RNDISPacketHeader;
|
||||
|
|
@ -199,18 +199,18 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
|
|||
Endpoint_StallTransaction();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_Read_Stream_LE(RNDISInterfaceInfo->State.FrameIN.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
RNDISInterfaceInfo->State.FrameIN.FrameLength = RNDISPacketHeader.DataLength;
|
||||
|
||||
RNDISInterfaceInfo->State.FrameIN.FrameInBuffer = true;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber);
|
||||
|
||||
|
||||
if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer)
|
||||
{
|
||||
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
|
||||
|
|
@ -223,11 +223,11 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
|
|||
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
|
||||
Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
|
||||
Endpoint_ClearIN();
|
||||
|
||||
|
||||
RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
|
||||
{
|
||||
|
|
@ -240,19 +240,19 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
{
|
||||
case REMOTE_NDIS_INITIALIZE_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = true;
|
||||
|
||||
|
||||
RNDIS_Initialize_Message_t* INITIALIZE_Message =
|
||||
(RNDIS_Initialize_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
RNDIS_Initialize_Complete_t* INITIALIZE_Response =
|
||||
(RNDIS_Initialize_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
|
||||
|
||||
INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
|
||||
INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
|
||||
INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
|
||||
INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
|
||||
|
||||
|
||||
INITIALIZE_Response->MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
|
||||
INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
|
||||
INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
|
||||
INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
|
||||
INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
|
||||
INITIALIZE_Response->MaxPacketsPerTransfer = 1;
|
||||
|
|
@ -260,9 +260,9 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
INITIALIZE_Response->PacketAlignmentFactor = 0;
|
||||
INITIALIZE_Response->AFListOffset = 0;
|
||||
INITIALIZE_Response->AFListSize = 0;
|
||||
|
||||
|
||||
RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Initialized;
|
||||
|
||||
|
||||
break;
|
||||
case REMOTE_NDIS_HALT_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = false;
|
||||
|
|
@ -273,40 +273,40 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
break;
|
||||
case REMOTE_NDIS_QUERY_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = true;
|
||||
|
||||
|
||||
RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
uint32_t Query_Oid = QUERY_Message->Oid;
|
||||
|
||||
|
||||
void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
|
||||
QUERY_Message->InformationBufferOffset];
|
||||
void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
|
||||
void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
|
||||
uint16_t ResponseSize;
|
||||
|
||||
QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
|
||||
QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
|
||||
|
||||
|
||||
if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
|
||||
ResponseData, &ResponseSize))
|
||||
{
|
||||
QUERY_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
|
||||
QUERY_Response->MessageLength += ResponseSize;
|
||||
|
||||
|
||||
QUERY_Response->InformationBufferLength = ResponseSize;
|
||||
QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
QUERY_Response->Status = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
|
||||
|
||||
QUERY_Response->InformationBufferLength = 0;
|
||||
QUERY_Response->InformationBufferOffset = 0;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case REMOTE_NDIS_SET_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = true;
|
||||
|
||||
|
||||
RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
uint32_t SET_Oid = SET_Message->Oid;
|
||||
|
|
@ -317,14 +317,14 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
|
||||
void* SetData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
|
||||
SET_Message->InformationBufferOffset];
|
||||
|
||||
|
||||
SET_Response->Status = RNDIS_Device_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData,
|
||||
SET_Message->InformationBufferLength) ?
|
||||
REMOTE_NDIS_STATUS_SUCCESS : REMOTE_NDIS_STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
case REMOTE_NDIS_RESET_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = true;
|
||||
|
||||
|
||||
RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
|
||||
RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
|
||||
|
|
@ -335,7 +335,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
break;
|
||||
case REMOTE_NDIS_KEEPALIVE_MSG:
|
||||
RNDISInterfaceInfo->State.ResponseReady = true;
|
||||
|
||||
|
||||
RNDIS_KeepAlive_Message_t* KEEPALIVE_Message =
|
||||
(RNDIS_KeepAlive_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
|
||||
RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response =
|
||||
|
|
@ -345,7 +345,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
|
|||
KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
|
||||
KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
|
||||
KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -364,60 +364,60 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
|
|||
{
|
||||
case OID_GEN_SUPPORTED_LIST:
|
||||
*ResponseSize = sizeof(AdapterSupportedOIDList);
|
||||
|
||||
|
||||
memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList));
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_PHYSICAL_MEDIUM:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Indicate that the device is a true ethernet link */
|
||||
*((uint32_t*)ResponseData) = 0;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_HARDWARE_STATUS:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
*((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_MEDIA_SUPPORTED:
|
||||
case OID_GEN_MEDIA_IN_USE:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIUM_802_3;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_VENDOR_ID:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Vendor ID 0x0xFFFFFF is reserved for vendors who have not purchased a NDIS VID */
|
||||
*((uint32_t*)ResponseData) = 0x00FFFFFF;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_MAXIMUM_FRAME_SIZE:
|
||||
case OID_GEN_TRANSMIT_BLOCK_SIZE:
|
||||
case OID_GEN_RECEIVE_BLOCK_SIZE:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
*((uint32_t*)ResponseData) = ETHERNET_FRAME_SIZE_MAX;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_VENDOR_DESCRIPTION:
|
||||
*ResponseSize = (strlen(RNDISInterfaceInfo->Config.AdapterVendorDescription) + 1);
|
||||
|
||||
|
||||
memcpy(ResponseData, RNDISInterfaceInfo->Config.AdapterVendorDescription, *ResponseSize);
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_MEDIA_CONNECT_STATUS:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIA_STATE_CONNECTED;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_LINK_SPEED:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Indicate 10Mb/s link speed */
|
||||
*((uint32_t*)ResponseData) = 100000;
|
||||
|
||||
|
|
@ -425,23 +425,23 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
|
|||
case OID_802_3_PERMANENT_ADDRESS:
|
||||
case OID_802_3_CURRENT_ADDRESS:
|
||||
*ResponseSize = sizeof(MAC_Address_t);
|
||||
|
||||
|
||||
memcpy(ResponseData, &RNDISInterfaceInfo->Config.AdapterMACAddress, sizeof(MAC_Address_t));
|
||||
|
||||
return true;
|
||||
case OID_802_3_MAXIMUM_LIST_SIZE:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Indicate only one multicast address supported */
|
||||
*((uint32_t*)ResponseData) = 1;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_CURRENT_PACKET_FILTER:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
*((uint32_t*)ResponseData) = RNDISInterfaceInfo->State.CurrPacketFilter;
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
case OID_GEN_XMIT_OK:
|
||||
case OID_GEN_RCV_OK:
|
||||
case OID_GEN_XMIT_ERROR:
|
||||
|
|
@ -451,17 +451,17 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
|
|||
case OID_802_3_XMIT_ONE_COLLISION:
|
||||
case OID_802_3_XMIT_MORE_COLLISIONS:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Unused statistic OIDs - always return 0 for each */
|
||||
*((uint32_t*)ResponseData) = 0;
|
||||
|
||||
|
||||
return true;
|
||||
case OID_GEN_MAXIMUM_TOTAL_SIZE:
|
||||
*ResponseSize = sizeof(uint32_t);
|
||||
|
||||
|
||||
/* Indicate maximum overall buffer (Ethernet frame and RNDIS header) the adapter can handle */
|
||||
*((uint32_t*)ResponseData) = (RNDIS_MESSAGE_BUFFER_SIZE + ETHERNET_FRAME_SIZE_MAX);
|
||||
|
||||
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -481,11 +481,11 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDI
|
|||
RNDISInterfaceInfo->State.CurrPacketFilter = *((uint32_t*)SetData);
|
||||
RNDISInterfaceInfo->State.CurrRNDISState = ((RNDISInterfaceInfo->State.CurrPacketFilter) ?
|
||||
RNDIS_Data_Initialized : RNDIS_Data_Initialized);
|
||||
|
||||
|
||||
return true;
|
||||
case OID_802_3_MULTICAST_LIST:
|
||||
/* Do nothing - throw away the value from the host as it is unused */
|
||||
|
||||
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -493,3 +493,4 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDI
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,9 +56,9 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/RNDIS.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -68,9 +68,9 @@
|
|||
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/* Type Defines: */
|
||||
/** \brief RNDIS Class Device Mode Configuration and State Structure.
|
||||
*
|
||||
* Class state structure. An instance of this structure should be made for each RNDIS interface
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
|
||||
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
|
||||
bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking. */
|
||||
|
||||
|
||||
char* AdapterVendorDescription; /**< String description of the adapter vendor. */
|
||||
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section.
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
* are reset to their defaults when the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_RNDIS_Device_t;
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library
|
||||
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
|
||||
|
|
@ -138,23 +138,23 @@
|
|||
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
|
||||
*
|
||||
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
|
||||
*/
|
||||
*/
|
||||
void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** General management task for a given HID class interface, required for the correct operation of the interface. This should
|
||||
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
|
||||
*
|
||||
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
|
||||
*/
|
||||
void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
|
||||
static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
|
||||
ATTR_NON_NULL_PTR_ARG(1);
|
||||
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
|
||||
static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
|
||||
const uint32_t OId,
|
||||
void* const QueryData,
|
||||
const uint16_t QuerySize,
|
||||
|
|
@ -167,14 +167,15 @@
|
|||
const uint16_t SetSize) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(3);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -47,8 +47,8 @@
|
|||
* - LUFA/Drivers/USB/Class/Host/HIDParser.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
|
||||
*
|
||||
* \section Module Description
|
||||
* HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device
|
||||
* and Host USB modes. User applications can use this class driver instead of implementing the HID class manually
|
||||
* HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device
|
||||
* and Host USB modes. User applications can use this class driver instead of implementing the HID class manually
|
||||
* via the low-level LUFA APIs.
|
||||
*
|
||||
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
|
||||
|
|
@ -56,14 +56,14 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HID_CLASS_H_
|
||||
#define _HID_CLASS_H_
|
||||
|
||||
/* Macros: */
|
||||
#define __INCLUDE_FROM_HID_DRIVER
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
|
@ -74,11 +74,12 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "Device/HID.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/HID.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -62,7 +62,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
return CDC_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
}
|
||||
|
||||
DataINEndpoint = NULL;
|
||||
DataOUTEndpoint = NULL;
|
||||
|
|
@ -79,10 +79,10 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
|
||||
NotificationEndpoint = NULL;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
|
|
@ -97,7 +97,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -141,7 +141,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
|
|||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
if ((CurrentInterface->Class == CDC_CONTROL_CLASS) &&
|
||||
(CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) &&
|
||||
(CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL))
|
||||
|
|
@ -149,7 +149,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
|
|||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
if ((CurrentInterface->Class == CDC_DATA_CLASS) &&
|
||||
(CurrentInterface->SubClass == CDC_DATA_SUBCLASS) &&
|
||||
(CurrentInterface->Protocol == CDC_DATA_PROTOCOL))
|
||||
|
|
@ -167,7 +167,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +177,9 @@ static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescri
|
|||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return;
|
||||
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
|
@ -206,14 +206,14 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
{
|
||||
USB_Request_Header_t Notification;
|
||||
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
if ((Notification.bRequest == CDC_NOTIF_SerialState) &&
|
||||
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
|
||||
{
|
||||
Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
|
||||
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
|
||||
NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
Pipe_ClearIN();
|
||||
|
||||
EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);
|
||||
|
|
@ -223,7 +223,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
Pipe_ClearIN();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
CDC_Host_Flush(CDCInterfaceInfo);
|
||||
|
|
@ -241,7 +241,7 @@ uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInf
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding);
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCI
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -287,12 +287,12 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -301,12 +301,12 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return PIPE_READYWAIT_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearOUT();
|
||||
|
|
@ -315,9 +315,9 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
|||
return ErrorCode;
|
||||
}
|
||||
|
||||
Pipe_Write_Byte(Data);
|
||||
Pipe_Write_Byte(Data);
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return 0;
|
||||
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
|
@ -346,7 +346,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||
else
|
||||
{
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return -1;
|
||||
|
||||
|
||||
int16_t ReceivedByte = -1;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
|
||||
|
|
@ -369,7 +369,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
if (!(Pipe_BytesInPipe()))
|
||||
Pipe_ClearIN();
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
return ReceivedByte;
|
||||
|
|
@ -379,12 +379,12 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
|
||||
return PIPE_READYWAIT_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
return PIPE_READYWAIT_NoError;
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
|
|||
}
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ static int CDC_Host_getchar(FILE* Stream)
|
|||
static int CDC_Host_getchar_Blocking(FILE* Stream)
|
||||
{
|
||||
int16_t ReceivedByte;
|
||||
|
||||
|
||||
while ((ReceivedByte = CDC_Host_ReceiveByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream))) < 0)
|
||||
{
|
||||
if (USB_HostState == HOST_STATE_Unattached)
|
||||
|
|
@ -457,3 +457,4 @@ void CDC_Host_Event_Stub(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */
|
||||
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
|
||||
bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
|
|
@ -100,11 +100,11 @@
|
|||
* Configured state.
|
||||
*/
|
||||
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */
|
||||
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe. */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used. */
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
* masks. This value is updated each time \ref CDC_Host_USBTask() is called.
|
||||
*/
|
||||
} ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_CDC_Host_t;
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible error codes returned by the \ref CDC_Host_ConfigurePipes() function. */
|
||||
enum CDC_Host_EnumerationFailure_ErrorCodes_t
|
||||
|
|
@ -145,7 +145,7 @@
|
|||
CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
|
||||
CDC_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** General management task for a given CDC host class interface, required for the correct operation of the interface. This should
|
||||
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state.
|
||||
*/
|
||||
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Host interface configuration routine, to configure a given CDC host interface instance using the Configuration
|
||||
* Descriptor read from an attached USB device. This function automatically updates the given CDC Host instance's
|
||||
* state values and configures the pipes required to communicate with the interface if it is found within the device.
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
||||
uint16_t ConfigDescriptorSize,
|
||||
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
/** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding
|
||||
* values of the interface have been changed to push the new settings to the USB device.
|
||||
*
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Sends a Send Break request to the device. This is generally used to separate data data or to indicate a special condition
|
||||
* to the receiving device.
|
||||
*
|
||||
|
|
@ -204,10 +204,10 @@
|
|||
*/
|
||||
uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
||||
const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Sends a given string to the attached USB device, if connected. If a device is not connected when the function is called, the
|
||||
* string is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
|
||||
* \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* packed into a single pipe packet, increasing data throughput.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -222,10 +222,10 @@
|
|||
uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
|
||||
const char* const Data,
|
||||
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
|
||||
/** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the
|
||||
* byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
|
||||
* \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* packed into a single pipe packet, increasing data throughput.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
* \return Next received byte from the device, or a negative value if no data received.
|
||||
*/
|
||||
int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -335,7 +335,7 @@
|
|||
static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -344,3 +344,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -44,9 +44,9 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
|
||||
USB_Descriptor_Interface_t* HIDInterface = NULL;
|
||||
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
|
||||
|
||||
|
||||
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
|
||||
|
||||
|
||||
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
||||
return HID_ENUMERROR_InvalidConfigDescriptor;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
{
|
||||
if (DataINEndpoint || DataOUTEndpoint)
|
||||
break;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
|
|
@ -66,11 +66,11 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
{
|
||||
return HID_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
|
||||
|
||||
HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
|
||||
} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
|
||||
(HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
|
||||
|
||||
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
|
|
@ -84,15 +84,15 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
DataINEndpoint = EndpointData;
|
||||
else
|
||||
DataOUTEndpoint = EndpointData;
|
||||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -101,7 +101,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
|
||||
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
|
||||
|
||||
|
||||
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
|
|
@ -115,13 +115,13 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
|
||||
HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
|
||||
HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
|
||||
HIDInterfaceInfo->State.LargestReportSize = 8;
|
||||
HIDInterfaceInfo->State.IsActive = true;
|
||||
|
||||
|
||||
return HID_ENUMERROR_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -131,11 +131,11 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
|
|||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
if (CurrentInterface->Class == HID_INTERFACE_CLASS)
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescri
|
|||
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
|
|
@ -182,11 +182,11 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(Buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
||||
void* Buffer)
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
|||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
uint16_t ReportSize;
|
||||
uint8_t* BufferPos = Buffer;
|
||||
|
||||
|
|
@ -205,13 +205,13 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
|||
if (!(HIDInterfaceInfo->State.UsingBootProtocol))
|
||||
{
|
||||
uint8_t ReportID = 0;
|
||||
|
||||
|
||||
if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs)
|
||||
{
|
||||
ReportID = Pipe_Read_Byte();
|
||||
*(BufferPos++) = ReportID;
|
||||
}
|
||||
|
||||
|
||||
ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In);
|
||||
}
|
||||
else
|
||||
|
|
@ -222,10 +222,10 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
|
|||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -244,19 +244,19 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == HID_REPORT_ITEM_Out))
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (ReportID)
|
||||
Pipe_Write_Stream_LE(&ReportID, sizeof(ReportID), NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
Pipe_ClearOUT();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
else
|
||||
|
|
@ -276,7 +276,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(Buffer);
|
||||
}
|
||||
}
|
||||
|
|
@ -290,11 +290,11 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
|
|||
|
||||
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
ReportReceived = Pipe_IsINReceived();
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return ReportReceived;
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
if (!(HIDInterfaceInfo->State.SupportsBootProtocol))
|
||||
return HID_ERROR_LOGICAL;
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf
|
|||
|
||||
HIDInterfaceInfo->State.LargestReportSize = 8;
|
||||
HIDInterfaceInfo->State.UsingBootProtocol = true;
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
|
|||
uint8_t ErrorCode;
|
||||
|
||||
uint8_t HIDReportData[HIDInterfaceInfo->State.HIDReportSize];
|
||||
|
||||
|
||||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
|
||||
|
|
@ -345,7 +345,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
|
|||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(HIDReportData)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if (HIDInterfaceInfo->State.UsingBootProtocol)
|
||||
{
|
||||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
|
|
@ -362,10 +362,10 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
|
|||
|
||||
HIDInterfaceInfo->State.UsingBootProtocol = false;
|
||||
}
|
||||
|
||||
|
||||
if (HIDInterfaceInfo->Config.HIDParserData == NULL)
|
||||
return HID_ERROR_LOGICAL;
|
||||
|
||||
|
||||
if ((ErrorCode = USB_ProcessHIDReport(HIDReportData, HIDInterfaceInfo->State.HIDReportSize,
|
||||
HIDInterfaceInfo->Config.HIDParserData)) != HID_PARSE_Successful)
|
||||
{
|
||||
|
|
@ -380,3 +380,4 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#include "../../USB.h"
|
||||
#include "../Common/HID.h"
|
||||
#include "HIDParser.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
/* Macros: */
|
||||
/** Error code for some HID Host functions, indicating a logical (and not hardware) error. */
|
||||
#define HID_ERROR_LOGICAL 0x80
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief HID Class Host Mode Configuration and State Structure.
|
||||
*
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe. */
|
||||
|
||||
|
||||
bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot
|
||||
* Protocol when enabled via \ref HID_Host_SetBootProtocol().
|
||||
*/
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
*/
|
||||
bool UsingBootProtocol; /**< Indicates that the interface is currently initialized in Boot Protocol mode */
|
||||
uint16_t HIDReportSize; /**< Size in bytes of the HID report descriptor in the device. */
|
||||
|
||||
|
||||
uint8_t LargestReportSize; /**< Largest report the device will send, in bytes. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
|
|
@ -141,7 +141,7 @@
|
|||
HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
|
||||
HID_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Host interface configuration routine, to configure a given HID host interface instance using the Configuration
|
||||
* Descriptor read from an attached USB device. This function automatically updates the given HID Host instance's
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
|
||||
|
||||
/** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.
|
||||
*
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
* call will fail.
|
||||
*
|
||||
|
|
@ -202,7 +202,7 @@
|
|||
const uint8_t ReportID,
|
||||
void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
|
||||
#endif
|
||||
|
||||
|
||||
/** Sends an OUT or FEATURE report to the currently attached HID device, using the device's OUT pipe if available,
|
||||
* or the device's Control pipe if not.
|
||||
*
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
* \return Boolean true if a report has been received, false otherwise.
|
||||
*/
|
||||
bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Switches the attached HID device's reporting protocol over to the Boot Report protocol mode, on supported devices.
|
||||
*
|
||||
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method must still be called
|
||||
|
|
@ -276,7 +276,7 @@
|
|||
*/
|
||||
uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
/** General management task for a given Human Interface Class host class interface, required for the correct operation of
|
||||
* the interface. This should be called frequently in the main program loop, before the master USB management task
|
||||
|
|
@ -288,7 +288,7 @@
|
|||
static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
|
||||
{
|
||||
(void)HIDInterfaceInfo;
|
||||
}
|
||||
}
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
|
|
@ -300,9 +300,9 @@
|
|||
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -311,3 +311,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -41,7 +41,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
HID_StateTable_t StateTable[HID_STATETABLE_STACK_DEPTH];
|
||||
HID_StateTable_t* CurrStateTable = &StateTable[0];
|
||||
HID_CollectionPath_t* CurrCollectionPath = NULL;
|
||||
HID_ReportSizeInfo_t* CurrReportIDInfo = &ParserData->ReportIDSizes[0];
|
||||
HID_ReportSizeInfo_t* CurrReportIDInfo = &ParserData->ReportIDSizes[0];
|
||||
uint16_t UsageList[HID_USAGE_STACK_DEPTH];
|
||||
uint8_t UsageListSize = 0;
|
||||
HID_MinMax_t UsageMinMax = {0, 0};
|
||||
|
|
@ -50,16 +50,16 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
memset(CurrStateTable, 0x00, sizeof(HID_StateTable_t));
|
||||
memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t));
|
||||
|
||||
ParserData->TotalDeviceReports = 1;
|
||||
ParserData->TotalDeviceReports = 1;
|
||||
|
||||
while (ReportSize)
|
||||
{
|
||||
uint8_t HIDReportItem = *ReportData;
|
||||
uint32_t ReportItemData = 0;
|
||||
|
||||
|
||||
ReportData++;
|
||||
ReportSize--;
|
||||
|
||||
|
||||
switch (HIDReportItem & DATA_SIZE_MASK)
|
||||
{
|
||||
case DATA_SIZE_4:
|
||||
|
|
@ -84,7 +84,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
|
||||
if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1])
|
||||
return HID_PARSE_HIDStackOverflow;
|
||||
|
||||
|
||||
memcpy((CurrStateTable + 1),
|
||||
CurrStateTable,
|
||||
sizeof(HID_ReportItem_t));
|
||||
|
|
@ -94,7 +94,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
case (TYPE_GLOBAL | TAG_GLOBAL_POP):
|
||||
if (CurrStateTable == &StateTable[0])
|
||||
return HID_PARSE_HIDStackUnderflow;
|
||||
|
||||
|
||||
CurrStateTable--;
|
||||
break;
|
||||
case (TYPE_GLOBAL | TAG_GLOBAL_USAGEPAGE):
|
||||
|
|
@ -139,25 +139,25 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CurrReportIDInfo == NULL)
|
||||
{
|
||||
if (ParserData->TotalDeviceReports == HID_MAX_REPORT_IDS)
|
||||
return HID_PARSE_InsufficientReportIDItems;
|
||||
|
||||
|
||||
CurrReportIDInfo = &ParserData->ReportIDSizes[ParserData->TotalDeviceReports++];
|
||||
memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ParserData->UsingReportIDs = true;
|
||||
|
||||
|
||||
CurrReportIDInfo->ReportID = CurrStateTable->ReportID;
|
||||
break;
|
||||
case (TYPE_LOCAL | TAG_LOCAL_USAGE):
|
||||
if (UsageListSize == HID_USAGE_STACK_DEPTH)
|
||||
return HID_PARSE_UsageListOverflow;
|
||||
|
||||
|
||||
UsageList[UsageListSize++] = ReportItemData;
|
||||
break;
|
||||
case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
|
||||
|
|
@ -174,42 +174,42 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
else
|
||||
{
|
||||
HID_CollectionPath_t* ParentCollectionPath = CurrCollectionPath;
|
||||
|
||||
|
||||
CurrCollectionPath = &ParserData->CollectionPaths[1];
|
||||
|
||||
|
||||
while (CurrCollectionPath->Parent != NULL)
|
||||
{
|
||||
if (CurrCollectionPath == &ParserData->CollectionPaths[HID_MAX_COLLECTIONS - 1])
|
||||
return HID_PARSE_InsufficientCollectionPaths;
|
||||
|
||||
|
||||
CurrCollectionPath++;
|
||||
}
|
||||
|
||||
|
||||
CurrCollectionPath->Parent = ParentCollectionPath;
|
||||
}
|
||||
|
||||
|
||||
CurrCollectionPath->Type = ReportItemData;
|
||||
CurrCollectionPath->Usage.Page = CurrStateTable->Attributes.Usage.Page;
|
||||
|
||||
|
||||
if (UsageListSize)
|
||||
{
|
||||
CurrCollectionPath->Usage.Usage = UsageList[0];
|
||||
|
||||
for (uint8_t i = 0; i < UsageListSize; i++)
|
||||
UsageList[i] = UsageList[i + 1];
|
||||
|
||||
|
||||
UsageListSize--;
|
||||
}
|
||||
else if (UsageMinMax.Minimum <= UsageMinMax.Maximum)
|
||||
{
|
||||
CurrCollectionPath->Usage.Usage = UsageMinMax.Minimum++;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case (TYPE_MAIN | TAG_MAIN_ENDCOLLECTION):
|
||||
if (CurrCollectionPath == NULL)
|
||||
return HID_PARSE_UnexpectedEndCollection;
|
||||
|
||||
|
||||
CurrCollectionPath = CurrCollectionPath->Parent;
|
||||
break;
|
||||
case (TYPE_MAIN | TAG_MAIN_INPUT):
|
||||
|
|
@ -218,60 +218,60 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
for (uint8_t ReportItemNum = 0; ReportItemNum < CurrStateTable->ReportCount; ReportItemNum++)
|
||||
{
|
||||
HID_ReportItem_t NewReportItem;
|
||||
|
||||
|
||||
memcpy(&NewReportItem.Attributes,
|
||||
&CurrStateTable->Attributes,
|
||||
sizeof(HID_ReportItem_Attributes_t));
|
||||
|
||||
|
||||
NewReportItem.ItemFlags = ReportItemData;
|
||||
NewReportItem.CollectionPath = CurrCollectionPath;
|
||||
NewReportItem.ReportID = CurrStateTable->ReportID;
|
||||
|
||||
|
||||
if (UsageListSize)
|
||||
{
|
||||
NewReportItem.Attributes.Usage.Usage = UsageList[0];
|
||||
|
||||
|
||||
for (uint8_t i = 0; i < UsageListSize; i++)
|
||||
UsageList[i] = UsageList[i + 1];
|
||||
|
||||
|
||||
UsageListSize--;
|
||||
}
|
||||
else if (UsageMinMax.Minimum <= UsageMinMax.Maximum)
|
||||
{
|
||||
NewReportItem.Attributes.Usage.Usage = UsageMinMax.Minimum++;
|
||||
}
|
||||
|
||||
|
||||
uint8_t ItemTag = (HIDReportItem & TAG_MASK);
|
||||
|
||||
|
||||
if (ItemTag == TAG_MAIN_INPUT)
|
||||
NewReportItem.ItemType = HID_REPORT_ITEM_In;
|
||||
else if (ItemTag == TAG_MAIN_OUTPUT)
|
||||
NewReportItem.ItemType = HID_REPORT_ITEM_Out;
|
||||
else
|
||||
NewReportItem.ItemType = HID_REPORT_ITEM_Feature;
|
||||
|
||||
|
||||
NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType];
|
||||
|
||||
|
||||
CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType] += CurrStateTable->Attributes.BitSize;
|
||||
|
||||
|
||||
if (ParserData->LargestReportSizeBits < NewReportItem.BitOffset)
|
||||
ParserData->LargestReportSizeBits = NewReportItem.BitOffset;
|
||||
|
||||
|
||||
if (!(ReportItemData & IOF_CONSTANT) && CALLBACK_HIDParser_FilterHIDReportItem(&NewReportItem))
|
||||
{
|
||||
if (ParserData->TotalReportItems == HID_MAX_REPORTITEMS)
|
||||
return HID_PARSE_InsufficientReportItems;
|
||||
|
||||
|
||||
memcpy(&ParserData->ReportItems[ParserData->TotalReportItems],
|
||||
&NewReportItem, sizeof(HID_ReportItem_t));
|
||||
|
||||
|
||||
ParserData->TotalReportItems++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((HIDReportItem & TYPE_MASK) == TYPE_MAIN)
|
||||
{
|
||||
UsageMinMax.Minimum = 0;
|
||||
|
|
@ -279,10 +279,10 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
|
|||
UsageListSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(ParserData->TotalReportItems))
|
||||
return HID_PARSE_NoUnfilteredReportItems;
|
||||
|
||||
|
||||
return HID_PARSE_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -292,27 +292,27 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
|
|||
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
|
||||
uint16_t CurrentBit = ReportItem->BitOffset;
|
||||
uint32_t BitMask = (1 << 0);
|
||||
|
||||
|
||||
if (ReportItem->ReportID)
|
||||
{
|
||||
if (ReportItem->ReportID != ReportData[0])
|
||||
return false;
|
||||
|
||||
|
||||
ReportData++;
|
||||
}
|
||||
|
||||
|
||||
ReportItem->PreviousValue = ReportItem->Value;
|
||||
ReportItem->Value = 0;
|
||||
|
||||
|
||||
while (DataBitsRem--)
|
||||
{
|
||||
if (ReportData[CurrentBit / 8] & (1 << (CurrentBit % 8)))
|
||||
ReportItem->Value |= BitMask;
|
||||
|
||||
|
||||
CurrentBit++;
|
||||
BitMask <<= 1;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -322,20 +322,20 @@ void USB_SetHIDReportItemInfo(uint8_t* ReportData,
|
|||
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
|
||||
uint16_t CurrentBit = ReportItem->BitOffset;
|
||||
uint32_t BitMask = (1 << 0);
|
||||
|
||||
|
||||
if (ReportItem->ReportID)
|
||||
{
|
||||
ReportData[0] = ReportItem->ReportID;
|
||||
ReportData++;
|
||||
}
|
||||
|
||||
|
||||
ReportItem->PreviousValue = ReportItem->Value;
|
||||
|
||||
|
||||
while (DataBitsRem--)
|
||||
{
|
||||
if (ReportItem->Value & (1 << (CurrentBit % 8)))
|
||||
ReportData[CurrentBit / 8] |= BitMask;
|
||||
|
||||
|
||||
CurrentBit++;
|
||||
BitMask <<= 1;
|
||||
}
|
||||
|
|
@ -348,7 +348,7 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData,
|
|||
for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++)
|
||||
{
|
||||
uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType];
|
||||
|
||||
|
||||
if (ParserData->ReportIDSizes[i].ReportID == ReportID)
|
||||
return ((ReportSizeBits >> 3) + ((ReportSizeBits & 0x07) ? 1 : 0));
|
||||
}
|
||||
|
|
@ -357,3 +357,4 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData,
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* a HID device transmits to the host. It also provides an easy API for extracting and processing the data
|
||||
* elements inside a HID report sent from an attached HID device.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_HIDParser HID Report Parser
|
||||
*
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
*/
|
||||
#define HID_STATETABLE_STACK_DEPTH 2
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(HID_USAGE_STACK_DEPTH) || defined(__DOXYGEN__)
|
||||
/** Constant indicating the maximum stack depth of the usage table. A larger usage table
|
||||
* allows for more USAGE items to be indicated sequentially for REPORT COUNT entries of more than
|
||||
|
|
@ -107,17 +107,17 @@
|
|||
*/
|
||||
#define HID_MAX_COLLECTIONS 10
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(HID_MAX_REPORTITEMS) || defined(__DOXYGEN__)
|
||||
/** Constant indicating the maximum number of report items (IN, OUT or FEATURE) that can be processed
|
||||
/** Constant indicating the maximum number of report items (IN, OUT or FEATURE) that can be processed
|
||||
* in the report item descriptor and stored in the user HID Report Info structure. A large value allows
|
||||
* for more report items to be stored, but consumes more memory. By default this is set to 20 items,
|
||||
* for more report items to be stored, but consumes more memory. By default this is set to 20 items,
|
||||
* but this can be overridden by defining HID_MAX_REPORTITEMS to another value in the user project
|
||||
* makefile, and passing the define to the compiler using the -D compiler switch.
|
||||
*/
|
||||
#define HID_MAX_REPORTITEMS 20
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(HID_MAX_REPORT_IDS) || defined(__DOXYGEN__)
|
||||
/** Constant indicating the maximum number of unique report IDs that can be processed in the report item
|
||||
* descriptor for the report size information array in the user HID Report Info structure. A large value
|
||||
|
|
@ -141,12 +141,12 @@
|
|||
#define HID_ALIGN_DATA(ReportItem, Type) ((Type)(ReportItem->Value << ((8 * sizeof(Type)) - ReportItem->Attributes.BitSize)))
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Enums: */
|
||||
/* Enums: */
|
||||
/** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function. */
|
||||
enum HID_Parse_ErrorCodes_t
|
||||
{
|
||||
HID_PARSE_Successful = 0, /**< Successful parse of the HID report descriptor, no error. */
|
||||
HID_PARSE_HIDStackOverflow = 1, /**< More than \ref HID_STATETABLE_STACK_DEPTH nested PUSHes in the report. */
|
||||
HID_PARSE_HIDStackOverflow = 1, /**< More than \ref HID_STATETABLE_STACK_DEPTH nested PUSHes in the report. */
|
||||
HID_PARSE_HIDStackUnderflow = 2, /**< A POP was found when the state table stack was empty. */
|
||||
HID_PARSE_InsufficientReportItems = 3, /**< More than \ref HID_MAX_REPORTITEMS report items in the report. */
|
||||
HID_PARSE_UnexpectedEndCollection = 4, /**< An END COLLECTION item found without matching COLLECTION item. */
|
||||
|
|
@ -155,8 +155,8 @@
|
|||
HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */
|
||||
HID_PARSE_NoUnfilteredReportItems = 8, /**< All report items from the device were filtered by the filtering callback routine. */
|
||||
};
|
||||
|
||||
/* Type Defines: */
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief HID Parser Report Item Min/Max Structure.
|
||||
*
|
||||
* Type define for an attribute with both minimum and maximum values (e.g. Logical Min/Max).
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
uint32_t Type; /**< Unit type (refer to HID specifications for details). */
|
||||
uint8_t Exponent; /**< Unit exponent (refer to HID specifications for details). */
|
||||
} HID_Unit_t;
|
||||
|
||||
|
||||
/** \brief HID Parser Report Item Usage Structure.
|
||||
*
|
||||
* Type define for the Usage attributes of a report item.
|
||||
|
|
@ -206,13 +206,13 @@
|
|||
typedef struct
|
||||
{
|
||||
uint8_t BitSize; /**< Size in bits of the report item's data. */
|
||||
|
||||
|
||||
HID_Usage_t Usage; /**< Usage of the report item. */
|
||||
HID_Unit_t Unit; /**< Unit type and exponent of the report item. */
|
||||
HID_MinMax_t Logical; /**< Logical minimum and maximum of the report item. */
|
||||
HID_MinMax_t Physical; /**< Physical minimum and maximum of the report item. */
|
||||
} HID_ReportItem_Attributes_t;
|
||||
|
||||
|
||||
/** \brief HID Parser Report Item Details Structure.
|
||||
*
|
||||
* Type define for a report item (IN, OUT or FEATURE) layout attributes and other details.
|
||||
|
|
@ -226,13 +226,13 @@
|
|||
HID_CollectionPath_t* CollectionPath; /**< Collection path of the item. */
|
||||
|
||||
HID_ReportItem_Attributes_t Attributes; /**< Report item attributes. */
|
||||
|
||||
|
||||
uint32_t Value; /**< Current value of the report item - use \ref HID_ALIGN_DATA() when processing
|
||||
* a retrieved value so that it is aligned to a specific type.
|
||||
*/
|
||||
uint32_t PreviousValue; /**< Previous value of the report item. */
|
||||
uint32_t PreviousValue; /**< Previous value of the report item. */
|
||||
} HID_ReportItem_t;
|
||||
|
||||
|
||||
/** \brief HID Parser Report Size Structure.
|
||||
*
|
||||
* Type define for a report item size information structure, to retain the size of a device's reports by ID.
|
||||
|
|
@ -267,7 +267,7 @@
|
|||
* element in its HID report descriptor.
|
||||
*/
|
||||
} HID_ReportInfo_t;
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Function to process a given HID report returned from an attached device, and store it into a given
|
||||
* \ref HID_ReportInfo_t structure.
|
||||
|
|
@ -285,7 +285,7 @@
|
|||
/** Extracts the given report item's value out of the given HID report and places it into the Value
|
||||
* member of the report item's \ref HID_ReportItem_t structure.
|
||||
*
|
||||
* When called on a report with an item that exists in that report, this copies the report item's Value
|
||||
* When called on a report with an item that exists in that report, this copies the report item's Value
|
||||
* to it's PreviousValue element for easy checking to see if an item's value has changed before processing
|
||||
* a report. If the given item does not exist in the report, the function does not modify the report item's
|
||||
* data.
|
||||
|
|
@ -348,7 +348,7 @@
|
|||
uint8_t ReportID;
|
||||
} HID_StateTable_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -357,3 +357,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __HIDREPORTDATA_H__
|
||||
#define __HIDREPORTDATA_H__
|
||||
|
||||
|
|
@ -107,11 +107,11 @@
|
|||
#define DATA_SIZE_1 0x01
|
||||
#define DATA_SIZE_2 0x02
|
||||
#define DATA_SIZE_4 0x03
|
||||
|
||||
|
||||
#define TYPE_MAIN 0x00
|
||||
#define TYPE_GLOBAL 0x04
|
||||
#define TYPE_LOCAL 0x08
|
||||
|
||||
|
||||
#define TAG_MAIN_INPUT 0x80
|
||||
#define TAG_MAIN_OUTPUT 0x90
|
||||
#define TAG_MAIN_COLLECTION 0xA0
|
||||
|
|
@ -130,12 +130,13 @@
|
|||
#define TAG_GLOBAL_REPORTCOUNT 0x90
|
||||
#define TAG_GLOBAL_PUSH 0xA0
|
||||
#define TAG_GLOBAL_POP 0xB0
|
||||
|
||||
|
||||
#define TAG_LOCAL_USAGE 0x00
|
||||
#define TAG_LOCAL_USAGEMIN 0x10
|
||||
#define TAG_LOCAL_USAGEMAX 0x20
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -68,7 +68,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
|
|
@ -76,7 +76,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
|
|||
else
|
||||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -84,16 +84,16 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
|
|||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
|
||||
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
|
||||
MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
|
||||
MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
|
||||
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
|
||||
MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
|
||||
MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDes
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -127,9 +127,9 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const Current
|
|||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
|
||||
if ((EndpointType == EP_TYPE_BULK) && !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo)
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
|
||||
return PIPE_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
|
|
@ -166,7 +166,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
|
||||
return HOST_SENDCONTROL_DeviceDisconnected;
|
||||
|
||||
|
||||
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
|
||||
if (Pipe_IsReadWriteAllowed())
|
||||
|
|
@ -179,7 +179,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
|
|||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
Pipe_ClearOUT();
|
||||
}
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
|
||||
return HOST_SENDCONTROL_DeviceDisconnected;
|
||||
|
||||
|
||||
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber);
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
@ -198,8 +198,9 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
|
|||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
Pipe_ClearIN();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/MIDI.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Type Defines: */
|
||||
/** \brief MIDI Class Host Mode Configuration and State Structure.
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
{
|
||||
uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe. */
|
||||
bool DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking. */
|
||||
|
||||
|
||||
uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_MIDI_Host_t;
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible error codes returned by the \ref MIDI_Host_ConfigurePipes() function. */
|
||||
enum MIDI_Host_EnumerationFailure_ErrorCodes_t
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
|
||||
MIDI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Host interface configuration routine, to configure a given MIDI host interface instance using the Configuration
|
||||
* Descriptor read from an attached USB device. This function automatically updates the given MIDI Host instance's
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Receives a MIDI event packet from the device.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -193,9 +193,9 @@
|
|||
#if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C)
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -204,3 +204,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -68,7 +68,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
|
|
@ -76,7 +76,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
else
|
||||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -84,16 +84,16 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
|
||||
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
|
||||
MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
|
||||
MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
|
||||
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
|
||||
MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
|
||||
MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor)
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
|
|||
Pipe_Freeze();
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
|
|||
while (!(Pipe_IsINReceived()))
|
||||
{
|
||||
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
|
||||
|
||||
|
||||
if (CurrentFrameNumber != PreviousFrameNumber)
|
||||
{
|
||||
PreviousFrameNumber = CurrentFrameNumber;
|
||||
|
|
@ -197,7 +197,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
|
|||
if (!(TimeoutMSRem--))
|
||||
return PIPE_RWSTREAM_Timeout;
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
|
@ -208,7 +208,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
|
|||
|
||||
return PIPE_RWSTREAM_PipeStalled;
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
|
@ -219,14 +219,14 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
|
|||
|
||||
return PIPE_RWSTREAM_PipeStalled;
|
||||
}
|
||||
|
||||
|
||||
if (USB_HostState == HOST_STATE_Unattached)
|
||||
return PIPE_RWSTREAM_DeviceDisconnected;
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Freeze();
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
|
|||
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
|
|||
return ErrorCode;
|
||||
|
||||
Pipe_ClearOUT();
|
||||
|
||||
|
||||
while (!(Pipe_IsOUTReady()))
|
||||
{
|
||||
if (USB_HostState == HOST_STATE_Unattached)
|
||||
|
|
@ -288,19 +288,19 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
|
|||
|
||||
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),
|
||||
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
|
||||
ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
|
|||
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 0,
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
return USB_Host_SendControlRequest(NULL);
|
||||
|
|
@ -333,7 +333,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 1,
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
|
||||
|
|
@ -341,7 +341,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
*MaxLUNIndex = 0;
|
||||
ErrorCode = HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
|
||||
return HOST_SENDCONTROL_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
|
||||
|
|
@ -370,12 +370,12 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
0x00 // Unused (control)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MS_CommandStatusWrapper_t SCSICommandStatus;
|
||||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, InquiryData)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
return ErrorCode;
|
||||
|
||||
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -406,12 +406,12 @@ uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
0x00 // Unused (control)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MS_CommandStatusWrapper_t SCSICommandStatus;
|
||||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
return ErrorCode;
|
||||
|
||||
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
|
|||
0x00 // Unused (control)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MS_CommandStatusWrapper_t SCSICommandStatus;
|
||||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError)
|
||||
|
|
@ -455,7 +455,7 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
|
|||
|
||||
SwapEndian_n(&DeviceCapacity->Blocks, sizeof(DeviceCapacity->Blocks));
|
||||
SwapEndian_n(&DeviceCapacity->BlockSize, sizeof(DeviceCapacity->BlockSize));
|
||||
|
||||
|
||||
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -487,7 +487,7 @@ uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
|||
0x00 // Unused (control)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MS_CommandStatusWrapper_t SCSICommandStatus;
|
||||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, SenseData)) != PIPE_RWSTREAM_NoError)
|
||||
|
|
@ -524,12 +524,12 @@ uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInter
|
|||
0x00 // Unused (control)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MS_CommandStatusWrapper_t SCSICommandStatus;
|
||||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -617,7 +617,7 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo
|
|||
|
||||
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -625,3 +625,4 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/MassStorage.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
/* Macros: */
|
||||
/** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error. */
|
||||
#define MS_ERROR_LOGICAL_CMD_FAILED 0x80
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** \brief Mass Storage Class Host Mode Configuration and State Structure.
|
||||
*
|
||||
|
|
@ -101,14 +101,14 @@
|
|||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe. */
|
||||
|
||||
|
||||
uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_MS_Host_t;
|
||||
|
||||
|
||||
/** \brief SCSI Device LUN Capacity Structure.
|
||||
*
|
||||
* SCSI capacity structure, to hold the total capacity of the device in both the number
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
|
||||
MS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Host interface configuration routine, to configure a given Mass Storage host interface instance using the
|
||||
* Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass
|
||||
|
|
@ -217,7 +217,7 @@
|
|||
const uint8_t LUNIndex,
|
||||
SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
/** Retrieves the device sense data, indicating the current device state and error codes for the previously
|
||||
* issued command.
|
||||
*
|
||||
|
|
@ -234,7 +234,7 @@
|
|||
const uint8_t LUNIndex,
|
||||
SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
/** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock
|
||||
* the device from removal so that blocks of data on the medium can be read or altered.
|
||||
*
|
||||
|
|
@ -250,7 +250,7 @@
|
|||
uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
const uint8_t LUNIndex,
|
||||
const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Reads blocks of data from the attached Mass Storage device's medium.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -271,7 +271,7 @@
|
|||
const uint8_t Blocks,
|
||||
const uint16_t BlockSize,
|
||||
void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6);
|
||||
|
||||
|
||||
/** Writes blocks of data to the attached Mass Storage device's medium.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -318,22 +318,22 @@
|
|||
|
||||
#define CBW_SIGNATURE 0x43425355UL
|
||||
#define CSW_SIGNATURE 0x53425355UL
|
||||
|
||||
|
||||
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
|
||||
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
|
||||
|
||||
|
||||
#define COMMAND_DATA_TIMEOUT_MS 10000
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
MS_CommandBlockWrapper_t* const SCSICommandBlock,
|
||||
const void* const BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
MS_CommandBlockWrapper_t* const SCSICommandBlock,
|
||||
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -350,3 +350,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -48,7 +48,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
|
||||
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)
|
||||
return PRNT_ENUMERROR_InvalidConfigDescriptor;
|
||||
|
||||
|
||||
while (!(DataINEndpoint) || !(DataOUTEndpoint))
|
||||
{
|
||||
if (!(PrinterInterface) ||
|
||||
|
|
@ -60,15 +60,15 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
{
|
||||
return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
|
||||
PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
|
||||
|
||||
DataINEndpoint = NULL;
|
||||
DataOUTEndpoint = NULL;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
|
|
@ -76,7 +76,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
else
|
||||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -84,16 +84,16 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
|
||||
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
|
||||
PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
|
||||
PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
|
||||
}
|
||||
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
|
||||
{
|
||||
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
|
||||
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
|
||||
PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
|
||||
|
||||
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
|
||||
PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor)
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInte
|
|||
if (PRNTInterfaceInfo->State.AlternateSetting)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
USB_ControlRequest = (USB_Request_Header_t)
|
||||
{
|
||||
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE),
|
||||
|
|
@ -159,13 +159,13 @@ uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInte
|
|||
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = 0,
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -206,12 +206,12 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
|
||||
return PIPE_READYWAIT_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
return PIPE_READYWAIT_NoError;
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
|
|||
}
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -237,12 +237,12 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
|
||||
return PIPE_READYWAIT_DeviceDisconnected;
|
||||
|
||||
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearOUT();
|
||||
|
|
@ -251,9 +251,9 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
|||
return ErrorCode;
|
||||
}
|
||||
|
||||
Pipe_Write_Byte(Data);
|
||||
Pipe_Write_Byte(Data);
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -268,14 +268,14 @@ uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
|||
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
Pipe_ClearOUT();
|
||||
|
||||
|
||||
ErrorCode = Pipe_WaitUntilReady();
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
return ErrorCode;
|
||||
|
|
@ -285,7 +285,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
{
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
|
||||
return 0;
|
||||
|
||||
|
||||
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
|
|||
else
|
||||
{
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@ int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
|
|||
if (!(Pipe_BytesInPipe()))
|
||||
Pipe_ClearIN();
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
return ReceivedByte;
|
||||
|
|
@ -350,33 +350,34 @@ uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
|
|||
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
|
||||
.wLength = sizeof(DeviceIDStringLength),
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if (!(DeviceIDStringLength))
|
||||
{
|
||||
DeviceIDString[0] = 0x00;
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
||||
DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength);
|
||||
|
||||
if (DeviceIDStringLength > BufferSize)
|
||||
DeviceIDStringLength = BufferSize;
|
||||
|
||||
USB_ControlRequest.wLength = DeviceIDStringLength;
|
||||
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2);
|
||||
|
||||
DeviceIDString[DeviceIDStringLength - 2] = 0x00;
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/Printer.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
|
||||
PRNT_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** General management task for a given Printer host class interface, required for the correct operation of
|
||||
* the interface. This should be called frequently in the main program loop, before the master USB management task
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
||||
uint16_t ConfigDescriptorSize,
|
||||
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
/** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called
|
||||
* once the connected device's configuration has been set, to ensure the printer is ready to accept commands.
|
||||
*
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Retrieves the status of the virtual Printer port's inbound status lines. The result can then be masked against the
|
||||
* PRNT_PORTSTATUS_* macros to determine the printer port's status.
|
||||
*
|
||||
|
|
@ -195,12 +195,12 @@
|
|||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
|
||||
void* Buffer,
|
||||
void* Buffer,
|
||||
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
/** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the
|
||||
* byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
|
||||
* \ref PRNT_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* \ref PRNT_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
|
||||
* packed into a single pipe packet, increasing data throughput.
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
|
|
@ -226,8 +226,8 @@
|
|||
*
|
||||
* \return Total number of buffered bytes received from the device.
|
||||
*/
|
||||
uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
|
||||
|
||||
uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
|
||||
|
||||
/** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function
|
||||
* returns a negative value. The \ref PRNT_Host_BytesReceived() function may be queried in advance to determine how many bytes
|
||||
* are currently buffered in the Printer interface's data receive pipe.
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
* \return Next received byte from the device, or a negative value if no data received.
|
||||
*/
|
||||
int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
|
||||
|
||||
|
||||
/** Retrieves the attached printer device's ID string, formatted according to IEEE 1284. This string is sent as a
|
||||
* Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus
|
||||
* the maximum reportable string length is two less than the size given (to accommodate the Unicode string length
|
||||
|
|
@ -268,14 +268,14 @@
|
|||
#define REQ_GetDeviceID 0
|
||||
#define REQ_GetPortStatus 1
|
||||
#define REQ_SoftReset 2
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
|
||||
#if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -284,3 +284,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -64,7 +64,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
|
|||
DCOMP_RNDIS_Host_NextRNDISDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
}
|
||||
|
||||
DataINEndpoint = NULL;
|
||||
DataOUTEndpoint = NULL;
|
||||
|
|
@ -76,15 +76,15 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
|
|||
{
|
||||
return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
|
||||
}
|
||||
|
||||
|
||||
RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
|
||||
|
||||
NotificationEndpoint = NULL;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
|
||||
|
||||
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
|
||||
|
|
@ -99,7 +99,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -141,7 +141,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
|
|||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
if ((CurrentInterface->Class == RNDIS_CONTROL_CLASS) &&
|
||||
(CurrentInterface->SubClass == RNDIS_CONTROL_SUBCLASS) &&
|
||||
(CurrentInterface->Protocol == RNDIS_CONTROL_PROTOCOL))
|
||||
|
|
@ -149,7 +149,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
|
|||
{
|
||||
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
if ((CurrentInterface->Class == RNDIS_DATA_CLASS) &&
|
||||
(CurrentInterface->SubClass == RNDIS_DATA_SUBCLASS) &&
|
||||
(CurrentInterface->Protocol == RNDIS_DATA_PROTOCOL))
|
||||
|
|
@ -167,7 +167,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +177,9 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDe
|
|||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
|
||||
{
|
||||
|
|
@ -223,7 +223,7 @@ static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const R
|
|||
.wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber,
|
||||
.wLength = Length,
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
return USB_Host_SendControlRequest(Buffer);
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
|
|||
|
||||
RNDIS_KeepAlive_Message_t KeepAliveMessage;
|
||||
RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse;
|
||||
|
||||
|
||||
KeepAliveMessage.MessageType = REMOTE_NDIS_KEEPALIVE_MSG;
|
||||
KeepAliveMessage.MessageLength = sizeof(RNDIS_KeepAlive_Message_t);
|
||||
KeepAliveMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
|
||||
|
|
@ -244,13 +244,13 @@ uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
|
|||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &KeepAliveMessageResponse,
|
||||
sizeof(RNDIS_KeepAlive_Complete_t))) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -268,13 +268,13 @@ uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
|
|||
InitMessage.MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
|
||||
InitMessage.MinorVersion = REMOTE_NDIS_VERSION_MINOR;
|
||||
InitMessage.MaxTransferSize = RNDISInterfaceInfo->Config.HostMaxPacketSize;
|
||||
|
||||
|
||||
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &InitMessage,
|
||||
sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &InitMessageResponse,
|
||||
sizeof(RNDIS_Initialize_Complete_t))) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
|
|
@ -283,9 +283,9 @@ uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
|
|||
|
||||
if (InitMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
|
||||
return RNDIS_COMMAND_FAILED;
|
||||
|
||||
|
||||
RNDISInterfaceInfo->State.DeviceMaxPacketSize = InitMessageResponse.MaxTransferSize;
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -301,18 +301,18 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
|
|||
RNDIS_Set_Message_t SetMessage;
|
||||
uint8_t ContiguousBuffer[Length];
|
||||
} SetMessageData;
|
||||
|
||||
|
||||
RNDIS_Set_Complete_t SetMessageResponse;
|
||||
|
||||
|
||||
SetMessageData.SetMessage.MessageType = REMOTE_NDIS_SET_MSG;
|
||||
SetMessageData.SetMessage.MessageLength = sizeof(RNDIS_Set_Message_t) + Length;
|
||||
SetMessageData.SetMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
|
||||
|
||||
|
||||
SetMessageData.SetMessage.Oid = Oid;
|
||||
SetMessageData.SetMessage.InformationBufferLength = Length;
|
||||
SetMessageData.SetMessage.InformationBufferOffset = (sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
|
||||
SetMessageData.SetMessage.DeviceVcHandle = 0;
|
||||
|
||||
|
||||
memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length);
|
||||
|
||||
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &SetMessageData,
|
||||
|
|
@ -320,7 +320,7 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
|
|||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &SetMessageResponse,
|
||||
sizeof(RNDIS_Set_Complete_t))) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
|
|
@ -329,7 +329,7 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
|
|||
|
||||
if (SetMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
|
||||
return RNDIS_COMMAND_FAILED;
|
||||
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInt
|
|||
QueryMessage.MessageType = REMOTE_NDIS_QUERY_MSG;
|
||||
QueryMessage.MessageLength = sizeof(RNDIS_Query_Message_t);
|
||||
QueryMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
|
||||
|
||||
|
||||
QueryMessage.Oid = Oid;
|
||||
QueryMessage.InformationBufferLength = 0;
|
||||
QueryMessage.InformationBufferOffset = 0;
|
||||
|
|
@ -362,7 +362,7 @@ uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInt
|
|||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &QueryMessageResponseData,
|
||||
sizeof(QueryMessageResponseData))) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
|
|
@ -385,11 +385,11 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
|
|||
return false;
|
||||
|
||||
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
|
||||
|
||||
|
||||
Pipe_Unfreeze();
|
||||
PacketWaiting = Pipe_IsINReceived();
|
||||
PacketWaiting = Pipe_IsINReceived();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PacketWaiting;
|
||||
}
|
||||
|
||||
|
|
@ -404,19 +404,19 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
|
|||
|
||||
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
if (Pipe_IsINReceived())
|
||||
Pipe_ClearIN();
|
||||
|
||||
|
||||
*PacketLength = 0;
|
||||
Pipe_Freeze();
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
RNDIS_Packet_Message_t DeviceMessage;
|
||||
|
||||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),
|
||||
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
{
|
||||
|
|
@ -424,17 +424,17 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
|
|||
}
|
||||
|
||||
*PacketLength = (uint16_t)DeviceMessage.DataLength;
|
||||
|
||||
|
||||
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
|
||||
NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
Pipe_Read_Stream_LE(Buffer, *PacketLength, NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
Pipe_ClearIN();
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +454,7 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
|
|||
DeviceMessage.MessageLength = (sizeof(RNDIS_Packet_Message_t) + PacketLength);
|
||||
DeviceMessage.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
|
||||
DeviceMessage.DataLength = PacketLength;
|
||||
|
||||
|
||||
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
|
@ -468,8 +468,9 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
|
|||
Pipe_ClearOUT();
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -89,9 +89,9 @@
|
|||
uint8_t DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking. */
|
||||
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
|
||||
uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
|
||||
bool NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking. */
|
||||
|
||||
|
||||
uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
|
|
@ -103,20 +103,20 @@
|
|||
* Configured state.
|
||||
*/
|
||||
uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */
|
||||
|
||||
|
||||
uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe. */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
|
||||
uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
|
||||
|
||||
uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */
|
||||
|
||||
|
||||
uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
|
||||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_RNDIS_Host_t;
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */
|
||||
enum RNDIS_Host_EnumerationFailure_ErrorCodes_t
|
||||
|
|
@ -211,7 +211,7 @@
|
|||
* \return Boolean true if a packet is waiting to be read in by the host, false otherwise.
|
||||
*/
|
||||
bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
||||
/** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave
|
||||
* only the packet contents for processing by the host in the nominated buffer.
|
||||
*
|
||||
|
|
@ -268,7 +268,7 @@
|
|||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)
|
||||
static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
|
||||
static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
|
||||
void* Buffer,
|
||||
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
|
@ -291,3 +291,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
USB_Descriptor_Interface_t* StillImageInterface = NULL;
|
||||
|
||||
memset(&SIInterfaceInfo->State, 0x00, sizeof(SIInterfaceInfo->State));
|
||||
|
||||
|
||||
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
|
||||
return SI_ENUMERROR_InvalidConfigDescriptor;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
}
|
||||
|
||||
StillImageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
|
||||
|
||||
|
||||
DataINEndpoint = NULL;
|
||||
DataOUTEndpoint = NULL;
|
||||
EventsEndpoint = NULL;
|
||||
|
|
@ -85,7 +85,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
DataOUTEndpoint = EndpointData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
|
||||
{
|
||||
if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber)
|
||||
|
|
@ -113,8 +113,8 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
|
||||
SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;
|
||||
SIInterfaceInfo->State.IsActive = true;
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor)
|
|||
return DESCRIPTOR_SEARCH_Found;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_NotFound;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
|
|||
{
|
||||
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
|
||||
USB_Descriptor_Endpoint_t);
|
||||
|
||||
|
||||
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
|
||||
|
||||
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
|
||||
|
|
@ -166,7 +166,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
SI_PIMA_Container_t* const PIMAHeader)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
|
||||
return PIPE_RWSTREAM_DeviceDisconnected;
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
|
||||
|
||||
if (ParamBytes)
|
||||
|
|
@ -186,10 +186,10 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
||||
Pipe_ClearOUT();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -204,11 +204,11 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
|
||||
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
while (!(Pipe_IsINReceived()))
|
||||
{
|
||||
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
|
||||
|
||||
|
||||
if (CurrentFrameNumber != PreviousFrameNumber)
|
||||
{
|
||||
PreviousFrameNumber = CurrentFrameNumber;
|
||||
|
|
@ -216,7 +216,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
if (!(TimeoutMSRem--))
|
||||
return PIPE_RWSTREAM_Timeout;
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
|
@ -236,25 +236,25 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataINPipeNumber);
|
||||
return PIPE_RWSTREAM_PipeStalled;
|
||||
}
|
||||
|
||||
|
||||
if (USB_HostState == HOST_STATE_Unattached)
|
||||
return PIPE_RWSTREAM_DeviceDisconnected;
|
||||
}
|
||||
|
||||
|
||||
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock)
|
||||
{
|
||||
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
|
||||
|
||||
if (ParamBytes)
|
||||
Pipe_Read_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
Pipe_ClearIN();
|
||||
}
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -269,12 +269,12 @@ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
|
||||
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
|
||||
|
||||
Pipe_ClearOUT();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -306,12 +306,12 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
|
||||
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if (Pipe_BytesInPipe())
|
||||
IsEventReceived = true;
|
||||
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return IsEventReceived;
|
||||
}
|
||||
|
||||
|
|
@ -325,12 +325,12 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
|
|||
|
||||
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(SI_PIMA_Container_t), NO_STREAM_CALLBACK);
|
||||
|
||||
|
||||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
|
|
@ -351,16 +351,16 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
.Code = 0x1002,
|
||||
.Params = {1},
|
||||
};
|
||||
|
||||
|
||||
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
return SI_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
|
||||
SIInterfaceInfo->State.IsSessionOpen = true;
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
|
|
@ -380,10 +380,10 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
.Code = 0x1003,
|
||||
.Params = {1},
|
||||
};
|
||||
|
||||
|
||||
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -411,9 +411,9 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
|||
.Type = SI_PIMA_CONTAINER_CommandBlock,
|
||||
.Code = Operation,
|
||||
};
|
||||
|
||||
|
||||
memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams);
|
||||
|
||||
|
||||
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -433,8 +433,9 @@ uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
|||
|
||||
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
|
||||
return SI_ERROR_LOGICAL_CMD_FAILED;
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
/* Includes: */
|
||||
#include "../../USB.h"
|
||||
#include "../Common/StillImage.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
#if !defined(__INCLUDE_FROM_SI_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Error code for some Still Image Host functions, indicating a logical (and not hardware) error. */
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe. */
|
||||
bool DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking. */
|
||||
|
||||
uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
|
||||
uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
|
||||
bool EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking. */
|
||||
} Config; /**< Config data for the USB class interface within the device. All elements in this section
|
||||
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe. */
|
||||
uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe. */
|
||||
uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe. */
|
||||
|
||||
|
||||
bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */
|
||||
uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */
|
||||
} State; /**< State data for the USB class interface within the device. All elements in this section
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
* the interface is enumerated.
|
||||
*/
|
||||
} USB_ClassInfo_SI_Host_t;
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible error codes returned by the \ref SI_Host_ConfigurePipes() function. */
|
||||
enum SI_Host_EnumerationFailure_ErrorCodes_t
|
||||
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands
|
||||
* are issued to the device. Only one session can be open at the one time.
|
||||
*
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
* call will fail.
|
||||
*
|
||||
|
|
@ -186,7 +186,7 @@
|
|||
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
|
||||
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
|
||||
* or without parameters.
|
||||
*
|
||||
|
|
@ -203,7 +203,7 @@
|
|||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
|
||||
*
|
||||
*
|
||||
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
|
||||
* call will fail.
|
||||
*
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
|
||||
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
|
||||
* transfer beyond the regular PIMA command block parameters.
|
||||
*
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
|
||||
void* Buffer,
|
||||
const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
/** General management task for a given Still Image host class interface, required for the correct operation of the
|
||||
* interface. This should be called frequently in the main program loop, before the master USB management task
|
||||
|
|
@ -302,7 +302,7 @@
|
|||
static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
|
||||
{
|
||||
(void)SIInterfaceInfo;
|
||||
}
|
||||
}
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
|
|
@ -312,14 +312,14 @@
|
|||
#define STILL_IMAGE_PROTOCOL 0x01
|
||||
|
||||
#define COMMAND_DATA_TIMEOUT_MS 10000
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_SI_CLASS_HOST_C)
|
||||
static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -328,3 +328,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
/* Macros: */
|
||||
#define __INCLUDE_FROM_MIDI_DRIVER
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
|
@ -80,7 +80,8 @@
|
|||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/MIDI.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
/* Macros: */
|
||||
#define __INCLUDE_FROM_MS_DRIVER
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
|
@ -73,11 +73,12 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "Device/MassStorage.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/MassStorage.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
||||
#if defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
|
@ -74,7 +74,8 @@
|
|||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/Printer.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
/* Macros: */
|
||||
#define __INCLUDE_FROM_RNDIS_DRIVER
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
|
@ -73,11 +73,12 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "Device/RNDIS.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/RNDIS.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -61,10 +61,10 @@
|
|||
/* Macros: */
|
||||
#define __INCLUDE_FROM_SI_DRIVER
|
||||
#define __INCLUDE_FROM_USB_DRIVER
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
|
||||
#if defined(NO_STREAM_CALLBACKS)
|
||||
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
|
||||
#endif
|
||||
|
|
@ -72,7 +72,8 @@
|
|||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "Host/StillImage.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -46,7 +46,7 @@ uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const
|
|||
.wIndex = 0,
|
||||
.wLength = sizeof(USB_Descriptor_Configuration_Header_t),
|
||||
};
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful)
|
||||
|
|
@ -56,15 +56,15 @@ uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const
|
|||
|
||||
if (*ConfigSizePtr > BufferSize)
|
||||
return HOST_GETCONFIG_BuffOverflow;
|
||||
|
||||
|
||||
USB_ControlRequest.wLength = *ConfigSizePtr;
|
||||
|
||||
|
||||
if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration)
|
||||
return HOST_GETCONFIG_InvalidData;
|
||||
|
||||
|
||||
return HOST_GETCONFIG_Successful;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -75,7 +75,7 @@ void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
|
|||
{
|
||||
while (*BytesRem)
|
||||
{
|
||||
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
|
||||
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
|
||||
|
||||
if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type)
|
||||
return;
|
||||
|
|
@ -109,22 +109,22 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
|
|||
const uint8_t AfterType)
|
||||
{
|
||||
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, AfterType);
|
||||
|
||||
|
||||
if (*BytesRem)
|
||||
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);
|
||||
}
|
||||
|
||||
|
||||
uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrConfigLoc, ConfigComparatorPtr_t const ComparatorRoutine)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
while (*BytesRem)
|
||||
{
|
||||
uint8_t* PrevDescLoc = *CurrConfigLoc;
|
||||
uint16_t PrevBytesRem = *BytesRem;
|
||||
|
||||
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
|
||||
|
||||
|
||||
if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound)
|
||||
{
|
||||
if (ErrorCode == DESCRIPTOR_SEARCH_Fail)
|
||||
|
|
@ -132,10 +132,11 @@ uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrCon
|
|||
*CurrConfigLoc = PrevDescLoc;
|
||||
*BytesRem = PrevBytesRem;
|
||||
}
|
||||
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -52,12 +52,12 @@
|
|||
|
||||
/* Includes: */
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "HostStandardReq.h"
|
||||
#include "USBMode.h"
|
||||
#include "StdDescriptors.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -67,8 +67,8 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
|
||||
* with the EP_TYPE_* masks to determine the exact type of the endpoint.
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
* values can be accessed in the \ref USB_DescriptorTypes_t enum.
|
||||
*/
|
||||
#define DESCRIPTOR_TYPE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).Type
|
||||
|
||||
|
||||
/** Returns the descriptor's size, expressed as the 8-bit value indicating the number of bytes. */
|
||||
#define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).Size
|
||||
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
* \see \ref USB_GetNextDescriptorComp function for more details.
|
||||
*/
|
||||
typedef uint8_t (* ConfigComparatorPtr_t)(void*);
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */
|
||||
enum USB_Host_GetConfigDescriptor_ErrorCodes_t
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
*/
|
||||
HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data. */
|
||||
};
|
||||
|
||||
|
||||
/** Enum for return values of a descriptor comparator function. */
|
||||
enum DSearch_Return_ErrorCodes_t
|
||||
{
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
|
||||
DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Retrieves the configuration descriptor data from an attached device via a standard request into a buffer,
|
||||
* including validity and size checking to prevent a buffer overflow.
|
||||
|
|
@ -266,16 +266,16 @@
|
|||
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
|
||||
*/
|
||||
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
|
||||
void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
|
||||
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
|
||||
void** CurrConfigLoc)
|
||||
{
|
||||
uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;
|
||||
|
||||
|
||||
*CurrConfigLoc = ((uint8_t*)*CurrConfigLoc) + CurrDescriptorSize;
|
||||
*BytesRem -= CurrDescriptorSize;
|
||||
}
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
@ -284,3 +284,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -50,12 +50,12 @@ void USB_Device_ProcessControlRequest(void)
|
|||
{
|
||||
bool RequestHandled = false;
|
||||
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
|
||||
|
||||
|
||||
for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
|
||||
*(RequestHeader++) = Endpoint_Read_Byte();
|
||||
|
||||
|
||||
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
|
||||
|
||||
|
||||
switch (USB_ControlRequest.bRequest)
|
||||
{
|
||||
case REQ_GetStatus:
|
||||
|
|
@ -92,7 +92,7 @@ void USB_Device_ProcessControlRequest(void)
|
|||
USB_Device_GetDescriptor();
|
||||
RequestHandled = true;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case REQ_GetConfiguration:
|
||||
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
|
||||
|
|
@ -114,11 +114,11 @@ void USB_Device_ProcessControlRequest(void)
|
|||
|
||||
if (!(RequestHandled))
|
||||
EVENT_USB_Device_UnhandledControlRequest();
|
||||
|
||||
|
||||
if (Endpoint_IsSETUPReceived())
|
||||
{
|
||||
Endpoint_StallTransaction();
|
||||
Endpoint_ClearSETUP();
|
||||
Endpoint_ClearSETUP();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,9 +129,9 @@ static void USB_Device_SetAddress(void)
|
|||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
{
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
|
||||
Endpoint_ClearStatusStage();
|
||||
|
||||
|
||||
while (!(Endpoint_IsINReady()));
|
||||
|
||||
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
|
||||
|
|
@ -157,7 +157,7 @@ static void USB_Device_SetConfiguration(void)
|
|||
#else
|
||||
uint8_t MemoryAddressSpace;
|
||||
#endif
|
||||
|
||||
|
||||
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
|
||||
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
||||
, &MemoryAddressSpace
|
||||
|
|
@ -166,7 +166,7 @@ static void USB_Device_SetConfiguration(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (MemoryAddressSpace == MEMSPACE_FLASH)
|
||||
{
|
||||
if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations)))
|
||||
|
|
@ -183,7 +183,7 @@ static void USB_Device_SetConfiguration(void)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
|
||||
|
|
@ -225,7 +225,7 @@ static void USB_Device_GetInternalSerialDescriptor(void)
|
|||
|
||||
SignatureDescriptor.Header.Type = DTYPE_String;
|
||||
SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);
|
||||
|
||||
|
||||
uint8_t SigReadAddress = 0x0E;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
|
|
@ -233,17 +233,17 @@ static void USB_Device_GetInternalSerialDescriptor(void)
|
|||
for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)
|
||||
{
|
||||
uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);
|
||||
|
||||
|
||||
if (SerialCharNum & 0x01)
|
||||
{
|
||||
SerialByte >>= 4;
|
||||
SigReadAddress++;
|
||||
}
|
||||
|
||||
|
||||
SignatureDescriptor.UnicodeString[SerialCharNum] = USB_Device_NibbleToASCII(SerialByte);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));
|
||||
|
|
@ -256,11 +256,11 @@ static void USB_Device_GetDescriptor(void)
|
|||
{
|
||||
const void* DescriptorPointer;
|
||||
uint16_t DescriptorSize;
|
||||
|
||||
|
||||
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
||||
uint8_t DescriptorAddressSpace;
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
|
||||
if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL))
|
||||
{
|
||||
|
|
@ -268,7 +268,7 @@ static void USB_Device_GetDescriptor(void)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
|
||||
&DescriptorPointer
|
||||
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
||||
|
|
@ -278,7 +278,7 @@ static void USB_Device_GetDescriptor(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_ClearSETUP();
|
||||
|
||||
#if defined(USE_RAM_DESCRIPTORS)
|
||||
|
|
@ -286,14 +286,14 @@ static void USB_Device_GetDescriptor(void)
|
|||
#elif defined(USE_EEPROM_DESCRIPTORS)
|
||||
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
|
||||
#elif defined(USE_FLASH_DESCRIPTORS)
|
||||
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
|
||||
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
|
||||
#else
|
||||
if (DescriptorAddressSpace == MEMSPACE_FLASH)
|
||||
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
|
||||
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
|
||||
else if (DescriptorAddressSpace == MEMSPACE_EEPROM)
|
||||
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
|
||||
else
|
||||
Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
|
||||
Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
|
||||
#endif
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
|
|
@ -305,14 +305,14 @@ static void USB_Device_GetStatus(void)
|
|||
|
||||
switch (USB_ControlRequest.bmRequestType)
|
||||
{
|
||||
#if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
#if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
|
||||
#if !defined(NO_DEVICE_SELF_POWER)
|
||||
if (USB_CurrentlySelfPowered)
|
||||
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
|
||||
#endif
|
||||
|
||||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
if (USB_RemoteWakeupEnabled)
|
||||
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
|
||||
#endif
|
||||
|
|
@ -324,7 +324,7 @@ static void USB_Device_GetStatus(void)
|
|||
|
||||
CurrentStatus = Endpoint_IsStalled();
|
||||
|
||||
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
||||
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
|
@ -336,7 +336,7 @@ static void USB_Device_GetStatus(void)
|
|||
|
||||
Endpoint_Write_Word_LE(CurrentStatus);
|
||||
Endpoint_ClearIN();
|
||||
|
||||
|
||||
Endpoint_ClearStatusStage();
|
||||
}
|
||||
|
||||
|
|
@ -344,28 +344,28 @@ static void USB_Device_ClearSetFeature(void)
|
|||
{
|
||||
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
|
||||
{
|
||||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
case REQREC_DEVICE:
|
||||
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
|
||||
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
|
||||
else
|
||||
return;
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
#endif
|
||||
#if !defined(CONTROL_ONLY_DEVICE)
|
||||
case REQREC_ENDPOINT:
|
||||
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT)
|
||||
{
|
||||
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
|
||||
|
||||
|
||||
if (EndpointIndex == ENDPOINT_CONTROLEP)
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(EndpointIndex);
|
||||
|
||||
if (Endpoint_IsEnabled())
|
||||
{
|
||||
{
|
||||
if (USB_ControlRequest.bRequest == REQ_SetFeature)
|
||||
{
|
||||
Endpoint_StallTransaction();
|
||||
|
|
@ -375,10 +375,10 @@ static void USB_Device_ClearSetFeature(void)
|
|||
Endpoint_ClearStall();
|
||||
Endpoint_ResetFIFO(EndpointIndex);
|
||||
Endpoint_ResetDataToggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
@ -393,3 +393,4 @@ static void USB_Device_ClearSetFeature(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#include <util/atomic.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "StdDescriptors.h"
|
||||
#include "Events.h"
|
||||
#include "StdRequestType.h"
|
||||
|
|
@ -64,13 +64,13 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if defined(USE_SINGLE_DEVICE_CONFIGURATION)
|
||||
#define FIXED_NUM_CONFIGURATIONS 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Enums: */
|
||||
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
||||
/** Enum for the possible descriptor memory spaces, for the MemoryAddressSpace of the
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Global Variables: */
|
||||
/** Indicates the currently set configuration number of the device. USB devices may have several
|
||||
* different configurations which the host can select between; this indicates the currently selected
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
* \ingroup Group_Device
|
||||
*/
|
||||
extern uint8_t USB_ConfigurationNumber;
|
||||
|
||||
|
||||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
/** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
|
||||
* flag is cleared, the device should not issue remote wakeup events to the host.
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
* \n\n
|
||||
*
|
||||
* \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
|
||||
* this global and the underlying management code can be disabled by defining the
|
||||
* this global and the underlying management code can be disabled by defining the
|
||||
* NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via
|
||||
* the -D switch.
|
||||
*
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
*/
|
||||
extern bool USB_RemoteWakeupEnabled;
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(NO_DEVICE_SELF_POWER)
|
||||
/** Indicates if the device is currently being powered by its own power supply, rather than being
|
||||
* powered by the host's USB supply. This flag should remain cleared if the device does not
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
*/
|
||||
extern bool USB_CurrentlySelfPowered;
|
||||
#endif
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
#if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
|
||||
|
|
@ -138,10 +138,10 @@
|
|||
#elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)
|
||||
#error Only one of the USE_*_DESCRIPTORS modes should be selected.
|
||||
#endif
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
void USB_Device_ProcessControlRequest(void);
|
||||
|
||||
|
||||
#if defined(__INCLUDE_FROM_DEVICESTDREQ_C)
|
||||
static void USB_Device_SetAddress(void);
|
||||
static void USB_Device_SetConfiguration(void);
|
||||
|
|
@ -149,11 +149,11 @@
|
|||
static void USB_Device_GetDescriptor(void);
|
||||
static void USB_Device_GetStatus(void);
|
||||
static void USB_Device_ClearSetFeature(void);
|
||||
|
||||
|
||||
#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
|
||||
static char USB_Device_NibbleToASCII(uint8_t Nibble) ATTR_ALWAYS_INLINE;
|
||||
static void USB_Device_GetInternalSerialDescriptor(void);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -161,5 +161,6 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -230,4 +230,4 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
|
|||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
|
||||
#include "Template/Template_Endpoint_Control_R.c"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -522,3 +522,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -36,3 +36,4 @@ void USB_Event_Stub(void)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -64,13 +64,13 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __USBEVENTS_H__
|
||||
#define __USBEVENTS_H__
|
||||
|
||||
/* Includes: */
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "USBMode.h"
|
||||
|
||||
|
|
@ -83,8 +83,8 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Pseudo-Functions for Doxygen: */
|
||||
#if !defined(__INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
|
||||
/** Event for USB mode pin level change. This event fires when the USB interface is set to dual role
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
* \ref Group_USBManagement documentation).
|
||||
*/
|
||||
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
|
||||
|
||||
|
||||
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
|
||||
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
|
||||
* the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB
|
||||
|
|
@ -141,11 +141,11 @@
|
|||
* \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
|
||||
*/
|
||||
void EVENT_USB_Host_DeviceUnattached(void);
|
||||
|
||||
|
||||
/** Event for USB device enumeration failure. This event fires when a the USB interface is
|
||||
* in host mode, and an attached USB device has failed to enumerate completely.
|
||||
*
|
||||
* \param[in] ErrorCode Error code indicating the failure reason, a value in
|
||||
* \param[in] ErrorCode Error code indicating the failure reason, a value in
|
||||
* \ref USB_Host_EnumerationErrorCodes_t.
|
||||
*
|
||||
* \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the
|
||||
|
|
@ -327,17 +327,17 @@
|
|||
*/
|
||||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
#endif
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_EVENTS_C)
|
||||
void USB_Event_Stub(void) ATTR_CONST;
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_BOTH)
|
||||
void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
|
||||
void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
|
||||
|
|
@ -366,7 +366,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -45,7 +45,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
uint16_t DataLen = USB_ControlRequest.wLength;
|
||||
|
||||
USB_Host_ResumeBus();
|
||||
|
||||
|
||||
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
Pipe_Write_Byte(*(HeaderStream++));
|
||||
|
||||
Pipe_ClearSETUP();
|
||||
|
||||
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful)
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST)
|
||||
{
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_IN);
|
||||
|
||||
|
||||
if (DataStream != NULL)
|
||||
{
|
||||
while (DataLen)
|
||||
|
|
@ -79,10 +79,10 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
DataLen = 0;
|
||||
|
||||
|
||||
while (Pipe_BytesInPipe() && DataLen)
|
||||
{
|
||||
*(DataStream++) = Pipe_Read_Byte();
|
||||
|
|
@ -96,7 +96,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
||||
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
|
||||
goto End_Of_Control_Send;
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
if (DataStream != NULL)
|
||||
{
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
|
||||
Pipe_Unfreeze();
|
||||
Pipe_Unfreeze();
|
||||
|
||||
while (DataLen)
|
||||
{
|
||||
|
|
@ -118,11 +118,11 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
goto End_Of_Control_Send;
|
||||
|
||||
while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
|
||||
{
|
||||
{
|
||||
Pipe_Write_Byte(*(DataStream++));
|
||||
DataLen--;
|
||||
}
|
||||
|
||||
|
||||
Pipe_ClearOUT();
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
|
||||
Pipe_Freeze();
|
||||
}
|
||||
|
||||
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_IN);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
|
|||
|
||||
End_Of_Control_Send:
|
||||
Pipe_Freeze();
|
||||
|
||||
|
||||
if (BusSuspended)
|
||||
USB_Host_SuspendBus();
|
||||
|
||||
|
|
@ -155,11 +155,11 @@ End_Of_Control_Send:
|
|||
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
|
||||
{
|
||||
#if (USB_HOST_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
#endif
|
||||
|
||||
|
||||
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
|
||||
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
|
||||
((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady())))
|
||||
|
|
@ -168,7 +168,7 @@ static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
|
|||
|
||||
if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
|
||||
if (!(TimeoutCounter--))
|
||||
return HOST_SENDCONTROL_SoftwareTimeOut;
|
||||
}
|
||||
|
|
@ -177,3 +177,4 @@ static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -44,11 +44,11 @@
|
|||
/* Includes: */
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "USBMode.h"
|
||||
#include "StdRequestType.h"
|
||||
#include "../LowLevel/USBController.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Enums: */
|
||||
/** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
*/
|
||||
HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device,
|
||||
* and transfers the data stored in the buffer to the device, or from the device to the buffer
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
uint8_t USB_Host_SendControlRequest(void* const BufferPtr);
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Enums: */
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
USB_HOST_WAITFOR_InReceived,
|
||||
USB_HOST_WAITFOR_OutReady,
|
||||
};
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(__INCLUDE_FROM_HOSTSTDREQ_C)
|
||||
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType);
|
||||
|
|
@ -113,5 +113,6 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -193,3 +193,4 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
|
|||
#include "Template/Template_Pipe_RW.c"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -296,3 +296,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __USBDESCRIPTORS_H__
|
||||
#define __USBDESCRIPTORS_H__
|
||||
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#include "../../../Common/Common.h"
|
||||
#include "USBMode.h"
|
||||
#include "Events.h"
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#include "../LowLevel/Device.h"
|
||||
#endif
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
#else
|
||||
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
|
||||
#endif
|
||||
|
||||
|
||||
/** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */
|
||||
#define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)
|
||||
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
* Should be used in string descriptor's headers for giving the string descriptor's byte length.
|
||||
*/
|
||||
#define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1))
|
||||
|
||||
|
||||
/** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded
|
||||
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
|
||||
* standard device descriptor.
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
* EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from
|
||||
* host to device).
|
||||
*/
|
||||
#define ENDPOINT_DESCRIPTOR_DIR_OUT 0x00
|
||||
#define ENDPOINT_DESCRIPTOR_DIR_OUT 0x00
|
||||
|
||||
/** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
|
||||
* descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
* \see The USB specification for more details on the possible Endpoint attributes.
|
||||
*/
|
||||
#define ENDPOINT_ATTR_SYNC (3 << 2)
|
||||
|
||||
|
||||
/** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
|
||||
* Attributes value to indicate that the specified endpoint is used for data transfers.
|
||||
*
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
* \see The USB specification for more details on the possible Endpoint usage attributes.
|
||||
*/
|
||||
#define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4)
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible standard descriptor types, as given in each descriptor's header. */
|
||||
enum USB_DescriptorTypes_t
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
* given by the specific class.
|
||||
*/
|
||||
} USB_Descriptor_Header_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Descriptor Header (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
|
||||
|
|
@ -246,7 +246,7 @@
|
|||
* given by the specific class.
|
||||
*/
|
||||
} USB_StdDescriptor_Header_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Device Descriptor (LUFA naming conventions).
|
||||
*
|
||||
* Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each
|
||||
|
|
@ -262,13 +262,13 @@
|
|||
uint8_t Class; /**< USB device class. */
|
||||
uint8_t SubClass; /**< USB device subclass. */
|
||||
uint8_t Protocol; /**< USB device protocol. */
|
||||
|
||||
|
||||
uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */
|
||||
|
||||
|
||||
uint16_t VendorID; /**< Vendor ID for the USB product. */
|
||||
uint16_t ProductID; /**< Unique product ID for the USB product. */
|
||||
uint16_t ReleaseNumber; /**< Product release (version) number. */
|
||||
|
||||
|
||||
uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The
|
||||
* host will request this string via a separate
|
||||
* control request for the string descriptor.
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
|
||||
|
||||
|
||||
uint16_t TotalConfigurationSize; /**< Size of the configuration descriptor header,
|
||||
* and all sub descriptors inside the configuration.
|
||||
*/
|
||||
|
|
@ -362,17 +362,17 @@
|
|||
|
||||
uint8_t ConfigurationNumber; /**< Configuration index of the current configuration. */
|
||||
uint8_t ConfigurationStrIndex; /**< Index of a string descriptor describing the configuration. */
|
||||
|
||||
|
||||
uint8_t ConfigAttributes; /**< Configuration attributes, comprised of a mask of zero or
|
||||
* more USB_CONFIG_ATTR_* masks.
|
||||
*/
|
||||
|
||||
|
||||
uint8_t MaxPowerConsumption; /**< Maximum power consumption of the device while in the
|
||||
* current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
|
||||
* macro.
|
||||
*/
|
||||
} USB_Descriptor_Configuration_Header_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Configuration Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names
|
||||
|
|
@ -419,14 +419,14 @@
|
|||
* selected by the host.
|
||||
*/
|
||||
uint8_t TotalEndpoints; /**< Total number of endpoints in the interface. */
|
||||
|
||||
|
||||
uint8_t Class; /**< Interface class ID. */
|
||||
uint8_t SubClass; /**< Interface subclass ID. */
|
||||
uint8_t Protocol; /**< Interface protocol ID. */
|
||||
|
||||
uint8_t InterfaceStrIndex; /**< Index of the string descriptor describing the interface. */
|
||||
} USB_Descriptor_Interface_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Interface Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names
|
||||
|
|
@ -471,7 +471,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
|
||||
|
||||
|
||||
uint8_t FirstInterfaceIndex; /**< Index of the first associated interface. */
|
||||
uint8_t TotalInterfaces; /**< Total number of associated interfaces. */
|
||||
|
||||
|
|
@ -483,7 +483,7 @@
|
|||
* interface association.
|
||||
*/
|
||||
} USB_Descriptor_Interface_Association_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given
|
||||
|
|
@ -538,7 +538,7 @@
|
|||
* or ISOCHRONOUS type.
|
||||
*/
|
||||
} USB_Descriptor_Endpoint_t;
|
||||
|
||||
|
||||
/** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions).
|
||||
*
|
||||
* Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given
|
||||
|
|
@ -553,10 +553,10 @@
|
|||
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a
|
||||
* value given by the specific class.
|
||||
*/
|
||||
uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
|
||||
uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
|
||||
* configuration, including direction mask.
|
||||
*/
|
||||
uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
|
||||
uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
|
||||
* and attributes (ENDPOINT_ATTR_*) masks.
|
||||
*/
|
||||
uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
|
||||
|
|
@ -583,7 +583,7 @@
|
|||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
|
||||
|
||||
|
||||
wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively,
|
||||
* string language IDs). If normal ASCII characters are
|
||||
* to be used, they must be added as an array of characters
|
||||
|
|
@ -636,12 +636,13 @@
|
|||
#define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10)
|
||||
#define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
* \note This file should not be included directly. It is automatically included as needed by the USB driver
|
||||
* dispatch header located in LUFA/Drivers/USB/USB.h.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_StdRequest Standard USB Requests
|
||||
*
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for the request type parameter, to indicate the direction of the request data (Host to Device
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
* \see \ref CONTROL_REQTYPE_RECIPIENT macro.
|
||||
*/
|
||||
#define REQREC_OTHER (3 << 0)
|
||||
|
||||
|
||||
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
|
||||
* request this indicates that an endpoint (whose address is given elsewhere in the request
|
||||
* should have its stall condition cleared. If used in a similar manner inside a Set Feature
|
||||
|
|
@ -229,3 +229,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
* \note This file should not be included directly. It is automatically included as needed by the USB driver
|
||||
* dispatch header located in LUFA/Drivers/USB/USB.h.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks
|
||||
*
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __STREAMCALLBACK_H__
|
||||
#define __STREAMCALLBACK_H__
|
||||
|
||||
|
|
@ -58,14 +58,14 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
|
||||
* call has no callback function to be called between USB packets.
|
||||
*/
|
||||
#define NO_STREAM_CALLBACK NULL
|
||||
|
||||
|
||||
/* Enums: */
|
||||
/** Enum for the possible error return codes of a stream callback function. */
|
||||
enum StreamCallback_Return_ErrorCodes_t
|
||||
|
|
@ -80,7 +80,8 @@
|
|||
* are to be used as the callback parameter of the stream functions.
|
||||
*/
|
||||
typedef uint8_t (* const StreamCallbackPtr_t)(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
|
|||
uint16_t Length)
|
||||
{
|
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
||||
|
||||
|
||||
if (!(Length))
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
|
||||
while (Length)
|
||||
{
|
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
||||
|
|
@ -16,7 +16,7 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
|
|||
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||
else if (Endpoint_IsSETUPReceived())
|
||||
return ENDPOINT_RWCSTREAM_HostAborted;
|
||||
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
while (Length && Endpoint_BytesInEndpoint())
|
||||
|
|
@ -24,11 +24,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
|
|||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
Length--;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (!(Endpoint_IsINReady()))
|
||||
{
|
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
||||
|
|
@ -38,11 +38,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
|
|||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
||||
return ENDPOINT_RWCSTREAM_BusSuspended;
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWCSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
||||
#undef TEMPLATE_BUFFER_OFFSET
|
||||
#undef TEMPLATE_FUNC_NAME
|
||||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
|
|||
{
|
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
||||
bool LastPacketFull = false;
|
||||
|
||||
|
||||
if (Length > USB_ControlRequest.wLength)
|
||||
Length = USB_ControlRequest.wLength;
|
||||
else if (!(Length))
|
||||
|
|
@ -12,7 +12,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
|
|||
while (Length || LastPacketFull)
|
||||
{
|
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
||||
|
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
||||
|
|
@ -25,19 +25,19 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
|
|||
if (Endpoint_IsINReady())
|
||||
{
|
||||
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
|
||||
|
||||
|
||||
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
|
||||
{
|
||||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
Length--;
|
||||
BytesInEndpoint++;
|
||||
}
|
||||
|
||||
|
||||
LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (!(Endpoint_IsOUTReceived()))
|
||||
{
|
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
||||
|
|
@ -53,4 +53,4 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
|
|||
|
||||
#undef TEMPLATE_BUFFER_OFFSET
|
||||
#undef TEMPLATE_FUNC_NAME
|
||||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
{
|
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
|
||||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
|
|
@ -43,7 +43,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
} while (Length >= 8);
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -76,4 +76,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
#undef TEMPLATE_BUFFER_TYPE
|
||||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
#undef TEMPLATE_CLEAR_ENDPOINT
|
||||
#undef TEMPLATE_BUFFER_OFFSET
|
||||
#undef TEMPLATE_BUFFER_OFFSET
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
{
|
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
|
||||
uint8_t ErrorCode;
|
||||
|
||||
|
||||
Pipe_SetPipeToken(TEMPLATE_TOKEN);
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
|
|
@ -36,7 +36,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
|
||||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
|
|
@ -45,7 +45,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
} while (Length >= 8);
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -70,7 +70,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
Length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PIPE_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -80,3 +80,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
|
|||
#undef TEMPLATE_TRANSFER_BYTE
|
||||
#undef TEMPLATE_CLEAR_PIPE
|
||||
#undef TEMPLATE_BUFFER_OFFSET
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
*/
|
||||
#define USB_CAN_BE_BOTH
|
||||
#else
|
||||
/* Macros: */
|
||||
/* Macros: */
|
||||
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
|
||||
defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
|
||||
#define USB_SERIES_2_AVR
|
||||
|
|
@ -106,13 +106,13 @@
|
|||
#define USB_SERIES_6_AVR
|
||||
#elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
|
||||
#define USB_SERIES_7_AVR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(USB_SERIES_7_AVR)
|
||||
#if !defined(USB_SERIES_7_AVR)
|
||||
#if defined(USB_HOST_ONLY)
|
||||
#error USB_HOST_ONLY is not available for the currently selected USB AVR model.
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(USB_DEVICE_ONLY)
|
||||
#define USB_DEVICE_ONLY
|
||||
#endif
|
||||
|
|
@ -127,12 +127,12 @@
|
|||
#elif defined(USB_DEVICE_ONLY)
|
||||
#define USB_CAN_BE_DEVICE
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
|
||||
#error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -63,12 +63,12 @@ static void USB_DeviceTask(void)
|
|||
if (USB_DeviceState != DEVICE_STATE_Unattached)
|
||||
{
|
||||
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
||||
|
||||
if (Endpoint_IsSETUPReceived())
|
||||
USB_Device_ProcessControlRequest();
|
||||
|
||||
|
||||
Endpoint_SelectEndpoint(PrevEndpoint);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,11 +78,12 @@ static void USB_DeviceTask(void)
|
|||
static void USB_HostTask(void)
|
||||
{
|
||||
uint8_t PrevPipe = Pipe_GetCurrentPipe();
|
||||
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
USB_Host_ProcessNextHostState();
|
||||
|
||||
|
||||
Pipe_SelectPipe(PrevPipe);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
#include <avr/interrupt.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "../LowLevel/USBController.h"
|
||||
#include "Events.h"
|
||||
#include "StdRequestType.h"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
#if defined(USB_CAN_BE_HOST)
|
||||
#include "HostStandardReq.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Global Variables: */
|
||||
/** Indicates if the USB interface is currently initialized but not necessarily connected to a host
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
* \ingroup Group_USBManagement
|
||||
*/
|
||||
extern USB_Request_Header_t USB_ControlRequest;
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
|
||||
#if !defined(HOST_STATE_AS_GPIOR) || defined(__DOXYGEN__)
|
||||
/** Indicates the current host state machine state. When in host mode, this indicates the state
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
* the library internally.
|
||||
*
|
||||
* To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
|
||||
* GPIOR hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR token to a value
|
||||
* GPIOR hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR token to a value
|
||||
* between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
|
||||
* defined, the corresponding GPIOR register should not be used in the user application except
|
||||
* implicitly via the library APIs.
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
* (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events).
|
||||
*
|
||||
* To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
|
||||
* GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
|
||||
* GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
|
||||
* between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
|
||||
* defined, the corresponding GPIOR register should not be used in the user application except
|
||||
* implicitly via the library APIs.
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
* The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode.
|
||||
* The task may be serviced at all times, or (for minimum CPU consumption):
|
||||
*
|
||||
* - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
|
||||
* - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
|
||||
* event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event.
|
||||
*
|
||||
* - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached()
|
||||
|
|
@ -185,21 +185,22 @@
|
|||
#if defined(USB_CAN_BE_HOST)
|
||||
static void USB_HostTask(void);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
static void USB_DeviceTask(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros: */
|
||||
#define HOST_TASK_NONBLOCK_WAIT(Duration, NextState) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \
|
||||
WaitMSRemaining = (Duration); \
|
||||
PostWaitState = (NextState); }MACROE
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -50,3 +50,4 @@ void USB_Device_SendRemoteWakeup(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "../../../Common/Common.h"
|
||||
#include "../HighLevel/StdDescriptors.h"
|
||||
#include "USBInterrupt.h"
|
||||
#include "Endpoint.h"
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
*/
|
||||
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
|
||||
#endif
|
||||
|
||||
|
||||
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
|
||||
* USB interface should be initialized in full speed (12Mb/s) mode.
|
||||
*/
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
* \see \ref Group_Descriptors for more information on the RMWAKEUP feature and device descriptors.
|
||||
*/
|
||||
void USB_Device_SendRemoteWakeup(void);
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
enum USB_Device_States_t
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
* resumed.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
|
||||
* the frame number is incremented by one.
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
{
|
||||
return UDFNUM;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(NO_SOF_EVENTS)
|
||||
/** Enables the device mode Start Of Frame events. When enabled, this causes the
|
||||
* \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
{
|
||||
USB_INT_Enable(USB_INT_SOFI);
|
||||
}
|
||||
|
||||
|
||||
/** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the
|
||||
* \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode.
|
||||
*
|
||||
|
|
@ -172,13 +172,13 @@
|
|||
USB_INT_Disable(USB_INT_SOFI);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
/** Function to retrieve a given descriptor's size and memory location from the given descriptor type value,
|
||||
* index and language ID. This function MUST be overridden in the user application (added with full, identical
|
||||
* index and language ID. This function MUST be overridden in the user application (added with full, identical
|
||||
* prototype and name so that the library can call it to retrieve descriptor data.
|
||||
*
|
||||
* \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the
|
||||
* \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the
|
||||
* lower byte (when more than one descriptor of the given type exists, such as the
|
||||
* case of string descriptors). The type may be one of the standard types defined
|
||||
* in the DescriptorTypes_t enum, or may be a class-specific descriptor type value.
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
*
|
||||
* \note By default, the library expects all descriptors to be located in flash memory via the PROGMEM attribute.
|
||||
* If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to
|
||||
* allow the descriptors to be changed dynamically at runtime) either the USE_RAM_DESCRIPTORS or the
|
||||
* allow the descriptors to be changed dynamically at runtime) either the USE_RAM_DESCRIPTORS or the
|
||||
* USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D
|
||||
* switch.
|
||||
*
|
||||
|
|
@ -216,14 +216,14 @@
|
|||
{
|
||||
UDCON |= (1 << LSM);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Device_SetFullSpeed(void)
|
||||
{
|
||||
UDCON &= ~(1 << LSM);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
|
||||
{
|
||||
|
|
@ -241,3 +241,4 @@
|
|||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -59,7 +59,7 @@ void Endpoint_ClearEndpoints(void)
|
|||
|
||||
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
|
||||
{
|
||||
Endpoint_SelectEndpoint(EPNum);
|
||||
Endpoint_SelectEndpoint(EPNum);
|
||||
UEIENX = 0;
|
||||
UEINTX = 0;
|
||||
UECFG1X = 0;
|
||||
|
|
@ -86,7 +86,7 @@ void Endpoint_ClearStatusStage(void)
|
|||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ void Endpoint_ClearStatusStage(void)
|
|||
uint8_t Endpoint_WaitUntilReady(void)
|
||||
{
|
||||
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#endif
|
||||
|
|
@ -114,13 +114,13 @@ uint8_t Endpoint_WaitUntilReady(void)
|
|||
if (Endpoint_IsOUTReceived())
|
||||
return ENDPOINT_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
|
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState;
|
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_READYWAIT_DeviceDisconnected;
|
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
|
||||
return ENDPOINT_READYWAIT_BusSuspended;
|
||||
return ENDPOINT_READYWAIT_BusSuspended;
|
||||
else if (Endpoint_IsStalled())
|
||||
return ENDPOINT_READYWAIT_EndpointStalled;
|
||||
|
||||
|
|
@ -138,3 +138,4 @@ uint8_t Endpoint_WaitUntilReady(void)
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -43,13 +43,13 @@
|
|||
*
|
||||
* Functions, macros, variables, enums and types related to data reading and writing from and to endpoints.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_EndpointRW
|
||||
* @defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types
|
||||
*
|
||||
* Functions, macros, variables, enums and types related to data reading and writing of primitive data types
|
||||
* from and to endpoints.
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \ingroup Group_EndpointManagement
|
||||
* @defgroup Group_EndpointPacketManagement Endpoint Packet Management
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
#include "../../../Common/Common.h"
|
||||
#include "../HighLevel/USBTask.h"
|
||||
#include "USBInterrupt.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -98,10 +98,10 @@
|
|||
#define _ENDPOINT_GET_DOUBLEBANK(EPIndex) _ENDPOINT_GET_DOUBLEBANK2(ENDPOINT_DETAILS_EP ## EPIndex)
|
||||
#define _ENDPOINT_GET_DOUBLEBANK2(EPDetails) _ENDPOINT_GET_DOUBLEBANK3(EPDetails)
|
||||
#define _ENDPOINT_GET_DOUBLEBANK3(MaxSize, DB) (DB)
|
||||
|
||||
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
|
||||
#define ENDPOINT_DETAILS_MAXEP 7
|
||||
|
||||
|
||||
#define ENDPOINT_DETAILS_EP0 64, true
|
||||
#define ENDPOINT_DETAILS_EP1 256, true
|
||||
#define ENDPOINT_DETAILS_EP2 64, true
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
#define ENDPOINT_DETAILS_EP1 64, false
|
||||
#define ENDPOINT_DETAILS_EP2 64, false
|
||||
#define ENDPOINT_DETAILS_EP3 64, true
|
||||
#define ENDPOINT_DETAILS_EP4 64, true
|
||||
#define ENDPOINT_DETAILS_EP4 64, true
|
||||
#endif
|
||||
|
||||
/* Inline Functions: */
|
||||
|
|
@ -126,13 +126,13 @@
|
|||
{
|
||||
uint8_t MaskVal = 0;
|
||||
uint16_t CheckBytes = 8;
|
||||
|
||||
|
||||
while (CheckBytes < Bytes)
|
||||
{
|
||||
MaskVal++;
|
||||
CheckBytes <<= 1;
|
||||
}
|
||||
|
||||
|
||||
return (MaskVal << EPSIZE0);
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
const uint8_t UECFG1XData);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
|
||||
|
|
@ -169,19 +169,19 @@
|
|||
* accesses the second bank.
|
||||
*/
|
||||
#define ENDPOINT_BANK_DOUBLE (1 << EPBK0)
|
||||
|
||||
|
||||
/** Endpoint address for the default control endpoint, which always resides in address 0. This is
|
||||
* defined for convenience to give more readable code when used with the endpoint macros.
|
||||
*/
|
||||
#define ENDPOINT_CONTROLEP 0
|
||||
|
||||
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
|
||||
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
|
||||
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
|
||||
* value in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE token is defined.
|
||||
*/
|
||||
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
|
||||
#endif
|
||||
|
||||
|
||||
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
|
||||
* numerical address in the device.
|
||||
*/
|
||||
|
|
@ -196,17 +196,17 @@
|
|||
* bank size in the device.
|
||||
*/
|
||||
#define ENDPOINT_EPSIZE_MASK 0x7F
|
||||
|
||||
|
||||
/** Maximum size in bytes of a given endpoint.
|
||||
*
|
||||
* \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
*/
|
||||
*/
|
||||
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex)
|
||||
|
||||
/** Indicates if the given endpoint supports double banking.
|
||||
*
|
||||
* \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
*/
|
||||
*/
|
||||
#define ENDPOINT_DOUBLEBANK_SUPPORTED(EPIndex) _ENDPOINT_GET_DOUBLEBANK(EPIndex)
|
||||
|
||||
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
|
||||
|
|
@ -243,7 +243,7 @@
|
|||
*/
|
||||
};
|
||||
|
||||
/* Inline Functions: */
|
||||
/* Inline Functions: */
|
||||
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
|
||||
* and banking mode. Once configured, the endpoint may be read from or written to, depending
|
||||
* on its direction.
|
||||
|
|
@ -274,7 +274,7 @@
|
|||
* index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each endpoint.
|
||||
* \n\n
|
||||
*
|
||||
* \note The default control endpoint should not be manually configured by the user application, as
|
||||
* \note The default control endpoint should not be manually configured by the user application, as
|
||||
* it is automatically configured by the library internally.
|
||||
* \n\n
|
||||
*
|
||||
|
|
@ -318,7 +318,7 @@
|
|||
return UEBCLX;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
|
||||
* the currently selected endpoint number so that it can be restored after another endpoint has
|
||||
* been manipulated.
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
return ENDPOINT_CONTROLEP;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** Selects the given endpoint number. If the address from the device descriptors is used, the
|
||||
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint
|
||||
* number (and discarding the endpoint direction bit).
|
||||
|
|
@ -349,9 +349,9 @@
|
|||
{
|
||||
#if !defined(CONTROL_ONLY_DEVICE)
|
||||
UENUM = EndpointNumber;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
|
||||
* In and Out pointers to the bank's contents.
|
||||
*
|
||||
|
|
@ -363,7 +363,7 @@
|
|||
UERST = (1 << EndpointNumber);
|
||||
UERST = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Enables the currently selected endpoint so that data can be sent and received through it to
|
||||
* and from a host.
|
||||
*
|
||||
|
|
@ -383,7 +383,7 @@
|
|||
{
|
||||
UECONX &= ~(1 << EPEN);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected endpoint is enabled, but not necessarily configured.
|
||||
*
|
||||
* \return Boolean True if the currently selected endpoint is enabled, false otherwise.
|
||||
|
|
@ -393,7 +393,7 @@
|
|||
{
|
||||
return ((UECONX & (1 << EPEN)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint
|
||||
* bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN
|
||||
* direction). This function will return false if an error has occurred in the endpoint, if the endpoint
|
||||
|
|
@ -409,7 +409,7 @@
|
|||
{
|
||||
return ((UEINTX & (1 << RWAL)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected endpoint is configured.
|
||||
*
|
||||
* \return Boolean true if the currently selected endpoint has been configured, false otherwise.
|
||||
|
|
@ -419,7 +419,7 @@
|
|||
{
|
||||
return ((UESTA0X & (1 << CFGOK)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their
|
||||
* interrupt duration has elapsed. Which endpoints have interrupted can be determined by
|
||||
* masking the return value against (1 << {Endpoint Number}).
|
||||
|
|
@ -431,7 +431,7 @@
|
|||
{
|
||||
return UEINT;
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
|
||||
* endpoints).
|
||||
*
|
||||
|
|
@ -444,7 +444,7 @@
|
|||
{
|
||||
return ((UEINT & (1 << EndpointNumber)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
|
|
@ -456,7 +456,7 @@
|
|||
{
|
||||
return ((UEINTX & (1 << TXINI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the selected OUT endpoint has received new packet from the host.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
|
|
@ -468,7 +468,7 @@
|
|||
{
|
||||
return ((UEINTX & (1 << RXOUTI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the current CONTROL type endpoint has received a SETUP packet.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
|
|
@ -480,20 +480,20 @@
|
|||
{
|
||||
return ((UEINTX & (1 << RXSTPI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the
|
||||
* endpoint for the next packet.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
*
|
||||
* \note This is not applicable for non CONTROL type endpoints.
|
||||
* \note This is not applicable for non CONTROL type endpoints.
|
||||
*/
|
||||
static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_ClearSETUP(void)
|
||||
{
|
||||
UEINTX &= ~(1 << RXSTPI);
|
||||
}
|
||||
|
||||
|
||||
/** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the
|
||||
* next packet and switching to the alternative endpoint bank if double banked.
|
||||
*
|
||||
|
|
@ -508,7 +508,7 @@
|
|||
UEINTX &= ~(1 << TXINI);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint
|
||||
* for the next packet and switching to the alternative endpoint bank if double banked.
|
||||
*
|
||||
|
|
@ -520,10 +520,10 @@
|
|||
#if !defined(CONTROL_ONLY_DEVICE)
|
||||
UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON));
|
||||
#else
|
||||
UEINTX &= ~(1 << RXOUTI);
|
||||
UEINTX &= ~(1 << RXOUTI);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
|
||||
* indicated endpoint and that the current transfer sequence should be aborted. This provides a
|
||||
* way for devices to indicate invalid commands to the host so that the current transfer can be
|
||||
|
|
@ -540,7 +540,7 @@
|
|||
{
|
||||
UECONX |= (1 << STALLRQ);
|
||||
}
|
||||
|
||||
|
||||
/** Clears the STALL condition on the currently selected endpoint.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
|
|
@ -550,7 +550,7 @@
|
|||
{
|
||||
UECONX |= (1 << STALLRQC);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected endpoint is stalled, false otherwise.
|
||||
*
|
||||
* \ingroup Group_EndpointPacketManagement
|
||||
|
|
@ -562,14 +562,14 @@
|
|||
{
|
||||
return ((UECONX & (1 << STALLRQ)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Resets the data toggle of the currently selected endpoint. */
|
||||
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_ResetDataToggle(void)
|
||||
{
|
||||
UECONX |= (1 << RSTDT);
|
||||
}
|
||||
|
||||
|
||||
/** Determines the currently selected endpoint's direction.
|
||||
*
|
||||
* \return The currently selected endpoint's direction, as a ENDPOINT_DIR_* mask.
|
||||
|
|
@ -622,10 +622,10 @@
|
|||
static inline void Endpoint_Discard_Byte(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UEDATX;
|
||||
}
|
||||
|
||||
|
||||
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
|
||||
* direction endpoints.
|
||||
*
|
||||
|
|
@ -641,10 +641,10 @@
|
|||
uint16_t Word;
|
||||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[0] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
||||
|
|
@ -663,10 +663,10 @@
|
|||
uint16_t Word;
|
||||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[0] = UEDATX;
|
||||
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
||||
|
|
@ -683,7 +683,7 @@
|
|||
UEDATX = (Word & 0xFF);
|
||||
UEDATX = (Word >> 8);
|
||||
}
|
||||
|
||||
|
||||
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
* direction endpoints.
|
||||
*
|
||||
|
|
@ -706,7 +706,7 @@
|
|||
static inline void Endpoint_Discard_Word(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
}
|
||||
|
|
@ -726,12 +726,12 @@
|
|||
uint32_t DWord;
|
||||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[0] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[2] = UEDATX;
|
||||
Data.Bytes[3] = UEDATX;
|
||||
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
||||
|
|
@ -750,12 +750,12 @@
|
|||
uint32_t DWord;
|
||||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[3] = UEDATX;
|
||||
Data.Bytes[2] = UEDATX;
|
||||
Data.Bytes[1] = UEDATX;
|
||||
Data.Bytes[0] = UEDATX;
|
||||
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
||||
|
|
@ -774,7 +774,7 @@
|
|||
UEDATX = (DWord >> 16);
|
||||
UEDATX = (DWord >> 24);
|
||||
}
|
||||
|
||||
|
||||
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
* direction endpoints.
|
||||
*
|
||||
|
|
@ -791,7 +791,7 @@
|
|||
UEDATX = (DWord & 0xFF);
|
||||
}
|
||||
|
||||
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
*
|
||||
* \ingroup Group_EndpointPrimitiveRW
|
||||
*/
|
||||
|
|
@ -799,7 +799,7 @@
|
|||
static inline void Endpoint_Discard_DWord(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
Dummy = UEDATX;
|
||||
|
|
@ -850,7 +850,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -55,15 +55,15 @@ void USB_Host_ProcessNextHostState(void)
|
|||
ErrorCode = HOST_ENUMERROR_WaitStage;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!(--WaitMSRemaining))
|
||||
USB_HostState = PostWaitState;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HOST_STATE_Powered:
|
||||
WaitMSRemaining = HOST_DEVICE_SETTLE_DELAY_MS;
|
||||
|
||||
|
||||
USB_HostState = HOST_STATE_Powered_WaitForDeviceSettle;
|
||||
break;
|
||||
case HOST_STATE_Powered_WaitForDeviceSettle:
|
||||
|
|
@ -79,23 +79,23 @@ void USB_Host_ProcessNextHostState(void)
|
|||
USB_OTGPAD_On();
|
||||
USB_Host_VBUS_Auto_Enable();
|
||||
USB_Host_VBUS_Auto_On();
|
||||
|
||||
|
||||
USB_HostState = HOST_STATE_Powered_WaitForConnect;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case HOST_STATE_Powered_WaitForConnect:
|
||||
case HOST_STATE_Powered_WaitForConnect:
|
||||
if (USB_INT_HasOccurred(USB_INT_DCONNI))
|
||||
{
|
||||
{
|
||||
USB_INT_Clear(USB_INT_DCONNI);
|
||||
USB_INT_Clear(USB_INT_DDISCI);
|
||||
|
||||
USB_INT_Clear(USB_INT_VBERRI);
|
||||
USB_INT_Enable(USB_INT_VBERRI);
|
||||
|
||||
|
||||
USB_Host_ResumeBus();
|
||||
Pipe_ClearPipes();
|
||||
|
||||
|
||||
HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Powered_DoReset);
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +108,8 @@ void USB_Host_ProcessNextHostState(void)
|
|||
case HOST_STATE_Powered_ConfigPipe:
|
||||
Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
|
||||
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
|
||||
PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
|
||||
|
||||
PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
|
||||
|
||||
if (!(Pipe_IsConfigured()))
|
||||
{
|
||||
ErrorCode = HOST_ENUMERROR_PipeConfigError;
|
||||
|
|
@ -138,9 +138,9 @@ void USB_Host_ProcessNextHostState(void)
|
|||
}
|
||||
|
||||
USB_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)];
|
||||
|
||||
|
||||
USB_Host_ResetDevice();
|
||||
|
||||
|
||||
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
|
||||
break;
|
||||
case HOST_STATE_Default_PostReset:
|
||||
|
|
@ -197,7 +197,7 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
|
|||
bool BusSuspended = USB_Host_IsBusSuspended();
|
||||
uint8_t ErrorCode = HOST_WAITERROR_Successful;
|
||||
bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI);
|
||||
|
||||
|
||||
USB_INT_Disable(USB_INT_HSOFI);
|
||||
USB_INT_Clear(USB_INT_HSOFI);
|
||||
|
||||
|
|
@ -210,11 +210,11 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
|
|||
USB_INT_Clear(USB_INT_HSOFI);
|
||||
MS--;
|
||||
}
|
||||
|
||||
|
||||
if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host))
|
||||
{
|
||||
ErrorCode = HOST_WAITERROR_DeviceDisconnect;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -222,16 +222,16 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
|
|||
{
|
||||
Pipe_ClearError();
|
||||
ErrorCode = HOST_WAITERROR_PipeError;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (Pipe_IsStalled() == true)
|
||||
{
|
||||
Pipe_ClearStall();
|
||||
ErrorCode = HOST_WAITERROR_SetupStalled;
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ static void USB_Host_ResetDevice(void)
|
|||
bool BusSuspended = USB_Host_IsBusSuspended();
|
||||
|
||||
USB_INT_Disable(USB_INT_DDISCI);
|
||||
|
||||
|
||||
USB_Host_ResetBus();
|
||||
while (!(USB_Host_IsBusResetComplete()));
|
||||
USB_Host_ResumeBus();
|
||||
|
|
@ -258,7 +258,7 @@ static void USB_Host_ResetDevice(void)
|
|||
|
||||
USB_INT_Disable(USB_INT_HSOFI);
|
||||
USB_INT_Clear(USB_INT_HSOFI);
|
||||
|
||||
|
||||
for (uint8_t MSRem = 10; MSRem != 0; MSRem--)
|
||||
{
|
||||
/* Workaround for powerless-pull-up devices. After a USB bus reset,
|
||||
|
|
@ -272,7 +272,7 @@ static void USB_Host_ResetDevice(void)
|
|||
USB_INT_Clear(USB_INT_DDISCI);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
_delay_ms(1);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber)
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr)
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(DeviceDescriptorPtr);
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(Buffer);
|
||||
}
|
||||
|
||||
|
|
@ -347,8 +347,9 @@ uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointNum)
|
|||
};
|
||||
|
||||
Pipe_SelectPipe(PIPE_CONTROLPIPE);
|
||||
|
||||
|
||||
return USB_Host_SendControlRequest(NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __USBHOST_H__
|
||||
#define __USBHOST_H__
|
||||
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Indicates the fixed USB device address which any attached device is enumerated to when in
|
||||
|
|
@ -83,12 +83,12 @@
|
|||
* device. If a device fails to respond to a sent control request within this period, the
|
||||
* library will return a timeout error code.
|
||||
*
|
||||
* This value may be overridden in the user project makefile as the value of the
|
||||
* This value may be overridden in the user project makefile as the value of the
|
||||
* \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch.
|
||||
*/
|
||||
#define USB_HOST_TIMEOUT_MS 1000
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(HOST_DEVICE_SETTLE_DELAY_MS) || defined(__DOXYGEN__)
|
||||
/** Constant for the delay in milliseconds after a device is connected before the library
|
||||
* will start the enumeration process. Some devices require a delay of up to 5 seconds
|
||||
|
|
@ -131,52 +131,52 @@
|
|||
HOST_STATE_Unattached = 2, /**< Internally implemented by the library. This state indicates
|
||||
* that the host state machine is waiting for a device to be
|
||||
* attached so that it can start the enumeration process.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Powered = 3, /**< Internally implemented by the library. This state indicates
|
||||
* that a device has been attached, and the library's internals
|
||||
* are being configured to begin the enumeration process.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Powered_WaitForDeviceSettle = 4, /**< Internally implemented by the library. This state indicates
|
||||
* that the stack is waiting for the initial settling period to
|
||||
* elapse before beginning the enumeration process.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Powered_WaitForConnect = 5, /**< Internally implemented by the library. This state indicates
|
||||
* that the stack is waiting for a connection event from the USB
|
||||
* controller to indicate a valid USB device has been attached to
|
||||
* the bus and is ready to be enumerated.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Powered_DoReset = 6, /**< Internally implemented by the library. This state indicates
|
||||
* that a valid USB device has been attached, and that it is
|
||||
* will now be reset to ensure it is ready for enumeration.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Powered_ConfigPipe = 7, /**< Internally implemented by the library. This state indicates
|
||||
* that the attached device is currently powered and reset, and
|
||||
* that the control pipe is now being configured by the stack.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Default = 8, /**< Internally implemented by the library. This state indicates
|
||||
* that the stack is currently retrieving the control endpoint's
|
||||
* size from the device, so that the control pipe can be altered
|
||||
* to match.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Default_PostReset = 9, /**< Internally implemented by the library. This state indicates that
|
||||
* the control pipe is being reconfigured to match the retrieved
|
||||
* control endpoint size from the device, and the device's USB bus
|
||||
* address is being set.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Default_PostAddressSet = 10, /**< Internally implemented by the library. This state indicates that
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
* stack to change the current USB device address to that set for
|
||||
* the connected device, before progressing to the user-implemented
|
||||
* \ref HOST_STATE_Addressed state for further communications.
|
||||
*
|
||||
*
|
||||
* \note Do not manually change to this state in the user code.
|
||||
*/
|
||||
HOST_STATE_Addressed = 11, /**< May be implemented by the user project. This state should
|
||||
|
|
@ -204,7 +204,7 @@
|
|||
* \ref HOST_STATE_WaitForDeviceRemoval states as needed.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event.
|
||||
*
|
||||
* \see \ref Group_Events for more information on this event.
|
||||
|
|
@ -218,7 +218,7 @@
|
|||
* current.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event.
|
||||
*
|
||||
* \see \ref Group_Events for more information on this event.
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
{
|
||||
return UHFNUM;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(NO_SOF_EVENTS)
|
||||
/** Enables the host mode Start Of Frame events. When enabled, this causes the
|
||||
* \ref EVENT_USB_Host_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
{
|
||||
USB_INT_Enable(USB_INT_HSOFI);
|
||||
}
|
||||
|
||||
|
||||
/** Disables the host mode Start Of Frame events. When disabled, this stops the firing of the
|
||||
* \ref EVENT_USB_Host_StartOfFrame() event when enumerated in host mode.
|
||||
*
|
||||
|
|
@ -277,7 +277,7 @@
|
|||
USB_INT_Disable(USB_INT_HSOFI);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.
|
||||
* USB bus resets leave the default control pipe configured (if already configured).
|
||||
*
|
||||
|
|
@ -320,7 +320,7 @@
|
|||
{
|
||||
UHCON &= ~(1 << SOFEN);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro,
|
||||
* false otherwise. While suspended, no USB communications can occur until the bus is resumed,
|
||||
* except for the Remote Wakeup event from the device if supported.
|
||||
|
|
@ -332,7 +332,7 @@
|
|||
{
|
||||
return ((UHCON & (1 << SOFEN)) ? false : true);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or
|
||||
* false if the attached device is enumerated in Low Speed mode (1.5Mb/s).
|
||||
*
|
||||
|
|
@ -371,7 +371,7 @@
|
|||
{
|
||||
UHCON |= (1 << RESUME);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if a resume from Remote Wakeup request is currently being sent to an attached
|
||||
* device.
|
||||
*
|
||||
|
|
@ -395,7 +395,7 @@
|
|||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber);
|
||||
|
||||
|
||||
/** Convenience function. This routine sends a GetDescriptor standard request to the attached
|
||||
* device, requesting the device descriptor. This can be used to easily retrieve information
|
||||
* about the device such as its VID, PID and power requirements.
|
||||
|
|
@ -408,7 +408,7 @@
|
|||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr);
|
||||
|
||||
|
||||
/** Convenience function. This routine sends a GetDescriptor standard request to the attached
|
||||
* device, requesting the string descriptor of the specified index. This can be used to easily
|
||||
* retrieve string descriptors from the device by index, after the index is obtained from the
|
||||
|
|
@ -426,7 +426,7 @@
|
|||
uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
|
||||
void* const Buffer,
|
||||
const uint8_t BufferLength);
|
||||
|
||||
|
||||
/** Clears a stall condition on the given pipe, via a ClearFeature request to the attached device.
|
||||
*
|
||||
* \note After this routine returns, the control pipe will be selected.
|
||||
|
|
@ -458,13 +458,13 @@
|
|||
OTGCON &= ~(1 << VBUSHWC);
|
||||
UHWCON |= (1 << UVCONE);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Host_VBUS_Manual_Enable(void)
|
||||
{
|
||||
OTGCON |= (1 << VBUSHWC);
|
||||
UHWCON &= ~(1 << UVCONE);
|
||||
|
||||
|
||||
DDRE |= (1 << 7);
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +479,7 @@
|
|||
{
|
||||
PORTE |= (1 << 7);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Host_VBUS_Auto_Off(void)
|
||||
{
|
||||
|
|
@ -490,7 +490,7 @@
|
|||
static inline void USB_Host_VBUS_Manual_Off(void)
|
||||
{
|
||||
PORTE &= ~(1 << 7);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Host_SetDeviceAddress(const uint8_t Address)
|
||||
|
|
@ -510,7 +510,7 @@
|
|||
/* Function Prototypes: */
|
||||
void USB_Host_ProcessNextHostState(void);
|
||||
uint8_t USB_Host_WaitMS(uint8_t MS);
|
||||
|
||||
|
||||
#if defined(__INCLUDE_FROM_HOST_C)
|
||||
static void USB_Host_ResetDevice(void);
|
||||
#endif
|
||||
|
|
@ -520,7 +520,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
|
||||
/** \file
|
||||
* \brief USB OTG mode definitions.
|
||||
*
|
||||
|
|
@ -54,26 +54,26 @@
|
|||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for the VBUS pulsing method of SRP, supported by some OTG devices.
|
||||
*
|
||||
* \see \ref USB_OTG_Device_InitiateSRP().
|
||||
*/
|
||||
*/
|
||||
#define USB_OTG_SRP_VBUS (1 << SRPSEL)
|
||||
|
||||
/** Mask for the Data + pulsing method of SRP, supported by some OTG devices.
|
||||
*
|
||||
* \see \ref USB_OTG_Device_InitiateSRP().
|
||||
*/
|
||||
*/
|
||||
#define USB_OTG_STP_DATA 0
|
||||
|
||||
/* Inline Functions: */
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
{
|
||||
OTGCON |= (1 << HNPREQ);
|
||||
}
|
||||
|
||||
|
||||
/** Cancel a Host Negotiation Protocol request. This stops a pending HNP request to the other
|
||||
* connected device.
|
||||
*/
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
{
|
||||
OTGCON &= ~(1 << HNPREQ);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the device is currently sending a HNP to an attached host.
|
||||
*
|
||||
* \return Boolean true if currently sending a HNP to the other connected device, false otherwise
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
{
|
||||
return ((OTGCON & (1 << HNPREQ)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB
|
||||
* interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in
|
||||
* host mode indicates that VBUS should be applied and a session started.
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
{
|
||||
OTGCON |= (1 << HNPREQ);
|
||||
}
|
||||
|
||||
|
||||
/** Rejects a HNP from a connected device, indicating that both devices should remain in their
|
||||
* current device/host roles.
|
||||
*/
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
{
|
||||
OTGCON &= ~(1 << HNPREQ);
|
||||
}
|
||||
|
||||
|
||||
/** Indicates if the connected device is not currently sending a HNP request.
|
||||
*
|
||||
* \return Boolean true if a HNP is currently being issued by the connected device, false otherwise.
|
||||
|
|
@ -148,7 +148,8 @@
|
|||
{
|
||||
return ((OTGCON & (1 << HNPREQ)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -48,7 +48,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
|
|||
Pipe_EnablePipe();
|
||||
|
||||
UPCFG1X = 0;
|
||||
|
||||
|
||||
UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
|
||||
UPCFG1X = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
|
||||
|
||||
|
|
@ -78,20 +78,20 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
|
|||
for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
|
||||
{
|
||||
Pipe_SelectPipe(PNum);
|
||||
|
||||
|
||||
if (!(Pipe_IsConfigured()))
|
||||
continue;
|
||||
|
||||
|
||||
uint8_t PipeToken = Pipe_GetPipeToken();
|
||||
bool PipeTokenCorrect = true;
|
||||
|
||||
if (PipeToken != PIPE_TOKEN_SETUP)
|
||||
PipeTokenCorrect = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));
|
||||
|
||||
|
||||
if (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Pipe_SelectPipe(PrevPipeNumber);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -99,13 +99,13 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
|
|||
uint8_t Pipe_WaitUntilReady(void)
|
||||
{
|
||||
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#endif
|
||||
|
||||
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (Pipe_GetPipeToken() == PIPE_TOKEN_IN)
|
||||
|
|
@ -116,7 +116,7 @@ uint8_t Pipe_WaitUntilReady(void)
|
|||
else
|
||||
{
|
||||
if (Pipe_IsOUTReady())
|
||||
return PIPE_READYWAIT_NoError;
|
||||
return PIPE_READYWAIT_NoError;
|
||||
}
|
||||
|
||||
if (Pipe_IsStalled())
|
||||
|
|
@ -137,3 +137,4 @@ uint8_t Pipe_WaitUntilReady(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
|
||||
/** \file
|
||||
* \brief USB host pipe management definitions.
|
||||
*
|
||||
|
|
@ -36,27 +36,27 @@
|
|||
*
|
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver
|
||||
* dispatch header located in LUFA/Drivers/USB/USB.h.
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \ingroup Group_PipeManagement
|
||||
* @defgroup Group_PipeRW Pipe Data Reading and Writing
|
||||
*
|
||||
* Functions, macros, variables, enums and types related to data reading and writing from and to pipes.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_PipeRW
|
||||
|
||||
/** \ingroup Group_PipeRW
|
||||
* @defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types
|
||||
*
|
||||
* Functions, macros, variables, enums and types related to data reading and writing of primitive data types
|
||||
* from and to pipes.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_PipeManagement
|
||||
* @defgroup Group_PipePacketManagement Pipe Packet Management
|
||||
*
|
||||
* Functions, macros, variables, enums and types related to packet management of pipes.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_PipeManagement
|
||||
* @defgroup Group_PipeControlReq Pipe Control Request Management
|
||||
*
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
* vendor control requests to the default control endpoint of an attached device while in host mode.
|
||||
*
|
||||
* \see Chapter 9 of the USB 2.0 specification.
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_PipeManagement Pipe Management
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "../HighLevel/USBTask.h"
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -95,7 +95,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */
|
||||
|
|
@ -146,17 +146,17 @@
|
|||
* bank.
|
||||
*/
|
||||
#define PIPE_BANK_DOUBLE (1 << EPBK0)
|
||||
|
||||
|
||||
/** Pipe address for the default control pipe, which always resides in address 0. This is
|
||||
* defined for convenience to give more readable code when used with the pipe macros.
|
||||
*/
|
||||
#define PIPE_CONTROLPIPE 0
|
||||
|
||||
/** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
|
||||
/** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
|
||||
* in the device descriptor of the attached device.
|
||||
*/
|
||||
#define PIPE_CONTROLPIPE_DEFAULT_SIZE 64
|
||||
|
||||
|
||||
/** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address
|
||||
* in the device.
|
||||
*/
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
enum Pipe_WaitUntilReady_ErrorCodes_t
|
||||
{
|
||||
PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error. */
|
||||
PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */
|
||||
PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */
|
||||
PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */
|
||||
PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet
|
||||
* within the software timeout period set by the
|
||||
|
|
@ -216,7 +216,7 @@
|
|||
{
|
||||
return UPBCX;
|
||||
}
|
||||
|
||||
|
||||
/** Returns the pipe address of the currently selected pipe. This is typically used to save the
|
||||
* currently selected pipe number so that it can be restored after another pipe has been manipulated.
|
||||
*
|
||||
|
|
@ -238,7 +238,7 @@
|
|||
{
|
||||
UPNUM = PipeNumber;
|
||||
}
|
||||
|
||||
|
||||
/** Resets the desired pipe, including the pipe banks and flags.
|
||||
*
|
||||
* \param[in] PipeNumber Index of the pipe to reset.
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
UPRST = (1 << PipeNumber);
|
||||
UPRST = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Enables the currently selected pipe so that data can be sent and received through it to and from
|
||||
* an attached device.
|
||||
*
|
||||
|
|
@ -279,7 +279,7 @@
|
|||
{
|
||||
return ((UPCONX & (1 << PEN)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Gets the current pipe token, indicating the pipe's data direction and type.
|
||||
*
|
||||
* \return The current pipe token, as a PIPE_TOKEN_* mask.
|
||||
|
|
@ -289,7 +289,7 @@
|
|||
{
|
||||
return (UPCFG0X & (0x03 << PTOKEN0));
|
||||
}
|
||||
|
||||
|
||||
/** Sets the token for the currently selected pipe to one of the tokens specified by the PIPE_TOKEN_*
|
||||
* masks. This can be used on CONTROL type pipes, to allow for bidirectional transfer of data during
|
||||
* control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices
|
||||
|
|
@ -302,14 +302,14 @@
|
|||
{
|
||||
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
|
||||
}
|
||||
|
||||
|
||||
/** Configures the currently selected pipe to allow for an unlimited number of IN requests. */
|
||||
static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_SetInfiniteINRequests(void)
|
||||
{
|
||||
UPCONX |= (1 << INMODE);
|
||||
}
|
||||
|
||||
|
||||
/** Configures the currently selected pipe to only allow the specified number of IN requests to be
|
||||
* accepted by the pipe before it is automatically frozen.
|
||||
*
|
||||
|
|
@ -331,7 +331,7 @@
|
|||
{
|
||||
return ((UPSTAX & (1 << CFGOK)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
|
||||
* pipe is bound to.
|
||||
*
|
||||
|
|
@ -352,7 +352,7 @@
|
|||
{
|
||||
UPCFG2X = Milliseconds;
|
||||
}
|
||||
|
||||
|
||||
/** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should
|
||||
* be serviced.
|
||||
*
|
||||
|
|
@ -363,7 +363,7 @@
|
|||
{
|
||||
return UPINT;
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
|
||||
* pipes).
|
||||
*
|
||||
|
|
@ -376,14 +376,14 @@
|
|||
{
|
||||
return ((UPINT & (1 << PipeNumber)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
|
||||
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Unfreeze(void)
|
||||
{
|
||||
UPCONX &= ~(1 << PFREEZE);
|
||||
}
|
||||
|
||||
|
||||
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
|
||||
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Freeze(void)
|
||||
|
|
@ -400,14 +400,14 @@
|
|||
{
|
||||
return ((UPCONX & (1 << PFREEZE)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Clears the master pipe error flag. */
|
||||
static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_ClearError(void)
|
||||
{
|
||||
UPINTX &= ~(1 << PERRI);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the master pipe error flag is set for the currently selected pipe, indicating that
|
||||
* some sort of hardware error has occurred on the pipe.
|
||||
*
|
||||
|
|
@ -420,7 +420,7 @@
|
|||
{
|
||||
return ((UPINTX & (1 << PERRI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Clears all the currently selected pipe's hardware error flags, but does not clear the master error
|
||||
* flag for the pipe.
|
||||
*/
|
||||
|
|
@ -429,7 +429,7 @@
|
|||
{
|
||||
UPERRX = 0;
|
||||
}
|
||||
|
||||
|
||||
/** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This
|
||||
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.
|
||||
*
|
||||
|
|
@ -443,7 +443,7 @@
|
|||
PIPE_ERRORFLAG_DATATGL)) |
|
||||
(UPSTAX & (PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW)));
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected pipe may be read from (if data is waiting in the pipe
|
||||
* bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT
|
||||
* direction). This function will return false if an error has occurred in the pipe, or if the pipe
|
||||
|
|
@ -453,7 +453,7 @@
|
|||
* \note This function is not valid on CONTROL type pipes.
|
||||
*
|
||||
* \ingroup Group_PipePacketManagement
|
||||
*
|
||||
*
|
||||
* \return Boolean true if the currently selected pipe may be read from or written to, depending on its direction.
|
||||
*/
|
||||
static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
||||
|
|
@ -461,7 +461,7 @@
|
|||
{
|
||||
return ((UPINTX & (1 << RWAL)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if a packet has been received on the currently selected IN pipe from the attached device.
|
||||
*
|
||||
* \ingroup Group_PipePacketManagement
|
||||
|
|
@ -473,7 +473,7 @@
|
|||
{
|
||||
return ((UPINTX & (1 << RXINI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device.
|
||||
*
|
||||
* \ingroup Group_PipePacketManagement
|
||||
|
|
@ -498,10 +498,10 @@
|
|||
{
|
||||
return ((UPINTX & (1 << TXSTPI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Sends the currently selected CONTROL type pipe's contents to the device as a SETUP packet.
|
||||
*
|
||||
* \ingroup Group_PipePacketManagement
|
||||
* \ingroup Group_PipePacketManagement
|
||||
*/
|
||||
static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_ClearSETUP(void)
|
||||
|
|
@ -558,7 +558,7 @@
|
|||
{
|
||||
UPINTX &= ~(1 << NAKEDI);
|
||||
}
|
||||
|
||||
|
||||
/** Determines if the currently selected pipe has had the STALL condition set by the attached device.
|
||||
*
|
||||
* \ingroup Group_PipePacketManagement
|
||||
|
|
@ -570,7 +570,7 @@
|
|||
{
|
||||
return ((UPINTX & (1 << RXSTALLI)) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the
|
||||
* STALL condition itself (this must be done via a ClearFeature control request to the device).
|
||||
*
|
||||
|
|
@ -614,10 +614,10 @@
|
|||
static inline void Pipe_Discard_Byte(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UPDATX;
|
||||
}
|
||||
|
||||
|
||||
/** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT
|
||||
* direction pipes.
|
||||
*
|
||||
|
|
@ -633,10 +633,10 @@
|
|||
uint16_t Word;
|
||||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[0] = UPDATX;
|
||||
Data.Bytes[1] = UPDATX;
|
||||
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
||||
|
|
@ -655,13 +655,13 @@
|
|||
uint16_t Word;
|
||||
uint8_t Bytes[2];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[1] = UPDATX;
|
||||
Data.Bytes[0] = UPDATX;
|
||||
|
||||
|
||||
return Data.Word;
|
||||
}
|
||||
|
||||
|
||||
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
|
||||
* direction pipes.
|
||||
*
|
||||
|
|
@ -675,7 +675,7 @@
|
|||
UPDATX = (Word & 0xFF);
|
||||
UPDATX = (Word >> 8);
|
||||
}
|
||||
|
||||
|
||||
/** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
|
||||
* direction pipes.
|
||||
*
|
||||
|
|
@ -698,7 +698,7 @@
|
|||
static inline void Pipe_Discard_Word(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UPDATX;
|
||||
Dummy = UPDATX;
|
||||
}
|
||||
|
|
@ -718,12 +718,12 @@
|
|||
uint32_t DWord;
|
||||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[0] = UPDATX;
|
||||
Data.Bytes[1] = UPDATX;
|
||||
Data.Bytes[2] = UPDATX;
|
||||
Data.Bytes[3] = UPDATX;
|
||||
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
||||
|
|
@ -742,12 +742,12 @@
|
|||
uint32_t DWord;
|
||||
uint8_t Bytes[4];
|
||||
} Data;
|
||||
|
||||
|
||||
Data.Bytes[3] = UPDATX;
|
||||
Data.Bytes[2] = UPDATX;
|
||||
Data.Bytes[1] = UPDATX;
|
||||
Data.Bytes[0] = UPDATX;
|
||||
|
||||
|
||||
return Data.DWord;
|
||||
}
|
||||
|
||||
|
|
@ -766,7 +766,7 @@
|
|||
UPDATX = (DWord >> 16);
|
||||
UPDATX = (DWord >> 24);
|
||||
}
|
||||
|
||||
|
||||
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
|
||||
* direction pipes.
|
||||
*
|
||||
|
|
@ -781,9 +781,9 @@
|
|||
UPDATX = (DWord >> 16);
|
||||
UPDATX = (DWord >> 8);
|
||||
UPDATX = (DWord & 0xFF);
|
||||
}
|
||||
|
||||
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
|
||||
}
|
||||
|
||||
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
|
||||
*
|
||||
* \ingroup Group_PipePrimitiveRW
|
||||
*/
|
||||
|
|
@ -791,7 +791,7 @@
|
|||
static inline void Pipe_Discard_DWord(void)
|
||||
{
|
||||
uint8_t Dummy;
|
||||
|
||||
|
||||
Dummy = UPDATX;
|
||||
Dummy = UPDATX;
|
||||
Dummy = UPDATX;
|
||||
|
|
@ -825,14 +825,14 @@
|
|||
* Speed USB devices - refer to the USB 2.0 specification.
|
||||
*
|
||||
* \param[in] Token Pipe data token, either \ref PIPE_TOKEN_SETUP, \ref PIPE_TOKEN_OUT or \ref PIPE_TOKEN_IN.
|
||||
* All pipes (except Control type) are unidirectional - data may only be read from or
|
||||
* All pipes (except Control type) are unidirectional - data may only be read from or
|
||||
* written to the pipe bank based on its direction, not both.
|
||||
*
|
||||
* \param[in] EndpointNumber Endpoint index within the attached device that the pipe should interface to.
|
||||
*
|
||||
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
|
||||
* the USB device, or after they have been received from the USB device (depending on
|
||||
* the pipe's data direction). The bank size must indicate the maximum packet size that
|
||||
* the USB device, or after they have been received from the USB device (depending on
|
||||
* the pipe's data direction). The bank size must indicate the maximum packet size that
|
||||
* the pipe can handle.
|
||||
*
|
||||
* \param[in] Banks Number of banks to use for the pipe being configured, a PIPE_BANK_* mask. More banks
|
||||
|
|
@ -862,7 +862,7 @@
|
|||
const uint16_t Size,
|
||||
const uint8_t Banks);
|
||||
|
||||
/** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read
|
||||
/** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read
|
||||
* or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).
|
||||
*
|
||||
* \ingroup Group_PipeRW
|
||||
|
|
@ -870,7 +870,7 @@
|
|||
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
|
||||
*/
|
||||
uint8_t Pipe_WaitUntilReady(void);
|
||||
|
||||
|
||||
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given
|
||||
* endpoint is found, it is automatically selected.
|
||||
*
|
||||
|
|
@ -887,20 +887,20 @@
|
|||
#if !defined(ENDPOINT_CONTROLEP)
|
||||
#define ENDPOINT_CONTROLEP 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes)
|
||||
{
|
||||
uint8_t MaskVal = 0;
|
||||
uint16_t CheckBytes = 8;
|
||||
|
||||
|
||||
while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE))
|
||||
{
|
||||
MaskVal++;
|
||||
CheckBytes <<= 1;
|
||||
}
|
||||
|
||||
|
||||
return (MaskVal << EPSIZE0);
|
||||
}
|
||||
|
||||
|
|
@ -912,7 +912,8 @@
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -50,7 +50,7 @@ void USB_Init(
|
|||
#elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS))
|
||||
void
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(USE_STATIC_OPTIONS)
|
||||
const uint8_t Options
|
||||
#endif
|
||||
|
|
@ -59,7 +59,7 @@ void USB_Init(
|
|||
#if !defined(USE_STATIC_OPTIONS)
|
||||
USB_Options = Options;
|
||||
#endif
|
||||
|
||||
|
||||
if (!(USB_Options & USB_OPT_REG_DISABLED))
|
||||
USB_REG_On();
|
||||
else
|
||||
|
|
@ -69,7 +69,7 @@ void USB_Init(
|
|||
if (Mode == USB_MODE_UID)
|
||||
{
|
||||
UHWCON |= (1 << UIDE);
|
||||
USB_INT_Enable(USB_INT_IDTI);
|
||||
USB_INT_Enable(USB_INT_IDTI);
|
||||
USB_CurrentMode = USB_GetUSBModeFromUID();
|
||||
}
|
||||
else
|
||||
|
|
@ -90,10 +90,10 @@ void USB_ShutDown(void)
|
|||
|
||||
USB_Detach();
|
||||
USB_Controller_Disable();
|
||||
|
||||
|
||||
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||
USB_PLL_Off();
|
||||
|
||||
|
||||
USB_REG_Off();
|
||||
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
|
||||
|
|
@ -115,9 +115,9 @@ void USB_ResetInterface(void)
|
|||
|
||||
USB_INT_DisableAllInterrupts();
|
||||
USB_INT_ClearAllInterrupts();
|
||||
|
||||
|
||||
USB_Controller_Reset();
|
||||
|
||||
|
||||
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||
{
|
||||
#if defined(USB_SERIES_4_AVR)
|
||||
|
|
@ -137,14 +137,14 @@ void USB_ResetInterface(void)
|
|||
#endif
|
||||
|
||||
USB_CLK_Unfreeze();
|
||||
|
||||
|
||||
if (USB_CurrentMode == USB_MODE_Device)
|
||||
{
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
|
||||
UHWCON |= (1 << UIMOD);
|
||||
#endif
|
||||
|
||||
|
||||
USB_Init_Device();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ void USB_ResetInterface(void)
|
|||
USB_Init_Host();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
|
||||
USB_OTGPAD_On();
|
||||
#endif
|
||||
|
|
@ -170,7 +170,7 @@ static void USB_Init_Device(void)
|
|||
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
||||
USB_RemoteWakeupEnabled = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(NO_DEVICE_SELF_POWER)
|
||||
USB_CurrentlySelfPowered = false;
|
||||
#endif
|
||||
|
|
@ -179,7 +179,7 @@ static void USB_Init_Device(void)
|
|||
USB_Descriptor_Device_t* DeviceDescriptorPtr;
|
||||
|
||||
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR)
|
||||
{
|
||||
{
|
||||
#if defined(USE_RAM_DESCRIPTORS)
|
||||
USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size;
|
||||
#elif defined(USE_EEPROM_DESCRIPTORS)
|
||||
|
|
@ -201,7 +201,7 @@ static void USB_Init_Device(void)
|
|||
|
||||
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
|
||||
ENDPOINT_DIR_OUT, USB_ControlEndpointSize,
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
ENDPOINT_BANK_SINGLE);
|
||||
|
||||
USB_INT_Clear(USB_INT_SUSPI);
|
||||
USB_INT_Enable(USB_INT_SUSPI);
|
||||
|
|
@ -218,7 +218,7 @@ static void USB_Init_Host(void)
|
|||
USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
|
||||
|
||||
USB_Host_HostMode_On();
|
||||
|
||||
|
||||
USB_Host_VBUS_Auto_Off();
|
||||
USB_Host_VBUS_Manual_Enable();
|
||||
USB_Host_VBUS_Manual_On();
|
||||
|
|
@ -229,3 +229,4 @@ static void USB_Init_Host(void)
|
|||
USB_Attach();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
* \note This file should not be included directly. It is automatically included as needed by the USB driver
|
||||
* dispatch header located in LUFA/Drivers/USB/USB.h.
|
||||
*/
|
||||
|
||||
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_USBManagement USB Interface Management
|
||||
*
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#include "../HighLevel/USBMode.h"
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
#include "../HighLevel/Events.h"
|
||||
#include "../HighLevel/USBTask.h"
|
||||
#include "USBInterrupt.h"
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
|
||||
#include "Host.h"
|
||||
#include "OTG.h"
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
#include "../HighLevel/HostStandardReq.h"
|
||||
#include "../HighLevel/PipeStream.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
|
||||
#include "Device.h"
|
||||
#include "Endpoint.h"
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
#if !defined(F_CLOCK)
|
||||
#error F_CLOCK is not defined. You must define F_CLOCK to the frequency of the unprescaled input clock in your project makefile.
|
||||
#endif
|
||||
|
||||
|
||||
#if (F_CLOCK == 8000000)
|
||||
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \
|
||||
defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \
|
||||
|
|
@ -116,13 +116,13 @@
|
|||
#define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP0))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(USB_PLL_PSC)
|
||||
#error No PLL prescale value available for chosen F_CPU value and AVR model.
|
||||
#endif
|
||||
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/* Macros: */
|
||||
/** Regulator disable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad
|
||||
* regulator should be enabled to regulate the data pin voltages to within the USB standard.
|
||||
*
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
* \note See USB AVR data sheet for more information on the internal pad regulator.
|
||||
*/
|
||||
#define USB_OPT_REG_ENABLED (0 << 1)
|
||||
|
||||
|
||||
/** Manual PLL control option mask for \ref USB_Init(). This indicates to the library that the user application
|
||||
* will take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock
|
||||
* that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations.
|
||||
|
|
@ -178,12 +178,12 @@
|
|||
* (both control and standard) when in either device or host mode. If the next packet of a stream
|
||||
* is not received or acknowledged within this time period, the stream function will fail.
|
||||
*
|
||||
* This value may be overridden in the user project makefile as the value of the
|
||||
* This value may be overridden in the user project makefile as the value of the
|
||||
* \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch.
|
||||
*/
|
||||
#define USB_STREAM_TIMEOUT_MS 100
|
||||
#endif
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
|
||||
/** Returns boolean true if the VBUS line is currently high (i.e. the USB host is supplying power),
|
||||
|
|
@ -246,21 +246,21 @@
|
|||
* PLL, and a USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device
|
||||
* mode speed.
|
||||
*
|
||||
* \note To reduce the FLASH requirements of the library if only device or host mode is required,
|
||||
* \note To reduce the FLASH requirements of the library if only device or host mode is required,
|
||||
* the mode can be statically set in the project makefile by defining the token USB_DEVICE_ONLY
|
||||
* (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler
|
||||
* (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler
|
||||
* via the -D switch. If the mode is statically set, this parameter does not exist in the
|
||||
* function prototype.
|
||||
* \n\n
|
||||
*
|
||||
* \note To reduce the FLASH requirements of the library if only fixed settings are are required,
|
||||
* the options may be set statically in the same manner as the mode (see the Mode parameter of
|
||||
* the options may be set statically in the same manner as the mode (see the Mode parameter of
|
||||
* this function). To statically set the USB options, pass in the USE_STATIC_OPTIONS token,
|
||||
* defined to the appropriate options masks. When the options are statically set, this
|
||||
* parameter does not exist in the function prototype.
|
||||
* \n\n
|
||||
*
|
||||
* \note The mode parameter does not exist on devices where only one mode is possible, such as USB
|
||||
*
|
||||
* \note The mode parameter does not exist on devices where only one mode is possible, such as USB
|
||||
* AVR models which only implement the USB device mode in hardware.
|
||||
*
|
||||
* \see Device.h for the USB_DEVICE_OPT_* masks.
|
||||
|
|
@ -280,7 +280,7 @@
|
|||
const uint8_t Options
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO
|
||||
* memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface
|
||||
* is restarted with the \ref USB_Init() function.
|
||||
|
|
@ -314,7 +314,7 @@
|
|||
#elif defined(USB_DEVICE_ONLY)
|
||||
#define USB_CurrentMode USB_MODE_Device
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__)
|
||||
/** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init()
|
||||
* was called. This value will be one of the USB_MODE_* masks defined elsewhere in this module.
|
||||
|
|
@ -348,12 +348,12 @@
|
|||
#if defined(USB_CAN_BE_DEVICE)
|
||||
static void USB_Init_Device(void);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
static void USB_Init_Host(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Inline Functions: */
|
||||
static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_PLL_On(void)
|
||||
|
|
@ -361,13 +361,13 @@
|
|||
PLLCSR = USB_PLL_PSC;
|
||||
PLLCSR |= (1 << PLLE);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_PLL_Off(void)
|
||||
{
|
||||
PLLCSR = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline bool USB_PLL_IsReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
||||
static inline bool USB_PLL_IsReady(void)
|
||||
{
|
||||
|
|
@ -381,7 +381,7 @@
|
|||
UHWCON |= (1 << UVREGE);
|
||||
#else
|
||||
REGCR &= ~(1 << REGDIS);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void USB_REG_Off(void) ATTR_ALWAYS_INLINE;
|
||||
|
|
@ -391,9 +391,9 @@
|
|||
UHWCON &= ~(1 << UVREGE);
|
||||
#else
|
||||
REGCR |= (1 << REGDIS);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
|
||||
static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_OTGPAD_On(void)
|
||||
|
|
@ -413,13 +413,13 @@
|
|||
{
|
||||
USBCON |= (1 << FRZCLK);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_CLK_Unfreeze(void)
|
||||
{
|
||||
USBCON &= ~(1 << FRZCLK);
|
||||
}
|
||||
|
||||
|
||||
static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void USB_Controller_Enable(void)
|
||||
{
|
||||
|
|
@ -436,11 +436,11 @@
|
|||
static inline void USB_Controller_Reset(void)
|
||||
{
|
||||
const uint8_t Temp = USBCON;
|
||||
|
||||
|
||||
USBCON = (Temp & ~(1 << USBE));
|
||||
USBCON = (Temp | (1 << USBE));
|
||||
}
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_BOTH)
|
||||
static inline uint8_t USB_GetUSBModeFromUID(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t USB_GetUSBModeFromUID(void)
|
||||
|
|
@ -453,12 +453,13 @@
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -34,19 +34,19 @@
|
|||
void USB_INT_DisableAllInterrupts(void)
|
||||
{
|
||||
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
|
||||
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
|
||||
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
|
||||
#elif defined(USB_SERIES_4_AVR)
|
||||
USBCON &= ~(1 << VBUSTE);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_BOTH)
|
||||
OTGIEN = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
UHIEN = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
UDIEN = 0;
|
||||
#endif
|
||||
|
|
@ -57,15 +57,15 @@ void USB_INT_ClearAllInterrupts(void)
|
|||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
|
||||
USBINT = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_BOTH)
|
||||
OTGINT = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
UHINT = 0;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE)
|
||||
UDINT = 0;
|
||||
#endif
|
||||
|
|
@ -86,7 +86,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
}
|
||||
else
|
||||
{
|
||||
USB_DeviceState = DEVICE_STATE_Unattached;
|
||||
USB_DeviceState = DEVICE_STATE_Unattached;
|
||||
EVENT_USB_Device_Disconnect();
|
||||
}
|
||||
}
|
||||
|
|
@ -98,9 +98,9 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
|
||||
USB_INT_Disable(USB_INT_SUSPI);
|
||||
USB_INT_Enable(USB_INT_WAKEUPI);
|
||||
|
||||
|
||||
USB_CLK_Freeze();
|
||||
|
||||
|
||||
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||
USB_PLL_Off();
|
||||
|
||||
|
|
@ -127,19 +127,19 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
|
||||
USB_INT_Disable(USB_INT_WAKEUPI);
|
||||
USB_INT_Enable(USB_INT_SUSPI);
|
||||
|
||||
|
||||
if (USB_ConfigurationNumber)
|
||||
USB_DeviceState = DEVICE_STATE_Configured;
|
||||
else
|
||||
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
|
||||
|
||||
|
||||
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
|
||||
EVENT_USB_Device_Connect();
|
||||
#else
|
||||
EVENT_USB_Device_WakeUp();
|
||||
EVENT_USB_Device_WakeUp();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_EORSTI);
|
||||
|
|
@ -161,29 +161,29 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
|
||||
EVENT_USB_Device_Reset();
|
||||
}
|
||||
|
||||
|
||||
#if !defined(NO_SOF_EVENTS)
|
||||
if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_SOFI);
|
||||
|
||||
|
||||
EVENT_USB_Device_StartOfFrame();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(USB_CAN_BE_HOST)
|
||||
if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_DDISCI);
|
||||
USB_INT_Clear(USB_INT_DCONNI);
|
||||
USB_INT_Disable(USB_INT_DDISCI);
|
||||
|
||||
|
||||
EVENT_USB_Host_DeviceUnattached();
|
||||
|
||||
USB_ResetInterface();
|
||||
}
|
||||
|
||||
|
||||
if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_VBERRI);
|
||||
|
|
@ -201,18 +201,18 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
{
|
||||
USB_INT_Clear(USB_INT_SRPI);
|
||||
USB_INT_Disable(USB_INT_SRPI);
|
||||
|
||||
|
||||
EVENT_USB_Host_DeviceAttached();
|
||||
|
||||
USB_INT_Enable(USB_INT_DDISCI);
|
||||
|
||||
|
||||
USB_HostState = HOST_STATE_Powered;
|
||||
}
|
||||
|
||||
if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_BCERRI);
|
||||
|
||||
|
||||
EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0);
|
||||
EVENT_USB_Host_DeviceUnattached();
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI))
|
||||
{
|
||||
USB_INT_Clear(USB_INT_HSOFI);
|
||||
|
||||
|
||||
EVENT_USB_Host_StartOfFrame();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -231,7 +231,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
|
||||
#if defined(USB_CAN_BE_BOTH)
|
||||
if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI))
|
||||
{
|
||||
{
|
||||
USB_INT_Clear(USB_INT_IDTI);
|
||||
|
||||
if (USB_DeviceState != DEVICE_STATE_Unattached)
|
||||
|
|
@ -239,7 +239,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
|
||||
if (USB_HostState != HOST_STATE_Unattached)
|
||||
EVENT_USB_Host_DeviceUnattached();
|
||||
|
||||
|
||||
USB_CurrentMode = USB_GetUSBModeFromUID();
|
||||
USB_ResetInterface();
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||
#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE)
|
||||
ISR(USB_COM_vect, ISR_BLOCK)
|
||||
{
|
||||
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
|
||||
uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
|
||||
|
||||
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
||||
USB_INT_Disable(USB_INT_RXSTPI);
|
||||
|
|
@ -266,3 +266,4 @@ ISR(USB_COM_vect, ISR_BLOCK)
|
|||
Endpoint_SelectEndpoint(PrevSelectedEndpoint);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
* \note This file should not be included directly. It is automatically included as needed by the USB driver
|
||||
* dispatch header located in LUFA/Drivers/USB/USB.h.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __USBINTERRUPT_H__
|
||||
#define __USBINTERRUPT_H__
|
||||
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
#include <avr/interrupt.h>
|
||||
#include <util/atomic.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
#if !defined(__INCLUDE_FROM_USB_DRIVER)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
|
||||
#endif
|
||||
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
|
|
@ -91,15 +91,16 @@
|
|||
#include "../HighLevel/USBMode.h"
|
||||
#include "../HighLevel/Events.h"
|
||||
#include "USBController.h"
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
void USB_INT_ClearAllInterrupts(void);
|
||||
void USB_INT_DisableAllInterrupts(void);
|
||||
#endif
|
||||
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2010.
|
||||
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.fourwalledcubicle.com
|
||||
*/
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
/*
|
||||
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
@ -86,9 +86,9 @@
|
|||
*
|
||||
* <table>
|
||||
* <tr>
|
||||
* <th width="100px">USB Class</th>
|
||||
* <th width="90px">Device Mode</th>
|
||||
* <th width="90px">Host Mode</th>
|
||||
* <th width="100px">USB Class</th>
|
||||
* <th width="90px">Device Mode</th>
|
||||
* <th width="90px">Host Mode</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>Audio</td>
|
||||
|
|
@ -141,10 +141,10 @@
|
|||
*
|
||||
* \subsection SSec_ClassDriverDevice Device Mode Class Drivers
|
||||
* Implementing a Device Mode Class Driver in a user application requires a number of steps to be followed. Firstly,
|
||||
* the module configuration and state structure must be added to the project source. These structures are named in a
|
||||
* the module configuration and state structure must be added to the project source. These structures are named in a
|
||||
* similar manner between classes, that of <i>USB_ClassInfo_<b>{Class Name}</b>_Device_t</i>, and are used to hold the
|
||||
* complete state and configuration for each class instance. Multiple class instances is where the power of the class
|
||||
* drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
|
||||
* complete state and configuration for each class instance. Multiple class instances is where the power of the class
|
||||
* drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
|
||||
* structure.
|
||||
*
|
||||
* Inside the ClassInfo structure lies two sections, a <i>Config</i> section, and a <i>State</i> section. The Config
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
* .Config =
|
||||
* {
|
||||
* .StreamingInterfaceNumber = 1,
|
||||
*
|
||||
*
|
||||
* .DataINEndpointNumber = 1,
|
||||
* .DataINEndpointSize = 256,
|
||||
* },
|
||||
|
|
@ -183,12 +183,12 @@
|
|||
* void EVENT_USB_Device_ConfigurationChanged(void)
|
||||
* {
|
||||
* LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
||||
*
|
||||
*
|
||||
* if (!(Audio_Device_ConfigureEndpoints(&My_Audio_Interface)))
|
||||
* LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* Once initialized, it is important to maintain the class driver's state by repeatedly calling the Class Driver's
|
||||
* <i><b>{Class Name}</b>_Device_USBTask()</i> function in the main program loop. The exact implementation of this
|
||||
* function varies between class drivers, and can be used for any internal class driver purpose to maintain each
|
||||
|
|
@ -199,13 +199,13 @@
|
|||
* int main(void)
|
||||
* {
|
||||
* SetupHardware();
|
||||
*
|
||||
*
|
||||
* LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
*
|
||||
*
|
||||
* for (;;)
|
||||
* {
|
||||
* Create_And_Process_Samples();
|
||||
*
|
||||
*
|
||||
* Audio_Device_USBTask(&My_Audio_Interface);
|
||||
* USB_USBTask();
|
||||
* }
|
||||
|
|
@ -240,10 +240,10 @@
|
|||
*
|
||||
* \subsection SSec_ClassDriverHost Host Mode Class Drivers
|
||||
* Implementing a Host Mode Class Driver in a user application requires a number of steps to be followed. Firstly,
|
||||
* the module configuration and state structure must be added to the project source. These structures are named in a
|
||||
* the module configuration and state structure must be added to the project source. These structures are named in a
|
||||
* similar manner between classes, that of <i>USB_ClassInfo_<b>{Class Name}</b>_Host_t</i>, and are used to hold the
|
||||
* complete state and configuration for each class instance. Multiple class instances is where the power of the class
|
||||
* drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
|
||||
* complete state and configuration for each class instance. Multiple class instances is where the power of the class
|
||||
* drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
|
||||
* structure.
|
||||
*
|
||||
* Inside the ClassInfo structure lies two sections, a <i>Config</i> section, and a <i>State</i> section. The Config
|
||||
|
|
@ -263,7 +263,7 @@
|
|||
* {
|
||||
* .DataINPipeNumber = 1,
|
||||
* .DataINPipeDoubleBank = false,
|
||||
*
|
||||
*
|
||||
* .DataOUTPipeNumber = 2,
|
||||
* .DataOUTPipeDoubleBank = false,
|
||||
* },
|
||||
|
|
@ -274,7 +274,7 @@
|
|||
* should be called in response to the host state machine entering the \ref HOST_STATE_Addressed state. This function
|
||||
* will return an error code from the class driver's <i><b>{Class Name}</b>_EnumerationFailure_ErrorCodes_t</i> enum
|
||||
* to indicate if the driver successfully initialized the instance and bound it to an interface in the attached device.
|
||||
* Like all the class driver functions, this function takes in the address of the specific instance you wish to initialize -
|
||||
* Like all the class driver functions, this function takes in the address of the specific instance you wish to initialize -
|
||||
* in this manner, multiple separate instances of the same class type can be initialized. A fragment of a Class Driver
|
||||
* based Host mode application may look like the following:
|
||||
*
|
||||
|
|
@ -283,7 +283,7 @@
|
|||
* {
|
||||
* case HOST_STATE_Addressed:
|
||||
* LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
|
||||
*
|
||||
*
|
||||
* uint16_t ConfigDescriptorSize;
|
||||
* uint8_t ConfigDescriptorData[512];
|
||||
*
|
||||
|
|
@ -323,16 +323,16 @@
|
|||
* int main(void)
|
||||
* {
|
||||
* SetupHardware();
|
||||
*
|
||||
*
|
||||
* LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
*
|
||||
*
|
||||
* for (;;)
|
||||
* {
|
||||
* switch (USB_HostState)
|
||||
* {
|
||||
* // Host state machine handling here
|
||||
* }
|
||||
*
|
||||
* }
|
||||
*
|
||||
* MIDI_Host_USBTask(&My_Audio_Interface);
|
||||
* USB_USBTask();
|
||||
* }
|
||||
|
|
@ -350,7 +350,7 @@
|
|||
* read and write routines. See each driver's individual documentation for more information on the
|
||||
* class-specific functions.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __USB_H__
|
||||
#define __USB_H__
|
||||
|
||||
|
|
@ -362,12 +362,12 @@
|
|||
/* Includes: */
|
||||
#include "HighLevel/USBMode.h"
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
/* Preprocessor Checks: */
|
||||
#if (!defined(USB_SERIES_2_AVR) && !defined(USB_SERIES_4_AVR) && \
|
||||
!defined(USB_SERIES_6_AVR) && !defined(USB_SERIES_7_AVR))
|
||||
#error The currently selected AVR model is not supported under the USB component of the LUFA library.
|
||||
#endif
|
||||
|
||||
|
||||
/* Includes: */
|
||||
#include "HighLevel/USBTask.h"
|
||||
#include "HighLevel/Events.h"
|
||||
|
|
@ -376,24 +376,24 @@
|
|||
|
||||
#include "LowLevel/USBController.h"
|
||||
#include "LowLevel/USBInterrupt.h"
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
|
||||
#include "LowLevel/Host.h"
|
||||
#include "LowLevel/Pipe.h"
|
||||
#include "HighLevel/HostStandardReq.h"
|
||||
#include "HighLevel/PipeStream.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
|
||||
#include "LowLevel/Device.h"
|
||||
#include "LowLevel/Endpoint.h"
|
||||
#include "HighLevel/DeviceStandardReq.h"
|
||||
#include "HighLevel/EndpointStream.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)
|
||||
#include "LowLevel/OTG.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue