drivers: gpio_mmio32: add support for pin validation

Add the common config structure as a prefix of the driver-specific
config structure and use the mask parameter to initialize it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-12-11 11:01:09 -06:00 committed by Carles Cufí
commit d68807a391

View file

@ -12,6 +12,8 @@
#include <zephyr/types.h>
struct gpio_mmio32_config {
/* gpio_driver_config needs to be first */
struct gpio_driver_config common;
volatile u32_t *reg;
u32_t mask;
};
@ -44,7 +46,10 @@ int gpio_mmio32_init(struct device *dev);
static struct gpio_mmio32_context _dev_name##_dev_data; \
\
static const struct gpio_mmio32_config _dev_name##_dev_cfg = { \
.reg = (volatile u32_t *)_address, \
.common = { \
.port_pin_mask = _mask, \
}, \
.reg = (volatile u32_t *)_address, \
.mask = _mask, \
}; \
\