Subversion Repositories f9daq

Rev

Rev 16 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 f9daq 1
//-------------------------------------------------------------------------------------------
2
// pcivme_ni.c - a ni labview dll skeleton for the ARW pcivme interface
3
//
4
// (c) 1999-2004 ARW Elektronik, Germany
5
//
6
// this source code is published under GPL (Open Source). You can use, redistrubute and 
7
// modify it unless this header  is  not modified or deleted. No warranty is given that 
8
// this software will work like expected.
9
// This product is not authorized for use as critical component in life support systems
10
// wihout the express written approval of ARW Elektronik Germany.
11
//
12
// Please announce changes and hints to ARW Elektronik
13
// 
14
//
15
// $Log: pcivme_ni.c,v $
16
// Revision 1.2  2004/07/24 07:47:00  klaus
17
// Update copyright to 2004
18
//
19
// Revision 1.1.1.1  2003/11/14 23:17:18  klaus
20
// First put into repository
21
//
22
// Revision 1.2  2002/10/27 17:05:33  klaus
23
// CVS log added, file addressing bug > 2 Gbtye circumvent
24
//
25
// what                                                              who    when
26
// first steps                                                       AR     07.11.1999
27
//
28
 
29
//-------------------------------------------------------------------------------------------
30
// INCLUDES
31
//
32
#include <windows.h>
33
#include <os_info.h>
34
#include <pcivme_ni_NT.h>
35
#include <pcivme_ni.h>
36
 
37
//-------------------------------------------------------------------------------------------
38
// DEFINES
39
//
40
 
41
//-------------------------------------------------------------------------------------------
42
// TYPEDEFS
43
//
44
typedef struct
45
{
46
        int (*VMEinit)(const char *cszDeviceName, unsigned short nVMEMM, unsigned char ubAddressModifier, int *pnHandle);
47
        int (*VMEread)(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer);
48
        int (*VMEwrite)(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer);
49
        int (*VMEaccessVIC)(int Handle, unsigned char ubAccessMode, unsigned short uwAddress, unsigned char *ubContent);
50
        int (*VMEreset)(int Handle);
51
        int (*VMETAS)(int Handle, unsigned long ulAddress, unsigned char *ubResult);
52
        int (*VMEinterrupt)(int Handle, unsigned char *ubVector);
53
        int (*VMEsysfailGet)(int nHandle, BOOLEAN *bResult);
54
        int (*VMEsysfailSet)(int nHandle, BOOLEAN bForce);
55
        int (*VMEclose)(int nHandle);
56
} MY_ACTIONS;
57
 
58
//-------------------------------------------------------------------------------------------
59
// LOCALS
60
//
61
static MY_ACTIONS ma;  // the selected actions
62
static BOOLEAN firstTime = TRUE;
63
 
64
//-------------------------------------------------------------------------------------------
65
// EXTERNALS
66
//
67
 
68
//-------------------------------------------------------------------------------------------
69
// GLOBALS
70
//
71
 
72
//-------------------------------------------------------------------------------------------
73
// FUNCTIONS
74
//
75
int __declspec(dllexport) VMEinit(const char *cszDeviceName, unsigned short nVMEMM, unsigned char ubAddressModifier, int *pnHandle)
76
{
77
        if (firstTime)
78
        {
79
                if (IsWindowsNT())
80
                {
81
                        ma.VMEinit               = VMEinitNT;
82
                        ma.VMEread               = VMEreadNT;
83
                        ma.VMEwrite              = VMEwriteNT;
84
                        ma.VMEaccessVIC  = VMEaccessVICNT;
85
                        ma.VMEreset              = VMEresetNT;
86
                        ma.VMETAS                = VMETASNT;
87
                        ma.VMEinterrupt  = VMEinterruptNT;
88
                        ma.VMEsysfailGet = VMEsysfailGetNT;
89
                        ma.VMEsysfailSet = VMEsysfailSetNT;
90
                        ma.VMEclose              = VMEcloseNT;
91
                }
92
 
93
                        else
94
                                return -1;
95
 
96
                firstTime = FALSE;
97
        }
98
 
99
        return ma.VMEinit(cszDeviceName, nVMEMM, ubAddressModifier, pnHandle);
100
}
101
 
102
int __declspec(dllexport) VMEread(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer)
103
{
104
        return ma.VMEread(nHandle, ulAddress, ubAccessWidth, ulElementCount, pvBuffer);
105
}      
106
 
107
int __declspec(dllexport) VMEwrite(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer)
108
{
109
        return ma.VMEwrite(nHandle, ulAddress, ubAccessWidth, ulElementCount, pvBuffer);
110
}
111
 
112
int __declspec(dllexport) VMEaccessVIC(int nHandle, unsigned char ubAccessMode, unsigned short uwAddress, unsigned char *ubContent)
113
{
114
        return ma.VMEaccessVIC(nHandle, ubAccessMode, uwAddress, ubContent);
115
}
116
 
117
int __declspec(dllexport) VMEreset(int nHandle)
118
{
119
        return ma.VMEreset(nHandle);
120
}
121
 
122
int __declspec(dllexport) VMETAS(int nHandle, unsigned long ulAddress, unsigned char *ubResult)
123
{
124
        return ma.VMETAS(nHandle, ulAddress, ubResult);
125
}
126
 
127
int __declspec(dllexport) VMEsysfailGet(int nHandle, BOOLEAN *bResult)
128
{
129
        return ma.VMEsysfailGet(nHandle, bResult);
130
}
131
 
132
int __declspec(dllexport) VMEsysfailSet(int nHandle, BOOLEAN bForce)
133
{
134
        return ma.VMEsysfailSet(nHandle, bForce);
135
}
136
 
137
int __declspec(dllexport) VMEinterrupt(int nHandle, unsigned char *ubVector)
138
{
139
        return ma.VMEinterrupt(nHandle, ubVector);
140
}
141
 
142
int __declspec(dllexport) VMEclose(int nHandle)
143
{
144
        return ma.VMEclose(nHandle);
145
}