1.1 --- a/pkg/devices/Control Fri Jan 01 00:49:07 2021 +0100 1.2 +++ b/pkg/devices/Control Fri Jan 01 01:49:35 2021 +0100 1.3 @@ -13,9 +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-cpm-client 1.8 -provides: libdevice-cpm-server 1.9 -provides: libdevice-display-client 1.10 provides: libdevice-display-ops 1.11 provides: libdevice-fb-client 1.12 provides: libdevice-fb-lcd
2.1 --- a/pkg/devices/cpm/Makefile Fri Jan 01 00:49:07 2021 +0100 2.2 +++ b/pkg/devices/cpm/Makefile Fri Jan 01 01:49:35 2021 +0100 2.3 @@ -1,8 +1,6 @@ 2.4 PKGDIR ?= .. 2.5 L4DIR ?= $(PKGDIR)/../.. 2.6 2.7 -TARGET := include src 2.8 +TARGET := src 2.9 2.10 include $(L4DIR)/mk/subdir.mk 2.11 - 2.12 -src: include
3.1 --- a/pkg/devices/cpm/include/Makefile Fri Jan 01 00:49:07 2021 +0100 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,4 +0,0 @@ 3.4 -PKGDIR = ../.. 3.5 -L4DIR ?= $(PKGDIR)/../.. 3.6 - 3.7 -include $(L4DIR)/mk/include.mk
4.1 --- a/pkg/devices/cpm/include/cpm-client.h Fri Jan 01 00:49:07 2021 +0100 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,48 +0,0 @@ 4.4 -/* 4.5 - * CPM client to access CPM servers. 4.6 - * 4.7 - * Copyright (C) 2018, 2020 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 -#ifdef __cplusplus 4.28 - 4.29 -#include <l4/re/env> 4.30 -#include <stdint.h> 4.31 - 4.32 -class Cpm_device_interface : public L4::Kobject_t<Cpm_device_interface, L4::Kobject> 4.33 -{ 4.34 - L4_KOBJECT(Cpm_device_interface) 4.35 - 4.36 -public: 4.37 - int get_lcd_pixel_frequency(uint32_t *frequency) throw(); 4.38 - 4.39 - int set_hdmi_frequency(uint32_t frequency) throw(); 4.40 - int set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) throw(); 4.41 - 4.42 - int start_hdmi() throw(); 4.43 - int stop_hdmi() throw(); 4.44 - 4.45 - int start_lcd() throw(); 4.46 - int stop_lcd() throw(); 4.47 - 4.48 - int update_output_frequency() throw(); 4.49 -}; 4.50 - 4.51 -#endif
5.1 --- a/pkg/devices/cpm/include/cpm-ops.h Fri Jan 01 00:49:07 2021 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,33 +0,0 @@ 5.4 -/* 5.5 - * CPM server operations. 5.6 - * 5.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 5.8 - * 5.9 - * This program is free software; you can redistribute it and/or 5.10 - * modify it under the terms of the GNU General Public License as 5.11 - * published by the Free Software Foundation; either version 2 of 5.12 - * the License, or (at your option) any later version. 5.13 - * 5.14 - * This program is distributed in the hope that it will be useful, 5.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 5.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 5.17 - * GNU General Public License for more details. 5.18 - * 5.19 - * You should have received a copy of the GNU General Public License 5.20 - * along with this program; if not, write to the Free Software 5.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 5.22 - * Boston, MA 02110-1301, USA 5.23 - */ 5.24 - 5.25 -#pragma once 5.26 - 5.27 -enum { 5.28 - Cpm_op_set_lcd_frequencies, 5.29 - Cpm_op_start_lcd, 5.30 - Cpm_op_stop_lcd, 5.31 - Cpm_op_update_output_frequency, 5.32 - Cpm_op_get_lcd_pixel_frequency, 5.33 - Cpm_op_set_hdmi_frequency, 5.34 - Cpm_op_start_hdmi, 5.35 - Cpm_op_stop_hdmi, 5.36 -};
6.1 --- a/pkg/devices/cpm/include/cpm-server.h Fri Jan 01 00:49:07 2021 +0100 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,49 +0,0 @@ 6.4 -/* 6.5 - * Common CPM server functionality. 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 -#pragma once 6.26 - 6.27 -#include <l4/devices/cpm.h> 6.28 - 6.29 -#ifdef __cplusplus 6.30 - 6.31 -#include <l4/cxx/ipc_server> 6.32 -#include <l4/re/dataspace> 6.33 -#include <l4/re/env> 6.34 - 6.35 -/* Server object to provide CPM access. */ 6.36 - 6.37 -class Cpm_server : public L4::Server_object_t<L4::Kobject> 6.38 -{ 6.39 -private: 6.40 - Cpm_chip *_chip; 6.41 - 6.42 -public: 6.43 - /* Initialise the server with a peripheral reference. */ 6.44 - 6.45 - explicit Cpm_server(Cpm_chip *chip) 6.46 - : _chip(chip) 6.47 - {} 6.48 - 6.49 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios); 6.50 -}; 6.51 - 6.52 -#endif
7.1 --- a/pkg/devices/cpm/src/Makefile Fri Jan 01 00:49:07 2021 +0100 7.2 +++ b/pkg/devices/cpm/src/Makefile Fri Jan 01 01:49:35 2021 +0100 7.3 @@ -1,10 +1,6 @@ 7.4 PKGDIR ?= ../.. 7.5 L4DIR ?= $(PKGDIR)/../.. 7.6 7.7 -TARGET := client jz4730 jz4740 jz4780 server 7.8 +TARGET := jz4730 jz4740 jz4780 7.9 7.10 include $(L4DIR)/mk/subdir.mk 7.11 - 7.12 -jz4730: server 7.13 -jz4740: server 7.14 -jz4780: server
8.1 --- a/pkg/devices/cpm/src/client/Makefile Fri Jan 01 00:49:07 2021 +0100 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,13 +0,0 @@ 8.4 -PKGDIR ?= ../../.. 8.5 -L4DIR ?= $(PKGDIR)/../.. 8.6 - 8.7 -TARGET = libdevice_cpm_client.o.a libdevice_cpm_client.o.so 8.8 -PC_FILENAME := libdevice-cpm-client 8.9 - 8.10 -SRC_CC := cpm-client.cc 8.11 - 8.12 -PRIVATE_INCDIR += $(PKGDIR)/cpm/include 8.13 - 8.14 -REQUIRES_LIBS := l4re_c l4re_c-util 8.15 - 8.16 -include $(L4DIR)/mk/lib.mk
9.1 --- a/pkg/devices/cpm/src/client/cpm-client.cc Fri Jan 01 00:49:07 2021 +0100 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,101 +0,0 @@ 9.4 -/* 9.5 - * CPM client to access CPM servers. 9.6 - * 9.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 9.8 - * 9.9 - * This program is free software; you can redistribute it and/or 9.10 - * modify it under the terms of the GNU General Public License as 9.11 - * published by the Free Software Foundation; either version 2 of 9.12 - * the License, or (at your option) any later version. 9.13 - * 9.14 - * This program is distributed in the hope that it will be useful, 9.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9.17 - * GNU General Public License for more details. 9.18 - * 9.19 - * You should have received a copy of the GNU General Public License 9.20 - * along with this program; if not, write to the Free Software 9.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 9.22 - * Boston, MA 02110-1301, USA 9.23 - */ 9.24 - 9.25 -#include <l4/cxx/ipc_stream> 9.26 -#include <l4/re/env> 9.27 - 9.28 -#include "cpm-client.h" 9.29 -#include "cpm-ops.h" 9.30 - 9.31 -int 9.32 -Cpm_device_interface::get_lcd_pixel_frequency(uint32_t *frequency) throw() 9.33 -{ 9.34 - L4::Ipc::Iostream s(l4_utcb()); 9.35 - int err = l4_error(s.call(cap(), Cpm_op_get_lcd_pixel_frequency)); 9.36 - uint32_t _frequency; 9.37 - 9.38 - if (err) 9.39 - return err; 9.40 - 9.41 - s >> _frequency; 9.42 - *frequency = _frequency; 9.43 - return L4_EOK; 9.44 -} 9.45 - 9.46 -int 9.47 -Cpm_device_interface::set_hdmi_frequency(uint32_t frequency) throw() 9.48 -{ 9.49 - L4::Ipc::Iostream s(l4_utcb()); 9.50 - 9.51 - s << frequency; 9.52 - 9.53 - return l4_error(s.call(cap(), Cpm_op_set_hdmi_frequency)); 9.54 -} 9.55 - 9.56 -int 9.57 -Cpm_device_interface::start_hdmi() throw() 9.58 -{ 9.59 - L4::Ipc::Iostream s(l4_utcb()); 9.60 - 9.61 - return l4_error(s.call(cap(), Cpm_op_start_hdmi)); 9.62 -} 9.63 - 9.64 -int 9.65 -Cpm_device_interface::stop_hdmi() throw() 9.66 -{ 9.67 - L4::Ipc::Iostream s(l4_utcb()); 9.68 - 9.69 - return l4_error(s.call(cap(), Cpm_op_stop_hdmi)); 9.70 -} 9.71 - 9.72 -int 9.73 -Cpm_device_interface::set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) throw() 9.74 -{ 9.75 - L4::Ipc::Iostream s(l4_utcb()); 9.76 - 9.77 - s << pclk << multiplier; 9.78 - 9.79 - return l4_error(s.call(cap(), Cpm_op_set_lcd_frequencies)); 9.80 -} 9.81 - 9.82 -int 9.83 -Cpm_device_interface::start_lcd() throw() 9.84 -{ 9.85 - L4::Ipc::Iostream s(l4_utcb()); 9.86 - 9.87 - return l4_error(s.call(cap(), Cpm_op_start_lcd)); 9.88 -} 9.89 - 9.90 -int 9.91 -Cpm_device_interface::stop_lcd() throw() 9.92 -{ 9.93 - L4::Ipc::Iostream s(l4_utcb()); 9.94 - 9.95 - return l4_error(s.call(cap(), Cpm_op_stop_lcd)); 9.96 -} 9.97 - 9.98 -int 9.99 -Cpm_device_interface::update_output_frequency() throw() 9.100 -{ 9.101 - L4::Ipc::Iostream s(l4_utcb()); 9.102 - 9.103 - return l4_error(s.call(cap(), Cpm_op_update_output_frequency)); 9.104 -}
10.1 --- a/pkg/devices/cpm/src/jz4730/Makefile Fri Jan 01 00:49:07 2021 +0100 10.2 +++ b/pkg/devices/cpm/src/jz4730/Makefile Fri Jan 01 01:49:35 2021 +0100 10.3 @@ -3,12 +3,36 @@ 10.4 10.5 TARGET = dev_cpm_jz4730 10.6 MODE = shared 10.7 -PC_FILENAME := devices-cpm-jz4730 10.8 +PC_FILENAME = devices-cpm-jz4730 10.9 + 10.10 +# Locations for interface input and generated output. 10.11 10.12 -SRC_CC := cpm-jz4730.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 -PRIVATE_INCDIR += $(PKGDIR)/cpm/include 10.23 +SERVER_INTERFACES_CC = cpm 10.24 + 10.25 +# Generated and plain source files. 10.26 + 10.27 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 10.28 + 10.29 +PLAIN_SRC_CC = cpm-jz4730.cc 10.30 10.31 -REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-cpm libdevice-cpm-server libdevice-util 10.32 +# Normal definitions. 10.33 + 10.34 +SRC_CC = $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) 10.35 + 10.36 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-cpm libdevice-util libipc 10.37 + 10.38 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) 10.39 10.40 include $(L4DIR)/mk/prog.mk 10.41 +include $(IDL_MK_DIR)/interface_rules.mk 10.42 + 10.43 +$(PLAIN_SRC_CC): $(SERVER_INTERFACES_SRC_CC)
11.1 --- a/pkg/devices/cpm/src/jz4730/cpm-jz4730.cc Fri Jan 01 00:49:07 2021 +0100 11.2 +++ b/pkg/devices/cpm/src/jz4730/cpm-jz4730.cc Fri Jan 01 01:49:35 2021 +0100 11.3 @@ -1,7 +1,7 @@ 11.4 /* 11.5 * JZ4730 CPM 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 @@ -21,21 +21,19 @@ 11.13 11.14 #include <l4/devices/cpm-jz4730.h> 11.15 #include <l4/devices/memory.h> 11.16 -#include "cpm-server.h" 11.17 + 11.18 +#include <l4/re/env.h> 11.19 11.20 -#include <l4/re/dataspace> 11.21 -#include <l4/re/env> 11.22 -#include <l4/re/util/object_registry> 11.23 +#include <ipc/server.h> 11.24 +#include "cpm_server.h" 11.25 11.26 -#include <l4/sys/types.h> 11.27 - 11.28 -// Virtual addresses for the CPM and LCD register blocks. 11.29 +/* Virtual addresses for the CPM and LCD register blocks. */ 11.30 11.31 static l4_addr_t cpm_virt_base = 0, cpm_virt_base_end = 0; 11.32 11.33 11.34 11.35 -// Access to peripheral memory. 11.36 +/* Access to peripheral memory. */ 11.37 11.38 static int setup_memory() 11.39 { 11.40 @@ -47,7 +45,42 @@ 11.41 11.42 11.43 11.44 -static L4Re::Util::Registry_server<> server; 11.45 +/* CPM server. */ 11.46 + 11.47 +class server_CPM : public CPM 11.48 +{ 11.49 + Cpm_jz4730_chip *_chip; 11.50 + 11.51 +public: 11.52 + explicit server_CPM(Cpm_jz4730_chip *chip) 11.53 + : _chip(chip) 11.54 + { 11.55 + } 11.56 + 11.57 + long set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) 11.58 + { 11.59 + _chip->set_lcd_frequencies(pclk, multiplier); 11.60 + return L4_EOK; 11.61 + } 11.62 + 11.63 + long start_lcd() 11.64 + { 11.65 + _chip->start_lcd(); 11.66 + return L4_EOK; 11.67 + } 11.68 + 11.69 + long stop_lcd() 11.70 + { 11.71 + _chip->stop_lcd(); 11.72 + return L4_EOK; 11.73 + } 11.74 + 11.75 + long update_output_frequency() 11.76 + { 11.77 + _chip->update_output_frequency(); 11.78 + return L4_EOK; 11.79 + } 11.80 +}; 11.81 11.82 11.83 11.84 @@ -63,11 +96,14 @@ 11.85 11.86 /* Initialise and register a server object. */ 11.87 11.88 - Cpm_server server_obj(&cpm_device); 11.89 - server.registry()->register_obj(&server_obj, "cpm"); 11.90 + server_CPM obj(&cpm_device); 11.91 + l4_cap_idx_t server; 11.92 + 11.93 + if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 11.94 11.95 /* Enter the IPC server loop. */ 11.96 11.97 - server.loop(); 11.98 + ipc_server_loop(CPM_expected_items, &obj, 11.99 + (ipc_server_handler_type) handle_CPM); 11.100 return 0; 11.101 }
12.1 --- a/pkg/devices/cpm/src/jz4740/Makefile Fri Jan 01 00:49:07 2021 +0100 12.2 +++ b/pkg/devices/cpm/src/jz4740/Makefile Fri Jan 01 01:49:35 2021 +0100 12.3 @@ -3,12 +3,36 @@ 12.4 12.5 TARGET = dev_cpm_jz4740 12.6 MODE = shared 12.7 -PC_FILENAME := devices-cpm-jz4740 12.8 +PC_FILENAME = devices-cpm-jz4740 12.9 + 12.10 +# Locations for interface input and generated output. 12.11 12.12 -SRC_CC := cpm-jz4740.cc 12.13 +IDL_DIR = $(PKGDIR)/idl 12.14 +IDL_MK_DIR = $(L4DIR)/idl4re/mk 12.15 +IDL_BUILD_DIR = . 12.16 +IDL_EXPORT_DIR = . 12.17 + 12.18 +include $(IDL_MK_DIR)/idl.mk 12.19 + 12.20 +# Individual interfaces. 12.21 12.22 -PRIVATE_INCDIR += $(PKGDIR)/cpm/include 12.23 +SERVER_INTERFACES_CC = cpm 12.24 + 12.25 +# Generated and plain source files. 12.26 + 12.27 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 12.28 + 12.29 +PLAIN_SRC_CC = cpm-jz4740.cc 12.30 12.31 -REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-cpm libdevice-cpm-server libdevice-util 12.32 +# Normal definitions. 12.33 + 12.34 +SRC_CC = $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) 12.35 + 12.36 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-cpm libdevice-util libipc 12.37 + 12.38 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) 12.39 12.40 include $(L4DIR)/mk/prog.mk 12.41 +include $(IDL_MK_DIR)/interface_rules.mk 12.42 + 12.43 +$(PLAIN_SRC_CC): $(SERVER_INTERFACES_SRC_CC)
13.1 --- a/pkg/devices/cpm/src/jz4740/cpm-jz4740.cc Fri Jan 01 00:49:07 2021 +0100 13.2 +++ b/pkg/devices/cpm/src/jz4740/cpm-jz4740.cc Fri Jan 01 01:49:35 2021 +0100 13.3 @@ -1,7 +1,7 @@ 13.4 /* 13.5 * JZ4740 CPM server. 13.6 * 13.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 13.8 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 13.9 * 13.10 * This program is free software; you can redistribute it and/or 13.11 * modify it under the terms of the GNU General Public License as 13.12 @@ -21,13 +21,11 @@ 13.13 13.14 #include <l4/devices/cpm-jz4740.h> 13.15 #include <l4/devices/memory.h> 13.16 -#include "cpm-server.h" 13.17 + 13.18 +#include <l4/re/env.h> 13.19 13.20 -#include <l4/re/dataspace> 13.21 -#include <l4/re/env> 13.22 -#include <l4/re/util/object_registry> 13.23 - 13.24 -#include <l4/sys/types.h> 13.25 +#include <ipc/server.h> 13.26 +#include "cpm_server.h" 13.27 13.28 // Virtual addresses for the CPM and LCD register blocks. 13.29 13.30 @@ -47,7 +45,42 @@ 13.31 13.32 13.33 13.34 -static L4Re::Util::Registry_server<> server; 13.35 +/* CPM server. */ 13.36 + 13.37 +class server_CPM : public CPM 13.38 +{ 13.39 + Cpm_jz4740_chip *_chip; 13.40 + 13.41 +public: 13.42 + explicit server_CPM(Cpm_jz4740_chip *chip) 13.43 + : _chip(chip) 13.44 + { 13.45 + } 13.46 + 13.47 + long set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) 13.48 + { 13.49 + _chip->set_lcd_frequencies(pclk, multiplier); 13.50 + return L4_EOK; 13.51 + } 13.52 + 13.53 + long start_lcd() 13.54 + { 13.55 + _chip->start_lcd(); 13.56 + return L4_EOK; 13.57 + } 13.58 + 13.59 + long stop_lcd() 13.60 + { 13.61 + _chip->stop_lcd(); 13.62 + return L4_EOK; 13.63 + } 13.64 + 13.65 + long update_output_frequency() 13.66 + { 13.67 + _chip->update_output_frequency(); 13.68 + return L4_EOK; 13.69 + } 13.70 +}; 13.71 13.72 13.73 13.74 @@ -62,12 +95,15 @@ 13.75 Cpm_jz4740_chip cpm_device(cpm_virt_base, 12000000); 13.76 13.77 /* Initialise and register a server object. */ 13.78 - 13.79 - Cpm_server server_obj(&cpm_device); 13.80 - server.registry()->register_obj(&server_obj, "cpm"); 13.81 - 13.82 + 13.83 + server_CPM obj(&cpm_device); 13.84 + l4_cap_idx_t server; 13.85 + 13.86 + if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 13.87 + 13.88 /* Enter the IPC server loop. */ 13.89 - 13.90 - server.loop(); 13.91 + 13.92 + ipc_server_loop(CPM_expected_items, &obj, 13.93 + (ipc_server_handler_type) handle_CPM); 13.94 return 0; 13.95 }
14.1 --- a/pkg/devices/cpm/src/jz4780/Makefile Fri Jan 01 00:49:07 2021 +0100 14.2 +++ b/pkg/devices/cpm/src/jz4780/Makefile Fri Jan 01 01:49:35 2021 +0100 14.3 @@ -3,12 +3,36 @@ 14.4 14.5 TARGET = dev_cpm_jz4780 14.6 MODE = shared 14.7 -PC_FILENAME := devices-cpm-jz4780 14.8 +PC_FILENAME = devices-cpm-jz4780 14.9 + 14.10 +# Locations for interface input and generated output. 14.11 14.12 -SRC_CC := cpm-jz4780.cc 14.13 +IDL_DIR = $(PKGDIR)/idl 14.14 +IDL_MK_DIR = $(L4DIR)/idl4re/mk 14.15 +IDL_BUILD_DIR = . 14.16 +IDL_EXPORT_DIR = . 14.17 + 14.18 +include $(IDL_MK_DIR)/idl.mk 14.19 + 14.20 +# Individual interfaces. 14.21 14.22 -PRIVATE_INCDIR += $(PKGDIR)/cpm/include 14.23 +SERVER_INTERFACES_CC = cpm 14.24 + 14.25 +# Generated and plain source files. 14.26 + 14.27 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 14.28 + 14.29 +PLAIN_SRC_CC = cpm-jz4780.cc 14.30 14.31 -REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-cpm libdevice-cpm-server libdevice-util 14.32 +# Normal definitions. 14.33 + 14.34 +SRC_CC = $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) 14.35 + 14.36 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-cpm libdevice-util libipc 14.37 + 14.38 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) 14.39 14.40 include $(L4DIR)/mk/prog.mk 14.41 +include $(IDL_MK_DIR)/interface_rules.mk 14.42 + 14.43 +$(PLAIN_SRC_CC): $(SERVER_INTERFACES_SRC_CC)
15.1 --- a/pkg/devices/cpm/src/jz4780/cpm-jz4780.cc Fri Jan 01 00:49:07 2021 +0100 15.2 +++ b/pkg/devices/cpm/src/jz4780/cpm-jz4780.cc Fri Jan 01 01:49:35 2021 +0100 15.3 @@ -1,7 +1,7 @@ 15.4 /* 15.5 * JZ4780 CPM server. 15.6 * 15.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 15.8 + * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 15.9 * 15.10 * This program is free software; you can redistribute it and/or 15.11 * modify it under the terms of the GNU General Public License as 15.12 @@ -21,13 +21,11 @@ 15.13 15.14 #include <l4/devices/cpm-jz4780.h> 15.15 #include <l4/devices/memory.h> 15.16 -#include "cpm-server.h" 15.17 + 15.18 +#include <l4/re/env.h> 15.19 15.20 -#include <l4/re/dataspace> 15.21 -#include <l4/re/env> 15.22 -#include <l4/re/util/object_registry> 15.23 - 15.24 -#include <l4/sys/types.h> 15.25 +#include <ipc/server.h> 15.26 +#include "cpm_server.h" 15.27 15.28 // Virtual addresses for the CPM and LCD register blocks. 15.29 15.30 @@ -47,7 +45,66 @@ 15.31 15.32 15.33 15.34 -static L4Re::Util::Registry_server<> server; 15.35 +/* CPM server. */ 15.36 + 15.37 +class server_CPM : public CPM 15.38 +{ 15.39 + Cpm_jz4780_chip *_chip; 15.40 + 15.41 +public: 15.42 + explicit server_CPM(Cpm_jz4780_chip *chip) 15.43 + : _chip(chip) 15.44 + { 15.45 + } 15.46 + 15.47 + long get_lcd_pixel_frequency(uint8_t controller, uint32_t *frequency) 15.48 + { 15.49 + *frequency = _chip->get_lcd_pixel_frequency(controller); 15.50 + return L4_EOK; 15.51 + } 15.52 + 15.53 + long set_hdmi_frequency(uint32_t frequency) 15.54 + { 15.55 + _chip->set_hdmi_frequency(frequency); 15.56 + return L4_EOK; 15.57 + } 15.58 + 15.59 + long set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) 15.60 + { 15.61 + _chip->set_lcd_frequencies(pclk, multiplier); 15.62 + return L4_EOK; 15.63 + } 15.64 + 15.65 + long start_hdmi() 15.66 + { 15.67 + _chip->start_hdmi(); 15.68 + return L4_EOK; 15.69 + } 15.70 + 15.71 + long stop_hdmi() 15.72 + { 15.73 + _chip->stop_hdmi(); 15.74 + return L4_EOK; 15.75 + } 15.76 + 15.77 + long start_lcd() 15.78 + { 15.79 + _chip->start_lcd(); 15.80 + return L4_EOK; 15.81 + } 15.82 + 15.83 + long stop_lcd() 15.84 + { 15.85 + _chip->stop_lcd(); 15.86 + return L4_EOK; 15.87 + } 15.88 + 15.89 + long update_output_frequency() 15.90 + { 15.91 + _chip->update_output_frequency(); 15.92 + return L4_EOK; 15.93 + } 15.94 +}; 15.95 15.96 15.97 15.98 @@ -63,11 +120,14 @@ 15.99 15.100 /* Initialise and register a server object. */ 15.101 15.102 - Cpm_server server_obj(&cpm_device); 15.103 - server.registry()->register_obj(&server_obj, "cpm"); 15.104 + server_CPM obj(&cpm_device); 15.105 + l4_cap_idx_t server; 15.106 + 15.107 + if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 15.108 15.109 /* Enter the IPC server loop. */ 15.110 15.111 - server.loop(); 15.112 + ipc_server_loop(CPM_expected_items, &obj, 15.113 + (ipc_server_handler_type) handle_CPM); 15.114 return 0; 15.115 }
16.1 --- a/pkg/devices/cpm/src/server/Makefile Fri Jan 01 00:49:07 2021 +0100 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,13 +0,0 @@ 16.4 -PKGDIR ?= ../../.. 16.5 -L4DIR ?= $(PKGDIR)/../.. 16.6 - 16.7 -TARGET = libdevice_cpm_server.o.a libdevice_cpm_server.o.so 16.8 -PC_FILENAME := libdevice-cpm-server 16.9 - 16.10 -SRC_CC := cpm-server.cc 16.11 - 16.12 -PRIVATE_INCDIR += $(PKGDIR)/cpm/include 16.13 - 16.14 -REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-cpm 16.15 - 16.16 -include $(L4DIR)/mk/lib.mk
17.1 --- a/pkg/devices/cpm/src/server/cpm-server.cc Fri Jan 01 00:49:07 2021 +0100 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,87 +0,0 @@ 17.4 -/* 17.5 - * Common CPM server functionality. 17.6 - * 17.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 17.8 - * 17.9 - * This program is free software; you can redistribute it and/or 17.10 - * modify it under the terms of the GNU General Public License as 17.11 - * published by the Free Software Foundation; either version 2 of 17.12 - * the License, or (at your option) any later version. 17.13 - * 17.14 - * This program is distributed in the hope that it will be useful, 17.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 17.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17.17 - * GNU General Public License for more details. 17.18 - * 17.19 - * You should have received a copy of the GNU General Public License 17.20 - * along with this program; if not, write to the Free Software 17.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 17.22 - * Boston, MA 02110-1301, USA 17.23 - */ 17.24 - 17.25 -#include "cpm-client.h" 17.26 -#include "cpm-server.h" 17.27 -#include "cpm-ops.h" 17.28 - 17.29 -#include <l4/cxx/ipc_server> 17.30 -#include <l4/re/env> 17.31 -#include <l4/sys/typeinfo_svr> 17.32 -#include <l4/util/util.h> 17.33 - 17.34 -/* Handle invocations. */ 17.35 - 17.36 -int 17.37 -Cpm_server::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 17.38 -{ 17.39 - l4_msgtag_t tag; 17.40 - 17.41 - (void) obj; 17.42 - ios >> tag; 17.43 - 17.44 - switch (tag.label()) 17.45 - { 17.46 - case L4::Meta::Protocol: 17.47 - return L4::Util::handle_meta_request<Cpm_device_interface>(ios); 17.48 - 17.49 - case Cpm_op_get_lcd_pixel_frequency: 17.50 - ios << _chip->get_lcd_pixel_frequency(); 17.51 - return L4_EOK; 17.52 - 17.53 - case Cpm_op_set_hdmi_frequency: 17.54 - uint32_t frequency; 17.55 - ios >> frequency; 17.56 - _chip->set_hdmi_frequency(frequency); 17.57 - return L4_EOK; 17.58 - 17.59 - case Cpm_op_start_hdmi: 17.60 - _chip->start_hdmi(); 17.61 - return L4_EOK; 17.62 - 17.63 - case Cpm_op_stop_hdmi: 17.64 - _chip->stop_hdmi(); 17.65 - return L4_EOK; 17.66 - 17.67 - case Cpm_op_set_lcd_frequencies: 17.68 - uint32_t pclk; 17.69 - int multiplier; 17.70 - ios >> pclk; 17.71 - ios >> multiplier; 17.72 - _chip->set_lcd_frequencies(pclk, multiplier); 17.73 - return L4_EOK; 17.74 - 17.75 - case Cpm_op_start_lcd: 17.76 - _chip->start_lcd(); 17.77 - return L4_EOK; 17.78 - 17.79 - case Cpm_op_stop_lcd: 17.80 - _chip->stop_lcd(); 17.81 - return L4_EOK; 17.82 - 17.83 - case Cpm_op_update_output_frequency: 17.84 - _chip->update_output_frequency(); 17.85 - return L4_EOK; 17.86 - 17.87 - default: 17.88 - return -L4_EBADPROTO; 17.89 - } 17.90 -}
18.1 --- a/pkg/devices/display/Makefile Fri Jan 01 00:49:07 2021 +0100 18.2 +++ b/pkg/devices/display/Makefile Fri Jan 01 01:49:35 2021 +0100 18.3 @@ -1,8 +1,6 @@ 18.4 PKGDIR ?= .. 18.5 L4DIR ?= $(PKGDIR)/../.. 18.6 18.7 -TARGET := include src 18.8 +TARGET := src 18.9 18.10 include $(L4DIR)/mk/subdir.mk 18.11 - 18.12 -src: include
19.1 --- a/pkg/devices/display/include/Makefile Fri Jan 01 00:49:07 2021 +0100 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,6 +0,0 @@ 19.4 -PKGDIR = ../.. 19.5 -L4DIR ?= $(PKGDIR)/../.. 19.6 - 19.7 -PC_FILENAME := libdevice-display-ops 19.8 - 19.9 -include $(L4DIR)/mk/include.mk
20.1 --- a/pkg/devices/display/include/display-client.h Fri Jan 01 00:49:07 2021 +0100 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,40 +0,0 @@ 20.4 -/* 20.5 - * Display client to access display servers. 20.6 - * 20.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 20.8 - * 20.9 - * This program is free software; you can redistribute it and/or 20.10 - * modify it under the terms of the GNU General Public License as 20.11 - * published by the Free Software Foundation; either version 2 of 20.12 - * the License, or (at your option) any later version. 20.13 - * 20.14 - * This program is distributed in the hope that it will be useful, 20.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20.17 - * GNU General Public License for more details. 20.18 - * 20.19 - * You should have received a copy of the GNU General Public License 20.20 - * along with this program; if not, write to the Free Software 20.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 20.22 - * Boston, MA 02110-1301, USA 20.23 - */ 20.24 - 20.25 -#pragma once 20.26 - 20.27 -#ifdef __cplusplus 20.28 - 20.29 -#include <l4/re/env> 20.30 -#include "display-ops.h" 20.31 - 20.32 -#include <stdint.h> 20.33 - 20.34 -class Display_device_interface : public L4::Kobject_t<Display_device_interface, L4::Kobject> 20.35 -{ 20.36 - L4_KOBJECT(Display_device_interface) 20.37 - 20.38 -public: 20.39 - int disable() throw(); 20.40 - int enable() throw(); 20.41 -}; 20.42 - 20.43 -#endif
21.1 --- a/pkg/devices/display/include/display-ops.h Fri Jan 01 00:49:07 2021 +0100 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,24 +0,0 @@ 21.4 -/* 21.5 - * Display server operations. 21.6 - * 21.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 21.8 - * 21.9 - * This program is free software; you can redistribute it and/or 21.10 - * modify it under the terms of the GNU General Public License as 21.11 - * published by the Free Software Foundation; either version 2 of 21.12 - * the License, or (at your option) any later version. 21.13 - * 21.14 - * This program is distributed in the hope that it will be useful, 21.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 21.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21.17 - * GNU General Public License for more details. 21.18 - * 21.19 - * You should have received a copy of the GNU General Public License 21.20 - * along with this program; if not, write to the Free Software 21.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 21.22 - * Boston, MA 02110-1301, USA 21.23 - */ 21.24 - 21.25 -#pragma once 21.26 - 21.27 -enum { Display_op_disable, Display_op_enable };
22.1 --- a/pkg/devices/display/src/Makefile Fri Jan 01 00:49:07 2021 +0100 22.2 +++ b/pkg/devices/display/src/Makefile Fri Jan 01 01:49:35 2021 +0100 22.3 @@ -1,6 +1,6 @@ 22.4 PKGDIR ?= ../.. 22.5 L4DIR ?= $(PKGDIR)/../.. 22.6 22.7 -TARGET := ci20 client letux400 qi_lb60 22.8 +TARGET := ci20 letux400 qi_lb60 22.9 22.10 include $(L4DIR)/mk/subdir.mk
23.1 --- a/pkg/devices/display/src/ci20/Makefile Fri Jan 01 00:49:07 2021 +0100 23.2 +++ b/pkg/devices/display/src/ci20/Makefile Fri Jan 01 01:49:35 2021 +0100 23.3 @@ -3,12 +3,40 @@ 23.4 23.5 TARGET = dev_display_ci20_hdmi 23.6 MODE = shared 23.7 -PC_FILENAME := devices-display-ci20_hdmi 23.8 +PC_FILENAME = devices-display-ci20_hdmi 23.9 + 23.10 +# Locations for interface input and generated output. 23.11 23.12 -SRC_CC := display-ci20_hdmi.cc 23.13 +IDL_DIR = $(PKGDIR)/idl 23.14 +IDL_MK_DIR = $(L4DIR)/idl4re/mk 23.15 +IDL_BUILD_DIR = . 23.16 +IDL_EXPORT_DIR = . 23.17 + 23.18 +include $(IDL_MK_DIR)/idl.mk 23.19 + 23.20 +# Individual interfaces. 23.21 + 23.22 +CLIENT_INTERFACES_CC = cpm icu 23.23 23.24 -PRIVATE_INCDIR += $(PKGDIR)/display/include 23.25 +SERVER_INTERFACES_CC = activation 23.26 + 23.27 +# Generated and plain source files. 23.28 + 23.29 +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) 23.30 + 23.31 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 23.32 23.33 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-cpm-client libdrivers-hdmi-jz4780 libdrivers-lcd-jz4740 libdrivers-panel-loader libdevice-util 23.34 +PLAIN_SRC_CC = display-ci20_hdmi.cc 23.35 + 23.36 +# Normal definitions. 23.37 + 23.38 +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) 23.39 + 23.40 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-hdmi-jz4780 libdrivers-lcd-jz4740 libdrivers-panel-loader libdevice-util libipc 23.41 + 23.42 +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) 23.43 23.44 include $(L4DIR)/mk/prog.mk 23.45 +include $(IDL_MK_DIR)/interface_rules.mk 23.46 + 23.47 +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC)
24.1 --- a/pkg/devices/display/src/ci20/display-ci20_hdmi.cc Fri Jan 01 00:49:07 2021 +0100 24.2 +++ b/pkg/devices/display/src/ci20/display-ci20_hdmi.cc Fri Jan 01 01:49:35 2021 +0100 24.3 @@ -19,33 +19,30 @@ 24.4 * Boston, MA 02110-1301, USA 24.5 */ 24.6 24.7 -#include <l4/devices/cpm-client.h> 24.8 #include <l4/devices/hdmi-jz4780.h> 24.9 #include <l4/devices/lcd-jz4740-config.h> 24.10 #include <l4/devices/lcd-jz4740-panel.h> 24.11 #include <l4/devices/panel-loader.h> 24.12 #include <l4/devices/memory.h> 24.13 24.14 -#include <l4/cxx/ipc_server> 24.15 -#include <l4/re/env> 24.16 -#include <l4/re/util/object_registry> 24.17 -#include <l4/sys/capability> 24.18 -#include <l4/sys/factory> 24.19 -#include <l4/sys/icu.h> 24.20 +#include <l4/re/env.h> 24.21 24.22 -#include "display-ops.h" 24.23 +#include <ipc/irq.h> 24.24 +#include <ipc/server.h> 24.25 +#include "activation_server.h" 24.26 +#include "cpm_client.h" 24.27 +#include "icu_client.h" 24.28 24.29 /* Virtual addresses for the HDMI register block plus interrupt capability. */ 24.30 24.31 static l4_addr_t hdmi_virt_base = 0, hdmi_virt_base_end = 0; 24.32 static l4_uint32_t hdmi_irq_start, hdmi_irq_end; 24.33 -static L4::Cap<L4::Irq> hdmi_irq; 24.34 -static L4::Cap<L4::Icu> icu; 24.35 +static l4_cap_idx_t hdmi_irq, icu; 24.36 24.37 -/* CPM device abstractions. */ 24.38 +/* Device abstractions. */ 24.39 24.40 static Hdmi_jz4780_chip *hdmi = 0; 24.41 -static L4::Cap<Cpm_device_interface> cpm_device; 24.42 +static CPM *cpm_device; 24.43 24.44 24.45 24.46 @@ -59,8 +56,11 @@ 24.47 24.48 /* Obtain a reference to the CPM device. */ 24.49 24.50 - cpm_device = L4Re::Env::env()->get_cap<Cpm_device_interface>("cpm"); 24.51 - if (!cpm_device.is_valid()) return 1; 24.52 + l4_cap_idx_t cpm = l4re_env_get_cap("cpm"); 24.53 + if (!l4_is_valid_cap(cpm)) return 1; 24.54 + 24.55 + static client_CPM cpm_obj(cpm); 24.56 + cpm_device = &cpm_obj; 24.57 24.58 /* Start the HDMI peripheral. */ 24.59 24.60 @@ -75,23 +75,24 @@ 24.61 24.62 /* Obtain access to the HDMI interrupt using the ICU. */ 24.63 24.64 - icu = L4Re::Env::env()->get_cap<L4::Icu>("icu"); 24.65 + icu = l4re_env_get_cap("icu"); 24.66 + if (!l4_is_valid_cap(icu)) return 1; 24.67 24.68 - hdmi_irq = L4Re::Util::cap_alloc.alloc<L4::Irq>(); 24.69 - L4Re::Env::env()->factory()->create(hdmi_irq); 24.70 - 24.71 - if (!hdmi_irq.is_valid() || !icu.is_valid()) return 1; 24.72 + if (ipc_create_irq(&hdmi_irq)) return 1; 24.73 24.74 /* Bind the IRQ object to the interrupt in this thread. */ 24.75 24.76 - int err = l4_error(icu->bind(hdmi_irq_start, hdmi_irq)); 24.77 + client_ICU icu_obj(icu); 24.78 + 24.79 + long err = icu_obj.bind(hdmi_irq_start, hdmi_irq); 24.80 if (err) return err; 24.81 24.82 - hdmi_irq->bind_thread(L4Re::Env::env()->main_thread(), 0); 24.83 + err = ipc_bind_irq(hdmi_irq, 0, l4re_env()->main_thread); 24.84 + if (err) return err; 24.85 24.86 /* Obtain an abstraction for the HDMI peripheral. */ 24.87 24.88 - hdmi = new Hdmi_jz4780_chip(hdmi_virt_base, hdmi_virt_base_end, hdmi_irq.cap(), panel); 24.89 + hdmi = new Hdmi_jz4780_chip(hdmi_virt_base, hdmi_virt_base_end, hdmi_irq, panel); 24.90 24.91 return 0; 24.92 } 24.93 @@ -100,56 +101,33 @@ 24.94 24.95 /* Display device. */ 24.96 24.97 -class Display_device_server : public L4::Server_object_t<L4::Kobject> 24.98 +class server_DisplayObject : public Activation 24.99 { 24.100 public: 24.101 - /* Dispatch incoming requests. */ 24.102 - 24.103 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 24.104 - { 24.105 - l4_msgtag_t tag; 24.106 - 24.107 - (void) obj; 24.108 - ios >> tag; 24.109 - 24.110 - switch (tag.label()) 24.111 - { 24.112 - case Display_op_disable: 24.113 - disable(); 24.114 - return L4_EOK; 24.115 - 24.116 - case Display_op_enable: 24.117 - enable(); 24.118 - return L4_EOK; 24.119 - 24.120 - default: 24.121 - return -L4_EBADPROTO; 24.122 - } 24.123 - } 24.124 - 24.125 /* Switch the display off. */ 24.126 24.127 - void disable(void) 24.128 + long disable(void) 24.129 { 24.130 + return L4_EOK; 24.131 } 24.132 24.133 /* Switch the display on. */ 24.134 24.135 - void enable(void) 24.136 + long enable(void) 24.137 { 24.138 uint32_t frequency; 24.139 24.140 // NOTE: Should test to see if it is connected. 24.141 24.142 - if (!cpm_device->get_lcd_pixel_frequency(&frequency)) 24.143 + if (!cpm_device->get_lcd_pixel_frequency(0, &frequency)) 24.144 { 24.145 hdmi->enable(frequency); 24.146 } 24.147 + 24.148 + return L4_EOK; 24.149 } 24.150 }; 24.151 24.152 -static L4Re::Util::Registry_server<> server; 24.153 - 24.154 24.155 24.156 int main(void) 24.157 @@ -158,11 +136,14 @@ 24.158 24.159 /* Initialise and register a new server object. */ 24.160 24.161 - Display_device_server server_obj; 24.162 - server.registry()->register_obj(&server_obj, "display"); 24.163 + server_DisplayObject obj; 24.164 + l4_cap_idx_t server; 24.165 + 24.166 + if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1; 24.167 24.168 /* Enter the IPC server loop. */ 24.169 24.170 - server.loop(); 24.171 + ipc_server_loop(Activation_expected_items, &obj, 24.172 + (ipc_server_handler_type) handle_Activation); 24.173 return 0; 24.174 }
25.1 --- a/pkg/devices/display/src/client/Makefile Fri Jan 01 00:49:07 2021 +0100 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,13 +0,0 @@ 25.4 -PKGDIR ?= ../../.. 25.5 -L4DIR ?= $(PKGDIR)/../.. 25.6 - 25.7 -TARGET = libdevice_display_client.o.a libdevice_display_client.o.so 25.8 -PC_FILENAME := libdevice-display-client 25.9 - 25.10 -SRC_CC := display-client.cc 25.11 - 25.12 -PRIVATE_INCDIR += $(PKGDIR)/display/include 25.13 - 25.14 -REQUIRES_LIBS := l4re_c l4re_c-util 25.15 - 25.16 -include $(L4DIR)/mk/lib.mk
26.1 --- a/pkg/devices/display/src/client/display-client.cc Fri Jan 01 00:49:07 2021 +0100 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,44 +0,0 @@ 26.4 -/* 26.5 - * Display client to access display servers. 26.6 - * 26.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 26.8 - * 26.9 - * This program is free software; you can redistribute it and/or 26.10 - * modify it under the terms of the GNU General Public License as 26.11 - * published by the Free Software Foundation; either version 2 of 26.12 - * the License, or (at your option) any later version. 26.13 - * 26.14 - * This program is distributed in the hope that it will be useful, 26.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 26.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26.17 - * GNU General Public License for more details. 26.18 - * 26.19 - * You should have received a copy of the GNU General Public License 26.20 - * along with this program; if not, write to the Free Software 26.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 26.22 - * Boston, MA 02110-1301, USA 26.23 - */ 26.24 - 26.25 -#include <l4/cxx/ipc_stream> 26.26 -#include <l4/re/env> 26.27 -#include <l4/sys/err.h> 26.28 - 26.29 -#include "display-client.h" 26.30 - 26.31 -#include <stdint.h> 26.32 - 26.33 -int 26.34 -Display_device_interface::disable() throw() 26.35 -{ 26.36 - L4::Ipc::Iostream s(l4_utcb()); 26.37 - 26.38 - return l4_error(s.call(cap(), Display_op_disable)); 26.39 -} 26.40 - 26.41 -int 26.42 -Display_device_interface::enable() throw() 26.43 -{ 26.44 - L4::Ipc::Iostream s(l4_utcb()); 26.45 - 26.46 - return l4_error(s.call(cap(), Display_op_enable)); 26.47 -}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/pkg/devices/idl/cpm.idl Fri Jan 01 01:49:35 2021 +0100 27.3 @@ -0,0 +1,25 @@ 27.4 +#include <l4/devices/protocols.h> 27.5 +#include <stdint.h> 27.6 + 27.7 +/* A clock and power management interface, currently with Ingenic-specific SoC 27.8 + details. */ 27.9 + 27.10 +[protocol(LANDFALL_CPM)] 27.11 +interface CPM 27.12 +{ 27.13 + void get_lcd_pixel_frequency(in uint8_t controller, out uint32_t frequency); 27.14 + 27.15 + void set_hdmi_frequency(in uint32_t frequency); 27.16 + 27.17 + void set_lcd_frequencies(in uint32_t pclk, in uint8_t multiplier); 27.18 + 27.19 + void start_hdmi(); 27.20 + 27.21 + void stop_hdmi(); 27.22 + 27.23 + void start_lcd(); 27.24 + 27.25 + void stop_lcd(); 27.26 + 27.27 + void update_output_frequency(); 27.28 +};
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/pkg/devices/idl/icu.idl Fri Jan 01 01:49:35 2021 +0100 28.3 @@ -0,0 +1,9 @@ 28.4 +#include <l4/sys/icu.h> 28.5 + 28.6 +/* An interrupt controller interface. */ 28.7 + 28.8 +[protocol(L4_PROTO_IRQ)] 28.9 +interface ICU 28.10 +{ 28.11 + [opcode(L4_ICU_OP_BIND)] void bind(in int num, in cap irq); 28.12 +};
29.1 --- a/pkg/devices/include/protocols.h Fri Jan 01 00:49:07 2021 +0100 29.2 +++ b/pkg/devices/include/protocols.h Fri Jan 01 01:49:35 2021 +0100 29.3 @@ -23,5 +23,8 @@ 29.4 29.5 #define LANDFALL_ACTIVATION 0x1f01 29.6 #define LANDFALL_BACKLIGHT 0x1f02 29.7 +#define LANDFALL_CPM 0x1f03 29.8 #define LANDFALL_PWM 0x1f10 29.9 #define LANDFALL_SPI 0x1f13 29.10 + 29.11 +// vim: tabstop=2 expandtab shiftwidth=2
30.1 --- a/pkg/devices/lcd/include/lcd-device.h Fri Jan 01 00:49:07 2021 +0100 30.2 +++ b/pkg/devices/lcd/include/lcd-device.h Fri Jan 01 01:49:35 2021 +0100 30.3 @@ -21,7 +21,7 @@ 30.4 30.5 #pragma once 30.6 30.7 -#include <l4/devices/activation/activation_interface.h> 30.8 +#include <l4/devices/lcd/activation_interface.h> 30.9 #include <l4/devices/lcd.h> 30.10 30.11 #include <l4/re/c/video/view.h>
31.1 --- a/pkg/devices/lcd/src/common/Makefile Fri Jan 01 00:49:07 2021 +0100 31.2 +++ b/pkg/devices/lcd/src/common/Makefile Fri Jan 01 01:49:35 2021 +0100 31.3 @@ -9,7 +9,7 @@ 31.4 IDL_DIR = $(PKGDIR)/idl 31.5 IDL_MK_DIR = $(L4DIR)/idl4re/mk 31.6 IDL_BUILD_DIR = . 31.7 -IDL_EXPORT_DIR = $(OBJ_BASE)/include/l4/devices/activation 31.8 +IDL_EXPORT_DIR = $(OBJ_BASE)/include/l4/devices/lcd 31.9 31.10 include $(IDL_MK_DIR)/idl.mk 31.11
32.1 --- a/pkg/devices/lcd/src/jz4740/Makefile Fri Jan 01 00:49:07 2021 +0100 32.2 +++ b/pkg/devices/lcd/src/jz4740/Makefile Fri Jan 01 01:49:35 2021 +0100 32.3 @@ -9,13 +9,13 @@ 32.4 IDL_DIR = $(PKGDIR)/idl 32.5 IDL_MK_DIR = $(L4DIR)/idl4re/mk 32.6 IDL_BUILD_DIR = . 32.7 -IDL_EXPORT_DIR = $(OBJ_BASE)/include/l4/devices/activation 32.8 +IDL_EXPORT_DIR = $(OBJ_BASE)/include/l4/devices/lcd 32.9 32.10 include $(IDL_MK_DIR)/idl.mk 32.11 32.12 # Individual interfaces. 32.13 32.14 -CLIENT_INTERFACES_CC = activation 32.15 +CLIENT_INTERFACES_CC = activation cpm 32.16 32.17 # Generated and plain source files. 32.18 32.19 @@ -29,7 +29,6 @@ 32.20 32.21 REQUIRES_LIBS = \ 32.22 l4re_c l4re_c-util \ 32.23 - libdevice-cpm-client \ 32.24 libdevice-lcd libdrivers-lcd-jz4740 libdrivers-panel-loader \ 32.25 libdevice-util libipc 32.26
33.1 --- a/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jan 01 00:49:07 2021 +0100 33.2 +++ b/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Fri Jan 01 01:49:35 2021 +0100 33.3 @@ -19,7 +19,6 @@ 33.4 * Boston, MA 02110-1301, USA 33.5 */ 33.6 33.7 -#include <l4/devices/cpm-client.h> 33.8 #include <l4/devices/lcd-jz4740.h> 33.9 #include <l4/devices/lcd-jz4780.h> 33.10 #include <l4/devices/panel-loader.h> 33.11 @@ -37,6 +36,7 @@ 33.12 #include <stdint.h> 33.13 33.14 #include "activation_client.h" 33.15 +#include "cpm_client.h" 33.16 33.17 // Virtual addresses for the LCD register block. 33.18 33.19 @@ -46,8 +46,8 @@ 33.20 33.21 static Lcd_jz4740_chip *lcd_chip = 0; 33.22 33.23 -static L4::Cap<Cpm_device_interface> cpm_device; 33.24 static Activation *display_device; 33.25 +static CPM *cpm_device; 33.26 33.27 33.28 33.29 @@ -265,8 +265,8 @@ 33.30 33.31 // Obtain access to the CPM and display devices. 33.32 33.33 - cpm_device = L4Re::Env::env()->get_cap<Cpm_device_interface>("cpm"); 33.34 - if (!cpm_device.is_valid()) return 1; 33.35 + l4_cap_idx_t cpm = l4re_env_get_cap("cpm"); 33.36 + if (!l4_is_valid_cap(cpm)) return 1; 33.37 33.38 l4_cap_idx_t display = l4re_env_get_cap("display"); 33.39 if (!l4_is_valid_cap(display)) return 1; 33.40 @@ -274,6 +274,9 @@ 33.41 static client_Activation display_obj(display); 33.42 display_device = &display_obj; 33.43 33.44 + static client_CPM cpm_obj(cpm); 33.45 + cpm_device = &cpm_obj; 33.46 + 33.47 // Load the panel data from the configured library. 33.48 33.49 struct Jz4740_lcd_panel *panel = (struct Jz4740_lcd_panel *) load_panel();