usb_descriptors.c

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 //_____ I N C L U D E S ____________________________________________________
00020 
00021 #include "config.h"
00022 #include "conf_usb.h"
00023 
00024 #include "lib_mcu\usb\usb_drv.h"
00025 #include "usb_descriptors.h"
00026 #include "modules\usb\device_chap9\usb_standard_request.h"
00027 #include "usb_specific_request.h"
00028 
00029 
00030 //_____ M A C R O S ________________________________________________________
00031 
00032 
00033 
00034 
00035 //_____ D E F I N I T I O N ________________________________________________
00036 
00037 // usb_user_device_descriptor
00038 code S_usb_device_descriptor usb_dev_desc =
00039 {
00040   sizeof(usb_dev_desc)
00041 , DEVICE_DESCRIPTOR
00042 , Usb_write_word_enum_struc(USB_SPECIFICATION)
00043 , DEVICE_CLASS
00044 , DEVICE_SUB_CLASS
00045 , DEVICE_PROTOCOL
00046 , EP_CONTROL_LENGTH
00047 , Usb_write_word_enum_struc(VENDOR_ID)
00048 , Usb_write_word_enum_struc(PRODUCT_ID)
00049 , Usb_write_word_enum_struc(RELEASE_NUMBER)
00050 , MAN_INDEX
00051 , PROD_INDEX
00052 , SN_INDEX
00053 , NB_CONFIGURATION
00054 };
00055 
00056 // usb_user_configuration_descriptor FS
00057 code S_usb_user_configuration_descriptor usb_conf_desc = {
00058  { sizeof(S_usb_configuration_descriptor)
00059  , CONFIGURATION_DESCRIPTOR
00060  , Usb_write_word_enum_struc(sizeof(S_usb_configuration_descriptor)+sizeof(S_usb_interface_descriptor)\
00061    +sizeof(S_usb_hid_descriptor)+sizeof(S_usb_endpoint_descriptor)+sizeof(S_usb_endpoint_descriptor))
00062  , NB_INTERFACE
00063  , CONF_NB
00064  , CONF_INDEX
00065  , CONF_ATTRIBUTES
00066  , MAX_POWER
00067  }
00068  ,
00069  { sizeof(S_usb_interface_descriptor)
00070  , INTERFACE_DESCRIPTOR
00071  , INTERFACE_NB
00072  , ALTERNATE
00073  , NB_ENDPOINT
00074  , INTERFACE_CLASS
00075  , INTERFACE_SUB_CLASS
00076  , INTERFACE_PROTOCOL
00077  , INTERFACE_INDEX
00078  }
00079  ,
00080  { 9, HID, 0x0111, 8, 1, REPORT, SIZE_OF_REPORT }
00081  ,
00082  { sizeof(S_usb_endpoint_descriptor)
00083  , ENDPOINT_DESCRIPTOR
00084  , ENDPOINT_NB_1
00085  , EP_ATTRIBUTES_1
00086  , Usb_write_word_enum_struc(EP_SIZE_1)
00087  , EP_INTERVAL_1
00088  }
00089  ,
00090   { sizeof(S_usb_endpoint_descriptor)
00091  , ENDPOINT_DESCRIPTOR
00092  , ENDPOINT_NB_2
00093  , EP_ATTRIBUTES_2
00094  , Usb_write_word_enum_struc(EP_SIZE_2)
00095  , EP_INTERVAL_2
00096  }
00097 };
00098 
00099 
00100 
00101                                       // usb_user_manufacturer_string_descriptor
00102 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00103   sizeof(usb_user_manufacturer_string_descriptor)
00104 , STRING_DESCRIPTOR
00105 , USB_MANUFACTURER_NAME
00106 };
00107 
00108 
00109                                       // usb_user_product_string_descriptor
00110 
00111 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00112   sizeof(usb_user_product_string_descriptor)
00113 , STRING_DESCRIPTOR
00114 , USB_PRODUCT_NAME
00115 };
00116 
00117 
00118                                       // usb_user_serial_number
00119 
00120 code S_usb_serial_number usb_user_serial_number = {
00121   sizeof(usb_user_serial_number)
00122 , STRING_DESCRIPTOR
00123 , USB_SERIAL_NUMBER
00124 };
00125 
00126 
00127                                       // usb_user_language_id
00128 
00129 code S_usb_language_id usb_user_language_id = {
00130   sizeof(usb_user_language_id)
00131 , STRING_DESCRIPTOR
00132 , Usb_write_word_enum_struc(LANGUAGE_ID)
00133 };
00134 
00135 
00136 code S_usb_hid_report_descriptor usb_hid_report_descriptor = {
00137       0x06, 0xFF, 0xFF,         // 04|2   , Usage Page (vendordefined?)
00138       0x09, 0x01,               // 08|1   , Usage      (vendordefined
00139       0xA1, 0x01,               // A0|1   , Collection (Application)
00140       // IN report
00141       0x09, 0x02,               // 08|1   , Usage      (vendordefined)
00142       0x09, 0x03,               // 08|1   , Usage      (vendordefined)
00143       0x15, 0x00,               // 14|1   , Logical Minimum(0 for signed byte?)
00144       0x26 ,0xFF,0x00,           // 24|1   , Logical Maximum(255 for signed byte?)
00145       0x75, 0x08,               // 74|1   , Report Size(8) = field size in bits = 1 byte
00146       0x95, LENGTH_OF_REPORT_IN,   // 94|1:ReportCount(size) = repeat count of previous item
00147       0x81, 0x02,               // 80|1: IN report (Data,Variable, Absolute)
00148       // OUT report
00149       0x09, 0x04,               // 08|1   , Usage      (vendordefined)
00150       0x09, 0x05,               // 08|1   , Usage      (vendordefined)
00151       0x15, 0x00,               // 14|1   , Logical Minimum(0 for signed byte?)
00152       0x26, 0xFF,0x00,           // 24|1   , Logical Maximum(255 for signed byte?)
00153       0x75, 0x08,               // 74|1   , Report Size(8) = field size in bits = 1 byte
00154       0x95, LENGTH_OF_REPORT_OUT,   // 94|1:ReportCount(size) = repeat count of previous item
00155       0x91, 0x02,               // 90|1: OUT report (Data,Variable, Absolute)
00156       // Feature report
00157       0x09, 0x06,               // 08|1   , Usage      (vendordefined)
00158       0x09, 0x07,               // 08|1   , Usage      (vendordefined)
00159       0x15, 0x00,               // 14|1   , LogicalMinimum(0 for signed byte)
00160       0x26, 0xFF,0x00,          // 24|1   , Logical Maximum(255 for signed byte)
00161       0x75, 0x08,               // 74|1   , Report Size(8) =field size in bits = 1 byte
00162       0x95, 0x04,               // 94|1:ReportCount
00163       0xB1, 0x02,               // B0|1:   Feature report
00164       0xC0                      // C0|0    , End Collection
00165  };
00166 
00167 
00168 

Generated on Fri Mar 17 16:02:03 2006 for Atmel by  doxygen 1.4.6-NO