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:
parent
7c175c5197
commit
d68807a391
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,8 @@
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
|
|
||||||
struct gpio_mmio32_config {
|
struct gpio_mmio32_config {
|
||||||
|
/* gpio_driver_config needs to be first */
|
||||||
|
struct gpio_driver_config common;
|
||||||
volatile u32_t *reg;
|
volatile u32_t *reg;
|
||||||
u32_t mask;
|
u32_t mask;
|
||||||
};
|
};
|
||||||
|
@ -44,7 +46,10 @@ int gpio_mmio32_init(struct device *dev);
|
||||||
static struct gpio_mmio32_context _dev_name##_dev_data; \
|
static struct gpio_mmio32_context _dev_name##_dev_data; \
|
||||||
\
|
\
|
||||||
static const struct gpio_mmio32_config _dev_name##_dev_cfg = { \
|
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, \
|
.mask = _mask, \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue