1.1 --- a/pkg/devices/input/include/input-event-loop.h Mon Jun 19 16:54:57 2023 +0200
1.2 +++ b/pkg/devices/input/include/input-event-loop.h Mon Jun 19 16:55:47 2023 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Input event loop functionality.
1.6 *
1.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -26,8 +26,6 @@
1.13 #include <l4/devices/event-loop.h>
1.14
1.15 #include <l4/re/event>
1.16 -#include <l4/sys/capability>
1.17 -#include <l4/sys/icu>
1.18
1.19 /* Input event loop abstraction. */
1.20
1.21 @@ -39,26 +37,19 @@
1.22
1.23 /* Notification interrupt capability. */
1.24
1.25 - L4::Cap<L4::Irq> _irq;
1.26 + l4_cap_idx_t _irq;
1.27
1.28 public:
1.29 /* Initialise the event loop with an event buffer, a notification interrupt,
1.30 and a thread priority. */
1.31
1.32 explicit Input_event_loop(L4Re::Event_buffer event_buffer,
1.33 - L4::Cap<L4::Irq> irq,
1.34 + l4_cap_idx_t irq,
1.35 int priority=0x20)
1.36 : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(irq)
1.37 {
1.38 }
1.39
1.40 - explicit Input_event_loop(L4Re::Event_buffer event_buffer,
1.41 - l4_cap_idx_t irq,
1.42 - int priority=0x20)
1.43 - : Event_handler_loop(priority), _event_buffer(event_buffer), _irq(L4::Cap<L4::Irq>(irq))
1.44 - {
1.45 - }
1.46 -
1.47 /* Event handler method, dispatching to the provided handler. */
1.48
1.49 virtual void handle();
2.1 --- a/pkg/devices/input/include/input-keypad-client.h Mon Jun 19 16:54:57 2023 +0200
2.2 +++ b/pkg/devices/input/include/input-keypad-client.h Mon Jun 19 16:55:47 2023 +0200
2.3 @@ -54,8 +54,8 @@
2.4 {
2.5 /* Memory and keypad access capabilities. */
2.6
2.7 - l4re_ds_t _mem;
2.8 - l4_cap_idx_t _keypad_cap;
2.9 + l4re_ds_t _mem = L4_INVALID_CAP;
2.10 + l4_cap_idx_t _keypad_cap = L4_INVALID_CAP;
2.11
2.12 /* Keypad layout details. */
2.13
2.14 @@ -76,7 +76,6 @@
2.15
2.16 /* Initialisation functions. */
2.17
2.18 - void init_memory();
2.19 void init_keypad();
2.20 void init_keypad_data();
2.21 void release_keypad_data();
2.22 @@ -89,7 +88,6 @@
2.23 public:
2.24 explicit Input_keypad_client(Keypad_generic *keypad) : _keypad(keypad)
2.25 {
2.26 - init_memory();
2.27 init_keypad();
2.28 init_keypad_data();
2.29 }
3.1 --- a/pkg/devices/input/src/Makefile Mon Jun 19 16:54:57 2023 +0200
3.2 +++ b/pkg/devices/input/src/Makefile Mon Jun 19 16:55:47 2023 +0200
3.3 @@ -5,5 +5,4 @@
3.4
3.5 include $(L4DIR)/mk/subdir.mk
3.6
3.7 -keypad: event_loop
3.8 server: keypad
4.1 --- a/pkg/devices/input/src/event_loop/Makefile Mon Jun 19 16:54:57 2023 +0200
4.2 +++ b/pkg/devices/input/src/event_loop/Makefile Mon Jun 19 16:55:47 2023 +0200
4.3 @@ -8,6 +8,6 @@
4.4
4.5 PRIVATE_INCDIR = $(PKGDIR)/input/include
4.6
4.7 -REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-util
4.8 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-util libipc
4.9
4.10 include $(L4DIR)/mk/lib.mk
5.1 --- a/pkg/devices/input/src/event_loop/input-event-loop.cc Mon Jun 19 16:54:57 2023 +0200
5.2 +++ b/pkg/devices/input/src/event_loop/input-event-loop.cc Mon Jun 19 16:55:47 2023 +0200
5.3 @@ -1,7 +1,7 @@
5.4 /*
5.5 * Input event loop functionality.
5.6 *
5.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
5.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk>
5.9 *
5.10 * This program is free software; you can redistribute it and/or
5.11 * modify it under the terms of the GNU General Public License as
5.12 @@ -22,15 +22,21 @@
5.13 #include "input-event-loop.h"
5.14
5.15 #include <l4/re/event>
5.16 +#include <l4/sys/irq.h>
5.17 +
5.18 +#include <pthread-l4.h>
5.19 +
5.20 +#include <ipc/irq.h>
5.21 +
5.22 +
5.23
5.24 /* Handler for incoming interrupts signalling the presence of events. */
5.25
5.26 -void
5.27 -Input_event_loop::handle()
5.28 +void Input_event_loop::handle()
5.29 {
5.30 Event_type *event;
5.31
5.32 - if (!l4_error(_irq->receive()))
5.33 + if (!l4_error(l4_irq_receive(_irq, L4_IPC_NEVER)))
5.34 {
5.35 while ((event = _event_buffer.next()))
5.36 {
5.37 @@ -42,10 +48,9 @@
5.38
5.39 /* Event loop initiation. */
5.40
5.41 -void
5.42 -Input_event_loop::start(l4_umword_t label)
5.43 +void Input_event_loop::start(l4_umword_t label)
5.44 {
5.45 Event_loop::start();
5.46
5.47 - _irq->bind_thread(Pthread::L4::cap(_pthread), label);
5.48 + ipc_bind_irq(_irq, label, pthread_l4_cap(_pthread));
5.49 }
6.1 --- a/pkg/devices/input/src/keypad/Makefile Mon Jun 19 16:54:57 2023 +0200
6.2 +++ b/pkg/devices/input/src/keypad/Makefile Mon Jun 19 16:55:47 2023 +0200
6.3 @@ -29,7 +29,7 @@
6.4
6.5 PRIVATE_INCDIR = $(PKGDIR)/input/include $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
6.6
6.7 -REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-input-event-loop libipc
6.8 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libipc
6.9
6.10 include $(L4DIR)/mk/lib.mk
6.11 include $(IDL_MK_DIR)/interface_rules.mk
7.1 --- a/pkg/devices/input/src/keypad/input-keypad-client.cc Mon Jun 19 16:54:57 2023 +0200
7.2 +++ b/pkg/devices/input/src/keypad/input-keypad-client.cc Mon Jun 19 16:55:47 2023 +0200
7.3 @@ -39,13 +39,6 @@
7.4
7.5
7.6
7.7 -/* Obtain a capability for the keypad data. */
7.8 -
7.9 -void Input_keypad_client::init_memory()
7.10 -{
7.11 - _mem = ipc_cap_alloc();
7.12 -}
7.13 -
7.14 /* Obtain a reference to the keypad. */
7.15
7.16 void Input_keypad_client::init_keypad()
8.1 --- a/pkg/devices/input/src/server/input-keypad-server.cc Mon Jun 19 16:54:57 2023 +0200
8.2 +++ b/pkg/devices/input/src/server/input-keypad-server.cc Mon Jun 19 16:55:47 2023 +0200
8.3 @@ -27,7 +27,6 @@
8.4
8.5 #include <l4/re/event>
8.6
8.7 -#include <ipc/cap_alloc.h>
8.8 #include <ipc/server.h>
8.9
8.10 #include "input_server.h"
8.11 @@ -58,13 +57,6 @@
8.12 if (l4_is_invalid_cap(mem))
8.13 return 1;
8.14
8.15 - /* Obtain a capability for the interrupt. */
8.16 -
8.17 - l4_cap_idx_t irq = ipc_cap_alloc();
8.18 -
8.19 - if (l4_is_invalid_cap(irq))
8.20 - return 1;
8.21 -
8.22 /* Event buffer for the data. */
8.23
8.24 L4Re::Event_buffer events(buffer, L4_PAGESIZE);