[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rtl] PCI Driver



Jeffrey wrote:
> 
> 0. or i just remap PCI memory area at 0x40000000,size 4M, like following?:
>         char * baseptr = ioremap(0x40000000, 4*1024*1024);
> 
Yes, you need to remap, cause this will give you a virtual pointer in
your address space.

> 2. Can i access the memory simply via a pointer?
> 
No. you will be able to do memory access only with the remapped address
(which is a pointer).

> 3. if i can access it via a pointer in driver module, can i  access it from user space? or something just like following:
>      mystruct *mystr;
>        pointer_in_driver<---------------some remap procedure ------------------->mystr;
> 
I don't think so. I use to add a RT-FIFO handler which receive requests
from apps and process it in kernel space. But in your driver you can, of
course, remap the memory area with a struct pointer like that :
  mystruct *mystr = (mystruct *) ioremap (0x40000000, 4*1024*1024);
and then mystr->data1 = xxx ;

If your memory space have configurations IOs, I suggest you to use
 mystruct *mystr = (mystruct *) ioremap_nocache (0x40000000,
4*1024*1024);


Chris.

--
Kumsta Christophe
Machinery Agrobotic Fruit
<kumsta@easynet.fr>
Real-Time image processing developper
RT-Linux/RTAI ( Use the Source Luck !)