|
hello, I'm working on a 9260 board running linux 2.6.36. I try to toggle some GPIO, this works fine if I run a C program using sysfs method, but it's too slow for me. I try to toggle these GPIOs with another C program using mmap, and it's works a little faster. My favorite language is C++, so I try the mmap method with, and compile it with g++. And all I get is a "segmentation Fault" at the first instruction using the returning value of mmap ... m_MapBase = ::mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, m_gpios, AT91_SYS & ~MAP_MASK); .... uint32_t value = *(( volatile uint32_t*)( m_MapBase + ((PMC_OFFSET + PMC_PCSR) & MAP_MASK))); -> Segmentation Fault !
I try to recompile the C program with g++, and I get the same seg fault as in C++ program...
Is there a problem between C++ and mmap ?
any idea is welcome... thanks
Pierre
|