4
votes

I am writing a pci driver for a PCIe FPGA card.

I am not sure how to implement the "read" and "write" functions - How to use the arguments: struct file *filp, char _ _user *buff, size_t count, loff_t *offp, correctly in order to do reads and writes to pci memory space.

Can you give me examples of how to use these functions, along with an example of using open/release as well.

1
You can refer to this source github.com/pkumarg/scull . It has implementation of read() and write() calls with example in test file. - Pushpendra

1 Answers

3
votes

LDD3 includes a sample character driver "scull" which implements file operations (including read and write) on a memory area. Should be easy to adapt it for your purposes.