- From: Andrew Mubeezi-Magoola <mubeezi_at_yahoo.com>
- Date: Tue, 2 Jul 2002 09:24:52 +0100 (BST)
Kindly advise what is the optimal solution to solve a
time interval problem?
1. The problem is:
in the function ni_ai_insn_readsee which is defined
in ni_mio_common.c under
(usr/local/src/comedi/comedi/drivers)
If the line (introduced in the program by me)
rt_printk("Board_Status =%x
\n",ni_readb(Status_611x));/* Andrew 100 */
is commented out, I get ni_E: timeout !
But if it is not commented Out, then the program gives
no errors.
2. The Question:
I am certain that though the DAQ 6111 board now works,
there should be a better way of regulating this (Time
interval or delay) What is the optimal way of handling
this problem? I guess that this might have someting to
do with jiffies
Kindly advise.
***************
static int ni_ai_insn_read(comedi_device
*dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t
*data)
{
int i,n;
int wsave;
unsigned int mask;
unsigned short signbits;
unsigned short d;
wsave=win_save();
win_out(1,ADC_FIFO_Clear);
ni_load_channelgain_list(dev,1,&insn->chanspec);
mask=(1<<boardtype.adbits)-1;
rt_printk("shift to left by %d\n",
boardtype.adbits); /* Andrew 8 */
signbits=devpriv->ai_xorlist[0];
for(n=0;n<insn->n;n++){
win_out(1,AI_Command_1_Register);
if(boardtype.reg_611x){
/* The 611x has screwy 32-bit FIFOs. */
for(i=0;i<NI_TIMEOUT;i++){
if(ni_readb(Status_611x)&0x80)
rt_printk("Board_Status =%x
\n",ni_readb(Status_611x));/* Andrew 100 */
break;
}
}else{
for(i=0;i<NI_TIMEOUT;i++){
if(!(win_in(AI_Status_1_Register)&AI_FIFO_Empty_St))
// rt_printk("Hello Germany !!!\n "); /* Andrew
7*/
break;
}
}
if(i==NI_TIMEOUT){
// rt_printk("ni_E: timeout 2\n");
// rt_printk(" Hello Svetik !!! \n "); /* Andrew
6*/
rt_printk(" ni_E: timeout #2, i = %d\n\n",
i);/*Andrew 1*/
win_restore(wsave);
return -ETIME;
}
if(boardtype.reg_611x){
d = ni_readl(ADC_FIFO_Data_611x)&0xffff;
}else{
d = ni_readw(ADC_FIFO_Data_Register);
}
d += signbits; /* subtle: needs to be short addition
*/
data[n] = d;
}
win_restore(wsave);
return insn->n;
}
***************
Andrew Mubeezi-Magoola.
(New comedi user)
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
Received on 2002-07-02Z07:24:52