fsl_user *nix forums beginner
Joined: 07 Oct 2005
Posts: 3
|
Posted: Fri May 12, 2006 4:23 pm Post subject:
ARM11 and flushing cashes in a driver
|
|
|
Hi,
I'm having a driver, which wants to use and share some physical memory
with an application.
1.) What I implemented:
the mmap-implementation of my driver returns a virtual address for a
physical adress known by the driver (cacheable and bufferable) to the
application.
2.) The application may read / write modify the buffer.
3.) at a later moment the driver wants to be sure, that the buffer is
entirely flushed before doing his work.
What function call do I have to do?
More info:
- Linux: 2.6.10
- Processor: ARM11
- driver knows physical address and the virtual address given to the
application
- buffer is cachaeble and bufferable
DRIVER CODE
==========================================
The mmap function without error checking:
my_mmap(struct file *file, struct vm_area_struct *vma)
{
struct my_device *dev = file->private_data;
unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end - vma->vm_start;
vout_data *vout = video_get_drvdata(dev);
pgprot_t my_prot;
my_prot= pgprot_noncached(PAGE_SHARED);
if (remap_pfn_range(vma, start, vma->vm_pgoff, size, my_prot));
return 0;
}
APPLICATION CODE
=====================================================
the application code (pseudo code):
int fd= open(dev_name);
char *buf = mmap (NULL, length,
PROT_READ | PROT_WRITE, MAP_SHARED,
fd, offset);
dosomething_with(buf);
// following ioctl cannot be split
ioctl(fd, DO_SOMETHING_FLUSH_AND_DO_SOMETHING_MORE, param);
thanks for any help
nsp |
|