summaryrefslogtreecommitdiff
path: root/usb/common/hid/HIDReport.h
blob: ec02dedcb4b7bc171679b8888d53c350f56c2864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

/**
 \unit

 !!!Purpose

 Definitions used when declaring an HID report descriptor.

 !!!Usage

 Use the definitions provided here when declaring a report descriptor,
 which shall be an unsigned char array.
*/

#ifndef HIDREPORT_H
#define HIDREPORT_H

//------------------------------------------------------------------------------
//         Definitions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// \page "HID Main Item Tags"
/// This page lists the Main Item Tags defined for HID %device.
/// ( HID Spec. 6.2.2 )
///
/// !Tags
/// - HIDReport_INPUT
/// - HIDReport_OUPUT
/// - HIDReport_FEATURE
/// - HIDReport_COLLECTION
/// - HIDReport_ENDCOLLECTION

/// Input item.
#define HIDReport_INPUT                         0x80
/// Output item.
#define HIDReport_OUTPUT                        0x90
/// Feature item.
#define HIDReport_FEATURE                       0xB0
/// Collection item.
#define HIDReport_COLLECTION                    0xA0
/// End of collection item.
#define HIDReport_ENDCOLLECTION                 0xC0
//------------------------------------------------------------------------------
                                                
//------------------------------------------------------------------------------
/// \page "HID Items for Data Fields"
/// This page lists defintions for HID Input, Output and Feature items that
/// are used to create the data fields within a report.
/// ( HID Spec. 6.2.2.5 )
///
/// !Items
/// - HIDReport_CONSTANT
/// - HIDReport_VARIABLE
/// - HIDReport_RELATIVE
/// - HIDReport_WRAP
/// - HIDReport_NONLINEAR
/// - HIDReport_NOPREFERRED
/// - HIDReport_NULLSTATE
/// - HIDReport_VOLATILE
/// - HIDReport_BUFFEREDBYTES

/// The report value is constant (vs. variable).
#define HIDReport_CONSTANT                      (1 << 0)
/// Data reported is a variable (vs. array).
#define HIDReport_VARIABLE                      (1 << 1)
/// Data is relative (vs. absolute).
#define HIDReport_RELATIVE                      (1 << 2)
/// Value rolls over when it reach a maximum/minimum.
#define HIDReport_WRAP                          (1 << 3)
/// Indicates that the data reported has been processed and is no longuer
/// linear with the original measurements.
#define HIDReport_NONLINEAR                     (1 << 4)
/// Device has no preferred state to which it automatically returns.
#define HIDReport_NOPREFERRED                   (1 << 5)
/// Device has a null state, in which it does not report meaningful
/// information.
#define HIDReport_NULLSTATE                     (1 << 6)
/// Indicates data can change without the host intervention.
#define HIDReport_VOLATILE                      (1 << 7)
/// Indicates the device produces a fixed-length stream of bytes.
#define HIDReport_BUFFEREDBYTES                 (1 << 8)
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// \page "HID Collection Items"
/// This page lists definitions for HID Collection Items.
/// ( HID Spec. 6.2.2.6 )
///
/// !Items
/// - HIDReport_COLLECTION_PHYSICAL
/// - HIDReport_COLLECTION_APPLICATION
/// - HIDReport_COLLECTION_LOGICAL
/// - HIDReport_COLLECTION_REPORT
/// - HIDReport_COLLECTION_NAMEDARRAY
/// - HIDReport_COLLECTION_USAGESWITCH
/// - HIDReport_COLLECTION_USAGEMODIFIER

/// Physical collection.
#define HIDReport_COLLECTION_PHYSICAL           0x00
/// Application collection.
#define HIDReport_COLLECTION_APPLICATION        0x01
/// Logical collection.
#define HIDReport_COLLECTION_LOGICAL            0x02
/// Report collection.
#define HIDReport_COLLECTION_REPORT             0x03
/// Named array collection.
#define HIDReport_COLLECTION_NAMEDARRAY         0x04
/// Usage switch collection.
#define HIDReport_COLLECTION_USAGESWITCH        0x05
/// Usage modifier collection
#define HIDReport_COLLECTION_USAGEMODIFIER      0x06
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// \page "HID Global Items"
/// This page lists HID Global Items.
/// ( HID Spec. 6.2.2.7 )
///
/// !Items
/// - HIDReport_GLOBAL_USAGEPAGE
/// - HIDReport_GLOBAL_LOGICALMINIMUM
/// - HIDReport_GLOBAL_LOGICALMAXIMUM
/// - HIDReport_GLOBAL_PHYSICALMINIMUM
/// - HIDReport_GLOBAL_PHYSICALMAXIMUM
/// - HIDReport_GLOBAL_UNITEXPONENT
/// - HIDReport_GLOBAL_UNIT
/// - HIDReport_GLOBAL_REPORTSIZE
/// - HIDReport_GLOBAL_REPORTID
/// - HIDReport_GLOBAL_REPORTCOUNT
/// - HIDReport_GLOBAL_PUSH
/// - HIDReport_GLOBAL_POP

/// Current usage page.
#define HIDReport_GLOBAL_USAGEPAGE              0x04
/// Minimum value that a variable or array item will report.
#define HIDReport_GLOBAL_LOGICALMINIMUM         0x14
/// Maximum value that a variable or array item will report.
#define HIDReport_GLOBAL_LOGICALMAXIMUM         0x24
/// Minimum value for the physical extent of a variable item.
#define HIDReport_GLOBAL_PHYSICALMINIMUM        0x34
/// Maximum value for the physical extent of a variable item.
#define HIDReport_GLOBAL_PHYSICALMAXIMUM        0x44
/// Value of the unit exponent in base 10.
#define HIDReport_GLOBAL_UNITEXPONENT           0x54
/// Unit values.
#define HIDReport_GLOBAL_UNIT                   0x64
/// Size of the report fields in bits.
#define HIDReport_GLOBAL_REPORTSIZE             0x74
/// Specifies the report ID.
#define HIDReport_GLOBAL_REPORTID               0x84
/// Number of data fields for an item.
#define HIDReport_GLOBAL_REPORTCOUNT            0x94
/// Places a copy of the global item state table on the stack.
#define HIDReport_GLOBAL_PUSH                   0xA4
/// Replaces the item state table with the top structure from the stack.
#define HIDReport_GLOBAL_POP                    0xB4
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// \page "HID Local Items"
/// This page lists definitions for HID Local Items.
///
/// !Items
/// - HIDReport_LOCAL_USAGE
/// - HIDReport_LOCAL_USAGEMINIMUM
/// - HIDReport_LOCAL_USAGEMAXIMUM
/// - HIDReport_LOCAL_DESIGNATORINDEX
/// - HIDReport_LOCAL_DESIGNATORMINIMUM
/// - HIDReport_LOCAL_DESIGNATORMAXIMUM
/// - HIDReport_LOCAL_STRINGINDEX
/// - HIDReport_LOCAL_STRINGMINIMUM
/// - HIDReport_LOCAL_STRINGMAXIMUM
/// - HIDReport_LOCAL_DELIMITER

/// Suggested usage for an item or collection.
#define HIDReport_LOCAL_USAGE                   0x08
/// Defines the starting usage associated with an array or bitmap.
#define HIDReport_LOCAL_USAGEMINIMUM            0x18
/// Defines the ending usage associated with an array or bitmap.
#define HIDReport_LOCAL_USAGEMAXIMUM            0x28
/// Determines the body part used for a control.
#define HIDReport_LOCAL_DESIGNATORINDEX         0x38
/// Defines the index of the starting designator associated with an array or
/// bitmap.
#define HIDReport_LOCAL_DESIGNATORMINIMUM       0x48
/// Defines the index of the ending designator associated with an array or
/// bitmap.
#define HIDReport_LOCAL_DESIGNATORMAXIMUM       0x58
/// String index for a string descriptor.
#define HIDReport_LOCAL_STRINGINDEX             0x78
/// Specifies the first string index when assigning a group of sequential
/// strings to controls in an array or bitmap.
#define HIDReport_LOCAL_STRINGMINIMUM           0x88
/// Specifies the last string index when assigning a group of sequential
/// strings to controls in an array or bitmap.
#define HIDReport_LOCAL_STRINGMAXIMUM           0x98
/// Defines the beginning or end of a set of local items.
#define HIDReport_LOCAL_DELIMITER               0xA8
//------------------------------------------------------------------------------

#endif //#ifndef HIDREPORT_H

personal git repositories of Harald Welte. Your mileage may vary