- 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, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 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_ATMega8U2_DFU                      0x2FEE
    00065 #define  PID_ATMega16U2_DFU                     0x2FEF
    00066 #define  PID_ATMega32U2_DFU                     0x2FF0
    00067 #define  PID_ATMega32U6_DFU                     0x2FF2
    00068 #define  PID_ATMega16U4_DFU                     0x2FF3
    00069 #define  PID_ATMega32U4_DFU                     0x2FF4
    00070 #define  PID_AT90USB82_DFU                      0x2FF7
    00071 #define  PID_AT90USB64_DFU                      0x2FF9
    00072 #define  PID_AT90USB162_DFU                     0x2FFA
    00073 #define  PID_AT90USB128_DFU                     0x2FFB
    00075
    00076
    00079 #define  CLASS_APPLICATION                   0xFE
    00080 #define  CLASS_VENDOR                        0xFF
    00081 #define  NO_CLASS                            0x00
    00082 #define  NO_SUBCLASS                         0x00
    00083 #define  NO_PROTOCOL                         0x00
    00085
    00088 #define  CLASS_IAD                       0xEF
    00089 #define  SUB_CLASS_IAD                   0x02
    00090 #define  PROTOCOL_IAD                    0x01
    00091
    00093
    00099 #define  USB_DEVICE_STATUS_BUS_POWERED       0x00
    00100 #define  USB_DEVICE_STATUS_SELF_POWERED      0x01
    00101 #define  USB_DEVICE_STATUS_REMOTEWAKEUP      0x02
    00102 #define  USB_DEVICE_STATUS_BATTERYPOWERED    0x04
    00104
    00105
    00108 #define USB_CONFIG_ATTRIBUTES_RESERVED       0x80
    00109 #define USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP   0x20
    00110 #define USB_CONFIG_ATTRIBUTES_SELFPOWERED    0x40
    00111 #define USB_CONFIG_BUSPOWERED                (USB_CONFIG_ATTRIBUTES_RESERVED)
    00112 #define USB_CONFIG_REMOTEWAKEUP              (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_REMOTEWAKEUP)
    00113 #define USB_CONFIG_SELFPOWERED               (USB_CONFIG_ATTRIBUTES_RESERVED | USB_CONFIG_ATTRIBUTES_SELFPOWERED)
    00115
    00116
    00119 #define  USB_ENDPOINT_BULK                   0x02
    00120 #define  USB_ENDPOINT_INTERRUPT              0x03
    00121 #define  USB_ENDPOINT_OUT                    0x00
    00122 #define  USB_ENDPOINT_IN                     0x80
    00123 #define  USB_ENDPOINT_DIR_MASK               0x80
    00124 #define  USB_ENDPOINT_NUM_MASK               (~USB_ENDPOINT_DIR_MASK)
    00126
    00127
    00130
    00133
    00139 #define  USB_SETUP_DIR_HOST_TO_DEVICE        (0<<7)
    00140 #define  USB_SETUP_DIR_DEVICE_TO_HOST        (1<<7)
    00142
    00150 #define  USB_SETUP_TYPE_STANDARD             (0<<5)
    00151 #define  USB_SETUP_TYPE_CLASS                (1<<5)
    00152 #define  USB_SETUP_TYPE_VENDOR               (2<<5)
    00154
    00163 #define  USB_SETUP_RECIPIENT_DEVICE          (0)
    00164 #define  USB_SETUP_RECIPIENT_INTERFACE       (1)
    00165 #define  USB_SETUP_RECIPIENT_ENDPOINT        (2)
    00166 #define  USB_SETUP_RECIPIENT_OTHER           (3)
    00168
    00171 #define  USB_SETUP_SET_STAND_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x00
    00172 #define  USB_SETUP_GET_STAND_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_DEVICE)    // 0x80
    00173 #define  USB_SETUP_SET_STAND_INTERFACE       (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x01
    00174 #define  USB_SETUP_GET_STAND_INTERFACE       (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_INTERFACE) // 0x81
    00175 #define  USB_SETUP_SET_STAND_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x02
    00176 #define  USB_SETUP_GET_STAND_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_STANDARD |USB_SETUP_RECIPIENT_ENDPOINT)  // 0x82
    00178
    00181 #define  USB_SETUP_SET_CLASS_DEVICE          (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0x20
    00182 #define  USB_SETUP_GET_CLASS_DEVICE          (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_DEVICE)       // 0xA0
    00183 #define  USB_SETUP_SET_CLASS_INTER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0x21
    00184 #define  USB_SETUP_GET_CLASS_INTER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_INTERFACE)    // 0xA1
    00185 #define  USB_SETUP_SET_CLASS_ENDPOINT        (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0x22
    00186 #define  USB_SETUP_GET_CLASS_ENDPOINT        (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_ENDPOINT)     // 0xA2
    00187 #define  USB_SETUP_SET_CLASS_OTHER           (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0x23
    00188 #define  USB_SETUP_GET_CLASS_OTHER           (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_CLASS |USB_SETUP_RECIPIENT_OTHER)        // 0xA3
    00189 #define  USB_SETUP_SET_VENDOR_DEVICE         (USB_SETUP_DIR_HOST_TO_DEVICE |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0x40
    00190 #define  USB_SETUP_GET_VENDOR_DEVICE         (USB_SETUP_DIR_DEVICE_TO_HOST |USB_SETUP_TYPE_VENDOR |USB_SETUP_RECIPIENT_DEVICE)      // 0xC0
    00193
    00196 #define  SETUP_GET_STATUS                    0x00
    00197 #define  SETUP_GET_DEVICE                    0x01
    00198 #define  SETUP_CLEAR_FEATURE                 0x01
    00199 #define  SETUP_GET_STRING                    0x03
    00200 #define  SETUP_SET_FEATURE                   0x03
    00201 #define  SETUP_SET_ADDRESS                   0x05
    00202 #define  SETUP_GET_DESCRIPTOR                0x06
    00203 #define  SETUP_SET_DESCRIPTOR                0x07
    00204 #define  SETUP_GET_CONFIGURATION             0x08
    00205 #define  SETUP_SET_CONFIGURATION             0x09
    00206 #define  SETUP_GET_INTERFACE                 0x0A
    00207 #define  SETUP_SET_INTERFACE                 0x0B
    00208 #define  SETUP_SYNCH_FRAME                   0x0C
    00210
    00213 #define  DESCRIPTOR_DEVICE                   0x01
    00214 #define  DESCRIPTOR_CONFIGURATION            0x02
    00215 #define  DESCRIPTOR_STRING                   0x03
    00216 #define  DESCRIPTOR_INTERFACE                0x04
    00217 #define  DESCRIPTOR_ENDPOINT                 0x05
    00218 #define  DESCRIPTOR_DEVICE_QUALIFIER         0x06
    00219 #define  DESCRIPTOR_CONF_OTHER_SPEED         0x07
    00220 #define  DESCRIPTOR_OTG                      0x09
    00221 #define  DESCRIPTOR_IAD                      0x0B
    00223
    00226 #define  FEATURE_DEVICE_REMOTE_WAKEUP        0x01
    00227 #define  FEATURE_DEVICE_TEST                 0x02
    00228 #define  FEATURE_DEVICE_OTG_B_HNP_ENABLE     0x03
    00229 #define  FEATURE_DEVICE_OTG_A_HNP_SUPPORT    0x04
    00230 #define  FEATURE_DEVICE_OTG_A_ALT_HNP_SUPPORT 0x05
    00231 #define  FEATURE_ENDPOINT_HALT               0x00
    00233
    00236 #define  FEATURE_DEVICE_TEST_J               0x01
    00237 #define  FEATURE_DEVICE_TEST_K               0x02
    00238 #define  FEATURE_DEVICE_TEST_SEO_NAK         0x03
    00239 #define  FEATURE_DEVICE_TEST_PACKET          0x04
    00240 #define  FEATURE_DEVICE_TEST_FORCE_ENABLE    0x05
    00243
    00246 #define  DESCRIPTOR_OTG_bLength              0x03
    00247 #define  HNP_SUPPORT                         0x02
    00248 #define  SRP_SUPPORT                         0x01
    00250
    00251
    00252 #endif   // _USB_COMMUN_H_
    00253