gpio: deprecate legacy gpio pin read/write functions
These have been replaced by get/set functions in both raw and active-sensitive variants. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
bfb7c39ca4
commit
2befa6a251
2 changed files with 21 additions and 63 deletions
|
@ -15,24 +15,6 @@ static inline int z_vrfy_gpio_config(struct device *port, int access_op,
|
||||||
}
|
}
|
||||||
#include <syscalls/gpio_config_mrsh.c>
|
#include <syscalls/gpio_config_mrsh.c>
|
||||||
|
|
||||||
static inline int z_vrfy_gpio_write(struct device *port, int access_op,
|
|
||||||
u32_t pin, u32_t value)
|
|
||||||
{
|
|
||||||
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, write));
|
|
||||||
return z_impl_gpio_write((struct device *)port, access_op, pin, value);
|
|
||||||
}
|
|
||||||
#include <syscalls/gpio_write_mrsh.c>
|
|
||||||
|
|
||||||
static inline int z_vrfy_gpio_read(struct device *port, int access_op,
|
|
||||||
u32_t pin, u32_t *value)
|
|
||||||
{
|
|
||||||
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, read));
|
|
||||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(value, sizeof(u32_t)));
|
|
||||||
return z_impl_gpio_read((struct device *)port, access_op, pin,
|
|
||||||
(u32_t *)value);
|
|
||||||
}
|
|
||||||
#include <syscalls/gpio_read_mrsh.c>
|
|
||||||
|
|
||||||
static inline int z_vrfy_gpio_port_get_raw(struct device *port,
|
static inline int z_vrfy_gpio_port_get_raw(struct device *port,
|
||||||
gpio_port_value_t *value)
|
gpio_port_value_t *value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -569,30 +569,6 @@ static inline int z_impl_gpio_config(struct device *port, int access_op,
|
||||||
return api->config(port, access_op, pin, (int)flags);
|
return api->config(port, access_op, pin, (int)flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
__syscall int gpio_write(struct device *port, int access_op, u32_t pin,
|
|
||||||
u32_t value);
|
|
||||||
|
|
||||||
static inline int z_impl_gpio_write(struct device *port, int access_op,
|
|
||||||
u32_t pin, u32_t value)
|
|
||||||
{
|
|
||||||
const struct gpio_driver_api *api =
|
|
||||||
(const struct gpio_driver_api *)port->driver_api;
|
|
||||||
|
|
||||||
return api->write(port, access_op, pin, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
__syscall int gpio_read(struct device *port, int access_op, u32_t pin,
|
|
||||||
u32_t *value);
|
|
||||||
|
|
||||||
static inline int z_impl_gpio_read(struct device *port, int access_op,
|
|
||||||
u32_t pin, u32_t *value)
|
|
||||||
{
|
|
||||||
const struct gpio_driver_api *api =
|
|
||||||
(const struct gpio_driver_api *)port->driver_api;
|
|
||||||
|
|
||||||
return api->read(port, access_op, pin, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
__syscall int gpio_enable_callback(struct device *port, int access_op,
|
__syscall int gpio_enable_callback(struct device *port, int access_op,
|
||||||
u32_t pin);
|
u32_t pin);
|
||||||
|
|
||||||
|
@ -1217,19 +1193,16 @@ static inline int gpio_pin_toggle(struct device *port, unsigned int pin)
|
||||||
* @param value Value set on the pin.
|
* @param value Value set on the pin.
|
||||||
* @return 0 if successful, negative errno code on failure.
|
* @return 0 if successful, negative errno code on failure.
|
||||||
*
|
*
|
||||||
* @deprecated Replace with gpio_pin_set_raw() or gpio_pin_set().
|
* @deprecated Replace with gpio_pin_set assuming active level is
|
||||||
|
* handled correctly. gpio_pin_set_raw() may be more correct for some
|
||||||
|
* drivers.
|
||||||
*/
|
*/
|
||||||
static inline int gpio_pin_write(struct device *port, u32_t pin,
|
/* Deprecated in 2.2 release */
|
||||||
u32_t value)
|
__deprecated static inline int gpio_pin_write(struct device *port,
|
||||||
|
gpio_pin_t pin,
|
||||||
|
u32_t value)
|
||||||
{
|
{
|
||||||
const struct gpio_driver_config *const cfg =
|
return gpio_pin_set(port, pin, value != 0);
|
||||||
(const struct gpio_driver_config *)port->config->config_info;
|
|
||||||
|
|
||||||
(void)cfg;
|
|
||||||
__ASSERT((cfg->port_pin_mask & (gpio_port_pins_t)BIT(pin)) != 0U,
|
|
||||||
"Unsupported pin");
|
|
||||||
|
|
||||||
return gpio_write(port, GPIO_ACCESS_BY_PIN, pin, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1242,19 +1215,22 @@ static inline int gpio_pin_write(struct device *port, u32_t pin,
|
||||||
* @param value Integer pointer to receive the data values from the pin.
|
* @param value Integer pointer to receive the data values from the pin.
|
||||||
* @return 0 if successful, negative errno code on failure.
|
* @return 0 if successful, negative errno code on failure.
|
||||||
*
|
*
|
||||||
* @deprecated Replace with gpio_pin_get_raw() or gpio_pin_get().
|
* @deprecated Replace with gpio_pin_get() assuming active level is
|
||||||
|
* handled correctly. gpio_pin_get_raw() may be more correct for some
|
||||||
|
* drivers.
|
||||||
*/
|
*/
|
||||||
static inline int gpio_pin_read(struct device *port, u32_t pin,
|
/* Deprecated in 2.2 release */
|
||||||
u32_t *value)
|
__deprecated static inline int gpio_pin_read(struct device *port,
|
||||||
|
gpio_pin_t pin,
|
||||||
|
u32_t *value)
|
||||||
{
|
{
|
||||||
const struct gpio_driver_config *const cfg =
|
int rv = gpio_pin_get(port, pin);
|
||||||
(const struct gpio_driver_config *)port->config->config_info;
|
|
||||||
|
|
||||||
(void)cfg;
|
if (rv >= 0) {
|
||||||
__ASSERT((cfg->port_pin_mask & (gpio_port_pins_t)BIT(pin)) != 0U,
|
*value = rv;
|
||||||
"Unsupported pin");
|
rv = 0;
|
||||||
|
}
|
||||||
return gpio_read(port, GPIO_ACCESS_BY_PIN, pin, value);
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue