63 unsigned input_select_bits = 0;
71 ni_tio_set_bits(counter,
81 unsigned gi_dma_config_bits = 0;
87 if (read_not_write == 0)
89 ni_tio_set_bits(counter,
90 NITIO_Gi_DMA_Config_Reg(counter->
101 unsigned int trignum)
116 spin_unlock_irqrestore(&counter->
lock, flags);
134 switch (counter_dev->
variant) {
146 ni_tio_set_bits(counter, NITIO_Gi_Command_Reg(counter->
counter_index),
148 ni_tio_configure_dma(counter, 1, 1);
156 async->
inttrig = &ni_tio_input_inttrig;
173 static int ni_tio_output_cmd(
struct ni_gpct *counter,
176 printk(
KERN_ERR "ni_tio: output commands not yet implemented.\n");
181 ni_tio_configure_dma(counter, 1, 0);
189 int set_gate_source = 0;
190 unsigned gate_source;
203 ni_tio_set_bits(counter,
204 NITIO_Gi_Interrupt_Enable_Reg(counter->
206 Gi_Gate_Interrupt_Enable_Bit(counter->
208 Gi_Gate_Interrupt_Enable_Bit(counter->
222 printk(
KERN_ERR "ni_tio: commands only supported with DMA. Interrupt-driven commands not yet implemented.\n");
225 retval = ni_tio_cmd_setup(counter, async);
228 retval = ni_tio_output_cmd(counter, async);
230 retval = ni_tio_input_cmd(counter, async);
233 spin_unlock_irqrestore(&counter->
lock, flags);
241 unsigned int sources;
246 if (ni_tio_counting_mode_registers_present(counter->
counter_dev))
248 err |= cfc_check_trigger_src(&cmd->
start_src, sources);
262 err |= cfc_check_trigger_is_unique(cmd->
start_src);
264 err |= cfc_check_trigger_is_unique(cmd->
convert_src);
326 spin_unlock_irqrestore(&counter->
lock, flags);
327 ni_tio_configure_dma(counter, 0, 0);
329 ni_tio_set_bits(counter,
340 static int should_ack_gate(
struct ni_gpct *counter)
362 spin_unlock_irqrestore(&counter->
lock, flags);
369 int *tc_error,
int *perm_stale_data,
372 const unsigned short gxx_status = read_register(counter,
376 const unsigned short gi_status = read_register(counter,
387 *perm_stale_data = 0;
391 if (gxx_status & Gi_Gate_Error_Bit(counter->
counter_index)) {
411 if (should_ack_gate(counter))
415 write_register(counter, ack,
416 NITIO_Gi_Interrupt_Acknowledge_Reg
418 if (ni_tio_get_soft_copy
422 if (gxx_status & Gi_Stale_Data_Bit(counter->
counter_index)) {
426 if (read_register(counter,
427 NITIO_Gxx_Joint_Status2_Reg
433 *perm_stale_data = 1;
442 unsigned gpct_mite_status;
449 &perm_stale_data,
NULL);
459 if (read_register(counter,
460 NITIO_Gi_DMA_Status_Reg
472 spin_unlock_irqrestore(&counter->
lock, flags);
482 spin_unlock_irqrestore(&counter->
lock, flags);
493 spin_unlock_irqrestore(&counter->
lock, flags);
497 static int __init ni_tiocmd_init_module(
void)
504 static void __exit ni_tiocmd_cleanup_module(
void)