1 /*
2  * Copyright (c) 2022 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <zephyr/drivers/misc/timeaware_gpio/timeaware_gpio.h>
7 #include <zephyr/syscall_handler.h>
8 
z_vrfy_tgpio_port_get_time(const struct device * port,uint64_t * current_time)9 static inline int z_vrfy_tgpio_port_get_time(const struct device *port, uint64_t *current_time)
10 {
11 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, get_time));
12 	K_OOPS(Z_SYSCALL_MEMORY_WRITE(current_time, sizeof(uint64_t)));
13 	return z_impl_tgpio_port_get_time((const struct device *)port, (uint64_t *)current_time);
14 }
15 #include <zephyr/syscalls/tgpio_port_get_time_mrsh.c>
16 
z_vrfy_tgpio_port_get_cycles_per_second(const struct device * port,uint32_t * cycles)17 static inline int z_vrfy_tgpio_port_get_cycles_per_second(const struct device *port,
18 							   uint32_t *cycles)
19 {
20 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, cyc_per_sec));
21 	K_OOPS(Z_SYSCALL_MEMORY_WRITE(cycles, sizeof(uint32_t)));
22 	return z_impl_tgpio_port_get_cycles_per_second((const struct device *)port,
23 							(uint32_t *)cycles);
24 }
25 #include <zephyr/syscalls/tgpio_port_get_cycles_per_second_mrsh.c>
26 
z_vrfy_tgpio_pin_periodic_output(const struct device * port,uint32_t pin,uint64_t start_time,uint64_t repeat_interval,bool periodic_enable)27 static inline int z_vrfy_tgpio_pin_periodic_output(const struct device *port, uint32_t pin,
28 						    uint64_t start_time, uint64_t repeat_interval,
29 						    bool periodic_enable)
30 {
31 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, set_perout));
32 	return z_impl_tgpio_pin_periodic_output((const struct device *)port, pin, start_time,
33 						 repeat_interval, periodic_enable);
34 }
35 #include <zephyr/syscalls/tgpio_pin_periodic_output_mrsh.c>
36 
z_vrfy_tgpio_pin_disable(const struct device * port,uint32_t pin)37 static inline int z_vrfy_tgpio_pin_disable(const struct device *port, uint32_t pin)
38 {
39 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, pin_disable));
40 	return z_impl_tgpio_pin_disable((const struct device *)port, pin);
41 }
42 #include <zephyr/syscalls/tgpio_pin_disable_mrsh.c>
43 
z_vrfy_tgpio_pin_config_ext_timestamp(const struct device * port,uint32_t pin,uint32_t event_polarity)44 static inline int z_vrfy_tgpio_pin_config_ext_timestamp(const struct device *port, uint32_t pin,
45 							 uint32_t event_polarity)
46 {
47 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, config_ext_ts));
48 	return z_impl_tgpio_pin_config_ext_timestamp((const struct device *)port, pin,
49 						      event_polarity);
50 }
51 #include <zephyr/syscalls/tgpio_pin_config_ext_timestamp_mrsh.c>
52 
z_vrfy_tgpio_pin_read_ts_ec(const struct device * port,uint32_t pin,uint64_t * timestamp,uint64_t * event_count)53 static inline int z_vrfy_tgpio_pin_read_ts_ec(const struct device *port, uint32_t pin,
54 					       uint64_t *timestamp, uint64_t *event_count)
55 {
56 	K_OOPS(Z_SYSCALL_DRIVER_TGPIO(port, read_ts_ec));
57 	return z_impl_tgpio_pin_read_ts_ec((const struct device *)port, pin, (uint64_t *)timestamp,
58 					    (uint64_t *)event_count);
59 }
60 #include <zephyr/syscalls/tgpio_pin_read_ts_ec_mrsh.c>
61