Subject: Re: how to write codes to access memory start at address 0xF1000000
To: Randy Wenjiun Lin <rblim@aht.com>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: current-users
Date: 09/03/1997 13:18:45
On Tue, 2 Sep 1997, Randy Wenjiun Lin wrote:
> Hi
>
> I am doing embedded system programming on Netbsd
> I need to access data on a shared memory which start at 0xF1000000.
> How to write codes to have the data on the shared memory accessed?
> In other words, how to make an array start at address 0xF100000? I want
> to declare an array containing all the adresses to which I can access
> those data pointed. Any ideas?
This should be standard C. :-)
Basically you want to have a variable be a pointer to the array at
0xF100000. I.E. you have some data structure (maybe a struct, maybe not)
which matches the data format you expect at 0xF100000. You have a variable
which is a pointer to such a structure. You set the pointer to 0xF100000
(with a type cast in there probably). You then de-reference the pointer.
Note: I've assumed you already have the shared memory allocated or
attached or whatever.
Though really shouldn't the memory sharing routine give you the address of
the memory it's sharing, and then you base everything off of that?
Take care,
Bill