📄 addi_common.h
字号:
/**@verbatimCopyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier Tel: +19(0)7223/9493-0 Fax: +49(0)7223/9493-92 http://www.addi-data-com info@addi-data.com 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAYou shoud also find the complete GPL in the COPYING file accompanying this source code.@endverbatim*//* +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ | Project : ADDI-DATA | Compiler : GCC | | Modulname : addi_common.h | Version : 2.96 | +-------------------------------+---------------------------------------+ | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : ADDI COMMON Header File | +-----------------------------------------------------------------------+*///including header files#include <linux/kernel.h>#include <linux/module.h>#include <linux/sched.h>#include <linux/mm.h>//#include <linux/malloc.h>#include <linux/slab.h>#include <linux/errno.h>#include <linux/ioport.h>#include <linux/delay.h>#include <linux/interrupt.h>#include <linux/timex.h>#include <linux/timer.h>#include <linux/pci.h>#include <asm/io.h>#include <linux/comedidev.h>#include "addi_amcc_s5933.h"#include <linux/kmod.h>#include <asm/uaccess.h>#define ERROR -1#define SUCCESS 1// variable type definition#define VOID void#define UINT unsigned int#define ULONG unsigned long#define USHORT unsigned short#define PUSHORT unsigned short *#define INT int#define BYTE unsigned char#define PBYTE unsigned char *#define PINT int *#define PUINT unsigned int *#define CHAR char#define PCHAR char *#define PRANGE comedi_lrange *#define LOBYTE(W) (BYTE )((W)&0xFF)#define HIBYTE(W) (BYTE )(((W)>>8)&0xFF)#define MAKEWORD(H,L) (USHORT )((L)|( (H)<<8) )#define LOWORD(W) (USHORT )((W)&0xFFFF)#define HIWORD(W) (USHORT )(((W)>>16)&0xFFFF)#define MAKEDWORD(H,L) (UINT )((L)|( (H)<<16) )#define DWORD unsigned long#define WORD unsigned short#define ADDI_ENABLE 1 #define ADDI_DISABLE 0 #define APCI1710_SAVE_INTERRUPT 1#define ADDIDATA_EEPROM 1#define ADDIDATA_NO_EEPROM 0#define ADDIDATA_93C76 "93C76"#define ADDIDATA_S5920 "S5920"#define ADDIDATA_S5933 "S5933"#define ADDIDATA_9054 "9054"// Structures// structure for the boardtypetypedef struct { PCHAR pc_DriverName; // driver name INT i_VendorId; //PCI vendor a device ID of card INT i_DeviceId; INT i_IorangeBase0; INT i_IorangeBase1; INT i_IorangeBase2; // base 2 range INT i_IorangeBase3; // base 3 range INT i_PCIEeprom; // eeprom present or not PCHAR pc_EepromChip; // type of chip INT i_NbrAiChannel; // num of A/D chans INT i_NbrAiChannelDiff;// num of A/D chans in diff mode INT i_AiChannelList;// len of chanlist INT i_NbrAoChannel;// num of D/A chans INT i_AiMaxdata;// resolution of A/D INT i_AoMaxdata;// resolution of D/A PRANGE pr_AiRangelist; // rangelist for A/D PRANGE pr_AoRangelist;// rangelist for D/A INT i_NbrDiChannel; // Number of DI channels INT i_NbrDoChannel; // Number of DO channels INT i_DoMaxdata; // data to set all chanels high INT i_NbrTTLChannel; // Number of TTL channels PRANGE pr_TTLRangelist; // rangelist for TTL INT i_Dma; // dma present or not INT i_Timer; // timer subdevice present or not BYTE b_AvailableConvertUnit; UINT ui_MinAcquisitiontimeNs; // Minimum Acquisition in Nano secs UINT ui_MinDelaytimeNs; // Minimum Delay in Nano secs// interrupt and reset void (*v_hwdrv_Interrupt)(int irq, void *d, struct pt_regs *regs); int (*i_hwdrv_Reset)(comedi_device *dev);//Subdevice functions //ANALOG INPUTint (*i_hwdrv_InsnConfigAnalogInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnReadAnalogInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnWriteAnalogInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnBitsAnalogInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_CommandTestAnalogInput)(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) ;int (*i_hwdrv_CommandAnalogInput)(comedi_device * dev,comedi_subdevice * s);int (*i_hwdrv_CancelAnalogInput)(comedi_device * dev, comedi_subdevice * s);//Analog Outputint (*i_hwdrv_InsnConfigAnalogOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnWriteAnalogOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnBitsAnalogOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);//Digital Inputint (*i_hwdrv_InsnConfigDigitalInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnReadDigitalInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnWriteDigitalInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnBitsDigitalInput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);//Digital Outputint (*i_hwdrv_InsnConfigDigitalOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnWriteDigitalOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnBitsDigitalOutput)(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data);int (*i_hwdrv_InsnReadDigitalOutput)(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data);//TIMER int (*i_hwdrv_InsnConfigTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnWriteTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnReadTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnBitsTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); //TTL IO int (*i_hwdr_ConfigInitTTLIO)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdr_ReadTTLIOBits)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdr_ReadTTLIOAllPortValue)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdr_WriteTTLIOChlOnOff)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data);} boardtype;//MODULE INFO STRUCTURE typedef union { /*****************************/ /* Incremental counter infos */ /*****************************/ struct { union { struct { BYTE b_ModeRegister1; BYTE b_ModeRegister2; BYTE b_ModeRegister3; BYTE b_ModeRegister4; }s_ByteModeRegister; DWORD dw_ModeRegister1_2_3_4; }s_ModeRegister; struct { unsigned int b_IndexInit : 1; unsigned int b_CounterInit : 1; unsigned int b_ReferenceInit : 1; unsigned int b_IndexInterruptOccur : 1; unsigned int b_CompareLogicInit : 1; unsigned int b_FrequencyMeasurementInit : 1; unsigned int b_FrequencyMeasurementEnable : 1; }s_InitFlag; }s_SiemensCounterInfo; /*************/ /* SSI infos */ /*************/ struct { BYTE b_SSIProfile; BYTE b_PositionTurnLength; BYTE b_TurnCptLength; BYTE b_SSIInit; }s_SSICounterInfo; /*****************/ /* TTL I/O infos */ /*****************/ struct { BYTE b_TTLInit; BYTE b_PortConfiguration [4]; }s_TTLIOInfo; /*********************/ /* Digital I/O infos */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -