paul@3 | 1 | /* |
paul@17 | 2 | * Input event client to access input event servers. This is a more narrow |
paul@17 | 3 | * alternative to the L4Re::Event interface. |
paul@3 | 4 | * |
paul@3 | 5 | * (c) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@3 | 6 | * |
paul@3 | 7 | * This program is free software; you can redistribute it and/or |
paul@3 | 8 | * modify it under the terms of the GNU General Public License as |
paul@3 | 9 | * published by the Free Software Foundation; either version 2 of |
paul@3 | 10 | * the License, or (at your option) any later version. |
paul@3 | 11 | * |
paul@3 | 12 | * This program is distributed in the hope that it will be useful, |
paul@3 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@3 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@3 | 15 | * GNU General Public License for more details. |
paul@3 | 16 | * |
paul@3 | 17 | * You should have received a copy of the GNU General Public License |
paul@3 | 18 | * along with this program; if not, write to the Free Software |
paul@3 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@3 | 20 | * Boston, MA 02110-1301, USA |
paul@3 | 21 | */ |
paul@3 | 22 | |
paul@3 | 23 | #include <l4/cxx/ipc_stream> |
paul@3 | 24 | #include <l4/re/env> |
paul@3 | 25 | |
paul@3 | 26 | #include "input-event-client.h" |
paul@3 | 27 | #include "input-event-ops.h" |
paul@3 | 28 | |
paul@3 | 29 | int |
paul@3 | 30 | Input_event_interface::get_buffer(L4::Cap<L4Re::Dataspace> mem) throw() |
paul@3 | 31 | { |
paul@3 | 32 | L4::Ipc::Iostream s(l4_utcb()); |
paul@3 | 33 | |
paul@15 | 34 | s << Input_event_op_get_buffer; |
paul@15 | 35 | |
paul@3 | 36 | /* Send a "receive item" for requesting a capability. */ |
paul@3 | 37 | |
paul@3 | 38 | s << L4::Ipc::Small_buf(mem); |
paul@3 | 39 | |
paul@15 | 40 | return l4_error(s.call(cap(), Input_event_proto_event)); |
paul@3 | 41 | } |
paul@3 | 42 | |
paul@3 | 43 | int |
paul@3 | 44 | Input_event_interface::bind(unsigned irqnum, L4::Cap<L4::Irq> irq) throw() |
paul@3 | 45 | { |
paul@3 | 46 | L4::Ipc::Iostream s(l4_utcb()); |
paul@3 | 47 | |
paul@15 | 48 | s << Input_event_op_bind; |
paul@3 | 49 | s << irqnum; |
paul@17 | 50 | s << irq; |
paul@3 | 51 | |
paul@15 | 52 | return l4_error(s.call(cap(), Input_event_proto_icu)); |
paul@3 | 53 | } |