From: Frank Mori Hess Date: Fri, 15 Dec 2006 16:34:28 +0000 (+0000) Subject: Added INSN_CONFIG_RESET_COUNT X-Git-Tag: r0_7_74~133 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=195af79c78416b94ae8665fddf707819e3887079;p=comedi.git Added INSN_CONFIG_RESET_COUNT --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 59cd8955..f41b05c6 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -632,6 +632,7 @@ static int check_insn_config_length(comedi_insn *insn, lsampl_t *data) case INSN_CONFIG_DIO_INPUT: case INSN_CONFIG_ARM: case INSN_CONFIG_DISARM: + case INSN_CONFIG_RESET_COUNT: if(insn->n == 1) return 0; break; case INSN_CONFIG_DIO_QUERY: diff --git a/comedi/drivers/ni_tio.c b/comedi/drivers/ni_tio.c index 39618523..d0077270 100644 --- a/comedi/drivers/ni_tio.c +++ b/comedi/drivers/ni_tio.c @@ -667,11 +667,15 @@ static int ni_tio_second_gate_registers_present(struct ni_gpct *counter) return 0; } -void ni_tio_init_counter(struct ni_gpct *counter) +static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter) { - /* reset counter */ counter->write_register(counter, Gi_Reset_Bit(counter->counter_index), NITIO_Gxx_Joint_Reset_Reg(counter->counter_index)); +} + +void ni_tio_init_counter(struct ni_gpct *counter) +{ + ni_tio_reset_count_and_disarm(counter); /* initialize counter registers */ counter->regs[NITIO_Gi_Autoincrement_Reg(counter->counter_index)] = 0x0; counter->write_register(counter, counter->regs[NITIO_Gi_Autoincrement_Reg(counter->counter_index)], @@ -1702,6 +1706,10 @@ int ni_tio_insn_config(struct ni_gpct *counter, case INSN_CONFIG_GET_GATE_SRC: return ni_tio_get_gate_src(counter, data[1], &data[2]); break; + case INSN_CONFIG_RESET_COUNT: + ni_tio_reset_count_and_disarm(counter); + return 0; + break; default: break; } diff --git a/include/linux/comedi.h b/include/linux/comedi.h index 829c7549..3c4059c5 100644 --- a/include/linux/comedi.h +++ b/include/linux/comedi.h @@ -242,6 +242,7 @@ enum configuration_ids INSN_CONFIG_ARM = 31, INSN_CONFIG_DISARM = 32, INSN_CONFIG_GET_COUNTER_STATUS = 33, + INSN_CONFIG_RESET_COUNT = 34, INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, // Use CTR as single pulsegenerator INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, // Use CTR as pulsetraingenerator INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, // Use the counter as encoder