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) \
|
2018-05-05 06:57:57 +08:00
|
|
|
Z_SYSCALL_HANDLER(counter_ ## name, 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
|
|
|
|
|
|
|
Z_SYSCALL_HANDLER(counter_get_guard_period, dev, flags)
|
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_guard_period));
|
|
|
|
return z_impl_counter_get_guard_period((struct device *)dev, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
Z_SYSCALL_HANDLER(counter_set_guard_period, dev, ticks, flags)
|
|
|
|
{
|
|
|
|
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_guard_period));
|
|
|
|
return z_impl_counter_set_guard_period((struct device *)dev, ticks,
|
|
|
|
flags);
|
|
|
|
}
|