Re: Using kcomedilib, am I on the right track?

Hi!

Actually, if you are using a standard frame rate normal polling would 
do. It's only every 20ms. So no kernel stuff at all. It's fast enough.

This is the control program to steer our robot towards food blobs. ;-) 
The same program is also used for line following, receptive field 
development etc. Bascially it works so that V4L does double buffering of 
the video data while comedi records asynchronously data and writes out 
sync data to the robot. Anyway have a look. The clock is generated by 
the frame rate. Simple as that.

You can watch me and the robot under this link:
http://www.berndporr.me.uk/ico_neco/

/Bernd

www:    http://www.berndporr.me.uk/
         http://www.linux-usb-daq.co.uk/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
         University of Glasgow
         Department of Electronics & Electrical Engineering
         Room 519, Rankine Building, Oakfield Avenue,
         Glasgow, G12 8LT


Kulecz, Walter (JSC-SK)[WLS] wrote:
>  Documentation and examples for using kcomedilib seem pretty sparse at 
> best.  Let me outline what I guess from reading the various sources of 
> what comedilib functions my modified video module would call.
>  
> #include <comedilib.h>  would be added to the module code.
>  
> (1) modified v4l2 init_module function would:
>    create the comedi_t device structure
>    call comedi_open()
>    create the async structure
>    init_async_buf()
>    create the comedi_cmd structure
>    initialize the comedi_cmd structure fields
>    call comedi_command_test()
>  
> (2) in the v4l2 stream on ioctrl the modified vfl2 module would:
>    call comedi_command() to start the data capture
>  
> (3) modified v4l2 module  Vsync interrupt service routine would:
>     call comedi_get_buffer contents() to retrieve A/D data captured 
> since start of capture or previous Vsync interrupt
>  
> (4) in the modified v4l2 stream off ioctrl to stop video capture:
>    call comedi_cancel() to stop the acquisition
>  
> (5) modified module remove_module function would:
>    free allocated comedi structures
>    call comdei_close()
>  
>  
> Is this a viable starting flow?  Am I missing any essential steps?
> Where does the buffer used for the async A/D get allocated?   do I do 
> it? or is it done auto magically when I setup for the command?
>  
> I've no idea at present of how  comedi_lock() and comedi-unlock() are to 
> be used.  I assume this is will be real important as I'm using a dual 
> core CPU.
>  
> A sample/demo module using kcomedilib would be even more helpful.
>  
> --wally.
>  
>  
>  
>  

Received on 2007-07-24Z21:09:46