+/rtos

git clone https://git.julia.blue/+/rtos

Vivek Malneediusb headers326af29

master
20.8 KiB596 linesraw
1//*****************************************************************************
2//
3// usbhid.h - Definitions used by HID class devices and hosts.
4//
5// Copyright (c) 2008-2017 Texas Instruments Incorporated.  All rights reserved.
6// Software License Agreement
7//
8// Texas Instruments (TI) is supplying this software for use solely and
9// exclusively on TI's microcontroller products. The software is owned by
10// TI and/or its suppliers, and is protected under applicable copyright
11// laws. You may not combine this software with "viral" open-source
12// software in order to form a larger program.
13//
14// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19// DAMAGES, FOR ANY REASON WHATSOEVER.
20//
21// This is part of revision 2.1.4.178 of the Tiva USB Library.
22//
23//*****************************************************************************
24
25#ifndef __USBHID_H__
26#define __USBHID_H__
27
28#include "usblib/usblib.h"
29#include <stdint.h>
30
31//*****************************************************************************
32//
33// If building with a C++ compiler, make all of the definitions in this header
34// have a C binding.
35//
36//*****************************************************************************
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41//*****************************************************************************
42//
43//! \addtogroup hid_device_class_api
44//! @{
45//
46//*****************************************************************************
47
48//*****************************************************************************
49//
50// HID Interface descriptor Subclasses.
51//
52//*****************************************************************************
53#define USB_HID_SCLASS_NONE 0x00
54#define USB_HID_SCLASS_BOOT 0x01
55
56//*****************************************************************************
57//
58// USB Interface descriptor HID protocols.
59//
60//*****************************************************************************
61#define USB_HID_PROTOCOL_NONE 0
62#define USB_HID_PROTOCOL_KEYB 1
63#define USB_HID_PROTOCOL_MOUSE 2
64
65//*****************************************************************************
66//
67// HID Class descriptor types.
68//
69//*****************************************************************************
70#define USB_HID_DTYPE_HID 0x21
71#define USB_HID_DTYPE_REPORT 0x22
72#define USB_HID_DTYPE_PHYSICAL 0x23
73
74//*****************************************************************************
75//
76// HID USB requests.
77//
78//*****************************************************************************
79#define USBREQ_GET_REPORT 0x01
80#define USBREQ_GET_IDLE 0x02
81#define USBREQ_GET_PROTOCOL 0x03
82#define USBREQ_SET_REPORT 0x09
83#define USBREQ_SET_IDLE 0x0a
84#define USBREQ_SET_PROTOCOL 0x0b
85
86//*****************************************************************************
87//
88// GET_REPORT or SET_REPORT Definitions.
89//
90//*****************************************************************************
91#define USB_HID_REPORT_IN 0x01
92#define USB_HID_REPORT_OUTPUT 0x02
93#define USB_HID_REPORT_FEATURE 0x03
94
95//*****************************************************************************
96//
97// GET_PROTOCOL or SET_PROTOCOL Definitions.
98//
99//*****************************************************************************
100#define USB_HID_PROTOCOL_BOOT 0
101#define USB_HID_PROTOCOL_REPORT 1
102
103//*****************************************************************************
104//
105// Report Values used with the Report macros.
106//
107//*****************************************************************************
108#define USB_HID_GENERIC_DESKTOP 0x01
109#define USB_HID_BUTTONS 0x09
110#define USB_HID_X 0x30
111#define USB_HID_Y 0x31
112#define USB_HID_Z 0x32
113#define USB_HID_RX 0x33
114#define USB_HID_RY 0x34
115#define USB_HID_RZ 0x35
116
117#define USB_HID_POINTER 0x01
118#define USB_HID_MOUSE 0x02
119#define USB_HID_JOYSTICK 0x04
120#define USB_HID_GAME_PAD 0x05
121#define USB_HID_KEYBOARD 0x06
122
123#define USB_HID_PHYSICAL 0x00
124#define USB_HID_APPLICATION 0x01
125#define USB_HID_LOGICAL 0x02
126
127#define USB_HID_USAGE_POINTER 0x0109
128#define USB_HID_USAGE_BUTTONS 0x0509
129#define USB_HID_USAGE_LEDS 0x0508
130#define USB_HID_USAGE_KEYCODES 0x0507
131
132//*****************************************************************************
133//
134// HID mouse button definitions as used in the first byte of the output report
135// used in the BIOS mouse protocol.
136//
137//*****************************************************************************
138#define HID_MOUSE_BUTTON_1 0x01
139#define HID_MOUSE_BUTTON_2 0x02
140#define HID_MOUSE_BUTTON_3 0x04
141
142//*****************************************************************************
143//
144// HID Keyboard LED definitions as used in the first byte of the output report
145// used in the BIOS keyboard protocol.
146//
147//*****************************************************************************
148#define HID_KEYB_NUM_LOCK 0x01
149#define HID_KEYB_CAPS_LOCK 0x02
150#define HID_KEYB_SCROLL_LOCK 0x04
151#define HID_KEYB_COMPOSE 0x08
152#define HID_KEYB_KANA 0x10
153
154//*****************************************************************************
155//
156// HID Keyboard key modifiers as provided in the first byte of the input report
157// used in the BIOS keyboard protocol.
158//
159//*****************************************************************************
160#define HID_KEYB_LEFT_CTRL 0x01
161#define HID_KEYB_LEFT_SHIFT 0x02
162#define HID_KEYB_LEFT_ALT 0x04
163#define HID_KEYB_LEFT_GUI 0x08
164#define HID_KEYB_RIGHT_CTRL 0x10
165#define HID_KEYB_RIGHT_SHIFT 0x20
166#define HID_KEYB_RIGHT_ALT 0x40
167#define HID_KEYB_RIGHT_GUI 0x80
168
169//*****************************************************************************
170//
171// A subset of the HID keyboard usage IDs.
172//
173//*****************************************************************************
174#define HID_KEYB_USAGE_RESERVED 0x00
175#define HID_KEYB_USAGE_ROLLOVER 0x01
176#define HID_KEYB_USAGE_A 0x04
177#define HID_KEYB_USAGE_B 0x05
178#define HID_KEYB_USAGE_C 0x06
179#define HID_KEYB_USAGE_D 0x07
180#define HID_KEYB_USAGE_E 0x08
181#define HID_KEYB_USAGE_F 0x09
182#define HID_KEYB_USAGE_G 0x0A
183#define HID_KEYB_USAGE_H 0x0B
184#define HID_KEYB_USAGE_I 0x0C
185#define HID_KEYB_USAGE_J 0x0D
186#define HID_KEYB_USAGE_K 0x0E
187#define HID_KEYB_USAGE_L 0x0F
188#define HID_KEYB_USAGE_M 0x10
189#define HID_KEYB_USAGE_N 0x11
190#define HID_KEYB_USAGE_O 0x12
191#define HID_KEYB_USAGE_P 0x13
192#define HID_KEYB_USAGE_Q 0x14
193#define HID_KEYB_USAGE_R 0x15
194#define HID_KEYB_USAGE_S 0x16
195#define HID_KEYB_USAGE_T 0x17
196#define HID_KEYB_USAGE_U 0x18
197#define HID_KEYB_USAGE_V 0x19
198#define HID_KEYB_USAGE_W 0x1A
199#define HID_KEYB_USAGE_X 0x1B
200#define HID_KEYB_USAGE_Y 0x1C
201#define HID_KEYB_USAGE_Z 0x1D
202#define HID_KEYB_USAGE_1 0x1E
203#define HID_KEYB_USAGE_2 0x1F
204#define HID_KEYB_USAGE_3 0x20
205#define HID_KEYB_USAGE_4 0x21
206#define HID_KEYB_USAGE_5 0x22
207#define HID_KEYB_USAGE_6 0x23
208#define HID_KEYB_USAGE_7 0x24
209#define HID_KEYB_USAGE_8 0x25
210#define HID_KEYB_USAGE_9 0x26
211#define HID_KEYB_USAGE_0 0x27
212#define HID_KEYB_USAGE_ENTER 0x28
213#define HID_KEYB_USAGE_ESCAPE 0x29
214#define HID_KEYB_USAGE_BACKSPACE 0x2A
215#define HID_KEYB_USAGE_TAB 0x2B
216#define HID_KEYB_USAGE_SPACE 0x2C
217#define HID_KEYB_USAGE_MINUS 0x2D
218#define HID_KEYB_USAGE_EQUAL 0x2E
219#define HID_KEYB_USAGE_LBRACKET 0x2F
220#define HID_KEYB_USAGE_RBRACKET 0x30
221#define HID_KEYB_USAGE_BSLASH 0x31
222#define HID_KEYB_USAGE_SEMICOLON 0x33
223#define HID_KEYB_USAGE_FQUOTE 0x34
224#define HID_KEYB_USAGE_BQUOTE 0x35
225#define HID_KEYB_USAGE_COMMA 0x36
226#define HID_KEYB_USAGE_PERIOD 0x37
227#define HID_KEYB_USAGE_FSLASH 0x38
228#define HID_KEYB_USAGE_CAPSLOCK 0x39
229#define HID_KEYB_USAGE_F1 0x3A
230#define HID_KEYB_USAGE_F2 0x3B
231#define HID_KEYB_USAGE_F3 0x3C
232#define HID_KEYB_USAGE_F4 0x3D
233#define HID_KEYB_USAGE_F5 0x3E
234#define HID_KEYB_USAGE_F6 0x3F
235#define HID_KEYB_USAGE_F7 0x40
236#define HID_KEYB_USAGE_F8 0x41
237#define HID_KEYB_USAGE_F9 0x42
238#define HID_KEYB_USAGE_F10 0x43
239#define HID_KEYB_USAGE_F11 0x44
240#define HID_KEYB_USAGE_F12 0x45
241#define HID_KEYB_USAGE_SCROLLOCK 0x47
242#define HID_KEYB_USAGE_PAGE_UP 0x4B
243#define HID_KEYB_USAGE_PAGE_DOWN 0x4E
244#define HID_KEYB_USAGE_RIGHT_ARROW 0x4F
245#define HID_KEYB_USAGE_LEFT_ARROW 0x50
246#define HID_KEYB_USAGE_DOWN_ARROW 0x51
247#define HID_KEYB_USAGE_UP_ARROW 0x52
248#define HID_KEYB_USAGE_NUMLOCK 0x53
249#define HID_KEYB_USAGE_KEYPAD_SLASH 0x54
250#define HID_KEYB_USAGE_KEYPAD_STAR 0x55
251#define HID_KEYB_USAGE_KEYPAD_MINUS 0x56
252#define HID_KEYB_USAGE_KEYPAD_PLUS 0x57
253#define HID_KEYB_USAGE_KEPAD_ENTER 0x58
254#define HID_KEYB_USAGE_KEYPAD_1 0x59
255#define HID_KEYB_USAGE_KEYPAD_2 0x5A
256#define HID_KEYB_USAGE_KEYPAD_3 0x5B
257#define HID_KEYB_USAGE_KEYPAD_4 0x5C
258#define HID_KEYB_USAGE_KEYPAD_5 0x5D
259#define HID_KEYB_USAGE_KEYPAD_6 0x5E
260#define HID_KEYB_USAGE_KEYPAD_7 0x5F
261#define HID_KEYB_USAGE_KEYPAD_8 0x60
262#define HID_KEYB_USAGE_KEYPAD_9 0x61
263#define HID_KEYB_USAGE_KEYPAD_0 0x62
264#define HID_KEYB_USAGE_KEPAD_PERIOD 0x63
265
266//*****************************************************************************
267//
268// HID descriptor country codes (most of these are described as "countries" in
269// the HID specification even though they are really languages).
270//
271//*****************************************************************************
272#define USB_HID_COUNTRY_NONE 0x00
273#define USB_HID_COUNTRY_ARABIC 0x01
274#define USB_HID_COUNTRY_BELGIAN 0x02
275#define USB_HID_COUNTRY_CANADA_BI 0x03
276#define USB_HID_COUNTRY_CANADA_FR 0x04
277#define USB_HID_COUNTRY_CZECH_REPUBLIC 0x05
278#define USB_HID_COUNTRY_DANISH 0x06
279#define USB_HID_COUNTRY_FINNISH 0x07
280#define USB_HID_COUNTRY_FRENCH 0x08
281#define USB_HID_COUNTRY_GERMAN 0x09
282#define USB_HID_COUNTRY_GREEK 0x0A
283#define USB_HID_COUNTRY_HEBREW 0x0B
284#define USB_HID_COUNTRY_HUNGARY 0x0C
285#define USB_HID_COUNTRY_INTERNATIONAL_ISO 0x0D
286#define USB_HID_COUNTRY_ITALIAN 0x0E
287#define USB_HID_COUNTRY_JAPAN_KATAKANA 0x0F
288#define USB_HID_COUNTRY_KOREAN 0x10
289#define USB_HID_COUNTRY_LATIN_AMERICAN 0x11
290#define USB_HID_COUNTRY_NETHERLANDS 0x12
291#define USB_HID_COUNTRY_NORWEGIAN 0x13
292#define USB_HID_COUNTRY_PERSIAN 0x14
293#define USB_HID_COUNTRY_POLAND 0x15
294#define USB_HID_COUNTRY_PORTUGUESE 0x16
295#define USB_HID_COUNTRY_RUSSIA 0x17
296#define USB_HID_COUNTRY_SLOVAKIA 0x18
297#define USB_HID_COUNTRY_SPANISH 0x19
298#define USB_HID_COUNTRY_SWEDISH 0x1A
299#define USB_HID_COUNTRY_SWISS_FRENCH 0x1B
300#define USB_HID_COUNTRY_SWISS_GERMAN 0x1C
301#define USB_HID_COUNTRY_SWITZERLAND 0x1D
302#define USB_HID_COUNTRY_TAIWAN 0x1E
303#define USB_HID_COUNTRY_TURKISH_Q 0x1F
304#define USB_HID_COUNTRY_UK 0x20
305#define USB_HID_COUNTRY_US 0x21
306#define USB_HID_COUNTRY_YUGOSLAVIA 0x22
307#define USB_HID_COUNTRY_TURKISH_F 0x23
308
309//*****************************************************************************
310//
311// Data flags used in Input item tags within report descriptors.
312//
313//*****************************************************************************
314#define USB_HID_INPUT_DATA 0x0000
315#define USB_HID_INPUT_CONSTANT 0x0001
316#define USB_HID_INPUT_ARRAY 0x0000
317#define USB_HID_INPUT_VARIABLE 0x0002
318#define USB_HID_INPUT_ABS 0x0000
319#define USB_HID_INPUT_RELATIVE 0x0004
320#define USB_HID_INPUT_NOWRAP 0x0000
321#define USB_HID_INPUT_WRAP 0x0008
322#define USB_HID_INPUT_LINEAR 0x0000
323#define USB_HID_INPUT_NONLINEAR 0x0010
324#define USB_HID_INPUT_PREFER 0x0000
325#define USB_HID_INPUT_NONPREFER 0x0020
326#define USB_HID_INPUT_NONULL 0x0000
327#define USB_HID_INPUT_NULL 0x0040
328#define USB_HID_INPUT_BITF 0x0100
329#define USB_HID_INPUT_BYTES 0x0000
330
331//*****************************************************************************
332//
333// Data flags used in Feature item tags within report descriptors.
334//
335//*****************************************************************************
336#define USB_HID_FEATURE_DATA 0x0000
337#define USB_HID_FEATURE_CONSTANT 0x0001
338#define USB_HID_FEATURE_ARRAY 0x0000
339#define USB_HID_FEATURE_VARIABLE 0x0002
340#define USB_HID_FEATURE_ABS 0x0000
341#define USB_HID_FEATURE_RELATIVE 0x0004
342#define USB_HID_FEATURE_NOWRAP 0x0000
343#define USB_HID_FEATURE_WRAP 0x0008
344#define USB_HID_FEATURE_LINEAR 0x0000
345#define USB_HID_FEATURE_NONLINEAR 0x0010
346#define USB_HID_FEATURE_PREFER 0x0000
347#define USB_HID_FEATURE_NONPREFER 0x0020
348#define USB_HID_FEATURE_NONULL 0x0000
349#define USB_HID_FEATURE_NULL 0x0040
350#define USB_HID_FEATURE_BITF 0x0100
351#define USB_HID_FEATURE_BYTES 0x0000
352
353//*****************************************************************************
354//
355// Data flags used in Output item tags within report descriptors.
356//
357//*****************************************************************************
358#define USB_HID_OUTPUT_DATA 0x0000
359#define USB_HID_OUTPUT_CONSTANT 0x0001
360#define USB_HID_OUTPUT_ARRAY 0x0000
361#define USB_HID_OUTPUT_VARIABLE 0x0002
362#define USB_HID_OUTPUT_ABS 0x0000
363#define USB_HID_OUTPUT_RELATIVE 0x0004
364#define USB_HID_OUTPUT_NOWRAP 0x0000
365#define USB_HID_OUTPUT_WRAP 0x0008
366#define USB_HID_OUTPUT_LINEAR 0x0000
367#define USB_HID_OUTPUT_NONLINEAR 0x0010
368#define USB_HID_OUTPUT_PREFER 0x0000
369#define USB_HID_OUTPUT_NONPREFER 0x0020
370#define USB_HID_OUTPUT_NONULL 0x0000
371#define USB_HID_OUTPUT_NULL 0x0040
372#define USB_HID_OUTPUT_BITF 0x0100
373#define USB_HID_OUTPUT_BYTES 0x0000
374
375//*****************************************************************************
376//
377// Physical descriptor bias values.
378//
379//*****************************************************************************
380#define USB_HID_BIAS_NOT_APPLICABLE 0x00
381#define USB_HID_BIAS_RIGHT_HAND 0x01
382#define USB_HID_BIAS_LEFT_HAND 0x02
383#define USB_HID_BIAS_BOTH_HANDS 0x03
384#define USB_HID_BIAS_EITHER_HAND 0x04
385
386//*****************************************************************************
387//
388// Physical descriptor designator values.
389//
390//*****************************************************************************
391#define USB_HID_DESIGNATOR_NONE 0x00
392#define USB_HID_DESIGNATOR_HAND 0x01
393#define USB_HID_DESIGNATOR_EYEBALL 0x02
394#define USB_HID_DESIGNATOR_EYEBROW 0x03
395#define USB_HID_DESIGNATOR_EYELID 0x04
396#define USB_HID_DESIGNATOR_EAR 0x05
397#define USB_HID_DESIGNATOR_NOSE 0x06
398#define USB_HID_DESIGNATOR_MOUTH 0x07
399#define USB_HID_DESIGNATOR_UPPER_LIP 0x08
400#define USB_HID_DESIGNATOR_LOWER_LIP 0x09
401#define USB_HID_DESIGNATOR_JAW 0x0A
402#define USB_HID_DESIGNATOR_NECK 0x0B
403#define USB_HID_DESIGNATOR_UPPER_ARM 0x0C
404#define USB_HID_DESIGNATOR_ELBOW 0x0D
405#define USB_HID_DESIGNATOR_FOREARM 0x0E
406#define USB_HID_DESIGNATOR_WRIST 0x0F
407#define USB_HID_DESIGNATOR_PALM 0x10
408#define USB_HID_DESIGNATOR_THUMB 0x11
409#define USB_HID_DESIGNATOR_INDEX_FINGER 0x12
410#define USB_HID_DESIGNATOR_MIDDLE_FINGER 0x13
411#define USB_HID_DESIGNATOR_RING_FINGER 0x14
412#define USB_HID_DESIGNATOR_LITTLE_FINGER 0x15
413#define USB_HID_DESIGNATOR_HEAD 0x16
414#define USB_HID_DESIGNATOR_SHOULDER 0x17
415#define USB_HID_DESIGNATOR_HIP 0x18
416#define USB_HID_DESIGNATOR_WAIST 0x19
417#define USB_HID_DESIGNATOR_THIGH 0x1A
418#define USB_HID_DESIGNATOR_KNEE 0x1B
419#define USB_HID_DESIGNATOR_CALF 0x1C
420#define USB_HID_DESIGNATOR_ANKLE 0x1D
421#define USB_HID_DESIGNATOR_FOOT 0x1E
422#define USB_HID_DESIGNATOR_HEEL 0x1F
423#define USB_HID_DESIGNATOR_BALL_OF_FOOT 0x20
424#define USB_HID_DESIGNATOR_BIG_TOE 0x21
425#define USB_HID_DESIGNATOR_SECOND_TOE 0x22
426#define USB_HID_DESIGNATOR_THIRD_TOE 0x23
427#define USB_HID_DESIGNATOR_FOURTH_TOE 0x24
428#define USB_HID_DESIGNATOR_LITTLE_TOE 0x25
429#define USB_HID_DESIGNATOR_BROW 0x26
430#define USB_HID_DESIGNATOR_CHEEK 0x27
431
432//*****************************************************************************
433//
434// Physical descriptor qualifier values.
435//
436//*****************************************************************************
437#define USB_HID_QUALIFIER_NOT_APPLICABLE (0x00 << 5)
438#define USB_HID_QUALIFIER_RIGHT (0x01 << 5)
439#define USB_HID_QUALIFIER_LEFT (0x02 << 5)
440#define USB_HID_QUALIFIER_BOTH (0x03 << 5)
441#define USB_HID_QUALIFIER_EITHER (0x04 << 5)
442#define USB_HID_QUALIFIER_CENTER (0x05 << 5)
443
444//*****************************************************************************
445//
446// This is the maximum value for a usage code.
447//
448//*****************************************************************************
449#define USBH_HID_MAX_USAGE 256
450#define USBH_HID_CAPS_ARRAY_SZ (USBH_HID_MAX_USAGE / sizeof(uint32_t))
451
452//*****************************************************************************
453//
454// All structures defined in this section of the header require byte packing of
455// fields.  This is usually accomplished using the PACKED macro but, for IAR
456// Embedded Workbench, this requires a pragma.
457//
458//*****************************************************************************
459#ifdef ewarm
460#pragma pack(1)
461#endif
462
463//*****************************************************************************
464//
465//! The class descriptor information structure is used to announce the presence
466//! of HID-specific class descriptors within the HID descriptor.
467//
468//*****************************************************************************
469typedef struct {
470    //
471    //! The type of HID class descriptor.  This will be \b USB_HID_DTYPE_REPORT
472    //!  or \b USB_HID_DTYPE_PHYSICAL.
473    //
474    uint8_t bDescriptorType;
475
476    //
477    //! The total length of the HID class descriptor.
478    //
479    uint16_t wDescriptorLength;
480} PACKED tHIDClassDescriptorInfo;
481
482//*****************************************************************************
483//
484//! The HID descriptor is inserted following the interface descriptor and
485//! before the endpoint descriptors for a HID class device.
486//
487//*****************************************************************************
488typedef struct {
489    //
490    //! The length of this descriptor in bytes.
491    //
492    uint8_t bLength;
493
494    //
495    //! The type of the descriptor.  For a HID descriptor, this will be
496    //! \b USB_HID_DTYPE_HID.
497    //
498    uint8_t bDescriptorType;
499
500    //
501    //! A BCD value identifying the HID Class specification release supported
502    //! by the device.  For version 1.11, for example, this value would be
503    //! 0x0111.
504    //
505    uint16_t bcdHID;
506
507    //
508    //! The country code for which this hardware is localized or 0 if no
509    //! localization has been performed.  Valid country (or language) codes are
510    //! in labels of the form \b USB_HID_COUNTRY_xxx.
511    uint8_t bCountryCode;
512
513    //
514    //! The number of class-specific descriptors that exist for this device.
515    //! This indicates the number of class descriptor information structures
516    //! that are appended to this structure and must be at least 1 (since all
517    //! HID devices must publish at least 1 report descriptor).
518    //
519    uint8_t bNumDescriptors;
520
521    //
522    //! A table announcing each of the class-specific descriptors that this
523    //! device publishes.  The actual number of entries in the array is given
524    //! by the bNumDescriptors field.
525    //
526    tHIDClassDescriptorInfo sClassDescriptor[1];
527} PACKED tHIDDescriptor;
528
529//*****************************************************************************
530//
531// Return to default packing when using the IAR Embedded Workbench compiler.
532//
533//*****************************************************************************
534#ifdef ewarm
535#pragma pack()
536#endif
537
538//*****************************************************************************
539//
540//! This structure defines the mapping of USB usage identifiers to printable
541//! characters.  The structure has three members that hold this information.
542//! The ui8BytesPerChar, indicates the number of bytes per character in
543//! the table.  The pui32CapsLock array holds a packed bit array of usage
544//! identifiers that can be modified by the Caps Lock key.  The pCharMapping
545//! array is treated as a double indexed array with two "columns".  In the case
546//! of a single byte character it is treated as pairs of 8 bit values for
547//! unshifted and shifted values.  In the case of a double byte characters it
548//! is treated as pairs of 16 bit values.
549//
550//*****************************************************************************
551typedef struct {
552    //
553    //! Number of bytes per character in the pCharMapping table of this
554    //! structure.
555    //
556    uint8_t ui8BytesPerChar;
557
558    //
559    //! This is a packed bitmasked structure with a one bit flags that
560    //! indicates if the corresponding Usage ID is affected by the Caps Lock
561    //! key.
562    //
563    uint32_t pui32CapsLock[USBH_HID_CAPS_ARRAY_SZ];
564
565    //
566    //! This is the indexed table of Usage ID to character value.  It must be
567    //! at least ui8BytesPerChar * 2 * \b USBH_HID_MAX_USAGE bytes in size as
568    //! it is treated as a double indexed array.
569    //
570    void* pvCharMapping;
571} tHIDKeyboardUsageTable;
572
573//*****************************************************************************
574//
575// The US Keyboard mapping used by USB keyboard usage ID to character mapping.
576//
577//*****************************************************************************
578extern const tHIDKeyboardUsageTable g_sUSKeyboardMap;
579
580//*****************************************************************************
581//
582// Close the Doxygen group.
583//! @}
584//
585//*****************************************************************************
586
587//*****************************************************************************
588//
589// Mark the end of the C bindings section for C++ compilers.
590//
591//*****************************************************************************
592#ifdef __cplusplus
593}
594#endif
595
596#endif // __USBHID_H__