00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00031
00032
00033
00034
00035
00036
00037
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
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)+sizeof(S_usb_interface_descriptor)\
00061 +sizeof(S_usb_hid_descriptor)+sizeof(S_usb_endpoint_descriptor)+sizeof(S_usb_endpoint_descriptor))
00062 , NB_INTERFACE
00063 , CONF_NB
00064 , CONF_INDEX
00065 , CONF_ATTRIBUTES
00066 , MAX_POWER
00067 }
00068 ,
00069 { sizeof(S_usb_interface_descriptor)
00070 , INTERFACE_DESCRIPTOR
00071 , INTERFACE_NB
00072 , ALTERNATE
00073 , NB_ENDPOINT
00074 , INTERFACE_CLASS
00075 , INTERFACE_SUB_CLASS
00076 , INTERFACE_PROTOCOL
00077 , INTERFACE_INDEX
00078 }
00079 ,
00080 { 9, HID, 0x0111, 8, 1, REPORT, SIZE_OF_REPORT }
00081 ,
00082 { sizeof(S_usb_endpoint_descriptor)
00083 , ENDPOINT_DESCRIPTOR
00084 , ENDPOINT_NB_1
00085 , EP_ATTRIBUTES_1
00086 , Usb_write_word_enum_struc(EP_SIZE_1)
00087 , EP_INTERVAL_1
00088 }
00089 ,
00090 { sizeof(S_usb_endpoint_descriptor)
00091 , ENDPOINT_DESCRIPTOR
00092 , ENDPOINT_NB_2
00093 , EP_ATTRIBUTES_2
00094 , Usb_write_word_enum_struc(EP_SIZE_2)
00095 , EP_INTERVAL_2
00096 }
00097 };
00098
00099
00100
00101
00102 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00103 sizeof(usb_user_manufacturer_string_descriptor)
00104 , STRING_DESCRIPTOR
00105 , USB_MANUFACTURER_NAME
00106 };
00107
00108
00109
00110
00111 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00112 sizeof(usb_user_product_string_descriptor)
00113 , STRING_DESCRIPTOR
00114 , USB_PRODUCT_NAME
00115 };
00116
00117
00118
00119
00120 code S_usb_serial_number usb_user_serial_number = {
00121 sizeof(usb_user_serial_number)
00122 , STRING_DESCRIPTOR
00123 , USB_SERIAL_NUMBER
00124 };
00125
00126
00127
00128
00129 code S_usb_language_id usb_user_language_id = {
00130 sizeof(usb_user_language_id)
00131 , STRING_DESCRIPTOR
00132 , Usb_write_word_enum_struc(LANGUAGE_ID)
00133 };
00134
00135
00136 code S_usb_hid_report_descriptor usb_hid_report_descriptor = {
00137 0x06, 0xFF, 0xFF,
00138 0x09, 0x01,
00139 0xA1, 0x01,
00140
00141 0x09, 0x02,
00142 0x09, 0x03,
00143 0x15, 0x00,
00144 0x26 ,0xFF,0x00,
00145 0x75, 0x08,
00146 0x95, LENGTH_OF_REPORT_IN,
00147 0x81, 0x02,
00148
00149 0x09, 0x04,
00150 0x09, 0x05,
00151 0x15, 0x00,
00152 0x26, 0xFF,0x00,
00153 0x75, 0x08,
00154 0x95, LENGTH_OF_REPORT_OUT,
00155 0x91, 0x02,
00156
00157 0x09, 0x06,
00158 0x09, 0x07,
00159 0x15, 0x00,
00160 0x26, 0xFF,0x00,
00161 0x75, 0x08,
00162 0x95, 0x04,
00163 0xB1, 0x02,
00164 0xC0
00165 };
00166
00167
00168