On Sun, 18 May 2008, carol9078 wrote:
> I'm alsot certainly missing the point, but why dows a simple memory
> read of the JP6 setting address not work and cause a segmntation fault
Protected mode. Protected mode was one of the major features of the 80386.
It provided muliple levels (or "rings") in which code could run, each
providing different amounts of access to memory and other peripherals. The
linux kernel runs in ring 0 and can do whatever it likes. Userspace
programs run in ring 3 and have a private address space into which the
kernel maps real memory. This means that for the program to access
arbitrary memory or I/O space, the kernel must first map those locations
into the program's private address space.
The implementation on ARM cores such as the cirrus EP9302 is a bit
different to this, but the concepts are the same.
To get the kernel to give you access to arbitrary memory, you must mmap()
the /dev/mem device node. This will give you a pointer to where global
memory is mapped into the program's private address space. Use it like a
unsigned char array.
ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7250-linux/samples/adc_7250.c is a
great example of how to access arbitrary memory.
Segmentation fault means that your program tried to access an address in
its private address space that isn't mapped to anything, which is why it's
such a common error when programming in C.
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|