1.1 --- a/pkg/devices/backlight/src/pwm/Makefile Sat Jun 10 23:59:44 2023 +0200 1.2 +++ b/pkg/devices/backlight/src/pwm/Makefile Sun Jun 11 15:42:11 2023 +0200 1.3 @@ -14,24 +14,17 @@ 1.4 1.5 include $(IDL_MK_DIR)/idl.mk 1.6 1.7 -# Compound interface definitions. 1.8 - 1.9 -backlight_object_NAME = BacklightObject 1.10 -backlight_object_INTERFACES = activation backlight 1.11 - 1.12 -COMP_INTERFACES_CC = backlight_object 1.13 - 1.14 # Individual interfaces. 1.15 1.16 CLIENT_INTERFACES_CC = activation pwm 1.17 1.18 -SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC)) 1.19 +SERVER_INTERFACES_CC = backlight_object 1.20 1.21 # Generated and plain source files. 1.22 1.23 CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) 1.24 1.25 -SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC)) 1.26 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 1.27 1.28 PLAIN_SRC_CC = backlight-pwm.cc 1.29
2.1 --- a/pkg/devices/backlight/src/pwm/backlight-pwm.cc Sat Jun 10 23:59:44 2023 +0200 2.2 +++ b/pkg/devices/backlight/src/pwm/backlight-pwm.cc Sun Jun 11 15:42:11 2023 +0200 2.3 @@ -1,7 +1,7 @@ 2.4 /* 2.5 * Access a PWM server to update a display panel backlight. 2.6 * 2.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 2.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 2.9 * 2.10 * This program is free software; you can redistribute it and/or 2.11 * modify it under the terms of the GNU General Public License as 2.12 @@ -24,6 +24,7 @@ 2.13 #include <stdlib.h> 2.14 2.15 #include <ipc/server.h> 2.16 + 2.17 #include "backlight_object_server.h" 2.18 #include "activation_client.h" 2.19 #include "pwm_client.h" 2.20 @@ -32,14 +33,14 @@ 2.21 2.22 /* Backlight device. */ 2.23 2.24 -class server_BacklightObject : public BacklightObject 2.25 +class BacklightObject_server : public BacklightObject 2.26 { 2.27 Activation *_activation; 2.28 PWM *_pwm; 2.29 int _min, _max; 2.30 2.31 public: 2.32 - explicit server_BacklightObject(Activation *activation, PWM *pwm, 2.33 + explicit BacklightObject_server(Activation *activation, PWM *pwm, 2.34 int min, int max) 2.35 : _activation(activation), _pwm(pwm), _min(min), _max(max) 2.36 { 2.37 @@ -84,7 +85,9 @@ 2.38 /* Obtain a reference to the PWM device. */ 2.39 2.40 l4_cap_idx_t pwm = l4re_env_get_cap("pwm"); 2.41 - if (!l4_is_valid_cap(pwm)) return 1; 2.42 + 2.43 + if (!l4_is_valid_cap(pwm)) 2.44 + return 1; 2.45 2.46 client_Activation activation_obj(pwm); 2.47 client_PWM pwm_obj(pwm); 2.48 @@ -94,14 +97,12 @@ 2.49 min = atoi(argv[1]); 2.50 max = atoi(argv[2]); 2.51 2.52 - server_BacklightObject obj(&activation_obj, &pwm_obj, min, max); 2.53 - l4_cap_idx_t server; 2.54 + BacklightObject_server obj(&activation_obj, &pwm_obj, min, max); 2.55 2.56 - if (ipc_server_bind("backlight", (l4_umword_t) &obj, &server)) return 1; 2.57 + /* Bind and start the IPC server loop. */ 2.58 2.59 - /* Enter the IPC server loop. */ 2.60 + if (ipc_server_loop_for(BacklightObject, &obj, "backlight")) 2.61 + return 1; 2.62 2.63 - ipc_server_loop(BacklightObject_expected_items, &obj, 2.64 - (ipc_server_handler_type) handle_BacklightObject); 2.65 return 0; 2.66 }
3.1 --- a/pkg/devices/backlight/src/spi-ili8960/Makefile Sat Jun 10 23:59:44 2023 +0200 3.2 +++ b/pkg/devices/backlight/src/spi-ili8960/Makefile Sun Jun 11 15:42:11 2023 +0200 3.3 @@ -14,24 +14,17 @@ 3.4 3.5 include $(IDL_MK_DIR)/idl.mk 3.6 3.7 -# Compound interface definitions. 3.8 - 3.9 -backlight_object_NAME = BacklightObject 3.10 -backlight_object_INTERFACES = activation backlight 3.11 - 3.12 -COMP_INTERFACES_CC = backlight_object 3.13 - 3.14 # Individual interfaces. 3.15 3.16 CLIENT_INTERFACES_CC = spi 3.17 3.18 -SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC)) 3.19 +SERVER_INTERFACES_CC = backlight_object 3.20 3.21 # Generated and plain source files. 3.22 3.23 CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) 3.24 3.25 -SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC)) 3.26 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 3.27 3.28 PLAIN_SRC_CC = backlight-spi-ili8960.cc 3.29
4.1 --- a/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Sat Jun 10 23:59:44 2023 +0200 4.2 +++ b/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Sun Jun 11 15:42:11 2023 +0200 4.3 @@ -5,7 +5,7 @@ 4.4 * the Giantplus GPM940B0 panel datasheet also describes this controller 4.5 * interface. 4.6 * 4.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 4.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 4.9 * 4.10 * This program is free software; you can redistribute it and/or 4.11 * modify it under the terms of the GNU General Public License as 4.12 @@ -26,6 +26,7 @@ 4.13 #include <l4/re/env.h> 4.14 4.15 #include <ipc/server.h> 4.16 + 4.17 #include "backlight_object_server.h" 4.18 #include "spi_client.h" 4.19 4.20 @@ -33,7 +34,7 @@ 4.21 4.22 /* Backlight device. */ 4.23 4.24 -class server_BacklightObject : public BacklightObject 4.25 +class BacklightObject_server : public BacklightObject 4.26 { 4.27 SPI *_spi; 4.28 int _min = 55, _max = 90, _start = 70; 4.29 @@ -54,7 +55,7 @@ 4.30 } 4.31 4.32 public: 4.33 - explicit server_BacklightObject(SPI *spi) 4.34 + explicit BacklightObject_server(SPI *spi) 4.35 : _spi(spi) 4.36 { 4.37 } 4.38 @@ -92,20 +93,20 @@ 4.39 /* Obtain a reference to the SPI device. */ 4.40 4.41 l4_cap_idx_t spi = l4re_env_get_cap("spi"); 4.42 - if (!l4_is_valid_cap(spi)) return 1; 4.43 + 4.44 + if (!l4_is_valid_cap(spi)) 4.45 + return 1; 4.46 4.47 client_SPI spi_obj(spi); 4.48 4.49 /* Initialise and register a new server object. */ 4.50 4.51 - server_BacklightObject obj(&spi_obj); 4.52 - l4_cap_idx_t server; 4.53 + BacklightObject_server obj(&spi_obj); 4.54 4.55 - if (ipc_server_bind("backlight", (l4_umword_t) &obj, &server)) return 1; 4.56 + /* Bind and start the IPC server loop. */ 4.57 4.58 - /* Enter the IPC server loop. */ 4.59 + if (ipc_server_loop_for(BacklightObject, &obj, "backlight")) 4.60 + return 1; 4.61 4.62 - ipc_server_loop(BacklightObject_expected_items, &obj, 4.63 - (ipc_server_handler_type) handle_BacklightObject); 4.64 return 0; 4.65 }
5.1 --- a/pkg/devices/cpm/src/jz4730/cpm-jz4730.cc Sat Jun 10 23:59:44 2023 +0200 5.2 +++ b/pkg/devices/cpm/src/jz4730/cpm-jz4730.cc Sun Jun 11 15:42:11 2023 +0200 5.3 @@ -1,7 +1,7 @@ 5.4 /* 5.5 * JZ4730 CPM server. 5.6 * 5.7 - * Copyright (C) 2018, 2020, 2021 Paul Boddie <paul@boddie.org.uk> 5.8 + * Copyright (C) 2018, 2020, 2021, 2023 Paul Boddie <paul@boddie.org.uk> 5.9 * 5.10 * This program is free software; you can redistribute it and/or 5.11 * modify it under the terms of the GNU General Public License as 5.12 @@ -25,6 +25,7 @@ 5.13 #include <l4/re/env.h> 5.14 5.15 #include <ipc/server.h> 5.16 + 5.17 #include "cpm_server.h" 5.18 5.19 /* Virtual addresses for the CPM and LCD register blocks. */ 5.20 @@ -47,12 +48,12 @@ 5.21 5.22 /* CPM server. */ 5.23 5.24 -class server_CPM : public CPM 5.25 +class CPM_server : public CPM 5.26 { 5.27 Cpm_jz4730_chip *_chip; 5.28 5.29 public: 5.30 - explicit server_CPM(Cpm_jz4730_chip *chip) 5.31 + explicit CPM_server(Cpm_jz4730_chip *chip) 5.32 : _chip(chip) 5.33 { 5.34 } 5.35 @@ -94,7 +95,8 @@ 5.36 5.37 int main(void) 5.38 { 5.39 - if (setup_memory()) return 1; 5.40 + if (setup_memory()) 5.41 + return 1; 5.42 5.43 /* Initialise the CPM abstraction. */ 5.44 5.45 @@ -102,14 +104,12 @@ 5.46 5.47 /* Initialise and register a server object. */ 5.48 5.49 - server_CPM obj(&cpm_device); 5.50 - l4_cap_idx_t server; 5.51 + CPM_server obj(&cpm_device); 5.52 5.53 - if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 5.54 + /* Bind and start the IPC server loop. */ 5.55 5.56 - /* Enter the IPC server loop. */ 5.57 + if (ipc_server_loop_for(CPM, &obj, "cpm")) 5.58 + return 1; 5.59 5.60 - ipc_server_loop(CPM_expected_items, &obj, 5.61 - (ipc_server_handler_type) handle_CPM); 5.62 return 0; 5.63 }
6.1 --- a/pkg/devices/cpm/src/jz4740/cpm-jz4740.cc Sat Jun 10 23:59:44 2023 +0200 6.2 +++ b/pkg/devices/cpm/src/jz4740/cpm-jz4740.cc Sun Jun 11 15:42:11 2023 +0200 6.3 @@ -1,7 +1,7 @@ 6.4 /* 6.5 * JZ4740 CPM server. 6.6 * 6.7 - * Copyright (C) 2018, 2020, 2021 Paul Boddie <paul@boddie.org.uk> 6.8 + * Copyright (C) 2018, 2020, 2021, 2023 Paul Boddie <paul@boddie.org.uk> 6.9 * 6.10 * This program is free software; you can redistribute it and/or 6.11 * modify it under the terms of the GNU General Public License as 6.12 @@ -25,6 +25,7 @@ 6.13 #include <l4/re/env.h> 6.14 6.15 #include <ipc/server.h> 6.16 + 6.17 #include "cpm_server.h" 6.18 6.19 // Virtual addresses for the CPM and LCD register blocks. 6.20 @@ -47,12 +48,12 @@ 6.21 6.22 /* CPM server. */ 6.23 6.24 -class server_CPM : public CPM 6.25 +class CPM_server : public CPM 6.26 { 6.27 Cpm_jz4740_chip *_chip; 6.28 6.29 public: 6.30 - explicit server_CPM(Cpm_jz4740_chip *chip) 6.31 + explicit CPM_server(Cpm_jz4740_chip *chip) 6.32 : _chip(chip) 6.33 { 6.34 } 6.35 @@ -94,7 +95,8 @@ 6.36 6.37 int main(void) 6.38 { 6.39 - if (setup_memory()) return 1; 6.40 + if (setup_memory()) 6.41 + return 1; 6.42 6.43 /* Initialise the CPM abstraction. */ 6.44 6.45 @@ -102,14 +104,12 @@ 6.46 6.47 /* Initialise and register a server object. */ 6.48 6.49 - server_CPM obj(&cpm_device); 6.50 - l4_cap_idx_t server; 6.51 + CPM_server obj(&cpm_device); 6.52 6.53 - if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 6.54 + /* Bind and start the IPC server loop. */ 6.55 6.56 - /* Enter the IPC server loop. */ 6.57 - 6.58 - ipc_server_loop(CPM_expected_items, &obj, 6.59 - (ipc_server_handler_type) handle_CPM); 6.60 + if (ipc_server_loop_for(CPM, &obj, "cpm")) 6.61 + return 1; 6.62 + 6.63 return 0; 6.64 }
7.1 --- a/pkg/devices/cpm/src/jz4780/cpm-jz4780.cc Sat Jun 10 23:59:44 2023 +0200 7.2 +++ b/pkg/devices/cpm/src/jz4780/cpm-jz4780.cc Sun Jun 11 15:42:11 2023 +0200 7.3 @@ -1,7 +1,7 @@ 7.4 /* 7.5 * JZ4780 CPM server. 7.6 * 7.7 - * Copyright (C) 2018, 2020, 2021 Paul Boddie <paul@boddie.org.uk> 7.8 + * Copyright (C) 2018, 2020, 2021, 2023 Paul Boddie <paul@boddie.org.uk> 7.9 * 7.10 * This program is free software; you can redistribute it and/or 7.11 * modify it under the terms of the GNU General Public License as 7.12 @@ -25,6 +25,7 @@ 7.13 #include <l4/re/env.h> 7.14 7.15 #include <ipc/server.h> 7.16 + 7.17 #include "cpm_server.h" 7.18 7.19 // Virtual addresses for the CPM and LCD register blocks. 7.20 @@ -47,12 +48,12 @@ 7.21 7.22 /* CPM server. */ 7.23 7.24 -class server_CPM : public CPM 7.25 +class CPM_server : public CPM 7.26 { 7.27 Cpm_jz4780_chip *_chip; 7.28 7.29 public: 7.30 - explicit server_CPM(Cpm_jz4780_chip *chip) 7.31 + explicit CPM_server(Cpm_jz4780_chip *chip) 7.32 : _chip(chip) 7.33 { 7.34 } 7.35 @@ -100,7 +101,8 @@ 7.36 7.37 int main(void) 7.38 { 7.39 - if (setup_memory()) return 1; 7.40 + if (setup_memory()) 7.41 + return 1; 7.42 7.43 /* Initialise the CPM abstraction. */ 7.44 7.45 @@ -108,14 +110,12 @@ 7.46 7.47 /* Initialise and register a server object. */ 7.48 7.49 - server_CPM obj(&cpm_device); 7.50 - l4_cap_idx_t server; 7.51 + CPM_server obj(&cpm_device); 7.52 7.53 - if (ipc_server_bind("cpm", (l4_umword_t) &obj, &server)) return 1; 7.54 + /* Bind and start the IPC server loop. */ 7.55 7.56 - /* Enter the IPC server loop. */ 7.57 + if (ipc_server_loop_for(CPM, &obj, "cpm")) 7.58 + return 1; 7.59 7.60 - ipc_server_loop(CPM_expected_items, &obj, 7.61 - (ipc_server_handler_type) handle_CPM); 7.62 return 0; 7.63 }
8.1 --- a/pkg/devices/display/src/ci20/display-ci20_hdmi.cc Sat Jun 10 23:59:44 2023 +0200 8.2 +++ b/pkg/devices/display/src/ci20/display-ci20_hdmi.cc Sun Jun 11 15:42:11 2023 +0200 8.3 @@ -1,7 +1,7 @@ 8.4 /* 8.5 * Export MIPS Creator CI20 HDMI display operations as a server. 8.6 * 8.7 - * Copyright (C) 2018, 2020, 2021 Paul Boddie <paul@boddie.org.uk> 8.8 + * Copyright (C) 2018, 2020, 2021, 2023 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 @@ -29,10 +29,13 @@ 8.13 8.14 #include <ipc/irq.h> 8.15 #include <ipc/server.h> 8.16 + 8.17 #include "activation_server.h" 8.18 #include "cpm_client.h" 8.19 #include "icu_client.h" 8.20 8.21 + 8.22 + 8.23 /* Virtual addresses for the HDMI register block plus interrupt capability. */ 8.24 8.25 static l4_addr_t hdmi_virt_base = 0, hdmi_virt_base_end = 0; 8.26 @@ -101,7 +104,7 @@ 8.27 8.28 /* Display device. */ 8.29 8.30 -class server_DisplayObject : public Activation 8.31 +class DisplayObject_server : public Activation 8.32 { 8.33 public: 8.34 /* Switch the display off. */ 8.35 @@ -132,18 +135,17 @@ 8.36 8.37 int main(void) 8.38 { 8.39 - if (setup_memory()) return 1; 8.40 + if (setup_memory()) 8.41 + return 1; 8.42 8.43 /* Initialise and register a new server object. */ 8.44 8.45 - server_DisplayObject obj; 8.46 - l4_cap_idx_t server; 8.47 + DisplayObject_server obj; 8.48 8.49 - if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1; 8.50 + /* Bind and start the IPC server loop. */ 8.51 8.52 - /* Enter the IPC server loop. */ 8.53 + if (ipc_server_loop_for(Activation, &obj, "display")) 8.54 + return 1; 8.55 8.56 - ipc_server_loop(Activation_expected_items, &obj, 8.57 - (ipc_server_handler_type) handle_Activation); 8.58 return 0; 8.59 }
9.1 --- a/pkg/devices/display/src/letux400/display-letux400.cc Sat Jun 10 23:59:44 2023 +0200 9.2 +++ b/pkg/devices/display/src/letux400/display-letux400.cc Sun Jun 11 15:42:11 2023 +0200 9.3 @@ -1,7 +1,7 @@ 9.4 /* 9.5 * Export Letux 400 display operations as a server. 9.6 * 9.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 9.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 9.9 * 9.10 * This program is free software; you can redistribute it and/or 9.11 * modify it under the terms of the GNU General Public License as 9.12 @@ -25,9 +25,12 @@ 9.13 #include <l4/re/env.h> 9.14 9.15 #include <ipc/server.h> 9.16 + 9.17 #include "activation_client.h" 9.18 #include "activation_server.h" 9.19 9.20 + 9.21 + 9.22 /* Virtual address for the GPIO register block. */ 9.23 9.24 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0; 9.25 @@ -66,7 +69,7 @@ 9.26 9.27 /* Display device only implementing the activation interface. */ 9.28 9.29 -class server_DisplayObject : public Activation 9.30 +class DisplayObject_server : public Activation 9.31 { 9.32 Pin_slice lcd_mask1 = {.offset=0, .mask=Jz4730_lcd_gpio_func1}; 9.33 Pin_slice lcd_mask2 = {.offset=0, .mask=Jz4730_lcd_gpio_func2}; 9.34 @@ -74,7 +77,7 @@ 9.35 Activation *_backlight; 9.36 9.37 public: 9.38 - explicit server_DisplayObject(Activation *backlight) 9.39 + explicit DisplayObject_server(Activation *backlight) 9.40 : _backlight(backlight) 9.41 { 9.42 /* Set functions for the LCD pins. */ 9.43 @@ -111,7 +114,8 @@ 9.44 9.45 int main(void) 9.46 { 9.47 - if (setup_memory()) return 1; 9.48 + if (setup_memory()) 9.49 + return 1; 9.50 9.51 /* Initialise the GPIO abstractions. */ 9.52 9.53 @@ -124,7 +128,9 @@ 9.54 /* Obtain a reference to the backlight device. */ 9.55 9.56 l4_cap_idx_t backlight = l4re_env_get_cap("backlight"); 9.57 - if (!l4_is_valid_cap(backlight)) return 1; 9.58 + 9.59 + if (!l4_is_valid_cap(backlight)) 9.60 + return 1; 9.61 9.62 /* Use the activation interface with the backlight. */ 9.63 9.64 @@ -132,14 +138,12 @@ 9.65 9.66 /* Initialise and register a new server object. */ 9.67 9.68 - server_DisplayObject obj(&backlight_obj); 9.69 - l4_cap_idx_t server; 9.70 - 9.71 - if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1; 9.72 + DisplayObject_server obj(&backlight_obj); 9.73 9.74 /* Enter the IPC server loop. */ 9.75 9.76 - ipc_server_loop(Activation_expected_items, &obj, 9.77 - (ipc_server_handler_type) handle_Activation); 9.78 + if (ipc_server_loop_for(Activation, &obj, "display")) 9.79 + return 1; 9.80 + 9.81 return 0; 9.82 }
10.1 --- a/pkg/devices/display/src/qi_lb60/display-qi_lb60.cc Sat Jun 10 23:59:44 2023 +0200 10.2 +++ b/pkg/devices/display/src/qi_lb60/display-qi_lb60.cc Sun Jun 11 15:42:11 2023 +0200 10.3 @@ -1,7 +1,7 @@ 10.4 /* 10.5 * Export Ben NanoNote display operations as a server. 10.6 * 10.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 10.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 10.9 * 10.10 * This program is free software; you can redistribute it and/or 10.11 * modify it under the terms of the GNU General Public License as 10.12 @@ -27,9 +27,12 @@ 10.13 #include <l4/re/env.h> 10.14 10.15 #include <ipc/server.h> 10.16 + 10.17 #include "activation_client.h" 10.18 #include "activation_server.h" 10.19 10.20 + 10.21 + 10.22 /* Virtual address for the GPIO register block. */ 10.23 10.24 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0; 10.25 @@ -68,7 +71,7 @@ 10.26 10.27 /* Display device only implementing the activation interface. */ 10.28 10.29 -class server_DisplayObject : public Activation 10.30 +class DisplayObject_server : public Activation 10.31 { 10.32 Pin_slice slcd8_mask = {.offset=0, .mask=(1 << Jz4740_lcd_gpio_cs) | (1 << Jz4740_lcd_gpio_rs) | 10.33 (1 << Jz4740_lcd_gpio_clk) | Jz4740_lcd_gpio_d0_d7}; 10.34 @@ -76,7 +79,7 @@ 10.35 Activation *_backlight; 10.36 10.37 public: 10.38 - explicit server_DisplayObject(Activation *backlight) 10.39 + explicit DisplayObject_server(Activation *backlight) 10.40 : _backlight(backlight) 10.41 { 10.42 } 10.43 @@ -108,7 +111,8 @@ 10.44 10.45 int main(void) 10.46 { 10.47 - if (setup_memory()) return 1; 10.48 + if (setup_memory()) 10.49 + return 1; 10.50 10.51 /* Initialise the GPIO abstraction. */ 10.52 10.53 @@ -119,7 +123,9 @@ 10.54 /* Obtain a reference to the backlight device. */ 10.55 10.56 l4_cap_idx_t backlight = l4re_env_get_cap("backlight"); 10.57 - if (!l4_is_valid_cap(backlight)) return 1; 10.58 + 10.59 + if (!l4_is_valid_cap(backlight)) 10.60 + return 1; 10.61 10.62 /* Use the activation interface with the backlight. */ 10.63 10.64 @@ -127,14 +133,12 @@ 10.65 10.66 /* Initialise and register a new server object. */ 10.67 10.68 - server_DisplayObject obj(&backlight_obj); 10.69 - l4_cap_idx_t server; 10.70 + DisplayObject_server obj(&backlight_obj); 10.71 10.72 - if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1; 10.73 + /* Bind and start the IPC server loop. */ 10.74 10.75 - /* Enter the IPC server loop. */ 10.76 + if (ipc_server_loop_for(Activation, &obj, "display")) 10.77 + return 1; 10.78 10.79 - ipc_server_loop(Activation_expected_items, &obj, 10.80 - (ipc_server_handler_type) handle_Activation); 10.81 return 0; 10.82 }
11.1 --- a/pkg/devices/fb/include/fb-client.h Sat Jun 10 23:59:44 2023 +0200 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,41 +0,0 @@ 11.4 -/* 11.5 - * Framebuffer client to access framebuffer servers. 11.6 - * 11.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 11.8 - * 11.9 - * This program is free software; you can redistribute it and/or 11.10 - * modify it under the terms of the GNU General Public License as 11.11 - * published by the Free Software Foundation; either version 2 of 11.12 - * the License, or (at your option) any later version. 11.13 - * 11.14 - * This program is distributed in the hope that it will be useful, 11.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11.17 - * GNU General Public License for more details. 11.18 - * 11.19 - * You should have received a copy of the GNU General Public License 11.20 - * along with this program; if not, write to the Free Software 11.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 11.22 - * Boston, MA 02110-1301, USA 11.23 - */ 11.24 - 11.25 -#pragma once 11.26 - 11.27 -#ifdef __cplusplus 11.28 - 11.29 -#include <l4/re/dataspace> 11.30 -#include <l4/re/env> 11.31 -#include <l4/re/c/video/view.h> 11.32 -#include <l4/sys/types.h> 11.33 - 11.34 -class Framebuffer_device_interface : public L4::Kobject_t<Framebuffer_device_interface, L4::Kobject> 11.35 -{ 11.36 - L4_KOBJECT(Framebuffer_device_interface) 11.37 - 11.38 -public: 11.39 - int get_framebuffer(L4::Cap<L4Re::Dataspace> mem) throw(); 11.40 - l4_size_t get_framebuffer_size() throw(); 11.41 - int get_view_info(l4re_video_view_info_t *view_info) throw(); 11.42 -}; 11.43 - 11.44 -#endif
12.1 --- a/pkg/devices/fb/include/fb-lcd.h Sat Jun 10 23:59:44 2023 +0200 12.2 +++ b/pkg/devices/fb/include/fb-lcd.h Sun Jun 11 15:42:11 2023 +0200 12.3 @@ -1,7 +1,7 @@ 12.4 /* 12.5 * LCD framebuffer server functionality. 12.6 * 12.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 12.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 12.9 * 12.10 * This program is free software; you can redistribute it and/or 12.11 * modify it under the terms of the GNU General Public License as 12.12 @@ -21,26 +21,28 @@ 12.13 12.14 #pragma once 12.15 12.16 -#include <l4/devices/lcd-device.h> 12.17 -#include "fb-server.h" 12.18 - 12.19 #ifdef __cplusplus 12.20 12.21 -#include <l4/re/dataspace> 12.22 -#include <l4/sys/capability> 12.23 +#include <l4/devices/lcd-device.h> 12.24 +#include <l4/re/c/dataspace.h> 12.25 + 12.26 +#include "fb-server.h" 12.27 12.28 class Framebuffer_lcd_server : public Framebuffer_server 12.29 { 12.30 Lcd_device *_device; 12.31 12.32 +protected: 12.33 + /* Specialised methods. */ 12.34 + 12.35 + l4_size_t _get_framebuffer_size(); 12.36 + void _get_view_info(l4re_video_view_info_t *view_info); 12.37 + 12.38 public: 12.39 - explicit Framebuffer_lcd_server(L4::Cap<L4Re::Dataspace> mem, Lcd_device *device) 12.40 + explicit Framebuffer_lcd_server(l4re_ds_t mem, Lcd_device *device) 12.41 : Framebuffer_server(mem), _device(device) 12.42 { 12.43 } 12.44 - 12.45 - l4_size_t get_framebuffer_size(); 12.46 - void get_view_info(l4re_video_view_info_t *view_info); 12.47 }; 12.48 12.49 #endif
13.1 --- a/pkg/devices/fb/include/fb-ops.h Sat Jun 10 23:59:44 2023 +0200 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,28 +0,0 @@ 13.4 -/* 13.5 - * Framebuffer server operations. 13.6 - * 13.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 13.8 - * 13.9 - * This program is free software; you can redistribute it and/or 13.10 - * modify it under the terms of the GNU General Public License as 13.11 - * published by the Free Software Foundation; either version 2 of 13.12 - * the License, or (at your option) any later version. 13.13 - * 13.14 - * This program is distributed in the hope that it will be useful, 13.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13.17 - * GNU General Public License for more details. 13.18 - * 13.19 - * You should have received a copy of the GNU General Public License 13.20 - * along with this program; if not, write to the Free Software 13.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 13.22 - * Boston, MA 02110-1301, USA 13.23 - */ 13.24 - 13.25 -#pragma once 13.26 - 13.27 -enum { 13.28 - Framebuffer_op_get_framebuffer, 13.29 - Framebuffer_op_get_framebuffer_size, 13.30 - Framebuffer_op_get_view_info, 13.31 -};
14.1 --- a/pkg/devices/fb/include/fb-server.h Sat Jun 10 23:59:44 2023 +0200 14.2 +++ b/pkg/devices/fb/include/fb-server.h Sun Jun 11 15:42:11 2023 +0200 14.3 @@ -1,7 +1,7 @@ 14.4 /* 14.5 * Common framebuffer server functionality. 14.6 * 14.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 14.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 14.9 * 14.10 * This program is free software; you can redistribute it and/or 14.11 * modify it under the terms of the GNU General Public License as 14.12 @@ -23,32 +23,36 @@ 14.13 14.14 #ifdef __cplusplus 14.15 14.16 -#include <l4/cxx/ipc_server> 14.17 -#include <l4/re/dataspace> 14.18 -#include <l4/re/env> 14.19 -#include <l4/re/c/video/view.h> 14.20 +#include <l4/re/c/dataspace.h> 14.21 #include <l4/sys/types.h> 14.22 14.23 +#include "framebuffer_interface.h" 14.24 + 14.25 /* Server object to provide framebuffer data access. */ 14.26 14.27 -class Framebuffer_server : public L4::Server_object_t<L4::Kobject> 14.28 +class Framebuffer_server : public Framebuffer 14.29 { 14.30 private: 14.31 - L4::Cap<L4Re::Dataspace> _mem; 14.32 + l4re_ds_t _mem; 14.33 + 14.34 +protected: 14.35 + /* Specialised methods for overriding. */ 14.36 + 14.37 + virtual l4_size_t _get_framebuffer_size() = 0; 14.38 + virtual void _get_view_info(l4re_video_view_info_t *view_info) = 0; 14.39 14.40 public: 14.41 /* Initialise the server with a capability referencing the exported memory. */ 14.42 14.43 - explicit Framebuffer_server(L4::Cap<L4Re::Dataspace> mem) 14.44 + explicit Framebuffer_server(l4re_ds_t mem) 14.45 : _mem(mem) 14.46 {} 14.47 14.48 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios); 14.49 - 14.50 /* Operation methods. */ 14.51 14.52 - virtual l4_size_t get_framebuffer_size() = 0; 14.53 - virtual void get_view_info(l4re_video_view_info_t *view_info) = 0; 14.54 + virtual long get_framebuffer(l4_cap_idx_t *mem); 14.55 + virtual long get_framebuffer_size(l4_size_t *size); 14.56 + virtual long get_view_info(l4re_video_view_info_t *view_info); 14.57 }; 14.58 14.59 #endif
15.1 --- a/pkg/devices/fb/src/Makefile Sat Jun 10 23:59:44 2023 +0200 15.2 +++ b/pkg/devices/fb/src/Makefile Sun Jun 11 15:42:11 2023 +0200 15.3 @@ -1,7 +1,7 @@ 15.4 PKGDIR ?= ../.. 15.5 L4DIR ?= $(PKGDIR)/../.. 15.6 15.7 -TARGET := client jz4740 lcd server 15.8 +TARGET := jz4740 lcd server 15.9 15.10 include $(L4DIR)/mk/subdir.mk 15.11
16.1 --- a/pkg/devices/fb/src/client/Makefile Sat Jun 10 23:59:44 2023 +0200 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_fb_client.o.a 16.8 -PC_FILENAME := libdevice-fb-client 16.9 - 16.10 -SRC_CC := fb-client.cc 16.11 - 16.12 -PRIVATE_INCDIR += $(PKGDIR)/fb/include 16.13 - 16.14 -REQUIRES_LIBS := l4re_c l4re_c-util 16.15 - 16.16 -include $(L4DIR)/mk/lib.mk
17.1 --- a/pkg/devices/fb/src/client/fb-client.cc Sat Jun 10 23:59:44 2023 +0200 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,72 +0,0 @@ 17.4 -/* 17.5 - * Framebuffer client to access framebuffer servers. 17.6 - * 17.7 - * Copyright (C) 2018 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 "fb-client.h" 17.26 -#include "fb-ops.h" 17.27 - 17.28 -#include <l4/cxx/ipc_stream> 17.29 -#include <l4/re/env> 17.30 - 17.31 -#include <stdint.h> 17.32 - 17.33 -int 17.34 -Framebuffer_device_interface::get_framebuffer(L4::Cap<L4Re::Dataspace> mem) throw() 17.35 -{ 17.36 - L4::Ipc::Iostream s(l4_utcb()); 17.37 - 17.38 - /* Send a "receive item" for requesting a capability. */ 17.39 - 17.40 - s << L4::Ipc::Small_buf(mem); 17.41 - 17.42 - return l4_error(s.call(cap(), Framebuffer_op_get_framebuffer)); 17.43 -} 17.44 - 17.45 -l4_size_t 17.46 -Framebuffer_device_interface::get_framebuffer_size() throw() 17.47 -{ 17.48 - L4::Ipc::Iostream s(l4_utcb()); 17.49 - l4_size_t size; 17.50 - 17.51 - /* Return zero on failure. */ 17.52 - 17.53 - if (l4_error(s.call(cap(), Framebuffer_op_get_framebuffer_size))) 17.54 - return 0; 17.55 - 17.56 - s >> size; 17.57 - return size; 17.58 -} 17.59 - 17.60 -int 17.61 -Framebuffer_device_interface::get_view_info(l4re_video_view_info_t *view_info) throw() 17.62 -{ 17.63 - L4::Ipc::Iostream s(l4_utcb()); 17.64 - 17.65 - int err = l4_error(s.call(cap(), Framebuffer_op_get_view_info)); 17.66 - if (err) return err; 17.67 - 17.68 - unsigned long expected = sizeof(*view_info); 17.69 - unsigned long size = expected; 17.70 - 17.71 - s >> L4::Ipc::buf_cp_in<uint8_t>((uint8_t *) view_info, expected); 17.72 - 17.73 - if (size != expected) return -L4_EIO; 17.74 - return L4_EOK; 17.75 -}
18.1 --- a/pkg/devices/fb/src/jz4740/Makefile Sat Jun 10 23:59:44 2023 +0200 18.2 +++ b/pkg/devices/fb/src/jz4740/Makefile Sun Jun 11 15:42:11 2023 +0200 18.3 @@ -2,12 +2,12 @@ 18.4 L4DIR ?= $(PKGDIR)/../.. 18.5 18.6 TARGET = dev_fb_jz4740 18.7 -PC_FILENAME := devices-fb-jz4740 18.8 +PC_FILENAME = devices-fb-jz4740 18.9 18.10 -SRC_CC := fb-jz4740.cc 18.11 +SRC_CC = fb-jz4740.cc 18.12 18.13 -PRIVATE_INCDIR += $(PKGDIR)/fb/include 18.14 +PRIVATE_INCDIR = $(PKGDIR)/fb/include 18.15 18.16 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-fb-lcd libdevice-lcd-jz4740 18.17 +REQUIRES_LIBS = l4re_c l4re_c-util libdevice-fb-lcd libdevice-lcd-jz4740 18.18 18.19 include $(L4DIR)/mk/prog.mk
19.1 --- a/pkg/devices/fb/src/lcd/Makefile Sat Jun 10 23:59:44 2023 +0200 19.2 +++ b/pkg/devices/fb/src/lcd/Makefile Sun Jun 11 15:42:11 2023 +0200 19.3 @@ -2,12 +2,12 @@ 19.4 L4DIR ?= $(PKGDIR)/../.. 19.5 19.6 TARGET = libdevice_fb_lcd.o.a 19.7 -PC_FILENAME := libdevice-fb-lcd 19.8 +PC_FILENAME = libdevice-fb-lcd 19.9 19.10 -SRC_CC := fb-lcd.cc 19.11 +SRC_CC = fb-lcd.cc 19.12 19.13 -PRIVATE_INCDIR += $(PKGDIR)/fb/include 19.14 +REQUIRES_LIBS = l4re_c l4re_c-util libdevice-fb-server libdevice-lcd 19.15 19.16 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-fb-server libdevice-lcd 19.17 +PRIVATE_INCDIR = $(PKGDIR)/fb/include 19.18 19.19 include $(L4DIR)/mk/lib.mk
20.1 --- a/pkg/devices/fb/src/lcd/fb-lcd.cc Sat Jun 10 23:59:44 2023 +0200 20.2 +++ b/pkg/devices/fb/src/lcd/fb-lcd.cc Sun Jun 11 15:42:11 2023 +0200 20.3 @@ -1,7 +1,7 @@ 20.4 /* 20.5 * Export the framebuffer as a data space accessible via the "fb" capability. 20.6 * 20.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 20.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 20.9 * 20.10 * This program is free software; you can redistribute it and/or 20.11 * modify it under the terms of the GNU General Public License as 20.12 @@ -20,61 +20,55 @@ 20.13 */ 20.14 20.15 #include <l4/devices/lcd-device.h> 20.16 -#include "fb-lcd.h" 20.17 -#include "fb-server.h" 20.18 + 20.19 +#include <ipc/server.h> 20.20 20.21 -#include <l4/cxx/ipc_stream> 20.22 -#include <l4/re/dataspace> 20.23 -#include <l4/re/env> 20.24 -#include <l4/re/util/object_registry> 20.25 +#include "fb-lcd.h" 20.26 +#include "framebuffer_server.h" 20.27 20.28 20.29 20.30 // Device-specific methods. 20.31 20.32 -l4_size_t 20.33 -Framebuffer_lcd_server::get_framebuffer_size() 20.34 +l4_size_t Framebuffer_lcd_server::_get_framebuffer_size() 20.35 { 20.36 return _device->get_framebuffer_size(); 20.37 } 20.38 20.39 -void 20.40 -Framebuffer_lcd_server::get_view_info(l4re_video_view_info_t *view_info) 20.41 +void Framebuffer_lcd_server::_get_view_info(l4re_video_view_info_t *view_info) 20.42 { 20.43 _device->get_view_info(view_info); 20.44 } 20.45 20.46 20.47 20.48 -static L4Re::Util::Registry_server<> server; 20.49 - 20.50 - 20.51 - 20.52 // Main program. 20.53 20.54 int run() 20.55 { 20.56 - // Obtain the LCD device. 20.57 + /* Obtain the LCD device. */ 20.58 20.59 Lcd_device *lcd_device = Lcd_device::get_device(); 20.60 20.61 - // Memory allocation capability for the framebuffer data. 20.62 + /* Memory allocation capability for the framebuffer data. */ 20.63 20.64 - L4::Cap<L4Re::Dataspace> mem = lcd_device->get_framebuffer_cap(); 20.65 + l4re_ds_t mem = lcd_device->get_framebuffer_cap(); 20.66 20.67 - if (!mem.is_valid()) return 1; 20.68 + if (l4_is_invalid_cap(mem)) 20.69 + return 1; 20.70 20.71 - // Enable the LCD device. 20.72 + /* Enable the LCD device. */ 20.73 20.74 lcd_device->enable(); 20.75 20.76 - // Initialise and register a server object. 20.77 + /* Initialise and register a server object. */ 20.78 + 20.79 + Framebuffer_lcd_server obj(mem, lcd_device); 20.80 20.81 - Framebuffer_lcd_server server_obj(mem, lcd_device); 20.82 - server.registry()->register_obj(&server_obj, "fb"); 20.83 + /* Bind and start the IPC server loop. */ 20.84 20.85 - // Enter the IPC server loop. 20.86 + if (ipc_server_loop_for(Framebuffer, &obj, "fb")) 20.87 + return 1; 20.88 20.89 - server.loop(); 20.90 return 0; 20.91 }
21.1 --- a/pkg/devices/fb/src/server/Makefile Sat Jun 10 23:59:44 2023 +0200 21.2 +++ b/pkg/devices/fb/src/server/Makefile Sun Jun 11 15:42:11 2023 +0200 21.3 @@ -2,12 +2,12 @@ 21.4 L4DIR ?= $(PKGDIR)/../.. 21.5 21.6 TARGET = libdevice_fb_server.o.a 21.7 -PC_FILENAME := libdevice-fb-server 21.8 +PC_FILENAME = libdevice-fb-server 21.9 21.10 -SRC_CC := fb-server.cc 21.11 +SRC_CC = fb-server.cc 21.12 21.13 -PRIVATE_INCDIR += $(PKGDIR)/fb/include 21.14 +PRIVATE_INCDIR = $(PKGDIR)/fb/include 21.15 21.16 -REQUIRES_LIBS := l4re_c l4re_c-util 21.17 +REQUIRES_LIBS = l4re_c l4re_c-util 21.18 21.19 include $(L4DIR)/mk/lib.mk
22.1 --- a/pkg/devices/fb/src/server/fb-server.cc Sat Jun 10 23:59:44 2023 +0200 22.2 +++ b/pkg/devices/fb/src/server/fb-server.cc Sun Jun 11 15:42:11 2023 +0200 22.3 @@ -1,7 +1,7 @@ 22.4 /* 22.5 * Common framebuffer server functionality. 22.6 * 22.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 22.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 22.9 * 22.10 * This program is free software; you can redistribute it and/or 22.11 * modify it under the terms of the GNU General Public License as 22.12 @@ -19,50 +19,25 @@ 22.13 * Boston, MA 02110-1301, USA 22.14 */ 22.15 22.16 -#include "fb-client.h" 22.17 #include "fb-server.h" 22.18 -#include "fb-ops.h" 22.19 - 22.20 -#include <l4/cxx/ipc_server> 22.21 -#include <l4/re/env> 22.22 -#include <l4/sys/typeinfo_svr> 22.23 -#include <l4/util/util.h> 22.24 22.25 -#include <stdint.h> 22.26 - 22.27 -/* Handle invocations. */ 22.28 - 22.29 -int 22.30 -Framebuffer_server::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 22.31 +long Framebuffer_server::get_framebuffer(l4_cap_idx_t *fb) 22.32 { 22.33 - l4_msgtag_t tag; 22.34 - 22.35 - (void) obj; 22.36 - ios >> tag; 22.37 + *fb = _mem; 22.38 + return L4_EOK; 22.39 +} 22.40 22.41 - switch (tag.label()) 22.42 - { 22.43 - case L4::Meta::Protocol: 22.44 - return L4::Util::handle_meta_request<Framebuffer_device_interface>(ios); 22.45 - 22.46 - case Framebuffer_op_get_framebuffer: 22.47 - ios << _mem; 22.48 - return L4_EOK; 22.49 - 22.50 - case Framebuffer_op_get_framebuffer_size: 22.51 - ios << get_framebuffer_size(); 22.52 - return L4_EOK; 22.53 +long Framebuffer_server::get_framebuffer_size(l4_size_t *size) 22.54 +{ 22.55 + *size = _get_framebuffer_size(); 22.56 + return L4_EOK; 22.57 +} 22.58 22.59 - case Framebuffer_op_get_view_info: 22.60 - l4re_video_view_info_t view_info; 22.61 - get_view_info(&view_info); 22.62 - 22.63 - /* Serialise the view information structure. */ 22.64 +long Framebuffer_server::get_view_info(l4re_video_view_info_t *view_info) 22.65 +{ 22.66 + _get_view_info(view_info); 22.67 + return L4_EOK; 22.68 +} 22.69 22.70 - ios << L4::Ipc::buf_cp_out<uint8_t>((uint8_t *) &view_info, sizeof(view_info)); 22.71 - return L4_EOK; 22.72 - 22.73 - default: 22.74 - return -L4_EBADPROTO; 22.75 - } 22.76 -} 22.77 +/* vim: tabstop=2 expandtab shiftwidth=2 22.78 +*/
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/pkg/devices/idl/backlight_object.idl Sun Jun 11 15:42:11 2023 +0200 23.3 @@ -0,0 +1,4 @@ 23.4 +import "activation.idl"; 23.5 +import "backlight.idl"; 23.6 + 23.7 +interface BacklightObject composes Activation, Backlight;
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/pkg/devices/idl/event.idl Sun Jun 11 15:42:11 2023 +0200 24.3 @@ -0,0 +1,9 @@ 24.4 +#include <l4/devices/protocols.h> 24.5 + 24.6 +/* An event interface. */ 24.7 + 24.8 +[protocol(L4RE_PROTO_EVENT)] 24.9 +interface Event 24.10 +{ 24.11 + void get_buffer(out cap mem); 24.12 +};
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/pkg/devices/idl/framebuffer.idl Sun Jun 11 15:42:11 2023 +0200 25.3 @@ -0,0 +1,18 @@ 25.4 +#include <l4/devices/protocols.h> 25.5 +#include <l4/re/c/video/view.h> 25.6 + 25.7 +[protocol(LANDFALL_FRAMEBUFFER)] 25.8 +interface Framebuffer 25.9 +{ 25.10 + /* Return a framebuffer capability. */ 25.11 + 25.12 + void get_framebuffer(out cap mem); 25.13 + 25.14 + /* Return the framebuffer size. */ 25.15 + 25.16 + void get_framebuffer_size(out l4_size_t size); 25.17 + 25.18 + /* Return view information. */ 25.19 + 25.20 + void get_view_info(out l4re_video_view_info_t view_info); 25.21 +};
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/pkg/devices/idl/keypad.idl Sun Jun 11 15:42:11 2023 +0200 26.3 @@ -0,0 +1,7 @@ 26.4 +#include <l4/devices/protocols.h> 26.5 + 26.6 +[protocol(LANDFALL_KEYPAD)] 26.7 +interface Keypad 26.8 +{ 26.9 + void get_keypad_data(out cap data); 26.10 +};
27.1 --- a/pkg/devices/include/protocols.h Sat Jun 10 23:59:44 2023 +0200 27.2 +++ b/pkg/devices/include/protocols.h Sun Jun 11 15:42:11 2023 +0200 27.3 @@ -1,7 +1,7 @@ 27.4 /* 27.5 * Interface protocols. 27.6 * 27.7 - * Copyright (C) 2020 Paul Boddie <paul@boddie.org.uk> 27.8 + * Copyright (C) 2020, 2023 Paul Boddie <paul@boddie.org.uk> 27.9 * 27.10 * This program is free software; you can redistribute it and/or 27.11 * modify it under the terms of the GNU General Public License as 27.12 @@ -21,10 +21,11 @@ 27.13 27.14 #pragma once 27.15 27.16 -#define LANDFALL_ACTIVATION 0x1f01 27.17 -#define LANDFALL_BACKLIGHT 0x1f02 27.18 -#define LANDFALL_CPM 0x1f03 27.19 -#define LANDFALL_PWM 0x1f10 27.20 -#define LANDFALL_SPI 0x1f13 27.21 +#define LANDFALL_ACTIVATION 0x1f01 27.22 +#define LANDFALL_BACKLIGHT 0x1f02 27.23 +#define LANDFALL_CPM 0x1f03 27.24 +#define LANDFALL_FRAMEBUFFER 0x1f04 27.25 +#define LANDFALL_PWM 0x1f10 27.26 +#define LANDFALL_SPI 0x1f13 27.27 27.28 // vim: tabstop=2 expandtab shiftwidth=2
28.1 --- a/pkg/devices/input/include/input-keypad-client.h Sat Jun 10 23:59:44 2023 +0200 28.2 +++ b/pkg/devices/input/include/input-keypad-client.h Sun Jun 11 15:42:11 2023 +0200 28.3 @@ -1,7 +1,7 @@ 28.4 /* 28.5 * Common keypad client functionality for input event generation. 28.6 * 28.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 28.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 28.9 * 28.10 * This program is free software; you can redistribute it and/or 28.11 * modify it under the terms of the GNU General Public License as 28.12 @@ -31,6 +31,8 @@ 28.13 28.14 #include <stdint.h> 28.15 28.16 + 28.17 + 28.18 /* Input event and handler. */ 28.19 28.20 typedef struct 28.21 @@ -55,8 +57,8 @@ 28.22 { 28.23 /* Memory and keypad access capabilities. */ 28.24 28.25 - L4::Cap<L4Re::Dataspace> _mem; 28.26 - L4::Cap<Keypad_device_interface> _keypad_server; 28.27 + l4re_ds_t _mem; 28.28 + l4_cap_idx_t _keypad_cap; 28.29 28.30 /* Keypad layout details. */ 28.31
29.1 --- a/pkg/devices/input/src/keypad/Makefile Sat Jun 10 23:59:44 2023 +0200 29.2 +++ b/pkg/devices/input/src/keypad/Makefile Sun Jun 11 15:42:11 2023 +0200 29.3 @@ -2,12 +2,12 @@ 29.4 L4DIR ?= $(PKGDIR)/../.. 29.5 29.6 TARGET = libinput_keypad.o.a 29.7 -PC_FILENAME := libdevice-input-keypad 29.8 +PC_FILENAME = libdevice-input-keypad 29.9 29.10 -SRC_CC := input-keypad-client.cc 29.11 +SRC_CC = input-keypad-client.cc 29.12 29.13 -PRIVATE_INCDIR += $(PKGDIR)/input/include 29.14 +PRIVATE_INCDIR = $(PKGDIR)/input/include 29.15 29.16 -REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-keypad-headers libdevice-keypad-client 29.17 +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-keypad-headers libdevice-keypad-client 29.18 29.19 include $(L4DIR)/mk/lib.mk
30.1 --- a/pkg/devices/input/src/keypad/input-keypad-client.cc Sat Jun 10 23:59:44 2023 +0200 30.2 +++ b/pkg/devices/input/src/keypad/input-keypad-client.cc Sun Jun 11 15:42:11 2023 +0200 30.3 @@ -24,72 +24,76 @@ 30.4 #include <pthread.h> 30.5 #include <pthread-l4.h> 30.6 30.7 -#include <l4/re/dataspace> 30.8 -#include <l4/re/env> 30.9 -#include <l4/re/rm> 30.10 -#include <l4/re/util/cap_alloc> 30.11 +#include <l4/re/env.h> 30.12 30.13 #include <l4/re/event_enums.h> 30.14 #include <l4/sys/thread.h> 30.15 #include <l4/util/util.h> 30.16 30.17 +#include <ipc/cap_alloc.h> 30.18 +#include <ipc/mem_ipc.h> 30.19 + 30.20 #include <stdlib.h> 30.21 30.22 +#include "keypad_interface.h" 30.23 + 30.24 + 30.25 + 30.26 /* Obtain a capability for the keypad data. */ 30.27 30.28 -void 30.29 -Input_keypad_client::init_memory() 30.30 +void Input_keypad_client::init_memory() 30.31 { 30.32 - _mem = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>(); 30.33 + _mem = ipc_cap_alloc(); 30.34 } 30.35 30.36 /* Obtain a reference to the keypad. */ 30.37 30.38 -void 30.39 -Input_keypad_client::init_keypad() 30.40 +void Input_keypad_client::init_keypad() 30.41 { 30.42 - _keypad_server = L4Re::Env::env()->get_cap<Keypad_device_interface>("keypad"); 30.43 + _keypad_cap = l4re_env_get_cap("keypad"); 30.44 } 30.45 30.46 /* Access the keypad server memory. */ 30.47 30.48 -void 30.49 -Input_keypad_client::init_keypad_data() 30.50 +void Input_keypad_client::init_keypad_data() 30.51 { 30.52 - if (!_mem.is_valid()) 30.53 + if (l4_is_invalid_cap(_mem)) 30.54 return; 30.55 30.56 - if (!_keypad_server.is_valid()) 30.57 + if (l4_is_invalid_cap(_keypad_server)) 30.58 return; 30.59 30.60 /* Obtain a reference to the keypad data. */ 30.61 30.62 - if (_keypad_server->get_keypad_data(_mem)) 30.63 + client_Keypad keypad(_keypad_cap); 30.64 + 30.65 + if (keypad.get_keypad_data(_mem)) 30.66 return; 30.67 30.68 /* Attach the keypad data to a region in this task. */ 30.69 30.70 - if (L4Re::Env::env()->rm()->attach(&_keymem, _mem->size(), 30.71 - L4Re::Rm::F::Search_addr | 30.72 - L4Re::Rm::F::R, 30.73 - L4::Ipc::make_cap_rw(_mem))) 30.74 + unsigned long size; 30.75 + 30.76 + if (ipc_dataspace_size(_mem, &size)) 30.77 + return; 30.78 + 30.79 + if (ipc_attach_dataspace(_mem, size, &_keymem)) 30.80 return; 30.81 30.82 /* Allocate memory for a copy of the keypad data. */ 30.83 30.84 - _keymem_previous = malloc(_mem->size()); 30.85 + _keymem_previous = malloc(size); 30.86 } 30.87 30.88 /* Release capabilities and the memory for a copy of the keypad data. */ 30.89 30.90 -void 30.91 -Input_keypad_client::release_keypad_data() 30.92 +void Input_keypad_client::release_keypad_data() 30.93 { 30.94 - if (_mem.is_valid()) 30.95 - L4Re::Util::cap_alloc.free(_mem); 30.96 + if (l4_is_valid_cap(_mem)) 30.97 + ipc_cap_free(_mem); 30.98 30.99 - if (_keypad_server.is_valid()) 30.100 - L4Re::Util::cap_alloc.free(_keypad_server); 30.101 + if (l4_is_valid_cap(_keypad_cap)) 30.102 + ipc_cap_free(_keypad_cap); 30.103 30.104 if (_keymem_previous && (_keymem_previous != NULL)) 30.105 free(_keymem_previous); 30.106 @@ -97,8 +101,7 @@ 30.107 30.108 /* Scan the keypad, compare old and new states, and generate key events. */ 30.109 30.110 -void 30.111 -Input_keypad_client::scan_keypad() 30.112 +void Input_keypad_client::scan_keypad() 30.113 { 30.114 uint32_t *keymem = (uint32_t *) _keymem; 30.115 uint32_t *keymem_previous = (uint32_t *) _keymem_previous; 30.116 @@ -147,8 +150,7 @@ 30.117 30.118 /* Perform keypad scanning in a separate thread. */ 30.119 30.120 -void * 30.121 -Input_keypad_client::scan_mainloop(void *data) 30.122 +void *Input_keypad_client::scan_mainloop(void *data) 30.123 { 30.124 /* Since this is a static method, obtain instance details from the data. */ 30.125 30.126 @@ -165,8 +167,7 @@ 30.127 30.128 /* Thread initialisation for the keypad scanning activity. */ 30.129 30.130 -void 30.131 -Input_keypad_client::attach(Input_handler handler, void *priv) 30.132 +void Input_keypad_client::attach(Input_handler handler, void *priv) 30.133 { 30.134 pthread_attr_t thread_attr; 30.135 struct sched_param sp;
31.1 --- a/pkg/devices/keypad/include/keypad-server.h Sat Jun 10 23:59:44 2023 +0200 31.2 +++ b/pkg/devices/keypad/include/keypad-server.h Sun Jun 11 15:42:11 2023 +0200 31.3 @@ -1,7 +1,7 @@ 31.4 /* 31.5 * Common keypad server functionality. 31.6 * 31.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 31.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 31.9 * 31.10 * This program is free software; you can redistribute it and/or 31.11 * modify it under the terms of the GNU General Public License as 31.12 @@ -21,27 +21,29 @@ 31.13 31.14 #pragma once 31.15 31.16 -#include <l4/cxx/ipc_server> 31.17 -#include <l4/re/dataspace> 31.18 -#include <l4/re/env> 31.19 +#include <l4/re/c/dataspace.h> 31.20 + 31.21 +#include <devices/keypad_interface.h> 31.22 + 31.23 + 31.24 31.25 #ifdef __cplusplus 31.26 31.27 /* Server object to provide keypad data access. */ 31.28 31.29 -class Keypad_server : public L4::Server_object_t<L4::Kobject> 31.30 +class Keypad_server : public Keypad 31.31 { 31.32 private: 31.33 - L4::Cap<L4Re::Dataspace> _mem; 31.34 + l4re_ds_t _mem; 31.35 31.36 public: 31.37 /* Initialise the server with a capability referencing the exported memory. */ 31.38 31.39 - explicit Keypad_server(L4::Cap<L4Re::Dataspace> mem) 31.40 + explicit Keypad_server(l4re_ds_t mem) 31.41 : _mem(mem) 31.42 {} 31.43 31.44 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios); 31.45 + long get_keypad_data(l4_cap_idx_t *data); 31.46 }; 31.47 31.48 #endif
32.1 --- a/pkg/devices/keypad/src/server/keypad-server.cc Sat Jun 10 23:59:44 2023 +0200 32.2 +++ b/pkg/devices/keypad/src/server/keypad-server.cc Sun Jun 11 15:42:11 2023 +0200 32.3 @@ -1,7 +1,7 @@ 32.4 /* 32.5 * Common keypad server functionality. 32.6 * 32.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 32.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 32.9 * 32.10 * This program is free software; you can redistribute it and/or 32.11 * modify it under the terms of the GNU General Public License as 32.12 @@ -19,34 +19,12 @@ 32.13 * Boston, MA 02110-1301, USA 32.14 */ 32.15 32.16 -#include "keypad-client.h" 32.17 #include "keypad-server.h" 32.18 32.19 -#include <l4/cxx/ipc_server> 32.20 -#include <l4/re/env> 32.21 -#include <l4/sys/typeinfo_svr> 32.22 -#include <l4/util/util.h> 32.23 32.24 -/* Handle invocations. */ 32.25 - 32.26 -int 32.27 -Keypad_server::dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 32.28 -{ 32.29 - l4_msgtag_t tag; 32.30 32.31 - (void) obj; 32.32 - ios >> tag; 32.33 - 32.34 - switch (tag.label()) 32.35 - { 32.36 - case L4::Meta::Protocol: 32.37 - return L4::Util::handle_meta_request<Keypad_device_interface>(ios); 32.38 - 32.39 - case Keypad_op_get_keypad_data: 32.40 - ios << _mem; 32.41 - return L4_EOK; 32.42 - 32.43 - default: 32.44 - return -L4_EBADPROTO; 32.45 - } 32.46 +long Keypad_server::get_keypad_data(l4_cap_idx_t *data) 32.47 +{ 32.48 + *data = _mem; 32.49 + return L4_EOK; 32.50 }
33.1 --- a/pkg/devices/lcd/include/lcd-jz4740-device.h Sat Jun 10 23:59:44 2023 +0200 33.2 +++ b/pkg/devices/lcd/include/lcd-jz4740-device.h Sun Jun 11 15:42:11 2023 +0200 33.3 @@ -29,6 +29,8 @@ 33.4 #include <l4/re/c/video/view.h> 33.5 #include <l4/sys/types.h> 33.6 33.7 + 33.8 + 33.9 /* C++ language interface. */ 33.10 33.11 #ifdef __cplusplus
34.1 --- a/pkg/devices/lcd/src/common/lcd-device.cc Sat Jun 10 23:59:44 2023 +0200 34.2 +++ b/pkg/devices/lcd/src/common/lcd-device.cc Sun Jun 11 15:42:11 2023 +0200 34.3 @@ -1,7 +1,7 @@ 34.4 /* 34.5 * Common LCD device functionality. 34.6 * 34.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 34.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 34.9 * 34.10 * This program is free software; you can redistribute it and/or 34.11 * modify it under the terms of the GNU General Public License as 34.12 @@ -21,6 +21,10 @@ 34.13 34.14 #include "lcd-device.h" 34.15 34.16 + 34.17 + 34.18 +/* Display activation. */ 34.19 + 34.20 void Lcd_device::disable_display() 34.21 { 34.22 _display->disable(); 34.23 @@ -31,7 +35,9 @@ 34.24 _display->enable(); 34.25 } 34.26 34.27 -// C language interface. 34.28 + 34.29 + 34.30 +/* C language interface. */ 34.31 34.32 void *lcd_get_device() 34.33 {
35.1 --- a/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Sat Jun 10 23:59:44 2023 +0200 35.2 +++ b/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Sun Jun 11 15:42:11 2023 +0200 35.3 @@ -25,22 +25,24 @@ 35.4 #include <l4/devices/memory.h> 35.5 #include "lcd-jz4740-device.h" 35.6 35.7 -#include <l4/re/dataspace> 35.8 -#include <l4/re/dma_space> 35.9 -#include <l4/re/env> 35.10 +#include <l4/re/c/dataspace.h> 35.11 +#include <l4/re/c/dma_space.h> 35.12 +#include <l4/re/c/mem_alloc.h> 35.13 #include <l4/re/env.h> 35.14 -#include <l4/re/mem_alloc> 35.15 -#include <l4/re/rm> 35.16 -#include <l4/re/util/cap_alloc> 35.17 -#include <l4/sys/factory> 35.18 +#include <l4/sys/factory.h> 35.19 #include <l4/sys/types.h> 35.20 -#include <l4/vbus/vbus> 35.21 +#include <l4/vbus/vbus.h> 35.22 + 35.23 +#include <ipc/cap_alloc.h> 35.24 +#include <ipc/mem_ipc.h> 35.25 35.26 #include <stdint.h> 35.27 35.28 #include "activation_client.h" 35.29 #include "cpm_client.h" 35.30 35.31 + 35.32 + 35.33 // Virtual addresses for the LCD register block. 35.34 35.35 static l4_addr_t lcd_virt_base = 0, lcd_virt_base_end = 0; 35.36 @@ -132,31 +134,22 @@ 35.37 35.38 // Memory allocation capabilities. 35.39 35.40 - L4::Cap<L4Re::Dataspace> descmem; 35.41 - L4::Cap<L4Re::Dma_space> dma; 35.42 + l4_cap_idx_t descmem, dma, vbus; 35.43 35.44 // Test for existing setup. 35.45 35.46 if (fb_vaddr) 35.47 return 0; 35.48 35.49 - // Obtain capabilities for allocating memory. 35.50 - 35.51 - _fbmem = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>(); 35.52 - if (!_fbmem.is_valid()) return 1; 35.53 - 35.54 - descmem = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>(); 35.55 - if (!descmem.is_valid()) return 1; 35.56 - 35.57 - dma = L4Re::Util::cap_alloc.alloc<L4Re::Dma_space>(); 35.58 - if (!dma.is_valid()) return 1; 35.59 - 35.60 // Create the DMA space. 35.61 35.62 - L4::Cap<L4vbus::Vbus> vbus = L4Re::Env::env()->get_cap<L4vbus::Vbus>("vbus"); 35.63 - if (!vbus.is_valid()) return 1; 35.64 + dma = ipc_cap_alloc(); 35.65 + if (l4_is_invalid_cap(dma)) return 1; 35.66 35.67 - if (l4_error(L4Re::Env::env()->user_factory()->create(dma))) 35.68 + vbus = l4re_env_get_cap("vbus"); 35.69 + if (l4_is_invalid_cap(vbus)) return 1; 35.70 + 35.71 + if (l4_error(l4_factory_create(l4re_env()->mem_alloc, L4RE_PROTO_DMA_SPACE, dma))) 35.72 return 1; 35.73 35.74 l4vbus_device_handle_t device = L4VBUS_NULL; 35.75 @@ -165,9 +158,9 @@ 35.76 if (!find_resource(&device, &dma_resource, L4VBUS_RESOURCE_DMA_DOMAIN)) 35.77 return 1; 35.78 35.79 - if (vbus->assign_dma_domain(dma_resource.start, 35.80 - L4VBUS_DMAD_BIND | L4VBUS_DMAD_L4RE_DMA_SPACE, 35.81 - dma)) 35.82 + if (l4vbus_assign_dma_domain(vbus, dma_resource.start, 35.83 + L4VBUS_DMAD_BIND | L4VBUS_DMAD_L4RE_DMA_SPACE, 35.84 + dma)) 35.85 return 1; 35.86 35.87 // Obtain the memory requirements. 35.88 @@ -182,23 +175,17 @@ 35.89 // NOTE: A 64 word burst mode is available on the JZ4780 that would 35.90 // NOTE: necessitate 64 word alignment for the framebuffer. 35.91 35.92 - const l4_size_t alloc_flags = L4Re::Mem_alloc::Continuous | L4Re::Mem_alloc::Pinned; 35.93 - 35.94 - if (L4Re::Env::env()->mem_alloc()->alloc(fb_size, _fbmem, alloc_flags, 8) || 35.95 - L4Re::Env::env()->mem_alloc()->alloc(desc_size, descmem, alloc_flags, 6)) 35.96 - return 1; 35.97 + const l4_size_t alloc_flags = L4RE_MA_CONTINUOUS | L4RE_MA_PINNED; 35.98 35.99 // Map the allocated memory, obtaining virtual addresses. 35.100 35.101 - const L4Re::Rm::F::Flags flags = L4Re::Rm::F::Search_addr | 35.102 - L4Re::Rm::F::Eager_map | 35.103 - L4Re::Rm::F::RW; 35.104 - 35.105 fb_vaddr = 0; 35.106 desc_vaddr = 0; 35.107 35.108 - if (L4Re::Env::env()->rm()->attach(&fb_vaddr, fb_size, flags, _fbmem, 0) || 35.109 - L4Re::Env::env()->rm()->attach(&desc_vaddr, desc_size, flags, descmem, 0)) 35.110 + if (ipc_allocate_align(fb_size, alloc_flags, 8, &fb_vaddr, &_fbmem)) 35.111 + return 1; 35.112 + 35.113 + if (ipc_allocate_align(desc_size, alloc_flags, 6, &desc_vaddr, &descmem)) 35.114 return 1; 35.115 35.116 // Obtain physical addresses for the framebuffer and descriptors. 35.117 @@ -209,16 +196,12 @@ 35.118 fb_size_out = fb_size; 35.119 desc_size_out = desc_size; 35.120 35.121 - if (dma->map(L4::Ipc::make_cap_rw(_fbmem), 0, &fb_size_out, 35.122 - L4Re::Dma_space::Attributes::None, 35.123 - L4Re::Dma_space::Direction::To_device, 35.124 - &fb_paddr)) 35.125 + if (l4re_dma_space_map(dma, _fbmem | L4_CAP_FPAGE_RW, 0, &fb_size_out, 0, 35.126 + L4RE_DMA_SPACE_TO_DEVICE, &fb_paddr)) 35.127 return 1; 35.128 35.129 - if (dma->map(L4::Ipc::make_cap_rw(descmem), 0, &desc_size_out, 35.130 - L4Re::Dma_space::Attributes::None, 35.131 - L4Re::Dma_space::Direction::To_device, 35.132 - &desc_paddr)) 35.133 + if (l4re_dma_space_map(dma, descmem | L4_CAP_FPAGE_RW, 0, &desc_size_out, 0, 35.134 + L4RE_DMA_SPACE_TO_DEVICE, &desc_paddr)) 35.135 return 1; 35.136 35.137 // Test the mapped region sizes. 35.138 @@ -231,8 +214,7 @@ 35.139 35.140 // Populate a view information structure. 35.141 35.142 -void 35.143 -Lcd_jz4740_device::get_view_info(l4re_video_view_info_t *view_info) 35.144 +void Lcd_jz4740_device::get_view_info(l4re_video_view_info_t *view_info) 35.145 { 35.146 // Populate the L4Re framebuffer description with details from the 35.147 // somewhat similar panel description. 35.148 @@ -303,10 +285,14 @@ 35.149 // Obtain access to the CPM and display devices. 35.150 35.151 l4_cap_idx_t cpm = l4re_env_get_cap("cpm"); 35.152 - if (!l4_is_valid_cap(cpm)) return 1; 35.153 + 35.154 + if (!l4_is_valid_cap(cpm)) 35.155 + return 1; 35.156 35.157 l4_cap_idx_t display = l4re_env_get_cap("display"); 35.158 - if (!l4_is_valid_cap(display)) return 1; 35.159 + 35.160 + if (!l4_is_valid_cap(display)) 35.161 + return 1; 35.162 35.163 static client_Activation display_obj(display); 35.164 display_device = &display_obj; 35.165 @@ -334,9 +320,11 @@ 35.166 35.167 Lcd_device *Lcd_device::get_device() 35.168 { 35.169 - if (Lcd_jz4740_device::device) return Lcd_jz4740_device::device; 35.170 + if (Lcd_jz4740_device::device) 35.171 + return Lcd_jz4740_device::device; 35.172 35.173 - if (setup_memory()) return 0; 35.174 + if (setup_memory()) 35.175 + return 0; 35.176 35.177 // Initialise the common device. 35.178
36.1 --- a/pkg/devices/pwm/src/jz4730/Makefile Sat Jun 10 23:59:44 2023 +0200 36.2 +++ b/pkg/devices/pwm/src/jz4730/Makefile Sun Jun 11 15:42:11 2023 +0200 36.3 @@ -14,20 +14,13 @@ 36.4 36.5 include $(IDL_MK_DIR)/idl.mk 36.6 36.7 -# Compound interface definitions. 36.8 - 36.9 -pwm_object_NAME = PWMObject 36.10 -pwm_object_INTERFACES = activation pwm 36.11 - 36.12 -COMP_INTERFACES_CC = pwm_object 36.13 - 36.14 # Individual interfaces. 36.15 36.16 -SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC)) 36.17 +SERVER_INTERFACES_CC = pwm_object 36.18 36.19 # Generated and plain source files. 36.20 36.21 -SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC)) 36.22 +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) 36.23 36.24 PLAIN_SRC_CC = pwm-jz4730.cc 36.25
37.1 --- a/pkg/devices/pwm/src/jz4730/pwm-jz4730.cc Sat Jun 10 23:59:44 2023 +0200 37.2 +++ b/pkg/devices/pwm/src/jz4730/pwm-jz4730.cc Sun Jun 11 15:42:11 2023 +0200 37.3 @@ -1,7 +1,7 @@ 37.4 /* 37.5 * Export a JZ4730 PWM peripheral as a server. 37.6 * 37.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 37.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 37.9 * 37.10 * This program is free software; you can redistribute it and/or 37.11 * modify it under the terms of the GNU General Public License as 37.12 @@ -29,8 +29,11 @@ 37.13 #include <stdlib.h> 37.14 37.15 #include <ipc/server.h> 37.16 + 37.17 #include "pwm_object_server.h" 37.18 37.19 + 37.20 + 37.21 /* Virtual addresses for the GPIO and PWM register blocks. */ 37.22 37.23 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0; 37.24 @@ -53,7 +56,7 @@ 37.25 37.26 /* PWM peripheral device. */ 37.27 37.28 -class server_PWMObject : public PWMObject 37.29 +class PWMObject_server : public PWMObject 37.30 { 37.31 Pwm_jz4730_chip *_device = 0; 37.32 int _duty, _period, _prescale; 37.33 @@ -61,7 +64,7 @@ 37.34 public: 37.35 /* Associate the device with a particular memory region. */ 37.36 37.37 - explicit server_PWMObject(Pwm_jz4730_chip *device, int duty, int period, 37.38 + explicit PWMObject_server(Pwm_jz4730_chip *device, int duty, int period, 37.39 int prescale) 37.40 : _device(device), _duty(duty), _period(period), _prescale(prescale) 37.41 { 37.42 @@ -130,15 +133,13 @@ 37.43 37.44 /* Initialise and register a new server object. */ 37.45 37.46 - server_PWMObject obj(&pwm_device, duty, period, prescale); 37.47 - l4_cap_idx_t server; 37.48 + PWMObject_server obj(&pwm_device, duty, period, prescale); 37.49 37.50 - if (ipc_server_bind("pwm", (l4_umword_t) &obj, &server)) return 1; 37.51 + /* Bind and start the IPC server loop. */ 37.52 37.53 - /* Enter the IPC server loop. */ 37.54 + if (ipc_server_loop_for(PWMObject, &obj, "pwm")) 37.55 + return 1; 37.56 37.57 - ipc_server_loop(PWMObject_expected_items, &obj, 37.58 - (ipc_server_handler_type) handle_PWMObject); 37.59 return 0; 37.60 } 37.61 37.62 @@ -150,23 +151,29 @@ 37.63 { 37.64 int number, duty, period, prescale; 37.65 37.66 - if (argc < 5) return 1; 37.67 + if (argc < 5) 37.68 + return 1; 37.69 37.70 /* Interpret and restrict the device number. */ 37.71 37.72 number = atoi(argv[1]); 37.73 - if ((number < 0) || (number > 1)) return 1; 37.74 + 37.75 + if ((number < 0) || (number > 1)) 37.76 + return 1; 37.77 37.78 /* Interpret and restrict the initial parameters. */ 37.79 37.80 duty = atoi(argv[2]); 37.81 period = atoi(argv[3]); 37.82 prescale = atoi(argv[4]); 37.83 - if ((duty < 0) || (period < 0) || (prescale < 0)) return 1; 37.84 + 37.85 + if ((duty < 0) || (period < 0) || (prescale < 0)) 37.86 + return 1; 37.87 37.88 /* Obtain access to peripheral memory. */ 37.89 37.90 - if (setup_memory()) return 1; 37.91 + if (setup_memory()) 37.92 + return 1; 37.93 37.94 return run(number, duty, period, prescale); 37.95 }
38.1 --- a/pkg/devices/spi/src/jz4740/spi-jz4740.cc Sat Jun 10 23:59:44 2023 +0200 38.2 +++ b/pkg/devices/spi/src/jz4740/spi-jz4740.cc Sun Jun 11 15:42:11 2023 +0200 38.3 @@ -1,7 +1,7 @@ 38.4 /* 38.5 * Export JZ4740 GPIO pins as a SPI server. 38.6 * 38.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk> 38.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk> 38.9 * 38.10 * This program is free software; you can redistribute it and/or 38.11 * modify it under the terms of the GNU General Public License as 38.12 @@ -29,8 +29,11 @@ 38.13 #include <stdlib.h> 38.14 38.15 #include <ipc/server.h> 38.16 + 38.17 #include "spi_server.h" 38.18 38.19 + 38.20 + 38.21 /* Virtual addresses for the GPIO register block. */ 38.22 38.23 static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0; 38.24 @@ -49,7 +52,7 @@ 38.25 38.26 /* SPI peripheral device. */ 38.27 38.28 -class server_SPI : public SPI 38.29 +class SPI_server : public SPI 38.30 { 38.31 Gpio_jz4740_chip *_clock_device = 0, *_data_device = 0, *_enable_device = 0; 38.32 int _clock_pin, _data_pin, _enable_pin; 38.33 @@ -57,7 +60,7 @@ 38.34 public: 38.35 /* Associate the device with a particular memory region. */ 38.36 38.37 - explicit server_SPI(Gpio_jz4740_chip *clock_device, 38.38 + explicit SPI_server(Gpio_jz4740_chip *clock_device, 38.39 Gpio_jz4740_chip *data_device, 38.40 Gpio_jz4740_chip *enable_device, 38.41 int clock_pin, int data_pin, int enable_pin) 38.42 @@ -141,17 +144,22 @@ 38.43 { 38.44 int clock_port, clock_pin, data_port, data_pin, enable_port, enable_pin; 38.45 38.46 - if (argc < 4) return 1; 38.47 + if (argc < 4) 38.48 + return 1; 38.49 38.50 /* Interpret the pin details. */ 38.51 38.52 - if (!parse_pin(argv[1], "ABCD", &clock_port, &clock_pin)) return 1; 38.53 - if (!parse_pin(argv[2], "ABCD", &data_port, &data_pin)) return 1; 38.54 - if (!parse_pin(argv[3], "ABCD", &enable_port, &enable_pin)) return 1; 38.55 + if (!parse_pin(argv[1], "ABCD", &clock_port, &clock_pin)) 38.56 + return 1; 38.57 + if (!parse_pin(argv[2], "ABCD", &data_port, &data_pin)) 38.58 + return 1; 38.59 + if (!parse_pin(argv[3], "ABCD", &enable_port, &enable_pin)) 38.60 + return 1; 38.61 38.62 /* Obtain access to peripheral memory. */ 38.63 38.64 - if (setup_memory()) return 1; 38.65 + if (setup_memory()) 38.66 + return 1; 38.67 38.68 /* Configure the clock pin. */ 38.69 38.70 @@ -176,16 +184,13 @@ 38.71 38.72 /* Initialise and register a new server object. */ 38.73 38.74 - server_SPI obj(&gpio_port_clock, &gpio_port_data, &gpio_port_enable, 38.75 + SPI_server obj(&gpio_port_clock, &gpio_port_data, &gpio_port_enable, 38.76 clock_pin, data_pin, enable_pin); 38.77 - l4_cap_idx_t server; 38.78 38.79 - if (ipc_server_bind("spi", (l4_umword_t) &obj, &server)) return 1; 38.80 + /* Bind and start the IPC server loop. */ 38.81 38.82 - /* Enter the IPC server loop. */ 38.83 - 38.84 - ipc_server_loop(SPI_expected_items, &obj, 38.85 - (ipc_server_handler_type) handle_SPI); 38.86 + if (ipc_server_loop_for(SPI, &obj, "spi")) 38.87 + return 1; 38.88 38.89 return 0; 38.90 }
39.1 --- a/pkg/devices/util/include/dataspace.h Sat Jun 10 23:59:44 2023 +0200 39.2 +++ b/pkg/devices/util/include/dataspace.h Sun Jun 11 15:42:11 2023 +0200 39.3 @@ -1,7 +1,7 @@ 39.4 /* 39.5 * Data space allocation utility functions. 39.6 * 39.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 39.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 39.9 * 39.10 * This program is free software; you can redistribute it and/or 39.11 * modify it under the terms of the GNU General Public License as 39.12 @@ -21,8 +21,7 @@ 39.13 39.14 #pragma once 39.15 39.16 -#include <l4/re/dataspace> 39.17 -#include <l4/sys/capability> 39.18 +#include <l4/re/c/dataspace.h> 39.19 #include <l4/sys/types.h> 39.20 39.21 -L4::Cap<L4Re::Dataspace> allocate_data(l4_size_t mem_size, void **allocated); 39.22 +l4re_ds_t allocate_data(l4_size_t mem_size, void **allocated);
40.1 --- a/pkg/devices/util/include/event-loop.h Sat Jun 10 23:59:44 2023 +0200 40.2 +++ b/pkg/devices/util/include/event-loop.h Sun Jun 11 15:42:11 2023 +0200 40.3 @@ -1,7 +1,7 @@ 40.4 /* 40.5 * Generic event loop functionality. 40.6 * 40.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 40.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 40.9 * 40.10 * This program is free software; you can redistribute it and/or 40.11 * modify it under the terms of the GNU General Public License as 40.12 @@ -26,6 +26,8 @@ 40.13 #include <pthread.h> 40.14 #include <pthread-l4.h> 40.15 40.16 + 40.17 + 40.18 /* Event loop abstraction. */ 40.19 40.20 class Event_loop
41.1 --- a/pkg/devices/util/src/dataspace.cc Sat Jun 10 23:59:44 2023 +0200 41.2 +++ b/pkg/devices/util/src/dataspace.cc Sun Jun 11 15:42:11 2023 +0200 41.3 @@ -19,46 +19,28 @@ 41.4 * Boston, MA 02110-1301, USA 41.5 */ 41.6 41.7 -#include <l4/re/dataspace> 41.8 -#include <l4/re/env> 41.9 -#include <l4/re/rm> 41.10 -#include <l4/re/util/cap_alloc> 41.11 +#include <l4/re/c/mem_alloc.h> 41.12 + 41.13 +#include <ipc/mem_ipc.h> 41.14 41.15 #include "dataspace.h" 41.16 41.17 -/* 41.18 -Allocate and map a region containing data, using the given mem_size to indicate 41.19 -the required region size, along with a pointer to be set to the allocated 41.20 -region. Return a capability which may be invalid if allocation or mapping 41.21 -failed. 41.22 + 41.23 + 41.24 +/* Allocate and map a region containing data, using the given mem_size to 41.25 + indicate the required region size, along with a pointer to be set to the 41.26 + allocated region. Return a capability which may be invalid if allocation or 41.27 + mapping failed. 41.28 */ 41.29 41.30 -L4::Cap<L4Re::Dataspace> allocate_data(l4_size_t mem_size, void **allocated) 41.31 +l4re_ds_t allocate_data(l4_size_t mem_size, void **allocated) 41.32 { 41.33 - /* Obtain a capability for the allocated memory. */ 41.34 - 41.35 - L4::Cap<L4Re::Dataspace> mem = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>(); 41.36 - 41.37 - if (!mem.is_valid()) 41.38 - return L4::Cap<L4Re::Dataspace>::Invalid; 41.39 - 41.40 - /* Allocate memory for the data. */ 41.41 + l4re_ds_t mem; 41.42 41.43 - if (L4Re::Env::env()->mem_alloc()->alloc(mem_size, mem, L4Re::Mem_alloc::Continuous)) 41.44 - { 41.45 - L4Re::Util::cap_alloc.free(mem); 41.46 - return L4::Cap<L4Re::Dataspace>::Invalid; 41.47 - } 41.48 - 41.49 - /* Map the memory to a virtual address. */ 41.50 + /* Allocate memory for the data and map it to a virtual address. */ 41.51 41.52 - if (L4Re::Env::env()->rm()->attach(allocated, mem->size(), 41.53 - L4Re::Rm::F::Search_addr | L4Re::Rm::F::RW, 41.54 - L4::Ipc::make_cap_rw(mem))) 41.55 - { 41.56 - L4Re::Util::cap_alloc.free(mem); 41.57 - return L4::Cap<L4Re::Dataspace>::Invalid; 41.58 - } 41.59 + if (ipc_allocate_align(mem_size, L4RE_MA_CONTINUOUS, 0, allocated, &mem)) 41.60 + return L4_INVALID_CAP; 41.61 41.62 return mem; 41.63 }
42.1 --- a/pkg/devices/util/src/event-loop.cc Sat Jun 10 23:59:44 2023 +0200 42.2 +++ b/pkg/devices/util/src/event-loop.cc Sun Jun 11 15:42:11 2023 +0200 42.3 @@ -1,7 +1,7 @@ 42.4 /* 42.5 * Generic event loop functionality. 42.6 * 42.7 - * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 42.8 + * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 42.9 * 42.10 * This program is free software; you can redistribute it and/or 42.11 * modify it under the terms of the GNU General Public License as 42.12 @@ -24,24 +24,23 @@ 42.13 #include <pthread.h> 42.14 #include <pthread-l4.h> 42.15 42.16 -#include <l4/re/event> 42.17 + 42.18 42.19 /* Main loop for event threads. */ 42.20 42.21 -void * 42.22 -Event_loop::event_loop(void *data) 42.23 +void *Event_loop::event_loop(void *data) 42.24 { 42.25 Event_loop *self = reinterpret_cast<Event_loop *>(data); 42.26 42.27 - while (1) self->handle(); 42.28 + while (1) 42.29 + self->handle(); 42.30 42.31 return 0; 42.32 } 42.33 42.34 /* Event loop initiation. */ 42.35 42.36 -void 42.37 -Event_loop::start() 42.38 +void Event_loop::start() 42.39 { 42.40 pthread_attr_t thread_attr; 42.41 struct sched_param sp;
43.1 --- a/pkg/devices/util/src/memory.cc Sat Jun 10 23:59:44 2023 +0200 43.2 +++ b/pkg/devices/util/src/memory.cc Sun Jun 11 15:42:11 2023 +0200 43.3 @@ -28,6 +28,8 @@ 43.4 43.5 #include "memory.h" 43.6 43.7 + 43.8 + 43.9 int get_device(char const *hid, l4io_device_handle_t *dh, l4io_resource_handle_t *rh) 43.10 { 43.11 return l4io_lookup_device(hid, dh, 0, rh);