Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2015 18:10:19 +0100
From:      =?UTF-8?B?TWFudWVsIFN0w7xobg==?= <freebsdnewbie@freenet.de>
To:        freebsd-arm@freebsd.org
Subject:   mmap-issue
Message-ID:  <54B945FB.10609@freenet.de>

next in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54B945FB.10609>