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_STK525
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 #define USB_MN_LENGTH 5
00163 #define USB_MANUFACTURER_NAME \
00164 { Usb_unicode('A') \
00165 , Usb_unicode('T') \
00166 , Usb_unicode('M') \
00167 , Usb_unicode('E') \
00168 , Usb_unicode('L') \
00169 }
00170
00171 #define USB_PN_LENGTH 28
00172 #define USB_PRODUCT_NAME \
00173 { Usb_unicode('A') \
00174 ,Usb_unicode('V') \
00175 ,Usb_unicode('R') \
00176 ,Usb_unicode(' ') \
00177 ,Usb_unicode('U') \
00178 ,Usb_unicode('S') \
00179 ,Usb_unicode('B') \
00180 ,Usb_unicode(' ') \
00181 ,Usb_unicode('K') \
00182 ,Usb_unicode('E') \
00183 ,Usb_unicode('Y') \
00184 ,Usb_unicode(' ') \
00185 ,Usb_unicode('C') \
00186 ,Usb_unicode('O') \
00187 ,Usb_unicode('M') \
00188 ,Usb_unicode('P') \
00189 ,Usb_unicode('O') \
00190 ,Usb_unicode('S') \
00191 ,Usb_unicode('I') \
00192 ,Usb_unicode('T') \
00193 ,Usb_unicode('E') \
00194 ,Usb_unicode(' ') \
00195 ,Usb_unicode('D') \
00196 ,Usb_unicode('E') \
00197 ,Usb_unicode('V') \
00198 ,Usb_unicode('I') \
00199 ,Usb_unicode('C') \
00200 ,Usb_unicode('E') \
00201 }
00202
00203 #define USB_SN_LENGTH 0x0D
00204
00205 #define USB_SERIAL_NUMBER \
00206 { Usb_unicode('0') \
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 }
00220
00221 #define LANGUAGE_ID 0x0409
00222
00223
00225 typedef struct
00226 {
00227 U8 bmRequestType;
00228 U8 bRequest;
00229 U16 wValue;
00230 U16 wIndex;
00231 U16 wLength;
00232 } S_UsbRequest;
00233
00235 typedef struct {
00236 U8 bLength;
00237 U8 bDescriptorType;
00238 U16 bscUSB;
00239 U8 bDeviceClass;
00240 U8 bDeviceSubClass;
00241 U8 bDeviceProtocol;
00242 U8 bMaxPacketSize0;
00243 U16 idVendor;
00244 U16 idProduct;
00245 U16 bcdDevice;
00246 U8 iManufacturer;
00247 U8 iProduct;
00248 U8 iSerialNumber;
00249 U8 bNumConfigurations;
00250 } S_usb_device_descriptor;
00251
00252
00254 typedef struct {
00255 U8 bLength;
00256 U8 bDescriptorType;
00257 U16 wTotalLength;
00258 U8 bNumInterfaces;
00259 U8 bConfigurationValue;
00260 U8 iConfiguration;
00261 U8 bmAttibutes;
00262 U8 MaxPower;
00263 } S_usb_configuration_descriptor;
00264
00265
00267 typedef struct {
00268 U8 bLength;
00269 U8 bDescriptorType;
00270 U8 bInterfaceNumber;
00271 U8 bAlternateSetting;
00272 U8 bNumEndpoints;
00273 U8 bInterfaceClass;
00274 U8 bInterfaceSubClass;
00275 U8 bInterfaceProtocol;
00276 U8 iInterface;
00277 } S_usb_interface_descriptor;
00278
00279
00281 typedef struct {
00282 U8 bLength;
00283 U8 bDescriptorType;
00284 U8 bEndpointAddress;
00285 U8 bmAttributes;
00286 U16 wMaxPacketSize;
00287 U8 bInterval;
00288 } S_usb_endpoint_descriptor;
00289
00290
00292 typedef struct {
00293 U8 bLength;
00294 U8 bDescriptorType;
00295 U16 wlangid;
00296 } S_usb_language_id;
00297
00298
00299
00300
00301
00302
00303 typedef struct {
00304 U8 bLength;
00305 U8 bDescriptorType;
00306 U16 wstring[USB_MN_LENGTH];
00307 } S_usb_manufacturer_string_descriptor;
00308
00309
00310
00311
00312
00313
00314 typedef struct {
00315 U8 bLength;
00316 U8 bDescriptorType;
00317 U16 wstring[USB_PN_LENGTH];
00318 } S_usb_product_string_descriptor;
00319
00320
00321
00322
00323 #if (USB_DEVICE_SN_USE==ENABLE)
00324
00325 typedef struct {
00326 U8 bLength;
00327 U8 bDescriptorType;
00328 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00329
00330 #else
00331 U16 wstring[USB_SN_LENGTH];
00332 #endif
00333 } S_usb_serial_number;
00334 #endif
00335
00336
00337
00338
00339 typedef struct {
00340 U8 bLength;
00341 U8 bDescriptorType;
00342 U16 bscHID;
00343 U8 bCountryCode;
00344 U8 bNumDescriptors;
00345 U8 bRDescriptorType;
00346 U16 wDescriptorLength;
00347 } S_usb_hid_descriptor;
00348
00349
00350
00351
00352 typedef struct
00353 {
00354 S_usb_configuration_descriptor cfg_mouse;
00355 S_usb_interface_descriptor ifc_mouse;
00356 S_usb_hid_descriptor hid_mouse;
00357 S_usb_endpoint_descriptor ep1_mouse;
00358 S_usb_interface_descriptor ifc_ms;
00359 S_usb_endpoint_descriptor ep1_ms;
00360 S_usb_endpoint_descriptor ep2_ms;
00361 S_usb_interface_descriptor ifc_hid;
00362 S_usb_hid_descriptor hid;
00363 S_usb_endpoint_descriptor ep1_hid;
00364 S_usb_endpoint_descriptor ep2_hid;
00365 } S_usb_user_configuration_descriptor;
00366
00367
00368
00369
00370 #endif
00371