📄 par4chkd.h
字号:
/* FILE: par4chkd.h Copyright (c), Symmetric Research, 2001
This include file is useful only for people wanting to recompile the
PAR4CH library and kernel mode device driver. MOST USERS DO NOT
NEED TO INCLUDE IT.
The constants and structures in this file are those shared between
the par4ch.c user library and par4chkd.c kernel mode device driver,
and those used by the driver installation/removal utility programs.
*/
// Define OS dependent device strings and functions
#if defined( SROS_WINNT )
#define REG_PARM_PORTADDR "PortAddress"
#define LREG_PARM_PORTADDR L"PortAddress"
#elif defined( SROS_WIN95 ) || defined( SROS_MSDOS )
#define ERROR_CRC ((long)0xC000009CL)
#define ERROR_SERVICE_DISABLED ((long)1058L)
#define ERROR_SERVICE_ALREADY_RUNNING ((long)1056L)
DEVHANDLE Msdos_DrvOpen( char *ParPortName );
int Msdos_DrvRead(
DEVHANDLE hDevice,
void *lpBuffer,
unsigned long nNumberOfBytesToRead,
unsigned long *lpNumberOfBytesRead
);
int Msdos_DrvIoctl(
DEVHANDLE hDevice,
unsigned long dwIoControlCode,
void *lpInBuffer,
unsigned long nInBufferSize,
void *lpOutBuffer,
unsigned long nOutBufferSize,
unsigned long *lpBytesReturned
);
int Msdos_DrvClose( DEVHANDLE hDevice );
long Msdos_DrvGetLastError( void );
#elif defined( SROS_LINUX )
#define ERROR_CRC ((long)(-EIO))
#define ERROR_SERVICE_DISABLED ((long)(-ENOSYS))
#define ERROR_SERVICE_ALREADY_RUNNING ((long)(-EEXIST))
#else
#pragma message( "COMPILE ERROR: SROS_xxxxx MUST BE DEFINED !! " )
#endif // SROS_WINNT SROS_WIN95 SROS_MSDOS SROS_LINUX
// Define a structure to facilitate passing data between the DLL and
// the device driver.
typedef struct _Init4chParms {
int ParPortMode;
int Df;
int GainLog;
int TurboLog;
int Decimation;
int ExtraDecimation;
long ADS1210_CrValue;
int Error;
} INIT4CHPARMS, *PINIT4CHPARMS;
// Defines shared between user and kernel portions of the driver.
// FIFO buffer ready size and A/D health
#define DB_NVALUES (((long)128)*PAR4CH_CHANNELS)
#define HEALTH_VOLTAGE_BAD (1 << 0)
#define HEALTH_OVERFLOW (1 << 1)
#define DIAG_FLAG_VALUE 0x0F
#define DIAG_FLAG_READY 0x10
#define DIAG_FLAG_FULL 0x20
/* IOCTL_ID NUMBERS:
The I/O Control code id numbers are used to indicate which function
the device driver should perform on the kernel side.
The format of these id numbers are OS dependent. DO NOT change them,
they have bit fields which are OS specific.
*/
#if defined( SROS_WINNT )
/* UNDER WINNT:
Device types in the range 0x8000 to 0xFFFF (32768-65535) are for customer use.
IOCTL function codes 0x800 to 0xFFF (2048-4095) are for customer use.
Winioctl.h is only included here, if ntddk.h has not already been
included elsewhere. This is because either file defines the needed
ioctl information, but they conflict over DEVICE_TYPE.
The bit fields in the IOCTL_ID ( WinNT CTL_CODE ) are assigned in
winioctl.h as follows:
#define CTL_CODE( DeviceType, Function, Method, Access) =
( (DeviceType) << 16 ) |
( (Access) << 14 ) |
( (Function) << 2 ) |
( (Method) << 0 )
The two decoding macros IOCTL_TYPE and _IOCTL_FUNC return their
respective bit fields from IOCTL_ID.
*/
#if !defined( DEVICE_TYPE )
#include <winioctl.h>
#endif
#define PAR4CH_DEVICE_TYPE 0xDD4C
#define DA_RD FILE_READ_ACCESS
#define DA_WR FILE_WRITE_ACCESS
#define DA_RW (FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_ID( id, access, size) CTL_CODE( PAR4CH_DEVICE_TYPE, (0x900+id), METHOD_BUFFERED, access)
#define IOCTLBASE 0x900
#define IOCTL_TYPE( ioctl_id) (((ioctl_id)>>16) & 0xFFFF)
#define IOCTL_FUNC( ioctl_id) (((ioctl_id)>>2) & 0x0FFF)
#elif defined( SROS_WIN95 ) || defined( SROS_MSDOS )
#define PAR4CH_DEVICE_TYPE 0x3443 // = "4C"
#define DA_RD
#define DA_WR
#define DA_RW
#define IOCTL_ID( id, access, size) id
#define IOCTLBASE 0x00
#define IOCTL_TYPE( ioctl_id) (PAR4CH_DEVICE_TYPE)
#define IOCTL_FUNC( ioctl_id) (ioctl_id)
#elif defined( SROS_LINUX )
#include <linux/ioctl.h> // included for ioctl macros
#define PAR4CH_DEVICE_TYPE 0x23
#define DA_RD _IOR
#define DA_WR _IOW
#define DA_RW _IOWR
#define IOCTL_ID( id, access, size) access( PAR4CH_DEVICE_TYPE, id, size)
#define IOCTLBASE 0x00
#define IOCTL_TYPE( ioctl_id) (_IOC_TYPE(ioctl_id))
#define IOCTL_FUNC( ioctl_id) (_IOC_NR(ioctl_id))
#endif // SROS_xxxxx
#define IOCTL_PAR4CH_INIT IOCTL_ID( 0x00, DA_RW, INIT4CHPARMS )
#define IOCTL_PAR4CH_START IOCTL_ID( 0x01, DA_WR, int )
#define IOCTL_PAR4CH_STOP IOCTL_ID( 0x02, DA_WR, int )
#define IOCTL_PAR4CH_READY IOCTL_ID( 0x03, DA_RD, int )
#define IOCTL_PAR4CH_OVERFLOW IOCTL_ID( 0x04, DA_RD, int )
#define IOCTL_PAR4CH_USER_LED IOCTL_ID( 0x05, DA_WR, int )
#define IOCTL_PAR4CH_DIO_READ IOCTL_ID( 0x06, DA_RD, int )
#define IOCTL_PAR4CH_DIO_WRITE IOCTL_ID( 0x07, DA_WR, int )
#define IOCTL_PAR4CH_INTR_ENABLE IOCTL_ID( 0x08, DA_WR, int )
#define IOCTL_PAR4CH_INTR_DISABLE IOCTL_ID( 0x09, DA_WR, int )
#define IOCTL_PAR4CH_VOLTAGE_GOOD IOCTL_ID( 0x0A, DA_RD, int )
#define IOCTL_PAR4CH_CHECK_HEALTH IOCTL_ID( 0x0B, DA_RD, int )
#define IOCTL_PAR4CH_DIAG_SET_POWER_DOWN IOCTL_ID( 0x0C, DA_WR, int )
#define IOCTL_PAR4CH_DIAG_BDCTRL_MODE IOCTL_ID( 0x0D, DA_WR, int )
#define IOCTL_PAR4CH_DIAG_FIFO_RESET IOCTL_ID( 0x0E, DA_RD, int )
#define IOCTL_PAR4CH_DIAG_FIFO_READ IOCTL_ID( 0x0F, DA_RD, int )
#define IOCTL_PAR4CH_DIAG_FIFO_WRITE IOCTL_ID( 0x10, DA_RW, int )
#define IOCTL_MAXFUNC IOCTLBASE+0x11
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -