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