AlcapDAQ
1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
CAEN
CAENComm
include
CAENComm.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* CAEN SpA - Software Division
4
* Via Vetraia, 11 - 55049 - Viareggio ITALY
5
* +390594388398 - www.caen.it
6
*
7
***************************************************************************/
20
#ifndef __CAENCOMMLIB_H
21
#define __CAENCOMMLIB_H
22
23
#ifdef _WIN32
24
#include <windows.h>
25
#else
26
#include <sys/time.h>
27
#include <sys/types.h>
28
#include <unistd.h>
29
#include <stdint.h>
30
#endif
31
32
33
#ifdef _WIN32
34
#define STDCALL __stdcall
35
#else
36
#define STDCALL
37
#endif
38
39
40
/*###########################################################################*/
41
/*
42
** DEFINITIONS
43
*/
44
/*###########################################################################*/
45
/* variable types */
46
#ifdef _WIN32
47
#ifndef int8_t
48
#define int8_t INT8
49
#endif
50
#ifndef int16_t
51
#define int16_t INT16
52
#endif
53
#ifndef int32_t
54
#define int32_t INT32
55
#endif
56
#ifndef int64_t
57
#define int64_t INT64
58
#endif
59
#ifndef uint8_t
60
#define uint8_t UINT8
61
#endif
62
#ifndef uint16_t
63
#define uint16_t UINT16
64
#endif
65
#ifndef uint32_t
66
#define uint32_t UINT32
67
#endif
68
#ifndef uint64_t
69
#define uint64_t UINT64
70
#endif
71
#endif
72
73
74
/* Link Types */
75
typedef
enum
CAEN_Comm_ConnectionType
{
76
CAENComm_USB
= 0,
77
CAENComm_PCI_OpticalLink
= 1,
78
CAENComm_PCIE_OpticalLink
= 2,
79
CAENComm_PCIE
= 3,
80
}
CAENComm_ConnectionType
;
81
82
typedef
enum
CAENComm_ErrorCode
{
83
/* Error Types */
84
CAENComm_Success
= 0,
/* Operation completed successfully */
85
CAENComm_VMEBusError
= -1,
/* VME bus error during the cycle */
86
CAENComm_CommError
= -2,
/* Communication error */
87
CAENComm_GenericError
= -3,
/* Unspecified error */
88
CAENComm_InvalidParam
= -4,
/* Invalid parameter */
89
CAENComm_InvalidLinkType
= -5,
/* Invalid Link Type */
90
CAENComm_InvalidHandler
= -6,
/* Invalid device handler */
91
CAENComm_CommTimeout
= -7,
/* Communication Timeout */
92
CAENComm_DeviceNotFound
= -8,
/* Unable to Open the requested Device */
93
CAENComm_MaxDevicesError
= -9,
/* Maximum number of devices exceeded */
94
CAENComm_DeviceAlreadyOpen
= -10,
/* The device is already opened */
95
CAENComm_NotSupported
= -11,
/* Not supported function */
96
CAENComm_UnusedBridge
= -12,
/* There aren't board controlled by that CAEN Bridge */
97
CAENComm_Terminated
= -13,
/* Communication terminated by the Device */
98
}
CAENComm_ErrorCode
;
99
100
typedef
enum
CAENCOMM_INFO
{
101
CAENComm_PCI_Board_SN
= 0,
/* s/n of the PCI/PCIe board */
102
CAENComm_PCI_Board_FwRel
= 1,
/* Firmware Release fo the PCI/PCIe board */
103
CAENComm_VME_Bridge_SN
= 2,
/* s/n of the VME bridge */
104
CAENComm_VME_Bridge_FwRel1
= 3,
/* Firmware Release for the VME bridge */
105
CAENComm_VME_Bridge_FwRel2
= 4,
/* Firmware Release for the optical chipset inside the VME bridge (V2718 only)*/
106
}
CAENCOMM_INFO
;
107
108
109
typedef
enum
IRQLevels
{
110
IRQ1
= 0x01,
/* Interrupt level 1 */
111
IRQ2
= 0x02,
/* Interrupt level 2 */
112
IRQ3
= 0x04,
/* Interrupt level 3 */
113
IRQ4
= 0x08,
/* Interrupt level 4 */
114
IRQ5
= 0x10,
/* Interrupt level 5 */
115
IRQ6
= 0x20,
/* Interrupt level 6 */
116
IRQ7
= 0x40
/* Interrupt level 7 */
117
}
IRQLevels
;
118
119
120
/*##########################################################################*/
121
/*
122
** COMMUNICATION LAYER
123
*/
124
/*##########################################################################*/
125
126
/**************************************************************************/
134
CAENComm_ErrorCode
STDCALL
CAENComm_DecodeError
(
int
ErrCode,
char
*ErrMsg);
135
136
137
/**************************************************************************/
148
CAENComm_ErrorCode
STDCALL
CAENComm_OpenDevice
(
CAENComm_ConnectionType
LinkType,
int
LinkNum,
int
ConetNode, uint32_t VMEBaseAddress,
int
*
handle
);
149
150
151
/**************************************************************************/
158
CAENComm_ErrorCode
STDCALL
CAENComm_CloseDevice
(
int
handle
);
159
160
161
/**************************************************************************/
170
CAENComm_ErrorCode
STDCALL
CAENComm_Write32
(
int
handle
, uint32_t Address, uint32_t Data);
171
172
173
/**************************************************************************/
182
CAENComm_ErrorCode
STDCALL
CAENComm_Write16
(
int
handle
, uint32_t Address, uint16_t Data);
183
184
185
/**************************************************************************/
194
CAENComm_ErrorCode
STDCALL
CAENComm_Read32
(
int
handle
, uint32_t Address, uint32_t *Data);
195
196
197
/**************************************************************************/
206
CAENComm_ErrorCode
STDCALL
CAENComm_Read16
(
int
handle
, uint32_t Address, uint16_t *Data);
207
208
209
/**************************************************************************/
220
CAENComm_ErrorCode
STDCALL
CAENComm_MultiRead32
(
int
handle
, uint32_t *Address,
int
nCycles, uint32_t *data,
CAENComm_ErrorCode
*ErrorCode);
221
222
223
/**************************************************************************/
234
CAENComm_ErrorCode
STDCALL
CAENComm_MultiRead16
(
int
handle
, uint32_t *Address,
int
nCycles, uint16_t *data,
CAENComm_ErrorCode
*ErrorCode);
235
236
237
/**************************************************************************/
248
CAENComm_ErrorCode
STDCALL
CAENComm_MultiWrite16
(
int
handle
, uint32_t *Address,
int
nCycles, uint16_t *data,
CAENComm_ErrorCode
*ErrorCode);
249
250
251
/**************************************************************************/
262
CAENComm_ErrorCode
STDCALL
CAENComm_MultiWrite32
(
int
handle
, uint32_t *Address,
int
nCycles, uint32_t *data,
CAENComm_ErrorCode
*ErrorCode);
263
264
265
/**************************************************************************/
276
CAENComm_ErrorCode
STDCALL
CAENComm_BLTRead
(
int
handle
, uint32_t Address, uint32_t *Buff,
int
BltSize,
int
*nw);
277
278
279
/**************************************************************************/
290
CAENComm_ErrorCode
STDCALL
CAENComm_MBLTRead
(
int
handle
, uint32_t Address, uint32_t *Buff,
int
BltSize,
int
*nw);
291
292
293
/**************************************************************************/
301
CAENComm_ErrorCode
STDCALL
CAENComm_VMEIRQCheck
(
int
VMEhandle, uint8_t *Mask);
302
303
304
/**************************************************************************/
311
CAENComm_ErrorCode
STDCALL
CAENComm_IRQDisable
(
int
handle
);
312
313
/**************************************************************************/
320
CAENComm_ErrorCode
STDCALL
CAENComm_IRQEnable
(
int
handle
);
321
322
323
/**************************************************************************/
332
CAENComm_ErrorCode
STDCALL
CAENComm_VMEIACKCycle16
(
int
VMEhandle,
IRQLevels
Level,
int
*BoardID);
333
334
335
/**************************************************************************/
344
CAENComm_ErrorCode
STDCALL
CAENComm_VMEIACKCycle32
(
int
VMEhandle,
IRQLevels
Level,
int
*BoardID);
345
346
347
/**************************************************************************/
356
CAENComm_ErrorCode
STDCALL
CAENComm_IACKCycle
(
int
handle
,
IRQLevels
Level,
int
*BoardID);
357
358
/**************************************************************************/
367
CAENComm_ErrorCode
STDCALL
CAENComm_IRQWait
(
int
handle
, uint32_t Timeout);
368
369
/**************************************************************************/
381
CAENComm_ErrorCode
STDCALL
CAENComm_VMEIRQWait
(
CAENComm_ConnectionType
LinkType,
int
LinkNum,
int
ConetNode, uint8_t IRQMask, uint32_t Timeout,
int
*VMEHandle);
382
383
/**************************************************************************/
392
CAENComm_ErrorCode
STDCALL
CAENComm_Info
(
int
handle
,
CAENCOMM_INFO
info,
char
*data);
393
394
395
/**************************************************************************/
402
CAENComm_ErrorCode
STDCALL
CAENComm_SWRelease
(
char
*SwRel);
403
#endif
Generated by
1.8.4