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)\
00061        +sizeof(S_usb_otg_descriptor)         \
00062        +sizeof(S_usb_interface_descriptor)   \
00063        +sizeof(S_usb_hid_descriptor)         \
00064        +sizeof(S_usb_endpoint_descriptor))
00065  , NB_INTERFACE
00066  , CONF_NB
00067  , CONF_INDEX
00068  , CONF_ATTRIBUTES
00069  , MAX_POWER
00070  }
00071  ,
00072  { sizeof(S_usb_otg_descriptor)
00073  , OTG_DESCRIPTOR
00074  , OTG_BMATTRIBUTES
00075  }
00076  ,
00077  { sizeof(S_usb_interface_descriptor)
00078  , INTERFACE_DESCRIPTOR
00079  , INTERFACE_NB_SPIDER
00080  , ALTERNATE_SPIDER
00081  , NB_ENDPOINT_SPIDER
00082  , INTERFACE_CLASS_SPIDER
00083  , INTERFACE_SUB_CLASS_SPIDER
00084  , INTERFACE_PROTOCOL_SPIDER
00085  , INTERFACE_INDEX_SPIDER
00086  }
00087  ,
00088  { sizeof(S_usb_hid_descriptor)
00089  , HID_DESCRIPTOR
00090  , HID_BDC
00091  , HID_COUNTRY_CODE
00092  , HID_CLASS_DESC_NB
00093  , HID_DESCRIPTOR_TYPE
00094  , Usb_write_word_enum_struc(sizeof(S_usb_hid_report_descriptor_mouse))
00095  }
00096  ,
00097  { sizeof(S_usb_endpoint_descriptor)
00098  , ENDPOINT_DESCRIPTOR
00099  , ENDPOINT_NB_1
00100  , EP_ATTRIBUTES_1
00101  , Usb_write_word_enum_struc(EP_SIZE_1)
00102  , EP_INTERVAL_1
00103  }
00104 };
00105 
00106                                       // usb_user_manufacturer_string_descriptor
00107 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00108   sizeof(usb_user_manufacturer_string_descriptor)
00109 , STRING_DESCRIPTOR
00110 , USB_MANUFACTURER_NAME
00111 };
00112 
00113 
00114                                       // usb_user_product_string_descriptor
00115 
00116 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00117   sizeof(usb_user_product_string_descriptor)
00118 , STRING_DESCRIPTOR
00119 , USB_PRODUCT_NAME
00120 };
00121 
00122 
00123                                       // usb_user_serial_number
00124 
00125 code S_usb_serial_number usb_user_serial_number = {
00126   sizeof(usb_user_serial_number)
00127 , STRING_DESCRIPTOR
00128 , USB_SERIAL_NUMBER
00129 };
00130 
00131 
00132                                       // usb_user_language_id
00133 
00134 code S_usb_language_id usb_user_language_id = {
00135   sizeof(usb_user_language_id)
00136 , STRING_DESCRIPTOR
00137 , Usb_write_word_enum_struc(LANGUAGE_ID)
00138 };
00139 
00140 code S_usb_hid_report_descriptor_mouse usb_hid_report_descriptor_mouse = {{
00141       0x05,0x01,          /* Usage Page (Generic Desktop)      */
00142       0x09,0x02,          /* Usage (Mouse)                     */
00143       0xA1,0x01,          /* Collection (Application)          */
00144       0x09,0x01,          /* Usage (Pointer)                   */
00145       0xA1,0x00,          /* Collection (Application)          */
00146       0x05,0x09,          /* Usage Page (Button)               */
00147       0x19,0x01,          /* Usage Minimum (1)                 */
00148       0x29,0x03,          /* Usage Maximum (3)                 */
00149       0x15,0x00,          /* Logical Minimum (0)               */
00150       0x25,0x01,          /* Logical Maximum (1)               */
00151       0x75,0x01,          /* Report Size (1)                   */
00152       0x95,0x03,          /* Report Count (3)                  */
00153       0x81,0x02,          /* Input (Data, Variable, Absolute)  */
00154       0x75,0x05,          /* Report Size (5)                   */
00155       0x95,0x01,          /* Report Count (1)                  */
00156       0x81,0x01,          /* Input (Constant)                  */
00157       0x05,0x01,          /* Usage Page (Generic Desktop Control)*/
00158       0x09,0x30,          /* Usage X                           */
00159       0x09,0x31,          /* Usage Y                           */
00160       0x09,0x38,          /* Usage Wheel                       */
00161       0x15,0x81,          /* Logical Minimum (-127)            */
00162       0x25,0x7F,          /* Logical Maximum (127)             */
00163       0x75,0x08,          /* Report Size (8)                   */
00164       0x95,0x03,          /* Report Count (3)                  */
00165       0x81,0x06,          /* Input (Data, Variable, Absolute)  */
00166       0xC0,               /* End Collection                    */
00167       0xC0                /* End Collection                    */
00168 }};
00169 

Generated on Mon Feb 19 09:31:47 2007 for Atmel by  doxygen 1.5.1-p1