Driver-questions

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



Hello,
	i am writing a driver for my webcam using the new V4L1 API
	(struct file_operations*).

First problem
-------------
To obtain the video_device structure from an open call i do this:

static int w9968cf_open(struct inode* inode, struct file* filp)
{
	...
	struct video_device* vdev = video_devdata(filp);
	...
}

The code compiles well in linux2.4.19, but it doesn't compile using the
linux2.4.8 and the linux2.4.10 source code, becouse of 
that "video_devdata()" function and the new interface, which doesn't 
seems to exist.

I don't know if video_devdata() belong to the new API; however,
since i would like the driver to be compatible with as many linux2.4.x
versions as possible, i need to know:
1. which version of the kernel the struct file_operations* interface
   was introduced in;
2. which version of the kernel the video_devdata() function
   was introduced in;
3. a simple way to obtain  the same video_devdata() result
   inside an open call (always using the new struct file_operations*),
   if it is possible.

Second problem
--------------
I use just one rvmalloc() call to allocate the whole memory for the
video frame buffers:

  frame[0].buffer = rvmalloc(NUMBER_OF_BUFFERS * SIZE_OF_BUFFER)

And i can point to the next frame buffers this way:
  frame[i].buffer = frame[0].buffer + i * SIZE_OF_BUFFER;

The "active and ready" frame buffer may be one of those frame[i].buffer.

So i can mmap all the buffers (ready or not) contiguously in a single,
long virtual memory area.

Now..Questions to the powers: is that a right way to implement mmap()?
Are there any disadvantages to allocate memory that way?


Thanks. Luca Risolia.







[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux