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

# usb_commun.h

Go to the documentation of this file.

    00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
    00012
    00013 /* Copyright (c) 2007, 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  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
    00029  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00030  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
    00031  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
    00032  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00033  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    00034  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00035  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00036  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    00037  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00038  */
    00039
    00040 #ifndef _USB_COMMUN_H_
    00041 #define _USB_COMMUN_H_
    00042
    00044 #define  VID_ATMEL                              0x03EB
    00045
    00046
    00049 #define  PID_MegaHIDGeneric                     0x2013
    00050 #define  PID_MegaHIDKeyboard                    0x2017
    00051 #define  PID_MegaCDC                            0x2018
    00052 #define  PID_MegaAUDIO_IN                       0x2019
    00053 #define  PID_MegaMS                             0x201A
    00054 #define  PID_MegaAUDIO_IN_OUT                   0x201B
    00055 #define  PID_MegaHIDMouse                       0x201C
    00056 #define  PID_MegaHIDMouse_certif_U4             0x201D
    00057 #define  PID_MegaCDC_multi                      0x201E
    00058 #define  PID_AT90USB128_64_MS_HIDMS_HID_USBKEY  0x2022
    00059 #define  PID_AT90USB128_64_MS_HIDMS_HID_STK525  0x2023
    00060 #define  PID_AT90USB128_64_MS                   0x2029
    00061 #define  PID_Mega_MS_HIDMS                      0x202A
    00062 #define  PID_MegaMS_2                           0x2032
    00063 #define  PID_MegaLibUsb                         0x2050
    00064 #define  PID_ATMega16U2_DFU                     0x2FEF
    00065 #define  PID_ATMega32U2_DFU                     0x2FF0
    00066 #define  PID_ATMega32U6_DFU                     0x2FF2
    00067 #define  PID_ATMega16U4_DFU                     0x2FF3
    00068 #define  PID_ATMega32U4_DFU                     0x2FF4
    00069 #define  PID_AT90USB82_DFU                      0x2FF7
    00070 #define  PID_AT90USB64_DFU                      0x2FF9
    00071 #define  PID_AT90USB162_DFU                     0x2FFA
    00072 #define  PID_AT90USB128_DFU                     0x2FFB
    00074
    00075
    00078 #define  CLASS_APPLICATION                   0xFE
    00079 #define  CLASS_VENDOR                        0xFF
    00080 #define  NO_CLASS                            0x00
    00081 #define  NO_SUBCLASS                         0x00
    00082 #define  NO_PROTOCOL                         0x00
    00084
    00087 #define  CLASS_IAD                       0xEF
    00088 #define  SUB_CLASS_IAD                   0x02
    00089 #define  PROTOCOL_IAD                    0x01
    00090
    00092
    00098 #define  USB_DEVICE_STATUS_BUS_POWERED       0x00
    00099 #define  USB_DEVICE_STATUS_SELF_POWERED      0x01
    00100 #define  USB_DEVICE_STATUS_REMOTEWAKEUP      0x02
    00101 #define  USB_DEVICE_STATUS_BATTERYPOWERED    0x04
    00103
    00104
    00107 #define USB_CONFIG_ATTRIBUTES_RESERVED       0x80
    00108 #define USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP   0x20
    00109 #define USB_CONFIG_ATTRIBUTES_SELFPOWERED    0x40
    00110 #define USB_CONFIG_BUSPOWERED                (USB_CONFIG_ATTRIBUTES_RESERVED)
    00111 #define USB_CONFIG_REMOTEWAKEUP              (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP)
    00112 #define USB_CONFIG_SELFPOWERED               (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_SELFPOWERED)
    00114
    00115
    00118 #define  USB_ENDPOINT_BULK                   0x02
    00119 #define  USB_ENDPOINT_INTERRUPT              0x03
    00120 #define  USB_ENDPOINT_OUT                    0x00
    00121 #define  USB_ENDPOINT_IN                     0x80
    00122 #define  USB_ENDPOINT_DIR_MASK               0x80
    00123 #define  USB_ENDPOINT_NUM_MASK               (~USB_ENDPOINT_DIR_MASK)
    00125
    00126
    00129
    00132
    00138 #define  USB_SETUP_DIR_HOST_TO_DEVICE        (0<<7)
    00139 #define  USB_SETUP_DIR_DEVICE_TO_HOST        (1<<7)
    00141
    00149 #define  USB_SETUP_TYPE_STANDARD             (0<<5)
    00150 #define  USB_SETUP_TYPE_CLASS                (1<<5)
    00151 #define  USB_SETUP_TYPE_VENDOR               (2<<5)
    00153
    00162 #define  USB_SETUP_RECIPIENT_DEVICE          (0)
    00163 #define  USB_SETUP_RECIPIENT_INTERFACE       (1)
    00164 #define  USB_SETUP_RECIPIENT_ENDPOINT        (2)
    00165 #define  USB_SETUP_RECIPIENT_OTHER           (3)
    00167
    00170 #define  USB_SETUP_SET_STAND_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x00
    00171 #define  USB_SETUP_GET_STAND_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x80
    00172 #define  USB_SETUP_SET_STAND_INTERFACE       (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x01
    00173 #define  USB_SETUP_GET_STAND_INTERFACE       (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x81
    00174 #define  USB_SETUP_SET_STAND_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x02
    00175 #define  USB_SETUP_GET_STAND_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x82
    00177
    00180 #define  USB_SETUP_SET_CLASS_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0x20
    00181 #define  USB_SETUP_GET_CLASS_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0xA0
    00182 #define  USB_SETUP_SET_CLASS_INTER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0x21
    00183 #define  USB_SETUP_GET_CLASS_INTER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0xA1
    00184 #define  USB_SETUP_SET_CLASS_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0x22
    00185 #define  USB_SETUP_GET_CLASS_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0xA2
    00186 #define  USB_SETUP_SET_CLASS_OTHER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0x23
    00187 #define  USB_SETUP_GET_CLASS_OTHER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0xA3
    00188 #define  USB_SETUP_SET_VENDOR_DEVICE         (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0x40
    00189 #define  USB_SETUP_GET_VENDOR_DEVICE         (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0xC0
    00192
    00195 #define  SETUP_GET_STATUS                    0x00
    00196 #define  SETUP_GET_DEVICE                    0x01
    00197 #define  SETUP_CLEAR_FEATURE                 0x01
    00198 #define  SETUP_GET_STRING                    0x03
    00199 #define  SETUP_SET_FEATURE                   0x03
    00200 #define  SETUP_SET_ADDRESS                   0x05
    00201 #define  SETUP_GET_DESCRIPTOR                0x06
    00202 #define  SETUP_SET_DESCRIPTOR                0x07
    00203 #define  SETUP_GET_CONFIGURATION             0x08
    00204 #define  SETUP_SET_CONFIGURATION             0x09
    00205 #define  SETUP_GET_INTERFACE                 0x0A
    00206 #define  SETUP_SET_INTERFACE                 0x0B
    00207 #define  SETUP_SYNCH_FRAME                   0x0C
    00209
    00212 #define  DESCRIPTOR_DEVICE                   0x01
    00213 #define  DESCRIPTOR_CONFIGURATION            0x02
    00214 #define  DESCRIPTOR_STRING                   0x03
    00215 #define  DESCRIPTOR_INTERFACE                0x04
    00216 #define  DESCRIPTOR_ENDPOINT                 0x05
    00217 #define  DESCRIPTOR_DEVICE_QUALIFIER         0x06
    00218 #define  DESCRIPTOR_CONF_OTHER_SPEED         0x07
    00219 #define  DESCRIPTOR_OTG                      0x09
    00220 #define  DESCRIPTOR_IAD                      0x0B
    00222
    00225 #define  FEATURE_DEVICE_REMOTE_WAKEUP        0x01
    00226 #define  FEATURE_DEVICE_TEST                 0x02
    00227 #define  FEATURE_DEVICE_OTG_B_HNP_ENABLE     0x03
    00228 #define  FEATURE_DEVICE_OTG_A_HNP_SUPPORT    0x04
    00229 #define  FEATURE_DEVICE_OTG_A_ALT_HNP_SUPPORT 0x05
    00230 #define  FEATURE_ENDPOINT_HALT               0x00
    00232
    00235 #define  FEATURE_DEVICE_TEST_J               0x01
    00236 #define  FEATURE_DEVICE_TEST_K               0x02
    00237 #define  FEATURE_DEVICE_TEST_SEO_NAK         0x03
    00238 #define  FEATURE_DEVICE_TEST_PACKET          0x04
    00239 #define  FEATURE_DEVICE_TEST_FORCE_ENABLE    0x05
    00242
    00245 #define  DESCRIPTOR_OTG_bLength              0x03
    00246 #define  HNP_SUPPORT                         0x02
    00247 #define  SRP_SUPPORT                         0x01
    00249
    00250
    00251 #endif   // _USB_COMMUN_H_
    00252