00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _HID_H_
00049 #define _HID_H_
00050
00051
00052
00053
00054
00055
00056
00059
00060 #define HID_DESCRIPTOR 0x21
00061 #define HID_REPORT_DESCRIPTOR 0x22
00062 #define HID_PHYSICAL_DESCRIPTOR 0x23
00064
00065
00067
00068 #define HID_BDC 0x0111
00069 #define HID_CLASS_DESC_NB_DEFAULT 0x01
00070
00071
00072
00074
00075 #define HID_COUNTRY_CODE_NOT_SUPPORTED 0
00076 #define HID_COUNTRY_CODE_ARABIC 1
00077 #define HID_COUNTRY_CODE_BELGIAN 2
00078 #define HID_COUNTRY_CODE_CANADIAN_BILINGUAL 3
00079 #define HID_COUNTRY_CODE_CANADIAN_FRENCH 4
00080 #define HID_COUNTRY_CODE_CZECH_REPUBLIC 5
00081 #define HID_COUNTRY_CODE_DANISH 6
00082 #define HID_COUNTRY_CODE_FINNISH 7
00083 #define HID_COUNTRY_CODE_FRENCH 8
00084 #define HID_COUNTRY_CODE_GERMAN 9
00085 #define HID_COUNTRY_CODE_GREEK 10
00086 #define HID_COUNTRY_CODE_HEBREW 11
00087 #define HID_COUNTRY_CODE_HUNGARY 12
00088 #define HID_COUNTRY_CODE_INTERNATIONAL_ISO 13
00089 #define HID_COUNTRY_CODE_ITALIAN 14
00090 #define HID_COUNTRY_CODE_JAPAN_KATAKANA 15
00091 #define HID_COUNTRY_CODE_KOREAN 16
00092 #define HID_COUNTRY_CODE_LATIN_AMERICAN 17
00093 #define HID_COUNTRY_CODE_NETHERLANDS_DUTCH 18
00094 #define HID_COUNTRY_CODE_NORWEGIAN 19
00095 #define HID_COUNTRY_CODE_PERSIAN_FARSI 20
00096 #define HID_COUNTRY_CODE_POLAND 21
00097 #define HID_COUNTRY_CODE_PORTUGUESE 22
00098 #define HID_COUNTRY_CODE_RUSSIA 23
00099 #define HID_COUNTRY_CODE_SLOVAKIA 24
00100 #define HID_COUNTRY_CODE_SPANISH 25
00101 #define HID_COUNTRY_CODE_SWEDISH 26
00102 #define HID_COUNTRY_CODE_SWISS_FRENCH 27
00103 #define HID_COUNTRY_CODE_SWISS_GERMAN 28
00104 #define HID_COUNTRY_CODE_SWITZERLAND 29
00105 #define HID_COUNTRY_CODE_TAIWAN 30
00106 #define HID_COUNTRY_CODE_TURKISH_Q 31
00107 #define HID_COUNTRY_CODE_UK 32
00108 #define HID_COUNTRY_CODE_US 33
00109 #define HID_COUNTRY_CODE_YUGOSLAVIA 34
00110 #define HID_COUNTRY_CODE_TURKISH_F 35
00112
00115 #define HID_A 4
00116 #define HID_B 5
00117 #define HID_C 6
00118 #define HID_D 7
00119 #define HID_E 8
00120 #define HID_F 9
00121 #define HID_G 10
00122 #define HID_H 11
00123 #define HID_I 12
00124 #define HID_J 13
00125 #define HID_K 14
00126 #define HID_L 15
00127 #define HID_M 16
00128 #define HID_N 17
00129 #define HID_O 18
00130 #define HID_P 19
00131 #define HID_Q 20
00132 #define HID_R 21
00133 #define HID_S 22
00134 #define HID_T 23
00135 #define HID_U 24
00136 #define HID_V 25
00137 #define HID_W 26
00138 #define HID_X 27
00139 #define HID_Y 28
00140 #define HID_Z 29
00141 #define HID_1 30
00142 #define HID_2 31
00143 #define HID_3 32
00144 #define HID_4 33
00145 #define HID_5 34
00146 #define HID_6 35
00147 #define HID_7 36
00148 #define HID_8 37
00149 #define HID_9 38
00150 #define HID_0 39
00151 #define HID_ENTER 40
00152 #define HID_ESCAPE 41
00153 #define HID_BACKSPACE 42
00154 #define HID_TAB 43
00155 #define HID_SPACEBAR 44
00156 #define HID_UNDERSCORE 45
00157 #define HID_PLUS 46
00158
00159
00160
00161
00162 #define HID_BACKSLASH 49
00163
00164
00165
00166
00167
00168 #define HID_TILDE 53
00169 #define HID_COMMA 54
00170 #define HID_DOT 55
00171 #define HID_SLASH 56
00172 #define HID_CAPS LOCK 57
00173 #define HID_F1 58
00174 #define HID_F2 59
00175 #define HID_F3 60
00176 #define HID_F4 61
00177 #define HID_F5 62
00178 #define HID_F6 63
00179 #define HID_F7 64
00180 #define HID_F8 65
00181 #define HID_F9 66
00182 #define HID_F10 67
00183 #define HID_F11 68
00184 #define HID_F12 69
00185 #define HID_PRINTSCREEN 70
00186 #define HID_SCROLL LOCK 71
00187 #define HID_PAUSE 72
00188 #define HID_INSERT 73
00189 #define HID_HOME 74
00190 #define HID_PAGEUP 75
00191 #define HID_DELETE 76
00192 #define HID_END 77
00193 #define HID_PAGEDOWN 78
00194 #define HID_RIGHT 79
00195 #define HID_LEFT 80
00196 #define HID_DOWN 81
00197 #define HID_UP 82
00198 #define HID_KEYPAD_NUM_LOCK 83
00199 #define HID_KEYPAD_DIVIDE 84
00200 #define HID_KEYPAD_AT 85
00201 #define HID_KEYPAD_MULTIPLY 85
00202 #define HID_KEYPAD_MINUS 86
00203 #define HID_KEYPAD_PLUS 87
00204 #define HID_KEYPAD_ENTER 88
00205 #define HID_KEYPAD_1 89
00206 #define HID_KEYPAD_2 90
00207 #define HID_KEYPAD_3 91
00208 #define HID_KEYPAD_4 92
00209 #define HID_KEYPAD_5 93
00210 #define HID_KEYPAD_6 94
00211 #define HID_KEYPAD_7 95
00212 #define HID_KEYPAD_8 96
00213 #define HID_KEYPAD_9 97
00214 #define HID_KEYPAD_0 98
00215
00218 #define HID_MODIFIER_NONE 0x00
00219 #define HID_MODIFIER_LEFT_CTRL 0x01
00220 #define HID_MODIFIER_LEFT_SHIFT 0x02
00221 #define HID_MODIFIER_LEFT_ALT 0x04
00222 #define HID_MODIFIER_LEFT_GUI 0x08
00223 #define HID_MODIFIER_RIGHT_CTRL 0x10
00224 #define HID_MODIFIER_RIGHT_SHIFT 0x20
00225 #define HID_MODIFIER_RIGHT_ALT 0x40
00226 #define HID_MODIFIER_RIGHT_GUI 0x80
00229
00230
00232
00233 #define HID_GET_REPORT 0x01
00234 #define HID_GET_IDLE 0x02
00235 #define HID_GET_PROTOCOL 0x03
00236 #define HID_SET_REPORT 0x09
00237 #define HID_SET_IDLE 0x0A
00238 #define HID_SET_PROTOCOL 0x0B
00240
00241
00243
00244 #define HID_REPORT_INPUT 0x01
00245 #define HID_REPORT_OUTPUT 0x02
00246 #define HID_REPORT_FEATURE 0x03
00248
00249
00251
00252 #define HID_REPORT_ID_ALL 0x00
00254
00255
00257
00258 #define HID_IDLE_DURATION_INDEFINITE 0x00
00260
00261
00263
00264 #define HID_BOOT_PROTOCOL 0x00
00265 #define HID_REPORT_PROTOCOL 0x01
00267
00268
00270
00271 #define HID_ITEM_TYPE_MAIN 0x00
00272 #define HID_ITEM_TYPE_GLOBAL 0x01
00273 #define HID_ITEM_TYPE_LOCAL 0x02
00274 #define HID_ITEM_TYPE_RESERVED 0x03
00276
00277
00279
00280 #define HID_ITEM_TAG_LONG_ITEM 0x0F
00282
00283
00285
00286 #define HID_MAIN_ITEM_TAG_INPUT 0x08
00287 #define HID_MAIN_ITEM_TAG_OUTPUT 0x09
00288 #define HID_MAIN_ITEM_TAG_FEATURE 0x0B
00289 #define HID_MAIN_ITEM_TAG_COLLECTION 0x0A
00290 #define HID_MAIN_ITEM_TAG_END_COLLECTION 0x0C
00292
00293
00295
00296 #define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0x00
00297 #define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM 0x01
00298 #define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM 0x02
00299 #define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM 0x03
00300 #define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM 0x04
00301 #define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 0x05
00302 #define HID_GLOBAL_ITEM_TAG_UNIT 0x06
00303 #define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 0x07
00304 #define HID_GLOBAL_ITEM_TAG_REPORT_ID 0x08
00305 #define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 0x09
00306 #define HID_GLOBAL_ITEM_TAG_PUSH 0x0A
00307 #define HID_GLOBAL_ITEM_TAG_POP 0x0B
00309
00310
00312
00313 #define HID_LOCAL_ITEM_TAG_USAGE 0x00
00314 #define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM 0x01
00315 #define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM 0x02
00316 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 0x03
00317 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 0x04
00318 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 0x05
00319 #define HID_LOCAL_ITEM_TAG_STRING_INDEX 0x07
00320 #define HID_LOCAL_ITEM_TAG_STRING_MINIMUM 0x08
00321 #define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM 0x09
00322 #define HID_LOCAL_ITEM_TAG_DELIMITER 0x0A
00324
00325
00326
00327
00329 typedef
00330 #if (defined __ICCAVR32__)
00331 #pragma pack(1)
00332 #endif
00333 struct
00334 #if (defined __GNUC__)
00335 __attribute__((__packed__))
00336 #endif
00337 {
00338 unsigned char bLength;
00339 unsigned char bDescriptorType;
00340 unsigned short bcdHID;
00341 unsigned char bCountryCode;
00342 unsigned char bNumDescriptors;
00343 struct
00344 #if (defined __GNUC__)
00345 __attribute__((__packed__))
00346 #endif
00347 {
00348 unsigned char bType;
00349 unsigned short wLength;
00350 } Descriptor[];
00351 }
00352 #if (defined __ICCAVR32__)
00353 #pragma pack()
00354 #endif
00355 hid_descriptor_t;
00356
00358 typedef unsigned char hid_report_id_t;
00359
00361 typedef
00362 #if (defined __ICCAVR32__)
00363 #pragma pack(1)
00364 #endif
00365 union
00366 #if (defined __GNUC__)
00367 __attribute__((__packed__))
00368 #endif
00369 {
00370 struct
00371 #if (defined __GNUC__)
00372 __attribute__((__packed__))
00373 #endif
00374 {
00375 unsigned char bTag : 4;
00376 unsigned char bType : 2;
00377 unsigned char bSize : 2;
00378 } header;
00379 struct
00380 #if (defined __GNUC__)
00381 __attribute__((__packed__))
00382 #endif
00383 {
00384 unsigned char bTag : 4;
00385 unsigned char bType : 2;
00386 unsigned char bSize : 2;
00387 unsigned char data[];
00388 } short_format;
00389 struct
00390 #if (defined __GNUC__)
00391 __attribute__((__packed__))
00392 #endif
00393 {
00394 unsigned char bTag : 4;
00395 unsigned char bType : 2;
00396 unsigned char bSize : 2;
00397 unsigned char bDataSize;
00398 unsigned char bLongItemTag;
00399 unsigned char data[];
00400 } long_format;
00401 }
00402 #if (defined __ICCAVR32__)
00403 #pragma pack()
00404 #endif
00405 hid_item_t;
00406
00408 typedef union
00409 {
00410 unsigned long value;
00411 union
00412 {
00413 struct
00414 {
00415 unsigned int : 23;
00416 unsigned int buffered_bytes : 1;
00417 unsigned int : 1;
00418 unsigned int null_state : 1;
00419 unsigned int no_preferred : 1;
00420 unsigned int non_linear : 1;
00421 unsigned int wrap : 1;
00422 unsigned int relative : 1;
00423 unsigned int variable : 1;
00424 unsigned int constant : 1;
00425 } input;
00426 struct
00427 {
00428 unsigned int : 23;
00429 unsigned int buffered_bytes : 1;
00430 unsigned int volatile_ : 1;
00431 unsigned int null_state : 1;
00432 unsigned int no_preferred : 1;
00433 unsigned int non_linear : 1;
00434 unsigned int wrap : 1;
00435 unsigned int relative : 1;
00436 unsigned int variable : 1;
00437 unsigned int constant : 1;
00438 } output;
00439 struct
00440 {
00441 unsigned int : 23;
00442 unsigned int buffered_bytes : 1;
00443 unsigned int volatile_ : 1;
00444 unsigned int null_state : 1;
00445 unsigned int no_preferred : 1;
00446 unsigned int non_linear : 1;
00447 unsigned int wrap : 1;
00448 unsigned int relative : 1;
00449 unsigned int variable : 1;
00450 unsigned int constant : 1;
00451 } feature;
00452 enum
00453 {
00454 HID_COLLECTION_PHYSICAL = 0x00,
00455 HID_COLLECTION_APPLICATION = 0x01,
00456 HID_COLLECTION_LOGICAL = 0x02,
00457 HID_COLLECTION_REPORT = 0x03,
00458 HID_COLLECTION_NAMED_ARRAY = 0x04,
00459 HID_COLLECTION_USAGE_SWITCH = 0x05,
00460 HID_COLLECTION_USAGE_MODIFIER = 0x06
00461 } collection;
00462 } main;
00463 union
00464 {
00465 unsigned int usage_page;
00466 int logical_minimum;
00467 int logical_maximum;
00468 int physical_minimum;
00469 int physical_maximum;
00470 struct
00471 {
00472 unsigned int : 28;
00473 int unit_exponent : 4;
00474 };
00475 struct
00476 {
00477 unsigned int : 4;
00478 enum
00479 {
00480 HID_UNIT_LUMINOUS_INTENSITY_NONE = 0x0,
00481 HID_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x1
00482 } luminous_intensity : 4;
00483 enum
00484 {
00485 HID_UNIT_CURRENT_NONE = 0x0,
00486 HID_UNIT_CURRENT_AMPERE = 0x1
00487 } current : 4;
00488 enum
00489 {
00490 HID_UNIT_TEMPERATURE_NONE = 0x0,
00491 HID_UNIT_TEMPERATURE_KELVIN = 0x1,
00492 HID_UNIT_TEMPERATURE_FAHRENHEIT = 0x3
00493 } temperature : 4;
00494 enum
00495 {
00496 HID_UNIT_TIME_NONE = 0x0,
00497 HID_UNIT_TIME_SECONDS = 0x1
00498 } time : 4;
00499 enum
00500 {
00501 HID_UNIT_MASS_NONE = 0x0,
00502 HID_UNIT_MASS_GRAM = 0x1,
00503 HID_UNIT_MASS_SLUG = 0x3
00504 } mass : 4;
00505 enum
00506 {
00507 HID_UNIT_LENGTH_NONE = 0x0,
00508 HID_UNIT_LENGTH_CENTIMETER = 0x1,
00509 HID_UNIT_LENGTH_RADIANS = 0x2,
00510 HID_UNIT_LENGTH_INCH = 0x3,
00511 HID_UNIT_LENGTH_DEGREES = 0x4
00512 } length : 4;
00513 enum
00514 {
00515 HID_UNIT_SYSTEM_NONE = 0x0,
00516 HID_UNIT_SYSTEM_SI_LINEAR = 0x1,
00517 HID_UNIT_SYSTEM_SI_ROTATION = 0x2,
00518 HID_UNIT_SYSTEM_ENGLISH_LINEAR = 0x3,
00519 HID_UNIT_SYSTEM_ENGLISH_ROTATION = 0x4
00520 } system : 4;
00521 } unit;
00522 unsigned int report_size;
00523 unsigned int report_id;
00524 unsigned int report_count;
00525 } global;
00526 union
00527 {
00528 unsigned int usage;
00529 unsigned int usage_minimum;
00530 unsigned int usage_maximum;
00531 unsigned int designator_index;
00532 unsigned int designator_minimum;
00533 unsigned int designator_maximum;
00534 unsigned int string_index;
00535 unsigned int string_minimum;
00536 unsigned int string_maximum;
00537 enum
00538 {
00539 HID_DELIMITER_OPEN_SET = 0x01,
00540 HID_DELIMITER_CLOSE_SET = 0x00
00541 } delimiter;
00542 } local;
00543 } hid_short_item_data_t;
00544
00545
00546
00547
00548
00549 #endif // _HID_H_