From: Frank Mori Hess Date: Sun, 20 Nov 2005 21:35:01 +0000 (+0000) Subject: Fix scan counter loading, which needs to be set to desired count minus X-Git-Tag: r0_7_71~126 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be316c3b5a23bf683ccf9ddf877e8f22bf3cc52b;p=comedi.git Fix scan counter loading, which needs to be set to desired count minus 3 (fix from Derek Foreman ). Fixed verified correct on pci-das6036 and 6025. --- diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index eb7ceeda..f6bcf24a 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -2361,20 +2361,22 @@ static uint32_t ai_convert_counter_6xxx( const comedi_device *dev, const comedi_ static uint32_t ai_scan_counter_6xxx( comedi_device *dev, comedi_cmd *cmd ) { + uint32_t count; // figure out how long we need to delay at end of scan switch( cmd->scan_begin_src ) { case TRIG_TIMER: - return ( cmd->scan_begin_arg - ( cmd->convert_arg * ( cmd->chanlist_len - 1 ) ) ) + count = (cmd->scan_begin_arg - (cmd->convert_arg * (cmd->chanlist_len - 1))) / TIMER_BASE; break; case TRIG_FOLLOW: - return cmd->convert_arg / TIMER_BASE; + count = cmd->convert_arg / TIMER_BASE; break; default: + return 0; break; } - return 0; + return count - 3; } static uint32_t ai_convert_counter_4020( comedi_device *dev, comedi_cmd *cmd )