AlcapDAQ  1
CAENVMEDemoMain.c
Go to the documentation of this file.
1 /*
2  -----------------------------------------------------------------------------
3 
4  --- CAEN SpA - Computing Systems Division ---
5 
6  -----------------------------------------------------------------------------
7 
8  Name : CAENVMEDemoMain.c
9 
10  Project : CaenVmeDemo
11 
12  Description : Example program for V1718 & V2718 control.
13 
14  Date : November 2004
15  Release : 1.0
16  Author : C.Landi
17 
18  Date : August 2006
19  Release : 1.1
20  Author : NDA
21  Description : 64 bit porting (CAENVMElib rev >= 2.5)
22 
23 
24  -----------------------------------------------------------------------------
25 
26 
27  -----------------------------------------------------------------------------
28 */
29 
30 
31 #include <stdlib.h>
32 #include <stdio.h>
33 //#include <stdint.h>
34 #include <stdarg.h>
35 
36 #include "CAENVMElib.h"
37 #include "console.h"
38 
39 
40 // -----------------------------------------------------------------------------
41 
42 extern void CaenVmeManual(long, short) ;
43 
44 // -----------------------------------------------------------------------------
45 
46 
47 
48 /*
49  -----------------------------------------------------------------------------
50 
51  Main program
52 
53  -----------------------------------------------------------------------------
54 */
55 
56 
57 int main(int argc, void *argv[])
58 
59 {
60 CVBoardTypes VMEBoard;
61 short Link;
62 short Device;
63 int32_t BHandle;
64 
65 
66 
67 if( (argc != 3) && (argc != 4) )
68  {
69  printf("Usage: CAENVMEDemo V1718 <VMEDevice>\n");
70  printf(" CAENVMEDemo V2718 <VMEDevice> <VMELink>\n");
71  exit(1);
72  }
73 else
74  {
75  if( strcmp((char*)argv[1], "V1718") == 0 )
76  {
77  if( argc == 3 )
78  {
79  VMEBoard = cvV1718;
80  Device = atoi((const char*)argv[2]);
81  Link = 0;
82  }
83  else
84  {
85  printf(" CAENVMEDemo V1718 <VMEDevice>\n");
86  exit(1);
87  }
88  }
89  else
90  {
91  if( strcmp((char*)argv[1], "V2718") == 0 )
92  {
93  if( argc == 4 )
94  {
95  Device = atoi((const char*) argv[2]);
96  Link = atoi((const char*) argv[3]);
97  VMEBoard = cvV2718;
98  }
99  else
100  {
101  printf(" CAENVMEDemo V2718 <VMEDevice> <VMELink>\n");
102  exit(1);
103  }
104  }
105  else
106  {
107  printf("Usage: CAENVMEDemo V1718 <VMEDevice>\n");
108  printf(" CAENVMEDemo V2718 <VMEDevice> <VMELink>\n");
109  exit(1);
110  }
111  }
112 
113  }
114 
115 // Initialize the Board
116 
117 if( CAENVME_Init(VMEBoard, Link, Device, &BHandle) != cvSuccess )
118  {
119  printf("\n\n Error opening the device\n");
120  exit(1);
121  }
122 
123 
124 con_init() ;
125 
126 // CAENVME_SetFIFOMode(BHandle,1) ;
127 
128 CaenVmeManual(BHandle,1) ;
129 
130 con_end() ;
131 
132 CAENVME_End(BHandle);
133 }
134