Forum Discussion
Altera_Forum
Honored Contributor
9 years agoI didn't have time to look at it in detail but I did find a few things:
- You shouldn't use a struct to define hardware register layouts. You aren't guaranteed that the compiler will layout memory as you intended. I'd recommend using# define or const to define byte offsets to your registers.
- The offset for mmap is wrong. It needs to be the physical address of your registers. I don't recall how to calculate this, so look at some linux examples for SoC. Note that it isn't the address in QSYS. That doesn't take into account the starting address of the interface you are using.
- Your HW_SPAN is too big. Use the smallest multiple of the linux kernel page size (usually 512) that will hold all your registers. It would be 1*512 for your application.