L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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/event-sys.h>
15#include <l4/re/util/icu_svr>
16#include <l4/cxx/minmax>
17
18#include <l4/sys/cxx/ipc_legacy>
19
20namespace L4Re { namespace Util {
21
27template< typename SVR >
28class Event_svr : public Icu_cap_array_svr<SVR>
29{
30private:
31 typedef Icu_cap_array_svr<SVR> Icu_svr;
32
33protected:
35 typename Icu_svr::Irq _irq;
36
37public:
38 Event_svr() : Icu_svr(1, &_irq) {}
39
40 L4_RPC_LEGACY_DISPATCH(L4Re::Event);
41 L4_RPC_LEGACY_USING(Icu_svr);
42
44 long op_get_buffer(L4Re::Event::Rights, L4::Ipc::Cap<L4Re::Dataspace> &ds)
45 {
46 static_cast<SVR*>(this)->reset_event_buffer();
48 return 0;
49 }
50
51 long op_get_num_streams(L4Re::Event::Rights)
52 { return static_cast<SVR*>(this)->get_num_streams(); }
53
54 long op_get_stream_info(L4Re::Event::Rights, int idx, Event_stream_info &info)
55 { return static_cast<SVR*>(this)->get_stream_info(idx, &info); }
56
57 long op_get_stream_info_for_id(L4Re::Event::Rights, l4_umword_t id,
58 Event_stream_info &info)
59 { return static_cast<SVR*>(this)->get_stream_info_for_id(id, &info); }
60
61 long op_get_axis_info(L4Re::Event::Rights, l4_umword_t id,
64 {
65 unsigned naxes = cxx::min<unsigned>(L4RE_ABS_MAX, axes.length);
66
67 info.length = 0;
68
69 Event_absinfo _info[L4RE_ABS_MAX];
70 int r = static_cast<SVR*>(this)->get_axis_info(id, naxes, axes.data, _info);
71 if (r < 0)
72 return r;
73
74 for (unsigned i = 0; i < naxes; ++i)
75 info.data[i] = _info[i];
76
77 info.length = naxes;
78 return r;
79 }
80
81 long op_get_stream_state_for_id(L4Re::Event::Rights, l4_umword_t stream_id,
82 Event_stream_state &state)
83 { return static_cast<SVR*>(this)->get_stream_state_for_id(stream_id, &state); }
84
85 int get_num_streams() const { return 0; }
86 int get_stream_info(int, L4Re::Event_stream_info *)
87 { return -L4_EINVAL; }
88 int get_stream_info_for_id(l4_umword_t, L4Re::Event_stream_info *)
89 { return -L4_EINVAL; }
90 int get_axis_info(l4_umword_t, unsigned /*naxes*/, unsigned const * /*axes*/,
91 L4Re::Event_absinfo *)
92 { return -L4_EINVAL; }
93 int get_stream_state_for_id(l4_umword_t, L4Re::Event_stream_state *)
94 { return -L4_EINVAL; }
95};
96
97}}
Event class.
Definition event:139
Convenience wrapper for implementing an event server.
Definition event_svr:29
long op_get_buffer(L4Re::Event::Rights, L4::Ipc::Cap< L4Re::Dataspace > &ds)
Handle L4Re::Event protocol.
Definition event_svr:44
C++ interface for capabilities.
Definition capability.h:219
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:699
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
@ L4_EINVAL
Invalid argument.
Definition err.h:46
@ L4_CAP_FPAGE_RW
Read and interface specific 'W' right for capability flexpages.
Definition __l4_fpage.h:192
L4Re C++ Interfaces.
Definition cmd_control:14
Server-side copy in buffer for Array.
Definition ipc_array:127
LEN_TYPE length
The length of the array.
Definition ipc_array:134
ELEM_TYPE data[MAX]
The data elements.
Definition ipc_array:132
Array reference data type for arrays located in the message.
Definition ipc_array:29