1 /*
2 * Copyright 2023 Cirrus Logic, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/internal/syscall_handler.h>
8 #include <zephyr/drivers/charger.h>
9
z_vrfy_charger_get_prop(const struct device * dev,const charger_prop_t prop,union charger_propval * val)10 static inline int z_vrfy_charger_get_prop(const struct device *dev, const charger_prop_t prop,
11 union charger_propval *val)
12 {
13 union charger_propval k_val;
14
15 K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, get_property));
16
17 int ret = z_impl_charger_get_prop(dev, prop, &k_val);
18
19 K_OOPS(k_usermode_to_copy(val, &k_val, sizeof(union charger_propval)));
20
21 return ret;
22 }
23
24 #include <zephyr/syscalls/charger_get_prop_mrsh.c>
25
z_vrfy_charger_set_prop(const struct device * dev,const charger_prop_t prop,const union charger_propval * val)26 static inline int z_vrfy_charger_set_prop(const struct device *dev, const charger_prop_t prop,
27 const union charger_propval *val)
28 {
29 union charger_propval k_val;
30
31 K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, set_property));
32
33 K_OOPS(k_usermode_from_copy(&k_val, val, sizeof(union charger_propval)));
34
35 return z_impl_charger_set_prop(dev, prop, &k_val);
36 }
37
38 #include <zephyr/syscalls/charger_set_prop_mrsh.c>
39
z_vrfy_charger_charge_enable(const struct device * dev,const bool enable)40 static inline int z_vrfy_charger_charge_enable(const struct device *dev, const bool enable)
41 {
42 K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, charge_enable));
43
44 return z_impl_charger_charge_enable(dev, enable);
45 }
46
47 #include <zephyr/syscalls/charger_charge_enable_mrsh.c>
48