Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
dt282x.c File Reference
#include "../comedidev.h"
#include <linux/gfp.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/dma.h>
#include "comedi_fc.h"

Go to the source code of this file.

Data Structures

struct  dt282x_board
 
struct  dt282x_private
 

Macros

#define DEBUG
 
#define DT2821_TIMEOUT   100 /* 500 us */
 
#define DT2821_SIZE   0x10
 
#define DT2821_ADCSR   0x00 /* A/D Control/Status */
 
#define DT2821_CHANCSR   0x02 /* Channel Control/Status */
 
#define DT2821_ADDAT   0x04 /* A/D data */
 
#define DT2821_DACSR   0x06 /* D/A Control/Status */
 
#define DT2821_DADAT   0x08 /* D/A data */
 
#define DT2821_DIODAT   0x0a /* digital data */
 
#define DT2821_SUPCSR   0x0c /* Supervisor Control/Status */
 
#define DT2821_TMRCTR   0x0e /* Timer/Counter */
 
#define DT2821_ADCSR_MASK   0xfff0
 
#define DT2821_ADCSR_VAL   0x7c00
 
#define DT2821_CHANCSR_MASK   0xf0f0
 
#define DT2821_CHANCSR_VAL   0x70f0
 
#define DT2821_DACSR_MASK   0x7c93
 
#define DT2821_DACSR_VAL   0x7c90
 
#define DT2821_SUPCSR_MASK   0xf8ff
 
#define DT2821_SUPCSR_VAL   0x0000
 
#define DT2821_TMRCTR_MASK   0xff00
 
#define DT2821_TMRCTR_VAL   0xf000
 
#define DT2821_ADERR   0x8000 /* (R) 1 for A/D error */
 
#define DT2821_ADCLK   0x0200 /* (R/W) A/D clock enable */
 
#define DT2821_MUXBUSY   0x0100 /* (R) multiplexer busy */
 
#define DT2821_ADDONE   0x0080 /* (R) A/D done */
 
#define DT2821_IADDONE   0x0040 /* (R/W) interrupt on A/D done */
 
#define DT2821_LLE   0x8000 /* (R/W) Load List Enable */
 
#define DT2821_DAERR   0x8000 /* (R) D/A error */
 
#define DT2821_YSEL   0x0200 /* (R/W) DAC 1 select */
 
#define DT2821_SSEL   0x0100 /* (R/W) single channel select */
 
#define DT2821_DACRDY   0x0080 /* (R) DAC ready */
 
#define DT2821_IDARDY   0x0040 /* (R/W) interrupt on DAC ready */
 
#define DT2821_DACLK   0x0020 /* (R/W) D/A clock enable */
 
#define DT2821_HBOE   0x0002 /* (R/W) DIO high byte output enable */
 
#define DT2821_LBOE   0x0001 /* (R/W) DIO low byte output enable */
 
#define DT2821_DMAD   0x8000 /* (R) DMA done */
 
#define DT2821_ERRINTEN   0x4000 /* (R/W) interrupt on error */
 
#define DT2821_CLRDMADNE   0x2000 /* (W) clear DMA done */
 
#define DT2821_DDMA   0x1000 /* (R/W) dual DMA */
 
#define DT2821_DS1   0x0800 /* (R/W) DMA select 1 */
 
#define DT2821_DS0   0x0400 /* (R/W) DMA select 0 */
 
#define DT2821_BUFFB   0x0200 /* (R/W) buffer B selected */
 
#define DT2821_SCDN   0x0100 /* (R) scan done */
 
#define DT2821_DACON   0x0080 /* (W) DAC single conversion */
 
#define DT2821_ADCINIT   0x0040 /* (W) A/D initialize */
 
#define DT2821_DACINIT   0x0020 /* (W) D/A initialize */
 
#define DT2821_PRLD   0x0010 /* (W) preload multiplexer */
 
#define DT2821_STRIG   0x0008 /* (W) software trigger */
 
#define DT2821_XTRIG   0x0004 /* (R/W) external trigger enable */
 
#define DT2821_XCLK   0x0002 /* (R/W) external clock enable */
 
#define DT2821_BDINIT   0x0001 /* (W) initialize board */
 
#define devpriv   ((struct dt282x_private *)dev->private)
 
#define boardtype   (*(const struct dt282x_board *)dev->board_ptr)
 
#define chan_to_DAC(a)   ((a)&1)
 
#define mux_busy()   (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY)
 
#define ad_done()   (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE)
 
#define wait_for(a, b)
 
#define SLOWEST_TIMER   (250*(1<<15)*255)
 

Enumerations

enum  {
  opt_iobase = 0, opt_irq, opt_dma1, opt_dma2,
  opt_diff, opt_ai_twos, opt_ao0_twos, opt_ao1_twos,
  opt_ai_range, opt_ao0_range, opt_ao1_range
}
 

Functions

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

Macro Definition Documentation

#define ad_done ( )    (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE)

Definition at line 259 of file dt282x.c.

#define boardtype   (*(const struct dt282x_board *)dev->board_ptr)

Definition at line 252 of file dt282x.c.

#define chan_to_DAC (   a)    ((a)&1)

Definition at line 257 of file dt282x.c.

#define DEBUG

Definition at line 68 of file dt282x.c.

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

Definition at line 251 of file dt282x.c.

#define DT2821_ADCINIT   0x0040 /* (W) A/D initialize */

Definition at line 151 of file dt282x.c.

#define DT2821_ADCLK   0x0200 /* (R/W) A/D clock enable */

Definition at line 113 of file dt282x.c.

#define DT2821_ADCSR   0x00 /* A/D Control/Status */

Definition at line 77 of file dt282x.c.

#define DT2821_ADCSR_MASK   0xfff0

Definition at line 91 of file dt282x.c.

#define DT2821_ADCSR_VAL   0x7c00

Definition at line 92 of file dt282x.c.

#define DT2821_ADDAT   0x04 /* A/D data */

Definition at line 79 of file dt282x.c.

#define DT2821_ADDONE   0x0080 /* (R) A/D done */

Definition at line 116 of file dt282x.c.

#define DT2821_ADERR   0x8000 /* (R) 1 for A/D error */

Definition at line 112 of file dt282x.c.

#define DT2821_BDINIT   0x0001 /* (W) initialize board */

Definition at line 157 of file dt282x.c.

#define DT2821_BUFFB   0x0200 /* (R/W) buffer B selected */

Definition at line 148 of file dt282x.c.

#define DT2821_CHANCSR   0x02 /* Channel Control/Status */

Definition at line 78 of file dt282x.c.

#define DT2821_CHANCSR_MASK   0xf0f0

Definition at line 94 of file dt282x.c.

#define DT2821_CHANCSR_VAL   0x70f0

Definition at line 95 of file dt282x.c.

#define DT2821_CLRDMADNE   0x2000 /* (W) clear DMA done */

Definition at line 144 of file dt282x.c.

#define DT2821_DACINIT   0x0020 /* (W) D/A initialize */

Definition at line 152 of file dt282x.c.

#define DT2821_DACLK   0x0020 /* (R/W) D/A clock enable */

Definition at line 136 of file dt282x.c.

#define DT2821_DACON   0x0080 /* (W) DAC single conversion */

Definition at line 150 of file dt282x.c.

#define DT2821_DACRDY   0x0080 /* (R) DAC ready */

Definition at line 134 of file dt282x.c.

#define DT2821_DACSR   0x06 /* D/A Control/Status */

Definition at line 80 of file dt282x.c.

#define DT2821_DACSR_MASK   0x7c93

Definition at line 97 of file dt282x.c.

#define DT2821_DACSR_VAL   0x7c90

Definition at line 98 of file dt282x.c.

#define DT2821_DADAT   0x08 /* D/A data */

Definition at line 81 of file dt282x.c.

#define DT2821_DAERR   0x8000 /* (R) D/A error */

Definition at line 131 of file dt282x.c.

#define DT2821_DDMA   0x1000 /* (R/W) dual DMA */

Definition at line 145 of file dt282x.c.

#define DT2821_DIODAT   0x0a /* digital data */

Definition at line 82 of file dt282x.c.

#define DT2821_DMAD   0x8000 /* (R) DMA done */

Definition at line 142 of file dt282x.c.

#define DT2821_DS0   0x0400 /* (R/W) DMA select 0 */

Definition at line 147 of file dt282x.c.

#define DT2821_DS1   0x0800 /* (R/W) DMA select 1 */

Definition at line 146 of file dt282x.c.

#define DT2821_ERRINTEN   0x4000 /* (R/W) interrupt on error */

Definition at line 143 of file dt282x.c.

#define DT2821_HBOE   0x0002 /* (R/W) DIO high byte output enable */

Definition at line 137 of file dt282x.c.

#define DT2821_IADDONE   0x0040 /* (R/W) interrupt on A/D done */

Definition at line 117 of file dt282x.c.

#define DT2821_IDARDY   0x0040 /* (R/W) interrupt on DAC ready */

Definition at line 135 of file dt282x.c.

#define DT2821_LBOE   0x0001 /* (R/W) DIO low byte output enable */

Definition at line 138 of file dt282x.c.

#define DT2821_LLE   0x8000 /* (R/W) Load List Enable */

Definition at line 123 of file dt282x.c.

#define DT2821_MUXBUSY   0x0100 /* (R) multiplexer busy */

Definition at line 115 of file dt282x.c.

#define DT2821_PRLD   0x0010 /* (W) preload multiplexer */

Definition at line 153 of file dt282x.c.

#define DT2821_SCDN   0x0100 /* (R) scan done */

Definition at line 149 of file dt282x.c.

#define DT2821_SIZE   0x10

Definition at line 71 of file dt282x.c.

#define DT2821_SSEL   0x0100 /* (R/W) single channel select */

Definition at line 133 of file dt282x.c.

#define DT2821_STRIG   0x0008 /* (W) software trigger */

Definition at line 154 of file dt282x.c.

#define DT2821_SUPCSR   0x0c /* Supervisor Control/Status */

Definition at line 83 of file dt282x.c.

#define DT2821_SUPCSR_MASK   0xf8ff

Definition at line 100 of file dt282x.c.

#define DT2821_SUPCSR_VAL   0x0000

Definition at line 101 of file dt282x.c.

#define DT2821_TIMEOUT   100 /* 500 us */

Definition at line 70 of file dt282x.c.

#define DT2821_TMRCTR   0x0e /* Timer/Counter */

Definition at line 84 of file dt282x.c.

#define DT2821_TMRCTR_MASK   0xff00

Definition at line 103 of file dt282x.c.

#define DT2821_TMRCTR_VAL   0xf000

Definition at line 104 of file dt282x.c.

#define DT2821_XCLK   0x0002 /* (R/W) external clock enable */

Definition at line 156 of file dt282x.c.

#define DT2821_XTRIG   0x0004 /* (R/W) external trigger enable */

Definition at line 155 of file dt282x.c.

#define DT2821_YSEL   0x0200 /* (R/W) DAC 1 select */

Definition at line 132 of file dt282x.c.

#define mux_busy ( )    (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY)

Definition at line 258 of file dt282x.c.

#define SLOWEST_TIMER   (250*(1<<15)*255)
#define wait_for (   a,
  b 
)
Value:
do { \
int _i; \
for (_i = 0; _i < DT2821_TIMEOUT; _i++) { \
if (a) { \
_i = 0; \
break; \
} \
udelay(5); \
} \
if (_i) \
b \
} while (0)

Definition at line 265 of file dt282x.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
opt_iobase 
opt_irq 
opt_dma1 
opt_dma2 
opt_diff 
opt_ai_twos 
opt_ao0_twos 
opt_ao1_twos 
opt_ai_range 
opt_ao0_range 
opt_ao1_range 

Definition at line 1068 of file dt282x.c.

Function Documentation

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