L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
event_svr
1// vi:set ft=cpp: -*- Mode: C++ -*-
2/*
3 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
4 * Alexander Warg <warg@os.inf.tu-dresden.de>
5 * economic rights: Technische Universität Dresden (Germany)
6 *
7 * License: see LICENSE.spdx (in this directory or the directories above)
8 */
9
10#pragma once
11
12#include <l4/re/event_enums.h>
13#include <l4/re/event>
14#include <l4/re/util/icu_svr>
15#include <l4/cxx/minmax>
16
17#include <l4/sys/cxx/ipc_legacy>
18
19namespace L4Re { namespace Util {
20
26template< typename SVR >
27class Event_svr : public Icu_cap_array_svr<SVR>
28{
29private:
30 typedef Icu_cap_array_svr<SVR> Icu_svr;
31
32protected:
34 typename Icu_svr::Irq _irq;
35
36public:
37 Event_svr() : Icu_svr(1, &_irq) {}
38
39 L4_RPC_LEGACY_DISPATCH(L4Re::Event);
40 L4_RPC_LEGACY_USING(Icu_svr);
41
44 {
45 static_cast<SVR*>(this)->reset_event_buffer();
47 return 0;
48 }
49
50 l4_ret_t op_get_num_streams(L4Re::Event::Rights)
51 { return static_cast<SVR*>(this)->get_num_streams(); }
52
53 l4_ret_t op_get_stream_info(L4Re::Event::Rights, int idx, Event_stream_info &info)
54 { return static_cast<SVR*>(this)->get_stream_info(idx, &info); }
55
56 l4_ret_t op_get_stream_info_for_id(L4Re::Event::Rights, l4_umword_t id,
57 Event_stream_info &info)
58 { return static_cast<SVR*>(this)->get_stream_info_for_id(id, &info); }
59
60 l4_ret_t op_get_axis_info(L4Re::Event::Rights, l4_umword_t id,
61 L4::Ipc::Array_in_buf<unsigned, unsigned long> const &axes,
62 L4::Ipc::Array_ref<Event_absinfo, unsigned long> &info)
63 {
64 unsigned naxes = cxx::min<unsigned>(L4RE_ABS_MAX, axes.length);
65
66 info.length = 0;
67
68 Event_absinfo _info[L4RE_ABS_MAX];
69 int r = static_cast<SVR*>(this)->get_axis_info(id, naxes, axes.data, _info);
70 if (r < 0)
71 return r;
72
73 for (unsigned i = 0; i < naxes; ++i)
74 info.data[i] = _info[i];
75
76 info.length = naxes;
77 return r;
78 }
79
80 l4_ret_t op_get_stream_state_for_id(L4Re::Event::Rights, l4_umword_t stream_id,
81 Event_stream_state &state)
82 { return static_cast<SVR*>(this)->get_stream_state_for_id(stream_id, &state); }
83
84 int get_num_streams() const { return 0; }
85 int get_stream_info(int, L4Re::Event_stream_info *)
86 { return -L4_EINVAL; }
87 int get_stream_info_for_id(l4_umword_t, L4Re::Event_stream_info *)
88 { return -L4_EINVAL; }
89 int get_axis_info(l4_umword_t, unsigned /*naxes*/, unsigned const * /*axes*/,
90 L4Re::Event_absinfo *)
91 { return -L4_EINVAL; }
92 int get_stream_state_for_id(l4_umword_t, L4Re::Event_stream_state *)
93 { return -L4_EINVAL; }
94};
95
96}}
Event class.
Definition event:139
l4_ret_t op_get_buffer(L4Re::Event::Rights, L4::Ipc::Cap< L4Re::Dataspace > &ds)
Handle L4Re::Event protocol.
Definition event_svr:43
C++ interface for capabilities.
Definition capability.h:249
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:725
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
@ L4_EINVAL
Invalid argument.
Definition err.h:47
@ L4_CAP_FPAGE_RW
Read and interface specific 'W' right for capability flexpages.
Definition __l4_fpage.h:192
l4_int16_t l4_ret_t
Return value of an IPC call as well as an RPC call.
Definition types.h:29
Documentation of the L4 Runtime Environment utility functionality in C++.
Definition l4re.dox:21
L4Re C++ Interfaces.
Definition cmd_control:14
LEN_TYPE length
The length of the array.
Definition ipc_array:134
ELEM_TYPE data[MAX]
The data elements.
Definition ipc_array:132