1.1 --- a/pkg/devices/lib/gpio/include/gpio-jz4730.h Tue Apr 30 01:31:23 2024 +0200
1.2 +++ b/pkg/devices/lib/gpio/include/gpio-jz4730.h Tue Apr 30 01:32:10 2024 +0200
1.3 @@ -30,10 +30,9 @@
1.4
1.5 #pragma once
1.6
1.7 -#include <l4/sys/err.h>
1.8 #include <l4/sys/types.h>
1.9 #include <stdint.h>
1.10 -#include "gpio.h"
1.11 +#include "gpio-generic.h"
1.12
1.13
1.14
1.15 @@ -79,33 +78,8 @@
1.16 Hw::Register_block<32> _regs;
1.17
1.18 l4_addr_t _start;
1.19 - unsigned _nr_pins;
1.20 struct gpio_port *_pull_config;
1.21
1.22 - // Convenience method for obtaining the bit corresponding to a pin.
1.23 -
1.24 - l4_uint32_t _pin_bit(unsigned pin)
1.25 - { return 1 << (pin & 31); }
1.26 -
1.27 - // Convenience method for obtaining the bit position of a pin.
1.28 -
1.29 - unsigned _pin_shift(unsigned pin)
1.30 - { return pin % 32; }
1.31 -
1.32 - // Permit only "aligned" accesses to registers.
1.33 -
1.34 - unsigned _reg_offset_check(unsigned pin_offset) const
1.35 - {
1.36 - switch (pin_offset)
1.37 - {
1.38 - case 0:
1.39 - return 0;
1.40 -
1.41 - default:
1.42 - throw -L4_EINVAL;
1.43 - }
1.44 - }
1.45 -
1.46 // General configuration register updates.
1.47
1.48 void _config(unsigned bitmap, unsigned mode);
1.49 @@ -124,16 +98,7 @@
1.50 unsigned *value);
1.51
1.52 public:
1.53 - Gpio_jz4730_chip(l4_addr_t start, uint8_t port_number);
1.54 -
1.55 - // Obtain the number of pins.
1.56 -
1.57 - unsigned nr_pins() const { return _nr_pins; }
1.58 -
1.59 - // Unnecessary operations.
1.60 -
1.61 - void request(unsigned) {}
1.62 - void free(unsigned) {}
1.63 + explicit Gpio_jz4730_chip(l4_addr_t start, uint8_t port_number);
1.64
1.65 // Configuration methods.
1.66
1.67 @@ -164,6 +129,9 @@
1.68 void config(unsigned pin, unsigned mode);
1.69 };
1.70
1.71 +Hw::Gpio_chip *jz4730_gpio_chip(l4_addr_t start, uint8_t port_number,
1.72 + bool shadow = false);
1.73 +
1.74 #endif /* __cplusplus */
1.75
1.76