NI MIO AO External Scan Trigger Patch

Hello. Here's a short patch to ni_mio_common.c from comedi release 0.7.67 to 
allow external triggering of streaming analog output. It doesn't work with 
DMA, and with #undef PCIDMA in ni_pcimio.c streaming analog input seems to 
be broken in the released version. E.g. the cmd demo program returns many 
zeros before some data (on my NI-6031E). I can see this is being actively 
worked on - so no worries. The first part of the patch, lines 8??, is to 
revert to a working non-DMA AI. The real AO patches are in lines 2???.

I hope the AO part of the patch can be included into the CVS tree.

Oliver

880a881,883
>               if(no_err==0){
>                       async->events |= COMEDI_CB_OVERFLOW;
>               }
892d894
<                       no_err &= comedi_buf_put(async, 
devpriv->ai_fifo_buffer[ n ]);
894,895c896,897
<               //      cfc_write_array_to_buffer( s, 
devpriv->ai_fifo_buffer,
<               //      n * sizeof(devpriv->ai_fifo_buffer[0]) );
---
>               cfc_write_array_to_buffer( s, devpriv->ai_fifo_buffer,
>                       n * sizeof(devpriv->ai_fifo_buffer[0]) );
897,899d898
<               if(no_err==0){
<                       async->events |= COMEDI_CB_OVERFLOW;
<               }
2129a2129
>       trigvar = ni_ns_to_timer(&cmd->scan_begin_arg,TRIG_ROUND_NEAREST);
2179,2182d2178
<       switch(cmd->scan_begin_src){
<       case TRIG_TIMER:
<       // Moved here because ni_ns_to_timer can modify scan_begin_arg
<       trigvar = ni_ns_to_timer(&cmd->scan_begin_arg,TRIG_ROUND_NEAREST);
2192,2202d2187
<       break;
<       case TRIG_EXT:
<               devpriv->ao_cmd2|=AO_BC_Gate_Enable;
<               win_out(devpriv->ao_cmd2,AO_Command_2_Register);
<                 devpriv->ao_mode1|=(
<                               
AO_UPDATE_Source_Select(1+(cmd->scan_begin_arg&0xf))|
<                               AO_UPDATE_Source_Polarity
<                               );
<               win_out(devpriv->ao_mode1,AO_Mode_1_Register);
<       break;
<       }
2266c2251
<       cmd->scan_begin_src &= TRIG_TIMER|TRIG_EXT;
---
>       cmd->scan_begin_src &= TRIG_TIMER;
2332d2316
<       if(cmd->scan_begin_src==TRIG_TIMER){
2336c2320
<       }
---
>

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

Received on 2003-09-17Z10:45:12