memory map io function
- From: "Louis Lu" <netlu visto com>
- To: gtk-list gnome org
- Subject: memory map io function
- Date: Wed, 20 Jun 2001 10:59:43 -0700
Hi:
I just wondering whether or not anyone who has the experiences on memory map io function before?
My code is as following:
int *base;
unsigned int fd;
fd = open("dev/mem", O_RDWR);
base = mmap(0, 0x80000, PROT_READ|PROT_WRITE,MAP_SHARED, fd, 0xd800000);
(and I tried to write a value to a certian register of vga)
*(int *)(base+0x60000/4) = 0x30f027f;
munmap(base, 0x800000);
close(fd);
The compile is ok, but when I runt it, I got segmentation fault (core dump).
I bassically need to write around 13 of them and I have even tried to change the size from 0x800000 to 0x8fffffff. I still got core dump though.
So, I appreciate it if there is anyone who can teach me how to correct my problem here.
Louis
___________________________________________________________________________
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]