Landfall

pkg/devices/input/include/input-event-loop.h

263:18edc9c73263
8 months ago Paul Boddie Exposed the card registry and added support for inspecting partition tables. cpm-library-improvements
     1 /*     2  * Input event loop functionality.     3  *     4  * Copyright (C) 2018, 2023 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     30 /* Input event loop abstraction. */    31     32 class Input_event_loop : public Event_handler_loop<L4Re::Event_buffer::Event>    33 {    34   /* Event buffer and notification interrupt capability. */    35     36   L4Re::Event_buffer _event_buffer;    37     38   /* Notification interrupt capability. */    39     40   l4_cap_idx_t _irq;    41     42 public:    43   /* Initialise the event loop with an event buffer, a notification interrupt,    44      and a thread priority. */    45     46   explicit Input_event_loop(L4Re::Event_buffer event_buffer,    47                             l4_cap_idx_t irq,    48                             int priority=0x20)    49   : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(irq)    50   {    51   }    52     53   /* Event handler method, dispatching to the provided handler. */    54     55   virtual void handle();    56     57   /* Start the loop, dispatching to the handle method. */    58     59   virtual void start(l4_umword_t label=0xDF00);    60 };    61     62 #endif