From 212f520f9725782d86d0eef3ccb23b1daf5cab85 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 16 Aug 2007 21:52:43 +0000 Subject: [PATCH] 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. --- comedi/drivers/ni_tio.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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)) -- 2.26.2