Andrew Boie | 6d79fe5 | 2017-09-29 02:56:55 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2017 Intel Corporation |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | |
| 7 | #include <sensor.h> |
| 8 | #include <syscall_handler.h> |
| 9 | |
| 10 | u32_t _handler_sensor_attr_set(u32_t dev, u32_t chan, u32_t attr, |
| 11 | u32_t val, u32_t arg5, u32_t arg6, void *ssf) |
| 12 | { |
| 13 | _SYSCALL_ARG4; |
| 14 | |
| 15 | _SYSCALL_IS_OBJ(dev, K_OBJ_DRIVER_SENSOR, 0, ssf); |
| 16 | _SYSCALL_MEMORY(val, sizeof(struct sensor_value), 0, ssf); |
| 17 | return _impl_sensor_attr_set((struct device *)dev, chan, attr, |
| 18 | (const struct sensor_value *)val); |
| 19 | } |
| 20 | |
| 21 | u32_t _handler_sensor_sample_fetch(u32_t dev, u32_t arg2, u32_t arg3, |
| 22 | u32_t arg4, u32_t arg5, u32_t arg6, |
| 23 | void *ssf) |
| 24 | { |
| 25 | _SYSCALL_ARG1; |
| 26 | |
| 27 | _SYSCALL_IS_OBJ(dev, K_OBJ_DRIVER_SENSOR, 0, ssf); |
| 28 | return _impl_sensor_sample_fetch((struct device *)dev); |
| 29 | } |
| 30 | |
| 31 | |
| 32 | u32_t _handler_sensor_sample_fetch_chan(u32_t dev, u32_t type, u32_t arg3, |
| 33 | u32_t arg4, u32_t arg5, u32_t arg6, |
| 34 | void *ssf) |
| 35 | { |
| 36 | _SYSCALL_ARG2; |
| 37 | |
| 38 | _SYSCALL_IS_OBJ(dev, K_OBJ_DRIVER_SENSOR, 0, ssf); |
| 39 | return _impl_sensor_sample_fetch_chan((struct device *)dev, type); |
| 40 | } |
| 41 | |
| 42 | u32_t _handler_sensor_channel_get(u32_t dev, u32_t chan, u32_t val, |
| 43 | u32_t arg4, u32_t arg5, u32_t arg6, |
| 44 | void *ssf) |
| 45 | { |
| 46 | _SYSCALL_ARG3; |
| 47 | |
| 48 | _SYSCALL_IS_OBJ(dev, K_OBJ_DRIVER_SENSOR, 0, ssf); |
| 49 | _SYSCALL_MEMORY(val, sizeof(struct sensor_value), 1, ssf); |
| 50 | return _impl_sensor_channel_get((struct device *)dev, chan, |
| 51 | (struct sensor_value *)val); |
| 52 | } |
| 53 | |