[sky9x] Massstorage (not finished at all!)
[stock] 180bytes flash saved
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of a class for manipulating CDC abstract control management
|
||||
descriptors.
|
||||
|
||||
!!!Usage
|
||||
|
||||
Should be included in a list of USB configuration descriptors.
|
||||
*/
|
||||
|
||||
#ifndef CDCABSTRACTCONTROLMANAGEMENTDESCRIPTOR_H
|
||||
#define CDCABSTRACTCONTROLMANAGEMENTDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC ACM Capabilities"
|
||||
/// This page lists the capabilities of the CDC ACM.
|
||||
///
|
||||
/// !Capabilities
|
||||
/// - CDCAbstractControlManagementDescriptor_COMMFEATURE
|
||||
/// - CDCAbstractControlManagementDescriptor_LINE
|
||||
/// - CDCAbstractControlManagementDescriptor_SENDBREAK
|
||||
/// - CDCAbstractControlManagementDescriptor_NETWORKCONNECTION
|
||||
|
||||
/// Device supports the request combination of SetCommFeature, ClearCommFeature
|
||||
/// and GetCommFeature.
|
||||
#define CDCAbstractControlManagementDescriptor_COMMFEATURE (1 << 0)
|
||||
/// Device supports the request combination of SetLineCoding, GetLineCoding and
|
||||
/// SetControlLineState.
|
||||
#define CDCAbstractControlManagementDescriptor_LINE (1 << 1)
|
||||
/// Device supports the SendBreak request.
|
||||
#define CDCAbstractControlManagementDescriptor_SENDBREAK (1 << 2)
|
||||
/// Device supports the NetworkConnection notification.
|
||||
#define CDCAbstractControlManagementDescriptor_NETWORKCONNECTION (1 << 3)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack(1) // IAR
|
||||
#define __attribute__(...) // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Describes the command supported by the communication interface class
|
||||
/// with the Abstract Control Model subclass code.
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
||||
/// Size of this descriptor in bytes.
|
||||
unsigned char bFunctionLength;
|
||||
/// Descriptor type (CDCDescriptors_INTERFACE).
|
||||
unsigned char bDescriptorType;
|
||||
/// Descriptor subtype (CDCDescriptors_ABSTRACTCONTROLMANAGEMENT).
|
||||
unsigned char bDescriptorSubtype;
|
||||
/// Configuration capabilities.
|
||||
/// \sa "CDC ACM Capabilities".
|
||||
unsigned char bmCapabilities;
|
||||
|
||||
} __attribute__ ((packed)) CDCAbstractControlManagementDescriptor; // GCC
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack() // IAR
|
||||
#endif // IAR
|
||||
|
||||
#endif //#ifndef CDCABSTRACTCONTROLMANAGEMENTDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of a class for managing CDC call management descriptors.
|
||||
|
||||
!!!Usage
|
||||
|
||||
Should be included in a list of configuration descriptors for a USB
|
||||
device.
|
||||
*/
|
||||
|
||||
#ifndef CDCCALLMANAGEMENTDESCRIPTOR_H
|
||||
#define CDCCALLMANAGEMENTDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC CallManagement Capabilities"
|
||||
/// This page lists CDC CallManagement Capabilities.
|
||||
///
|
||||
/// !Capabilities
|
||||
/// - CDCCallManagementDescriptor_SELFCALLMANAGEMENT
|
||||
/// - CDCCallManagementDescriptor_DATACALLMANAGEMENT
|
||||
|
||||
/// Device handles call management itself.
|
||||
#define CDCCallManagementDescriptor_SELFCALLMANAGEMENT (1 << 0)
|
||||
/// Device can exchange call management information over a Data class interface.
|
||||
#define CDCCallManagementDescriptor_DATACALLMANAGEMENT (1 << 1)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack(1) // IAR
|
||||
#define __attribute__(...) // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Describes the processing of calls for the communication class interface.
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
||||
/// Size of this descriptor in bytes.
|
||||
unsigned char bFunctionLength;
|
||||
/// Descriptor type (CDCDescriptors_INTERFACE).
|
||||
unsigned char bDescriptorType;
|
||||
/// Descriptor sub-type (CDCDescriptors_CALLMANAGEMENT).
|
||||
unsigned char bDescriptorSubtype;
|
||||
/// Configuration capabilities ("CDC CallManagement Capabilities").
|
||||
unsigned char bmCapabilities;
|
||||
/// Interface number of the data class interface used for call management
|
||||
/// (optional).
|
||||
unsigned char bDataInterface;
|
||||
|
||||
} __attribute__ ((packed)) CDCCallManagementDescriptor; // GCC
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack() // IAR
|
||||
#endif // IAR
|
||||
|
||||
#endif //#ifndef CDCCALLMANAGEMENTDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of several constants used when declaring a CDC communication
|
||||
class interface descriptor.
|
||||
*/
|
||||
|
||||
#ifndef CDCCOMMUNICATIONINTERFACEDESCRIPTOR_H
|
||||
#define CDCCOMMUNICATIONINTERFACEDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Communication Interface Values"
|
||||
/// This page lists the values for CDC Communication Interface Descriptor.
|
||||
///
|
||||
/// !Values
|
||||
/// - CDCCommunicationInterfaceDescriptor_CLASS
|
||||
/// - CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL
|
||||
/// - CDCCommunicationInterfaceDescriptor_NOPROTOCOL
|
||||
|
||||
/// Interface class code for a CDC communication class interface.
|
||||
#define CDCCommunicationInterfaceDescriptor_CLASS 0x02
|
||||
/// Interface subclass code for an Abstract Control Model interface descriptor.
|
||||
#define CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL 0x02
|
||||
/// Interface protocol code when a CDC communication interface does not
|
||||
/// implemenent any particular protocol.
|
||||
#define CDCCommunicationInterfaceDescriptor_NOPROTOCOL 0x00
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif //#ifndef CDCCOMMUNICATIONINTERFACEDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definitions of constants used when declaring a CDC data class interface
|
||||
descriptor.
|
||||
*/
|
||||
|
||||
#ifndef CDCDATAINTERFACEDESCRIPTOR_H
|
||||
#define CDCDATAINTERFACEDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Data Interface Values"
|
||||
/// This page lists the values for CDC Data Interface Descriptor.
|
||||
///
|
||||
/// !Values
|
||||
/// - CDCDataInterfaceDescriptor_CLASS
|
||||
/// - CDCDataInterfaceDescriptor_SUBCLASS
|
||||
/// - CDCDataInterfaceDescriptor_NOPROTOCOL
|
||||
|
||||
/// Interface class code for a data class interface.
|
||||
#define CDCDataInterfaceDescriptor_CLASS 0x0A
|
||||
/// Interface subclass code for a data class interface.
|
||||
#define CDCDataInterfaceDescriptor_SUBCLASS 0x00
|
||||
/// Protocol code for a data class interface which does not implement any
|
||||
/// particular protocol.
|
||||
#define CDCDataInterfaceDescriptor_NOPROTOCOL 0x00
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif //#ifndef CDCDATAINTERFACEDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of several constants used when declaring USB CDC device
|
||||
descriptors.
|
||||
*/
|
||||
|
||||
#ifndef CDCDEVICEDESCRIPTOR_H
|
||||
#define CDCDEVICEDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Device Descriptor Values"
|
||||
/// This page lists the values for CDC Device Descriptor.
|
||||
///
|
||||
/// !Values
|
||||
/// - CDCDeviceDescriptor_CLASS
|
||||
/// - CDCDeviceDescriptor_SUBCLASS
|
||||
/// - CDCDeviceDescriptor_PROTOCOL
|
||||
|
||||
/// Device class code when using the CDC class.
|
||||
#define CDCDeviceDescriptor_CLASS 0x02
|
||||
/// Device subclass code when using the CDC class.
|
||||
#define CDCDeviceDescriptor_SUBCLASS 0x00
|
||||
/// Device protocol code when using the CDC class.
|
||||
#define CDCDeviceDescriptor_PROTOCOL 0x00
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif //#ifndef CDCDEVICEDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of several constants for declaring CDC descriptors.
|
||||
*/
|
||||
|
||||
#ifndef CDCGENERICDESCRIPTOR_H
|
||||
#define CDCGENERICDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Specification Release Numbers"
|
||||
/// This page list the CDC Spec. Release Numbers.
|
||||
///
|
||||
/// !Numbers
|
||||
/// - CDCGenericDescriptor_CDC1_10
|
||||
|
||||
/// Identify CDC specification version 1.10.
|
||||
#define CDCGenericDescriptor_CDC1_10 0x0110
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Descriptro Types"
|
||||
/// This page lists CDC descriptor types.
|
||||
///
|
||||
/// !Types
|
||||
/// - CDCGenericDescriptor_INTERFACE
|
||||
/// - CDCGenericDescriptor_ENDPOINT
|
||||
|
||||
///Indicates that a CDC descriptor applies to an interface.
|
||||
#define CDCGenericDescriptor_INTERFACE 0x24
|
||||
/// Indicates that a CDC descriptor applies to an endpoint.
|
||||
#define CDCGenericDescriptor_ENDPOINT 0x25
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Descriptor Subtypes"
|
||||
/// This page lists CDC descriptor sub types
|
||||
///
|
||||
/// !Types
|
||||
/// - CDCGenericDescriptor_HEADER
|
||||
/// - CDCGenericDescriptor_CALLMANAGEMENT
|
||||
/// - CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT
|
||||
/// - CDCGenericDescriptor_UNION
|
||||
|
||||
/// Header functional descriptor subtype.
|
||||
#define CDCGenericDescriptor_HEADER 0x00
|
||||
/// Call management functional descriptor subtype.
|
||||
#define CDCGenericDescriptor_CALLMANAGEMENT 0x01
|
||||
/// Abstract control management descriptor subtype.
|
||||
#define CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT 0x02
|
||||
/// Union descriptor subtype.
|
||||
#define CDCGenericDescriptor_UNION 0x06
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif //#ifndef CDCGENERICDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Various definitions used for characterizing USB CDC requests.
|
||||
*/
|
||||
|
||||
#ifndef CDCGENERICREQUEST_H
|
||||
#define CDCGENERICREQUEST_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC Request Codes"
|
||||
/// This page lists USB CDC Request Codes.
|
||||
///
|
||||
/// !Codes
|
||||
/// - CDCGenericRequest_SETLINECODING
|
||||
/// - CDCGenericRequest_GETLINECODING
|
||||
/// - CDCGenericRequest_SETCONTROLLINESTATE
|
||||
|
||||
/// SetLineCoding request code.
|
||||
#define CDCGenericRequest_SETLINECODING 0x20
|
||||
/// GetLineCoding request code.
|
||||
#define CDCGenericRequest_GETLINECODING 0x21
|
||||
/// SetControlLineState request code.
|
||||
#define CDCGenericRequest_SETCONTROLLINESTATE 0x22
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif //#ifndef CDCGENERICREQUEST_H
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of the CDCHeaderDescriptor class.
|
||||
|
||||
!!!Usage
|
||||
|
||||
Should be included in a USB configuration descriptor.
|
||||
*/
|
||||
|
||||
#ifndef CDCHEADERDESCRIPTOR_H
|
||||
#define CDCHEADERDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack(1) // IAR
|
||||
#define __attribute__(...) // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Marks the beginning of the concatenated set of functional descriptors
|
||||
/// for the interface.
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
||||
/// Size of this descriptor in bytes.
|
||||
unsigned char bFunctionLength;
|
||||
/// Descriptor type (CDCDescriptors_INTERFACE).
|
||||
unsigned char bDescriptorType;
|
||||
/// Descriptor sub-type (CDCDescriptors_HEADER).
|
||||
unsigned char bDescriptorSubtype;
|
||||
/// USB CDC specification release number.
|
||||
unsigned short bcdCDC;
|
||||
|
||||
} __attribute__ ((packed)) CDCHeaderDescriptor; // GCC
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack() // IAR
|
||||
#endif // IAR
|
||||
|
||||
#endif //#ifndef CDCHEADERDESCRIPTOR_H
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
Title: CDCLineCoding
|
||||
|
||||
About: Purpose
|
||||
Implementation of the CDCLineCoding class.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "CDCLineCoding.h"
|
||||
#include <utility/assert.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Initializes the bitrate, number of stop bits, parity checking and
|
||||
/// number of data bits of a CDCLineCoding object.
|
||||
/// \param lineCoding Pointer to a CDCLineCoding instance.
|
||||
/// \param bitrate Bitrate of the virtual COM connection.
|
||||
/// \param stopbits Number of stop bits ("CDC LineCoding StopBits").
|
||||
/// \param parity Parity check type ("CDC LineCoding ParityChecking").
|
||||
/// \param databits Number of data bits.
|
||||
//------------------------------------------------------------------------------
|
||||
void CDCLineCoding_Initialize(CDCLineCoding *lineCoding,
|
||||
unsigned int bitrate,
|
||||
unsigned char stopbits,
|
||||
unsigned char parity,
|
||||
unsigned char databits)
|
||||
{
|
||||
ASSERT(stopbits <= CDCLineCoding_TWOSTOPBITS,
|
||||
"CDCLineCoding_Initialize: Invalid stopbits value (%d)\n\r",
|
||||
stopbits);
|
||||
ASSERT(parity <= CDCLineCoding_SPACEPARITY,
|
||||
"CDCLineCoding_Initialize: Invalid parity value (%d)\n\r",
|
||||
parity);
|
||||
ASSERT(((databits >= 5) && (databits <= 8)) || (databits == 16),
|
||||
"CDCLineCoding_Initialize: Invalid databits value (%d)\n\r",
|
||||
databits);
|
||||
|
||||
lineCoding->dwDTERate = bitrate;
|
||||
lineCoding->bCharFormat = stopbits;
|
||||
lineCoding->bParityType = parity;
|
||||
lineCoding->bDataBits = databits;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Line coding structure used for by the CDC GetLineCoding and SetLineCoding
|
||||
requests.
|
||||
|
||||
!!!Usage
|
||||
|
||||
-# Initialize a CDCLineCoding instance using CDCLineCoding_Initialize.
|
||||
-# Send a CDCLineCoding object to the host in response to a GetLineCoding
|
||||
request.
|
||||
-# Receive a CDCLineCoding object from the host after a SetLineCoding
|
||||
request.
|
||||
*/
|
||||
|
||||
#ifndef CDCLINECODING_H
|
||||
#define CDCLINECODING_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC LineCoding StopBits"
|
||||
/// This page lists Stop Bits for CDC Line Coding.
|
||||
///
|
||||
/// !Stop bits
|
||||
/// - CDCLineCoding_ONESTOPBIT
|
||||
/// - CDCLineCoding_ONE5STOPBIT
|
||||
/// - CDCLineCoding_TWOSTOPBITS
|
||||
|
||||
/// The transmission protocol uses one stop bit.
|
||||
#define CDCLineCoding_ONESTOPBIT 0
|
||||
/// The transmission protocol uses 1.5 stop bit.
|
||||
#define CDCLineCoding_ONE5STOPBIT 1
|
||||
/// The transmissin protocol uses two stop bits.
|
||||
#define CDCLineCoding_TWOSTOPBITS 2
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \page "CDC LineCoding ParityCheckings"
|
||||
/// This page lists Parity checkings for CDC Line Coding.
|
||||
///
|
||||
/// !Parity checking
|
||||
/// - CDCLineCoding_NOPARITY
|
||||
/// - CDCLineCoding_ODDPARITY
|
||||
/// - CDCLineCoding_EVENPARITY
|
||||
/// - CDCLineCoding_MARKPARITY
|
||||
/// - CDCLineCoding_SPACEPARITY
|
||||
|
||||
/// No parity checking.
|
||||
#define CDCLineCoding_NOPARITY 0
|
||||
/// Odd parity checking.
|
||||
#define CDCLineCoding_ODDPARITY 1
|
||||
/// Even parity checking.
|
||||
#define CDCLineCoding_EVENPARITY 2
|
||||
/// Mark parity checking.
|
||||
#define CDCLineCoding_MARKPARITY 3
|
||||
/// Space parity checking.
|
||||
#define CDCLineCoding_SPACEPARITY 4
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack(1) // IAR
|
||||
#define __attribute__(...) // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Format of the data returned when a GetLineCoding request is received.
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
||||
/// Data terminal rate in bits per second.
|
||||
unsigned int dwDTERate;
|
||||
/// Number of stop bits.
|
||||
/// \sa "CDC LineCoding StopBits".
|
||||
char bCharFormat;
|
||||
/// Type of parity checking used.
|
||||
/// \sa "CDC LineCoding ParityCheckings".
|
||||
char bParityType;
|
||||
/// Number of data bits (5, 6, 7, 8 or 16).
|
||||
char bDataBits;
|
||||
|
||||
} __attribute__ ((packed)) CDCLineCoding; // GCC
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack() // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern void CDCLineCoding_Initialize(CDCLineCoding *lineCoding,
|
||||
unsigned int bitrate,
|
||||
unsigned char stopbits,
|
||||
unsigned char parity,
|
||||
unsigned char databits);
|
||||
|
||||
#endif //#ifndef CDCLINECODING_H
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
CDCSetControlLineStateRequest.c
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Implementation of the CDCSetControlLineStateRequest class.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "CDCSetControlLineStateRequest.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Notifies if the given request indicates that the DTE signal is present.
|
||||
/// \param request Pointer to a USBGenericRequest instance.
|
||||
/// \return 1 if the DTE signal is present, otherwise 0.
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned char CDCSetControlLineStateRequest_IsDtePresent(
|
||||
const USBGenericRequest *request)
|
||||
{
|
||||
if ((USBGenericRequest_GetValue(request) & 0x0001) != 0) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Notifies if the given request indicates that the device carrier should
|
||||
/// be activated.
|
||||
/// \param request Pointer to a USBGenericRequest instance.
|
||||
/// \return 1 is the device should activate its carrier, 0 otherwise.
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned char CDCSetControlLineStateRequest_ActivateCarrier(
|
||||
const USBGenericRequest *request)
|
||||
{
|
||||
if ((USBGenericRequest_GetValue(request) & 0x0002) != 0) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of a class for manipulating SetControlLineState requests.
|
||||
*/
|
||||
|
||||
#ifndef CDCSETCONTROLLINESTATE_H
|
||||
#define CDCSETCONTROLLINESTATE_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <usb/common/core/USBGenericRequest.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern unsigned char CDCSetControlLineStateRequest_IsDtePresent(
|
||||
const USBGenericRequest *request);
|
||||
|
||||
|
||||
extern unsigned char CDCSetControlLineStateRequest_ActivateCarrier(
|
||||
const USBGenericRequest *request);
|
||||
|
||||
#endif //#ifndef CDCSETCONTROLLINESTATE_H
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
\unit
|
||||
|
||||
!!!Purpose
|
||||
|
||||
Definition of a class for manipulating CDC union descriptors.
|
||||
|
||||
!!!Usage
|
||||
|
||||
Should be included in the list of USB descriptor used for a device
|
||||
configuration.
|
||||
*/
|
||||
|
||||
#ifndef CDCUNIONDESCRIPTOR_H
|
||||
#define CDCUNIONDESCRIPTOR_H
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack(1) // IAR
|
||||
#define __attribute__(...) // IAR
|
||||
#endif // IAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Describes the relationship between a group of interfaces that can
|
||||
/// be considered to form a functional unit.
|
||||
//------------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
||||
/// Size of the descriptor in bytes.
|
||||
unsigned char bFunctionLength;
|
||||
/// Descriptor type (CDCDescriptors_INTERFACE).
|
||||
unsigned char bDescriptorType;
|
||||
/// Descriptor subtype (CDCDescriptors_UNION).
|
||||
unsigned char bDescriptorSubtype;
|
||||
/// Number of the master interface for this union.
|
||||
unsigned char bMasterInterface;
|
||||
/// Number of the first slave interface for this union.
|
||||
unsigned char bSlaveInterface0;
|
||||
|
||||
} __attribute__ ((packed)) CDCUnionDescriptor; // GCC
|
||||
|
||||
#ifdef __ICCARM__ // IAR
|
||||
#pragma pack() // IAR
|
||||
#endif // IAR
|
||||
|
||||
#endif //#ifndef CDCUNIONDESCRIPTOR_H
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \dir
|
||||
/// !Purpose
|
||||
///
|
||||
/// This directory contains structures and definitions related to the USB CDC
|
||||
/// specification. They can be divided into two groups:
|
||||
/// - CDC-specific descriptors, prefixed with CDC and suffixed with Descriptor.
|
||||
/// - CDC-specific requests, prefixed with CDC and suffixed with Request.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user