Quote:
Originally Posted by zvivered
Till now, every register was written with a single IOCtl request.
Is there any alternative ?
I suspect this way is quite slow.
|
The "slowness" would be due to the overhead of each system call.
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
map[1] = reg_D
map[2] = reg_b
map[3] = reg_M
The userspace program would write to the device with an array. The driver copies the array into kernel space, and then in a loop extracts each value from the array and writes to the appropriate register per the map list.
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