# HG changeset patch # User Paul Boddie # Date 1527888977 -7200 # Node ID 40d544f769170d8251c5b4ca8eab3ac3d5ea1a98 # Parent 5c569c381a4ef054939bfa537e4938b59a5714f3 Introduced a convenience "loader" library for panel details. diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/Control --- a/pkg/devices/Control Fri Jun 01 22:53:02 2018 +0200 +++ b/pkg/devices/Control Fri Jun 01 23:36:17 2018 +0200 @@ -43,6 +43,7 @@ provides: libdrivers-lcd-jz4740 provides: libdrivers-panel-headers provides: libdrivers-panel-letux400 +provides: libdrivers-panel-loader provides: libdrivers-panel-qi_lb60 provides: libdrivers-pwm requires: libc l4re_c libio diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lcd/src/jz4740/Makefile --- a/pkg/devices/lcd/src/jz4740/Makefile Fri Jun 01 22:53:02 2018 +0200 +++ b/pkg/devices/lcd/src/jz4740/Makefile Fri Jun 01 23:36:17 2018 +0200 @@ -8,6 +8,6 @@ PRIVATE_INCDIR += $(PKGDIR)/lcd/include -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-lcd libdrivers-lcd-jz4740 libdrivers-panel-headers libdevice-cpm-client libdevice-util +REQUIRES_LIBS := l4re_c l4re_c-util libdevice-lcd libdrivers-lcd-jz4740 libdrivers-panel-loader libdevice-cpm-client libdevice-util include $(L4DIR)/mk/lib.mk diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc --- a/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jun 01 22:53:02 2018 +0200 +++ b/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jun 01 23:36:17 2018 +0200 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include "lcd-jz4740-device.h" @@ -46,10 +46,6 @@ static L4::Cap cpm_device; static L4::Cap display_device; -// Panel definition. - -static struct Jz4740_lcd_panel *panel; - // CPM operations. @@ -246,13 +242,9 @@ display_device = L4Re::Env::env()->get_cap("display"); if (!display_device.is_valid()) return 1; - // Load the panel data. + // Load the panel data from the configured library. - void *(*panel_get)(void); - panel_get = (void *(*)(void)) load_function("rom/mips-jz4740-panel.txt", "panel_get"); - if (!panel_get) return 1; - - panel = (struct Jz4740_lcd_panel *) panel_get(); + struct Jz4740_lcd_panel *panel = (struct Jz4740_lcd_panel *) load_panel(); // Initialise the LCD abstraction. diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lib/panel/include/panel-loader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/panel/include/panel-loader.h Fri Jun 01 23:36:17 2018 +0200 @@ -0,0 +1,28 @@ +/* + * Client access to panel libraries. + * + * Copyright (C) 2018 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 + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#pragma once + +EXTERN_C_BEGIN + +void *load_panel(); + +EXTERN_C_END diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lib/panel/src/Makefile --- a/pkg/devices/lib/panel/src/Makefile Fri Jun 01 22:53:02 2018 +0200 +++ b/pkg/devices/lib/panel/src/Makefile Fri Jun 01 23:36:17 2018 +0200 @@ -1,6 +1,6 @@ PKGDIR ?= ../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET := letux400 qi_lb60 +TARGET := letux400 loader qi_lb60 include $(L4DIR)/mk/subdir.mk diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lib/panel/src/loader/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/panel/src/loader/Makefile Fri Jun 01 23:36:17 2018 +0200 @@ -0,0 +1,12 @@ +PKGDIR ?= ../../../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = libpanel_loader.a +PC_FILENAME := libdrivers-panel-loader + +SRC_CC := panel-loader.cc +REQUIRES_LIBS := libdevice-util + +PRIVATE_INCDIR += $(PKGDIR)/lib/panel/include + +include $(L4DIR)/mk/lib.mk diff -r 5c569c381a4e -r 40d544f76917 pkg/devices/lib/panel/src/loader/panel-loader.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/panel/src/loader/panel-loader.cc Fri Jun 01 23:36:17 2018 +0200 @@ -0,0 +1,37 @@ +/* + * Client functionality for panel library access. + * + * Copyright (C) 2018 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 + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include +#include "panel-loader.h" + +void *load_panel() +{ + // Load the panel library using details in the specified file. + + void *(*panel_get)(void); + + panel_get = (void *(*)(void)) load_function("rom/mips-jz4740-panel.txt", "panel_get"); + if (!panel_get) return 0; + + // Return the panel details. + + return panel_get(); +}