Reading from physical addresses..

Shailesh Hingole shingole at cs.binghamton.edu
Fri May 2 14:09:32 UTC 2003



On Fri, 2 May 2003, Fernando RUIZ wrote:

> On Thu, 1 May 2003 23:24:29 -0400 (EDT), Shailesh Hingole wrote:
> 
> > 
> > Hi there,
> >  I need to read from a range of physical addresses (for
> > ex. 0x000-0x1000) from an application in RTEMS. When I say that, these are
> > the actual locations on the physical memory and not on the process address
> > space. 
> > 
> > What is the best way to do it?
> > 
> > Is it possible to do it from an application?
> > 
> 
> Hi,
>   My experience is that you are free to build a C pointer in order to read/write the I/O memory
> mapped space.
> 
> unsigned short char * pb = (unsigned short char *) 0x008000;
> 
> *pb=15  by example.
> 
> You can do this always like a label in your link file memory map and declare like an external
> variable in your C program.
> 
> The physical memory is the real memory at least in my experience (sh HITACHI and pc386 cpus).
> 
> Drivers need to do this. I have flash memory, rtc, uarts, and more devices and always I declare a
> structure and declare like external variable from C. 
> I can set up the memory adress after in the link file when the linking process.
> 
> Is it right for all CPU's?
> 
> BRGDS.
> 
> > 
> > thanks,
> > Shailesh
> 
> RUE DE LA GARE
> LE CLOS DES GENETS, VILLA 51 
> 69730 GENAY
> TELEPHONE: 04 72 08 99 25
> PORTABLE : 06 80 38 54 10      
> EMAIL    : correo at fernando-ruiz.com
> 

How about using rtems_region_create to access a contiguous physical
segment. I know that rtems_region_create will take a starting address and
length as a parameter. Now is this memory allocated directly from the
physical RAM (i mean the starting address that we give is the starting
address on physical RAM) or is it allocated from the process address
space..?

thanks,
Shailesh






More information about the users mailing list