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>
|
|
|
|
|
2017-10-14 05:00:22 +08:00
|
|
|
_SYSCALL_HANDLER(sensor_attr_set, dev, chan, attr, val)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2017-10-13 00:54:26 +08:00
|
|
|
_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SENSOR);
|
|
|
|
_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);
|
|
|
|
}
|
|
|
|
|
2017-10-13 00:54:26 +08:00
|
|
|
_SYSCALL_HANDLER1_SIMPLE(sensor_sample_fetch, K_OBJ_DRIVER_SENSOR,
|
|
|
|
struct device *);
|
2017-09-29 17:56:55 +08:00
|
|
|
|
2017-10-14 05:00:22 +08:00
|
|
|
_SYSCALL_HANDLER(sensor_semple_fetch_chan, dev, type)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2017-10-13 00:54:26 +08:00
|
|
|
_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SENSOR);
|
2017-09-29 17:56:55 +08:00
|
|
|
return _impl_sensor_sample_fetch_chan((struct device *)dev, type);
|
|
|
|
}
|
|
|
|
|
2017-10-14 05:00:22 +08:00
|
|
|
_SYSCALL_HANDLER(sensor_channel_get, dev, chan, val)
|
2017-09-29 17:56:55 +08:00
|
|
|
{
|
2017-10-13 00:54:26 +08:00
|
|
|
_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SENSOR);
|
|
|
|
_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);
|
|
|
|
}
|