星期五, 4月 15, 2005

framebuffer fb_mmap() in fbmem.c

fbmem.c的fb_mmap()是application的mmap()function.
他先check device有沒有implement mmap,如果有就執行device的mmap,
如果沒有就執行fbmem default的mmap:

start = fix.smem_start; // fd的fix data: fb的start address
off += start;
vma->pgoff = off >> PAGE_SHIFT;
...
io_remap_page_range(vma_start,off,
vma->vm_end - vma->vm_start, vma->vm_page_prot);

其中io_remap_page_range( )在asm-arm/io.h中define為
remap_page_range(from, physic,size,prot)
所以實off就是physical address,這個address在mmap return時會藉由vma->vm_pgoff
轉成return value傳給caller application

沒有留言:

張貼留言