|
| 1 | +/* |
| 2 | + * Copyright (c) 2022 Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#include <zephyr/drivers/smbus.h> |
| 8 | +#include <zephyr/syscall_handler.h> |
| 9 | + |
| 10 | +static inline int z_vrfy_smbus_configure(const struct device *dev, |
| 11 | + uint32_t dev_config) |
| 12 | +{ |
| 13 | + Z_OOPS(Z_SYSCALL_DRIVER_SMBUS(dev, configure)); |
| 14 | + |
| 15 | + return z_impl_smbus_configure(dev, dev_config); |
| 16 | +} |
| 17 | +#include <syscalls/smbus_configure_mrsh.c> |
| 18 | + |
| 19 | +static inline int z_vrfy_smbus_get_config(const struct device *dev, |
| 20 | + uint32_t *dev_config) |
| 21 | +{ |
| 22 | + Z_OOPS(Z_SYSCALL_DRIVER_SMBUS(dev, get_config)); |
| 23 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(dev_config, sizeof(uint32_t))); |
| 24 | + |
| 25 | + return z_impl_smbus_get_config(dev, dev_config); |
| 26 | +} |
| 27 | +#include <syscalls/smbus_get_config_mrsh.c> |
| 28 | + |
| 29 | +static inline int z_vrfy_smbus_quick(const struct device *dev, uint16_t addr, |
| 30 | + enum smbus_direction rw) |
| 31 | +{ |
| 32 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 33 | + |
| 34 | + return z_impl_smbus_quick(dev, addr, rw); |
| 35 | +} |
| 36 | +#include <syscalls/smbus_quick_mrsh.c> |
| 37 | + |
| 38 | +static inline int z_vrfy_smbus_byte_write(const struct device *dev, |
| 39 | + uint16_t addr, uint8_t byte) |
| 40 | +{ |
| 41 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 42 | + |
| 43 | + return z_impl_smbus_byte_write(dev, addr, byte); |
| 44 | +} |
| 45 | +#include <syscalls/smbus_byte_write_mrsh.c> |
| 46 | + |
| 47 | +static inline int z_vrfy_smbus_byte_read(const struct device *dev, |
| 48 | + uint16_t addr, uint8_t *byte) |
| 49 | +{ |
| 50 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 51 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(byte, sizeof(uint8_t))); |
| 52 | + |
| 53 | + return z_impl_smbus_byte_read(dev, addr, byte); |
| 54 | +} |
| 55 | +#include <syscalls/smbus_byte_read_mrsh.c> |
| 56 | + |
| 57 | +static inline int z_vrfy_smbus_byte_data_write(const struct device *dev, |
| 58 | + uint16_t addr, uint8_t cmd, |
| 59 | + uint8_t byte) |
| 60 | +{ |
| 61 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 62 | + |
| 63 | + return z_impl_smbus_byte_data_write(dev, addr, cmd, byte); |
| 64 | +} |
| 65 | +#include <syscalls/smbus_byte_data_write_mrsh.c> |
| 66 | + |
| 67 | +static inline int z_vrfy_smbus_byte_data_read(const struct device *dev, |
| 68 | + uint16_t addr, uint8_t cmd, |
| 69 | + uint8_t *byte) |
| 70 | +{ |
| 71 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 72 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(byte, sizeof(uint8_t))); |
| 73 | + |
| 74 | + return z_impl_smbus_byte_data_read(dev, addr, cmd, byte); |
| 75 | +} |
| 76 | +#include <syscalls/smbus_byte_data_read_mrsh.c> |
| 77 | + |
| 78 | +static inline int z_vrfy_smbus_word_data_write(const struct device *dev, |
| 79 | + uint16_t addr, uint8_t cmd, |
| 80 | + uint16_t word) |
| 81 | +{ |
| 82 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 83 | + |
| 84 | + return z_impl_smbus_word_data_write(dev, addr, cmd, word); |
| 85 | +} |
| 86 | +#include <syscalls/smbus_word_data_write_mrsh.c> |
| 87 | + |
| 88 | +static inline int z_vrfy_smbus_word_data_read(const struct device *dev, |
| 89 | + uint16_t addr, uint8_t cmd, |
| 90 | + uint16_t *word) |
| 91 | +{ |
| 92 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 93 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(word, sizeof(uint16_t))); |
| 94 | + |
| 95 | + return z_impl_smbus_word_data_read(dev, addr, cmd, word); |
| 96 | +} |
| 97 | +#include <syscalls/smbus_word_data_read_mrsh.c> |
| 98 | + |
| 99 | +static inline int z_vrfy_smbus_pcall(const struct device *dev, |
| 100 | + uint16_t addr, uint8_t cmd, |
| 101 | + uint16_t send_word, uint16_t *recv_word) |
| 102 | +{ |
| 103 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 104 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(recv_word, sizeof(uint16_t))); |
| 105 | + |
| 106 | + return z_impl_smbus_pcall(dev, addr, cmd, send_word, recv_word); |
| 107 | +} |
| 108 | +#include <syscalls/smbus_pcall_mrsh.c> |
| 109 | + |
| 110 | +static inline int z_vrfy_smbus_block_write(const struct device *dev, |
| 111 | + uint16_t addr, uint8_t cmd, |
| 112 | + uint8_t count, uint8_t *buf) |
| 113 | +{ |
| 114 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 115 | + Z_OOPS(Z_SYSCALL_MEMORY_READ(buf, count)); |
| 116 | + |
| 117 | + return z_impl_smbus_block_write(dev, addr, cmd, count, buf); |
| 118 | +} |
| 119 | +#include <syscalls/smbus_block_write_mrsh.c> |
| 120 | + |
| 121 | +static inline int z_vrfy_smbus_block_read(const struct device *dev, |
| 122 | + uint16_t addr, uint8_t cmd, |
| 123 | + uint8_t *count, uint8_t *buf) |
| 124 | +{ |
| 125 | + Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_SMBUS)); |
| 126 | + Z_OOPS(Z_SYSCALL_MEMORY_WRITE(count, sizeof(uint8_t))); |
| 127 | + |
| 128 | + return z_impl_smbus_block_read(dev, addr, cmd, count, buf); |
| 129 | +} |
| 130 | +#include <syscalls/smbus_block_read_mrsh.c> |
0 commit comments