Rev 17 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#ifndef __PCIVME_H__
#define __PCIVME_H__
//-------------------------------------------------------------------------
// WINNT driver for PCIVME interface from ARW Elektronik, Germany ---------
// IO definitions and common data structures between application and driver
//
// (c) 1999-2004 ARW Elektronik
//
// this source code is published under GPL (Open Source). You can use, redistrubute and
// modify it unless this header is not modified or deleted. No warranty is given that
// this software will work like expected.
// This product is not authorized for use as critical component in life support systems
// wihout the express written approval of ARW Elektronik Germany.
//
// Please announce changes and hints to ARW Elektronik
//
// $Log: pcivme.h,v $
// Revision 1.3 2004/07/24 07:07:26 klaus
// Update copyright to 2004
//
// Revision 1.2 2003/11/15 19:12:50 klaus
// Update copyright to 2003
//
// Revision 1.1.1.1 2003/11/14 23:16:33 klaus
// First put into repository
//
// Revision 1.4 2002/10/27 17:02:30 klaus
// File addressing bug > 2 Gbtye circumvent
//
// Revision 1.3 2002/10/27 16:17:48 klaus
// Typing bug fixed caused at log addition
//
// Revision 1.2 2002/10/27 16:11:02 klaus
// Added CVS log into header
//
// what who when
// started AR 15.06.99
//
//-------------------------------------------------------------------------
// INCLUDES
//
// #include <devioctl.h> must be declared before inclusion when used for driver
// #include <winioctl.h> must be declared before inclusion when used for applications
//-------------------------------------------------------------------------
// DEFINES
//
// to get a compatible view to WIN95 driver
#define USER_CONTROL_CODE(x) (0x800 + x)
// initialise a dedicated VMEMM hardware
#define PCIVME_INIT_HARDWARE CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(0),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// de-initialise a dedicated VMEMM hardware
#define PCIVME_DEINIT_HARDWARE CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(1),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// get a static status info from a dedicted VMEMM+PCIADA hardware
#define PCIVME_GET_STATIC_STATUS CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(4),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// get dynamically changing status from PCIADA+VMEMM
#define PCIVME_GET_DYNAMIC_STATUS CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(5),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// read a vector in case of interrupt from VMEMM or PCIADA
#define PCIVME_READ_VECTOR CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(6),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// access VIC68A registers direct
#define PCIVME_ACCESS_VIC68A CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(7),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// enable or disable interrupts from user space
#define PCIVME_CONTROL_INTERRUPTS CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(9),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// generate a (undivisible) test-and-set instruction
#define PCIVME_TAS CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(10),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// generate a reset on VME BUS for a dedicated VMEMM interface
#define PCIVME_RESET CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(12),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// set the access parameter for this file (vmemm)
#define PCIVME_SET_ACCESS_PARA CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(13),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// my last usefull control code - change each time you add a ctl_code
#define PCIVME_LAST_CTL_CODE PCIVME_SET_ACCESS_PARA
// to make standard entries for not compatible WIN95 call codes
#define PCIVME_INCOMPATIBLE CTL_CODE(\
FILE_DEVICE_UNKNOWN,\
USER_CONTROL_CODE(255),\
METHOD_BUFFERED,\
FILE_ANY_ACCESS)
// to get a compatible view to WIN95 driver
#define VPCIVMED_INIT_HARDWARE PCIVME_INIT_HARDWARE
#define VPCIVMED_DEINIT_HARDWARE PCIVME_DEINIT_HARDWARE
#define VPCIVMED_ATTACH_WINDOW PCIVME_INCOMPATIBLE // no compatibility!
#define VPCIVMED_DETACH_WINDOW PCIVME_INCOMPATIBLE // no compatibility!
#define VPCIVMED_GET_STATIC_STATUS PCIVME_GET_STATIC_STATUS
#define VPCIVMED_GET_DYNAMIC_STATUS PCIVME_GET_DYNAMIC_STATUS
#define VPCIVMED_READ_VECTOR PCIVME_READ_VECTOR
#define VPCIVMED_ACCESS_VIC68A PCIVME_ACCESS_VIC68A
#define VPCIVMED_CONTROL_INTERRUPTS PCIVME_CONTROL_INTERRUPTS
#define VPCIVMED_TAS PCIVME_TAS
#define VPCIVMED_GET_PCIADA_STATUS PCIVME_GET_PCIADA_STATUS
#define VPCIVMED_RESET PCIVME_RESET
// switches for PCIVME_(DE)INIT_HARDWARE ------------------------
#define LCR (UCHAR)0 // destination is LCR register
#define IFR (UCHAR)1 // destination is VME-Interface register
#define VIC (UCHAR)2 // destination is VIC68A register
#define STOP (UCHAR)255 // this command stops the init machine
#define BYTE_ACCESS (UCHAR)1 // write byte wise
#define WORD_ACCESS (UCHAR)2 // word
#define LONG_ACCESS (UCHAR)4 // long
// switches for PCIVME_ACCESS_VIC68A --------------------------
#define VIC68A_READ 0 // read only access
#define VIC68A_WRITE 1 // write and read back access
#define VIC68A_OR 2 // read, bitwise 'or' content and read back access
#define VIC68A_AND 3 // read, bitwise 'and' content and read back access
#define VIC68A_WRITE_ONLY 4 // do not read back after write
// switches for the PCIVME_RESET ------------------------------
#define VME_RESET_CMD 0 // raise a VME reset only
#define LOCAL_RESET_CMD 1 // raise a local reset only
#define GLOBAL_RESET_CMD 2 // raise a global reset
#define POLL_RESET_CMD 3 // ask if reset is finished
#define BOGUSADDRESS 0xFFFFFFFF // compatibilty to WIN95
#ifndef PHYSICAL_ADDRESS
#define PHYSICAL_ADDRESS LARGE_INTEGER
#endif
//-------------------------------------------------------------------------
// TYPEDEFS
//
typedef struct // one command element to initialize interface or deinitialize
{
UCHAR range; // 0 = lcr, 1 = vme-interface, -1 = stop, default = vme-if
UCHAR type; // 1 = byte access, 2 = word access, 4 = dword access, default byte
USHORT offset; // offset into interface address range for initialisation
ULONG value; // value to initialize
} PCIVME_INIT_ELEMENT;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
PCIVME_INIT_ELEMENT sVie[8]; // at least one zero element must be the last
} PCIVME_INIT_COMMAND;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
UCHAR bAddressModifier; // set the current modifier
UCHAR bAccessType; // set the current access type (1,2,4)
UCHAR bIncrement; // set the current byte increment count
ULONG dwAccessBase; // base address of seek operation (extended modifiers only, else must = 0)
} PCIVME_ACCESS_COMMAND;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
USHORT wRegisterAddress; // address offset of vic68a register
USHORT wAccessMode; // read, write, or, and
UCHAR bContent; // content to write, and, or
} PCIVME_VIC68A_ACTION;
// includes static information about driver parameters ------
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
ULONG dwLinkCount; // how often this interface is requested
USHORT wNumMemWindows; // aus der aktuellen konfiguration
USHORT wNumIOPorts;
USHORT wNumIRQs;
USHORT wNumDMAs;
USHORT wModuleType; // von der angeschlossenen hardware gelesen
USHORT wFPGAVersion;
USHORT wModuleNumber;
USHORT wWordMode;
USHORT wSysControl; // if the associated VMEMM has slot 1 function
USHORT wConnected; // is the VMEMM connected (obsolete sometimes)
PHYSICAL_ADDRESS pvLcr; // physikalische adresse des lcr
PHYSICAL_ADDRESS pvIfr; // physikalische adresse des interfaces ohne vme
ULONG dwDriverVersion; // highWord.lowWord
ULONG dwDriverVariant; // show customized variants here
} PCIVME_STATIC_STATUS;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
USHORT wVMEMM_connected; // status: VMEMM is connected and powered
USHORT wVMEMM_enable; // status: VMEMM access is enabled
USHORT wPCIADAIrq; // status: PCIADA timeout IRQ pending
USHORT wVMEMMIrq; // status: VMEMM IRQ pending
} PCIVME_DYNAMIC_STATUS;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
ULONG dwAddress; // tas to address
USHORT wModifier; // VME address modifier for this window
UCHAR bContent; // byte content to store and get back
} PCIVME_TAS_STRUCT;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
USHORT wCommand; // the appropriate reset command
} PCIVME_RESET_COMMAND;
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95
USHORT wResult;
} PCIVME_RESET_RESULT; // polling result: in progress if (wResult != 0)
typedef struct
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95..
USHORT wEnable; // a 1 enables the queue filling, a 0 disables
} PCIVME_IRQ_CONTROL;
typedef struct // to request vectors from a interface
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95..
USHORT wRequestCount; // maximum number of vectors to requests
BOOLEAN bPoll; // no blocking allowed - poll always
} PCIVME_VECTOR_REQUEST;
typedef struct // the response to the above request
{
ULONG dwInterface; // here dummy 'cause of compatibility to WIN95..
USHORT wPendingCount; // represents the number of vectors pending
USHORT wCount; // actual delivered count of vectors
BOOLEAN bOverflow; // there was a irq overflow @ this channel
UCHAR bStatusID; // base of following vector array
} PCIVME_VECTOR_RESPONSE;
#endif // __PCIVME_H__