# HG changeset patch # User Paul Boddie # Date 1687186547 -7200 # Node ID 3e41a1f2ddaad9dc1dea25f2cd2edf75887d0107 # Parent f1ed3ebe0ddd5d26fdcfbfacaff47f5ca43d3663 Tidied up and migrated away from the L4Re C++ types where appropriate. diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/include/input-event-loop.h --- a/pkg/devices/input/include/input-event-loop.h Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/include/input-event-loop.h Mon Jun 19 16:55:47 2023 +0200 @@ -1,7 +1,7 @@ /* * Input event loop functionality. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,8 +26,6 @@ #include #include -#include -#include /* Input event loop abstraction. */ @@ -39,26 +37,19 @@ /* Notification interrupt capability. */ - L4::Cap _irq; + l4_cap_idx_t _irq; public: /* Initialise the event loop with an event buffer, a notification interrupt, and a thread priority. */ explicit Input_event_loop(L4Re::Event_buffer event_buffer, - L4::Cap irq, + l4_cap_idx_t irq, int priority=0x20) : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(irq) { } - explicit Input_event_loop(L4Re::Event_buffer event_buffer, - l4_cap_idx_t irq, - int priority=0x20) - : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(L4::Cap(irq)) - { - } - /* Event handler method, dispatching to the provided handler. */ virtual void handle(); diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/include/input-keypad-client.h --- a/pkg/devices/input/include/input-keypad-client.h Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/include/input-keypad-client.h Mon Jun 19 16:55:47 2023 +0200 @@ -54,8 +54,8 @@ { /* Memory and keypad access capabilities. */ - l4re_ds_t _mem; - l4_cap_idx_t _keypad_cap; + l4re_ds_t _mem = L4_INVALID_CAP; + l4_cap_idx_t _keypad_cap = L4_INVALID_CAP; /* Keypad layout details. */ @@ -76,7 +76,6 @@ /* Initialisation functions. */ - void init_memory(); void init_keypad(); void init_keypad_data(); void release_keypad_data(); @@ -89,7 +88,6 @@ public: explicit Input_keypad_client(Keypad_generic *keypad) : _keypad(keypad) { - init_memory(); init_keypad(); init_keypad_data(); } diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/Makefile --- a/pkg/devices/input/src/Makefile Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/Makefile Mon Jun 19 16:55:47 2023 +0200 @@ -5,5 +5,4 @@ include $(L4DIR)/mk/subdir.mk -keypad: event_loop server: keypad diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/event_loop/Makefile --- a/pkg/devices/input/src/event_loop/Makefile Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/event_loop/Makefile Mon Jun 19 16:55:47 2023 +0200 @@ -8,6 +8,6 @@ PRIVATE_INCDIR = $(PKGDIR)/input/include -REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-util +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-util libipc include $(L4DIR)/mk/lib.mk diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/event_loop/input-event-loop.cc --- a/pkg/devices/input/src/event_loop/input-event-loop.cc Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/event_loop/input-event-loop.cc Mon Jun 19 16:55:47 2023 +0200 @@ -1,7 +1,7 @@ /* * Input event loop functionality. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -22,15 +22,21 @@ #include "input-event-loop.h" #include +#include + +#include + +#include + + /* Handler for incoming interrupts signalling the presence of events. */ -void -Input_event_loop::handle() +void Input_event_loop::handle() { Event_type *event; - if (!l4_error(_irq->receive())) + if (!l4_error(l4_irq_receive(_irq, L4_IPC_NEVER))) { while ((event = _event_buffer.next())) { @@ -42,10 +48,9 @@ /* Event loop initiation. */ -void -Input_event_loop::start(l4_umword_t label) +void Input_event_loop::start(l4_umword_t label) { Event_loop::start(); - _irq->bind_thread(Pthread::L4::cap(_pthread), label); + ipc_bind_irq(_irq, label, pthread_l4_cap(_pthread)); } diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/keypad/Makefile --- a/pkg/devices/input/src/keypad/Makefile Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/keypad/Makefile Mon Jun 19 16:55:47 2023 +0200 @@ -29,7 +29,7 @@ PRIVATE_INCDIR = $(PKGDIR)/input/include $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) -REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-input-event-loop libipc +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libipc include $(L4DIR)/mk/lib.mk include $(IDL_MK_DIR)/interface_rules.mk diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/keypad/input-keypad-client.cc --- a/pkg/devices/input/src/keypad/input-keypad-client.cc Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/keypad/input-keypad-client.cc Mon Jun 19 16:55:47 2023 +0200 @@ -39,13 +39,6 @@ -/* Obtain a capability for the keypad data. */ - -void Input_keypad_client::init_memory() -{ - _mem = ipc_cap_alloc(); -} - /* Obtain a reference to the keypad. */ void Input_keypad_client::init_keypad() diff -r f1ed3ebe0ddd -r 3e41a1f2ddaa pkg/devices/input/src/server/input-keypad-server.cc --- a/pkg/devices/input/src/server/input-keypad-server.cc Mon Jun 19 16:54:57 2023 +0200 +++ b/pkg/devices/input/src/server/input-keypad-server.cc Mon Jun 19 16:55:47 2023 +0200 @@ -27,7 +27,6 @@ #include -#include #include #include "input_server.h" @@ -58,13 +57,6 @@ if (l4_is_invalid_cap(mem)) return 1; - /* Obtain a capability for the interrupt. */ - - l4_cap_idx_t irq = ipc_cap_alloc(); - - if (l4_is_invalid_cap(irq)) - return 1; - /* Event buffer for the data. */ L4Re::Event_buffer events(buffer, L4_PAGESIZE);