1 /*
2  * Copyright (c) 2018 Linaro Ltd.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/internal/syscall_handler.h>
8 #include <zephyr/drivers/led.h>
9 
z_vrfy_led_blink(const struct device * dev,uint32_t led,uint32_t delay_on,uint32_t delay_off)10 static inline int z_vrfy_led_blink(const struct device *dev, uint32_t led,
11 				   uint32_t delay_on, uint32_t delay_off)
12 {
13 	K_OOPS(K_SYSCALL_DRIVER_LED(dev, blink));
14 	return z_impl_led_blink((const struct device *)dev, led, delay_on,
15 					delay_off);
16 }
17 #include <syscalls/led_blink_mrsh.c>
18 
z_vrfy_led_get_info(const struct device * dev,uint32_t led,const struct led_info ** info)19 static inline int z_vrfy_led_get_info(const struct device *dev, uint32_t led,
20 				      const struct led_info **info)
21 {
22 	K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_LED));
23 	K_OOPS(K_SYSCALL_MEMORY_WRITE(info, sizeof(*info)));
24 	return z_impl_led_get_info(dev, led, info);
25 }
26 #include <syscalls/led_get_info_mrsh.c>
27 
z_vrfy_led_set_brightness(const struct device * dev,uint32_t led,uint8_t value)28 static inline int z_vrfy_led_set_brightness(const struct device *dev,
29 					    uint32_t led,
30 					    uint8_t value)
31 {
32 	K_OOPS(K_SYSCALL_DRIVER_LED(dev, set_brightness));
33 	return z_impl_led_set_brightness((const struct device *)dev, led,
34 					 value);
35 }
36 #include <syscalls/led_set_brightness_mrsh.c>
37 
38 static inline int
z_vrfy_led_write_channels(const struct device * dev,uint32_t start_channel,uint32_t num_channels,const uint8_t * buf)39 z_vrfy_led_write_channels(const struct device *dev, uint32_t start_channel,
40 			  uint32_t num_channels, const uint8_t *buf)
41 {
42 	K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_LED));
43 	K_OOPS(K_SYSCALL_MEMORY_READ(buf, num_channels));
44 	return z_impl_led_write_channels(dev, start_channel, num_channels, buf);
45 }
46 #include <syscalls/led_write_channels_mrsh.c>
47 
z_vrfy_led_set_channel(const struct device * dev,uint32_t channel,uint8_t value)48 static inline int z_vrfy_led_set_channel(const struct device *dev,
49 					 uint32_t channel, uint8_t value)
50 {
51 	K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_LED));
52 	return z_impl_led_set_channel(dev, channel, value);
53 }
54 #include <syscalls/led_set_channel_mrsh.c>
55 
z_vrfy_led_set_color(const struct device * dev,uint32_t led,uint8_t num_colors,const uint8_t * color)56 static inline int z_vrfy_led_set_color(const struct device *dev, uint32_t led,
57 				       uint8_t num_colors, const uint8_t *color)
58 {
59 	K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_LED));
60 	K_OOPS(K_SYSCALL_MEMORY_READ(color, num_colors));
61 	return z_impl_led_set_color(dev, led, num_colors, color);
62 }
63 #include <syscalls/led_set_color_mrsh.c>
64 
z_vrfy_led_on(const struct device * dev,uint32_t led)65 static inline int z_vrfy_led_on(const struct device *dev, uint32_t led)
66 {
67 	K_OOPS(K_SYSCALL_DRIVER_LED(dev, on));
68 	return z_impl_led_on((const struct device *)dev, led);
69 }
70 #include <syscalls/led_on_mrsh.c>
71 
z_vrfy_led_off(const struct device * dev,uint32_t led)72 static inline int z_vrfy_led_off(const struct device *dev, uint32_t led)
73 {
74 	K_OOPS(K_SYSCALL_DRIVER_LED(dev, off));
75 	return z_impl_led_off((const struct device *)dev, led);
76 }
77 #include <syscalls/led_off_mrsh.c>
78