- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# usb_commun.h

Go to the documentation of this file.

    00001 /*This file is prepared for Doxygen automatic documentation generation.*/
    00012
    00013 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
    00014  *
    00015  * Redistribution and use in source and binary forms, with or without
    00016  * modification, are permitted provided that the following conditions are met:
    00017  *
    00018  * 1. Redistributions of source code must retain the above copyright notice,
    00019  * this list of conditions and the following disclaimer.
    00020  *
    00021  * 2. Redistributions in binary form must reproduce the above copyright notice,
    00022  * this list of conditions and the following disclaimer in the documentation
    00023  * and/or other materials provided with the distribution.
    00024  *
    00025  * 3. The name of Atmel may not be used to endorse or promote products derived
    00026  * from this software without specific prior written permission.
    00027  *
    00028  * 4. This software may only be redistributed and used in connection with an Atmel
    00029  * AVR product.
    00030  *
    00031  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
    00032  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00033  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
    00034  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
    00035  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00036  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    00037  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00038  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00039  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    00040  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00041  */
    00042
    00043 #ifndef _USB_COMMUN_H_
    00044 #define _USB_COMMUN_H_
    00045
    00047 #define  VID_ATMEL                              0x03EB
    00048
    00049
    00052 #define  PID_MegaHIDGeneric                     0x2013
    00053 #define  PID_MegaHIDKeyboard                    0x2017
    00054 #define  PID_MegaCDC                            0x2018
    00055 #define  PID_MegaAUDIO_IN                       0x2019
    00056 #define  PID_MegaMS                             0x201A
    00057 #define  PID_MegaAUDIO_IN_OUT                   0x201B
    00058 #define  PID_MegaHIDMouse                       0x201C
    00059 #define  PID_MegaHIDMouse_certif_U4             0x201D
    00060 #define  PID_MegaCDC_multi                      0x201E
    00061 #define  PID_AT90USB128_64_MS_HIDMS_HID_USBKEY  0x2022
    00062 #define  PID_AT90USB128_64_MS_HIDMS_HID_STK525  0x2023
    00063 #define  PID_AT90USB128_64_MS                   0x2029
    00064 #define  PID_Mega_MS_HIDMS                      0x202A
    00065 #define  PID_MegaMS_2                           0x2032
    00066 #define  PID_MegaLibUsb                         0x2050
    00067 #define  PID_ATMega8U2_DFU                      0x2FEE
    00068 #define  PID_ATMega16U2_DFU                     0x2FEF
    00069 #define  PID_ATMega32U2_DFU                     0x2FF0
    00070 #define  PID_ATMega32U6_DFU                     0x2FF2
    00071 #define  PID_ATMega16U4_DFU                     0x2FF3
    00072 #define  PID_ATMega32U4_DFU                     0x2FF4
    00073 #define  PID_AT90USB82_DFU                      0x2FF7
    00074 #define  PID_AT90USB64_DFU                      0x2FF9
    00075 #define  PID_AT90USB162_DFU                     0x2FFA
    00076 #define  PID_AT90USB128_DFU                     0x2FFB
    00077
    00078
    00079
    00082 #define  CLASS_APPLICATION                   0xFE  //!< Use to declare a specific interface link at VID-PID
    00083 #define  CLASS_VENDOR                        0xFF  //!< Use to declare a specific interface link at VID-PID
    00084 #define  NO_CLASS                            0x00
    00085 #define  NO_SUBCLASS                         0x00
    00086 #define  NO_PROTOCOL                         0x00
    00087
    00088
    00091 #define  CLASS_IAD                       0xEF
    00092 #define  SUB_CLASS_IAD                   0x02
    00093 #define  PROTOCOL_IAD                    0x01
    00094
    00096
    00102 #define  USB_DEVICE_STATUS_BUS_POWERED       0x00
    00103 #define  USB_DEVICE_STATUS_SELF_POWERED      0x01
    00104 #define  USB_DEVICE_STATUS_REMOTEWAKEUP      0x02
    00105 #define  USB_DEVICE_STATUS_BATTERYPOWERED    0x04
    00106
    00107
    00108
    00111 #define USB_CONFIG_ATTRIBUTES_RESERVED       0x80
    00112 #define USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP   0x20
    00113 #define USB_CONFIG_ATTRIBUTES_SELFPOWERED    0x40
    00114 #define USB_CONFIG_BUSPOWERED                (USB_CONFIG_ATTRIBUTES_RESERVED)
    00115 #define USB_CONFIG_REMOTEWAKEUP              (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP)
    00116 #define USB_CONFIG_SELFPOWERED               (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_SELFPOWERED)
    00117
    00118
    00119
    00122 #define  USB_ENDPOINT_BULK                   0x02
    00123 #define  USB_ENDPOINT_INTERRUPT              0x03
    00124 #define  USB_ENDPOINT_OUT                    0x00
    00125 #define  USB_ENDPOINT_IN                     0x80
    00126 #define  USB_ENDPOINT_DIR_MASK               0x80
    00127 #define  USB_ENDPOINT_NUM_MASK               (~USB_ENDPOINT_DIR_MASK)
    00128
    00129
    00130
    00133
    00136
    00142 #define  USB_SETUP_DIR_HOST_TO_DEVICE        (0<<7)
    00143 #define  USB_SETUP_DIR_DEVICE_TO_HOST        (1<<7)
    00144
    00145
    00153 #define  USB_SETUP_TYPE_STANDARD             (0<<5)
    00154 #define  USB_SETUP_TYPE_CLASS                (1<<5)
    00155 #define  USB_SETUP_TYPE_VENDOR               (2<<5)
    00156
    00157
    00166 #define  USB_SETUP_RECIPIENT_DEVICE          (0)
    00167 #define  USB_SETUP_RECIPIENT_INTERFACE       (1)
    00168 #define  USB_SETUP_RECIPIENT_ENDPOINT        (2)
    00169 #define  USB_SETUP_RECIPIENT_OTHER           (3)
    00170
    00171
    00174 #define  USB_SETUP_SET_STAND_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x00
    00175 #define  USB_SETUP_GET_STAND_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x80
    00176 #define  USB_SETUP_SET_STAND_INTERFACE       (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x01
    00177 #define  USB_SETUP_GET_STAND_INTERFACE       (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x81
    00178 #define  USB_SETUP_SET_STAND_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x02
    00179 #define  USB_SETUP_GET_STAND_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x82
    00180
    00181
    00184 #define  USB_SETUP_SET_CLASS_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0x20
    00185 #define  USB_SETUP_GET_CLASS_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0xA0
    00186 #define  USB_SETUP_SET_CLASS_INTER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0x21
    00187 #define  USB_SETUP_GET_CLASS_INTER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0xA1
    00188 #define  USB_SETUP_SET_CLASS_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0x22
    00189 #define  USB_SETUP_GET_CLASS_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0xA2
    00190 #define  USB_SETUP_SET_CLASS_OTHER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0x23
    00191 #define  USB_SETUP_GET_CLASS_OTHER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0xA3
    00192 #define  USB_SETUP_SET_VENDOR_DEVICE         (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0x40
    00193 #define  USB_SETUP_GET_VENDOR_DEVICE         (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0xC0
    00194
    00195
    00196
    00199 #define  SETUP_GET_STATUS                    0x00
    00200 #define  SETUP_GET_DEVICE                    0x01
    00201 #define  SETUP_CLEAR_FEATURE                 0x01
    00202 #define  SETUP_GET_STRING                    0x03
    00203 #define  SETUP_SET_FEATURE                   0x03
    00204 #define  SETUP_SET_ADDRESS                   0x05
    00205 #define  SETUP_GET_DESCRIPTOR                0x06
    00206 #define  SETUP_SET_DESCRIPTOR                0x07
    00207 #define  SETUP_GET_CONFIGURATION             0x08
    00208 #define  SETUP_SET_CONFIGURATION             0x09
    00209 #define  SETUP_GET_INTERFACE                 0x0A
    00210 #define  SETUP_SET_INTERFACE                 0x0B
    00211 #define  SETUP_SYNCH_FRAME                   0x0C
    00212
    00213
    00216 #define  DESCRIPTOR_DEVICE                   0x01
    00217 #define  DESCRIPTOR_CONFIGURATION            0x02
    00218 #define  DESCRIPTOR_STRING                   0x03
    00219 #define  DESCRIPTOR_INTERFACE                0x04
    00220 #define  DESCRIPTOR_ENDPOINT                 0x05
    00221 #define  DESCRIPTOR_DEVICE_QUALIFIER         0x06
    00222 #define  DESCRIPTOR_CONF_OTHER_SPEED         0x07
    00223 #define  DESCRIPTOR_OTG                      0x09
    00224 #define  DESCRIPTOR_IAD                      0x0B
    00225
    00226
    00229 #define  FEATURE_DEVICE_REMOTE_WAKEUP        0x01
    00230 #define  FEATURE_DEVICE_TEST                 0x02
    00231 #define  FEATURE_DEVICE_OTG_B_HNP_ENABLE     0x03
    00232 #define  FEATURE_DEVICE_OTG_A_HNP_SUPPORT    0x04
    00233 #define  FEATURE_DEVICE_OTG_A_ALT_HNP_SUPPORT 0x05
    00234 #define  FEATURE_ENDPOINT_HALT               0x00
    00235
    00236
    00239 #define  FEATURE_DEVICE_TEST_J               0x01
    00240 #define  FEATURE_DEVICE_TEST_K               0x02
    00241 #define  FEATURE_DEVICE_TEST_SEO_NAK         0x03
    00242 #define  FEATURE_DEVICE_TEST_PACKET          0x04
    00243 #define  FEATURE_DEVICE_TEST_FORCE_ENABLE    0x05
    00244
    00245
    00246
    00249 #define  DESCRIPTOR_OTG_bLength              0x03
    00250 #define  HNP_SUPPORT                         0x02
    00251 #define  SRP_SUPPORT                         0x01
    00252
    00253
    00254
    00255 #endif   // _USB_COMMUN_H_
    00256