* Writing first v4l2 driver
@ 2008-06-09 16:20 Ramatou sori
0 siblings, 0 replies; 8+ messages in thread
From: Ramatou sori @ 2008-06-09 16:20 UTC (permalink / raw)
To: jon.dufresne; +Cc: video4linux-list
hi,
I have a dsp (TMS320DM642) on a pci-card and my cameras are whith 8P8C to the card connected.
I have to write a linux driver for this card and I see that you have also to write v4l2 driver for a pci-device.
Did you find good documentation ? and can you send some links and maybe an easier example for pci-devices.
Thanks very much.
Atou
_____________________________________________________________________________
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread* Writing first v4l2 driver
@ 2008-06-09 9:00 Ramatou sori
0 siblings, 0 replies; 8+ messages in thread
From: Ramatou sori @ 2008-06-09 9:00 UTC (permalink / raw)
To: jon.dufresne; +Cc: video4linux-list, linux-kernel
hi,
I have a dsp (TMS320DM642) on a pci-card and my cameras are whith 8P8C to the card connected.
I have to write a linux driver for this card and I see that you have also to write v4l2 driver for a pci-device.
Did you find good documentation ? and can you send some links and maybe an easier example for pci-devices.
Thanks very much.
Atou
_____________________________________________________________________________
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread[parent not found: <20080605160010.BB443619D1A@hormel.redhat.com>]
* Re: Writing first v4l2 driver
[not found] <20080605160010.BB443619D1A@hormel.redhat.com>
@ 2008-06-05 22:49 ` Fritz Katz
0 siblings, 0 replies; 8+ messages in thread
From: Fritz Katz @ 2008-06-05 22:49 UTC (permalink / raw)
To: video4linux-list
On Thu, 05 Jun 2008
Jon Dufresne <jon dufresne infinitevideocorporation com> wrote:
>
> I'm in the process of writing my first v4l2 linux driver.
> I have written drivers in the past but this is my first time
> with a video device. I have read as much documentation as I
> could get my hands on.
> ......
> Is there a good guide on using video-buf for video dma transfer? I did
> quite a few google searches but I didn't find anything.
_________________
For a good overview of "Linux Device Drivers" the O'Reilly book is FREE online:
http://www.xml.com/ldd/chapter/book/
Take a look at chapter 16:
http://www.xml.com/ldd/chapter/book/ch16.html
There are several paragraphs introducing 'drivers/video' and 'drivers/media'
I'm in the process of writing my first v4l2 driver too. However, I'm going to create a driver for a TV-tuner that's not in the list of currently supported cards. ( Wish me luck! ) Or, better, point me in the direction of resources for TV-tuner drivers on Linux.
Regards,
-- Fritz Katz
Los Angeles, CA
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Writing first v4l2 driver
@ 2008-06-05 14:26 Jon Dufresne
2008-06-05 21:07 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 8+ messages in thread
From: Jon Dufresne @ 2008-06-05 14:26 UTC (permalink / raw)
To: video4linux-list
Hi,
I'm in the process of writing my first v4l2 linux driver. I have written
drivers in the past but this is my first time with a video device. I
have read as much documentation as I could get my hands on.
My device is a pci capture device and I am trying to use streaming
mmaped buffers. Right now I am trying to integrate the video-buf helper
functions to do the actual frame grabbing. I am quite confused as how
this all fits together.
Is there a good guide on using video-buf for video dma transfer? I did
quite a few google searches but I didn't find anything.
What is the simplest example of a capture device using video-buf for a
streaming device in the source tree to use as an example? I've looked at
a few, but I want to look at the simplest one.
Thanks for any help,
Jon
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Writing first v4l2 driver
2008-06-05 14:26 Jon Dufresne
@ 2008-06-05 21:07 ` Mauro Carvalho Chehab
2008-06-06 14:29 ` Jon Dufresne
0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2008-06-05 21:07 UTC (permalink / raw)
To: jon.dufresne; +Cc: video4linux-list
On Thu, 05 Jun 2008 10:26:17 -0400
Jon Dufresne <jon.dufresne@infinitevideocorporation.com> wrote:
> Hi,
>
> I'm in the process of writing my first v4l2 linux driver. I have written
> drivers in the past but this is my first time with a video device. I
> have read as much documentation as I could get my hands on.
>
> My device is a pci capture device and I am trying to use streaming
> mmaped buffers. Right now I am trying to integrate the video-buf helper
> functions to do the actual frame grabbing. I am quite confused as how
> this all fits together.
Does your device support DMA scatter/gather mode (e.g. instead of a continuous
DMA memory, you would be using a range of non-continuous memory areas)? If not,
then you'll need to write a different video-buf driver.
>
> Is there a good guide on using video-buf for video dma transfer? I did
> quite a few google searches but I didn't find anything.
>
> What is the simplest example of a capture device using video-buf for a
> streaming device in the source tree to use as an example? I've looked at
> a few, but I want to look at the simplest one.
The simplest driver is vivi.c. Yet, it uses videobuf-vmalloc, which is a little
bit different. However, since this is a fake device, it helps to understand how
videobuf works. If you get into vivi.c previous versions, at mercurial repo,
you'll find even a vivi example using the video-buf-dma-sg. Most of stuff
will be similar.
The other two examples for PCI devices are saa7134-video and cx88-video. bttv
also uses it, but bttv driver is more complex to understand, since its code is
bigger.
Cheers,
Mauro
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Writing first v4l2 driver
2008-06-05 21:07 ` Mauro Carvalho Chehab
@ 2008-06-06 14:29 ` Jon Dufresne
2008-06-06 15:30 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 8+ messages in thread
From: Jon Dufresne @ 2008-06-06 14:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: video4linux-list
On Thu, 2008-06-05 at 18:07 -0300, Mauro Carvalho Chehab wrote:
> Does your device support DMA scatter/gather mode (e.g. instead of a continuous
> DMA memory, you would be using a range of non-continuous memory areas)? If not,
> then you'll need to write a different video-buf driver.
I am writing code for both sides, the DSP on the PCI board and the
driver in the linux kernel. The dsp has functionality to write data over
the PCI bus, and I could certainly code this to work in discontinuous
chunks. So I believe it could use sg lists.
> The simplest driver is vivi.c. Yet, it uses videobuf-vmalloc, which is a little
> bit different. However, since this is a fake device, it helps to understand how
> videobuf works. If you get into vivi.c previous versions, at mercurial repo,
> you'll find even a vivi example using the video-buf-dma-sg. Most of stuff
> will be similar.
>
> The other two examples for PCI devices are saa7134-video and cx88-video. bttv
> also uses it, but bttv driver is more complex to understand, since its code is
> bigger.
Thanks for pointing these devices out. I will study these and see how
things turn out.
Thanks again,
Jon
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Writing first v4l2 driver
2008-06-06 14:29 ` Jon Dufresne
@ 2008-06-06 15:30 ` Mauro Carvalho Chehab
2008-06-19 13:51 ` Jon Dufresne
0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2008-06-06 15:30 UTC (permalink / raw)
To: jon.dufresne; +Cc: video4linux-list
On Fri, 06 Jun 2008 10:29:52 -0400
Jon Dufresne <jon.dufresne@infinitevideocorporation.com> wrote:
>
> On Thu, 2008-06-05 at 18:07 -0300, Mauro Carvalho Chehab wrote:
> > Does your device support DMA scatter/gather mode (e.g. instead of a continuous
> > DMA memory, you would be using a range of non-continuous memory areas)? If not,
> > then you'll need to write a different video-buf driver.
>
> I am writing code for both sides, the DSP on the PCI board and the
> driver in the linux kernel. The dsp has functionality to write data over
> the PCI bus, and I could certainly code this to work in discontinuous
> chunks. So I believe it could use sg lists.
This is the better solution, if you can work on both sides. Continuous stream
buffer for video is generally very large, and may lead into some troubles if
the memory is too fragmented before you allocate such memory (the drivers that
work with non sg DMA returns -ENOMEM if you don't have a continuous block with
enough size to allocate the buffer).
> > The simplest driver is vivi.c. Yet, it uses videobuf-vmalloc, which is a little
> > bit different. However, since this is a fake device, it helps to understand how
> > videobuf works. If you get into vivi.c previous versions, at mercurial repo,
> > you'll find even a vivi example using the video-buf-dma-sg. Most of stuff
> > will be similar.
> >
> > The other two examples for PCI devices are saa7134-video and cx88-video. bttv
> > also uses it, but bttv driver is more complex to understand, since its code is
> > bigger.
>
> Thanks for pointing these devices out. I will study these and see how
> things turn out.
Anytime.
Cheers,
Mauro
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Writing first v4l2 driver
2008-06-06 15:30 ` Mauro Carvalho Chehab
@ 2008-06-19 13:51 ` Jon Dufresne
0 siblings, 0 replies; 8+ messages in thread
From: Jon Dufresne @ 2008-06-19 13:51 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: video4linux-list
On Fri, 2008-06-06 at 12:30 -0300, Mauro Carvalho Chehab wrote:
> On Fri, 06 Jun 2008 10:29:52 -0400
> Jon Dufresne <jon.dufresne@infinitevideocorporation.com> wrote:
>
> >
> > On Thu, 2008-06-05 at 18:07 -0300, Mauro Carvalho Chehab wrote:
> > > Does your device support DMA scatter/gather mode (e.g. instead of a continuous
> > > DMA memory, you would be using a range of non-continuous memory areas)? If not,
> > > then you'll need to write a different video-buf driver.
> >
> > I am writing code for both sides, the DSP on the PCI board and the
> > driver in the linux kernel. The dsp has functionality to write data over
> > the PCI bus, and I could certainly code this to work in discontinuous
> > chunks. So I believe it could use sg lists.
>
> This is the better solution, if you can work on both sides. Continuous stream
> buffer for video is generally very large, and may lead into some troubles if
> the memory is too fragmented before you allocate such memory (the drivers that
> work with non sg DMA returns -ENOMEM if you don't have a continuous block with
> enough size to allocate the buffer).
>
> > > The simplest driver is vivi.c. Yet, it uses videobuf-vmalloc, which is a little
> > > bit different. However, since this is a fake device, it helps to understand how
> > > videobuf works. If you get into vivi.c previous versions, at mercurial repo,
> > > you'll find even a vivi example using the video-buf-dma-sg. Most of stuff
> > > will be similar.
> > >
> > > The other two examples for PCI devices are saa7134-video and cx88-video. bttv
> > > also uses it, but bttv driver is more complex to understand, since its code is
> > > bigger.
> >
> > Thanks for pointing these devices out. I will study these and see how
> > things turn out.
>
> Anytime.
Thank you for the help. I have been able to successfully get streaming
video to work using sg lists and the video buf help file. There are a
few things I'm still confused about and hoping someone can clear them up
for me.
What exactly are the operations that should be performed by the queue
ops. I'll explain what I think they should do, please correct me if I am
wrong:
buf_setup;
Assign the size of the video frame the driver expects and the number of
buffers the driver allows. Right now I have just have the accept as many
buffers as was requested. When is this a bad thing?
buf_prepare:
Not really sure about this. Right now I just call the iolock function
from the video-buf module. I think this sets up the sg list for me.
buf_queue:
Puts the buffer into a list. If it is the first to enter the list it
tells the hardware to begin a dma transfer, otherwise it just appends to
the list.
Upon receiving an interrupt from the hardware, the buffer is removed
from the list and considered "STATE_DONE", at which point the memory
contains the frame data. In this interrupt the driver looks at the next
buffer in the list and tells it to start the dma again.
buf_release:
Currently my release does nothing.
Another issue I've noticed is that sometimes the DQBUF ioctl will return
-EINVAL. I traced this back in the code and it appears this occurs with
the error message "stream running..." I'm not clear what this means.
Thanks for any help,
Jon
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-06-19 13:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-09 16:20 Writing first v4l2 driver Ramatou sori
-- strict thread matches above, loose matches on Subject: below --
2008-06-09 9:00 Ramatou sori
[not found] <20080605160010.BB443619D1A@hormel.redhat.com>
2008-06-05 22:49 ` Fritz Katz
2008-06-05 14:26 Jon Dufresne
2008-06-05 21:07 ` Mauro Carvalho Chehab
2008-06-06 14:29 ` Jon Dufresne
2008-06-06 15:30 ` Mauro Carvalho Chehab
2008-06-19 13:51 ` Jon Dufresne
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.