Re: [patch] NI DAQ-STC support for non-20MHz external timebase

On Tuesday 11 July 2006 05:43 pm, David MacMahon wrote:
> The existing NI DAQ-STC comedi drivers allow the use of an external
> timebase through the use of the INSN_CONFIG_SET_RTSI_CLOCK_MODE "sub-op"
> of the INSN_CONFIG instruction, but the drivers still expect that
> timebase to be the same 20 MHz frequency as the internal timebase.  The
> attached patch removes this limitation and fixes a couple of minor
> problems while maintaining backwards compatibility with existing code.
>
> Here's a more detailed summary...
>
> 1. Allows the external timebase period to be specified (in nanoseconds)
> in the data[2] field of the instruction when setting the clock mode to
> COMEDI_RTSI_CLOCK_MODE_SLAVE.

Use INSN_CONFIG_TIMER_1 in conjunction with TRIG_OTHER to specify what 
divisor of the external master clock you want to trigger off of.  After 
all, there is no requirement in general that an external master clock has 
to generate clocks at a fixed frequency.  See 
comedi/Documentation/comedi/insn_config for a little more information, and 
the cb_pcidas64.c driver for an example.

>
> 2. Changes the number of channels reported by the RTSI subdevice to be 7
> rather than 8.  The ni_rtsi_insn_config function errors out if the
> channel is greater than 6, which matches the STC documentation, so it
> seems appropriate to report only 7 channels for the rtsi subdevice
> instead of 8.

Okay, thanks.  I've committed that change.

>
> 3. Added INSN_CONFIG_SET_RTSI_CLOCK_MODE to check_insn_config_length()
> so that warning messages are not logged when using that sub-op.

I added a length check for INSN_CONFIG_SET_RTSI_CLOCK_MODE, but only for 
the original length of 2.

>
> I've tested it with an NI PXI-6031E and a 10 MHz external timebase and
> it seems to work well.  I've also attached clkmode.c, a program that
> demonstrates how to use the new functionality.  clkmode.c could go into
> comedilib/demo.
>
> I hope this patch can get added to CVS; please let me know if I can
> facilitate that in any way.
>
> Thanks,
> Dave

-- 
Frank

Received on 2006-07-12Z01:19:37