gpio: use named types to distinguish pin sets from pin values

Both pin sets and values encoding pin values are ultimately represented
by 32-bit unsigned integers. Provide typedefs that make the role of a
parameter explicit.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit is contained in:
Peter Bigot 2019-08-26 11:44:01 -05:00 committed by Carles Cufí
commit 48b674b570
2 changed files with 59 additions and 44 deletions

View file

@ -34,17 +34,17 @@ static inline int z_vrfy_gpio_read(struct device *port, int access_op,
#include <syscalls/gpio_read_mrsh.c>
static inline int z_vrfy_gpio_port_get_raw(struct device *port,
gpio_pins_t *value)
gpio_port_value_t *value)
{
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_get_raw));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(value, sizeof(gpio_pins_t)));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(value, sizeof(gpio_port_value_t)));
return z_impl_gpio_port_get_raw((struct device *)port,
(gpio_pins_t *)value);
(gpio_port_value_t *)value);
}
#include <syscalls/gpio_port_get_raw_mrsh.c>
static inline int z_vrfy_gpio_port_set_masked_raw(struct device *port,
gpio_pins_t mask, gpio_pins_t value)
gpio_port_pins_t mask, gpio_port_value_t value)
{
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_set_masked_raw));
return z_impl_gpio_port_set_masked_raw((struct device *)port, mask,
@ -53,7 +53,7 @@ static inline int z_vrfy_gpio_port_set_masked_raw(struct device *port,
#include <syscalls/gpio_port_set_masked_raw_mrsh.c>
static inline int z_vrfy_gpio_port_set_bits_raw(struct device *port,
gpio_pins_t pins)
gpio_port_pins_t pins)
{
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_set_bits_raw));
return z_impl_gpio_port_set_bits_raw((struct device *)port, pins);
@ -61,7 +61,7 @@ static inline int z_vrfy_gpio_port_set_bits_raw(struct device *port,
#include <syscalls/gpio_port_set_bits_raw_mrsh.c>
static inline int z_vrfy_gpio_port_clear_bits_raw(struct device *port,
gpio_pins_t pins)
gpio_port_pins_t pins)
{
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_clear_bits_raw));
return z_impl_gpio_port_clear_bits_raw((struct device *)port, pins);
@ -69,7 +69,7 @@ static inline int z_vrfy_gpio_port_clear_bits_raw(struct device *port,
#include <syscalls/gpio_port_clear_bits_raw_mrsh.c>
static inline int z_vrfy_gpio_port_toggle_bits(struct device *port,
gpio_pins_t pins)
gpio_port_pins_t pins)
{
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_toggle_bits));
return z_impl_gpio_port_toggle_bits((struct device *)port, pins);