From: Frank Mori Hess Date: Thu, 16 Aug 2007 21:52:43 +0000 (+0000) Subject: Fixed failure to unlock spinlock after locking it. Fixed possibly X-Git-Tag: r0_7_75~44 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=212f520f9725782d86d0eef3ccb23b1daf5cab85;p=comedi.git Fixed failure to unlock spinlock after locking it. Fixed possibly bogus perm_stale_data result from ni_tio_acknowledge_and_confirm(). Added (unused) support for accessing joint status register 1. --- diff --git a/comedi/drivers/ni_tio.c b/comedi/drivers/ni_tio.c index e78dede0..6b926108 100644 --- a/comedi/drivers/ni_tio.c +++ b/comedi/drivers/ni_tio.c @@ -165,6 +165,25 @@ static inline enum ni_gpct_register NITIO_Gxx_Joint_Reset_Reg(unsigned counter_i return 0; } +static inline enum ni_gpct_register NITIO_Gxx_Joint_Status1_Reg(unsigned counter_index) +{ + switch(counter_index) + { + case 0: + case 1: + return NITIO_G01_Joint_Status1_Reg; + break; + case 2: + case 3: + return NITIO_G23_Joint_Status1_Reg; + break; + default: + BUG(); + break; + } + return 0; +} + static inline enum ni_gpct_register NITIO_Gxx_Joint_Status2_Reg(unsigned counter_index) { switch(counter_index) @@ -1039,10 +1058,12 @@ static inline unsigned ni_tio_get_soft_copy(struct ni_gpct *counter, enum ni_gpc { struct ni_gpct_device *counter_dev = counter->counter_dev; unsigned long flags; + unsigned value; comedi_spin_lock_irqsave(&counter_dev->regs_lock, flags); - return counter_dev->regs[register_index]; + value = counter_dev->regs[register_index]; comedi_spin_unlock_irqrestore(&counter_dev->regs_lock, flags ); + return value; } static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter) @@ -2705,6 +2726,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error, in if(gate_error) *gate_error = 0; if(tc_error) *tc_error = 0; + if(perm_stale_data) *perm_stale_data = 0; if(stale_data) *stale_data = 0; if(gxx_status & Gi_Gate_Error_Bit(counter->counter_index))