I am trying to add a simple frame grabbing functionality to the
ohci firewire driver I have been writing for the linux1394 project.
I have taken as an example the code of bttv.c to allocate the big
chunk of memory needed to do multiple buffering and memory mapping,
but there is something I don't quite understand.

What I want to do is allocate a space big enough for n frames of size
s bytes each, that I will map from user space later on. So I do

   buf = rvmalloc(n*s);

Then I need to program the dma engine to write directly in this buffer,
but I have to break the program into small pieces because of the dma
limitation. The dma engine needs the physical address of the memory,
so I write something like

  for (i=0;i<m;i++)
      dma_prg[i].buf_dest = kvirt_to_bus((unsigned long)buf+i*c);

where c is the size set for a single dma tranfer (here I chose 32k).
Is calling the function kvirt_to_bus the right way to access the 
physical address of the allocated memory. Is it normal if the addresses
generated by the above loop are not always verifying

   (dma_prg[i+1].buf_dest > dma_prg[i].buf_dest)

For the moment my driver crashes the kernel so I guess I am doing
something wrong.

Thanks,

-- 
Sebastien Rougeaux
RSISE, The Australian National University


-- 
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to