2017-09-29 17:56:55 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sensor.h>
|
|
|
|
#include <syscall_handler.h>
|
|
|
|
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_SYSCALL_HANDLER(sensor_attr_set, dev, chan, attr, val)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_set));
|
|
|
|
Z_OOPS(Z_SYSCALL_MEMORY_READ(val, sizeof(struct sensor_value)));
|
2017-09-29 17:56:55 +08:00
|
|
|
return _impl_sensor_attr_set((struct device *)dev, chan, attr,
|
|
|
|
(const struct sensor_value *)val);
|
|
|
|
}
|
|
|
|
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_SYSCALL_HANDLER(sensor_sample_sample_fetch, dev)
|
2018-04-05 04:50:32 +08:00
|
|
|
{
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
|
2018-04-05 04:50:32 +08:00
|
|
|
return _impl_sensor_sample_fetch((struct device *)dev);
|
|
|
|
}
|
2017-09-29 17:56:55 +08:00
|
|
|
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_SYSCALL_HANDLER(sensor_sample_fetch_chan, dev, type)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
|
2017-09-29 17:56:55 +08:00
|
|
|
return _impl_sensor_sample_fetch_chan((struct device *)dev, type);
|
|
|
|
}
|
|
|
|
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_SYSCALL_HANDLER(sensor_channel_get, dev, chan, val)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, channel_get));
|
|
|
|
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)));
|
2017-09-29 17:56:55 +08:00
|
|
|
return _impl_sensor_channel_get((struct device *)dev, chan,
|
|
|
|
(struct sensor_value *)val);
|
|
|
|
}
|