usb_enum.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef _USB_ENUM_H_
00024
#define _USB_ENUM_H_
00025
00026
00027
00028
#include "usb_user_configuration.h"
00029
00030
00031 #define Usb_str_28(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28) \
00032
{ (a1) <<8, (a2) <<8, (a3) <<8, (a4) <<8, (a5) <<8, (a6) <<8 \
00033
, (a7) <<8, (a8) <<8, (a9) <<8, (a10)<<8, (a11)<<8, (a12)<<8 \
00034
, (a13)<<8, (a14)<<8, (a15)<<8, (a16)<<8, (a17)<<8, (a18)<<8 \
00035
, (a19)<<8, (a20)<<8, (a21)<<8, (a22)<<8, (a23)<<8, (a24)<<8 \
00036
, (a25)<<8, (a26)<<8, (a27)<<8, (a28)<<8 }
00037
00038
00040
00041 #define GET_STATUS 0x00
00042 #define GET_DEVICE 0x01
00043 #define CLEAR_FEATURE 0x01
00044 #define GET_STRING 0x03
00045 #define SET_FEATURE 0x03
00046 #define SET_ADDRESS 0x05
00047 #define GET_DESCRIPTOR 0x06
00048 #define SET_DESCRIPTOR 0x07
00049 #define GET_CONFIGURATION 0x08
00050 #define SET_CONFIGURATION 0x09
00051 #define GET_INTERFACE 0x0A
00052 #define SET_INTERFACE 0x0B
00053 #define SYNCH_FRAME 0x0C
00054
00055 #define GET_DEVICE_DESCRIPTOR 1
00056 #define GET_CONFIGURATION_DESCRIPTOR 4
00057
00058 #define REQUEST_DEVICE_STATUS 0x80
00059 #define REQUEST_INTERFACE_STATUS 0x81
00060 #define REQUEST_ENDPOINT_STATUS 0x82
00061 #define ZERO_TYPE 0x00
00062 #define INTERFACE_TYPE 0x01
00063 #define ENDPOINT_TYPE 0x02
00064
00066
00067 #define DEVICE_DESCRIPTOR 0x01
00068 #define CONFIGURATION_DESCRIPTOR 0x02
00069 #define STRING_DESCRIPTOR 0x03
00070 #define INTERFACE_DESCRIPTOR 0x04
00071 #define ENDPOINT_DESCRIPTOR 0x05
00072 #define DEVICE_QUALIFIER_DESCRIPTOR 0x06
00073 #define OTHER_SPEED_CONFIGURATION_DESCRIPTOR 0x07
00074
00076
00077 #define FEATURE_DEVICE_REMOTE_WAKEUP 0x01
00078 #define FEATURE_ENDPOINT_HALT 0x00
00079
00080 #define TEST_J 0x01
00081 #define TEST_K 0x02
00082 #define TEST_SEO_NAK 0x03
00083 #define TEST_PACKET 0x04
00084 #define TEST_FORCE_ENABLE 0x05
00085
00086
00088 #define BUS_POWERED 0
00089 #define SELF_POWERED 1
00090
00092
00093 #define ATTACHED 0
00094 #define POWERED 1
00095 #define DEFAULT 2
00096 #define ADDRESSED 3
00097 #define CONFIGURED 4
00098 #define SUSPENDED 5
00099
00100 #define USB_CONFIG_ATTRIBUTES_RESERVED 0x80
00101 #define USB_CONFIG_BUSPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x00)
00102 #define USB_CONFIG_SELFPOWERED (USB_CONFIG_ATTRIBUTES_RESERVED | 0x40)
00103 #define USB_CONFIG_REMOTEWAKEUP (USB_CONFIG_ATTRIBUTES_RESERVED | 0x20)
00104
00105
00106
00107 #define HID 0x21
00108 #define REPORT 0x22
00109
00110
00111
00112
00114 typedef struct
00115
{
00116 U8 bmRequestType;
00117 U8 bRequest;
00118 U16 wValue;
00119 U16 wIndex;
00120 U16 wLength;
00121 }
S_UsbRequest;
00122
00124 typedef struct {
00125 U8 bLength;
00126 U8 bDescriptorType;
00127 U16 bscUSB;
00128 U8 bDeviceClass;
00129 U8 bDeviceSubClass;
00130 U8 bDeviceProtocol;
00131 U8 bMaxPacketSize0;
00132 U16 idVendor;
00133 U16 idProduct;
00134 U16 bcdDevice;
00135 U8 iManufacturer;
00136 U8 iProduct;
00137 U8 iSerialNumber;
00138 U8 bNumConfigurations;
00139 }
S_usb_device_descriptor;
00140
00141
00143 typedef struct {
00144 U8 bLength;
00145 U8 bDescriptorType;
00146 U16 wTotalLength;
00147 U8 bNumInterfaces;
00148 U8 bConfigurationValue;
00149 U8 iConfiguration;
00150 U8 bmAttibutes;
00151 U8 MaxPower;
00152 }
S_usb_configuration_descriptor;
00153
00154
00156 typedef struct {
00157 U8 bLength;
00158 U8 bDescriptorType;
00159 U8 bInterfaceNumber;
00160 U8 bAlternateSetting;
00161 U8 bNumEndpoints;
00162 U8 bInterfaceClass;
00163 U8 bInterfaceSubClass;
00164 U8 bInterfaceProtocol;
00165 U8 iInterface;
00166 }
S_usb_interface_descriptor;
00167
00168
00170 typedef struct {
00171 U8 bLength;
00172 U8 bDescriptorType;
00173 U8 bEndpointAddress;
00174 U8 bmAttributes;
00175 U16 wMaxPacketSize;
00176 U8 bInterval;
00177 }
S_usb_endpoint_descriptor;
00178
00179
00181 typedef struct {
00182 U8 bLength;
00183 U8 bDescriptorType;
00184 U16 bscUSB;
00185 U8 bDeviceClass;
00186 U8 bDeviceSubClass;
00187 U8 bDeviceProtocol;
00188 U8 bMaxPacketSize0;
00189 U8 bNumConfigurations;
00190 U8 bReserved;
00191 }
S_usb_device_qualifier_descriptor;
00192
00193
00195 typedef struct {
00196 U8 bLength;
00197 U8 bDescriptorType;
00198 U16 wlangid;
00199 }
S_usb_language_id;
00200
00202 typedef struct {
00203 U8 bLength;
00204 U8 bDescriptorType;
00205 U16 bcdHID;
00206 U8 bCountryCode;
00207 U8 bNumDescriptors;
00208 U8 bDescriptorTypeHid;
00209 U16 wDescriptorLength;
00210 }
S_usb_hid_descriptor;
00211
00212
00213
00214
00215
void usb_enum_var_init(
void);
00216
void usb_process_request(
void);
00217
00218
#endif // _USB_ENUM_H_
00219
Generated on Mon Apr 10 17:23:30 2006 for Atmel by
1.3.7