Device driver: read\write multiple words
Hello,
I'm developing a device driver for an FPGA that has dozens of registers. The registers are not address contiguous. Till now, every register was written with a single IOCtl request. Is there any alternative ? I suspect this way is quite slow. I can map the BARs of the FPGA to user space and write\read by *(long*) from the user space driver. Is it a wise step ? Regards, Z.V |
Quote:
You could minimize the overhead by using just one write() syscall, and pass the pointer of an array of the register values. Use a soft mapping of array elements to FPGA registers. E.G. The driver would have an array defining the mapping. Each element contains an FPGA register address (in any order you choose). Code:
map[0] = reg_A You would need to handle various read/write lengths and maintain a read/write offset, and accept lseek(fd, 0, SEEK_SET) to reset that offset. Regards |
All times are GMT -5. The time now is 04:53 PM. |