zephyr/drivers/sensor/sensor_handlers.c
Anas Nashif 8c1f89fa99 cleanup: include/: move sensor.h to drivers/sensor.h
move sensor.h to drivers/sensor.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00

37 lines
1.0 KiB
C

/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <drivers/sensor.h>
#include <syscall_handler.h>
Z_SYSCALL_HANDLER(sensor_attr_set, dev, chan, attr, val)
{
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_set));
Z_OOPS(Z_SYSCALL_MEMORY_READ(val, sizeof(struct sensor_value)));
return z_impl_sensor_attr_set((struct device *)dev, chan, attr,
(const struct sensor_value *)val);
}
Z_SYSCALL_HANDLER(sensor_sample_fetch, dev)
{
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
return z_impl_sensor_sample_fetch((struct device *)dev);
}
Z_SYSCALL_HANDLER(sensor_sample_fetch_chan, dev, type)
{
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
return z_impl_sensor_sample_fetch_chan((struct device *)dev, type);
}
Z_SYSCALL_HANDLER(sensor_channel_get, dev, chan, val)
{
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, channel_get));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)));
return z_impl_sensor_channel_get((struct device *)dev, chan,
(struct sensor_value *)val);
}