- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

# 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_interface_descriptor)   \
    00062        +sizeof(S_usb_hid_descriptor)         \
    00063        +sizeof(S_usb_endpoint_descriptor)    \
    00064        +sizeof(S_usb_interface_descriptor)   \
    00065        +sizeof(S_usb_endpoint_descriptor)    \
    00066        +sizeof(S_usb_endpoint_descriptor))
    00067  , NB_INTERFACE
    00068  , CONF_NB
    00069  , CONF_INDEX
    00070  , CONF_ATTRIBUTES
    00071  , MAX_POWER
    00072  }
    00073  ,
    00074  { sizeof(S_usb_interface_descriptor)
    00075  , INTERFACE_DESCRIPTOR
    00076  , INTERFACE_NB_MOUSE
    00077  , ALTERNATE_MOUSE
    00078  , NB_ENDPOINT_MOUSE
    00079  , INTERFACE_CLASS_MOUSE
    00080  , INTERFACE_SUB_CLASS_MOUSE
    00081  , INTERFACE_PROTOCOL_MOUSE
    00082  , INTERFACE_INDEX_MOUSE
    00083  }
    00084  ,
    00085  { sizeof(S_usb_hid_descriptor)
    00086  , HID_DESCRIPTOR
    00087  , HID_BDC
    00088  , HID_COUNTRY_CODE
    00089  , HID_CLASS_DESC_NB
    00090  , HID_DESCRIPTOR_TYPE
    00091  , Usb_write_word_enum_struc(sizeof(S_usb_hid_report_descriptor_mouse))
    00092  }
    00093  ,
    00094  { sizeof(S_usb_endpoint_descriptor)
    00095  , ENDPOINT_DESCRIPTOR
    00096  , ENDPOINT_NB_1
    00097  , EP_ATTRIBUTES_1
    00098  , Usb_write_word_enum_struc(EP_SIZE_1)
    00099  , EP_INTERVAL_1
    00100  }
    00101 ,
    00102  { sizeof(S_usb_interface_descriptor)
    00103  , INTERFACE_DESCRIPTOR
    00104  , INTERFACE_NB
    00105  , ALTERNATE
    00106  , NB_ENDPOINT
    00107  , INTERFACE_CLASS
    00108  , INTERFACE_SUB_CLASS
    00109  , INTERFACE_PROTOCOL
    00110  , INTERFACE_INDEX
    00111  }
    00112  ,
    00113  { sizeof(S_usb_endpoint_descriptor)
    00114  , ENDPOINT_DESCRIPTOR
    00115  , ENDPOINT_NB_2
    00116  , EP_ATTRIBUTES_2
    00117  , Usb_write_word_enum_struc(EP_SIZE_2)
    00118  , EP_INTERVAL_2
    00119  }
    00120  ,
    00121  { sizeof(S_usb_endpoint_descriptor)
    00122  , ENDPOINT_DESCRIPTOR
    00123  , ENDPOINT_NB_3
    00124  , EP_ATTRIBUTES_3
    00125  , Usb_write_word_enum_struc(EP_SIZE_3)
    00126  , EP_INTERVAL_3
    00127  }
    00128 };
    00129
    00130
    00131
    00132                                       // usb_user_manufacturer_string_descriptor
    00133 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
    00134   sizeof(usb_user_manufacturer_string_descriptor)
    00135 , STRING_DESCRIPTOR
    00136 , USB_MANUFACTURER_NAME
    00137 };
    00138
    00139
    00140                                       // usb_user_product_string_descriptor
    00141
    00142 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
    00143   sizeof(usb_user_product_string_descriptor)
    00144 , STRING_DESCRIPTOR
    00145 , USB_PRODUCT_NAME
    00146 };
    00147
    00148
    00149                                       // usb_user_serial_number
    00150
    00151 code S_usb_serial_number usb_user_serial_number = {
    00152   sizeof(usb_user_serial_number)
    00153 , STRING_DESCRIPTOR
    00154 , USB_SERIAL_NUMBER
    00155 };
    00156
    00157
    00158                                       // usb_user_language_id
    00159
    00160 code S_usb_language_id usb_user_language_id = {
    00161   sizeof(usb_user_language_id)
    00162 , STRING_DESCRIPTOR
    00163 , Usb_write_word_enum_struc(LANGUAGE_ID)
    00164 };
    00165
    00166 code S_usb_hid_report_descriptor_mouse usb_hid_report_descriptor_mouse = {
    00167       0x05,0x01,          /* Usage Page (Generic Desktop)      */
    00168       0x09,0x02,          /* Usage (Mouse)                     */
    00169       0xA1,0x01,          /* Collection (Application)          */
    00170       0x09,0x01,          /* Usage (Pointer)                   */
    00171       0xA1,0x00,          /* Collection (Application)          */
    00172       0x05,0x09,          /* Usage Page (Button)               */
    00173       0x19,0x01,          /* Usage Minimum (1)                 */
    00174       0x29,0x03,          /* Usage Maximum (3)                 */
    00175       0x15,0x00,          /* Logical Minimum (0)               */
    00176       0x25,0x01,          /* Logical Maximum (1)               */
    00177       0x75,0x01,          /* Report Size (1)                   */
    00178       0x95,0x03,          /* Report Count (3)                  */
    00179       0x81,0x02,          /* Input (Data, Variable, Absolute)  */
    00180       0x75,0x05,          /* Report Size (5)                   */
    00181       0x95,0x01,          /* Report Count (1)                  */
    00182       0x81,0x01,          /* Input (Constant)                  */
    00183       0x05,0x01,          /* Usage Page (Generic Desktop Control)*/
    00184       0x09,0x30,          /* Usage X                           */
    00185       0x09,0x31,          /* Usage Y                           */
    00186       0x09,0x38,          /* Usage Wheel                       */
    00187       0x15,0x81,          /* Logical Minimum (-127)            */
    00188       0x25,0x7F,          /* Logical Maximum (127)             */
    00189       0x75,0x08,          /* Report Size (8)                   */
    00190       0x95,0x03,          /* Report Count (3)                  */
    00191       0x81,0x06,          /* Input (Data, Variable, Absolute)  */
    00192       0xC0,               /* End Collection                    */
    00193       0xC0                /* End Collection                    */
    00194 };
    00195
    00196
    00197
    00198