AlcapDAQ
1
|
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | STDCALL |
Typedefs | |
typedef enum CAEN_Comm_ConnectionType | CAENComm_ConnectionType |
typedef enum CAENComm_ErrorCode | CAENComm_ErrorCode |
typedef enum CAENCOMM_INFO | CAENCOMM_INFO |
typedef enum IRQLevels | IRQLevels |
Enumerations | |
enum | CAEN_Comm_ConnectionType { CAENComm_USB = 0, CAENComm_PCI_OpticalLink = 1, CAENComm_PCIE_OpticalLink = 2, CAENComm_PCIE = 3 } |
enum | CAENComm_ErrorCode { CAENComm_Success = 0, CAENComm_VMEBusError = -1, CAENComm_CommError = -2, CAENComm_GenericError = -3, CAENComm_InvalidParam = -4, CAENComm_InvalidLinkType = -5, CAENComm_InvalidHandler = -6, CAENComm_CommTimeout = -7, CAENComm_DeviceNotFound = -8, CAENComm_MaxDevicesError = -9, CAENComm_DeviceAlreadyOpen = -10, CAENComm_NotSupported = -11, CAENComm_UnusedBridge = -12, CAENComm_Terminated = -13 } |
enum | CAENCOMM_INFO { CAENComm_PCI_Board_SN = 0, CAENComm_PCI_Board_FwRel = 1, CAENComm_VME_Bridge_SN = 2, CAENComm_VME_Bridge_FwRel1 = 3, CAENComm_VME_Bridge_FwRel2 = 4 } |
enum | IRQLevels { IRQ1 = 0x01, IRQ2 = 0x02, IRQ3 = 0x04, IRQ4 = 0x08, IRQ5 = 0x10, IRQ6 = 0x20, IRQ7 = 0x40 } |
Functions | |
CAENComm_ErrorCode STDCALL | CAENComm_DecodeError (int ErrCode, char *ErrMsg) |
Decode error code. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_OpenDevice (CAENComm_ConnectionType LinkType, int LinkNum, int ConetNode, uint32_t VMEBaseAddress, int *handle) |
CAENComm_ErrorCode STDCALL | CAENComm_CloseDevice (int handle) |
Close the device. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_Write32 (int handle, uint32_t Address, uint32_t Data) |
CAENComm_ErrorCode STDCALL | CAENComm_Write16 (int handle, uint32_t Address, uint16_t Data) |
CAENComm_ErrorCode STDCALL | CAENComm_Read32 (int handle, uint32_t Address, uint32_t *Data) |
Read a 32 bit data from the specified register. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_Read16 (int handle, uint32_t Address, uint16_t *Data) |
Read a 16 bit data from the specified register. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_MultiRead32 (int handle, uint32_t *Address, int nCycles, uint32_t *data, CAENComm_ErrorCode *ErrorCode) |
CAENComm_ErrorCode STDCALL | CAENComm_MultiRead16 (int handle, uint32_t *Address, int nCycles, uint16_t *data, CAENComm_ErrorCode *ErrorCode) |
CAENComm_ErrorCode STDCALL | CAENComm_MultiWrite16 (int handle, uint32_t *Address, int nCycles, uint16_t *data, CAENComm_ErrorCode *ErrorCode) |
CAENComm_ErrorCode STDCALL | CAENComm_MultiWrite32 (int handle, uint32_t *Address, int nCycles, uint32_t *data, CAENComm_ErrorCode *ErrorCode) |
The function performs a block of single 16bit WriteRegister. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_BLTRead (int handle, uint32_t Address, uint32_t *Buff, int BltSize, int *nw) |
Read a block of data from the device using a BLT (32 bit) cycle. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_MBLTRead (int handle, uint32_t Address, uint32_t *Buff, int BltSize, int *nw) |
Read a block of data from the device using an MBLT (64 bit) cycle. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_VMEIRQCheck (int VMEhandle, uint8_t *Mask) |
The function returns a bit mask indicating the active VME IRQ lines. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_IRQDisable (int handle) |
The function disables the IRQ lines. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_IRQEnable (int handle) |
The function enaables the IRQ lines. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_VMEIACKCycle16 (int VMEhandle, IRQLevels Level, int *BoardID) |
The function performs a 16 bit VME interrupt acknowledge cycle . More... | |
CAENComm_ErrorCode STDCALL | CAENComm_VMEIACKCycle32 (int VMEhandle, IRQLevels Level, int *BoardID) |
The function performs a 32 bit VME interrupt acknowledge cycle. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_IACKCycle (int handle, IRQLevels Level, int *BoardID) |
The function performs a 16 bit VME interrupt acknowledge cycle . More... | |
CAENComm_ErrorCode STDCALL | CAENComm_IRQWait (int handle, uint32_t Timeout) |
The function wait the IRQ until one of them raise or timeout expires. This function can be used ONLY on board NOT controlled by CAEN VME Bridges. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_VMEIRQWait (CAENComm_ConnectionType LinkType, int LinkNum, int ConetNode, uint8_t IRQMask, uint32_t Timeout, int *VMEHandle) |
CAENComm_ErrorCode STDCALL | CAENComm_Info (int handle, CAENCOMM_INFO info, char *data) |
The function returns information about serial number or firmware release of the device. More... | |
CAENComm_ErrorCode STDCALL | CAENComm_SWRelease (char *SwRel) |
Returns the Software Release of the library. More... | |
#define STDCALL |
Name CAENComm.h Project CAENComm - Communication Layer Authors Carlo Tintori & Alberto Lucchesi (suppo) Version 1.0 Date 2009/09/23 rt.c omput ing@ caen. it
This library provides the low level functions for the access to the devices. By default, this library is based on the CAENVMElib (CAEN VME bridges V1718 and V2718) and the CAENVMElink (USB and CONET).
Definition at line 36 of file CAENComm.h.
typedef enum CAEN_Comm_ConnectionType CAENComm_ConnectionType |
typedef enum CAENComm_ErrorCode CAENComm_ErrorCode |
typedef enum CAENCOMM_INFO CAENCOMM_INFO |
Enumerator | |
---|---|
CAENComm_USB | |
CAENComm_PCI_OpticalLink | |
CAENComm_PCIE_OpticalLink | |
CAENComm_PCIE |
Definition at line 75 of file CAENComm.h.
enum CAENComm_ErrorCode |
Definition at line 82 of file CAENComm.h.
enum CAENCOMM_INFO |
Enumerator | |
---|---|
CAENComm_PCI_Board_SN | |
CAENComm_PCI_Board_FwRel | |
CAENComm_VME_Bridge_SN | |
CAENComm_VME_Bridge_FwRel1 | |
CAENComm_VME_Bridge_FwRel2 |
Definition at line 100 of file CAENComm.h.
enum IRQLevels |
CAENComm_ErrorCode STDCALL CAENComm_BLTRead | ( | int | handle, |
uint32_t | Address, | ||
uint32_t * | Buff, | ||
int | BltSize, | ||
int * | nw | ||
) |
Read a block of data from the device using a BLT (32 bit) cycle.
[IN] | handle: device handler |
[IN] | Address: data space starting address |
[IN] | BltSize: size of the Block Read Cycle (in bytes) |
[OUT] | buff: pointer to the data buffer |
[OUT] | nw: number of longwords (32 bit) actually read from the device |
CAENComm_ErrorCode STDCALL CAENComm_CloseDevice | ( | int | handle) |
Close the device.
[IN] | handle: device handler |
Referenced by cvUpgrade(), GetFWRel(), KeyInfo(), License(), and WriteKey().
void CAENComm_DecodeError | ( | int | ErrCode, |
char * | ErrMsg | ||
) |
Decode error code.
[IN] | ErrCode: Error code |
[OUT] | ErrMsg: string with the error message |
CAENComm_ErrorCode STDCALL CAENComm_IACKCycle | ( | int | handle, |
IRQLevels | Level, | ||
int * | BoardID | ||
) |
The function performs a 16 bit VME interrupt acknowledge cycle .
[IN] | handle: device handler |
[IN] | Level: The VME IRQ level to acknowledge (see IRQLevels enum). |
[OUT] | BoardID: the Id of the Board that reased the interrupt. |
CAENComm_ErrorCode STDCALL CAENComm_Info | ( | int | handle, |
CAENCOMM_INFO | info, | ||
char * | data | ||
) |
The function returns information about serial number or firmware release of the device.
[IN] | handle: device handler |
[IN] | info: The interested info (see CAENCOMM_INFO enum). |
[OUT] | data: an array (user defined to 30 byte) with the requested info |
CAENComm_ErrorCode STDCALL CAENComm_IRQDisable | ( | int | handle) |
The function disables the IRQ lines.
[IN] | handle: device handler |
CAENComm_ErrorCode STDCALL CAENComm_IRQEnable | ( | int | handle) |
The function enaables the IRQ lines.
[IN] | handle: device handler |
CAENComm_ErrorCode STDCALL CAENComm_IRQWait | ( | int | handle, |
uint32_t | Timeout | ||
) |
The function wait the IRQ until one of them raise or timeout expires. This function can be used ONLY on board NOT controlled by CAEN VME Bridges.
[IN] | handle: device handler |
[IN] | Timeout: Timeout in milliseconds. |
CAENComm_ErrorCode STDCALL CAENComm_MBLTRead | ( | int | handle, |
uint32_t | Address, | ||
uint32_t * | Buff, | ||
int | BltSize, | ||
int * | nw | ||
) |
Read a block of data from the device using an MBLT (64 bit) cycle.
[IN] | handle: device handler |
[IN] | Address: data space starting address |
[IN] | BltSize: size of the Block Read Cycle (in bytes) |
[OUT] | buff: pointer to the data buffer |
[OUT] | nw: number of longwords (32 bit) actually read from the device |
CAENComm_ErrorCode STDCALL CAENComm_MultiRead16 | ( | int | handle, |
uint32_t * | Address, | ||
int | nCycles, | ||
uint16_t * | data, | ||
CAENComm_ErrorCode * | ErrorCode | ||
) |
Referenced by ReadFlashPage16().
CAENComm_ErrorCode STDCALL CAENComm_MultiRead32 | ( | int | handle, |
uint32_t * | Address, | ||
int | nCycles, | ||
uint32_t * | data, | ||
CAENComm_ErrorCode * | ErrorCode | ||
) |
Referenced by read_flash_page(), and ReadFlashPage32().
CAENComm_ErrorCode STDCALL CAENComm_MultiWrite16 | ( | int | handle, |
uint32_t * | Address, | ||
int | nCycles, | ||
uint16_t * | data, | ||
CAENComm_ErrorCode * | ErrorCode | ||
) |
Referenced by ReadFlashPage16(), and WriteFlashPage16().
CAENComm_ErrorCode STDCALL CAENComm_MultiWrite32 | ( | int | handle, |
uint32_t * | Address, | ||
int | nCycles, | ||
uint32_t * | data, | ||
CAENComm_ErrorCode * | ErrorCode | ||
) |
The function performs a block of single 16bit WriteRegister.
[IN] | handle: device handler |
[IN] | Address: register address offsets |
[IN] | nCycles: the number of read to perform |
[IN] | data: The datas to write to the device |
[OUT] | ErrorCode: The error codes relaive to each cycle. |
Referenced by ReadFlashPage32(), and WriteFlashPage32().
CAENComm_ErrorCode STDCALL CAENComm_OpenDevice | ( | CAENComm_ConnectionType | LinkType, |
int | LinkNum, | ||
int | ConetNode, | ||
uint32_t | VMEBaseAddress, | ||
int * | handle | ||
) |
Referenced by cvUpgrade(), GetFWRel(), KeyInfo(), License(), and WriteKey().
CAENComm_ErrorCode STDCALL CAENComm_Read16 | ( | int | handle, |
uint32_t | Address, | ||
uint16_t * | Data | ||
) |
Read a 16 bit data from the specified register.
[IN] | handle: device handler |
[IN] | Address: register address offset |
[OUT] | Data: The data read from the device |
Referenced by GetFlashStatus16(), GetFWRel(), read_flash_page(), ReadFlashSecurityReg16(), and validateModel().
CAENComm_ErrorCode STDCALL CAENComm_Read32 | ( | int | handle, |
uint32_t | Address, | ||
uint32_t * | Data | ||
) |
Read a 32 bit data from the specified register.
[IN] | handle: device handler |
[IN] | Address: register address offset |
[OUT] | Data: The data read from the device |
Referenced by GetFlashStatus32(), GetFWRel(), ReadFlashSecurityReg32(), and validateModel().
CAENComm_ErrorCode STDCALL CAENComm_SWRelease | ( | char * | SwRel) |
Returns the Software Release of the library.
[OUT] | SwRel: the Software Release of the library |
CAENComm_ErrorCode STDCALL CAENComm_VMEIACKCycle16 | ( | int | VMEhandle, |
IRQLevels | Level, | ||
int * | BoardID | ||
) |
The function performs a 16 bit VME interrupt acknowledge cycle .
[IN] | handle: device handler |
[IN] | Level: The VME IRQ level to acknowledge (see IRQLevels enum). |
[OUT] | BoardID: the Id of the Board that reased the interrupt. |
CAENComm_ErrorCode STDCALL CAENComm_VMEIACKCycle32 | ( | int | VMEhandle, |
IRQLevels | Level, | ||
int * | BoardID | ||
) |
The function performs a 32 bit VME interrupt acknowledge cycle.
[IN] | handle: device handler |
[IN] | Level: The VME IRQ level to acknowledge (see IRQLevels enum). |
[OUT] | BoardID: the Id of the Board that reased the interrupt. |
CAENComm_ErrorCode STDCALL CAENComm_VMEIRQCheck | ( | int | handle, |
uint8_t * | Mask | ||
) |
The function returns a bit mask indicating the active VME IRQ lines.
[IN] | handle: device handler |
[OUT] | Mask: A bit-mask indicating the VME IRQ lines. |
CAENComm_ErrorCode STDCALL CAENComm_VMEIRQWait | ( | CAENComm_ConnectionType | LinkType, |
int | LinkNum, | ||
int | ConetNode, | ||
uint8_t | IRQMask, | ||
uint32_t | Timeout, | ||
int * | VMEHandle | ||
) |
CAENComm_ErrorCode STDCALL CAENComm_Write16 | ( | int | handle, |
uint32_t | Address, | ||
uint16_t | Data | ||
) |
Referenced by GetFlashStatus16(), read_flash_page(), ReadFlashPage16(), ReadFlashSecurityReg16(), and WriteFlashPage16().
CAENComm_ErrorCode STDCALL CAENComm_Write32 | ( | int | handle, |
uint32_t | Address, | ||
uint32_t | Data | ||
) |
Referenced by GetFlashStatus32(), ReadFlashPage32(), ReadFlashSecurityReg32(), and WriteFlashPage32().