root/Examples_CP-JR_ARM7_LPC2368/ETT_LPC2368_Examples/USB_DEMO/USBHID/hid.h

Revision 8, 14.0 kB (checked in by phil, 16 years ago)

Added Examples etc. from CD

Line 
1 /*----------------------------------------------------------------------------
2  *      U S B  -  K e r n e l
3  *----------------------------------------------------------------------------
4  *      Name:    HID.H
5  *      Purpose: USB HID (Human Interface Device) Definitions
6  *      Version: V1.10
7  *----------------------------------------------------------------------------
8  *      This file is part of the uVision/ARM development tools.
9  *      This software may only be used under the terms of a valid, current,
10  *      end user licence from KEIL for a compatible version of KEIL software
11  *      development tools. Nothing else gives you the right to use it.
12  *
13  *      Copyright (c) 2005-2006 Keil Software.
14  *---------------------------------------------------------------------------*/
15
16 #ifndef __HID_H__
17 #define __HID_H__
18
19
20 /* HID Subclass Codes */
21 #define HID_SUBCLASS_NONE               0x00
22 #define HID_SUBCLASS_BOOT               0x01
23
24 /* HID Protocol Codes */
25 #define HID_PROTOCOL_NONE               0x00
26 #define HID_PROTOCOL_KEYBOARD           0x01
27 #define HID_PROTOCOL_MOUSE              0x02
28
29
30 /* HID Descriptor Types */
31 #define HID_HID_DESCRIPTOR_TYPE         0x21
32 #define HID_REPORT_DESCRIPTOR_TYPE      0x22
33 #define HID_PHYSICAL_DESCRIPTOR_TYPE    0x23
34
35
36 /* HID Descriptor */
37 typedef __packed struct _HID_DESCRIPTOR {
38   BYTE  bLength;
39   BYTE  bDescriptorType;
40   WORD  bcdHID;
41   BYTE  bCountryCode;
42   BYTE  bNumDescriptors;
43   /* Array of one or more descriptors */
44   __packed struct _HID_DESCRIPTOR_LIST {
45     BYTE  bDescriptorType;
46     WORD  wDescriptorLength;
47   } DescriptorList[1];
48 } HID_DESCRIPTOR;
49
50
51 /* HID Request Codes */
52 #define HID_REQUEST_GET_REPORT          0x01
53 #define HID_REQUEST_GET_IDLE            0x02
54 #define HID_REQUEST_GET_PROTOCOL        0x03
55 #define HID_REQUEST_SET_REPORT          0x09
56 #define HID_REQUEST_SET_IDLE            0x0A
57 #define HID_REQUEST_SET_PROTOCOL        0x0B
58
59 /* HID Report Types */
60 #define HID_REPORT_INPUT                0x01
61 #define HID_REPORT_OUTPUT               0x02
62 #define HID_REPORT_FEATURE              0x03
63
64
65 /* Usage Pages */
66 #define HID_USAGE_PAGE_UNDEFINED        0x00
67 #define HID_USAGE_PAGE_GENERIC          0x01
68 #define HID_USAGE_PAGE_SIMULATION       0x02
69 #define HID_USAGE_PAGE_VR               0x03
70 #define HID_USAGE_PAGE_SPORT            0x04
71 #define HID_USAGE_PAGE_GAME             0x05
72 #define HID_USAGE_PAGE_DEV_CONTROLS     0x06
73 #define HID_USAGE_PAGE_KEYBOARD         0x07
74 #define HID_USAGE_PAGE_LED              0x08
75 #define HID_USAGE_PAGE_BUTTON           0x09
76 #define HID_USAGE_PAGE_ORDINAL          0x0A
77 #define HID_USAGE_PAGE_TELEPHONY        0x0B
78 #define HID_USAGE_PAGE_CONSUMER         0x0C
79 #define HID_USAGE_PAGE_DIGITIZER        0x0D
80 #define HID_USAGE_PAGE_UNICODE          0x10
81 #define HID_USAGE_PAGE_ALPHANUMERIC     0x14
82 /* ... */
83
84
85 /* Generic Desktop Page (0x01) */
86 #define HID_USAGE_GENERIC_POINTER               0x01
87 #define HID_USAGE_GENERIC_MOUSE                 0x02
88 #define HID_USAGE_GENERIC_JOYSTICK              0x04
89 #define HID_USAGE_GENERIC_GAMEPAD               0x05
90 #define HID_USAGE_GENERIC_KEYBOARD              0x06
91 #define HID_USAGE_GENERIC_KEYPAD                0x07
92 #define HID_USAGE_GENERIC_X                     0x30
93 #define HID_USAGE_GENERIC_Y                     0x31
94 #define HID_USAGE_GENERIC_Z                     0x32
95 #define HID_USAGE_GENERIC_RX                    0x33
96 #define HID_USAGE_GENERIC_RY                    0x34
97 #define HID_USAGE_GENERIC_RZ                    0x35
98 #define HID_USAGE_GENERIC_SLIDER                0x36
99 #define HID_USAGE_GENERIC_DIAL                  0x37
100 #define HID_USAGE_GENERIC_WHEEL                 0x38
101 #define HID_USAGE_GENERIC_HATSWITCH             0x39
102 #define HID_USAGE_GENERIC_COUNTED_BUFFER        0x3A
103 #define HID_USAGE_GENERIC_BYTE_COUNT            0x3B
104 #define HID_USAGE_GENERIC_MOTION_WAKEUP         0x3C
105 #define HID_USAGE_GENERIC_VX                    0x40
106 #define HID_USAGE_GENERIC_VY                    0x41
107 #define HID_USAGE_GENERIC_VZ                    0x42
108 #define HID_USAGE_GENERIC_VBRX                  0x43
109 #define HID_USAGE_GENERIC_VBRY                  0x44
110 #define HID_USAGE_GENERIC_VBRZ                  0x45
111 #define HID_USAGE_GENERIC_VNO                   0x46
112 #define HID_USAGE_GENERIC_SYSTEM_CTL            0x80
113 #define HID_USAGE_GENERIC_SYSCTL_POWER          0x81
114 #define HID_USAGE_GENERIC_SYSCTL_SLEEP          0x82
115 #define HID_USAGE_GENERIC_SYSCTL_WAKE           0x83
116 #define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU   0x84
117 #define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU      0x85
118 #define HID_USAGE_GENERIC_SYSCTL_APP_MENU       0x86
119 #define HID_USAGE_GENERIC_SYSCTL_HELP_MENU      0x87
120 #define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT      0x88
121 #define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT    0x89
122 #define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT     0x8A
123 #define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT      0x8B
124 #define HID_USAGE_GENERIC_SYSCTL_MENU_UP        0x8C
125 #define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN      0x8D
126 /* ... */
127
128 /* Simulation Controls Page (0x02) */
129 /* ... */
130 #define HID_USAGE_SIMULATION_RUDDER             0xBA
131 #define HID_USAGE_SIMULATION_THROTTLE           0xBB
132 /* ... */
133
134 /* Virtual Reality Controls Page (0x03) */
135 /* ... */
136
137 /* Sport Controls Page (0x04) */
138 /* ... */
139
140 /* Game Controls Page (0x05) */
141 /* ... */
142
143 /* Generic Device Controls Page (0x06) */
144 /* ... */
145
146 /* Keyboard/Keypad Page (0x07) */
147
148 /* Error "keys" */
149 #define HID_USAGE_KEYBOARD_NOEVENT              0x00
150 #define HID_USAGE_KEYBOARD_ROLLOVER             0x01
151 #define HID_USAGE_KEYBOARD_POSTFAIL             0x02
152 #define HID_USAGE_KEYBOARD_UNDEFINED            0x03
153
154 /* Letters */
155 #define HID_USAGE_KEYBOARD_aA                   0x04
156 #define HID_USAGE_KEYBOARD_zZ                   0x1D
157
158 /* Numbers */
159 #define HID_USAGE_KEYBOARD_ONE                  0x1E
160 #define HID_USAGE_KEYBOARD_ZERO                 0x27
161
162 #define HID_USAGE_KEYBOARD_RETURN               0x28
163 #define HID_USAGE_KEYBOARD_ESCAPE               0x29
164 #define HID_USAGE_KEYBOARD_DELETE               0x2A
165
166 /* Funtion keys */
167 #define HID_USAGE_KEYBOARD_F1                   0x3A
168 #define HID_USAGE_KEYBOARD_F12                  0x45
169
170 #define HID_USAGE_KEYBOARD_PRINT_SCREEN         0x46
171
172 /* Modifier Keys */
173 #define HID_USAGE_KEYBOARD_LCTRL                0xE0
174 #define HID_USAGE_KEYBOARD_LSHFT                0xE1
175 #define HID_USAGE_KEYBOARD_LALT                 0xE2
176 #define HID_USAGE_KEYBOARD_LGUI                 0xE3
177 #define HID_USAGE_KEYBOARD_RCTRL                0xE4
178 #define HID_USAGE_KEYBOARD_RSHFT                0xE5
179 #define HID_USAGE_KEYBOARD_RALT                 0xE6
180 #define HID_USAGE_KEYBOARD_RGUI                 0xE7
181 #define HID_USAGE_KEYBOARD_SCROLL_LOCK          0x47
182 #define HID_USAGE_KEYBOARD_NUM_LOCK             0x53
183 #define HID_USAGE_KEYBOARD_CAPS_LOCK            0x39
184
185 /* ... */
186
187 /* LED Page (0x08) */
188 #define HID_USAGE_LED_NUM_LOCK                  0x01
189 #define HID_USAGE_LED_CAPS_LOCK                 0x02
190 #define HID_USAGE_LED_SCROLL_LOCK               0x03
191 #define HID_USAGE_LED_COMPOSE                   0x04
192 #define HID_USAGE_LED_KANA                      0x05
193 #define HID_USAGE_LED_POWER                     0x06
194 #define HID_USAGE_LED_SHIFT                     0x07
195 #define HID_USAGE_LED_DO_NOT_DISTURB            0x08
196 #define HID_USAGE_LED_MUTE                      0x09
197 #define HID_USAGE_LED_TONE_ENABLE               0x0A
198 #define HID_USAGE_LED_HIGH_CUT_FILTER           0x0B
199 #define HID_USAGE_LED_LOW_CUT_FILTER            0x0C
200 #define HID_USAGE_LED_EQUALIZER_ENABLE          0x0D
201 #define HID_USAGE_LED_SOUND_FIELD_ON            0x0E
202 #define HID_USAGE_LED_SURROUND_FIELD_ON         0x0F
203 #define HID_USAGE_LED_REPEAT                    0x10
204 #define HID_USAGE_LED_STEREO                    0x11
205 #define HID_USAGE_LED_SAMPLING_RATE_DETECT      0x12
206 #define HID_USAGE_LED_SPINNING                  0x13
207 #define HID_USAGE_LED_CAV                       0x14
208 #define HID_USAGE_LED_CLV                       0x15
209 #define HID_USAGE_LED_RECORDING_FORMAT_DET      0x16
210 #define HID_USAGE_LED_OFF_HOOK                  0x17
211 #define HID_USAGE_LED_RING                      0x18
212 #define HID_USAGE_LED_MESSAGE_WAITING           0x19
213 #define HID_USAGE_LED_DATA_MODE                 0x1A
214 #define HID_USAGE_LED_BATTERY_OPERATION         0x1B
215 #define HID_USAGE_LED_BATTERY_OK                0x1C
216 #define HID_USAGE_LED_BATTERY_LOW               0x1D
217 #define HID_USAGE_LED_SPEAKER                   0x1E
218 #define HID_USAGE_LED_HEAD_SET                  0x1F
219 #define HID_USAGE_LED_HOLD                      0x20
220 #define HID_USAGE_LED_MICROPHONE                0x21
221 #define HID_USAGE_LED_COVERAGE                  0x22
222 #define HID_USAGE_LED_NIGHT_MODE                0x23
223 #define HID_USAGE_LED_SEND_CALLS                0x24
224 #define HID_USAGE_LED_CALL_PICKUP               0x25
225 #define HID_USAGE_LED_CONFERENCE                0x26
226 #define HID_USAGE_LED_STAND_BY                  0x27
227 #define HID_USAGE_LED_CAMERA_ON                 0x28
228 #define HID_USAGE_LED_CAMERA_OFF                0x29
229 #define HID_USAGE_LED_ON_LINE                   0x2A
230 #define HID_USAGE_LED_OFF_LINE                  0x2B
231 #define HID_USAGE_LED_BUSY                      0x2C
232 #define HID_USAGE_LED_READY                     0x2D
233 #define HID_USAGE_LED_PAPER_OUT                 0x2E
234 #define HID_USAGE_LED_PAPER_JAM                 0x2F
235 #define HID_USAGE_LED_REMOTE                    0x30
236 #define HID_USAGE_LED_FORWARD                   0x31
237 #define HID_USAGE_LED_REVERSE                   0x32
238 #define HID_USAGE_LED_STOP                      0x33
239 #define HID_USAGE_LED_REWIND                    0x34
240 #define HID_USAGE_LED_FAST_FORWARD              0x35
241 #define HID_USAGE_LED_PLAY                      0x36
242 #define HID_USAGE_LED_PAUSE                     0x37
243 #define HID_USAGE_LED_RECORD                    0x38
244 #define HID_USAGE_LED_ERROR                     0x39
245 #define HID_USAGE_LED_SELECTED_INDICATOR        0x3A
246 #define HID_USAGE_LED_IN_USE_INDICATOR          0x3B
247 #define HID_USAGE_LED_MULTI_MODE_INDICATOR      0x3C
248 #define HID_USAGE_LED_INDICATOR_ON              0x3D
249 #define HID_USAGE_LED_INDICATOR_FLASH           0x3E
250 #define HID_USAGE_LED_INDICATOR_SLOW_BLINK      0x3F
251 #define HID_USAGE_LED_INDICATOR_FAST_BLINK      0x40
252 #define HID_USAGE_LED_INDICATOR_OFF             0x41
253 #define HID_USAGE_LED_FLASH_ON_TIME             0x42
254 #define HID_USAGE_LED_SLOW_BLINK_ON_TIME        0x43
255 #define HID_USAGE_LED_SLOW_BLINK_OFF_TIME       0x44
256 #define HID_USAGE_LED_FAST_BLINK_ON_TIME        0x45
257 #define HID_USAGE_LED_FAST_BLINK_OFF_TIME       0x46
258 #define HID_USAGE_LED_INDICATOR_COLOR           0x47
259 #define HID_USAGE_LED_RED                       0x48
260 #define HID_USAGE_LED_GREEN                     0x49
261 #define HID_USAGE_LED_AMBER                     0x4A
262 #define HID_USAGE_LED_GENERIC_INDICATOR         0x4B
263
264 /* Button Page (0x09) */
265 /*   There is no need to label these usages. */
266
267 /* Ordinal Page (0x0A) */
268 /*   There is no need to label these usages. */
269
270 /* Telephony Device Page (0x0B) */
271 #define HID_USAGE_TELEPHONY_PHONE               0x01
272 #define HID_USAGE_TELEPHONY_ANSWERING_MACHINE   0x02
273 #define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS    0x03
274 #define HID_USAGE_TELEPHONY_HANDSET             0x04
275 #define HID_USAGE_TELEPHONY_HEADSET             0x05
276 #define HID_USAGE_TELEPHONY_KEYPAD              0x06
277 #define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON 0x07
278 /* ... */
279
280 /* Consumer Page (0x0C) */
281 #define HID_USAGE_CONSUMER_CONTROL              0x01
282 /* ... */
283
284 /* and others ... */
285
286
287 /* HID Report Item Macros */
288
289 /* Main Items */
290 #define HID_Input(x)           0x81,x
291 #define HID_Output(x)          0x91,x
292 #define HID_Feature(x)         0xB1,x
293 #define HID_Collection(x)      0xA1,x
294 #define HID_EndCollection      0xC0
295
296 /* Data (Input, Output, Feature) */
297 #define HID_Data               0<<0
298 #define HID_Constant           1<<0
299 #define HID_Array              0<<1
300 #define HID_Variable           1<<1
301 #define HID_Absolute           0<<2
302 #define HID_Relative           1<<2
303 #define HID_NoWrap             0<<3
304 #define HID_Wrap               1<<3
305 #define HID_Linear             0<<4
306 #define HID_NonLinear          1<<4
307 #define HID_PreferredState     0<<5
308 #define HID_NoPreferred        1<<5
309 #define HID_NoNullPosition     0<<6
310 #define HID_NullState          1<<6
311 #define HID_NonVolatile        0<<7
312 #define HID_Volatile           1<<7
313
314 /* Collection Data */
315 #define HID_Physical           0x00
316 #define HID_Application        0x01
317 #define HID_Logical            0x02
318 #define HID_Report             0x03
319 #define HID_NamedArray         0x04
320 #define HID_UsageSwitch        0x05
321 #define HID_UsageModifier      0x06
322
323 /* Global Items */
324 #define HID_UsagePage(x)       0x05,x
325 #define HID_UsagePageVendor(x) 0x06,x,0xFF
326 #define HID_LogicalMin(x)      0x15,x
327 #define HID_LogicalMinS(x)     0x16,(x&0xFF),((x>>8)&0xFF)
328 #define HID_LogicalMinL(x)     0x17,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
329 #define HID_LogicalMax(x)      0x25,x
330 #define HID_LogicalMaxS(x)     0x26,(x&0xFF),((x>>8)&0xFF)
331 #define HID_LogicalMaxL(x)     0x27,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
332 #define HID_PhysicalMin(x)     0x35,x
333 #define HID_PhysicalMinS(x)    0x36,(x&0xFF),((x>>8)&0xFF)
334 #define HID_PhysicalMinL(x)    0x37,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
335 #define HID_PhysicalMax(x)     0x45,x
336 #define HID_PhysicalMaxS(x)    0x46,(x&0xFF),((x>>8)&0xFF)
337 #define HID_PhysicalMaxL(x)    0x47,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
338 #define HID_UnitExponent(x)    0x55,x
339 #define HID_Unit(x)            0x65,x
340 #define HID_UnitS(x)           0x66,(x&0xFF),((x>>8)&0xFF)
341 #define HID_UnitL(x)           0x67,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
342 #define HID_ReportSize(x)      0x75,x
343 #define HID_ReportID(x)        0x85,x
344 #define HID_ReportCount(x)     0x95,x
345 #define HID_Push               0xA0
346 #define HID_Pop                0xB0
347
348 /* Local Items */
349 #define HID_Usage(x)           0x09,x
350 #define HID_UsageMin(x)        0x19,x
351 #define HID_UsageMax(x)        0x29,x
352
353
354 #endif  /* __HID_H__ */
Note: See TracBrowser for help on using the browser.