25 #include "switchtec/gas_mrpc.h" 27 #include "switchtec_priv.h" 58 const void *src,
size_t n)
63 cmd.gas_offset = (uint32_t)(dest - (
void __gas *)dev->gas_map);
67 if (cmd.len >
sizeof(cmd.data))
68 cmd.len =
sizeof(cmd.data);
70 memcpy(&cmd.data, src, cmd.len);
73 cmd.len +
sizeof(cmd) -
sizeof(cmd.data),
79 cmd.gas_offset += cmd.len;
91 const void __gas *src,
size_t n)
96 cmd.gas_offset = (uint32_t)(src - (
void __gas *)dev->gas_map);
100 if (cmd.len > MRPC_MAX_DATA_LEN)
101 cmd.len = MRPC_MAX_DATA_LEN;
104 sizeof(cmd), dest, cmd.len);
121 const void __gas *src,
size_t n)
123 char buf[MRPC_MAX_DATA_LEN];
124 ssize_t ret, total = 0;
129 if (txfr_sz >
sizeof(buf))
130 txfr_sz =
sizeof(buf);
134 ret = write(fd, buf, txfr_sz);
void gas_mrpc_memcpy_from_gas(struct switchtec_dev *dev, void *dest, const void __gas *src, size_t n)
Copy data from the GAS using MRPC commands.
ssize_t gas_mrpc_write_from_gas(struct switchtec_dev *dev, int fd, const void __gas *src, size_t n)
Call write() with data from the GAS using an MRPC command.
void gas_mrpc_memcpy_to_gas(struct switchtec_dev *dev, void __gas *dest, const void *src, size_t n)
Copy data to the GAS using MRPC commands.
int switchtec_cmd(struct switchtec_dev *dev, uint32_t cmd, const void *payload, size_t payload_len, void *resp, size_t resp_len)
Execute an MRPC command.