2017-10-26 02:59:13 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <syscall_handler.h>
|
2019-06-26 03:53:48 +08:00
|
|
|
#include <drivers/counter.h>
|
2017-10-26 02:59:13 +08:00
|
|
|
|
|
|
|
/* For those APIs that just take one argument which is a counter driver
|
|
|
|
* instance and return an integral value
|
|
|
|
*/
|
|
|
|
#define COUNTER_HANDLER(name) \
|
2019-08-14 02:34:34 +08:00
|
|
|
static inline int z_vrfy_counter_##name(struct devince *dev) \
|
2018-04-05 04:50:32 +08:00
|
|
|
{ \
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, name)); \
|
2019-03-09 05:19:05 +08:00
|
|
|
return z_impl_counter_ ## name((struct device *)dev); \
|
2018-04-05 04:50:32 +08:00
|
|
|
}
|
2017-10-26 02:59:13 +08:00
|
|
|
|
2018-04-05 04:50:32 +08:00
|
|
|
COUNTER_HANDLER(get_pending_int)
|
|
|
|
COUNTER_HANDLER(read)
|
|
|
|
COUNTER_HANDLER(stop)
|
|
|
|
COUNTER_HANDLER(start)
|
2019-01-23 15:19:07 +08:00
|
|
|
COUNTER_HANDLER(get_top_value)
|
2018-06-11 17:50:20 +08:00
|
|
|
COUNTER_HANDLER(get_max_relative_alarm)
|
2019-05-20 16:38:57 +08:00
|
|
|
|
2019-08-14 02:34:34 +08:00
|
|
|
#include <syscalls/counter_get_pending_int_mrsh.c>
|
|
|
|
#include <syscalls/counter_read_mrsh.c>
|
|
|
|
#include <syscalls/counter_stop_mrsh.c>
|
|
|
|
#include <syscalls/counter_start_mrsh.c>
|
|
|
|
#include <syscalls/counter_get_top_value_mrsh.c>
|
|
|
|
#include <syscalls/counter_get_max_relative_alarm_mrsh.c>
|
|
|
|
|
|
|
|
static inline u32_t z_vrfy_counter_get_guard_period(struct device *dev,
|
|
|
|
u32_t flags)
|
2019-05-20 16:38:57 +08:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_guard_period));
|
|
|
|
return z_impl_counter_get_guard_period((struct device *)dev, flags);
|
|
|
|
}
|
2019-08-14 02:34:34 +08:00
|
|
|
#include <syscalls/counter_get_guard_period_mrsh.c>
|
2019-05-20 16:38:57 +08:00
|
|
|
|
2019-08-14 02:34:34 +08:00
|
|
|
static inline int z_vrfy_counter_set_guard_period(struct device *dev,
|
|
|
|
u32_t ticks, u32_t flags)
|
2019-05-20 16:38:57 +08:00
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_guard_period));
|
|
|
|
return z_impl_counter_set_guard_period((struct device *)dev, ticks,
|
|
|
|
flags);
|
|
|
|
}
|
2019-08-14 02:34:34 +08:00
|
|
|
#include <syscalls/counter_set_guard_period_mrsh.c>
|