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 #include "lib_mcu/usb/usb_drv.h"
00053 #include "usb_descriptors.h"
00054 #include "modules/usb/device_chap9/usb_standard_request.h"
00055 #include "usb_specific_request.h"
00056 #if ((USB_DEVICE_SN_USE==ENABLE) && (USE_DEVICE_SN_UNIQUE==ENABLE))
00057 #include "lib_mcu/flash/flash_drv.h"
00058 #endif
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 code S_usb_device_descriptor usb_dev_desc =
00069 {
00070 sizeof(usb_dev_desc)
00071 , DESCRIPTOR_DEVICE
00072 , Usb_write_word_enum_struc(USB_SPECIFICATION)
00073 , DEVICE_CLASS
00074 , DEVICE_SUB_CLASS
00075 , DEVICE_PROTOCOL
00076 , EP_CONTROL_LENGTH
00077 , Usb_write_word_enum_struc(VENDOR_ID)
00078 , Usb_write_word_enum_struc(PRODUCT_ID)
00079 , Usb_write_word_enum_struc(RELEASE_NUMBER)
00080 , MAN_INDEX
00081 , PROD_INDEX
00082 , SN_INDEX
00083 , NB_CONFIGURATION
00084 };
00085
00086
00087 code S_usb_user_configuration_descriptor usb_conf_desc = {
00088 { sizeof(S_usb_configuration_descriptor)
00089 , DESCRIPTOR_CONFIGURATION
00090 , Usb_write_word_enum_struc(sizeof(S_usb_configuration_descriptor)\
00091 +sizeof(S_usb_interface_descriptor) \
00092 +sizeof(S_usb_hid_descriptor) \
00093 +sizeof(S_usb_endpoint_descriptor) \
00094 +sizeof(S_usb_endpoint_descriptor))
00095 , NB_INTERFACE
00096 , CONF_NB
00097 , CONF_INDEX
00098 , CONF_ATTRIBUTES
00099 , MAX_POWER
00100 }
00101 ,
00102 { sizeof(S_usb_interface_descriptor)
00103 , DESCRIPTOR_INTERFACE
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_hid_descriptor)
00114 , DESCRIPTOR_HID
00115 , HID_BDC
00116 , HID_NO_COUNTRY_CODE
00117 , HID_CLASS_DESC_NB_DEFAULT
00118 , DESCRIPTOR_REPORT
00119 , Usb_write_word_enum_struc(sizeof(S_usb_hid_report_descriptor))
00120 }
00121 ,
00122 { sizeof(S_usb_endpoint_descriptor)
00123 , DESCRIPTOR_ENDPOINT
00124 , ENDPOINT_NB_1
00125 , EP_ATTRIBUTES_1
00126 , Usb_write_word_enum_struc(EP_SIZE_1)
00127 , EP_INTERVAL_1
00128 }
00129 ,
00130 { sizeof(S_usb_endpoint_descriptor)
00131 , DESCRIPTOR_ENDPOINT
00132 , ENDPOINT_NB_2
00133 , EP_ATTRIBUTES_2
00134 , Usb_write_word_enum_struc(EP_SIZE_2)
00135 , EP_INTERVAL_2
00136 }
00137 };
00138
00139
00140
00141
00142 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00143 sizeof(usb_user_manufacturer_string_descriptor)
00144 , DESCRIPTOR_STRING
00145 , USB_MANUFACTURER_NAME
00146 };
00147
00148
00149
00150
00151 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00152 sizeof(usb_user_product_string_descriptor)
00153 , DESCRIPTOR_STRING
00154 , USB_PRODUCT_NAME
00155 };
00156
00157
00158
00159 #if (USB_DEVICE_SN_USE==ENABLE)
00160 code S_usb_serial_number usb_user_serial_number = {
00161 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00162 sizeof(usb_user_serial_number)+4*SN_LENGTH
00163 , DESCRIPTOR_STRING
00164 #else
00165 sizeof(usb_user_serial_number)
00166 , DESCRIPTOR_STRING
00167 , USB_SERIAL_NUMBER
00168 #endif
00169 };
00170 #endif
00171
00172
00173
00174 code S_usb_language_id usb_user_language_id = {
00175 sizeof(usb_user_language_id)
00176 , DESCRIPTOR_STRING
00177 , Usb_write_word_enum_struc(LANGUAGE_ID)
00178 };
00179
00180
00181 code S_usb_hid_report_descriptor usb_hid_report_descriptor = {{
00182 0x06, 0xFF, 0xFF,
00183 0x09, 0x01,
00184 0xA1, 0x01,
00185
00186 0x09, 0x02,
00187 0x09, 0x03,
00188 0x15, 0x00,
00189 0x26 ,0xFF,0x00,
00190 0x75, 0x08,
00191 0x95, LENGTH_OF_REPORT_IN,
00192 0x81, 0x02,
00193
00194 0x09, 0x04,
00195 0x09, 0x05,
00196 0x15, 0x00,
00197 0x26, 0xFF,0x00,
00198 0x75, 0x08,
00199 0x95, LENGTH_OF_REPORT_OUT,
00200 0x91, 0x02,
00201
00202 0x09, 0x06,
00203 0x09, 0x07,
00204 0x15, 0x00,
00205 0x26, 0xFF,0x00,
00206 0x75, 0x08,
00207 0x95, 0x04,
00208 0xB1, 0x02,
00209 0xC0
00210 }};
00211
00212
00213