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