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_user_configuration_descriptor) )
00092 , NB_INTERFACE
00093 , CONF_NB
00094 , CONF_INDEX
00095 , CONF_ATTRIBUTES
00096 , MAX_POWER
00097 }
00098 ,
00099 { sizeof(S_usb_interface_descriptor)
00100 , DESCRIPTOR_INTERFACE
00101 , INTERFACE_NB_KBD
00102 , ALTERNATE_KBD
00103 , NB_ENDPOINT_KBD
00104 , INTERFACE_CLASS_KBD
00105 , INTERFACE_SUB_CLASS_KBD
00106 , INTERFACE_PROTOCOL_KBD
00107 , INTERFACE_INDEX_KBD
00108 }
00109 ,
00110 { sizeof(S_usb_hid_descriptor)
00111 , DESCRIPTOR_HID
00112 , HID_BDC
00113 , HID_NO_COUNTRY_CODE
00114 , HID_CLASS_DESC_NB_DEFAULT
00115 , DESCRIPTOR_REPORT
00116 , Usb_write_word_enum_struc(sizeof(S_usb_hid_report_descriptor_kbd))
00117 }
00118 ,
00119 { sizeof(S_usb_endpoint_descriptor)
00120 , DESCRIPTOR_ENDPOINT
00121 , ENDPOINT_NB_1
00122 , EP_ATTRIBUTES_1
00123 , Usb_write_word_enum_struc(EP_SIZE_1)
00124 , EP_INTERVAL_1
00125 }
00126 };
00127
00128
00129
00130
00131 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00132 sizeof(usb_user_manufacturer_string_descriptor)
00133 , DESCRIPTOR_STRING
00134 , USB_MANUFACTURER_NAME
00135 };
00136
00137
00138
00139
00140 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00141 sizeof(usb_user_product_string_descriptor)
00142 , DESCRIPTOR_STRING
00143 , USB_PRODUCT_NAME
00144 };
00145
00146
00147
00148 #if (USB_DEVICE_SN_USE==ENABLE)
00149 code S_usb_serial_number usb_user_serial_number = {
00150 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00151 sizeof(usb_user_serial_number)+4*SN_LENGTH
00152 , DESCRIPTOR_STRING
00153 #else
00154 sizeof(usb_user_serial_number)
00155 , DESCRIPTOR_STRING
00156 , USB_SERIAL_NUMBER
00157 #endif
00158 };
00159 #endif
00160
00161
00162
00163 code S_usb_language_id usb_user_language_id = {
00164 sizeof(usb_user_language_id)
00165 , DESCRIPTOR_STRING
00166 , Usb_write_word_enum_struc(LANGUAGE_ID)
00167 };
00168
00169
00170
00171 #ifdef TG_DESKTOP
00172 code S_usb_hid_report_descriptor_kbd usb_hid_report_descriptor_kbd =
00173 {{
00174 0x05, 0x01,
00175 0x09, 0x06,
00176 0xA1, 0x01,
00177 0x05, 0x07,
00178 0x19, 0xE0,
00179 0x29, 0xE7,
00180 0x15, 0x00,
00181 0x25, 0x01,
00182 0x75, 0x01,
00183 0x95, 0x08,
00184 0x81, 0x02,
00185 0x95, 0x01,
00186 0x75, 0x08,
00187 0x81, 0x01,
00188 0x95, 0x05,
00189 0x75, 0x01,
00190 0x05, 0x08,
00191 0x19, 0x01,
00192 0x29, 0x05,
00193 0x91, 0x02,
00194 0x95, 0x01,
00195 0x75, 0x03,
00196 0x91, 0x01,
00197 0x95, 0x06,
00198 0x75, 0x08,
00199 0x15, 0x00,
00200 0x25, 0x65,
00201 0x05, 0x07,
00202 0x19, 0x00,
00203 0x29, 0x65,
00204 0x81, 0x00,
00205 0xC0 }};
00206 #else
00207 code S_usb_hid_report_descriptor_kbd usb_hid_report_descriptor_kbd =
00208 {{ 0x05,0x01,
00209 0x09,0x06,
00210 0xA1,0x01,
00211 0x05,0x07,
00212 0x19,224,
00213 0x29,231,
00214 0x15,0x00,
00215 0x25,0x01,
00216 0x75,0x01,
00217 0x95,0x08,
00218 0x81,0x02,
00219 0x81,0x01,
00220 0x19,0x00,
00221 0x29,101,
00222 0x15,0x00,
00223 0x25,101,
00224 0x75,0x08,
00225 0x95,0x06,
00226 0x81,0x00,
00227 0x05,0x08,
00228 0x19,0x01,
00229 0x29,0x05,
00230 0x15,0x00,
00231 0x25,0x01,
00232 0x75,0x01,
00233 0x95,0x05,
00234 0x91,0x02,
00235 0x95,0x03,
00236 0x91,0x01,
00237 0xC0
00238 }};
00239
00240 #endif
00241