forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
w1_handlers.c
116 lines (91 loc) · 3.35 KB
/
w1_handlers.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* Copyright (c) 2022 Thomas Stranger
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/internal/syscall_handler.h>
#include <zephyr/drivers/w1.h>
static inline int z_vrfy_w1_reset_bus(const struct device *dev)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, reset_bus));
return z_impl_w1_reset_bus((const struct device *)dev);
}
#include <zephyr/syscalls/w1_reset_bus_mrsh.c>
static inline int z_vrfy_w1_read_bit(const struct device *dev)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, read_bit));
return z_impl_w1_read_bit((const struct device *)dev);
}
#include <zephyr/syscalls/w1_read_bit_mrsh.c>
static inline int z_vrfy_w1_write_bit(const struct device *dev, bool bit)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, write_bit));
return z_impl_w1_write_bit((const struct device *)dev, bit);
}
#include <zephyr/syscalls/w1_write_bit_mrsh.c>
static inline int z_vrfy_w1_read_byte(const struct device *dev)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, read_byte));
return z_impl_w1_read_byte((const struct device *)dev);
}
#include <zephyr/syscalls/w1_read_byte_mrsh.c>
static inline int z_vrfy_w1_write_byte(const struct device *dev, uint8_t byte)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, write_byte));
return z_impl_w1_write_byte((const struct device *)dev, (uint8_t)byte);
}
#include <zephyr/syscalls/w1_write_byte_mrsh.c>
static inline int z_vrfy_w1_read_block(const struct device *dev,
uint8_t *buffer, size_t len)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_W1));
K_OOPS(K_SYSCALL_MEMORY_WRITE(buffer, len));
return z_impl_w1_read_block((const struct device *)dev,
(uint8_t *)buffer, (size_t)len);
}
#include <zephyr/syscalls/w1_read_block_mrsh.c>
static inline int z_vrfy_w1_write_block(const struct device *dev,
const uint8_t *buffer, size_t len)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_W1));
K_OOPS(K_SYSCALL_MEMORY_READ(buffer, len));
return z_impl_w1_write_block((const struct device *)dev,
(const uint8_t *)buffer, (size_t)len);
}
#include <zephyr/syscalls/w1_write_block_mrsh.c>
static inline int z_vrfy_w1_change_bus_lock(const struct device *dev, bool lock)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_W1));
return z_impl_w1_change_bus_lock((const struct device *)dev, lock);
}
#include <zephyr/syscalls/w1_change_bus_lock_mrsh.c>
static inline int z_vrfy_w1_configure(const struct device *dev,
enum w1_settings_type type, uint32_t value)
{
K_OOPS(K_SYSCALL_DRIVER_W1(dev, configure));
return z_impl_w1_configure(dev, type, value);
}
#include <zephyr/syscalls/w1_configure_mrsh.c>
static inline size_t z_vrfy_w1_get_slave_count(const struct device *dev)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_W1));
return z_impl_w1_get_slave_count((const struct device *)dev);
}
#include <zephyr/syscalls/w1_get_slave_count_mrsh.c>
#if CONFIG_W1_NET
static inline int z_vrfy_w1_search_bus(const struct device *dev,
uint8_t command, uint8_t family,
w1_search_callback_t callback,
void *user_data)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_W1));
K_OOPS(K_SYSCALL_VERIFY_MSG(callback == 0,
"callbacks may not be set from user mode"));
/* user_data is not dereferenced, no need to check parameter */
return z_impl_w1_search_bus((const struct device *)dev,
(uint8_t)command, (uint8_t)family,
(w1_search_callback_t)callback,
(void *)user_data);
}
#include <zephyr/syscalls/w1_search_bus_mrsh.c>
#endif /* CONFIG_W1_NET */