1 /* 2 * Copyright (c) 2019 Intel Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/syscall_handler.h> 8 #include <zephyr/drivers/ptp_clock.h> 9 10 #ifdef CONFIG_USERSPACE z_vrfy_ptp_clock_get(const struct device * dev,struct net_ptp_time * tm)11int z_vrfy_ptp_clock_get(const struct device *dev, 12 struct net_ptp_time *tm) 13 { 14 struct net_ptp_time ptp_time; 15 int ret; 16 17 Z_OOPS(Z_SYSCALL_DRIVER_PTP_CLOCK(dev, get)); 18 Z_OOPS(Z_SYSCALL_MEMORY_WRITE(tm, sizeof(struct net_ptp_time))); 19 20 ret = z_impl_ptp_clock_get((const struct device *)dev, &ptp_time); 21 if (ret != 0) { 22 return 0; 23 } 24 25 if (z_user_to_copy((void *)tm, &ptp_time, sizeof(ptp_time)) != 0) { 26 return 0; 27 } 28 29 return ret; 30 } 31 #include <syscalls/ptp_clock_get_mrsh.c> 32 #endif /* CONFIG_USERSPACE */ 33