1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/pkg/devices/lib/gpio/include/gpio-generic.h Tue Apr 30 01:32:10 2024 +0200 1.3 @@ -0,0 +1,37 @@ 1.4 +/* 1.5 + * Generic GPIO driver abstractions. 1.6 + * 1.7 + * Copyright (C) 2024 Paul Boddie <paul@boddie.org.uk> 1.8 + * 1.9 + * This program is free software; you can redistribute it and/or 1.10 + * modify it under the terms of the GNU General Public License as 1.11 + * published by the Free Software Foundation; either version 2 of 1.12 + * the License, or (at your option) any later version. 1.13 + * 1.14 + * This program is distributed in the hope that it will be useful, 1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.17 + * GNU General Public License for more details. 1.18 + * 1.19 + * You should have received a copy of the GNU General Public License 1.20 + * along with this program; if not, write to the Free Software 1.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 1.22 + * Boston, MA 02110-1301, USA 1.23 + */ 1.24 + 1.25 +#pragma once 1.26 + 1.27 +#include <l4/sys/types.h> 1.28 +#include <stdint.h> 1.29 +#include "gpio.h" 1.30 + 1.31 + 1.32 + 1.33 +#ifdef __cplusplus 1.34 + 1.35 +// Generic access to the GPIO abstraction. 1.36 + 1.37 +Hw::Gpio_chip *new_gpio_chip(const char *name, l4_addr_t gpio_base, 1.38 + uint8_t port_number, bool shadow = false); 1.39 + 1.40 +#endif /* __cplusplus */
2.1 --- a/pkg/devices/lib/gpio/include/gpio-jz4730.h Tue Apr 30 01:31:23 2024 +0200 2.2 +++ b/pkg/devices/lib/gpio/include/gpio-jz4730.h Tue Apr 30 01:32:10 2024 +0200 2.3 @@ -30,10 +30,9 @@ 2.4 2.5 #pragma once 2.6 2.7 -#include <l4/sys/err.h> 2.8 #include <l4/sys/types.h> 2.9 #include <stdint.h> 2.10 -#include "gpio.h" 2.11 +#include "gpio-generic.h" 2.12 2.13 2.14 2.15 @@ -79,33 +78,8 @@ 2.16 Hw::Register_block<32> _regs; 2.17 2.18 l4_addr_t _start; 2.19 - unsigned _nr_pins; 2.20 struct gpio_port *_pull_config; 2.21 2.22 - // Convenience method for obtaining the bit corresponding to a pin. 2.23 - 2.24 - l4_uint32_t _pin_bit(unsigned pin) 2.25 - { return 1 << (pin & 31); } 2.26 - 2.27 - // Convenience method for obtaining the bit position of a pin. 2.28 - 2.29 - unsigned _pin_shift(unsigned pin) 2.30 - { return pin % 32; } 2.31 - 2.32 - // Permit only "aligned" accesses to registers. 2.33 - 2.34 - unsigned _reg_offset_check(unsigned pin_offset) const 2.35 - { 2.36 - switch (pin_offset) 2.37 - { 2.38 - case 0: 2.39 - return 0; 2.40 - 2.41 - default: 2.42 - throw -L4_EINVAL; 2.43 - } 2.44 - } 2.45 - 2.46 // General configuration register updates. 2.47 2.48 void _config(unsigned bitmap, unsigned mode); 2.49 @@ -124,16 +98,7 @@ 2.50 unsigned *value); 2.51 2.52 public: 2.53 - Gpio_jz4730_chip(l4_addr_t start, uint8_t port_number); 2.54 - 2.55 - // Obtain the number of pins. 2.56 - 2.57 - unsigned nr_pins() const { return _nr_pins; } 2.58 - 2.59 - // Unnecessary operations. 2.60 - 2.61 - void request(unsigned) {} 2.62 - void free(unsigned) {} 2.63 + explicit Gpio_jz4730_chip(l4_addr_t start, uint8_t port_number); 2.64 2.65 // Configuration methods. 2.66 2.67 @@ -164,6 +129,9 @@ 2.68 void config(unsigned pin, unsigned mode); 2.69 }; 2.70 2.71 +Hw::Gpio_chip *jz4730_gpio_chip(l4_addr_t start, uint8_t port_number, 2.72 + bool shadow = false); 2.73 + 2.74 #endif /* __cplusplus */ 2.75 2.76
3.1 --- a/pkg/devices/lib/gpio/include/gpio-jz4740.h Tue Apr 30 01:31:23 2024 +0200 3.2 +++ b/pkg/devices/lib/gpio/include/gpio-jz4740.h Tue Apr 30 01:32:10 2024 +0200 3.3 @@ -2,7 +2,7 @@ 3.4 * GPIO driver for Ingenic JZ4740. 3.5 * (See below for additional copyright and licensing notices.) 3.6 * 3.7 - * Copyright (C) 2017, 2018, 2023 Paul Boddie <paul@boddie.org.uk> 3.8 + * Copyright (C) 2017, 2018, 2023, 2024 Paul Boddie <paul@boddie.org.uk> 3.9 * 3.10 * This program is free software; you can redistribute it and/or 3.11 * modify it under the terms of the GNU General Public License as 3.12 @@ -30,10 +30,9 @@ 3.13 3.14 #pragma once 3.15 3.16 -#include <l4/sys/err.h> 3.17 #include <l4/sys/types.h> 3.18 #include <stdint.h> 3.19 -#include "gpio.h" 3.20 +#include "gpio-generic.h" 3.21 3.22 3.23 3.24 @@ -71,33 +70,8 @@ 3.25 Hw::Register_block<32> _regs; 3.26 3.27 l4_addr_t _start; 3.28 - unsigned _nr_pins; 3.29 struct gpio_port *_pull_config; 3.30 3.31 - // Convenience method for obtaining the bit corresponding to a pin. 3.32 - 3.33 - l4_uint32_t _pin_bit(unsigned pin) 3.34 - { return 1 << (pin & 31); } 3.35 - 3.36 - // Convenience method for obtaining the bit position of a pin. 3.37 - 3.38 - unsigned _pin_shift(unsigned pin) 3.39 - { return pin % 32; } 3.40 - 3.41 - // Permit only "aligned" accesses to registers. 3.42 - 3.43 - unsigned _reg_offset_check(unsigned pin_offset) const 3.44 - { 3.45 - switch (pin_offset) 3.46 - { 3.47 - case 0: 3.48 - return 0; 3.49 - 3.50 - default: 3.51 - throw -L4_EINVAL; 3.52 - } 3.53 - } 3.54 - 3.55 // General configuration register updates. 3.56 3.57 void _config(unsigned bitmap, unsigned mode); 3.58 @@ -111,16 +85,7 @@ 3.59 void _config_pad(unsigned bitmap, unsigned func, unsigned value); 3.60 3.61 public: 3.62 - Gpio_jz4740_chip(l4_addr_t start, uint8_t port_number); 3.63 - 3.64 - // Obtain the number of pins. 3.65 - 3.66 - unsigned nr_pins() const { return _nr_pins; } 3.67 - 3.68 - // Unnecessary operations. 3.69 - 3.70 - void request(unsigned) {} 3.71 - void free(unsigned) {} 3.72 + explicit Gpio_jz4740_chip(l4_addr_t start, uint8_t port_number); 3.73 3.74 // Configuration methods. 3.75 3.76 @@ -151,6 +116,9 @@ 3.77 void config(unsigned pin, unsigned mode); 3.78 }; 3.79 3.80 +Hw::Gpio_chip *jz4740_gpio_chip(l4_addr_t start, uint8_t port_number, 3.81 + bool shadow = false); 3.82 + 3.83 #endif /* __cplusplus */ 3.84 3.85
4.1 --- a/pkg/devices/lib/gpio/include/gpio-jz4780.h Tue Apr 30 01:31:23 2024 +0200 4.2 +++ b/pkg/devices/lib/gpio/include/gpio-jz4780.h Tue Apr 30 01:32:10 2024 +0200 4.3 @@ -2,7 +2,7 @@ 4.4 * GPIO driver for Ingenic JZ4780. 4.5 * (See below for additional copyright and licensing notices.) 4.6 * 4.7 - * Copyright (C) 2017, 2018, 2023 Paul Boddie <paul@boddie.org.uk> 4.8 + * Copyright (C) 2017, 2018, 2023, 2024 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 @@ -30,10 +30,9 @@ 4.13 4.14 #pragma once 4.15 4.16 -#include <l4/sys/err.h> 4.17 #include <l4/sys/types.h> 4.18 #include <stdint.h> 4.19 -#include "gpio.h" 4.20 +#include "gpio-generic.h" 4.21 4.22 4.23 4.24 @@ -71,44 +70,10 @@ 4.25 Hw::Register_block<32> _regs; 4.26 4.27 l4_addr_t _start; 4.28 - unsigned _nr_pins; 4.29 struct gpio_port *_pull_config; 4.30 4.31 - // Convenience method for obtaining the bit corresponding to a pin. 4.32 - 4.33 - l4_uint32_t _pin_bit(unsigned pin) 4.34 - { return 1 << (pin & 31); } 4.35 - 4.36 - // Convenience method for obtaining the bit position of a pin. 4.37 - 4.38 - unsigned _pin_shift(unsigned pin) 4.39 - { return pin % 32; } 4.40 - 4.41 - // Permit only "aligned" accesses to registers. 4.42 - 4.43 - unsigned _reg_offset_check(unsigned pin_offset) const 4.44 - { 4.45 - switch (pin_offset) 4.46 - { 4.47 - case 0: 4.48 - return 0; 4.49 - 4.50 - default: 4.51 - throw -L4_EINVAL; 4.52 - } 4.53 - } 4.54 - 4.55 public: 4.56 - Gpio_jz4780_chip(l4_addr_t start, uint8_t port_number); 4.57 - 4.58 - // Obtain the number of pins. 4.59 - 4.60 - unsigned nr_pins() const { return _nr_pins; } 4.61 - 4.62 - // Unnecessary operations. 4.63 - 4.64 - void request(unsigned) {} 4.65 - void free(unsigned) {} 4.66 + explicit Gpio_jz4780_chip(l4_addr_t start, uint8_t port_number); 4.67 4.68 // Configuration methods. 4.69 4.70 @@ -138,6 +103,9 @@ 4.71 void config(unsigned pin, unsigned mode); 4.72 }; 4.73 4.74 +Hw::Gpio_chip *jz4780_gpio_chip(l4_addr_t start, uint8_t port_number, 4.75 + bool shadow = false); 4.76 + 4.77 #endif /* __cplusplus */ 4.78 4.79
5.1 --- a/pkg/devices/lib/gpio/include/gpio-x1600.h Tue Apr 30 01:31:23 2024 +0200 5.2 +++ b/pkg/devices/lib/gpio/include/gpio-x1600.h Tue Apr 30 01:32:10 2024 +0200 5.3 @@ -30,10 +30,9 @@ 5.4 5.5 #pragma once 5.6 5.7 -#include <l4/sys/err.h> 5.8 #include <l4/sys/types.h> 5.9 #include <stdint.h> 5.10 -#include "gpio.h" 5.11 +#include "gpio-generic.h" 5.12 5.13 5.14 5.15 @@ -82,7 +81,6 @@ 5.16 Hw::Register_block<32> _regs, _shadow_regs; 5.17 5.18 l4_addr_t _start; 5.19 - unsigned _nr_pins; 5.20 struct gpio_port *_pull_config; 5.21 5.22 // Optional shadow port configuration. 5.23 @@ -91,43 +89,11 @@ 5.24 uint8_t _port_number; 5.25 bool _shadow; 5.26 5.27 - // Convenience method for obtaining the bit corresponding to a pin. 5.28 - 5.29 - l4_uint32_t _pin_bit(unsigned pin) 5.30 - { return 1 << (pin & 31); } 5.31 - 5.32 - // Convenience method for obtaining the bit position of a pin. 5.33 - 5.34 - unsigned _pin_shift(unsigned pin) 5.35 - { return pin % 32; } 5.36 - 5.37 - // Permit only "aligned" accesses to registers. 5.38 - 5.39 - unsigned _reg_offset_check(unsigned pin_offset) const 5.40 - { 5.41 - switch (pin_offset) 5.42 - { 5.43 - case 0: 5.44 - return 0; 5.45 - 5.46 - default: 5.47 - throw -L4_EINVAL; 5.48 - } 5.49 - } 5.50 - 5.51 void write_reg_pin(unsigned reg, unsigned pin); 5.52 5.53 public: 5.54 - Gpio_x1600_chip(l4_addr_t start, uint8_t port_number, bool shadow = false); 5.55 - 5.56 - // Obtain the number of pins. 5.57 - 5.58 - unsigned nr_pins() const { return _nr_pins; } 5.59 - 5.60 - // Unnecessary operations. 5.61 - 5.62 - void request(unsigned) {} 5.63 - void free(unsigned) {} 5.64 + explicit Gpio_x1600_chip(l4_addr_t start, uint8_t port_number, 5.65 + bool shadow = false); 5.66 5.67 // Configuration methods. 5.68 5.69 @@ -157,6 +123,9 @@ 5.70 void config(unsigned pin, unsigned mode); 5.71 }; 5.72 5.73 +Hw::Gpio_chip *x1600_gpio_chip(l4_addr_t start, uint8_t port_number, 5.74 + bool shadow = false); 5.75 + 5.76 #endif /* __cplusplus */ 5.77 5.78
6.1 --- a/pkg/devices/lib/gpio/include/gpio.h Tue Apr 30 01:31:23 2024 +0200 6.2 +++ b/pkg/devices/lib/gpio/include/gpio.h Tue Apr 30 01:32:10 2024 +0200 6.3 @@ -30,6 +30,7 @@ 6.4 6.5 #pragma once 6.6 6.7 +#include <l4/sys/err.h> 6.8 #include <l4/vbus/vbus_gpio.h> 6.9 #include <stdint.h> 6.10 6.11 @@ -64,7 +65,39 @@ 6.12 6.13 class Gpio_chip 6.14 { 6.15 +protected: 6.16 + unsigned _nr_pins; 6.17 + 6.18 + // Convenience method for obtaining the bit corresponding to a pin. 6.19 + 6.20 + l4_uint32_t _pin_bit(unsigned pin) 6.21 + { return 1 << (pin & 31); } 6.22 + 6.23 + // Convenience method for obtaining the bit position of a pin. 6.24 + 6.25 + unsigned _pin_shift(unsigned pin) 6.26 + { return pin % 32; } 6.27 + 6.28 + // Permit only "aligned" accesses to registers. 6.29 + 6.30 + unsigned _reg_offset_check(unsigned pin_offset) const 6.31 + { 6.32 + switch (pin_offset) 6.33 + { 6.34 + case 0: 6.35 + return 0; 6.36 + 6.37 + default: 6.38 + throw -L4_EINVAL; 6.39 + } 6.40 + } 6.41 + 6.42 public: 6.43 + explicit Gpio_chip(unsigned nr_pins) 6.44 + : _nr_pins(nr_pins) 6.45 + { 6.46 + } 6.47 + 6.48 /// Modes used for setup() 6.49 enum Fix_mode 6.50 { 6.51 @@ -89,14 +122,12 @@ 6.52 Function_irq, 6.53 }; 6.54 6.55 - virtual void request(unsigned pin) = 0; 6.56 - virtual void free(unsigned pin) = 0; 6.57 - 6.58 /** 6.59 * \brief Request number of pins from GPIO chip 6.60 * \return Number of pins of this GPIO chip 6.61 */ 6.62 - virtual unsigned nr_pins() const = 0; 6.63 + virtual unsigned nr_pins() const 6.64 + { return _nr_pins; } 6.65 6.66 /** 6.67 * \brief Generic (platform independent) setup for a pin.
7.1 --- a/pkg/devices/lib/gpio/src/Makefile Tue Apr 30 01:31:23 2024 +0200 7.2 +++ b/pkg/devices/lib/gpio/src/Makefile Tue Apr 30 01:32:10 2024 +0200 7.3 @@ -4,7 +4,7 @@ 7.4 TARGET = libgpio.o.a libgpio.o.so 7.5 PC_FILENAME := libdrivers-gpio 7.6 7.7 -SRC_CC := jz4730.cc jz4740.cc jz4780.cc x1600.cc 7.8 +SRC_CC := generic.cc jz4730.cc jz4740.cc jz4780.cc x1600.cc 7.9 7.10 PRIVATE_INCDIR += $(PKGDIR)/lib/gpio/include 7.11
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/pkg/devices/lib/gpio/src/generic.cc Tue Apr 30 01:32:10 2024 +0200 8.3 @@ -0,0 +1,57 @@ 8.4 +/* 8.5 + * Generic access to general purpose input/output functionality. 8.6 + * 8.7 + * Copyright (C) 2024 Paul Boddie <paul@boddie.org.uk> 8.8 + * 8.9 + * This program is free software; you can redistribute it and/or 8.10 + * modify it under the terms of the GNU General Public License as 8.11 + * published by the Free Software Foundation; either version 2 of 8.12 + * the License, or (at your option) any later version. 8.13 + * 8.14 + * This program is distributed in the hope that it will be useful, 8.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 8.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8.17 + * GNU General Public License for more details. 8.18 + * 8.19 + * You should have received a copy of the GNU General Public License 8.20 + * along with this program; if not, write to the Free Software 8.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 8.22 + * Boston, MA 02110-1301, USA 8.23 + */ 8.24 + 8.25 +#include <string.h> 8.26 +#include "gpio-generic.h" 8.27 + 8.28 +/* Function declarations reproduced here to avoid clock identifier conflicts in 8.29 + the chip-specific headers. */ 8.30 + 8.31 +extern Hw::Gpio_chip *jz4730_gpio_chip(l4_addr_t, uint8_t, bool); 8.32 +extern Hw::Gpio_chip *jz4740_gpio_chip(l4_addr_t, uint8_t, bool); 8.33 +extern Hw::Gpio_chip *jz4780_gpio_chip(l4_addr_t, uint8_t, bool); 8.34 +extern Hw::Gpio_chip *x1600_gpio_chip(l4_addr_t, uint8_t, bool); 8.35 + 8.36 +struct gpio_function 8.37 +{ 8.38 + const char *name; 8.39 + Hw::Gpio_chip *(*function)(l4_addr_t, uint8_t, bool); 8.40 +}; 8.41 + 8.42 +static struct gpio_function functions[] = { 8.43 + {"jz4730", jz4730_gpio_chip}, 8.44 + {"jz4740", jz4740_gpio_chip}, 8.45 + {"jz4780", jz4780_gpio_chip}, 8.46 + {"x1600", x1600_gpio_chip}, 8.47 + {NULL, NULL} 8.48 +}; 8.49 + 8.50 +Hw::Gpio_chip *new_gpio_chip(const char *name, l4_addr_t gpio_base, 8.51 + uint8_t port_number, bool shadow) 8.52 +{ 8.53 + for (struct gpio_function *f = functions; f->name != NULL; f++) 8.54 + { 8.55 + if (!strcmp(name, f->name)) 8.56 + return f->function(gpio_base, port_number, shadow); 8.57 + } 8.58 + 8.59 + return NULL; 8.60 +}
9.1 --- a/pkg/devices/lib/gpio/src/jz4730.cc Tue Apr 30 01:31:23 2024 +0200 9.2 +++ b/pkg/devices/lib/gpio/src/jz4730.cc Tue Apr 30 01:32:10 2024 +0200 9.3 @@ -245,7 +245,7 @@ 9.4 // Initialise the GPIO controller. 9.5 9.6 Gpio_jz4730_chip::Gpio_jz4730_chip(l4_addr_t start, uint8_t port_number) 9.7 -: _nr_pins(32) 9.8 +: Hw::Gpio_chip(32) 9.9 { 9.10 _start = start + port_number * 0x30; 9.11 _regs = new Hw::Mmio_register_block<32>(_start); 9.12 @@ -526,13 +526,19 @@ 9.13 multi_set(mask, outvalues); 9.14 } 9.15 9.16 +Hw::Gpio_chip *jz4730_gpio_chip(l4_addr_t start, uint8_t port_number, bool shadow) 9.17 +{ 9.18 + (void) shadow; 9.19 + return new Gpio_jz4730_chip(start, port_number); 9.20 +} 9.21 + 9.22 9.23 9.24 // C language interface functions. 9.25 9.26 void *jz4730_gpio_init(l4_addr_t start, uint8_t port_number) 9.27 { 9.28 - return (void *) new Gpio_jz4730_chip(start, port_number); 9.29 + return (void *) jz4730_gpio_chip(start, port_number, false); 9.30 } 9.31 9.32 void jz4730_gpio_setup(void *gpio, unsigned pin, unsigned mode, int value)
10.1 --- a/pkg/devices/lib/gpio/src/jz4740.cc Tue Apr 30 01:31:23 2024 +0200 10.2 +++ b/pkg/devices/lib/gpio/src/jz4740.cc Tue Apr 30 01:32:10 2024 +0200 10.3 @@ -178,7 +178,7 @@ 10.4 // Initialise the GPIO controller. 10.5 10.6 Gpio_jz4740_chip::Gpio_jz4740_chip(l4_addr_t start, uint8_t port_number) 10.7 -: _nr_pins(32) 10.8 +: Hw::Gpio_chip(32) 10.9 { 10.10 _start = start + port_number * 0x100; 10.11 _regs = new Hw::Mmio_register_block<32>(_start); 10.12 @@ -423,13 +423,19 @@ 10.13 multi_set(mask, outvalues); 10.14 } 10.15 10.16 +Hw::Gpio_chip *jz4740_gpio_chip(l4_addr_t start, uint8_t port_number, bool shadow) 10.17 +{ 10.18 + (void) shadow; 10.19 + return new Gpio_jz4740_chip(start, port_number); 10.20 +} 10.21 + 10.22 10.23 10.24 // C language interface functions. 10.25 10.26 void *jz4740_gpio_init(l4_addr_t start, uint8_t port_number) 10.27 { 10.28 - return (void *) new Gpio_jz4740_chip(start, port_number); 10.29 + return (void *) jz4740_gpio_chip(start, port_number, false); 10.30 } 10.31 10.32 void jz4740_gpio_setup(void *gpio, unsigned pin, unsigned mode, int value)
11.1 --- a/pkg/devices/lib/gpio/src/jz4780.cc Tue Apr 30 01:31:23 2024 +0200 11.2 +++ b/pkg/devices/lib/gpio/src/jz4780.cc Tue Apr 30 01:32:10 2024 +0200 11.3 @@ -201,7 +201,7 @@ 11.4 // Initialise the GPIO controller. 11.5 11.6 Gpio_jz4780_chip::Gpio_jz4780_chip(l4_addr_t start, uint8_t port_number) 11.7 -: _nr_pins(32) 11.8 +: Hw::Gpio_chip(32) 11.9 { 11.10 _start = start + port_number * 0x100; 11.11 _regs = new Hw::Mmio_register_block<32>(_start); 11.12 @@ -437,13 +437,19 @@ 11.13 setup(pin, mode, outvalues & 1); 11.14 } 11.15 11.16 +Hw::Gpio_chip *jz4780_gpio_chip(l4_addr_t start, uint8_t port_number, bool shadow) 11.17 +{ 11.18 + (void) shadow; 11.19 + return new Gpio_jz4780_chip(start, port_number); 11.20 +} 11.21 + 11.22 11.23 11.24 // C language interface functions. 11.25 11.26 void *jz4780_gpio_init(l4_addr_t start, uint8_t port_number) 11.27 { 11.28 - return (void *) new Gpio_jz4780_chip(start, port_number); 11.29 + return (void *) jz4780_gpio_chip(start, port_number, false); 11.30 } 11.31 11.32 void jz4780_gpio_setup(void *gpio, unsigned pin, unsigned mode, int value)
12.1 --- a/pkg/devices/lib/gpio/src/x1600.cc Tue Apr 30 01:31:23 2024 +0200 12.2 +++ b/pkg/devices/lib/gpio/src/x1600.cc Tue Apr 30 01:32:10 2024 +0200 12.3 @@ -228,7 +228,7 @@ 12.4 12.5 Gpio_x1600_chip::Gpio_x1600_chip(l4_addr_t start, uint8_t port_number, 12.6 bool shadow) 12.7 -: _nr_pins(32), _port_number(port_number), _shadow(shadow) 12.8 +: Hw::Gpio_chip(32), _port_number(port_number), _shadow(shadow) 12.9 { 12.10 _start = start + port_number * 0x100; 12.11 _regs = new Hw::Mmio_register_block<32>(_start); 12.12 @@ -493,18 +493,23 @@ 12.13 setup(pin, mode, outvalues & 1); 12.14 } 12.15 12.16 +Hw::Gpio_chip *x1600_gpio_chip(l4_addr_t start, uint8_t port_number, bool shadow) 12.17 +{ 12.18 + return new Gpio_x1600_chip(start, port_number, shadow); 12.19 +} 12.20 + 12.21 12.22 12.23 // C language interface functions. 12.24 12.25 void *x1600_gpio_init(l4_addr_t start, uint8_t port_number) 12.26 { 12.27 - return (void *) new Gpio_x1600_chip(start, port_number, false); 12.28 + return (void *) x1600_gpio_chip(start, port_number, false); 12.29 } 12.30 12.31 void *x1600_gpio_init_shadow(l4_addr_t start, uint8_t port_number) 12.32 { 12.33 - return (void *) new Gpio_x1600_chip(start, port_number, true); 12.34 + return (void *) x1600_gpio_chip(start, port_number, true); 12.35 } 12.36 12.37 void x1600_gpio_setup(void *gpio, unsigned pin, unsigned mode, int value)