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
00048
00049
00050 #include "config.h"
00051 #include "conf_usb.h"
00052
00053 #include "lib_mcu/usb/usb_drv.h"
00054 #include "usb_descriptors.h"
00055 #include "modules/usb/device_chap9/usb_standard_request.h"
00056 #include "usb_specific_request.h"
00057 #if ((USB_DEVICE_SN_USE==ENABLE) && (USE_DEVICE_SN_UNIQUE==ENABLE))
00058 #include "lib_mcu/flash/flash_drv.h"
00059 #endif
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 code S_usb_device_descriptor usb_dev_desc =
00070 {
00071 sizeof(usb_dev_desc)
00072 , DESCRIPTOR_DEVICE
00073 , Usb_write_word_enum_struc(USB_SPECIFICATION)
00074 , DEVICE_CLASS
00075 , DEVICE_SUB_CLASS
00076 , DEVICE_PROTOCOL
00077 , EP_CONTROL_LENGTH
00078 , Usb_write_word_enum_struc(VENDOR_ID)
00079 , Usb_write_word_enum_struc(PRODUCT_ID)
00080 , Usb_write_word_enum_struc(RELEASE_NUMBER)
00081 , MAN_INDEX
00082 , PROD_INDEX
00083 , SN_INDEX
00084 , NB_CONFIGURATION
00085 };
00086
00087
00088 code S_usb_user_configuration_descriptor usb_conf_desc = {
00089 { sizeof(S_usb_configuration_descriptor)
00090 , DESCRIPTOR_CONFIGURATION
00091 , Usb_write_word_enum_struc(sizeof(S_usb_configuration_descriptor)\
00092 +sizeof(S_usb_interface_descriptor) \
00093 +sizeof(S_usb_hid_descriptor) \
00094 +sizeof(S_usb_endpoint_descriptor) \
00095 +sizeof(S_usb_interface_descriptor) \
00096 +sizeof(S_usb_endpoint_descriptor) \
00097 +sizeof(S_usb_endpoint_descriptor))
00098 , NB_INTERFACE
00099 , CONF_NB
00100 , CONF_INDEX
00101 , CONF_ATTRIBUTES
00102 , MAX_POWER
00103 }
00104 ,
00105 { sizeof(S_usb_interface_descriptor)
00106 , DESCRIPTOR_INTERFACE
00107 , INTERFACE_NB_MOUSE
00108 , ALTERNATE_MOUSE
00109 , NB_ENDPOINT_MOUSE
00110 , INTERFACE_CLASS_MOUSE
00111 , INTERFACE_SUB_CLASS_MOUSE
00112 , INTERFACE_PROTOCOL_MOUSE
00113 , INTERFACE_INDEX_MOUSE
00114 }
00115 ,
00116 { sizeof(S_usb_hid_descriptor)
00117 , DESCRIPTOR_HID
00118 , HID_BDC
00119 , HID_NO_COUNTRY_CODE
00120 , HID_CLASS_DESC_NB_DEFAULT
00121 , DESCRIPTOR_REPORT
00122 , Usb_write_word_enum_struc(sizeof(S_usb_hid_report_descriptor_mouse))
00123 }
00124 ,
00125 { sizeof(S_usb_endpoint_descriptor)
00126 , DESCRIPTOR_ENDPOINT
00127 , ENDPOINT_NB_1
00128 , EP_ATTRIBUTES_1
00129 , Usb_write_word_enum_struc(EP_SIZE_1)
00130 , EP_INTERVAL_1
00131 }
00132 ,
00133 { sizeof(S_usb_interface_descriptor)
00134 , DESCRIPTOR_INTERFACE
00135 , INTERFACE_NB
00136 , ALTERNATE
00137 , NB_ENDPOINT
00138 , INTERFACE_CLASS
00139 , INTERFACE_SUB_CLASS
00140 , INTERFACE_PROTOCOL
00141 , INTERFACE_INDEX
00142 }
00143 ,
00144 { sizeof(S_usb_endpoint_descriptor)
00145 , DESCRIPTOR_ENDPOINT
00146 , ENDPOINT_NB_2
00147 , EP_ATTRIBUTES_2
00148 , Usb_write_word_enum_struc(EP_SIZE_2)
00149 , EP_INTERVAL_2
00150 }
00151 ,
00152 { sizeof(S_usb_endpoint_descriptor)
00153 , DESCRIPTOR_ENDPOINT
00154 , ENDPOINT_NB_3
00155 , EP_ATTRIBUTES_3
00156 , Usb_write_word_enum_struc(EP_SIZE_3)
00157 , EP_INTERVAL_3
00158 }
00159 };
00160
00161
00162
00163
00164 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00165 sizeof(usb_user_manufacturer_string_descriptor)
00166 , DESCRIPTOR_STRING
00167 , USB_MANUFACTURER_NAME
00168 };
00169
00170
00171
00172
00173 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00174 sizeof(usb_user_product_string_descriptor)
00175 , DESCRIPTOR_STRING
00176 , USB_PRODUCT_NAME
00177 };
00178
00179
00180
00181 #if (USB_DEVICE_SN_USE==ENABLE)
00182 code S_usb_serial_number usb_user_serial_number = {
00183 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00184 sizeof(usb_user_serial_number)+4*SN_LENGTH
00185 , DESCRIPTOR_STRING
00186 #else
00187 sizeof(usb_user_serial_number)
00188 , DESCRIPTOR_STRING
00189 , USB_SERIAL_NUMBER
00190 #endif
00191 };
00192 #endif
00193
00194
00195
00196
00197 code S_usb_language_id usb_user_language_id = {
00198 sizeof(usb_user_language_id)
00199 , DESCRIPTOR_STRING
00200 , Usb_write_word_enum_struc(LANGUAGE_ID)
00201 };
00202
00203 code S_usb_hid_report_descriptor_mouse usb_hid_report_descriptor_mouse = {{
00204 0x05,0x01,
00205 0x09,0x02,
00206 0xA1,0x01,
00207 0x09,0x01,
00208 0xA1,0x00,
00209 0x05,0x09,
00210 0x19,0x01,
00211 0x29,0x03,
00212 0x15,0x00,
00213 0x25,0x01,
00214 0x75,0x01,
00215 0x95,0x03,
00216 0x81,0x02,
00217 0x75,0x05,
00218 0x95,0x01,
00219 0x81,0x01,
00220 0x05,0x01,
00221 0x09,0x30,
00222 0x09,0x31,
00223 0x09,0x38,
00224 0x15,0x81,
00225 0x25,0x7F,
00226 0x75,0x08,
00227 0x95,0x03,
00228 0x81,0x06,
00229 0xC0,
00230 0xC0
00231 }};
00232
00233
00234
00235