| USBD ROM Stack 2.0 ROM based USB device stack

mw_usbd_hid.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id:: mw_usbd_hid.h 196 2011-06-09 22:39:19Z usb06052 $
3 *
4 * Project: USB device ROM Stack
5 *
6 * Description:
7 * HID Definitions.
8 *
9 ***********************************************************************
10 * Copyright(C) 2011, NXP Semiconductor
11 * All rights reserved.
12 *
13 * Software that is described herein is for illustrative purposes only
14 * which provides customers with programming information regarding the
15 * products. This software is supplied "AS IS" without any warranties.
16 * NXP Semiconductors assumes no responsibility or liability for the
17 * use of the software, conveys no license or title under any patent,
18 * copyright, or mask work right to the product. NXP Semiconductors
19 * reserves the right to make changes in the software without
20 * notification. NXP Semiconductors also make no representation or
21 * warranty that such application will be suitable for the specified
22 * use without further testing or modification.
23 **********************************************************************/
24 #ifndef __HID_H__
25 #define __HID_H__
26
27 #include "mw_usbd.h"
28
41 #define HID_SUBCLASS_NONE 0x00
42
43 #define HID_SUBCLASS_BOOT 0x01
44
50 #define HID_PROTOCOL_NONE 0x00
51
52 #define HID_PROTOCOL_KEYBOARD 0x01
53
54 #define HID_PROTOCOL_MOUSE 0x02
55
61 #define HID_HID_DESCRIPTOR_TYPE 0x21
62
63 #define HID_REPORT_DESCRIPTOR_TYPE 0x22
64
65 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
66
74 PRE_PACK struct POST_PACK _HID_DESCRIPTOR {
75 uint8_t bLength;
77 uint8_t bDescriptorType;
78 uint16_t bcdHID;
79 uint8_t bCountryCode;
80 uint8_t bNumDescriptors;
82 PRE_PACK struct POST_PACK _HID_DESCRIPTOR_LIST {
83 uint8_t bDescriptorType;
85 uint16_t wDescriptorLength;
86 } DescriptorList[1];
87 };
89 typedef struct _HID_DESCRIPTOR HID_DESCRIPTOR;
90
94 #define HID_REQUEST_GET_REPORT 0x01
95 #define HID_REQUEST_GET_IDLE 0x02
96 #define HID_REQUEST_GET_PROTOCOL 0x03
97 #define HID_REQUEST_SET_REPORT 0x09
98 #define HID_REQUEST_SET_IDLE 0x0A
99 #define HID_REQUEST_SET_PROTOCOL 0x0B
100
105 #define HID_REPORT_INPUT 0x01
106 #define HID_REPORT_OUTPUT 0x02
107 #define HID_REPORT_FEATURE 0x03
108
113 #define HID_USAGE_PAGE_UNDEFINED 0x00
114 #define HID_USAGE_PAGE_GENERIC 0x01
115 #define HID_USAGE_PAGE_SIMULATION 0x02
116 #define HID_USAGE_PAGE_VR 0x03
117 #define HID_USAGE_PAGE_SPORT 0x04
118 #define HID_USAGE_PAGE_GAME 0x05
119 #define HID_USAGE_PAGE_DEV_CONTROLS 0x06
120 #define HID_USAGE_PAGE_KEYBOARD 0x07
121 #define HID_USAGE_PAGE_LED 0x08
122 #define HID_USAGE_PAGE_BUTTON 0x09
123 #define HID_USAGE_PAGE_ORDINAL 0x0A
124 #define HID_USAGE_PAGE_TELEPHONY 0x0B
125 #define HID_USAGE_PAGE_CONSUMER 0x0C
126 #define HID_USAGE_PAGE_DIGITIZER 0x0D
127 #define HID_USAGE_PAGE_UNICODE 0x10
128 #define HID_USAGE_PAGE_ALPHANUMERIC 0x14
129
134 #define HID_USAGE_GENERIC_POINTER 0x01
135 #define HID_USAGE_GENERIC_MOUSE 0x02
136 #define HID_USAGE_GENERIC_JOYSTICK 0x04
137 #define HID_USAGE_GENERIC_GAMEPAD 0x05
138 #define HID_USAGE_GENERIC_KEYBOARD 0x06
139 #define HID_USAGE_GENERIC_KEYPAD 0x07
140 #define HID_USAGE_GENERIC_X 0x30
141 #define HID_USAGE_GENERIC_Y 0x31
142 #define HID_USAGE_GENERIC_Z 0x32
143 #define HID_USAGE_GENERIC_RX 0x33
144 #define HID_USAGE_GENERIC_RY 0x34
145 #define HID_USAGE_GENERIC_RZ 0x35
146 #define HID_USAGE_GENERIC_SLIDER 0x36
147 #define HID_USAGE_GENERIC_DIAL 0x37
148 #define HID_USAGE_GENERIC_WHEEL 0x38
149 #define HID_USAGE_GENERIC_HATSWITCH 0x39
150 #define HID_USAGE_GENERIC_COUNTED_BUFFER 0x3A
151 #define HID_USAGE_GENERIC_BYTE_COUNT 0x3B
152 #define HID_USAGE_GENERIC_MOTION_WAKEUP 0x3C
153 #define HID_USAGE_GENERIC_VX 0x40
154 #define HID_USAGE_GENERIC_VY 0x41
155 #define HID_USAGE_GENERIC_VZ 0x42
156 #define HID_USAGE_GENERIC_VBRX 0x43
157 #define HID_USAGE_GENERIC_VBRY 0x44
158 #define HID_USAGE_GENERIC_VBRZ 0x45
159 #define HID_USAGE_GENERIC_VNO 0x46
160 #define HID_USAGE_GENERIC_SYSTEM_CTL 0x80
161 #define HID_USAGE_GENERIC_SYSCTL_POWER 0x81
162 #define HID_USAGE_GENERIC_SYSCTL_SLEEP 0x82
163 #define HID_USAGE_GENERIC_SYSCTL_WAKE 0x83
164 #define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU 0x84
165 #define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU 0x85
166 #define HID_USAGE_GENERIC_SYSCTL_APP_MENU 0x86
167 #define HID_USAGE_GENERIC_SYSCTL_HELP_MENU 0x87
168 #define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT 0x88
169 #define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT 0x89
170 #define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT 0x8A
171 #define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT 0x8B
172 #define HID_USAGE_GENERIC_SYSCTL_MENU_UP 0x8C
173 #define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN 0x8D
174
179 #define HID_USAGE_SIMULATION_RUDDER 0xBA
180 #define HID_USAGE_SIMULATION_THROTTLE 0xBB
181
183 /* Virtual Reality Controls Page (0x03) */
184 /* ... */
185
186 /* Sport Controls Page (0x04) */
187 /* ... */
188
189 /* Game Controls Page (0x05) */
190 /* ... */
191
192 /* Generic Device Controls Page (0x06) */
193 /* ... */
194
199 #define HID_USAGE_KEYBOARD_NOEVENT 0x00
200 #define HID_USAGE_KEYBOARD_ROLLOVER 0x01
201 #define HID_USAGE_KEYBOARD_POSTFAIL 0x02
202 #define HID_USAGE_KEYBOARD_UNDEFINED 0x03
203
205 #define HID_USAGE_KEYBOARD_aA 0x04
206 #define HID_USAGE_KEYBOARD_zZ 0x1D
207
209 #define HID_USAGE_KEYBOARD_ONE 0x1E
210 #define HID_USAGE_KEYBOARD_ZERO 0x27
211
212 #define HID_USAGE_KEYBOARD_RETURN 0x28
213 #define HID_USAGE_KEYBOARD_ESCAPE 0x29
214 #define HID_USAGE_KEYBOARD_DELETE 0x2A
215
217 #define HID_USAGE_KEYBOARD_F1 0x3A
218 #define HID_USAGE_KEYBOARD_F12 0x45
219
220 #define HID_USAGE_KEYBOARD_PRINT_SCREEN 0x46
221
223 #define HID_USAGE_KEYBOARD_LCTRL 0xE0
224 #define HID_USAGE_KEYBOARD_LSHFT 0xE1
225 #define HID_USAGE_KEYBOARD_LALT 0xE2
226 #define HID_USAGE_KEYBOARD_LGUI 0xE3
227 #define HID_USAGE_KEYBOARD_RCTRL 0xE4
228 #define HID_USAGE_KEYBOARD_RSHFT 0xE5
229 #define HID_USAGE_KEYBOARD_RALT 0xE6
230 #define HID_USAGE_KEYBOARD_RGUI 0xE7
231 #define HID_USAGE_KEYBOARD_SCROLL_LOCK 0x47
232 #define HID_USAGE_KEYBOARD_NUM_LOCK 0x53
233 #define HID_USAGE_KEYBOARD_CAPS_LOCK 0x39
234
236 /* ... */
237
241 #define HID_USAGE_LED_NUM_LOCK 0x01
242 #define HID_USAGE_LED_CAPS_LOCK 0x02
243 #define HID_USAGE_LED_SCROLL_LOCK 0x03
244 #define HID_USAGE_LED_COMPOSE 0x04
245 #define HID_USAGE_LED_KANA 0x05
246 #define HID_USAGE_LED_POWER 0x06
247 #define HID_USAGE_LED_SHIFT 0x07
248 #define HID_USAGE_LED_DO_NOT_DISTURB 0x08
249 #define HID_USAGE_LED_MUTE 0x09
250 #define HID_USAGE_LED_TONE_ENABLE 0x0A
251 #define HID_USAGE_LED_HIGH_CUT_FILTER 0x0B
252 #define HID_USAGE_LED_LOW_CUT_FILTER 0x0C
253 #define HID_USAGE_LED_EQUALIZER_ENABLE 0x0D
254 #define HID_USAGE_LED_SOUND_FIELD_ON 0x0E
255 #define HID_USAGE_LED_SURROUND_FIELD_ON 0x0F
256 #define HID_USAGE_LED_REPEAT 0x10
257 #define HID_USAGE_LED_STEREO 0x11
258 #define HID_USAGE_LED_SAMPLING_RATE_DETECT 0x12
259 #define HID_USAGE_LED_SPINNING 0x13
260 #define HID_USAGE_LED_CAV 0x14
261 #define HID_USAGE_LED_CLV 0x15
262 #define HID_USAGE_LED_RECORDING_FORMAT_DET 0x16
263 #define HID_USAGE_LED_OFF_HOOK 0x17
264 #define HID_USAGE_LED_RING 0x18
265 #define HID_USAGE_LED_MESSAGE_WAITING 0x19
266 #define HID_USAGE_LED_DATA_MODE 0x1A
267 #define HID_USAGE_LED_BATTERY_OPERATION 0x1B
268 #define HID_USAGE_LED_BATTERY_OK 0x1C
269 #define HID_USAGE_LED_BATTERY_LOW 0x1D
270 #define HID_USAGE_LED_SPEAKER 0x1E
271 #define HID_USAGE_LED_HEAD_SET 0x1F
272 #define HID_USAGE_LED_HOLD 0x20
273 #define HID_USAGE_LED_MICROPHONE 0x21
274 #define HID_USAGE_LED_COVERAGE 0x22
275 #define HID_USAGE_LED_NIGHT_MODE 0x23
276 #define HID_USAGE_LED_SEND_CALLS 0x24
277 #define HID_USAGE_LED_CALL_PICKUP 0x25
278 #define HID_USAGE_LED_CONFERENCE 0x26
279 #define HID_USAGE_LED_STAND_BY 0x27
280 #define HID_USAGE_LED_CAMERA_ON 0x28
281 #define HID_USAGE_LED_CAMERA_OFF 0x29
282 #define HID_USAGE_LED_ON_LINE 0x2A
283 #define HID_USAGE_LED_OFF_LINE 0x2B
284 #define HID_USAGE_LED_BUSY 0x2C
285 #define HID_USAGE_LED_READY 0x2D
286 #define HID_USAGE_LED_PAPER_OUT 0x2E
287 #define HID_USAGE_LED_PAPER_JAM 0x2F
288 #define HID_USAGE_LED_REMOTE 0x30
289 #define HID_USAGE_LED_FORWARD 0x31
290 #define HID_USAGE_LED_REVERSE 0x32
291 #define HID_USAGE_LED_STOP 0x33
292 #define HID_USAGE_LED_REWIND 0x34
293 #define HID_USAGE_LED_FAST_FORWARD 0x35
294 #define HID_USAGE_LED_PLAY 0x36
295 #define HID_USAGE_LED_PAUSE 0x37
296 #define HID_USAGE_LED_RECORD 0x38
297 #define HID_USAGE_LED_ERROR 0x39
298 #define HID_USAGE_LED_SELECTED_INDICATOR 0x3A
299 #define HID_USAGE_LED_IN_USE_INDICATOR 0x3B
300 #define HID_USAGE_LED_MULTI_MODE_INDICATOR 0x3C
301 #define HID_USAGE_LED_INDICATOR_ON 0x3D
302 #define HID_USAGE_LED_INDICATOR_FLASH 0x3E
303 #define HID_USAGE_LED_INDICATOR_SLOW_BLINK 0x3F
304 #define HID_USAGE_LED_INDICATOR_FAST_BLINK 0x40
305 #define HID_USAGE_LED_INDICATOR_OFF 0x41
306 #define HID_USAGE_LED_FLASH_ON_TIME 0x42
307 #define HID_USAGE_LED_SLOW_BLINK_ON_TIME 0x43
308 #define HID_USAGE_LED_SLOW_BLINK_OFF_TIME 0x44
309 #define HID_USAGE_LED_FAST_BLINK_ON_TIME 0x45
310 #define HID_USAGE_LED_FAST_BLINK_OFF_TIME 0x46
311 #define HID_USAGE_LED_INDICATOR_COLOR 0x47
312 #define HID_USAGE_LED_RED 0x48
313 #define HID_USAGE_LED_GREEN 0x49
314 #define HID_USAGE_LED_AMBER 0x4A
315 #define HID_USAGE_LED_GENERIC_INDICATOR 0x4B
316
318 /* Button Page (0x09)
319 */
320 /* There is no need to label these usages. */
321
322 /* Ordinal Page (0x0A)
323 */
324 /* There is no need to label these usages. */
325
329 #define HID_USAGE_TELEPHONY_PHONE 0x01
330 #define HID_USAGE_TELEPHONY_ANSWERING_MACHINE 0x02
331 #define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS 0x03
332 #define HID_USAGE_TELEPHONY_HANDSET 0x04
333 #define HID_USAGE_TELEPHONY_HEADSET 0x05
334 #define HID_USAGE_TELEPHONY_KEYPAD 0x06
335 #define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON 0x07
336
337 /* ... */
338
342 #define HID_USAGE_CONSUMER_CONTROL 0x01
343 #define HID_USAGE_CONSUMER_FAST_FORWARD 0xB3
344 #define HID_USAGE_CONSUMER_REWIND 0xB4
345 #define HID_USAGE_CONSUMER_PLAY_PAUSE 0xCD
346 #define HID_USAGE_CONSUMER_VOLUME_INCREMENT 0xE9
347 #define HID_USAGE_CONSUMER_VOLUME_DECREMENT 0xEA
348
349 /* ... */
350
351 /* and others ... */
352
357 #define HID_Input(x) 0x81, x
358 #define HID_Output(x) 0x91, x
359 #define HID_Feature(x) 0xB1, x
360 #define HID_Collection(x) 0xA1, x
361 #define HID_EndCollection 0xC0
362
364 #define HID_Data 0 << 0
365 #define HID_Constant 1 << 0
366 #define HID_Array 0 << 1
367 #define HID_Variable 1 << 1
368 #define HID_Absolute 0 << 2
369 #define HID_Relative 1 << 2
370 #define HID_NoWrap 0 << 3
371 #define HID_Wrap 1 << 3
372 #define HID_Linear 0 << 4
373 #define HID_NonLinear 1 << 4
374 #define HID_PreferredState 0 << 5
375 #define HID_NoPreferred 1 << 5
376 #define HID_NoNullPosition 0 << 6
377 #define HID_NullState 1 << 6
378 #define HID_NonVolatile 0 << 7
379 #define HID_Volatile 1 << 7
380
382 #define HID_Physical 0x00
383 #define HID_Application 0x01
384 #define HID_Logical 0x02
385 #define HID_Report 0x03
386 #define HID_NamedArray 0x04
387 #define HID_UsageSwitch 0x05
388 #define HID_UsageModifier 0x06
389
391 #define HID_UsagePage(x) 0x05, x
392 #define HID_UsagePageVendor(x) 0x06, x, 0xFF
393 #define HID_LogicalMin(x) 0x15, x
394 #define HID_LogicalMinS(x) 0x16, (x & 0xFF), ((x >> 8) & 0xFF)
395 #define HID_LogicalMinL(x) 0x17, (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
396 #define HID_LogicalMax(x) 0x25, x
397 #define HID_LogicalMaxS(x) 0x26, (x & 0xFF), ((x >> 8) & 0xFF)
398 #define HID_LogicalMaxL(x) 0x27, (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
399 #define HID_PhysicalMin(x) 0x35, x
400 #define HID_PhysicalMinS(x) 0x36, (x & 0xFF), ((x >> 8) & 0xFF)
401 #define HID_PhysicalMinL(x) 0x37, (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
402 #define HID_PhysicalMax(x) 0x45, x
403 #define HID_PhysicalMaxS(x) 0x46, (x & 0xFF), ((x >> 8) & 0xFF)
404 #define HID_PhysicalMaxL(x) 0x47, (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
405 #define HID_UnitExponent(x) 0x55, x
406 #define HID_Unit(x) 0x65, x
407 #define HID_UnitS(x) 0x66, (x & 0xFF), ((x >> 8) & 0xFF)
408 #define HID_UnitL(x) 0x67, (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF)
409 #define HID_ReportSize(x) 0x75, x
410 #define HID_ReportID(x) 0x85, x
411 #define HID_ReportCount(x) 0x95, x
412 #define HID_Push 0xA0
413 #define HID_Pop 0xB0
414
416 #define HID_Usage(x) 0x09, x
417 #define HID_UsageMin(x) 0x19, x
418 #define HID_UsageMax(x) 0x29, x
419
423 #endif /* __HID_H__ */
_HID_DESCRIPTOR::_HID_DESCRIPTOR_LIST::bDescriptorType
uint8_t bDescriptorType
Definition: mw_usbd_hid.h:83
_HID_DESCRIPTOR::bLength
uint8_t bLength
Definition: mw_usbd_hid.h:75
_HID_DESCRIPTOR::bcdHID
uint16_t bcdHID
Definition: mw_usbd_hid.h:78
_HID_DESCRIPTOR
HID class-specific HID Descriptor.
Definition: mw_usbd_hid.h:74
_HID_DESCRIPTOR::_HID_DESCRIPTOR_LIST
Definition: mw_usbd_hid.h:82
_HID_DESCRIPTOR::bCountryCode
uint8_t bCountryCode
Definition: mw_usbd_hid.h:79
mw_usbd.h
Common definitions and declarations for the USB stack.
_HID_DESCRIPTOR::_HID_DESCRIPTOR_LIST::wDescriptorLength
uint16_t wDescriptorLength
Definition: mw_usbd_hid.h:85
_HID_DESCRIPTOR::bNumDescriptors
uint8_t bNumDescriptors
Definition: mw_usbd_hid.h:80
_HID_DESCRIPTOR::bDescriptorType
uint8_t bDescriptorType
Definition: mw_usbd_hid.h:77