1.1 --- a/pkg/devices/Control Wed Dec 30 22:51:48 2020 +0100
1.2 +++ b/pkg/devices/Control Thu Dec 31 01:11:34 2020 +0100
1.3 @@ -13,7 +13,6 @@
1.4 provides: devices-keypad-qi_lb60
1.5 provides: devices-pwm-jz4730
1.6 provides: devices-spi-jz4740
1.7 -provides: libdevice-backlight-client
1.8 provides: libdevice-cpm-client
1.9 provides: libdevice-cpm-server
1.10 provides: libdevice-display-client
2.1 --- a/pkg/devices/backlight/include/Makefile Wed Dec 30 22:51:48 2020 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,4 +0,0 @@
2.4 -PKGDIR = ../..
2.5 -L4DIR ?= $(PKGDIR)/../..
2.6 -
2.7 -include $(L4DIR)/mk/include.mk
3.1 --- a/pkg/devices/backlight/include/backlight-client.h Wed Dec 30 22:51:48 2020 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,39 +0,0 @@
3.4 -/*
3.5 - * Backlight client to access backlight servers.
3.6 - *
3.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
3.8 - *
3.9 - * This program is free software; you can redistribute it and/or
3.10 - * modify it under the terms of the GNU General Public License as
3.11 - * published by the Free Software Foundation; either version 2 of
3.12 - * the License, or (at your option) any later version.
3.13 - *
3.14 - * This program is distributed in the hope that it will be useful,
3.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 - * GNU General Public License for more details.
3.18 - *
3.19 - * You should have received a copy of the GNU General Public License
3.20 - * along with this program; if not, write to the Free Software
3.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor,
3.22 - * Boston, MA 02110-1301, USA
3.23 - */
3.24 -
3.25 -#pragma once
3.26 -
3.27 -#ifdef __cplusplus
3.28 -
3.29 -#include <l4/re/env>
3.30 -#include "backlight-ops.h"
3.31 -
3.32 -class Backlight_device_interface : public L4::Kobject_t<Backlight_device_interface, L4::Kobject>
3.33 -{
3.34 - L4_KOBJECT(Backlight_device_interface)
3.35 -
3.36 -public:
3.37 - int disable() throw();
3.38 - int enable() throw();
3.39 - int set_brightness(int level) throw();
3.40 -};
3.41 -
3.42 -#endif
4.1 --- a/pkg/devices/backlight/include/backlight-ops.h Wed Dec 30 22:51:48 2020 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,24 +0,0 @@
4.4 -/*
4.5 - * Backlight server operations.
4.6 - *
4.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
4.8 - *
4.9 - * This program is free software; you can redistribute it and/or
4.10 - * modify it under the terms of the GNU General Public License as
4.11 - * published by the Free Software Foundation; either version 2 of
4.12 - * the License, or (at your option) any later version.
4.13 - *
4.14 - * This program is distributed in the hope that it will be useful,
4.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.17 - * GNU General Public License for more details.
4.18 - *
4.19 - * You should have received a copy of the GNU General Public License
4.20 - * along with this program; if not, write to the Free Software
4.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor,
4.22 - * Boston, MA 02110-1301, USA
4.23 - */
4.24 -
4.25 -#pragma once
4.26 -
4.27 -enum { Backlight_op_disable, Backlight_op_enable, Backlight_op_set_brightness };
5.1 --- a/pkg/devices/backlight/src/client/Makefile Wed Dec 30 22:51:48 2020 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,13 +0,0 @@
5.4 -PKGDIR ?= ../../..
5.5 -L4DIR ?= $(PKGDIR)/../..
5.6 -
5.7 -TARGET = libdevice_backlight_client.o.a libdevice_backlight_client.o.so
5.8 -PC_FILENAME := libdevice-backlight-client
5.9 -
5.10 -SRC_CC := backlight-client.cc
5.11 -
5.12 -PRIVATE_INCDIR += $(PKGDIR)/backlight/include
5.13 -
5.14 -REQUIRES_LIBS := l4re_c l4re_c-util
5.15 -
5.16 -include $(L4DIR)/mk/lib.mk
6.1 --- a/pkg/devices/backlight/src/client/backlight-client.cc Wed Dec 30 22:51:48 2020 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,50 +0,0 @@
6.4 -/*
6.5 - * Backlight client to access backlight servers.
6.6 - *
6.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
6.8 - *
6.9 - * This program is free software; you can redistribute it and/or
6.10 - * modify it under the terms of the GNU General Public License as
6.11 - * published by the Free Software Foundation; either version 2 of
6.12 - * the License, or (at your option) any later version.
6.13 - *
6.14 - * This program is distributed in the hope that it will be useful,
6.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.17 - * GNU General Public License for more details.
6.18 - *
6.19 - * You should have received a copy of the GNU General Public License
6.20 - * along with this program; if not, write to the Free Software
6.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor,
6.22 - * Boston, MA 02110-1301, USA
6.23 - */
6.24 -
6.25 -#include <l4/cxx/ipc_stream>
6.26 -#include <l4/re/env>
6.27 -
6.28 -#include "backlight-client.h"
6.29 -
6.30 -int
6.31 -Backlight_device_interface::disable() throw()
6.32 -{
6.33 - L4::Ipc::Iostream s(l4_utcb());
6.34 -
6.35 - return l4_error(s.call(cap(), Backlight_op_disable));
6.36 -}
6.37 -
6.38 -int
6.39 -Backlight_device_interface::enable() throw()
6.40 -{
6.41 - L4::Ipc::Iostream s(l4_utcb());
6.42 -
6.43 - return l4_error(s.call(cap(), Backlight_op_enable));
6.44 -}
6.45 -
6.46 -int
6.47 -Backlight_device_interface::set_brightness(int level) throw()
6.48 -{
6.49 - L4::Ipc::Iostream s(l4_utcb());
6.50 -
6.51 - s << level;
6.52 - return l4_error(s.call(cap(), Backlight_op_set_brightness));
6.53 -}
7.1 --- a/pkg/devices/backlight/src/pwm/Makefile Wed Dec 30 22:51:48 2020 +0100
7.2 +++ b/pkg/devices/backlight/src/pwm/Makefile Thu Dec 31 01:11:34 2020 +0100
7.3 @@ -3,12 +3,43 @@
7.4
7.5 TARGET = dev_backlight_pwm
7.6 MODE = shared
7.7 -PC_FILENAME := devices-backlight-pwm
7.8 +PC_FILENAME = devices-backlight-pwm
7.9 +
7.10 +# Locations for interface input and generated output.
7.11 +
7.12 +IDL_DIR = $(PKGDIR)/idl
7.13 +IDL_MK_DIR = $(L4DIR)/idl4re/mk
7.14 +IDL_BUILD_DIR = .
7.15 +IDL_EXPORT_DIR = .
7.16
7.17 -SRC_CC := backlight-pwm.cc
7.18 +include $(IDL_MK_DIR)/idl.mk
7.19 +
7.20 +# Compound interface definitions.
7.21 +
7.22 +backlight_object_NAME = BacklightObject
7.23 +backlight_object_INTERFACES = activation backlight
7.24 +
7.25 +COMP_INTERFACES_CC = backlight_object
7.26
7.27 -PRIVATE_INCDIR += $(PKGDIR)/backlight/include
7.28 +# Individual interfaces.
7.29 +
7.30 +SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC))
7.31 +
7.32 +# Generated and plain source files.
7.33 +
7.34 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC))
7.35
7.36 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-pwm-client
7.37 +PLAIN_SRC_CC = backlight-pwm.cc
7.38 +
7.39 +# Normal definitions.
7.40 +
7.41 +SRC_CC = $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC)
7.42 +
7.43 +REQUIRES_LIBS = l4re_c l4re_c-util libdevice-pwm-client libipc
7.44 +
7.45 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
7.46
7.47 include $(L4DIR)/mk/prog.mk
7.48 +include $(IDL_MK_DIR)/interface_rules.mk
7.49 +
7.50 +$(PLAIN_SRC_CC): $(SERVER_INTERFACES_SRC_CC)
8.1 --- a/pkg/devices/backlight/src/pwm/backlight-pwm.cc Wed Dec 30 22:51:48 2020 +0100
8.2 +++ b/pkg/devices/backlight/src/pwm/backlight-pwm.cc Thu Dec 31 01:11:34 2020 +0100
8.3 @@ -1,7 +1,7 @@
8.4 /*
8.5 * Access a PWM server to update a display panel backlight.
8.6 *
8.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
8.8 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
8.9 *
8.10 * This program is free software; you can redistribute it and/or
8.11 * modify it under the terms of the GNU General Public License as
8.12 @@ -19,15 +19,15 @@
8.13 * Boston, MA 02110-1301, USA
8.14 */
8.15
8.16 -#include <l4/cxx/ipc_server>
8.17 #include <l4/re/env>
8.18 -#include <l4/re/util/object_registry>
8.19 #include <l4/sys/capability>
8.20
8.21 #include <stdlib.h>
8.22
8.23 #include <l4/devices/pwm-client.h>
8.24 -#include "backlight-ops.h"
8.25 +
8.26 +#include <ipc/server.h>
8.27 +#include "backlight_object_server.h"
8.28
8.29 /* PWM access abstractions. */
8.30
8.31 @@ -37,66 +37,41 @@
8.32
8.33 /* Backlight device. */
8.34
8.35 -class Backlight_device_server : public L4::Server_object_t<L4::Kobject>
8.36 +class server_BacklightObject : public BacklightObject
8.37 {
8.38 int _min, _max;
8.39
8.40 public:
8.41 - explicit Backlight_device_server(int min, int max)
8.42 + explicit server_BacklightObject(int min, int max)
8.43 : _min(min), _max(max)
8.44 {
8.45 }
8.46
8.47 - /* Dispatch incoming requests. */
8.48 -
8.49 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios)
8.50 - {
8.51 - l4_msgtag_t tag;
8.52 - int arg;
8.53 -
8.54 - (void) obj;
8.55 - ios >> tag;
8.56 + /* Disable the backlight. */
8.57
8.58 - switch (tag.label())
8.59 - {
8.60 - case Backlight_op_disable:
8.61 - disable();
8.62 - return L4_EOK;
8.63 -
8.64 - case Backlight_op_enable:
8.65 - enable();
8.66 - return L4_EOK;
8.67 -
8.68 - case Backlight_op_set_brightness:
8.69 - ios >> arg;
8.70 - set_brightness(arg);
8.71 - return L4_EOK;
8.72 -
8.73 - default:
8.74 - return -L4_EBADPROTO;
8.75 - }
8.76 + long disable()
8.77 + {
8.78 + pwm_device->disable();
8.79 + return L4_EOK;
8.80 }
8.81
8.82 - void disable()
8.83 - {
8.84 - pwm_device->disable();
8.85 - }
8.86 + /* Enable the backlight. */
8.87
8.88 - void enable()
8.89 + long enable()
8.90 {
8.91 pwm_device->enable();
8.92 + return L4_EOK;
8.93 }
8.94
8.95 /* Use the PWM device to update the backlight level. */
8.96
8.97 - void set_brightness(int level)
8.98 + long set_brightness(int level)
8.99 {
8.100 pwm_device->set_duty(level);
8.101 + return L4_EOK;
8.102 }
8.103 };
8.104
8.105 -static L4Re::Util::Registry_server<> server;
8.106 -
8.107
8.108
8.109 /* Arguments: <minimum level> <maximum level> */
8.110 @@ -118,11 +93,14 @@
8.111 min = atoi(argv[1]);
8.112 max = atoi(argv[2]);
8.113
8.114 - Backlight_device_server server_obj(min, max);
8.115 - server.registry()->register_obj(&server_obj, "backlight");
8.116 + server_BacklightObject obj(min, max);
8.117 + l4_cap_idx_t server;
8.118 +
8.119 + if (ipc_server_bind("backlight", (l4_umword_t) &obj, &server)) return 1;
8.120
8.121 /* Enter the IPC server loop. */
8.122
8.123 - server.loop();
8.124 + ipc_server_loop(BacklightObject_expected_items, &obj,
8.125 + (ipc_server_handler_type) handle_BacklightObject);
8.126 return 0;
8.127 }
9.1 --- a/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Wed Dec 30 22:51:48 2020 +0100
9.2 +++ b/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Thu Dec 31 01:11:34 2020 +0100
9.3 @@ -25,9 +25,6 @@
9.4
9.5 #include <l4/re/env>
9.6 #include <l4/sys/capability>
9.7 -#include <l4/sys/err.h>
9.8 -
9.9 -#include <stdio.h>
9.10
9.11 #include <l4/devices/spi-client.h>
9.12
10.1 --- a/pkg/devices/display/src/letux400/Makefile Wed Dec 30 22:51:48 2020 +0100
10.2 +++ b/pkg/devices/display/src/letux400/Makefile Thu Dec 31 01:11:34 2020 +0100
10.3 @@ -3,12 +3,40 @@
10.4
10.5 TARGET = dev_display_letux400
10.6 MODE = shared
10.7 -PC_FILENAME := devices-display-letux400
10.8 +PC_FILENAME = devices-display-letux400
10.9 +
10.10 +# Locations for interface input and generated output.
10.11
10.12 -SRC_CC := display-letux400.cc
10.13 +IDL_DIR = $(PKGDIR)/idl
10.14 +IDL_MK_DIR = $(L4DIR)/idl4re/mk
10.15 +IDL_BUILD_DIR = .
10.16 +IDL_EXPORT_DIR = .
10.17 +
10.18 +include $(IDL_MK_DIR)/idl.mk
10.19 +
10.20 +# Individual interfaces.
10.21 +
10.22 +CLIENT_INTERFACES_CC = activation
10.23
10.24 -PRIVATE_INCDIR += $(PKGDIR)/display/include
10.25 +SERVER_INTERFACES_CC = activation
10.26 +
10.27 +# Generated and plain source files.
10.28 +
10.29 +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC))
10.30 +
10.31 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC))
10.32
10.33 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-backlight-client libdrivers-gpio libdevice-util
10.34 +PLAIN_SRC_CC = display-letux400.cc
10.35 +
10.36 +# Normal definitions.
10.37 +
10.38 +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC)
10.39 +
10.40 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-lcd-jz4740 libdrivers-gpio libdevice-util libipc
10.41 +
10.42 +PRIVATE_INCDIR = $(PKGDIR)/display/include $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
10.43
10.44 include $(L4DIR)/mk/prog.mk
10.45 +include $(IDL_MK_DIR)/interface_rules.mk
10.46 +
10.47 +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC)
11.1 --- a/pkg/devices/display/src/letux400/display-letux400.cc Wed Dec 30 22:51:48 2020 +0100
11.2 +++ b/pkg/devices/display/src/letux400/display-letux400.cc Thu Dec 31 01:11:34 2020 +0100
11.3 @@ -1,7 +1,7 @@
11.4 /*
11.5 * Export Letux 400 display operations as a server.
11.6 *
11.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
11.8 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
11.9 *
11.10 * This program is free software; you can redistribute it and/or
11.11 * modify it under the terms of the GNU General Public License as
11.12 @@ -20,24 +20,21 @@
11.13 */
11.14
11.15 #include <l4/devices/gpio-jz4730.h>
11.16 -#include <l4/devices/backlight-client.h>
11.17 #include <l4/devices/memory.h>
11.18
11.19 -#include <l4/cxx/ipc_server>
11.20 -#include <l4/re/env>
11.21 -#include <l4/re/util/object_registry>
11.22 -#include <l4/sys/capability>
11.23 +#include <l4/re/env.h>
11.24
11.25 -#include "display-ops.h"
11.26 +#include <ipc/server.h>
11.27 +#include "activation_client.h"
11.28 +#include "activation_server.h"
11.29
11.30 /* Virtual address for the GPIO register block. */
11.31
11.32 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0;
11.33
11.34 -/* GPIO and backlight device abstractions. */
11.35 +/* GPIO abstraction. */
11.36
11.37 static Gpio_jz4730_chip *gpio_port_b = 0, *gpio_port_c = 0;
11.38 -static L4::Cap<Backlight_device_interface> backlight_device;
11.39
11.40
11.41
11.42 @@ -67,15 +64,18 @@
11.43
11.44
11.45
11.46 -/* Display device. */
11.47 +/* Display device only implementing the activation interface. */
11.48
11.49 -class Display_device_server : public L4::Server_object_t<L4::Kobject>
11.50 +class server_DisplayObject : public Activation
11.51 {
11.52 Pin_slice lcd_mask1 = {.offset=0, .mask=Jz4730_lcd_gpio_func1};
11.53 Pin_slice lcd_mask2 = {.offset=0, .mask=Jz4730_lcd_gpio_func2};
11.54
11.55 + Activation *_backlight;
11.56 +
11.57 public:
11.58 - explicit Display_device_server()
11.59 + explicit server_DisplayObject(Activation *backlight)
11.60 + : _backlight(backlight)
11.61 {
11.62 /* Set functions for the LCD pins. */
11.63
11.64 @@ -88,49 +88,25 @@
11.65 gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 0);
11.66 }
11.67
11.68 - /* Dispatch incoming requests. */
11.69 -
11.70 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios)
11.71 - {
11.72 - l4_msgtag_t tag;
11.73 -
11.74 - (void) obj;
11.75 - ios >> tag;
11.76 -
11.77 - switch (tag.label())
11.78 - {
11.79 - case Display_op_disable:
11.80 - disable();
11.81 - return L4_EOK;
11.82 -
11.83 - case Display_op_enable:
11.84 - enable();
11.85 - return L4_EOK;
11.86 -
11.87 - default:
11.88 - return -L4_EBADPROTO;
11.89 - }
11.90 - }
11.91 -
11.92 /* Switch the display off. */
11.93
11.94 - void disable(void)
11.95 + long disable(void)
11.96 {
11.97 gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 0);
11.98 - backlight_device->disable();
11.99 + _backlight->disable();
11.100 + return L4_EOK;
11.101 }
11.102
11.103 /* Switch the display on. */
11.104
11.105 - void enable(void)
11.106 + long enable(void)
11.107 {
11.108 gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 1);
11.109 - backlight_device->enable();
11.110 + _backlight->enable();
11.111 + return L4_EOK;
11.112 }
11.113 };
11.114
11.115 -static L4Re::Util::Registry_server<> server;
11.116 -
11.117
11.118
11.119 int main(void)
11.120 @@ -147,16 +123,23 @@
11.121
11.122 /* Obtain a reference to the backlight device. */
11.123
11.124 - backlight_device = L4Re::Env::env()->get_cap<Backlight_device_interface>("backlight");
11.125 - if (!backlight_device.is_valid()) return 1;
11.126 + l4_cap_idx_t backlight = l4re_env_get_cap("backlight");
11.127 + if (!l4_is_valid_cap(backlight)) return 1;
11.128 +
11.129 + /* Use the activation interface with the backlight. */
11.130 +
11.131 + client_Activation backlight_obj(backlight);
11.132
11.133 /* Initialise and register a new server object. */
11.134
11.135 - Display_device_server server_obj;
11.136 - server.registry()->register_obj(&server_obj, "display");
11.137 + server_DisplayObject obj(&backlight_obj);
11.138 + l4_cap_idx_t server;
11.139 +
11.140 + if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1;
11.141
11.142 /* Enter the IPC server loop. */
11.143
11.144 - server.loop();
11.145 + ipc_server_loop(Activation_expected_items, &obj,
11.146 + (ipc_server_handler_type) handle_Activation);
11.147 return 0;
11.148 }
12.1 --- a/pkg/landfall-examples/letux400_backlight/Makefile Wed Dec 30 22:51:48 2020 +0100
12.2 +++ b/pkg/landfall-examples/letux400_backlight/Makefile Thu Dec 31 01:11:34 2020 +0100
12.3 @@ -2,7 +2,35 @@
12.4 L4DIR ?= $(PKGDIR)/../..
12.5
12.6 TARGET = ex_letux400_backlight
12.7 -SRC_CC = letux400_backlight.cc
12.8 -REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util
12.9 +
12.10 +# Locations for interface input and generated output.
12.11 +
12.12 +IDL_DIR = $(L4DIR)/pkg/devices/idl
12.13 +IDL_MK_DIR = $(L4DIR)/idl4re/mk
12.14 +IDL_BUILD_DIR = .
12.15 +IDL_EXPORT_DIR = .
12.16 +
12.17 +include $(IDL_MK_DIR)/idl.mk
12.18 +
12.19 +# Individual interfaces.
12.20 +
12.21 +CLIENT_INTERFACES_CC = backlight
12.22 +
12.23 +# Generated and plain source files.
12.24 +
12.25 +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC))
12.26 +
12.27 +PLAIN_SRC_CC = letux400_backlight.cc
12.28 +
12.29 +# Normal definitions.
12.30 +
12.31 +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(PLAIN_SRC_CC)
12.32 +
12.33 +REQUIRES_LIBS = l4re_c-util libdevice-input-keypad libdrivers-keypad-loader libdevice-util libipc
12.34 +
12.35 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
12.36
12.37 include $(L4DIR)/mk/prog.mk
12.38 +include $(IDL_MK_DIR)/interface_rules.mk
12.39 +
12.40 +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC)
13.1 --- a/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Wed Dec 30 22:51:48 2020 +0100
13.2 +++ b/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Thu Dec 31 01:11:34 2020 +0100
13.3 @@ -1,7 +1,9 @@
13.4 /*
13.5 * Access the keypad to modify the backlight on the Letux 400.
13.6 *
13.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
13.8 + * Fn+Volume Down/Up adjusts the brightness.
13.9 + *
13.10 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
13.11 *
13.12 * This program is free software; you can redistribute it and/or
13.13 * modify it under the terms of the GNU General Public License as
13.14 @@ -19,7 +21,6 @@
13.15 * Boston, MA 02110-1301, USA
13.16 */
13.17
13.18 -#include <l4/devices/backlight-client.h>
13.19 #include <l4/devices/input-keypad-client.h>
13.20 #include <l4/devices/keypad-loader.h>
13.21
13.22 @@ -31,6 +32,8 @@
13.23
13.24 #include <stdio.h>
13.25
13.26 +#include "backlight_client.h"
13.27 +
13.28 /* Backlight level. */
13.29
13.30 enum Letux400_backlight_levels
13.31 @@ -46,9 +49,9 @@
13.32
13.33 static int modifier_set = 0;
13.34
13.35 -/* Backlight device abstractions. */
13.36 +/* Backlight references. */
13.37
13.38 -static L4::Cap<Backlight_device_interface> backlight_device;
13.39 +Backlight *backlight_device;
13.40
13.41
13.42
13.43 @@ -101,10 +104,15 @@
13.44 Keypad *keypad = (Keypad *) load_keypad();
13.45 Input_keypad_client client(keypad);
13.46
13.47 - /* Obtain a reference to the PWM device. */
13.48 + /* Obtain a reference to the backlight device. */
13.49 +
13.50 + l4_cap_idx_t backlight = l4re_env_get_cap("backlight");
13.51 + if (!l4_is_valid_cap(backlight)) return 1;
13.52
13.53 - backlight_device = L4Re::Env::env()->get_cap<Backlight_device_interface>("backlight");
13.54 - if (!backlight_device.is_valid()) return 1;
13.55 + /* Use only the backlight interface with the backlight. */
13.56 +
13.57 + client_Backlight backlight_obj(backlight);
13.58 + backlight_device = &backlight_obj;
13.59
13.60 client.attach(handler, 0);
13.61
14.1 --- a/pkg/landfall-examples/qi_lb60_backlight/Makefile Wed Dec 30 22:51:48 2020 +0100
14.2 +++ b/pkg/landfall-examples/qi_lb60_backlight/Makefile Thu Dec 31 01:11:34 2020 +0100
14.3 @@ -2,7 +2,35 @@
14.4 L4DIR ?= $(PKGDIR)/../..
14.5
14.6 TARGET = ex_qi_lb60_backlight
14.7 -SRC_CC = qi_lb60_backlight.cc
14.8 -REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util
14.9 +
14.10 +# Locations for interface input and generated output.
14.11 +
14.12 +IDL_DIR = $(L4DIR)/pkg/devices/idl
14.13 +IDL_MK_DIR = $(L4DIR)/idl4re/mk
14.14 +IDL_BUILD_DIR = .
14.15 +IDL_EXPORT_DIR = .
14.16 +
14.17 +include $(IDL_MK_DIR)/idl.mk
14.18 +
14.19 +# Individual interfaces.
14.20 +
14.21 +CLIENT_INTERFACES_CC = activation backlight
14.22 +
14.23 +# Generated and plain source files.
14.24 +
14.25 +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC))
14.26 +
14.27 +PLAIN_SRC_CC = qi_lb60_backlight.cc
14.28 +
14.29 +# Normal definitions.
14.30 +
14.31 +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(PLAIN_SRC_CC)
14.32 +
14.33 +REQUIRES_LIBS = l4re_c-util libdevice-input-keypad libdrivers-keypad-loader libdevice-util libipc
14.34 +
14.35 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR)
14.36
14.37 include $(L4DIR)/mk/prog.mk
14.38 +include $(IDL_MK_DIR)/interface_rules.mk
14.39 +
14.40 +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC)
15.1 --- a/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Wed Dec 30 22:51:48 2020 +0100
15.2 +++ b/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Thu Dec 31 01:11:34 2020 +0100
15.3 @@ -1,7 +1,10 @@
15.4 /*
15.5 * Access the keypad to modify the backlight on the Ben NanoNote.
15.6 *
15.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
15.8 + * Fn+Volume Down/Up adjusts the brightness.
15.9 + * Red Arrow+Volume Down/Up disables/enables the backlight.
15.10 + *
15.11 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
15.12 *
15.13 * This program is free software; you can redistribute it and/or
15.14 * modify it under the terms of the GNU General Public License as
15.15 @@ -19,18 +22,19 @@
15.16 * Boston, MA 02110-1301, USA
15.17 */
15.18
15.19 -#include <l4/devices/backlight-client.h>
15.20 #include <l4/devices/input-keypad-client.h>
15.21 #include <l4/devices/keypad-loader.h>
15.22
15.23 -#include <l4/re/env>
15.24 -#include <l4/sys/capability>
15.25 +#include <l4/re/env.h>
15.26
15.27 #include <l4/re/event_enums.h>
15.28 #include <l4/util/util.h>
15.29
15.30 #include <stdio.h>
15.31
15.32 +#include "activation_client.h"
15.33 +#include "backlight_client.h"
15.34 +
15.35 /* Backlight level. */
15.36
15.37 enum Qi_lb60_backlight_levels
15.38 @@ -49,7 +53,8 @@
15.39
15.40 /* Backlight device abstractions. */
15.41
15.42 -static L4::Cap<Backlight_device_interface> backlight_device;
15.43 +static Activation *activation_device;
15.44 +static Backlight *backlight_device;
15.45
15.46
15.47
15.48 @@ -76,7 +81,7 @@
15.49 case L4RE_KEY_VOLUMEDOWN:
15.50 if (enable_modifier_set)
15.51 {
15.52 - backlight_device->disable();
15.53 + activation_device->disable();
15.54 return;
15.55 }
15.56 else if (backlight_level < Qi_lb60_backlight_min_level + Qi_lb60_backlight_step)
15.57 @@ -88,7 +93,7 @@
15.58 case L4RE_KEY_VOLUMEUP:
15.59 if (enable_modifier_set)
15.60 {
15.61 - backlight_device->enable();
15.62 + activation_device->enable();
15.63 return;
15.64 }
15.65 else if (backlight_level > Qi_lb60_backlight_max_level - Qi_lb60_backlight_step)
15.66 @@ -116,8 +121,17 @@
15.67
15.68 /* Obtain a reference to the backlight device. */
15.69
15.70 - backlight_device = L4Re::Env::env()->get_cap<Backlight_device_interface>("backlight");
15.71 - if (!backlight_device.is_valid()) return 1;
15.72 + l4_cap_idx_t backlight = l4re_env_get_cap("backlight");
15.73 + if (!l4_is_valid_cap(backlight)) return 1;
15.74 +
15.75 + /* NOTE: The component framework should permit the use of a compound client
15.76 + object. */
15.77 +
15.78 + client_Activation activation_obj(backlight);
15.79 + activation_device = &activation_obj;
15.80 +
15.81 + client_Backlight backlight_obj(backlight);
15.82 + backlight_device = &backlight_obj;
15.83
15.84 client.attach(handler, 0);
15.85