25 #ifndef LIBSWITCHTEC_GAS_MRPC_H 26 #define LIBSWITCHTEC_GAS_MRPC_H 28 #include <switchtec/mrpc.h> 35 uint8_t data[MRPC_MAX_DATA_LEN - 2 *
sizeof(uint32_t)];
44 const void *src,
size_t n);
46 const void __gas *src,
size_t n);
48 const void __gas *src,
size_t n);
50 #define create_mrpc_gas_read(type, suffix) \ 51 static inline type gas_mrpc_read ## suffix(struct switchtec_dev *dev, \ 55 gas_mrpc_memcpy_from_gas(dev, &ret, addr, sizeof(ret)); \ 59 #define create_mrpc_gas_write(type, suffix) \ 60 static inline void gas_mrpc_write ## suffix(struct switchtec_dev *dev, \ 61 type val, type __gas *addr) \ 63 gas_mrpc_memcpy_to_gas(dev, addr, &val, sizeof(val)); \ 66 create_mrpc_gas_read(uint8_t, 8);
67 create_mrpc_gas_read(uint16_t, 16);
68 create_mrpc_gas_read(uint32_t, 32);
69 create_mrpc_gas_read(uint64_t, 64);
71 create_mrpc_gas_write(uint8_t, 8);
72 create_mrpc_gas_write(uint16_t, 16);
73 create_mrpc_gas_write(uint32_t, 32);
74 create_mrpc_gas_write(uint64_t, 64);
76 #undef create_mrpc_gas_read 77 #undef create_mrpc_gas_write 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.