Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
ni_labpc.c File Reference
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/io.h>
#include "../comedidev.h"
#include <linux/delay.h>
#include <asm/dma.h>
#include "8253.h"
#include "8255.h"
#include "mite.h"
#include "comedi_fc.h"
#include "ni_labpc.h"

Go to the source code of this file.

Macros

#define DRV_NAME   "ni_labpc"
 
#define LABPC_SIZE   32
 
#define LABPC_TIMER_BASE   500
 
#define COMMAND1_REG   0x0
 
#define ADC_GAIN_MASK   (0x7 << 4)
 
#define ADC_CHAN_BITS(x)   ((x) & 0x7)
 
#define ADC_SCAN_EN_BIT   0x80
 
#define COMMAND2_REG   0x1
 
#define PRETRIG_BIT   0x1
 
#define HWTRIG_BIT   0x2
 
#define SWTRIG_BIT   0x4
 
#define CASCADE_BIT   0x8
 
#define DAC_PACED_BIT(channel)   (0x40 << ((channel) & 0x1))
 
#define COMMAND3_REG   0x2
 
#define DMA_EN_BIT   0x1
 
#define DIO_INTR_EN_BIT   0x2
 
#define DMATC_INTR_EN_BIT   0x4
 
#define TIMER_INTR_EN_BIT   0x8
 
#define ERR_INTR_EN_BIT   0x10
 
#define ADC_FNE_INTR_EN_BIT   0x20
 
#define ADC_CONVERT_REG   0x3
 
#define DAC_LSB_REG(channel)   (0x4 + 2 * ((channel) & 0x1))
 
#define DAC_MSB_REG(channel)   (0x5 + 2 * ((channel) & 0x1))
 
#define ADC_CLEAR_REG   0x8
 
#define DMATC_CLEAR_REG   0xa
 
#define TIMER_CLEAR_REG   0xc
 
#define COMMAND6_REG   0xe
 
#define ADC_COMMON_BIT   0x1
 
#define ADC_UNIP_BIT   0x2
 
#define DAC_UNIP_BIT(channel)   (0x4 << ((channel) & 0x1))
 
#define ADC_FHF_INTR_EN_BIT   0x20
 
#define A1_INTR_EN_BIT   0x40
 
#define ADC_SCAN_UP_BIT   0x80
 
#define COMMAND4_REG   0xf
 
#define INTERVAL_SCAN_EN_BIT   0x1
 
#define EXT_SCAN_EN_BIT   0x2
 
#define EXT_CONVERT_OUT_BIT   0x4
 
#define ADC_DIFF_BIT   0x8
 
#define EXT_CONVERT_DISABLE_BIT   0x10
 
#define COMMAND5_REG   0x1c
 
#define EEPROM_WRITE_UNPROTECT_BIT   0x4
 
#define DITHER_EN_BIT   0x8
 
#define CALDAC_LOAD_BIT   0x10
 
#define SCLOCK_BIT   0x20
 
#define SDATA_BIT   0x40
 
#define EEPROM_EN_BIT   0x80
 
#define INTERVAL_COUNT_REG   0x1e
 
#define INTERVAL_LOAD_REG   0x1f
 
#define INTERVAL_LOAD_BITS   0x1
 
#define STATUS1_REG   0x0
 
#define DATA_AVAIL_BIT   0x1
 
#define OVERRUN_BIT   0x2
 
#define OVERFLOW_BIT   0x4
 
#define TIMER_BIT   0x8
 
#define DMATC_BIT   0x10
 
#define EXT_TRIG_BIT   0x40
 
#define STATUS2_REG   0x1d
 
#define EEPROM_OUT_BIT   0x1
 
#define A1_TC_BIT   0x2
 
#define FNHF_BIT   0x4
 
#define ADC_FIFO_REG   0xa
 
#define DIO_BASE_REG   0x10
 
#define COUNTER_A_BASE_REG   0x14
 
#define COUNTER_A_CONTROL_REG   (COUNTER_A_BASE_REG + 0x3)
 
#define INIT_A0_BITS   0x14
 
#define INIT_A1_BITS   0x70
 
#define COUNTER_B_BASE_REG   0x18
 
#define NUM_LABPC_PLUS_AI_RANGES   16
 
#define NUM_LABPC_1200_AI_RANGES   14
 
#define AO_RANGE_IS_UNIPOLAR   0x1
 
#define thisboard   ((struct labpc_board_struct *)dev->board_ptr)
 
#define devpriv   ((struct labpc_private *)dev->private)
 

Enumerations

enum  scan_mode { MODE_SINGLE_CHAN, MODE_SINGLE_CHAN_INTERVAL, MODE_MULT_CHAN_UP, MODE_MULT_CHAN_DOWN }
 

Functions

 EXPORT_SYMBOL_GPL (labpc_1200_is_unipolar)
 
 EXPORT_SYMBOL_GPL (labpc_1200_ai_gain_bits)
 
 EXPORT_SYMBOL_GPL (range_labpc_1200_ai)
 
int labpc_common_attach (struct comedi_device *dev, unsigned long iobase, unsigned int irq, unsigned int dma_chan)
 
 EXPORT_SYMBOL_GPL (labpc_common_attach)
 
void labpc_common_detach (struct comedi_device *dev)
 
 EXPORT_SYMBOL_GPL (labpc_common_detach)
 
 module_comedi_driver (labpc_driver)
 
 MODULE_AUTHOR ("Comedi http://www.comedi.org")
 
 MODULE_DESCRIPTION ("Comedi low-level driver")
 
 MODULE_LICENSE ("GPL")
 

Variables

const int labpc_1200_is_unipolar [NUM_LABPC_1200_AI_RANGES]
 
const int labpc_1200_ai_gain_bits [NUM_LABPC_1200_AI_RANGES]
 
struct comedi_lrange range_labpc_1200_ai
 

Macro Definition Documentation

#define A1_INTR_EN_BIT   0x40

Definition at line 145 of file ni_labpc.c.

#define A1_TC_BIT   0x2

Definition at line 195 of file ni_labpc.c.

#define ADC_CHAN_BITS (   x)    ((x) & 0x7)

Definition at line 102 of file ni_labpc.c.

#define ADC_CLEAR_REG   0x8

Definition at line 131 of file ni_labpc.c.

#define ADC_COMMON_BIT   0x1

Definition at line 137 of file ni_labpc.c.

#define ADC_CONVERT_REG   0x3

Definition at line 128 of file ni_labpc.c.

#define ADC_DIFF_BIT   0x8

Definition at line 156 of file ni_labpc.c.

#define ADC_FHF_INTR_EN_BIT   0x20

Definition at line 143 of file ni_labpc.c.

#define ADC_FIFO_REG   0xa

Definition at line 198 of file ni_labpc.c.

#define ADC_FNE_INTR_EN_BIT   0x20

Definition at line 127 of file ni_labpc.c.

#define ADC_GAIN_MASK   (0x7 << 4)

Definition at line 101 of file ni_labpc.c.

#define ADC_SCAN_EN_BIT   0x80

Definition at line 104 of file ni_labpc.c.

#define ADC_SCAN_UP_BIT   0x80

Definition at line 147 of file ni_labpc.c.

#define ADC_UNIP_BIT   0x2

Definition at line 139 of file ni_labpc.c.

#define AO_RANGE_IS_UNIPOLAR   0x1

Definition at line 390 of file ni_labpc.c.

#define CALDAC_LOAD_BIT   0x10

Definition at line 165 of file ni_labpc.c.

#define CASCADE_BIT   0x8

Definition at line 113 of file ni_labpc.c.

#define COMMAND1_REG   0x0

Definition at line 100 of file ni_labpc.c.

#define COMMAND2_REG   0x1

Definition at line 105 of file ni_labpc.c.

#define COMMAND3_REG   0x2

Definition at line 115 of file ni_labpc.c.

#define COMMAND4_REG   0xf

Definition at line 148 of file ni_labpc.c.

#define COMMAND5_REG   0x1c

Definition at line 159 of file ni_labpc.c.

#define COMMAND6_REG   0xe

Definition at line 135 of file ni_labpc.c.

#define COUNTER_A_BASE_REG   0x14

Definition at line 201 of file ni_labpc.c.

#define COUNTER_A_CONTROL_REG   (COUNTER_A_BASE_REG + 0x3)

Definition at line 202 of file ni_labpc.c.

#define COUNTER_B_BASE_REG   0x18

Definition at line 207 of file ni_labpc.c.

#define DAC_LSB_REG (   channel)    (0x4 + 2 * ((channel) & 0x1))

Definition at line 129 of file ni_labpc.c.

#define DAC_MSB_REG (   channel)    (0x5 + 2 * ((channel) & 0x1))

Definition at line 130 of file ni_labpc.c.

#define DAC_PACED_BIT (   channel)    (0x40 << ((channel) & 0x1))

Definition at line 114 of file ni_labpc.c.

#define DAC_UNIP_BIT (   channel)    (0x4 << ((channel) & 0x1))

Definition at line 141 of file ni_labpc.c.

#define DATA_AVAIL_BIT   0x1

Definition at line 179 of file ni_labpc.c.

#define devpriv   ((struct labpc_private *)dev->private)

Definition at line 490 of file ni_labpc.c.

#define DIO_BASE_REG   0x10

Definition at line 200 of file ni_labpc.c.

#define DIO_INTR_EN_BIT   0x2

Definition at line 119 of file ni_labpc.c.

#define DITHER_EN_BIT   0x8

Definition at line 163 of file ni_labpc.c.

#define DMA_EN_BIT   0x1

Definition at line 117 of file ni_labpc.c.

#define DMATC_BIT   0x10

Definition at line 187 of file ni_labpc.c.

#define DMATC_CLEAR_REG   0xa

Definition at line 132 of file ni_labpc.c.

#define DMATC_INTR_EN_BIT   0x4

Definition at line 121 of file ni_labpc.c.

#define DRV_NAME   "ni_labpc"

Definition at line 90 of file ni_labpc.c.

#define EEPROM_EN_BIT   0x80

Definition at line 171 of file ni_labpc.c.

#define EEPROM_OUT_BIT   0x1

Definition at line 193 of file ni_labpc.c.

#define EEPROM_WRITE_UNPROTECT_BIT   0x4

Definition at line 161 of file ni_labpc.c.

#define ERR_INTR_EN_BIT   0x10

Definition at line 125 of file ni_labpc.c.

#define EXT_CONVERT_DISABLE_BIT   0x10

Definition at line 157 of file ni_labpc.c.

#define EXT_CONVERT_OUT_BIT   0x4

Definition at line 154 of file ni_labpc.c.

#define EXT_SCAN_EN_BIT   0x2

Definition at line 152 of file ni_labpc.c.

#define EXT_TRIG_BIT   0x40

Definition at line 189 of file ni_labpc.c.

#define FNHF_BIT   0x4

Definition at line 197 of file ni_labpc.c.

#define HWTRIG_BIT   0x2

Definition at line 109 of file ni_labpc.c.

#define INIT_A0_BITS   0x14

Definition at line 204 of file ni_labpc.c.

#define INIT_A1_BITS   0x70

Definition at line 206 of file ni_labpc.c.

#define INTERVAL_COUNT_REG   0x1e

Definition at line 172 of file ni_labpc.c.

#define INTERVAL_LOAD_BITS   0x1

Definition at line 174 of file ni_labpc.c.

#define INTERVAL_LOAD_REG   0x1f

Definition at line 173 of file ni_labpc.c.

#define INTERVAL_SCAN_EN_BIT   0x1

Definition at line 150 of file ni_labpc.c.

#define LABPC_SIZE   32

Definition at line 93 of file ni_labpc.c.

#define LABPC_TIMER_BASE   500

Definition at line 95 of file ni_labpc.c.

#define NUM_LABPC_1200_AI_RANGES   14

Definition at line 329 of file ni_labpc.c.

#define NUM_LABPC_PLUS_AI_RANGES   16

Definition at line 266 of file ni_labpc.c.

#define OVERFLOW_BIT   0x4

Definition at line 183 of file ni_labpc.c.

#define OVERRUN_BIT   0x2

Definition at line 181 of file ni_labpc.c.

#define PRETRIG_BIT   0x1

Definition at line 107 of file ni_labpc.c.

#define SCLOCK_BIT   0x20

Definition at line 167 of file ni_labpc.c.

#define SDATA_BIT   0x40

Definition at line 169 of file ni_labpc.c.

#define STATUS1_REG   0x0

Definition at line 177 of file ni_labpc.c.

#define STATUS2_REG   0x1d

Definition at line 191 of file ni_labpc.c.

#define SWTRIG_BIT   0x4

Definition at line 111 of file ni_labpc.c.

#define thisboard   ((struct labpc_board_struct *)dev->board_ptr)

Definition at line 483 of file ni_labpc.c.

#define TIMER_BIT   0x8

Definition at line 185 of file ni_labpc.c.

#define TIMER_CLEAR_REG   0xc

Definition at line 133 of file ni_labpc.c.

#define TIMER_INTR_EN_BIT   0x8

Definition at line 123 of file ni_labpc.c.

Enumeration Type Documentation

enum scan_mode
Enumerator:
MODE_SINGLE_CHAN 
MODE_SINGLE_CHAN_INTERVAL 
MODE_MULT_CHAN_UP 
MODE_MULT_CHAN_DOWN 

Definition at line 209 of file ni_labpc.c.

Function Documentation

EXPORT_SYMBOL_GPL ( labpc_1200_is_unipolar  )
EXPORT_SYMBOL_GPL ( labpc_1200_ai_gain_bits  )
EXPORT_SYMBOL_GPL ( range_labpc_1200_ai  )
EXPORT_SYMBOL_GPL ( labpc_common_attach  )
EXPORT_SYMBOL_GPL ( labpc_common_detach  )
int labpc_common_attach ( struct comedi_device dev,
unsigned long  iobase,
unsigned int  irq,
unsigned int  dma_chan 
)

Definition at line 504 of file ni_labpc.c.

void labpc_common_detach ( struct comedi_device dev)

Definition at line 771 of file ni_labpc.c.

MODULE_AUTHOR ( "Comedi http://www.comedi.org"  )
module_comedi_driver ( labpc_driver  )
MODULE_DESCRIPTION ( "Comedi low-level driver )
MODULE_LICENSE ( "GPL"  )

Variable Documentation

const int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES]
Initial value:
= {
0x00,
0x20,
0x30,
0x40,
0x50,
0x60,
0x70,
0x00,
0x20,
0x30,
0x40,
0x50,
0x60,
0x70,
}

Definition at line 350 of file ni_labpc.c.

const int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES]
Initial value:
= {
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
}

Definition at line 331 of file ni_labpc.c.

struct comedi_lrange range_labpc_1200_ai
Initial value:
= {
{
BIP_RANGE(2.5),
BIP_RANGE(0.5),
BIP_RANGE(0.25),
BIP_RANGE(0.1),
BIP_RANGE(0.05),
UNI_RANGE(10),
UNI_RANGE(0.5),
UNI_RANGE(0.2),
UNI_RANGE(0.1),
}
}

Definition at line 368 of file ni_labpc.c.