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_unicode(a) ((U16)(a))
00059 #define Usb_get_dev_desc_pointer() (&(usb_dev_desc.bLength))
00060 #define Usb_get_dev_desc_length() (sizeof (usb_dev_desc))
00061 #define Usb_get_conf_desc_pointer() (&(usb_conf_desc.cfg_temp.bLength))
00062 #define Usb_get_conf_desc_length() (sizeof (usb_conf_desc))
00063
00064
00065
00066
00067 #define USB_SPECIFICATION 0x0200
00068 #define DEVICE_CLASS 0
00069 #define DEVICE_SUB_CLASS 0
00070 #define DEVICE_PROTOCOL 0
00071 #define EP_CONTROL_LENGTH 64
00072 #define VENDOR_ID VID_ATMEL
00073 #define PRODUCT_ID 0x0000
00074 #define RELEASE_NUMBER 0x1000
00075 #define MAN_INDEX 0x01
00076 #define PROD_INDEX 0x02
00077 #if (USB_DEVICE_SN_USE==ENABLE)
00078 #define SN_INDEX 0x03
00079 #else
00080 #define SN_INDEX 0x00 // No serial number field
00081 #endif
00082 #define NB_CONFIGURATION 1
00083
00084
00085 #define NB_INTERFACE 2 // Number of interfaces
00086 #define CONF_NB 1
00087 #define CONF_INDEX 0
00088 #define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
00089 #define MAX_POWER 50 // 100 mA
00090
00091
00092 #define INTERFACE_NB_TEMP 0
00093 #define ALTERNATE_TEMP 0
00094 #define NB_ENDPOINT_TEMP 2
00095 #define INTERFACE_CLASS_TEMP NO_CLASS
00096 #define INTERFACE_SUB_CLASS_TEMP NO_SUBCLASS
00097 #define INTERFACE_PROTOCOL_TEMP NO_PROTOCOL
00098 #define INTERFACE_INDEX_TEMP 0
00099
00100
00101 #define ENDPOINT_NB_TEMP1 (EP_TEMP_IN | USB_ENDPOINT_IN)
00102 #define EP_ATTRIBUTES_TEMP1 0x02 // BULK = 0x02, INTERUPT = 0x03
00103 #define EP_IN_LENGTH_TEMP1 64
00104 #define EP_SIZE_TEMP1 EP_IN_LENGTH_TEMP1
00105 #define EP_INTERVAL_TEMP1 0x00 // Interrupt polling interval from host
00106
00107
00108 #define ENDPOINT_NB_TEMP2 EP_TEMP_OUT
00109 #define EP_ATTRIBUTES_TEMP2 0x02 // BULK = 0x02, INTERUPT = 0x03
00110 #define EP_IN_LENGTH_TEMP2 64
00111 #define EP_SIZE_TEMP2 EP_IN_LENGTH_TEMP2
00112 #define EP_INTERVAL_TEMP2 0x00 // Interrupt polling interval from host
00113
00114
00115 #define INTERFACE_NB_SECOND_TEMP 1
00116 #define ALTERNATE_SECOND_TEMP 0
00117 #define NB_ENDPOINT_SECOND_TEMP 1
00118 #define INTERFACE_CLASS_SECOND_TEMP 0x00
00119 #define INTERFACE_SUB_CLASS_SECOND_TEMP 0x55
00120 #define INTERFACE_PROTOCOL_SECOND_TEMP 0xAA
00121 #define INTERFACE_INDEX_SECOND_TEMP 0
00122
00123
00124 #define ENDPOINT_NB_TEMP3 (EP_TEMP_INT_IN | USB_ENDPOINT_IN)
00125 #define EP_ATTRIBUTES_TEMP3 0x03 // BULK = 0x02, INTERUPT = 0x03
00126 #define EP_IN_LENGTH_TEMP3 64
00127 #define EP_SIZE_TEMP3 EP_IN_LENGTH_TEMP2
00128 #define EP_INTERVAL_TEMP3 20 // Interrupt polling interval from host
00129
00130
00131 #define DEVICE_STATUS USB_DEVICE_STATUS_BUS_POWERED
00132
00133 #define LANG_ID 0x00
00134
00135
00136 #define USB_MN_LENGTH 5
00137 #define USB_MANUFACTURER_NAME \
00138 { Usb_unicode('A') \
00139 , Usb_unicode('T') \
00140 , Usb_unicode('M') \
00141 , Usb_unicode('E') \
00142 , Usb_unicode('L') \
00143 }
00144
00145 #define USB_PN_LENGTH 14
00146 #define USB_PRODUCT_NAME \
00147 { Usb_unicode('A') \
00148 ,Usb_unicode('V') \
00149 ,Usb_unicode('R') \
00150 ,Usb_unicode(' ') \
00151 ,Usb_unicode('U') \
00152 ,Usb_unicode('S') \
00153 ,Usb_unicode('B') \
00154 ,Usb_unicode(' ') \
00155 ,Usb_unicode('D') \
00156 ,Usb_unicode('E') \
00157 ,Usb_unicode('V') \
00158 ,Usb_unicode('I') \
00159 ,Usb_unicode('C') \
00160 ,Usb_unicode('E') \
00161 }
00162
00163 #define USB_SN_LENGTH 0x0D
00164
00165 #define USB_SERIAL_NUMBER \
00166 { Usb_unicode('0') \
00167 ,Usb_unicode('0') \
00168 ,Usb_unicode('0') \
00169 ,Usb_unicode('0') \
00170 ,Usb_unicode('0') \
00171 ,Usb_unicode('0') \
00172 ,Usb_unicode('0') \
00173 ,Usb_unicode('0') \
00174 ,Usb_unicode('0') \
00175 ,Usb_unicode('0') \
00176 ,Usb_unicode('0') \
00177 ,Usb_unicode('0') \
00178 ,Usb_unicode('0') \
00179 }
00180
00181 #define LANGUAGE_ID 0x0409
00182
00183
00185 typedef struct
00186 {
00187 U8 bmRequestType;
00188 U8 bRequest;
00189 U16 wValue;
00190 U16 wIndex;
00191 U16 wLength;
00192 } S_UsbRequest;
00193
00195 typedef struct {
00196 U8 bLength;
00197 U8 bDescriptorType;
00198 U16 bscUSB;
00199 U8 bDeviceClass;
00200 U8 bDeviceSubClass;
00201 U8 bDeviceProtocol;
00202 U8 bMaxPacketSize0;
00203 U16 idVendor;
00204 U16 idProduct;
00205 U16 bcdDevice;
00206 U8 iManufacturer;
00207 U8 iProduct;
00208 U8 iSerialNumber;
00209 U8 bNumConfigurations;
00210 } S_usb_device_descriptor;
00211
00212
00214 typedef struct {
00215 U8 bLength;
00216 U8 bDescriptorType;
00217 U16 wTotalLength;
00218 U8 bNumInterfaces;
00219 U8 bConfigurationValue;
00220 U8 iConfiguration;
00221 U8 bmAttibutes;
00222 U8 MaxPower;
00223 } S_usb_configuration_descriptor;
00224
00225
00227 typedef struct {
00228 U8 bLength;
00229 U8 bDescriptorType;
00230 U8 bInterfaceNumber;
00231 U8 bAlternateSetting;
00232 U8 bNumEndpoints;
00233 U8 bInterfaceClass;
00234 U8 bInterfaceSubClass;
00235 U8 bInterfaceProtocol;
00236 U8 iInterface;
00237 } S_usb_interface_descriptor;
00238
00239
00241 typedef struct {
00242 U8 bLength;
00243 U8 bDescriptorType;
00244 U8 bEndpointAddress;
00245 U8 bmAttributes;
00246 U16 wMaxPacketSize;
00247 U8 bInterval;
00248 } S_usb_endpoint_descriptor;
00249
00250
00252 typedef struct {
00253 U8 bLength;
00254 U8 bDescriptorType;
00255 U16 wlangid;
00256 } S_usb_language_id;
00257
00258
00259
00260
00261
00262
00263 typedef struct {
00264 U8 bLength;
00265 U8 bDescriptorType;
00266 U16 wstring[USB_MN_LENGTH];
00267 } S_usb_manufacturer_string_descriptor;
00268
00269
00270
00271
00272
00273
00274 typedef struct {
00275 U8 bLength;
00276 U8 bDescriptorType;
00277 U16 wstring[USB_PN_LENGTH];
00278 } S_usb_product_string_descriptor;
00279
00280
00281
00282
00283
00284 #if (USB_DEVICE_SN_USE==ENABLE)
00285
00286 typedef struct {
00287 U8 bLength;
00288 U8 bDescriptorType;
00289 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00290
00291 #else
00292 U16 wstring[USB_SN_LENGTH];
00293 #endif
00294 } S_usb_serial_number;
00295 #endif
00296
00297
00298
00299
00300
00301
00302
00303
00304 typedef struct
00305 {
00306 S_usb_configuration_descriptor cfg_temp;
00307 S_usb_interface_descriptor ifc_temp;
00308 S_usb_endpoint_descriptor ep1_temp;
00309 S_usb_endpoint_descriptor ep2_temp;
00310 S_usb_interface_descriptor ifc_second_temp;
00311 S_usb_endpoint_descriptor ep3_temp;
00312 } S_usb_user_configuration_descriptor;
00313
00314
00315
00316
00317 #endif
00318