00001
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef _USB_DESCRIPTORS_H_
00048 #define _USB_DESCRIPTORS_H_
00049
00050
00051
00052 #include "config.h"
00053 #include "modules/usb/device_chap9/usb_standard_request.h"
00054 #include "conf_usb.h"
00055
00056
00057
00058 #define Usb_get_dev_desc_pointer() (&(usb_dev_desc.bLength))
00059 #define Usb_get_dev_desc_length() (sizeof (usb_dev_desc))
00060 #define Usb_get_conf_desc_pointer() (&(usb_conf_desc.cfg_mouse.bLength))
00061 #define Usb_get_conf_desc_length() (sizeof (usb_conf_desc))
00062
00063
00064
00065
00066 #define USB_SPECIFICATION 0x0200
00067 #define DEVICE_CLASS 0 // each configuration has its own class
00068 #define DEVICE_SUB_CLASS 0 // each configuration has its own sub-class
00069 #define DEVICE_PROTOCOL 0 // each configuration has its own protocol
00070 #define EP_CONTROL_LENGTH 64
00071 #define VENDOR_ID VID_ATMEL
00072 #define PRODUCT_ID PID_AT90USB128_64_MS_HIDMS_HID_USBKEY
00073 #define RELEASE_NUMBER 0x1000
00074 #define MAN_INDEX 0x01
00075 #define PROD_INDEX 0x02
00076 #if (USB_DEVICE_SN_USE==ENABLE)
00077 #define SN_INDEX 0x03
00078 #else
00079 #define SN_INDEX 0x00 // No serial number field
00080 #endif
00081 #define NB_CONFIGURATION 1
00082
00083
00084 #define NB_INTERFACE 3 // Number of interfaces
00085 #define CONF_NB 1
00086 #define CONF_INDEX 0
00087 #define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
00088 #define MAX_POWER 50 // 100 mA
00089
00090
00091 #define INTERFACE_NB_MOUSE 0 // Interface's number
00092 #define ALTERNATE_MOUSE 0
00093 #define NB_ENDPOINT_MOUSE 1
00094 #define INTERFACE_CLASS_MOUSE HID_CLASS
00095 #define INTERFACE_SUB_CLASS_MOUSE NO_SUBCLASS // no Sub Class
00096 #define INTERFACE_PROTOCOL_MOUSE HID_PROTOCOL_MOUSE // Mouse
00097 #define INTERFACE_INDEX_MOUSE 0
00098
00099
00100 #define ENDPOINT_NB_1 (EP_MOUSE_IN | USB_ENDPOINT_IN)
00101 #define EP_ATTRIBUTES_1 0x03 // BULK = 0x02, INTERUPT = 0x03
00102 #define EP_IN_LENGTH_1 8
00103 #define EP_SIZE_1 EP_IN_LENGTH_1
00104 #define EP_INTERVAL_1 0x25 // Interrupt polling interval from host
00105
00106
00107
00108 #define INTERFACE_NB 1 // Interface's number
00109 #define ALTERNATE 0
00110 #define NB_ENDPOINT 2
00111 #define INTERFACE_CLASS MS_CLASS // Mass Storage Class
00112 #define INTERFACE_SUB_CLASS MS_SUB_CLASS6 // SCSI transparent Command Set
00113 #define INTERFACE_PROTOCOL MS_PROTOCOL // Bulk-Only Transport
00114 #define INTERFACE_INDEX 0
00115
00116
00117 #define ENDPOINT_NB_2 (EP_MS_IN | USB_ENDPOINT_IN)
00118 #define EP_ATTRIBUTES_2 0x02 // BULK = 0x02, INTERUPT = 0x03
00119 #define EP_IN_LENGTH 64
00120 #define EP_SIZE_2 EP_IN_LENGTH
00121 #define EP_INTERVAL_2 0x00
00122
00123
00124
00125 #define ENDPOINT_NB_3 EP_MS_OUT
00126 #define EP_ATTRIBUTES_3 0x02 // BULK = 0x02, INTERUPT = 0x03
00127 #define EP_IN_LENGTH 64
00128 #define EP_SIZE_3 EP_IN_LENGTH
00129 #define EP_INTERVAL_3 0x00
00130
00131 #define DEVICE_STATUS USB_DEVICE_STATUS_BUS_POWERED
00132
00133
00134 #define INTERFACE_NB_HID 2 // Interface's number
00135 #define ALTERNATE 0
00136 #define NB_ENDPOINT 2
00137 #define INTERFACE_CLASS_HID HID_CLASS // HID Class
00138 #define INTERFACE_SUB_CLASS_HID NO_SUBCLASS
00139 #define INTERFACE_PROTOCOL_HID NO_PROTOCOL
00140 #define INTERFACE_INDEX 0
00141
00142
00143 #define ENDPOINT_NB_4 (EP_HID_IN | USB_ENDPOINT_IN)
00144 #define EP_ATTRIBUTES_4 0x03 // BULK = 0x02, INTERUPT = 0x03
00145 #define EP_IN_LENGTH_4 8
00146 #define EP_SIZE_4 EP_IN_LENGTH_4
00147 #define EP_INTERVAL_4 20 //interrupt pooling from host
00148
00149
00150 #define ENDPOINT_NB_5 (EP_HID_OUT)
00151 #define EP_ATTRIBUTES_5 0x03 // BULK = 0x02, INTERUPT = 0x03
00152 #define EP_OUT_LENGTH_5 8
00153 #define EP_SIZE_5 EP_OUT_LENGTH_5
00154 #define EP_INTERVAL_5 20 //interrupt pooling from host
00155
00156 #define SIZE_OF_REPORT_HID 0x35
00157 #define LENGTH_OF_REPORT_IN 0x08
00158 #define LENGTH_OF_REPORT_OUT 0x08
00159
00160 #define LANG_ID 0x00
00161
00162
00163 #define USB_MN_LENGTH 5
00164 #define USB_MANUFACTURER_NAME \
00165 { Usb_unicode('A') \
00166 , Usb_unicode('T') \
00167 , Usb_unicode('M') \
00168 , Usb_unicode('E') \
00169 , Usb_unicode('L') \
00170 }
00171
00172 #define USB_PN_LENGTH 28
00173 #define USB_PRODUCT_NAME \
00174 { Usb_unicode('A') \
00175 ,Usb_unicode('V') \
00176 ,Usb_unicode('R') \
00177 ,Usb_unicode(' ') \
00178 ,Usb_unicode('U') \
00179 ,Usb_unicode('S') \
00180 ,Usb_unicode('B') \
00181 ,Usb_unicode(' ') \
00182 ,Usb_unicode('K') \
00183 ,Usb_unicode('E') \
00184 ,Usb_unicode('Y') \
00185 ,Usb_unicode(' ') \
00186 ,Usb_unicode('C') \
00187 ,Usb_unicode('O') \
00188 ,Usb_unicode('M') \
00189 ,Usb_unicode('P') \
00190 ,Usb_unicode('O') \
00191 ,Usb_unicode('S') \
00192 ,Usb_unicode('I') \
00193 ,Usb_unicode('T') \
00194 ,Usb_unicode('E') \
00195 ,Usb_unicode(' ') \
00196 ,Usb_unicode('D') \
00197 ,Usb_unicode('E') \
00198 ,Usb_unicode('V') \
00199 ,Usb_unicode('I') \
00200 ,Usb_unicode('C') \
00201 ,Usb_unicode('E') \
00202 }
00203
00204 #define USB_SN_LENGTH 0x0D
00205
00206 #define USB_SERIAL_NUMBER \
00207 { Usb_unicode('0') \
00208 ,Usb_unicode('0') \
00209 ,Usb_unicode('0') \
00210 ,Usb_unicode('0') \
00211 ,Usb_unicode('0') \
00212 ,Usb_unicode('0') \
00213 ,Usb_unicode('0') \
00214 ,Usb_unicode('0') \
00215 ,Usb_unicode('0') \
00216 ,Usb_unicode('0') \
00217 ,Usb_unicode('0') \
00218 ,Usb_unicode('0') \
00219 ,Usb_unicode('0') \
00220 }
00221
00222 #define LANGUAGE_ID 0x0409
00223
00224
00226 typedef struct
00227 {
00228 U8 bmRequestType;
00229 U8 bRequest;
00230 U16 wValue;
00231 U16 wIndex;
00232 U16 wLength;
00233 } S_UsbRequest;
00234
00236 typedef struct {
00237 U8 bLength;
00238 U8 bDescriptorType;
00239 U16 bscUSB;
00240 U8 bDeviceClass;
00241 U8 bDeviceSubClass;
00242 U8 bDeviceProtocol;
00243 U8 bMaxPacketSize0;
00244 U16 idVendor;
00245 U16 idProduct;
00246 U16 bcdDevice;
00247 U8 iManufacturer;
00248 U8 iProduct;
00249 U8 iSerialNumber;
00250 U8 bNumConfigurations;
00251 } S_usb_device_descriptor;
00252
00253
00255 typedef struct {
00256 U8 bLength;
00257 U8 bDescriptorType;
00258 U16 wTotalLength;
00259 U8 bNumInterfaces;
00260 U8 bConfigurationValue;
00261 U8 iConfiguration;
00262 U8 bmAttibutes;
00263 U8 MaxPower;
00264 } S_usb_configuration_descriptor;
00265
00266
00268 typedef struct {
00269 U8 bLength;
00270 U8 bDescriptorType;
00271 U8 bInterfaceNumber;
00272 U8 bAlternateSetting;
00273 U8 bNumEndpoints;
00274 U8 bInterfaceClass;
00275 U8 bInterfaceSubClass;
00276 U8 bInterfaceProtocol;
00277 U8 iInterface;
00278 } S_usb_interface_descriptor;
00279
00280
00282 typedef struct {
00283 U8 bLength;
00284 U8 bDescriptorType;
00285 U8 bEndpointAddress;
00286 U8 bmAttributes;
00287 U16 wMaxPacketSize;
00288 U8 bInterval;
00289 } S_usb_endpoint_descriptor;
00290
00291
00293 typedef struct {
00294 U8 bLength;
00295 U8 bDescriptorType;
00296 U16 wlangid;
00297 } S_usb_language_id;
00298
00299
00300
00301
00302
00303
00304 typedef struct {
00305 U8 bLength;
00306 U8 bDescriptorType;
00307 U16 wstring[USB_MN_LENGTH];
00308 } S_usb_manufacturer_string_descriptor;
00309
00310
00311
00312
00313
00314
00315 typedef struct {
00316 U8 bLength;
00317 U8 bDescriptorType;
00318 U16 wstring[USB_PN_LENGTH];
00319 } S_usb_product_string_descriptor;
00320
00321
00322
00323
00324
00325 #if (USB_DEVICE_SN_USE==ENABLE)
00326
00327 typedef struct {
00328 U8 bLength;
00329 U8 bDescriptorType;
00330 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00331
00332 #else
00333 U16 wstring[USB_SN_LENGTH];
00334 #endif
00335 } S_usb_serial_number;
00336 #endif
00337
00338
00339
00340
00341 typedef struct {
00342 U8 bLength;
00343 U8 bDescriptorType;
00344 U16 bscHID;
00345 U8 bCountryCode;
00346 U8 bNumDescriptors;
00347 U8 bRDescriptorType;
00348 U16 wDescriptorLength;
00349 } S_usb_hid_descriptor;
00350
00351
00352
00353
00354 typedef struct
00355 {
00356 S_usb_configuration_descriptor cfg_mouse;
00357 S_usb_interface_descriptor ifc_mouse;
00358 S_usb_hid_descriptor hid_mouse;
00359 S_usb_endpoint_descriptor ep1_mouse;
00360 S_usb_interface_descriptor ifc_ms;
00361 S_usb_endpoint_descriptor ep1_ms;
00362 S_usb_endpoint_descriptor ep2_ms;
00363 S_usb_interface_descriptor ifc_hid;
00364 S_usb_hid_descriptor hid;
00365 S_usb_endpoint_descriptor ep1_hid;
00366 S_usb_endpoint_descriptor ep2_hid;
00367 } S_usb_user_configuration_descriptor;
00368
00369
00370
00371
00372 #endif
00373