mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-26 09:16:21 +00:00
Driver APIs might not implement all operations, making it possible for a user thread to get the kernel to execute a function at 0x00000000. Perform runtime checks in all the driver handlers, checking if they're capable of performing the requested operation. Fixes #6907. Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
24 lines
569 B
C
24 lines
569 B
C
/*
|
|
* Copyright (c) 2017 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <syscall_handler.h>
|
|
#include <pwm.h>
|
|
|
|
_SYSCALL_HANDLER(pwm_pin_set_cycles, dev, pwm, period, pulse)
|
|
{
|
|
_SYSCALL_DRIVER_PWM(dev, pin_set);
|
|
return _impl_pwm_pin_set_cycles((struct device *)dev, pwm, period,
|
|
pulse);
|
|
}
|
|
|
|
_SYSCALL_HANDLER(pwm_get_cycles_per_sec, dev, pwm, cycles)
|
|
{
|
|
_SYSCALL_DRIVER_PWM(dev, get_cycles_per_sec);
|
|
_SYSCALL_MEMORY_WRITE(cycles, sizeof(u64_t));
|
|
return _impl_pwm_get_cycles_per_sec((struct device *)dev,
|
|
pwm, (u64_t *)cycles);
|
|
}
|