AlcapDAQ  1
CAENVMElib.h
Go to the documentation of this file.
1 
16 #ifndef __CAENVMELIB_H
17 #define __CAENVMELIB_H
18 
19 #include <stdio.h>
20 // Rev. 2.5
21 #ifdef LINUX
22  #include <stdint.h>
23 #endif
24 #include <stdlib.h>
25 #include <malloc.h>
26 #include "CAENVMEoslib.h"
27 #include "CAENVMEtypes.h"
28 
29 #ifdef WIN32
30  typedef INT8 int8_t;
31  typedef UINT8 uint8_t;
32  typedef INT16 int16_t;
33  typedef UINT16 uint16_t;
34  typedef INT32 int32_t;
35  typedef UINT32 uint32_t;
36  typedef INT64 int64_t;
37  typedef UINT64 uint64_t;
38 #endif
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif // __cplusplus
43 /*
44  CAENVME_DecodeError
45  -----------------------------------------------------------------------------
46  Parameters:
47  [in] Code : The error code to decode.
48  -----------------------------------------------------------------------------
49  Returns:
50  An string describing the error condition.
51  -----------------------------------------------------------------------------
52  Description:
53  Decode the error.
54 */
55 const char *
56 #ifdef WIN32
57 __stdcall
58 #endif
60 
61 /*
62  CAENVME_API CAENVME_SWRelease
63  -----------------------------------------------------------------------------
64  Parameters:
65  [out] SwRel : Returns the software release of the library.
66  -----------------------------------------------------------------------------
67  Returns:
68  An error code about the execution of the function.
69  -----------------------------------------------------------------------------
70  Description:
71  Permits to read the software release of the library.
72 */
74 CAENVME_SWRelease(char *SwRel);
75 
76 /*
77  CAENVME_BoardFWRelease.
78  -----------------------------------------------------------------------------
79  Parameters:
80  [in] Handle : The handle that identifies the device.
81  [out] FWRel : Returns the firmware release of the device.
82  -----------------------------------------------------------------------------
83  Returns:
84  An error code about the execution of the function.
85  -----------------------------------------------------------------------------
86  Description:
87  Permits to read the firmware release loaded into the device.
88 */
90 CAENVME_BoardFWRelease(int32_t Handle, char *FWRel);
91 
92 /*
93  CAENVME_DriverRelease.
94  -----------------------------------------------------------------------------
95  Parameters:
96  [in] Handle : The handle that identifies the device.
97  [out] Rel : Returns the software release of the device driver
98  -----------------------------------------------------------------------------
99  Returns:
100  An error code about the execution of the function.
101  -----------------------------------------------------------------------------
102  Description:
103  Permits to read the software release of the device driver.
104 */
106 CAENVME_DriverRelease(int32_t Handle, char *Rel);
107 
108 /*
109  CAENVME_DeviceReset
110  -----------------------------------------------------------------------------
111  Parameters:
112  [in] Handle : The handle that identifies the device.
113  -----------------------------------------------------------------------------
114  Returns:
115  An error code about the execution of the function.
116  -----------------------------------------------------------------------------
117  Description:
118  Permits to reset the device.
119  Implemented for A2818, A2719, V2718 on Linux platform only
120 */
122 CAENVME_DeviceReset(int32_t dev);
123 
124 
125 /*
126  CAENVME_Init
127  -----------------------------------------------------------------------------
128  Parameters:
129  [in] BdType : The model of the bridge (V1718/V2718).
130  [in] Link : The link number (don't care for V1718).
131  [in] BdNum : The board number in the link.
132  [out] Handle : The handle that identifies the device.
133  -----------------------------------------------------------------------------
134  Returns:
135  An error code about the execution of the function.
136  -----------------------------------------------------------------------------
137  Description:
138  The function generates an opaque handle to identify a module
139  attached to the PC. In the case of V1718 bridge it must be
140  specified only the module index (BdNum) because the link is USB.
141  In the case of V2718 it must be specified also the link because
142  you can have some A2818 optical link inside the PC.
143 */
145 CAENVME_Init(CVBoardTypes BdType, short Link, short BdNum, int32_t *Handle);
146 
147 /*
148  CAENVME_End
149  -----------------------------------------------------------------------------
150  Parameters:
151  [in] Handle : The handle that identifies the device.
152  -----------------------------------------------------------------------------
153  Returns:
154  An error code about the execution of the function.
155  -----------------------------------------------------------------------------
156  Description:
157  Notifies the library the end of work and free the allocated
158  resources.
159 */
161 CAENVME_End(int32_t Handle);
162 
163 /*
164  CAENVME_ReadCycle
165  -----------------------------------------------------------------------------
166  Parameters:
167  [in] Handle : The handle that identifies the device.
168  [in] Address : The VME bus address.
169  [out] Data : The data read from the VME bus.
170  [in] AM : The address modifier (see CVAddressModifier enum).
171  [in] DW : The data width.(see CVDataWidth enum).
172  -----------------------------------------------------------------------------
173  Returns:
174  An error code about the execution of the function.
175  -----------------------------------------------------------------------------
176  Description:
177  The function performs a single VME read cycle.
178 */
180 CAENVME_ReadCycle(int32_t Handle, uint32_t Address, void *Data,
182 
183 /*
184  CAENVME_RMWCycle
185  -----------------------------------------------------------------------------
186  Parameters:
187  [in] Handle : The handle that identifies the device.
188  [in] Address: The VME bus address.
189  [in/out] Data : The data read and then written to the VME bus.
190  [in] AM : The address modifier (see CVAddressModifier enum).
191  [in] DW : The data width.(see CVDataWidth enum).
192  -----------------------------------------------------------------------------
193  Returns:
194  An error code about the execution of the function.
195  -----------------------------------------------------------------------------
196  Description:
197  The function performs a Read-Modify-Write cycle. The Data parameter
198  is bidirectional: it is used to write the value to the VME bus and to
199  return the value read.
200 */
202 CAENVME_RMWCycle(int32_t Handle, uint32_t Address, void *Data,
204 
205 /*
206  CAENVME_WriteCycle
207  -----------------------------------------------------------------------------
208  Parameters:
209  [in] Handle : The handle that identifies the device.
210  [in] Address : The VME bus address.
211  [in] Data : The data written to the VME bus.
212  [in] AM : The address modifier (see CVAddressModifier enum).
213  [in] DW : The data width.(see CVDataWidth enum).
214  -----------------------------------------------------------------------------
215  Returns:
216  An error code about the execution of the function.
217  -----------------------------------------------------------------------------
218  Description:
219  The function performs a single VME write cycle.
220 */
222 CAENVME_WriteCycle(int32_t Handle, uint32_t Address, void *Data,
224 
225 /*
226  CAENVME_MultiRead (Ver. 2.2)
227  -----------------------------------------------------------------------------
228  Parameters:
229  [in] Handle : The handle that identifies the device.
230  [in] Addrs : The VME bus addresses.
231  [out] Buffer : The data read from the VME bus.
232  [in] NCycles : The number of read cycles to perform.
233  [in] AMs : The address modifiers (see CVAddressModifier enum).
234  [in] DWs : The data widths.(see CVDataWidth enum).
235  [out] ECs : The error codes relaive to each cycle.
236  -----------------------------------------------------------------------------
237  Returns:
238  An error code about the execution of the function.
239  -----------------------------------------------------------------------------
240  Description:
241  The function performs a block of single VME read cycles.
242 */
244 CAENVME_MultiRead(int32_t Handle, uint32_t *Addrs, uint32_t *Buffer,
245  int NCycles, CVAddressModifier *AMs, CVDataWidth *DWs, CVErrorCodes *ECs);
246 
247 /*
248  CAENVME_MultiWrite (Ver. 2.2)
249  -----------------------------------------------------------------------------
250  Parameters:
251  [in] Handle : The handle that identifies the device.
252  [in] Addrs : The VME bus addresses.
253  [in] Buffer : The data to write to the VME bus.
254  [in] NCycles : The number of read cycles to perform.
255  [in] AMs : The address modifiers (see CVAddressModifier enum).
256  [in] DWs : The data widths.(see CVDataWidth enum).
257  [out] ECs : The error codes relaive to each cycle.
258  -----------------------------------------------------------------------------
259  Returns:
260  An error code about the execution of the function.
261  -----------------------------------------------------------------------------
262  Description:
263  The function performs a block of single VME write cycles.
264 */
266 CAENVME_MultiWrite(int32_t Handle, uint32_t *Addrs, uint32_t *Buffer,
267  int NCycles, CVAddressModifier *AMs, CVDataWidth *DWs, CVErrorCodes *ECs);
268 
269 /*
270  CAENVME_BLTReadCycle
271  -----------------------------------------------------------------------------
272  Parameters:
273  [in] Handle : The handle that identifies the device.
274  [in] Address : The VME bus address.
275  [out] Buffer : The data read from the VME bus.
276  [in] Size : The size of the transfer in bytes.
277  [in] AM : The address modifier (see CVAddressModifier enum).
278  [in] DW : The data width.(see CVDataWidth enum).
279  [out] count : The number of bytes transferred.
280  -----------------------------------------------------------------------------
281  Returns:
282  An error code about the execution of the function.
283  -----------------------------------------------------------------------------
284  Description:
285  The function performs a VME block transfer read cycle. It can be used to
286  perform MBLT transfers using 64 bit data width.
287 */
289 CAENVME_BLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
290  int Size, CVAddressModifier AM, CVDataWidth DW, int *count);
291 
292 /*
293  Ver. 2.3 - New function
294 
295  CAENVME_FIFOBLTReadCycle
296  -----------------------------------------------------------------------------
297  Parameters:
298  [in] Handle : The handle that identifies the device.
299  [in] Address : The VME bus address.
300  [out] Buffer : The data read from the VME bus.
301  [in] Size : The size of the transfer in bytes.
302  [in] AM : The address modifier (see CVAddressModifier enum).
303  [in] DW : The data width.(see CVDataWidth enum).
304  [out] count : The number of bytes transferred.
305  -----------------------------------------------------------------------------
306  Returns:
307  An error code about the execution of the function.
308  -----------------------------------------------------------------------------
309  Description:
310  The function performs a VME block transfer read cycle. It can be used to
311  perform MBLT transfers using 64 bit data width. The Address is not
312  incremented on the VMEBus during the cycle.
313 */
315 CAENVME_FIFOBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
316  int Size, CVAddressModifier AM, CVDataWidth DW, int *count);
317 
318 /*
319  CAENVME_MBLTReadCycle
320  -----------------------------------------------------------------------------
321  Parameters:
322  [in] Handle : The handle that identifies the device.
323  [in] Address : The VME bus address.
324  [out] Buffer : The data read from the VME bus.
325  [in] Size : The size of the transfer in bytes.
326  [in] AM : The address modifier (see CVAddressModifier enum).
327  [out] count : The number of bytes transferred.
328  -----------------------------------------------------------------------------
329  Returns:
330  An error code about the execution of the function.
331  -----------------------------------------------------------------------------
332  Description:
333  The function performs a VME multiplexed block transfer read cycle.
334 */
336 CAENVME_MBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
337  int Size, CVAddressModifier AM, int *count);
338 
339 /*
340  Ver. 2.3 - New function
341 
342  CAENVME_FIFOMBLTReadCycle
343  -----------------------------------------------------------------------------
344  Parameters:
345  [in] Handle : The handle that identifies the device.
346  [in] Address : The VME bus address.
347  [out] Buffer : The data read from the VME bus.
348  [in] Size : The size of the transfer in bytes.
349  [in] AM : The address modifier (see CVAddressModifier enum).
350  [out] count : The number of bytes transferred.
351  -----------------------------------------------------------------------------
352  Returns:
353  An error code about the execution of the function.
354  -----------------------------------------------------------------------------
355  Description:
356  The function performs a VME multiplexed block transfer read cycle.
357  The Address is not incremented on the VMEBus during the cycle.
358 */
360 CAENVME_FIFOMBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
361  int Size, CVAddressModifier AM, int *count);
362 
363 /*
364  CAENVME_BLTWriteCycle
365  -----------------------------------------------------------------------------
366  Parameters:
367  [in] Handle : The handle that identifies the device.
368  [in] Address : The VME bus address.
369  [in] Buffer : The data to be written to the VME bus.
370  [in] Size : The size of the transfer in bytes.
371  [in] AM : The address modifier (see CVAddressModifier enum).
372  [in] DW : The data width.(see CVDataWidth enum).
373  [out] count : The number of bytes transferred.
374  -----------------------------------------------------------------------------
375  Returns:
376  An error code about the execution of the function.
377  -----------------------------------------------------------------------------
378  Description:
379  The function performs a VME block transfer write cycle.
380 */
382 CAENVME_BLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
383  int size, CVAddressModifier AM, CVDataWidth DW, int *count);
384 
385 /*
386  Ver. 2.3 - New function
387 
388  CAENVME_FIFOBLTWriteCycle
389  -----------------------------------------------------------------------------
390  Parameters:
391  [in] Handle : The handle that identifies the device.
392  [in] Address : The VME bus address.
393  [in] Buffer : The data to be written to the VME bus.
394  [in] Size : The size of the transfer in bytes.
395  [in] AM : The address modifier (see CVAddressModifier enum).
396  [in] DW : The data width.(see CVDataWidth enum).
397  [out] count : The number of bytes transferred.
398  -----------------------------------------------------------------------------
399  Returns:
400  An error code about the execution of the function.
401  -----------------------------------------------------------------------------
402  Description:
403  The function performs a VME block transfer write cycle. The address
404  is not incremented during the cycle.
405 */
407 CAENVME_FIFOBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
408  int size, CVAddressModifier AM, CVDataWidth DW, int *count);
409 
410 /*
411  CAENVME_MBLTWriteCycle
412  -----------------------------------------------------------------------------
413  Parameters:
414  [in] Handle : The handle that identifies the device.
415  [in] Address : The VME bus address.
416  [in] Buffer : The data to be written to the VME bus.
417  [in] Size : The size of the transfer in bytes.
418  [in] AM : The address modifier (see CVAddressModifier enum).
419  [out] count : The number of bytes transferred.
420  -----------------------------------------------------------------------------
421  Returns:
422  An error code about the execution of the function.
423  -----------------------------------------------------------------------------
424  Description:
425  The function performs a VME multiplexed block transfer write cycle.
426 */
428 CAENVME_MBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
429  int size, CVAddressModifier AM, int *count);
430 
431 /*
432  Ver. 2.3 - New function
433 
434  CAENVME_FIFOMBLTWriteCycle
435  -----------------------------------------------------------------------------
436  Parameters:
437  [in] Handle : The handle that identifies the device.
438  [in] Address : The VME bus address.
439  [in] Buffer : The data to be written to the VME bus.
440  [in] Size : The size of the transfer in bytes.
441  [in] AM : The address modifier (see CVAddressModifier enum).
442  [out] count : The number of bytes transferred.
443  -----------------------------------------------------------------------------
444  Returns:
445  An error code about the execution of the function.
446  -----------------------------------------------------------------------------
447  Description:
448  The function performs a VME multiplexed block transfer write cycle.
449  The address is not incremented during the cycle.
450 */
452 CAENVME_FIFOMBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
453  int size, CVAddressModifier AM, int *count);
454 
455 /*
456  CAENVME_ADOCycle
457  -----------------------------------------------------------------------------
458  Parameters:
459  [in] Handle : The handle that identifies the device.
460  [in] Address : The VME bus address.
461  [in] AM : The address modifier (see CVAddressModifier enum).
462  -----------------------------------------------------------------------------
463  Returns:
464  An error code about the execution of the function.
465  -----------------------------------------------------------------------------
466  Description:
467  The function performs a VME address only cycle. It can be used to
468  perform MBLT transfers using 64 bit data width.
469 */
471 CAENVME_ADOCycle(int32_t Handle, uint32_t Address, CVAddressModifier AM);
472 
473 /*
474  CAENVME_ADOHCycle
475  -----------------------------------------------------------------------------
476  Parameters:
477  [in] Handle : The handle that identifies the device.
478  [in] Address : The VME bus address.
479  [in] AM : The address modifier (see CVAddressModifier enum).
480  -----------------------------------------------------------------------------
481  Returns:
482  An error code about the execution of the function.
483  -----------------------------------------------------------------------------
484  Description:
485  The function performs a VME address only with handshake cycle.
486 */
488 CAENVME_ADOHCycle(int32_t Handle, uint32_t Address, CVAddressModifier AM);
489 
490 /*
491  CAENVME_IACKCycle
492  -----------------------------------------------------------------------------
493  Parameters:
494  [in] Handle : The handle that identifies the device.
495  [in] Level : The IRQ level to acknowledge (see CVIRQLevels enum).
496  [in] DW : The data width.(see CVDataWidth enum).
497  -----------------------------------------------------------------------------
498  Returns:
499  An error code about the execution of the function.
500  -----------------------------------------------------------------------------
501  Description:
502  The function performs a VME interrupt acknowledge cycle.
503 */
505 CAENVME_IACKCycle(int32_t Handle, CVIRQLevels Level, void *Vector, CVDataWidth DW);
506 
507 /*
508  CAENVME_IRQCheck
509  -----------------------------------------------------------------------------
510  Parameters:
511  [in] Handle : The handle that identifies the device.
512  [out] Mask : A bit-mask indicating the active IRQ lines.
513  -----------------------------------------------------------------------------
514  Returns:
515  An error code about the execution of the function.
516  -----------------------------------------------------------------------------
517  Description:
518  The function returns a bit mask indicating the active IRQ lines.
519 */
521 CAENVME_IRQCheck(int32_t Handle, CAEN_BYTE *Mask);
522 
523 /*
524  CAENVME_IRQEnable
525  -----------------------------------------------------------------------------
526  Parameters:
527  [in] Handle : The handle that identifies the device.
528  [in] Mask : A bit-mask indicating the IRQ lines.
529  -----------------------------------------------------------------------------
530  Returns:
531  An error code about the execution of the function.
532  -----------------------------------------------------------------------------
533  Description:
534  The function enables the IRQ lines specified by Mask.
535 */
537 CAENVME_IRQEnable(int32_t Handle, uint32_t Mask);
538 
539 /*
540  CAENVME_IRQDisable
541  -----------------------------------------------------------------------------
542  Parameters:
543  [in] Handle : The handle that identifies the device.
544  [in] Mask : A bit-mask indicating the IRQ lines.
545  -----------------------------------------------------------------------------
546  Returns:
547  An error code about the execution of the function.
548  -----------------------------------------------------------------------------
549  Description:
550  The function disables the IRQ lines specified by Mask.
551 */
553 CAENVME_IRQDisable(int32_t Handle, uint32_t Mask);
554 
555 /*
556  CAENVME_IRQWait
557  -----------------------------------------------------------------------------
558  Parameters:
559  [in] Handle : The handle that identifies the device.
560  [in] Mask : A bit-mask indicating the IRQ lines.
561  [in] Timeout : Timeout in milliseconds.
562  -----------------------------------------------------------------------------
563  Returns:
564  An error code about the execution of the function.
565  -----------------------------------------------------------------------------
566  Description:
567  The function wait the IRQ lines specified by Mask until one of
568  them raise or timeout expires.
569 */
571 CAENVME_IRQWait(int32_t Handle, uint32_t Mask, uint32_t Timeout);
572 
573 /*
574  CAENVME_SetPulserConf
575  -----------------------------------------------------------------------------
576  Parameters:
577  [in] Handle : The handle that identifies the device.
578  [in] PulSel : The pulser to configure (see CVPulserSelect enum).
579  [in] Period : The period of the pulse in time units.
580  [in] Width : The width of the pulse in time units.
581  [in] Unit : The time unit for the pulser configuration (see
582  CVTimeUnits enum).
583  [in] PulseNo : The number of pulses to generate (0 = infinite).
584  [in] Start : The source signal to start the pulse burst (see
585  CVIOSources enum).
586  [in] Reset : The source signal to stop the pulse burst (see
587  CVIOSources enum).
588  -----------------------------------------------------------------------------
589  Returns:
590  An error code about the execution of the function.
591  -----------------------------------------------------------------------------
592  Description:
593  The function permits to configure the pulsers. All the timing parameters
594  are expressed in the time units specified. The start signal source can be
595  one of: front panel button or software (cvManualSW), input signal 0
596  (cvInputSrc0),input signal 1 (cvInputSrc1) or input coincidence
597  (cvCoincidence). The reset signal source can be: front panel button or
598  software (cvManualSW) or, for pulser A the input signal 0 (cvInputSrc0),
599  for pulser B the input signal 1 (cvInputSrc1).
600 */
602 CAENVME_SetPulserConf(int32_t Handle, CVPulserSelect PulSel, unsigned char Period,
603  unsigned char Width, CVTimeUnits Unit, unsigned char PulseNo,
604  CVIOSources Start, CVIOSources Reset);
605 
606 /*
607  CAENVME_SetScalerConf
608  -----------------------------------------------------------------------------
609  Parameters:
610  [in] Handle : The handle that identifies the device.
611  [in] Limit : The counter limit for the scaler.
612  [in] AutoReset : Enable/disable the counter auto reset.
613  [in] Hit : The source signal for the signal to count (see
614  CVIOSources enum).
615  [in] Gate : The source signal for the gate (see CVIOSources enum).
616  [in] Reset : The source signal to stop the counter (see
617  CVIOSources enum).
618  -----------------------------------------------------------------------------
619  Returns:
620  An error code about the execution of the function.
621  -----------------------------------------------------------------------------
622  Description:
623  The function permits to configure the scaler. Limit range is 0 - 1024
624  (10 bit). The hit signal source can be: input signal 0 (cvInputSrc0)
625  or input coincidence (cvCoincidence). The gate signal source can be:
626  front panel button or software (cvManualSW) or input signal 1
627  (cvInputSrc1). The reset signal source can be: front panel button or
628  software (cvManualSW) or input signal 1 (cvInputSrc1).
629 */
631 CAENVME_SetScalerConf(int32_t Handle, short Limit, short AutoReset,
632  CVIOSources Hit, CVIOSources Gate, CVIOSources Reset);
633 
634 /*
635  CAENVME_SetOutputConf
636  -----------------------------------------------------------------------------
637  Parameters:
638  [in] Handle : The handle that identifies the device.
639  [in] OutSel : The output line to configure (see CVOutputSelect
640  enum).
641  [in] OutPol : The output line polarity (see CVIOPolarity enum).
642  [in] LEDPol : The output LED polarity (see CVLEDPolarity enum).
643  [in] Source : The source signal to propagate to the output line
644  (see CVIOSources enum).
645  -----------------------------------------------------------------------------
646  Returns:
647  An error code about the execution of the function.
648  -----------------------------------------------------------------------------
649  Description:
650  The function permits to configure the output lines of the module. It
651  can be specified the polarity for the line and for the LED. The
652  output line source depends on the line as figured out by the
653  following table:
654 
655  +-----------------------------------------------------------+
656  ! S O U R C E S E L E C T I O N !
657  +--------------+---------------+---------------+------------+
658  ! cvVMESignals ! cvCoincidence ! cvMiscSignals ! cvManualSW !
659  +---+---+--------------+---------------+---------------+------------+
660  ! ! 0 ! DS ! Input Coinc. ! Pulser A ! Manual/SW !
661  ! O +---+--------------+---------------+---------------+------------+
662  ! U ! 1 ! AS ! Input Coinc. ! Pulser A ! Manual/SW !
663  ! T +---+--------------+---------------+---------------+------------+
664  ! P ! 2 ! DTACK ! Input Coinc. ! Pulser B ! Manual/SW !
665  ! U +---+--------------+---------------+---------------+------------+
666  ! T ! 3 ! BERR ! Input Coinc. ! Pulser B ! Manual/SW !
667  ! +---+--------------+---------------+---------------+------------+
668  ! ! 4 ! LMON ! Input Coinc. ! Scaler end ! Manual/SW !
669  +---+---+--------------+---------------+---------------+------------+
670 */
672 CAENVME_SetOutputConf(int32_t Handle, CVOutputSelect OutSel, CVIOPolarity OutPol,
673  CVLEDPolarity LEDPol, CVIOSources Source);
674 
675 /*
676  CAENVME_SetInputConf
677  -----------------------------------------------------------------------------
678  Parameters:
679  [in] Handle : The handle that identifies the device.
680  [in] InSel : The input line to configure (see CVInputSelect enum).
681  [in] InPol : The input line polarity (see CVIOPolarity enum).
682  [in] LEDPol : The output LED polarity (see CVLEDPolarity enum).
683  -----------------------------------------------------------------------------
684  Returns:
685  An error code about the execution of the function.
686  -----------------------------------------------------------------------------
687  Description:
688  The function permits to configure the input lines of the module. It
689  ca be specified the polarity for the line and for the LED.
690 */
692 CAENVME_SetInputConf(int32_t Handle, CVInputSelect InSel, CVIOPolarity InPol,
693  CVLEDPolarity LEDPol);
694 
695 /*
696  CAENVME_GetPulserConf
697  -----------------------------------------------------------------------------
698  Parameters:
699  [in] Handle : The handle that identifies the device.
700  [in] PulSel : The pulser to configure (see CVPulserSelect enum).
701  [out] Period : The period of the pulse in time units.
702  [out] Width : The width of the pulse in time units.
703  [out] Unit : The time unit for the pulser configuration (see
704  CVTimeUnits enum).
705  [out] PulseNo : The number of pulses to generate (0 = infinite).
706  [out] Start : The source signal to start the pulse burst (see
707  CVIOSources enum).
708  [out] Reset : The source signal to stop the pulse burst (see
709  CVIOSources enum).
710  -----------------------------------------------------------------------------
711  Returns:
712  An error code about the execution of the function.
713  -----------------------------------------------------------------------------
714  Description:
715  The function permits to read the configuration of the pulsers.
716 */
718 CAENVME_GetPulserConf(int32_t Handle, CVPulserSelect PulSel, unsigned char *Period,
719  unsigned char *Width, CVTimeUnits *Unit, unsigned char *PulseNo,
720  CVIOSources *Start, CVIOSources *Reset);
721 
722 /*
723  CAENVME_GetScalerConf
724  -----------------------------------------------------------------------------
725  Parameters:
726  [in] Handle : The handle that identifies the device.
727  [out] Limit : The counter limit for the scaler.
728  [out] AutoReset : The auto reset configuration.
729  [out] Hit : The source signal for the signal to count (see
730  CVIOSources enum).
731  [out] Gate : The source signal for the gate (see CVIOSources enum).
732  [out] Reset : The source signal to stop the counter (see
733  CVIOSources enum).
734  -----------------------------------------------------------------------------
735  Returns:
736  An error code about the execution of the function.
737  -----------------------------------------------------------------------------
738  Description:
739  The function permits to read the configuration of the scaler.
740 */
742 CAENVME_GetScalerConf(int32_t Handle, short *Limit, short *AutoReset,
743  CVIOSources *Hit, CVIOSources *Gate, CVIOSources *Reset);
744 
745 
746 /*
747  CAENVME_SetOutputConf
748  -----------------------------------------------------------------------------
749  Parameters:
750  [in] Handle : The handle that identifies the device.
751  [in] OutSel : The output line to configure (see CVOutputSelect enum).
752  [out] OutPol : The output line polarity (see CVIOPolarity enum).
753  [out] LEDPol : The output LED polarity (see CVLEDPolarity enum).
754  [out] Source : The source signal to propagate to the output line (see
755  CVIOSources enum).
756  -----------------------------------------------------------------------------
757  Returns:
758  An error code about the execution of the function.
759  -----------------------------------------------------------------------------
760  Description:
761  The function permits to read the configuration of the output lines.
762 */
764 CAENVME_GetOutputConf(int32_t Handle, CVOutputSelect OutSel, CVIOPolarity *OutPol,
765  CVLEDPolarity *LEDPol, CVIOSources *Source);
766 
767 /*
768  CAENVME_SetInputConf
769  -----------------------------------------------------------------------------
770  Parameters:
771  [in] Handle : The handle that identifies the device.
772  [in] InSel : The input line to configure (see CVInputSelect enum).
773  [out] InPol : The input line polarity (see CVIOPolarity enum).
774  [out] LEDPol : The output LED polarity (see CVLEDPolarity enum).
775  -----------------------------------------------------------------------------
776  Returns:
777  An error code about the execution of the function.
778  -----------------------------------------------------------------------------
779  Description:
780  The function permits to read the configuration of the input lines.
781 */
783 CAENVME_GetInputConf(int32_t Handle, CVInputSelect InSel, CVIOPolarity *InPol,
784  CVLEDPolarity *LEDPol);
785 
786 /*
787  CAENVME_ReadRegister
788  -----------------------------------------------------------------------------
789  Parameters:
790  [in] Handle : The handle that identifies the device.
791  [in] Reg : The internal register to read (see CVRegisters enum).
792  [out] Data : The data read from the module.
793  -----------------------------------------------------------------------------
794  Returns:
795  An error code about the execution of the function.
796  -----------------------------------------------------------------------------
797  Description:
798  The function permits to read all internal registers.
799 */
801 CAENVME_ReadRegister(int32_t Handle, CVRegisters Reg, unsigned int *Data);
802 
803 /*
804  CAENVME_WriteRegister
805  -----------------------------------------------------------------------------
806  Parameters:
807  [in] Handle : The handle that identifies the device.
808  [in] Reg : The internal register to read (see CVRegisters enum).
809  [in] Data : The data to be written to the module.
810  -----------------------------------------------------------------------------
811  Returns:
812  An error code about the execution of the function.
813  -----------------------------------------------------------------------------
814  Description:
815  The function permits to write to all internal registers.
816 */
818 CAENVME_WriteRegister(int32_t Handle, CVRegisters Reg, unsigned int Data);
819 
820 /*
821  CAENVME_SetOutputRegister
822  -----------------------------------------------------------------------------
823  Parameters:
824  [in] Handle : The handle that identifies the device.
825  [in] Mask : The lines to be set.
826  -----------------------------------------------------------------------------
827  Returns:
828  An error code about the execution of the function.
829  -----------------------------------------------------------------------------
830  Description:
831  The function sets the lines specified. Refer the CVOutputRegisterBits
832  enum to compose and decoding the bit mask.
833 */
835 CAENVME_SetOutputRegister(int32_t Handle, unsigned short Mask);
836 
837 /*
838  CAENVME_ClearOutputRegister
839  -----------------------------------------------------------------------------
840  Parameters:
841  [in] Handle : The handle that identifies the device.
842  [in] Mask : The IRQ lines to be cleared.
843  -----------------------------------------------------------------------------
844  Returns:
845  An error code about the execution of the function.
846  -----------------------------------------------------------------------------
847  Description:
848  The function clears the lines specified. Refer the CVOutputRegisterBits
849  enum to compose and decoding the bit mask.
850 */
852 CAENVME_ClearOutputRegister(int32_t Handle, unsigned short Mask);
853 
854 /*
855  CAENVME_PulseOutputRegister
856  -----------------------------------------------------------------------------
857  Parameters:
858  [in] Handle : The handle that identifies the device.
859  [in] Mask : The lines to be pulsed.
860  -----------------------------------------------------------------------------
861  Returns:
862  An error code about the execution of the function.
863  -----------------------------------------------------------------------------
864  Description:
865  The function produces a pulse with the lines specified by setting and
866  then clearing them. Refer the CVOutputRegisterBits enum to compose and
867  decoding the bit mask.
868 */
870 CAENVME_PulseOutputRegister(int32_t Handle, unsigned short Mask);
871 
872 /*
873  CAENVME_ReadDisplay
874  -----------------------------------------------------------------------------
875  Parameters:
876  [in] Handle : The handle that identifies the device.
877  [out] Value : The values read from the module (see CVDisplay enum).
878  -----------------------------------------------------------------------------
879  Returns:
880  An error code about the execution of the function.
881  -----------------------------------------------------------------------------
882  Description:
883  The function reads the VME data display on the front panel of the module.
884  Refer to the CVDisplay data type definition and comments to decode the
885  value returned.
886 */
888 CAENVME_ReadDisplay(int32_t Handle, CVDisplay *Value);
889 
890 /*
891  CAENVME_SetArbiterType
892  -----------------------------------------------------------------------------
893  Parameters:
894  [in] Handle : The handle that identifies the device.
895  [in] Value : The type of VME bus arbitration to implement (see
896  CVArbiterTypes enum).
897  -----------------------------------------------------------------------------
898  Returns:
899  An error code about the execution of the function.
900  -----------------------------------------------------------------------------
901  Description:
902  The function sets the behaviour of the VME bus arbiter on the module.
903 */
905 CAENVME_SetArbiterType(int32_t Handle, CVArbiterTypes Value);
906 
907 /*
908  CAENVME_SetRequesterType
909  -----------------------------------------------------------------------------
910  Parameters:
911  [in] Handle : The handle that identifies the device.
912  [in] Value : The type of VME bus requester to implement (see
913  CVRequesterTypes enum).
914  -----------------------------------------------------------------------------
915  Returns:
916  An error code about the execution of the function.
917  -----------------------------------------------------------------------------
918  Description:
919  The function sets the behaviour of the VME bus requester on the module.
920 */
922 CAENVME_SetRequesterType(int32_t Handle, CVRequesterTypes Value);
923 
924 /*
925  CAENVME_SetReleaseType
926  -----------------------------------------------------------------------------
927  Parameters:
928  [in] Handle : The handle that identifies the device.
929  [in] Value : The type of VME bus release policy to implement (see
930  CVReleaseTypes enum).
931  -----------------------------------------------------------------------------
932  Returns:
933  An error code about the execution of the function.
934  -----------------------------------------------------------------------------
935  Description:
936  The function sets the release policy of the VME bus on the module.
937 */
939 CAENVME_SetReleaseType(int32_t Handle, CVReleaseTypes Value);
940 
941 /*
942  CAENVME_SetBusReqLevel
943  -----------------------------------------------------------------------------
944  Parameters:
945  [in] Handle : The handle that identifies the device.
946  [in] Value : The type of VME bus requester priority level to set
947  (see CVBusReqLevels enum).
948  -----------------------------------------------------------------------------
949  Returns:
950  An error code about the execution of the function.
951  -----------------------------------------------------------------------------
952  Description:
953  The function sets the specified VME bus requester priority level on
954  the module.
955 */
957 CAENVME_SetBusReqLevel(int32_t Handle, CVBusReqLevels Value);
958 
959 /*
960  CAENVME_SetTimeout
961  -----------------------------------------------------------------------------
962  Parameters:
963  [in] Handle : The handle that identifies the device.
964  [in] Value : The value of VME bus timeout to set (see
965  CVVMETimeouts enum).
966  -----------------------------------------------------------------------------
967  Returns:
968  An error code about the execution of the function.
969  -----------------------------------------------------------------------------
970  Description:
971  The function sets the specified VME bus timeout on the module.
972 */
974 CAENVME_SetTimeout(int32_t Handle, CVVMETimeouts Value);
975 
976 /*
977  CAENVME_SetLocationMonitor
978  -----------------------------------------------------------------------------
979  Parameters:
980  [in] Handle : The handle that identifies the device.
981  [in] Address : The addres to be monitored.
982  [in] Write : Flag to specify read or write cycle types.
983  [in] Lword : Flag to specify long word cycle type.
984  [in] Iack : Flag to specify interrupt acknowledge cycle type.
985 
986  -----------------------------------------------------------------------------
987  Returns:
988  An error code about the execution of the function.
989  -----------------------------------------------------------------------------
990  Description:
991  The function sets the Location Monitor.
992 */
994 CAENVME_SetLocationMonitor(int32_t Handle, uint32_t Address, CVAddressModifier Am,
995  short Write, short Lword, short Iack);
996 /*
997  CAENVME_SetFIFOMode
998  -----------------------------------------------------------------------------
999  Parameters:
1000  [in] Handle : The handle that identifies the device.
1001  [in] Value : Enable/disable the FIFO mode.
1002  -----------------------------------------------------------------------------
1003  Returns:
1004  An error code about the execution of the function.
1005  -----------------------------------------------------------------------------
1006  Description:
1007  The function enables/disables the auto increment of the VME addresses
1008  during the block transfer cycles. With the FIFO mode enabled the
1009  addresses are not incremented.
1010 */
1012 CAENVME_SetFIFOMode(int32_t Handle, short Value);
1013 
1014 /*
1015  CAENVME_GetArbiterType
1016  -----------------------------------------------------------------------------
1017  Parameters:
1018  [in] Handle : The handle that identifies the device.
1019  [out] Value : The type of VME bus arbitration implemented (see
1020  CVArbiterTypes enum).
1021  -----------------------------------------------------------------------------
1022  Returns:
1023  An error code about the execution of the function.
1024  -----------------------------------------------------------------------------
1025  Description:
1026  The function get the type of VME bus arbiter implemented on the module.
1027 */
1029 CAENVME_GetArbiterType(int32_t Handle, CVArbiterTypes *Value);
1030 
1031 /*
1032  CAENVME_GetRequesterType
1033  -----------------------------------------------------------------------------
1034  Parameters:
1035  [in] Handle : The handle that identifies the device.
1036  [out] Value : The type of VME bus requester implemented (see
1037  CVRequesterTypes enum).
1038  -----------------------------------------------------------------------------
1039  Returns:
1040  An error code about the execution of the function.
1041  -----------------------------------------------------------------------------
1042  Description:
1043  The function get the type of VME bus requester implemented on the module.
1044 */
1046 CAENVME_GetRequesterType(int32_t Handle, CVRequesterTypes *Value);
1047 
1048 /*
1049  CAENVME_GetReleaseType
1050  -----------------------------------------------------------------------------
1051  Parameters:
1052  [in] Handle : The handle that identifies the device.
1053  [out] Value : The type of VME bus release policy implemented (see
1054  CVReleaseTypes enum).
1055  -----------------------------------------------------------------------------
1056  Returns:
1057  An error code about the execution of the function.
1058  -----------------------------------------------------------------------------
1059  Description:
1060  The function get the type of VME bus release implemented on the module.
1061 */
1063 CAENVME_GetReleaseType(int32_t Handle, CVReleaseTypes *Value);
1064 
1065 /*
1066  CAENVME_GetBusReqLevel
1067  -----------------------------------------------------------------------------
1068  Parameters:
1069  [in] Handle : The handle that identifies the device.
1070  [out] Value : The type of VME bus requester priority level (see
1071  CVBusReqLevels enum).
1072  -----------------------------------------------------------------------------
1073  Returns:
1074  An error code about the execution of the function.
1075  -----------------------------------------------------------------------------
1076  Description:
1077  The function reads the specified VME bus requester priority level on
1078  the module.
1079 */
1081 CAENVME_GetBusReqLevel(int32_t Handle, CVBusReqLevels *Value);
1082 
1083 /*
1084  CAENVME_GetTimeout
1085  -----------------------------------------------------------------------------
1086  Parameters:
1087  [in] Handle : The handle that identifies the device.
1088  [out] Value : The value of VME bus timeout (see CVVMETimeouts enum).
1089  -----------------------------------------------------------------------------
1090  Returns:
1091  An error code about the execution of the function.
1092  -----------------------------------------------------------------------------
1093  Description:
1094  The function sets the specified VME bus timeout on the module.
1095 */
1097 CAENVME_GetTimeout(int32_t Handle, CVVMETimeouts *Value);
1098 
1099 /*
1100  CAENVME_GetFIFOMode
1101  -----------------------------------------------------------------------------
1102  Parameters:
1103  [in] Handle : The handle that identifies the device.
1104  [out] Value : The FIFO mode read setting.
1105  -----------------------------------------------------------------------------
1106  Returns:
1107  An error code about the execution of the function.
1108  -----------------------------------------------------------------------------
1109  Description:
1110  The function read if the auto increment of the VME addresses during the
1111  block transfer cycles is enabled (0) or disabled (!=0).
1112 */
1114 CAENVME_GetFIFOMode(int32_t Handle, short *Value);
1115 
1116 /*
1117  CAENVME_SystemReset
1118  -----------------------------------------------------------------------------
1119  Parameters:
1120  [in] Handle : The handle that identifies the device.
1121  -----------------------------------------------------------------------------
1122  Returns:
1123  An error code about the execution of the function.
1124  -----------------------------------------------------------------------------
1125  Description:
1126  The function performs a system reset on the module.
1127 */
1129 CAENVME_SystemReset(int32_t Handle);
1130 
1131 /*
1132  CAENVME_ResetScalerCount
1133  -----------------------------------------------------------------------------
1134  Parameters:
1135  [in] Handle : The handle that identifies the device.
1136  -----------------------------------------------------------------------------
1137  Returns:
1138  An error code about the execution of the function.
1139  -----------------------------------------------------------------------------
1140  Description:
1141  The function resets the counter of the scaler..
1142 */
1144 CAENVME_ResetScalerCount(int32_t Handle);
1145 
1146 /*
1147  CAENVME_EnableScalerGate
1148  -----------------------------------------------------------------------------
1149  Parameters:
1150  [in] Handle : The handle that identifies the device.
1151  -----------------------------------------------------------------------------
1152  Returns:
1153  An error code about the execution of the function.
1154  -----------------------------------------------------------------------------
1155  Description:
1156  The function enables the gate of the scaler.
1157 */
1159 CAENVME_EnableScalerGate(int32_t Handle);
1160 
1161 /*
1162  CAENVME_DisableScalerGate
1163  -----------------------------------------------------------------------------
1164  Parameters:
1165  [in] Handle : The handle that identifies the device.
1166  -----------------------------------------------------------------------------
1167  Returns:
1168  An error code about the execution of the function.
1169  -----------------------------------------------------------------------------
1170  Description:
1171  The function disables the gate of the scaler.
1172 */
1174 CAENVME_DisableScalerGate(int32_t Handle);
1175 
1176 /*
1177  CAENVME_StartPulser
1178  -----------------------------------------------------------------------------
1179  Parameters:
1180  [in] Handle : The handle that identifies the device.
1181  [in] PulSel : The pulser to configure (see CVPulserSelect enum).
1182  -----------------------------------------------------------------------------
1183  Returns:
1184  An error code about the execution of the function.
1185  -----------------------------------------------------------------------------
1186  Description:
1187  The function starts the generation of pulse burst if the specified
1188  pulser is configured for manual/software operation.
1189 */
1191 CAENVME_StartPulser(int32_t Handle, CVPulserSelect PulSel);
1192 
1193 /*
1194  CAENVME_StopPulser
1195  -----------------------------------------------------------------------------
1196  Parameters:
1197  [in] Handle : The handle that identifies the device.
1198  [in] PulSel : The pulser to configure (see CVPulserSelect enum).
1199  -----------------------------------------------------------------------------
1200  Returns:
1201  An error code about the execution of the function.
1202  -----------------------------------------------------------------------------
1203  Description:
1204  The function stops the generation of pulse burst if the specified
1205  pulser is configured for manual/software operation.
1206 */
1208 CAENVME_StopPulser(int32_t Handle, CVPulserSelect PulSel);
1209 
1210 /*
1211  CAENVME_WriteFlashPage
1212  -----------------------------------------------------------------------------
1213  Parameters:
1214  [in] Handle : The handle that identifies the device.
1215  [in] Data : The data to write.
1216  [in] PageNum : The flash page number to write.
1217  -----------------------------------------------------------------------------
1218  Returns:
1219  An error code about the execution of the function.
1220  -----------------------------------------------------------------------------
1221  Description:
1222  The function writes the data into the specified flash page.
1223 */
1225 CAENVME_WriteFlashPage(int32_t Handle, unsigned char *Data, int PageNum);
1226 
1227 /*
1228  CAENVME_ReadFlashPage
1229  -----------------------------------------------------------------------------
1230  Parameters:
1231  [in] Handle : The handle that identifies the device.
1232  [out] Data : The data to write.
1233  [in] PageNum : The flash page number to write.
1234  -----------------------------------------------------------------------------
1235  Returns:
1236  An error code about the execution of the function.
1237  -----------------------------------------------------------------------------
1238  Description:
1239  The function reads the data from the specified flash page.
1240 */
1242 CAENVME_ReadFlashPage(int32_t Handle, unsigned char *Data, int PageNum);
1243 
1244 /*
1245  CAENVME_EraseFlashPage
1246  -----------------------------------------------------------------------------
1247  Parameters:
1248  [in] Handle : The handle that identifies the device.
1249  [in] PageNum : The flash page number to write.
1250  -----------------------------------------------------------------------------
1251  Returns:
1252  An error code about the execution of the function.
1253  -----------------------------------------------------------------------------
1254  Description:
1255  The function erases the specified flash page.
1256 */
1258 CAENVME_EraseFlashPage(int32_t Handle, int Pagenum);
1259 
1260 #ifdef LINUX
1261 /*
1262  CAENVME_BLTReadAsync
1263  -----------------------------------------------------------------------------
1264  Parameters:
1265  [in] Handle : The handle that identifies the device.
1266  [in] Address : The VME bus address.
1267  [out] Buffer : The data read from the VME bus.
1268  [in] Size : The size of the transfer in bytes.
1269  [in] AM : The address modifier (see CVAddressModifier enum).
1270  [in] DW : The data width.(see CVDataWidth enum).
1271  -----------------------------------------------------------------------------
1272  Returns:
1273  An error code about the execution of the function.
1274  -----------------------------------------------------------------------------
1275  Description:
1276  The function starts a VME block transfer read cycle. It can be used
1277  to perform MBLT transfers using 64 bit data width.
1278  This function cannot be used with the V1718 USB bridge.
1279  This function can be used only on Linux platforms.
1280  Take care to call the CAENVME_BLTReadWait function before any other
1281  call to a CAENVMElib function with the same handle.
1282 */
1284 CAENVME_BLTReadAsync(int32_t Handle, uint32_t Address, void *Buffer,
1285  int Size, CVAddressModifier AM, CVDataWidth DW);
1286 
1287 /*
1288  CAENVME_BLTReadWait
1289  -----------------------------------------------------------------------------
1290  Parameters:
1291  [in] Handle : The handle that identifies the device.
1292  [out] Count : The number of bytes transferred.
1293  -----------------------------------------------------------------------------
1294  Returns:
1295  An error code about the execution of the function.
1296  -----------------------------------------------------------------------------
1297  Description:
1298  The function wait for the completion of a VME block transfer read
1299  cycle started with the CAENVME_BLTReadAsync function call.
1300  This function cannot be used with the V1718 USB bridge.
1301  This function can be used only on Linux platforms.
1302 */
1304 CAENVME_BLTReadWait(int32_t Handle, int *Count);
1305 
1306 #endif
1307 
1308 #ifdef __cplusplus
1309 }
1310 #endif // __cplusplus
1311 
1312 #endif // __CAENVMELIB_H