SAMV71 Xplained Ultra Software Package 1.5

CDCDescriptors.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /** \file
00031  *
00032  *  Definitions and classes for USB CDC class descriptors.
00033  */
00034 
00035 #ifndef _CDCDESCRIPTORS_H_
00036 #define _CDCDESCRIPTORS_H_
00037 /** \addtogroup usb_cdc
00038  *@{
00039  */
00040 
00041 /*----------------------------------------------------------------------------
00042  *         Includes
00043  *----------------------------------------------------------------------------*/
00044 
00045 #include <stdint.h>
00046 
00047 /*----------------------------------------------------------------------------
00048  *         Definitions
00049  *----------------------------------------------------------------------------*/
00050 
00051 /** \addtogroup usb_cdc_ver USB CDC Specification Release Numbers
00052  *      @{
00053  * This section list the CDC Spec. Release Numbers.
00054  * - \ref CDCGenericDescriptor_CDC1_10
00055  */
00056  
00057 /** Identify CDC specification version 1.10. */
00058 #define CDCGenericDescriptor_CDC1_10                            0x0110
00059 /**     @}*/
00060 
00061 /** \addtogroup usb_cdc_desc_type CDC Descriptor Types
00062  *      @{
00063  * This section lists CDC descriptor types.
00064  * - \ref CDCGenericDescriptor_INTERFACE
00065  * - \ref CDCGenericDescriptor_ENDPOINT
00066  */
00067 /**Indicates that a CDC descriptor applies to an interface. */
00068 #define CDCGenericDescriptor_INTERFACE                          0x24
00069 /** Indicates that a CDC descriptor applies to an endpoint. */
00070 #define CDCGenericDescriptor_ENDPOINT                           0x25
00071 /**     @}*/
00072 
00073 /** \addtogroup usb_cdc_desc_subtype CDC Descriptor Subtypes
00074  *      @{
00075  * This section lists CDC descriptor sub types
00076  * - \ref CDCGenericDescriptor_HEADER
00077  * - \ref CDCGenericDescriptor_CALLMANAGEMENT
00078  * - \ref CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT
00079  * - \ref CDCGenericDescriptor_UNION
00080  */
00081 
00082 /** Header functional descriptor subtype. */
00083 #define CDCGenericDescriptor_HEADER                             0x00
00084 /** Call management functional descriptor subtype. */
00085 #define CDCGenericDescriptor_CALLMANAGEMENT                     0x01
00086 /** Abstract control management descriptor subtype. */
00087 #define CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT          0x02
00088 /** Union descriptor subtype. */
00089 #define CDCGenericDescriptor_UNION                              0x06
00090 /**    @}*/
00091 
00092 /** \addtogroup usb_cdc_descriptor USB CDC Device Descriptor Values
00093  *  @{
00094  * This section lists the values for CDC Device Descriptor.
00095  * - \ref CDCDeviceDescriptor_CLASS
00096  * - \ref CDCDeviceDescriptor_SUBCLASS
00097  * - \ref CDCDeviceDescriptor_PROTOCOL
00098  */
00099 /** Device class code when using the CDC class. */
00100 #define CDCDeviceDescriptor_CLASS               0x02
00101 /** Device subclass code when using the CDC class. */
00102 #define CDCDeviceDescriptor_SUBCLASS            0x00
00103 /** Device protocol code when using the CDC class. */
00104 #define CDCDeviceDescriptor_PROTOCOL            0x00
00105 /** @}*/
00106 
00107 /** \addtogroup usb_cdc_if_desc USB CDC Communication Interface Descriptor
00108  *  @{
00109  * This section lists the values for CDC Communication Interface Descriptor.
00110  * - \ref CDCCommunicationInterfaceDescriptor_CLASS
00111  * - \ref CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL
00112  * - \ref CDCCommunicationInterfaceDescriptor_ETHERNETEMULATIONMODEL
00113  * - \ref CDCCommunicationInterfaceDescriptor_NOPROTOCOL
00114  * - \ref CDCCommunicationInterfaceDescriptor_EEMPROTOCOL
00115  */
00116 /** Interface class code for a CDC communication class interface. */
00117 #define CDCCommunicationInterfaceDescriptor_CLASS                   0x02
00118 /** Interface subclass code for an Abstract Control Model interface descriptor.
00119  */
00120 #define CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL    0x02
00121 /** Interface subclass code for an Ethernet Emulation Model interface descriptor.
00122  */
00123 #define CDCCommunicationInterfaceDescriptor_ETHERNETEMULATIONMODEL  0x0C
00124 /** Interface protocol code when a CDC communication interface does not
00125     implement any particular protocol. */
00126 #define CDCCommunicationInterfaceDescriptor_NOPROTOCOL              0x00
00127 /** Interface protocol code for an Ethernet Emulation Model interface.
00128  */
00129 #define CDCCommunicationInterfaceDescriptor_EEMPROTOCOL             0x07
00130 /** @}*/
00131 
00132 /** \addtogroup usb_cdc_data_if USB CDC Data Interface Values
00133  *  @{
00134  * This section lists the values for CDC Data Interface Descriptor.
00135  * - \ref CDCDataInterfaceDescriptor_CLASS
00136  * - \ref CDCDataInterfaceDescriptor_SUBCLASS
00137  * - \ref CDCDataInterfaceDescriptor_NOPROTOCOL
00138  */
00139  
00140 /** Interface class code for a data class interface. */
00141 #define CDCDataInterfaceDescriptor_CLASS        0x0A
00142 /** Interface subclass code for a data class interface. */
00143 #define CDCDataInterfaceDescriptor_SUBCLASS     0x00
00144 /** Protocol code for a data class interface which does not implement any
00145     particular protocol. */
00146 #define CDCDataInterfaceDescriptor_NOPROTOCOL   0x00
00147 /** @}*/
00148 
00149 /** \addtogroup usb_cdc_cb_man_desc USB CDC CallManagement Capabilities
00150  *  @{
00151  * This section lists CDC CallManagement Capabilities.
00152  * - \ref CDCCallManagementDescriptor_SELFCALLMANAGEMENT
00153  * - \ref CDCCallManagementDescriptor_DATACALLMANAGEMENT
00154  */
00155 /** Device handles call management itself. */
00156 #define CDCCallManagementDescriptor_SELFCALLMANAGEMENT      (1 << 0)
00157 /** Device can exchange call management information over a Data class interface.
00158  */
00159 #define CDCCallManagementDescriptor_DATACALLMANAGEMENT      (1 << 1)
00160 /** @}*/
00161 
00162 /** \addtogroup usb_cdc_acm USB CDC ACM Capabilities
00163  *  @{
00164  *
00165  * This section lists the capabilities of the CDC ACM.
00166  * - \ref CDCAbstractControlManagementDescriptor_COMMFEATURE
00167  * - \ref CDCAbstractControlManagementDescriptor_LINE
00168  * - \ref CDCAbstractControlManagementDescriptor_SENDBREAK
00169  * - \ref CDCAbstractControlManagementDescriptor_NETWORKCONNECTION
00170  */
00171  
00172 /** Device supports the request combination of SetCommFeature, ClearCommFeature
00173     and GetCommFeature. */
00174 #define CDCAbstractControlManagementDescriptor_COMMFEATURE          (1 << 0)
00175 /** Device supports the request combination of SetLineCoding, GetLineCoding and
00176     SetControlLineState. */
00177 #define CDCAbstractControlManagementDescriptor_LINE                 (1 << 1)
00178 /** Device supports the SendBreak request. */
00179 #define CDCAbstractControlManagementDescriptor_SENDBREAK            (1 << 2)
00180 /** Device supports the NetworkConnection notification. */
00181 #define CDCAbstractControlManagementDescriptor_NETWORKCONNECTION    (1 << 3)
00182 /** @}*/
00183 
00184 
00185 //! \name USB CDC Subclass IDs
00186 //@{
00187 #define  CDC_SUBCLASS_DLCM    0x01  //!< Direct Line Control Model
00188 #define  CDC_SUBCLASS_ACM     0x02  //!< Abstract Control Model
00189 #define  CDC_SUBCLASS_TCM     0x03  //!< Telephone Control Model
00190 #define  CDC_SUBCLASS_MCCM    0x04  //!< Multi-Channel Control Model
00191 #define  CDC_SUBCLASS_CCM     0x05  //!< CAPI Control Model
00192 #define  CDC_SUBCLASS_ETH     0x06  //!< Ethernet Networking Control Model
00193 #define  CDC_SUBCLASS_ATM     0x07  //!< ATM Networking Control Model
00194 //@}
00195 
00196 //! \name USB CDC Communication Interface Protocol IDs
00197 //@{
00198 #define  CDC_PROTOCOL_V25TER  0x01  //!< Common AT commands
00199 //@}
00200 
00201 //! \name USB CDC Data Interface Protocol IDs
00202 //@{
00203 #define  CDC_PROTOCOL_I430    0x30  //!< ISDN BRI
00204 #define  CDC_PROTOCOL_HDLC    0x31  //!< HDLC
00205 #define  CDC_PROTOCOL_TRANS   0x32  //!< Transparent
00206 #define  CDC_PROTOCOL_Q921M   0x50  //!< Q.921 management protocol
00207 #define  CDC_PROTOCOL_Q921    0x51  //!< Q.931 [sic] Data link protocol
00208 #define  CDC_PROTOCOL_Q921TM  0x52  //!< Q.921 TEI-multiplexor
00209 #define  CDC_PROTOCOL_V42BIS  0x90  //!< Data compression procedures
00210 #define  CDC_PROTOCOL_Q931    0x91  //!< Euro-ISDN protocol control
00211 #define  CDC_PROTOCOL_V120    0x92  //!< V.24 rate adaption to ISDN
00212 #define  CDC_PROTOCOL_CAPI20  0x93  //!< CAPI Commands
00213 #define  CDC_PROTOCOL_HOST    0xFD  //!< Host based driver
00214 /**
00215  * \brief Describes the Protocol Unit Functional Descriptors [sic]
00216  * on Communication Class Interface
00217  */
00218 #define  CDC_PROTOCOL_PUFD    0xFE
00219 //@}
00220 /*----------------------------------------------------------------------------
00221  *         Types
00222  *----------------------------------------------------------------------------*/
00223 #pragma pack(1)
00224 #if defined   ( __CC_ARM   ) /* Keil ¦̀Vision 4 */
00225 #elif defined ( __ICCARM__ ) /* IAR Ewarm */
00226 #define __attribute__(...)
00227 #define __packed__  packed
00228 #elif defined (  __GNUC__  ) /* GCC CS3 */
00229 #define __packed__  aligned(1)
00230 #endif
00231 /**
00232  * \typedef CDCHeaderDescriptor
00233  * \brief Marks the beginning of the concatenated set of functional descriptors
00234  *        for the interface.
00235  */
00236 typedef struct _CDCHeaderDescriptor {
00237 
00238     /** Size of this descriptor in bytes. */
00239     uint8_t bFunctionLength;
00240     /** Descriptor type . */
00241     uint8_t bDescriptorType;
00242     /** Descriptor sub-type . */
00243     uint8_t bDescriptorSubtype;
00244     /** USB CDC specification release number. */
00245     uint16_t bcdCDC;
00246 
00247 } __attribute__ ((__packed__)) CDCHeaderDescriptor; /* GCC */
00248 
00249 /**
00250  * \typedef CDCUnionDescriptor
00251  * \brief Describes the relationship between a group of interfaces that can
00252  *        be considered to form a functional unit.
00253  */
00254 typedef struct _CDCUnionDescriptor {
00255 
00256     /** Size of the descriptor in bytes. */
00257     uint8_t bFunctionLength;
00258     /** Descriptor type . */
00259     uint8_t bDescriptorType;
00260     /** Descriptor subtype . */
00261     uint8_t bDescriptorSubtype;
00262     /** Number of the master interface for this union. */
00263     uint8_t bMasterInterface;
00264     /** Number of the first slave interface for this union. */
00265     uint8_t bSlaveInterface0;
00266 
00267 } __attribute__ ((__packed__)) CDCUnionDescriptor; /* GCC */
00268 
00269 /**
00270  * \typedef CDCCallManagementDescriptor
00271  * \brief Describes the processing of calls for the communication class
00272  *        interface.
00273  */
00274 typedef struct _CDCCallManagementDescriptor {
00275 
00276     /** Size of this descriptor in bytes. */
00277     uint8_t bFunctionLength;
00278     /** Descriptor type . */
00279     uint8_t bDescriptorType;
00280     /** Descriptor sub-type . */
00281     uint8_t bDescriptorSubtype;
00282     /** Configuration capabilities
00283         \sa usb_cdc_cb_man_desc CDC CallManagement Capabilities. */
00284     uint8_t bmCapabilities;
00285     /** Interface number of the data class interface used for call management
00286         (optional). */
00287     uint8_t bDataInterface;
00288 
00289 } __attribute__ ((__packed__)) CDCCallManagementDescriptor; /* GCC */
00290 
00291 /**
00292  * \typedef CDCAbstractControlManagementDescriptor
00293  * \brief Describes the command supported by the communication interface class
00294  *        with the Abstract Control Model subclass code.
00295  */
00296 typedef struct _CDCAbstractControlManagementDescriptor {
00297 
00298     /** Size of this descriptor in bytes. */
00299     uint8_t bFunctionLength;
00300     /** Descriptor type . */
00301     uint8_t bDescriptorType;
00302     /** Descriptor subtype . */
00303     uint8_t bDescriptorSubtype;
00304     /** Configuration capabilities.
00305         \sa usb_cdc_acm CDC ACM Capabilities. */
00306     uint8_t bmCapabilities;
00307 
00308 } __attribute__ ((__packed__)) CDCAbstractControlManagementDescriptor; /* GCC */
00309 
00310 #pragma pack()
00311 
00312 /*----------------------------------------------------------------------------
00313  *         Functions
00314  *----------------------------------------------------------------------------*/
00315 
00316 
00317 /**@}*/
00318 #endif /* #ifndef _CDCDESCRIPTORS_H_ */
00319 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines