⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ni_pcimio.c

📁 rtlinux-3.2-pre3.tar.bz2 rtlinux3.2-pre3的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*    module/ni_pcimio.c    Hardware driver for NI PCI-MIO E series cards    COMEDI - Linux Control and Measurement Device Interface    Copyright (C) 1997-8 David A. Schleef <ds@schleef.org>    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*//*Driver: ni_pcimio.oDescription: National Instruments PCI-MIO-E series (all boards)Author: ds, John Hallen, Frank Mori Hess, Rolf Mueller, Herbert Peremans,  Herman BruyninckxStatus: worksDevices: [National Instruments] PCI-MIO-16XE-50 (ni_pcimio),  PCI-MIO-16XE-10, PXI-6030E, PCI-MIO-16E-1, PCI-MIO-16E-4, PCI-6040E,  PXI-6040E, PCI-6031E, PCI-6032E, PCI-6033E, PCI-6071E, PCI-6023E,  PCI-6024E, PCI-6025E, PXI-6025E, PCI-6034E, PCI-6035E, PCI-6052E,  PCI-6110, PCI-6111, PCI-6711, PCI-6713, PXI-6071E, PXI-6070E,  PXI-6052E, PCI-6036E, PCI-6731, PCI-6733Updated: Sat, 16 Mar 2002 17:34:48 -0800These boards are almost identical to the AT-MIO E series, except thatthey use the PCI bus instead of ISA (i.e., AT).  See the notes forthe ni_atmio.o driver for additional information about these boards.Autocalibration is supported on many of the devices, using thecalibration utility in Comedilib.By default, the driver uses DMA to transfer analog input data tomemory.  When DMA is enabled, not all triggering features aresupported.Streaming analog output is not supported on PCI-671x and PCI-673x.PCI IDs are not known for PCI-6731 and PCI-6733.  Digital I/O may notwork on 673x.Information (number of channels, bits, etc.) for some devices may beincorrect.  Please check this and submit a bug if there are problemsfor your device.Bugs: - When DMA is enabled, COMEDI_EV_SCAN_END and COMEDI_EV_CONVERT do   not work correctly. - There are reported problems with the 67xx boards.*//*	The PCI-MIO E series driver was originally written by	Tomasz Motylewski <...>, and ported to comedi by ds.	References:	   341079b.pdf  PCI E Series Register-Level Programmer Manual	   340934b.pdf  DAQ-STC reference manual	   322080b.pdf  6711/6713/6715 User Manual	   320945c.pdf  PCI E Series User Manual	   322138a.pdf  PCI-6052E and DAQPad-6052E User Manual	ISSUES:	need to deal with external reference for DAC, and other DAC	properties in board properties	deal with at-mio-16de-10 revision D to N changes, etc.	need to add other CALDAC type	need to slow down DAC loading.  I don't trust NI's claim that	two writes to the PCI bus slows IO enough.  I would prefer to	use comedi_udelay().  Timing specs: (clock)		AD8522		30ns		DAC8043		120ns		DAC8800		60ns		MB88341		?*/#include <linux/comedidev.h>#include <linux/delay.h>#include "ni_stc.h"#include "mite.h"//#define PCI_DEBUG#define PCIDMA#define PCIMIO 1#undef ATMIO#define MAX_N_CALDACS (16+16+2)/* The following two tables must be in the same order */static struct pci_device_id ni_pci_table[] __devinitdata = {	{ PCI_VENDOR_ID_NATINST, 0x0162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1170, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x11d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1190, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x11c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1270, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1350, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2a60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2a70, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2a80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2ab0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2ca0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x18b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x14e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x14f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1870, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x15b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x11b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x18c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x1580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ PCI_VENDOR_ID_NATINST, 0x2890, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },	{ 0 }};MODULE_DEVICE_TABLE(pci, ni_pci_table);static ni_board ni_boards[]={	{       device_id:      0x0162, // NI also says 0x1620.  typo?		name:           "pci-mio-16xe-50",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  2048,		alwaysdither:   1,		gainlkup:       ai_gain_8,		ai_speed:	50000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  0,		ao_unipolar:    0,		caldac:         {dac8800,dac8043},		has_8255:       0,	},	{       device_id:      0x1170,		name:           "pci-mio-16xe-10",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_14,		ai_speed:	10000,		n_aochan:       2,		aobits:         16,		ao_fifo_depth:  2048,		ao_unipolar:    1,		caldac:         {dac8800,dac8043,ad8522},		has_8255:       0,	},	{       device_id:      0x11d0,		name:           "pxi-6030e",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_14,		ai_speed:	10000,		n_aochan:       2,		aobits:         16,		ao_fifo_depth:  2048,		ao_unipolar:    1,		caldac:         {dac8800,dac8043,ad8522},		has_8255:       0,	},	{       device_id:      0x1180,		name:           "pci-mio-16e-1",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_16,		ai_speed:	800,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  2048,		ao_unipolar:    1,		caldac:         {mb88341},		has_8255:       0,	},	{       device_id:      0x1190,		name:           "pci-mio-16e-4", /* aka pci-6040e */		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_16,		/* Note: there have been reported problems with full speed		 * on this board */		ai_speed:	2000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  512,		ao_unipolar:    1,		caldac:         {ad8804_debug}, // doc says mb88341		has_8255:       0,	},	{       device_id:      0x11c0,		name:           "pxi-6040e",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_16,		ai_speed:	2000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  512,		ao_unipolar:    1,		caldac:         {mb88341},		has_8255:       0,	},	{       device_id:      0x1330,		name:           "pci-6031e",		n_adchan:       64,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_14,		ai_speed:	10000,		n_aochan:       2,		aobits:         16,		ao_fifo_depth:  2048,		ao_unipolar:    1,		caldac:         {dac8800,dac8043,ad8522},		has_8255:       0,	},	{       device_id:      0x1270,		name:           "pci-6032e",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_14,		ai_speed:	10000,		n_aochan:       0,		aobits:         0,		ao_fifo_depth:  0,		ao_unipolar:    1,		caldac:         {dac8800,dac8043,ad8522},		has_8255:       0,	},	{       device_id:      0x1340,		name:           "pci-6033e",		n_adchan:       64,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_14,		ai_speed:	10000,		n_aochan:       0,		aobits:         0,		ao_fifo_depth:  0,		ao_unipolar:    1,		caldac:         {dac8800,dac8043,ad8522},		has_8255:       0,	},	{       device_id:      0x1350,		name:           "pci-6071e",		n_adchan:       64,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_16,		ai_speed:	800,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  2048,		ao_unipolar:    1,		caldac:         {ad8804_debug},		has_8255:       0,	},	{       device_id:      0x2a60,		name:           "pci-6023e",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       0,		aobits:         0,		ao_unipolar:    0,		caldac:         {ad8804}, /* manual is wrong */		has_8255:	0,	},	{       device_id:      0x2a70,		name:           "pci-6024e",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  0,		ao_unipolar:    0,		caldac:         {ad8804}, /* manual is wrong */		has_8255:	0,	},	{       device_id:      0x2a80,		name:           "pci-6025e",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  0,		ao_unipolar:    0,		caldac:         {ad8804}, /* manual is wrong */		has_8255:	1,	},	{       device_id:      0x2ab0,		name:           "pxi-6025e",		n_adchan:       16,		adbits:         12,		ai_fifo_depth:  512,		alwaysdither:   0,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  0,		ao_unipolar:    1,		caldac:         {ad8804}, /* manual is wrong */		has_8255:	1,	},	{       device_id:      0x2ca0,		name:           "pci-6034e",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       0,		aobits:         0,		ao_fifo_depth:  0,		ao_unipolar:    0,		caldac:         {mb88341},		has_8255:	0,	},	{       device_id:      0x2c80,		name:           "pci-6035e",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_4,		ai_speed:	5000,		n_aochan:       2,		aobits:         12,		ao_fifo_depth:  0,		ao_unipolar:    0,		caldac:         {ad8804_debug},		has_8255:	0,	},	{       device_id:      0x18b0,		name:           "pci-6052e",		n_adchan:       16,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_16,		ai_speed:	3000,		n_aochan:       2,		aobits:         16,		ao_unipolar:    1,		ao_fifo_depth:  2048,		caldac:         {ad8804,mb88341,ad8522}, /* manual is wrong */	},#if 0	{       device_id:      0x0000, /* unknown */		name:           "pci-6053e",		n_adchan:       64,		adbits:         16,		ai_fifo_depth:  512,		alwaysdither:   1,		gainlkup:       ai_gain_16,		ai_speed:	3000,		n_aochan:       2,		aobits:         16,		ao_unipolar:    1,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -