Fix scan counter loading, which needs to be set to desired count minus
authorFrank Mori Hess <fmhess@speakeasy.net>
Sun, 20 Nov 2005 21:35:01 +0000 (21:35 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sun, 20 Nov 2005 21:35:01 +0000 (21:35 +0000)
3 (fix from Derek Foreman <Derek.Foreman@nrc-cnrc.gc.ca>).  Fixed
verified correct on pci-das6036 and 6025.

comedi/drivers/cb_pcidas64.c

index eb7ceedaafb22709276e376db6b2253adbf768eb..f6bcf24aa6b36610e88e9c74bc13f25b8b614bd1 100644 (file)
@@ -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 )