1.1 --- a/pkg/devices/Control Fri Jun 01 22:53:02 2018 +0200
1.2 +++ b/pkg/devices/Control Fri Jun 01 23:36:17 2018 +0200
1.3 @@ -43,6 +43,7 @@
1.4 provides: libdrivers-lcd-jz4740
1.5 provides: libdrivers-panel-headers
1.6 provides: libdrivers-panel-letux400
1.7 +provides: libdrivers-panel-loader
1.8 provides: libdrivers-panel-qi_lb60
1.9 provides: libdrivers-pwm
1.10 requires: libc l4re_c libio
2.1 --- a/pkg/devices/lcd/src/jz4740/Makefile Fri Jun 01 22:53:02 2018 +0200
2.2 +++ b/pkg/devices/lcd/src/jz4740/Makefile Fri Jun 01 23:36:17 2018 +0200
2.3 @@ -8,6 +8,6 @@
2.4
2.5 PRIVATE_INCDIR += $(PKGDIR)/lcd/include
2.6
2.7 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-lcd libdrivers-lcd-jz4740 libdrivers-panel-headers libdevice-cpm-client libdevice-util
2.8 +REQUIRES_LIBS := l4re_c l4re_c-util libdevice-lcd libdrivers-lcd-jz4740 libdrivers-panel-loader libdevice-cpm-client libdevice-util
2.9
2.10 include $(L4DIR)/mk/lib.mk
3.1 --- a/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jun 01 22:53:02 2018 +0200
3.2 +++ b/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jun 01 23:36:17 2018 +0200
3.3 @@ -22,7 +22,7 @@
3.4 #include <l4/devices/cpm-client.h>
3.5 #include <l4/devices/display-client.h>
3.6 #include <l4/devices/lcd-jz4740.h>
3.7 -#include <l4/devices/dl.h>
3.8 +#include <l4/devices/panel-loader.h>
3.9 #include <l4/devices/memory.h>
3.10 #include "lcd-jz4740-device.h"
3.11
3.12 @@ -46,10 +46,6 @@
3.13 static L4::Cap<Cpm_device_interface> cpm_device;
3.14 static L4::Cap<Display_device_interface> display_device;
3.15
3.16 -// Panel definition.
3.17 -
3.18 -static struct Jz4740_lcd_panel *panel;
3.19 -
3.20
3.21
3.22 // CPM operations.
3.23 @@ -246,13 +242,9 @@
3.24 display_device = L4Re::Env::env()->get_cap<Display_device_interface>("display");
3.25 if (!display_device.is_valid()) return 1;
3.26
3.27 - // Load the panel data.
3.28 + // Load the panel data from the configured library.
3.29
3.30 - void *(*panel_get)(void);
3.31 - panel_get = (void *(*)(void)) load_function("rom/mips-jz4740-panel.txt", "panel_get");
3.32 - if (!panel_get) return 1;
3.33 -
3.34 - panel = (struct Jz4740_lcd_panel *) panel_get();
3.35 + struct Jz4740_lcd_panel *panel = (struct Jz4740_lcd_panel *) load_panel();
3.36
3.37 // Initialise the LCD abstraction.
3.38
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/pkg/devices/lib/panel/include/panel-loader.h Fri Jun 01 23:36:17 2018 +0200
4.3 @@ -0,0 +1,28 @@
4.4 +/*
4.5 + * Client access to panel libraries.
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 +EXTERN_C_BEGIN
4.28 +
4.29 +void *load_panel();
4.30 +
4.31 +EXTERN_C_END
5.1 --- a/pkg/devices/lib/panel/src/Makefile Fri Jun 01 22:53:02 2018 +0200
5.2 +++ b/pkg/devices/lib/panel/src/Makefile Fri Jun 01 23:36:17 2018 +0200
5.3 @@ -1,6 +1,6 @@
5.4 PKGDIR ?= ../../..
5.5 L4DIR ?= $(PKGDIR)/../..
5.6
5.7 -TARGET := letux400 qi_lb60
5.8 +TARGET := letux400 loader qi_lb60
5.9
5.10 include $(L4DIR)/mk/subdir.mk
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/pkg/devices/lib/panel/src/loader/Makefile Fri Jun 01 23:36:17 2018 +0200
6.3 @@ -0,0 +1,12 @@
6.4 +PKGDIR ?= ../../../..
6.5 +L4DIR ?= $(PKGDIR)/../..
6.6 +
6.7 +TARGET = libpanel_loader.a
6.8 +PC_FILENAME := libdrivers-panel-loader
6.9 +
6.10 +SRC_CC := panel-loader.cc
6.11 +REQUIRES_LIBS := libdevice-util
6.12 +
6.13 +PRIVATE_INCDIR += $(PKGDIR)/lib/panel/include
6.14 +
6.15 +include $(L4DIR)/mk/lib.mk
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/pkg/devices/lib/panel/src/loader/panel-loader.cc Fri Jun 01 23:36:17 2018 +0200
7.3 @@ -0,0 +1,37 @@
7.4 +/*
7.5 + * Client functionality for panel library access.
7.6 + *
7.7 + * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
7.8 + *
7.9 + * This program is free software; you can redistribute it and/or
7.10 + * modify it under the terms of the GNU General Public License as
7.11 + * published by the Free Software Foundation; either version 2 of
7.12 + * the License, or (at your option) any later version.
7.13 + *
7.14 + * This program is distributed in the hope that it will be useful,
7.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.17 + * GNU General Public License for more details.
7.18 + *
7.19 + * You should have received a copy of the GNU General Public License
7.20 + * along with this program; if not, write to the Free Software
7.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
7.22 + * Boston, MA 02110-1301, USA
7.23 + */
7.24 +
7.25 +#include <l4/devices/dl.h>
7.26 +#include "panel-loader.h"
7.27 +
7.28 +void *load_panel()
7.29 +{
7.30 + // Load the panel library using details in the specified file.
7.31 +
7.32 + void *(*panel_get)(void);
7.33 +
7.34 + panel_get = (void *(*)(void)) load_function("rom/mips-jz4740-panel.txt", "panel_get");
7.35 + if (!panel_get) return 0;
7.36 +
7.37 + // Return the panel details.
7.38 +
7.39 + return panel_get();
7.40 +}