1.1 --- a/pkg/devices/display/src/letux400/display-letux400.cc Sat Jun 10 23:59:44 2023 +0200
1.2 +++ b/pkg/devices/display/src/letux400/display-letux400.cc Sun Jun 11 15:42:11 2023 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Export Letux 400 display operations as a server.
1.6 *
1.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2018, 2020, 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 @@ -25,9 +25,12 @@
1.13 #include <l4/re/env.h>
1.14
1.15 #include <ipc/server.h>
1.16 +
1.17 #include "activation_client.h"
1.18 #include "activation_server.h"
1.19
1.20 +
1.21 +
1.22 /* Virtual address for the GPIO register block. */
1.23
1.24 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0;
1.25 @@ -66,7 +69,7 @@
1.26
1.27 /* Display device only implementing the activation interface. */
1.28
1.29 -class server_DisplayObject : public Activation
1.30 +class DisplayObject_server : public Activation
1.31 {
1.32 Pin_slice lcd_mask1 = {.offset=0, .mask=Jz4730_lcd_gpio_func1};
1.33 Pin_slice lcd_mask2 = {.offset=0, .mask=Jz4730_lcd_gpio_func2};
1.34 @@ -74,7 +77,7 @@
1.35 Activation *_backlight;
1.36
1.37 public:
1.38 - explicit server_DisplayObject(Activation *backlight)
1.39 + explicit DisplayObject_server(Activation *backlight)
1.40 : _backlight(backlight)
1.41 {
1.42 /* Set functions for the LCD pins. */
1.43 @@ -111,7 +114,8 @@
1.44
1.45 int main(void)
1.46 {
1.47 - if (setup_memory()) return 1;
1.48 + if (setup_memory())
1.49 + return 1;
1.50
1.51 /* Initialise the GPIO abstractions. */
1.52
1.53 @@ -124,7 +128,9 @@
1.54 /* Obtain a reference to the backlight device. */
1.55
1.56 l4_cap_idx_t backlight = l4re_env_get_cap("backlight");
1.57 - if (!l4_is_valid_cap(backlight)) return 1;
1.58 +
1.59 + if (!l4_is_valid_cap(backlight))
1.60 + return 1;
1.61
1.62 /* Use the activation interface with the backlight. */
1.63
1.64 @@ -132,14 +138,12 @@
1.65
1.66 /* Initialise and register a new server object. */
1.67
1.68 - server_DisplayObject obj(&backlight_obj);
1.69 - l4_cap_idx_t server;
1.70 -
1.71 - if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1;
1.72 + DisplayObject_server obj(&backlight_obj);
1.73
1.74 /* Enter the IPC server loop. */
1.75
1.76 - ipc_server_loop(Activation_expected_items, &obj,
1.77 - (ipc_server_handler_type) handle_Activation);
1.78 + if (ipc_server_loop_for(Activation, &obj, "display"))
1.79 + return 1;
1.80 +
1.81 return 0;
1.82 }