📄 usb_desc.lst
字号:
C51 COMPILER V7.00 Beta 6 USB_DESC 02/19/2003 15:59:28 PAGE 1
C51 COMPILER V7.00 Beta 6, COMPILATION OF MODULE USB_DESC
OBJECT MODULE PLACED IN usb_desc.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE usb_desc.c LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /////////////////////////////////////////////////////////////////////////////
2 // usb_desc.c
3 //
4 // USB descriptors.
5 //
6 // Author: Jon Moore
7 //
8 // Revision History:
9 //
10 // 07/22/02 (JAM) Initial coding.
11 // 08/30/03 (JAM) Changed to ST vendor ID.
12
13 /*---------------------------------------------------------------------------
14 Copyright (c) 2002 ST Microelectronics
15 This example demo code is provided as is and has no warranty,
16 implied or otherwise. You are free to use/modify any of the provided
17 code at your own risk in your applications with the expressed limitation
18 of liability (see below) so long as your product using the code contains
19 at least one uPSD products (device).
20
21 LIMITATION OF LIABILITY: NEITHER STMicroelectronics NOR ITS VENDORS OR
22 AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
23 INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
24 CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
25 OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
26 --------------------------------------------------------------------------*/
27
28 #include "general.h"
29 #include "usb.h"
30
31 #define REPORT_DESC_LEN 46
32
33 const device_descriptor code deviceDesc =
34 {
35 sizeof(device_descriptor), // Size of this Descriptor in Bytes
36 DT_DEVICE, // Descriptor Type (=1)
37 {0x10, 0x01}, // USB Spec Release Number in BCD = 1.10
38 0, // Device Class Code (none)
39 0, // Device Subclass Code (none)
40 0, // Device Protocol Code (none)
41 8, // Maximum Packet Size for EP0
42 {0x83, 0x04}, // Vendor ID
43 {0x00, 0x00}, // Product ID
44 {0x00, 0x01}, // Device Release Number in BCD
45 1, // Index of String Desc for Manufacturer
46 2, // Index of String Desc for Product
47 0, // Index of String Desc for SerNo
48 1 // Number of possible Configurations
49 };
50
51 // Copy of HID class descriptor embedded in configDesc below
52
53 const uchar code hidClassDescSize = 9;
54
55 const uchar code hidClassDesc[] =
C51 COMPILER V7.00 Beta 6 USB_DESC 02/19/2003 15:59:28 PAGE 2
56 {
57 9, // Descriptor length
58 0x21, // Descriptor type (HID)
59 0, 1, // HID release (1.0)
60 0, // Country code (none)
61 1, // Number of HID class descriptors to follow
62 0x22, // Report descriptor type (HID)
63 REPORT_DESC_LEN, 0 // Byte length of report descriptor
64 };
65
66 const uchar code configDesc[] =
67 {
68 9, // Configuration descriptor length
69 2, // Descriptor type (configuration)
70 34, 0, // Total length of this descriptor
71 1, // Number of interfaces
72 1, // Configuration value
73 0, // Index of string descriptor (none)
74 0xC0, // Self powered, no remote wakeup
75 250, // 250 mA max power consumption
76
77 // Interface
78
79 9, // Descriptor length
80 4, // Descriptor type (interface)
81 0, // Number of interface
82 0, // Alternate setting
83 1, // Number of endpoints
84 3, // Class code (HID)
85 0, // Subclass (none)
86 0, // Protocol (none)
87 0, // Index of string descriptor (none)
88
89 // HID class descriptor (copy of hidClassDesc)
90
91 9, // Descriptor length
92 0x21, // Descriptor type (HID)
93 0, 1, // HID release (1.0)
94 0, // Country code (none)
95 1, // Number of HID class descriptors to follow
96 0x22, // Report descriptor type (HID)
97 REPORT_DESC_LEN, 0, // Byte length of report descriptor
98
99 // Endpoint descriptor
100
101 7, // Descriptor length (7 bytes)
102 5, // Descriptor type (endpoint)
103 0x81, // Address (IN1)
104 3, // Attributes (interrupt)
105 8, 0, // Maximum packet size (8 bytes)
106 10 // Polling interval (10 msec)
107 };
108
109 const uchar code reportDescSize = REPORT_DESC_LEN;
110
111 const uchar code reportDesc[REPORT_DESC_LEN] =
112 {
113 0x06, 0xA0, 0xFF, // Usage page (vendor defined)
114 0x09, 0xA5, // Usage (vendor defined)
115 0xA1, 0x01, // Collection (application)
116 0x09, 0xA6, // Usage (vendor defined)
117
C51 COMPILER V7.00 Beta 6 USB_DESC 02/19/2003 15:59:28 PAGE 3
118 // Feature report
119
120 0x09, 0xA5, // Usage (vendor defined)
121 0x15, 0x80, // Logical min (-127)
122 0x25, 0x7F, // Logical max (128)
123 0x75, 0x08, // Report size (8 bits)
124 0x95, 0x40, // Report count (64 bytes)
125 0xB1, 0x02, // Feature (data, variable, absolute)
126
127 // Input report
128
129 0x09, 0xA7, // Usage (vendor defined)
130 0x15, 0x80, // Logical min (-127)
131 0x25, 0x7F, // Logical max (128)
132 0x75, 0x08, // Report size (8 bits)
133 0x95, 0x08, // Report count (8 bytes)
134 0x81, 0x02, // Input (data, variable, absolute)
135
136 // Output report
137
138 0x09, 0xA9, // Usage (vendor defined)
139 0x15, 0x80, // Logical min (-127)
140 0x25, 0x7F, // Logical max (128)
141 0x75, 0x08, // Report size (8 bits)
142 0x95, 0x40, // Report count (64 bytes)
143 0x91, 0x02, // Output (data, variable, absolute)
144
145 0xC0 // End collection
146 };
147
148 // Language IDs
149 //--------------
150 #define SD0LEN 4
151 //--------------
152
153 const uchar code string0Desc[SD0LEN] =
154 {
155 // Size, Type
156 SD0LEN, DT_STRING,
157 // LangID Codes
158 0x09, 0x04
159 };
160
161 // Manufacturer String
162 //--------------------------------------------
163 #define SD1LEN sizeof("ST Microelectronics")*2
164 //--------------------------------------------
165 const uchar code string1Desc[SD1LEN] = {
166 // Size, Type
167 SD1LEN, DT_STRING,
168 // Unicode String
169 'S', 0,
170 'T', 0,
171 ' ', 0,
172 'M', 0,
173 'i', 0,
174 'c', 0,
175 'r', 0,
176 'o', 0,
177 'e', 0,
178 'l', 0,
179 'e', 0,
C51 COMPILER V7.00 Beta 6 USB_DESC 02/19/2003 15:59:28 PAGE 4
180 'c', 0,
181 't', 0,
182 'r', 0,
183 'o', 0,
184 'n', 0,
185 'i', 0,
186 'c', 0,
187 's', 0
188 };
189
190 // Product String
191 //-----------------------------------------------
192 #define SD2LEN sizeof("DK3000 Evaluation Board")*2
193 //-----------------------------------------------
194 const uchar code string2Desc[SD2LEN] =
195 {
196 // Size, Type
197 SD2LEN, DT_STRING,
198 // Unicode String
199 'D', 0,
200 'K', 0,
201 '3', 0,
202 '0', 0,
203 '0', 0,
204 '0', 0,
205 ' ', 0,
206 'E', 0,
207 'v', 0,
208 'a', 0,
209 'l', 0,
210 'u', 0,
211 'a', 0,
212 't', 0,
213 'i', 0,
214 'o', 0,
215 'n', 0,
216 ' ', 0,
217 'B', 0,
218 'o', 0,
219 'a', 0,
220 'r', 0,
221 'd', 0
222 };
223
224 // Table of String Descriptors
225 //
226 const uchar * const code stringDescTable[] =
227 {
228 string0Desc,
229 string1Desc,
230 string2Desc
231 };
232
233
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = ---- ----
CONSTANT SIZE = 210 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
C51 COMPILER V7.00 Beta 6 USB_DESC 02/19/2003 15:59:28 PAGE 5
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -