Using mmap on custom HW


I am new to using mmap and mapping HW registers, maybe the questions are simple. So, my problem is that we have some custom HW, which has 32bit registers. One requirement is that I must use mmap to ensure fast IO operations.

I see in examples that people use dev/mem as a general file. Is this a good idea or should I create my own dev/custom and put the maps in there? Are there any benefits in doing that? Secondly, are there any tools to let me create a mapped file, like dev/custom or how does one go about doing that?

Thirdly, how do I ensure that the offset is always a multiple of the page size? In my case that is 4096 bytes.

Thanks for any help,

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!