Suco wrote:
> Bus error

That's probably mmap failing and returning MAP_FAILED aka (void *) -1.
You should check for this. If you're too lazy to check, you
can see what happens if you run the program under "strace".

To keep mmap happy, you need to calculate PageAddress correctly
and maybe also increase the length to PAGE_SIZE.

The calculation of PageAddress should probably be
PageAddress = (off_t) hw_addr - PageOffset;

You may also want to declare the pointer you get as "volatile".

> I'm forgetting to add some kind of offset in the address?

Yes, that too :-) You forgot to add PageOffset to hw_addr.
(Careful about the item size !)

Here's a simple read/write program that works also on the Ben:
http://svn.openmoko.org/developers/werner/poke/

- Werner

_______________________________________________
Qi Hardware Discussion List
Mail to list (members only): [email protected]
Subscribe or Unsubscribe: 
http://lists.en.qi-hardware.com/mailman/listinfo/discussion

Reply via email to