2017-10-26 13:43:24 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2019-06-25 15:53:52 -04:00
|
|
|
#include <drivers/gpio.h>
|
2017-10-26 13:43:24 -07:00
|
|
|
#include <syscall_handler.h>
|
|
|
|
|
2020-01-30 09:31:07 -06:00
|
|
|
static inline int z_vrfy_gpio_config(struct device *port,
|
2020-01-27 05:56:25 -06:00
|
|
|
gpio_pin_t pin, gpio_flags_t flags)
|
2017-10-26 13:43:24 -07:00
|
|
|
{
|
2020-01-30 12:12:39 -06:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, pin_configure));
|
2020-01-30 09:31:07 -06:00
|
|
|
return z_impl_gpio_config((struct device *)port, pin, flags);
|
2017-10-26 13:43:24 -07:00
|
|
|
}
|
2019-08-13 10:27:12 -07:00
|
|
|
#include <syscalls/gpio_config_mrsh.c>
|
2017-10-26 13:43:24 -07:00
|
|
|
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
static inline int z_vrfy_gpio_port_get_raw(struct device *port,
|
2019-08-26 11:44:01 -05:00
|
|
|
gpio_port_value_t *value)
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_get_raw));
|
2019-08-26 11:44:01 -05:00
|
|
|
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(value, sizeof(gpio_port_value_t)));
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
return z_impl_gpio_port_get_raw((struct device *)port,
|
2019-08-26 11:44:01 -05:00
|
|
|
(gpio_port_value_t *)value);
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
}
|
|
|
|
#include <syscalls/gpio_port_get_raw_mrsh.c>
|
|
|
|
|
|
|
|
static inline int z_vrfy_gpio_port_set_masked_raw(struct device *port,
|
2019-08-26 11:44:01 -05:00
|
|
|
gpio_port_pins_t mask, gpio_port_value_t value)
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_set_masked_raw));
|
|
|
|
return z_impl_gpio_port_set_masked_raw((struct device *)port, mask,
|
|
|
|
value);
|
|
|
|
}
|
|
|
|
#include <syscalls/gpio_port_set_masked_raw_mrsh.c>
|
|
|
|
|
|
|
|
static inline int z_vrfy_gpio_port_set_bits_raw(struct device *port,
|
2019-08-26 11:44:01 -05:00
|
|
|
gpio_port_pins_t pins)
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_set_bits_raw));
|
|
|
|
return z_impl_gpio_port_set_bits_raw((struct device *)port, pins);
|
|
|
|
}
|
|
|
|
#include <syscalls/gpio_port_set_bits_raw_mrsh.c>
|
|
|
|
|
|
|
|
static inline int z_vrfy_gpio_port_clear_bits_raw(struct device *port,
|
2019-08-26 11:44:01 -05:00
|
|
|
gpio_port_pins_t pins)
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_clear_bits_raw));
|
|
|
|
return z_impl_gpio_port_clear_bits_raw((struct device *)port, pins);
|
|
|
|
}
|
|
|
|
#include <syscalls/gpio_port_clear_bits_raw_mrsh.c>
|
|
|
|
|
|
|
|
static inline int z_vrfy_gpio_port_toggle_bits(struct device *port,
|
2019-08-26 11:44:01 -05:00
|
|
|
gpio_port_pins_t pins)
|
gpio: add new functions to set/get pin/port values
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-05-31 11:00:13 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, port_toggle_bits));
|
|
|
|
return z_impl_gpio_port_toggle_bits((struct device *)port, pins);
|
|
|
|
}
|
|
|
|
#include <syscalls/gpio_port_toggle_bits_mrsh.c>
|
|
|
|
|
2019-06-30 21:52:18 +02:00
|
|
|
static inline int z_vrfy_gpio_pin_interrupt_configure(struct device *port,
|
2020-01-27 05:56:25 -06:00
|
|
|
gpio_pin_t pin,
|
|
|
|
gpio_flags_t flags)
|
2019-06-30 21:52:18 +02:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(port, pin_interrupt_configure));
|
|
|
|
return z_impl_gpio_pin_interrupt_configure((struct device *)port, pin,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
#include <syscalls/gpio_pin_interrupt_configure_mrsh.c>
|
|
|
|
|
2019-08-13 10:27:12 -07:00
|
|
|
static inline int z_vrfy_gpio_get_pending_int(struct device *dev)
|
2018-04-04 13:50:32 -07:00
|
|
|
{
|
2020-03-05 18:09:10 -08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_GPIO(dev, get_pending_int));
|
|
|
|
|
2019-08-13 10:27:12 -07:00
|
|
|
return z_impl_gpio_get_pending_int((struct device *)dev);
|
2018-04-04 13:50:32 -07:00
|
|
|
}
|
2019-08-13 10:27:12 -07:00
|
|
|
#include <syscalls/gpio_get_pending_int_mrsh.c>
|