source: mainline/uspace/app/vuhid/items.h@ 3fafe5e0

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3fafe5e0 was 8d2dd7f2, checked in by Jakub Jermar <jakub@…>, 8 years ago

Reduce the number of files that include <sys/types.h>

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Copyright (c) 2010 Vojtech Horky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup usbvirtkbd
30 * @{
31 */
32/** @file
33 * @brief HID Item related functions.
34 */
35#ifndef VUK_ITEM_H_
36#define VUK_ITEM_H_
37
38#include <stdint.h>
39
40typedef uint8_t report_descriptor_data_t[];
41
42/* Item types. */
43#define ITEM_MAIN 0
44#define ITEM_GLOBAL 1
45#define ITEM_LOCAL 2
46
47
48
49/* Item tags. */
50
51/* Main item tags. */
52#define TAG_INPUT 8
53#define TAG_OUTPUT 9
54#define TAG_FEATURE 11
55#define TAG_COLLECTION 10
56#define TAG_END_COLLECTION 12
57
58/* Global item tags. */
59#define TAG_USAGE_PAGE 0
60#define TAG_LOGICAL_MINIMUM 1
61#define TAG_LOGICAL_MAXIMUM 2
62#define TAG_REPORT_SIZE 7
63#define TAG_REPORT_COUNT 9
64
65/* Local item tags. */
66#define TAG_USAGE 0
67#define TAG_USAGE_MINIMUM 1
68#define TAG_USAGE_MAXIMUM 2
69
70
71/* Bits for Input, Output and Feature items. */
72#define _IOF(value, shift) ((value) << (shift))
73#define IOF_DATA _IOF(0, 0)
74#define IOF_CONSTANT _IOF(1, 0)
75#define IOF_ARRAY _IOF(0, 1)
76#define IOF_VARIABLE _IOF(1, 1)
77#define IOF_ABSOLUTE _IOF(0, 2)
78#define IOF_RELATIVE _IOF(1, 2)
79/* ... */
80
81/* Collection types. */
82#define COLLECTION_PHYSICAL 0x00
83#define COLLECTION_APPLICATION 0x01
84
85
86/** Creates item prefix.
87 * @param size Item size.
88 * @param type Item type.
89 * @param tag Item tag.
90 */
91#define BUILD_ITEM_PREFIX(size, type, tag) \
92 ((size) | ((type) << 2) | ((tag) << 4))
93
94/** Create no-data item.
95 * @param type Item type.
96 * @param tag Item tag.
97 */
98#define ITEM_CREATE0(type, tag) \
99 BUILD_ITEM_PREFIX(0, type, tag)
100
101/** Create item with 1-byte data.
102 * @param type Item type.
103 * @param tag Item tag.
104 * @param data Item data (single byte).
105 */
106#define ITEM_CREATE1(type, tag, data) \
107 BUILD_ITEM_PREFIX(1, type, tag), data
108
109
110#endif
111/**
112 * @}
113 */
Note: See TracBrowser for help on using the repository browser.