2017-09-29 02:56:55 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2019-06-25 15:54:00 -04:00
|
|
|
#include <drivers/sensor.h>
|
2017-09-29 02:56:55 -07:00
|
|
|
#include <syscall_handler.h>
|
|
|
|
|
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 02:56:55 -07:00
|
|
|
{
|
2018-05-04 15:57:57 -07:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_set));
|
|
|
|
Z_OOPS(Z_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 02:56:55 -07:00
|
|
|
}
|
2019-08-13 11:34:34 -07:00
|
|
|
#include <syscalls/sensor_attr_set_mrsh.c>
|
2017-09-29 02:56:55 -07: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
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_get));
|
|
|
|
Z_OOPS(Z_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
|
|
|
}
|
|
|
|
#include <syscalls/sensor_attr_get_mrsh.c>
|
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static inline int z_vrfy_sensor_sample_fetch(const struct device *dev)
|
2018-04-04 13:50:32 -07:00
|
|
|
{
|
2018-05-04 15:57:57 -07:00
|
|
|
Z_OOPS(Z_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 13:50:32 -07:00
|
|
|
}
|
2019-08-13 11:34:34 -07:00
|
|
|
#include <syscalls/sensor_sample_fetch_mrsh.c>
|
2017-09-29 02:56:55 -07: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 02:56:55 -07:00
|
|
|
{
|
2018-05-04 15:57:57 -07:00
|
|
|
Z_OOPS(Z_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 02:56:55 -07:00
|
|
|
}
|
2019-08-13 11:34:34 -07:00
|
|
|
#include <syscalls/sensor_sample_fetch_chan_mrsh.c>
|
2017-09-29 02:56:55 -07: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 02:56:55 -07:00
|
|
|
{
|
2018-05-04 15:57:57 -07:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, channel_get));
|
|
|
|
Z_OOPS(Z_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 02:56:55 -07:00
|
|
|
}
|
2019-08-13 11:34:34 -07:00
|
|
|
#include <syscalls/sensor_channel_get_mrsh.c>
|