15#include <l4/sys/cxx/ipc_array>
40typedef l4re_event_stream_id_t Event_stream_id;
41typedef l4re_event_absinfo_t Event_absinfo;
46 static unsigned __get_idx(
unsigned idx)
47 {
return idx / (
sizeof(
unsigned long)*8); }
49 static unsigned long __get_mask(
unsigned idx)
50 {
return 1ul << (idx % (
sizeof(
unsigned long)*8)); }
52 static bool __get_bit(
unsigned long const *bm,
unsigned max,
unsigned idx)
55 return bm[__get_idx(idx)] & __get_mask(idx);
59 static void __set_bit(
unsigned long *bm,
unsigned max,
unsigned idx,
bool v)
65 bm[__get_idx(idx)] |= __get_mask(idx);
67 bm[__get_idx(idx)] &= ~__get_mask(idx);
72:
public l4re_event_stream_info_t,
73 private Event_stream_bitmap_h
76 bool get_propbit(
unsigned idx)
const
77 {
return __get_bit(propbits, L4RE_EVENT_PROP_MAX, idx); }
79 void set_propbit(
unsigned idx,
bool v)
80 { __set_bit(propbits, L4RE_EVENT_PROP_MAX, idx, v); }
82 bool get_evbit(
unsigned idx)
const
83 {
return __get_bit(evbits, L4RE_EVENT_EV_MAX, idx); }
85 void set_evbit(
unsigned idx,
bool v)
86 { __set_bit(evbits, L4RE_EVENT_EV_MAX, idx, v); }
88 bool get_keybit(
unsigned idx)
const
89 {
return __get_bit(keybits, L4RE_EVENT_KEY_MAX, idx); }
91 void set_keybit(
unsigned idx,
bool v)
92 { __set_bit(keybits, L4RE_EVENT_KEY_MAX, idx, v); }
94 bool get_relbit(
unsigned idx)
const
95 {
return __get_bit(relbits, L4RE_EVENT_REL_MAX, idx); }
97 void set_relbit(
unsigned idx,
bool v)
98 { __set_bit(relbits, L4RE_EVENT_REL_MAX, idx, v); }
100 bool get_absbit(
unsigned idx)
const
101 {
return __get_bit(absbits, L4RE_EVENT_ABS_MAX, idx); }
103 void set_absbit(
unsigned idx,
bool v)
104 { __set_bit(absbits, L4RE_EVENT_ABS_MAX, idx, v); }
106 bool get_swbit(
unsigned idx)
const
107 {
return __get_bit(swbits, L4RE_EVENT_SW_MAX, idx); }
109 void set_swbit(
unsigned idx,
bool v)
110 { __set_bit(swbits, L4RE_EVENT_SW_MAX, idx, v); }
114:
public l4re_event_stream_state_t,
115 private Event_stream_bitmap_h
118 bool get_keybit(
unsigned idx)
const
119 {
return __get_bit(keybits, L4RE_EVENT_KEY_MAX, idx); }
121 void set_keybit(
unsigned idx,
bool v)
122 { __set_bit(keybits, L4RE_EVENT_KEY_MAX, idx, v); }
124 bool get_swbit(
unsigned idx)
const
125 {
return __get_bit(swbits, L4RE_EVENT_SW_MAX, idx); }
127 void set_swbit(
unsigned idx,
bool v)
128 { __set_bit(swbits, L4RE_EVENT_SW_MAX, idx, v); }
170 L4_RPC(
long, get_stream_info, (
int idx, Event_stream_info *info));
199 unsigned const *axis, Event_absinfo *info)
const noexcept
202 return get_axis_info_t::call(c(), stream_id,
216 Event_stream_state *state));
222 get_stream_info_for_id_t,
224 get_stream_state_for_id_t
245template<
typename PAYLOAD = Default_event_payload >
272 if (_current == _end)
278 Event_buffer_t() : _current(0), _begin(0), _end(0) {}
282 for (Event *i = _begin; i != _end; ++i)
294 : _current(static_cast<
Event*>(buffer)), _begin(_current),
295 _end(_begin + size / sizeof(
Event))
327 c->payload = ev.payload;
334typedef Event_buffer_t<Default_event_payload> Event_buffer;
L4::Cap related definitions.
Event_buffer_t(void *buffer, l4_addr_t size)
Initialize event buffer.
Event * next() noexcept
Next event in buffer.
bool put(Event const &ev) noexcept
Put event into buffer at current position.
long get_axis_info(l4_umword_t stream_id, unsigned naxes, unsigned const *axis, Event_absinfo *info) const noexcept
Get event stream axis infos.
C++ interface for capabilities.
Helper class to create an L4Re interface class that is derived from a single base class.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_addr_t
Address type.
void l4_wmb(void)
Write memory barrier.
void l4_mb(void)
Memory barrier.
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Interface Definition Language.
#define L4_RPC(res, name, args, attr...)
Define an RPC call (type and callable).
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Default event stream payload.
l4_umword_t stream_id
Stream ID.
unsigned short code
Code of event.
unsigned short type
Type of event.
Event structure used in buffer.
void free() noexcept
Free the entry.
long long time
Event time stamp.
Array data type for dynamically sized arrays in RPCs.
Mark an argument as a output value in an RPC signature.
Standard list of RPCs of an interface.