mmap-issue
    Manuel Stühn 
    freebsdnewbie at freenet.de
       
    Fri Jan 16 17:12:36 UTC 2015
    
    
  
Hi,
I'm seeing unexpected behavior using mmap( /dev/mem ) on my beaglebone 
black. It seems to me, that writing to/reading from this mapped pointer 
does not immediatly take effect. The code looks like this:
#define GPIO1   0x4804C000
#define CLR_REG 0x190
#define SET_REG 0x194
#define LED0    21
#define LED1    22
#define LED2    23
#define LED3    24
int fd = open( "/dev/mem", O_RDWR );
int pagesize = getpagesize();
volatile uint32_t* ptr =
mmap( 0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIO1_ADDR );
ptr[SET_REG] = LED0 << 1;
I mapped for testing purposes the AM335x-GPIO-registers from /dev/mem.
Writing into these mmap'ed registers for toggling some LEDs does not 
immediatly take effect. I have to call it several times to get one 
LED-toggle. Is there any data caching I'm missing?
Thanks for hints.
    
    
More information about the freebsd-arm
mailing list