1 /**
2  * \file
3  * \brief   Events
4  */
5 /*
6  * (c) 2009 Alexander Warg <warg@os.inf.tu-dresden.de>
7  *     economic rights: Technische Universität Dresden (Germany)
8  *
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU General Public License 2.
11  * Please see the COPYING-GPL-2 file for details.
12  *
13  * As a special exception, you may use this file as part of a free software
14  * library without restriction.  Specifically, if other files instantiate
15  * templates or use macros or inline functions from this file, or you compile
16  * this file and link it with other files to produce an executable, this
17  * file does not by itself cause the resulting executable to be covered by
18  * the GNU General Public License.  This exception does not however
19  * invalidate any other reasons why the executable file might be covered by
20  * the GNU General Public License.
21  */
22 #pragma once
23 
24 #include <l4/sys/compiler.h>
25 #include <l4/sys/l4int.h>
26 
27 typedef struct L4_EXPORT_TYPE l4re_event_stream_id_t
28 {
29   l4_uint16_t bustype;
30   l4_uint16_t vendor;
31   l4_uint16_t product;
32   l4_uint16_t version;
33 } l4re_event_stream_id_t;
34 
35 typedef struct L4_EXPORT_TYPE l4re_event_absinfo_t
36 {
37   l4_int32_t value;
38   l4_int32_t min;
39   l4_int32_t max;
40   l4_int32_t fuzz;
41   l4_int32_t flat;
42   l4_int32_t resolution;
43 } l4re_event_absinfo_t;
44 
45 enum l4re_event_stream_max_values_t
46 {
47   L4RE_EVENT_EV_MAX  = 0x1f,
48   L4RE_EVENT_KEY_MAX = 0x1ff,
49   L4RE_EVENT_REL_MAX = 0xf,
50   L4RE_EVENT_ABS_MAX = 0x3f,
51   L4RE_EVENT_PROP_MAX = 0x1f,
52   L4RE_EVENT_SW_MAX   = 0xf, // should be >= L4RE_SW_MAX
53 };
54 
55 enum l4re_event_stream_props_t
56 {
57   L4RE_EVENT_STREAM_CALIBRATE = 0x001,
58 };
59 
60 
61 #define __UNUM_B(x) ((x+1) + sizeof(unsigned long)*8 - 1) / (sizeof(unsigned long)*8)
62 
63 typedef struct L4_EXPORT_TYPE l4re_event_stream_info_t
64 {
65   l4_umword_t stream_id;
66   char name[32];
67   char phys[32];
68   l4re_event_stream_id_t id;
69 
70   unsigned long propbits[__UNUM_B(L4RE_EVENT_PROP_MAX)];
71 
72   unsigned long evbits[__UNUM_B(L4RE_EVENT_EV_MAX)];
73   unsigned long keybits[__UNUM_B(L4RE_EVENT_KEY_MAX)];
74   unsigned long relbits[__UNUM_B(L4RE_EVENT_REL_MAX)];
75   unsigned long absbits[__UNUM_B(L4RE_EVENT_ABS_MAX)];
76   unsigned long swbits[__UNUM_B(L4RE_EVENT_SW_MAX)];
77 
78 } l4re_event_stream_info_t;
79 
80 typedef struct L4_EXPORT_TYPE l4re_event_stream_state_t
81 {
82   unsigned long keybits[__UNUM_B(L4RE_EVENT_KEY_MAX)];
83   unsigned long swbits[__UNUM_B(L4RE_EVENT_SW_MAX)];
84 } l4re_event_stream_state_t;
85 
86 #undef __UNUM_B
87 
88