Re: guidance needed for writing "buffered non-cumulative event counting" function for NI 660x card driver

> I have downloaded and installed comedi+comedilib. I have also downloaded
> relevant ni660x files from Mr Klaas Gadeyne's website:

You can omit the Mr :-)

> 1) How do I test to see if comedi is installed correctly?
>     -I don't have other cards other than NI6602.
>     -And I have not yet learnt how to add the 660x driver into comedi.

Try loading comedi_test or comedi_parport driver for example, and use the
comedilib/demo/info program to check some stuff.

> 2) How to I use the "patch" function in Linux to patch the ni660x files
>     I have downloaded?

- Patch the comedi and libcomedi directories.  Suppose the patches are in
  /tmp and comedi/comedilib in /usr/src

 cd /usr/src/comedi
 patch -p1 < /tmp/comedi_ni660x_patch
 cd /usr/src/comedilib/
 patch -p1 < /tmp/libcomedi_ni660x_patch

You might try first with the --dry-run option (see patch manpage)

- Reinstall comedi

> 3) Am I on the right path if I start working by:
>     -testing the card driver's "encoder" function to see how a working
>      function is like?
>     -And then work on the event counting function?

You are.

Have a look at the documentation and relevant posts on this ML about the
"counter API" posts suggested by Herman Bruyninckx (Mr. Herman Bruyninckx
:-) and myself.

You will have to do several things.
- Extend the API for this new function

[cut from patched comedi.h]

#define GPCT_SINGLE_PULSE_GENERATOR 1 // Use CTR as single pulsegenerator
#define GPCT_PULSE_TRAIN_GENERATOR 2 // Use CTR as pulsetraingenerator
#define GPCT_QUADRATURE_ENCODER 3 // Use the counter as encoder
====================
eg add something like

#define GPCT_BUFFERED_EVENT COUNTING 4

#define GPCT_CUMULATIVE_BUFFERED_EVENT_COUNTING 0
#define GPCT_NON_CUMULATIVE_BUFFERED_EVENT_COUNTING 1

- Implement interrupt handling (and perhaps DMA, didn't check the
  register level programming very carefully)

- Use this to implement the buffered cumulative event counting
  instruction.

Good luck!

Klaas

Received on 2003-10-29Z15:12:36