Altera_Forum
Honored Contributor
14 years agoLinux with MMU acessing registers
Hello i need to acess my registers from userspace, i am developing a
critical timing application and i can't consider the time needed to call the device driver and read my timestamp register. I need to read my timestamp register from userspace, how can i do that? I know that 0x8 is for uncached, therefore peripherals adresses will have the 8 in the adress. I am trying to use inl(0x000024e0 (my adress), 0); however i get a segmentation fault... i tried to include io.h but with no sucess # define inl(addr) ({ unsigned int __res; __asm__ __volatile__( "ldwio %0, 0(%1)" : "=r"(__res) : "r" (addr)); __res; }) //----------------------------------------------------------------------- # define inb(addr) ({ unsigned int __res; __asm__ __volatile__( "ldbio %0, 0(%1)" : "=r"(__res) : "r" (addr)); __res; }) //----------------------------------------------------------------------- # define outl(b,addr) ({ __asm__ __volatile__( "stwio %0, 0(%1)" : : "r"(, "r" (addr)); }) //----------------------------------------------------------------------- # define outw(b,addr) ({ __asm__ __volatile__( "sthio %0, 0(%1)" : : "r"(, "r" (addr)); }) //----------------------------------------------------------------------- # define outb(b,addr) ({ __asm__ __volatile__( "stbio %0, 0(%1)" : : "r"(, "r" (addr)); })