1 /* 2 * Input event loop functionality. 3 * 4 * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #ifdef __cplusplus 25 26 #include <l4/devices/event-loop.h> 27 28 #include <l4/re/event> 29 #include <l4/sys/capability> 30 #include <l4/sys/icu> 31 32 /* Input event loop abstraction. */ 33 34 class Input_event_loop : public Event_handler_loop<L4Re::Event_buffer::Event> 35 { 36 /* Event buffer and notification interrupt capability. */ 37 38 L4Re::Event_buffer _event_buffer; 39 40 /* Notification interrupt capability. */ 41 42 L4::Cap<L4::Irq> _irq; 43 44 public: 45 /* Initialise the event loop with an event buffer, a notification interrupt, 46 and a thread priority. */ 47 48 explicit Input_event_loop(L4Re::Event_buffer event_buffer, 49 L4::Cap<L4::Irq> irq, 50 int priority=0x20) 51 : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(irq) 52 { 53 } 54 55 /* Event handler method, dispatching to the provided handler. */ 56 57 virtual void handle(); 58 59 /* Start the loop, dispatching to the handle method. */ 60 61 virtual void start(l4_umword_t label=0xDF00); 62 }; 63 64 #endif