The code (somewhat abridged, but you get the idea):
Code: Select all
#define GPIO_BASE 0x22000000
#define BLOCK_SIZE (4 * 1024)
bool PiGPIO::setupio()
{
if((mem_fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) return false; // this succeeds when run as root
gpio_map = (char *) mmap(
NULL,
BLOCK_SIZE,
PROT_READ | PROT_WRITE,
mem_fd,
GPIO_BASE); // always fails with errno 11 (EAGAIN -- Resource temporarily unavailable)
// etc
}
Any help would be gratefully received.
Tony