2017-09-29 11:56:55 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2022-05-06 10:25:46 +02:00
|
|
|
#include <zephyr/drivers/sensor.h>
|
2023-09-27 00:46:01 +02:00
|
|
|
#include <zephyr/internal/syscall_handler.h>
|
2017-09-29 11:56:55 +02:00
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_attr_set(const struct device *dev,
|
|
|
|
enum sensor_channel chan,
|
|
|
|
enum sensor_attribute attr,
|
|
|
|
const struct sensor_value *val)
|
2017-09-29 11:56:55 +02:00
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, attr_set));
|
|
|
|
K_OOPS(K_SYSCALL_MEMORY_READ(val, sizeof(struct sensor_value)));
|
2020-04-30 20:33:38 +02:00
|
|
|
return z_impl_sensor_attr_set((const struct device *)dev, chan, attr,
|
|
|
|
(const struct sensor_value *)val);
|
2017-09-29 11:56:55 +02:00
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_attr_set_mrsh.c>
|
2017-09-29 11:56:55 +02:00
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_attr_get(const struct device *dev,
|
|
|
|
enum sensor_channel chan,
|
|
|
|
enum sensor_attribute attr,
|
|
|
|
struct sensor_value *val)
|
2020-06-13 21:02:10 +02:00
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, attr_get));
|
|
|
|
K_OOPS(K_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)));
|
2020-04-30 20:33:38 +02:00
|
|
|
return z_impl_sensor_attr_get((const struct device *)dev, chan, attr,
|
|
|
|
(struct sensor_value *)val);
|
2020-06-13 21:02:10 +02:00
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_attr_get_mrsh.c>
|
2020-06-13 21:02:10 +02:00
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_sample_fetch(const struct device *dev)
|
2018-04-04 22:50:32 +02:00
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
|
2020-04-30 20:33:38 +02:00
|
|
|
return z_impl_sensor_sample_fetch((const struct device *)dev);
|
2018-04-04 22:50:32 +02:00
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_sample_fetch_mrsh.c>
|
2017-09-29 11:56:55 +02:00
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_sample_fetch_chan(const struct device *dev,
|
|
|
|
enum sensor_channel type)
|
2017-09-29 11:56:55 +02:00
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
|
2020-04-30 20:33:38 +02:00
|
|
|
return z_impl_sensor_sample_fetch_chan((const struct device *)dev,
|
|
|
|
type);
|
2017-09-29 11:56:55 +02:00
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_sample_fetch_chan_mrsh.c>
|
2017-09-29 11:56:55 +02:00
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_channel_get(const struct device *dev,
|
|
|
|
enum sensor_channel chan,
|
|
|
|
struct sensor_value *val)
|
2017-09-29 11:56:55 +02:00
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, channel_get));
|
|
|
|
K_OOPS(K_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)));
|
2020-04-30 20:33:38 +02:00
|
|
|
return z_impl_sensor_channel_get((const struct device *)dev, chan,
|
|
|
|
(struct sensor_value *)val);
|
2017-09-29 11:56:55 +02:00
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_channel_get_mrsh.c>
|
2023-04-26 07:17:46 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_SENSOR_ASYNC_API
|
|
|
|
static inline int z_vrfy_sensor_get_decoder(const struct device *dev,
|
|
|
|
const struct sensor_decoder_api **decoder)
|
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SENSOR));
|
|
|
|
K_OOPS(K_SYSCALL_MEMORY_READ(decoder, sizeof(struct sensor_decoder_api)));
|
2023-04-26 07:17:46 +02:00
|
|
|
return z_impl_sensor_get_decoder(dev, decoder);
|
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_get_decoder_mrsh.c>
|
2023-04-26 07:17:46 +02:00
|
|
|
|
|
|
|
static inline int z_vrfy_sensor_reconfigure_read_iodev(struct rtio_iodev *iodev,
|
|
|
|
const struct device *sensor,
|
|
|
|
const enum sensor_channel *channels,
|
|
|
|
size_t num_channels)
|
|
|
|
{
|
2023-09-27 13:20:28 +02:00
|
|
|
K_OOPS(K_SYSCALL_OBJ(iodev, K_OBJ_RTIO_IODEV));
|
|
|
|
K_OOPS(K_SYSCALL_OBJ(sensor, K_OBJ_DRIVER_SENSOR));
|
|
|
|
K_OOPS(K_SYSCALL_MEMORY_READ(channels, sizeof(enum sensor_channel) * num_channels));
|
2023-04-26 07:17:46 +02:00
|
|
|
return z_impl_sensor_reconfigure_read_iodev(iodev, sensor, channels, num_channels);
|
|
|
|
}
|
2024-01-24 10:35:04 +01:00
|
|
|
#include <zephyr/syscalls/sensor_reconfigure_read_iodev_mrsh.c>
|
2023-04-26 07:17:46 +02:00
|
|
|
#endif
|