NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
pixie16app_export.h
1 #ifndef PIXIE16APP_EXPORT_H
2 #define PIXIE16APP_EXPORT_H
3 
4 /*----------------------------------------------------------------------
5  * Copyright (c) 2005 - 2009, XIA LLC
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms,
9  * with or without modification, are permitted provided
10  * that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above
13  * copyright notice, this list of conditions and the
14  * following disclaimer.
15  * * Redistributions in binary form must reproduce the
16  * above copyright notice, this list of conditions and the
17  * following disclaimer in the documentation and/or other
18  * materials provided with the distribution.
19  * * Neither the name of XIA LLC nor the names of its
20  * contributors may be used to endorse or promote
21  * products derived from this software without
22  * specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
25  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
26  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
34  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
35  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *----------------------------------------------------------------------*/
38 
39 /******************************************************************************
40  *
41  * File Name:
42  *
43  * pixie16app_export.h
44  *
45  * Description:
46  *
47  * Function prototypes seen by user applications.
48  *
49  * $Rev: 29161 $
50  * $Id: pixie16app_export.h 29161 2014-01-09 19:27:58Z htan $
51  ******************************************************************************/
52 
53 /* If this is compiled by a C++ compiler, make it */
54 /* clear that these are C routines. */
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 #ifndef __PIXIE16APP_DEFS_H
60 #include "pixie16app_defs.h"
61 #endif
62 
63 
64 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16InitSystem (
65  unsigned short NumModules, // total number of Pixie16 modules in the system
66  unsigned short *PXISlotMap, // an array containing the PXI slot number for each pixie16 module
67  unsigned short OfflineMode ); // specify if the system is in offline mode
68 
69 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ExitSystem (
70  unsigned short ModNum ); // module number
71 
72 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadModuleInfo (
73  unsigned short ModNum, // module number
74  unsigned short *ModRev, // returned module revision
75  unsigned int *ModSerNum, // returned module serial number
76  unsigned short *ModADCBits, // returned module ADC bits
77  unsigned short *ModADCMSPS ); // returned module ADC sampling rate
78 
79 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16BootModule (
80  const char *ComFPGAConfigFile, // name of communications FPGA configuration file
81  const char *SPFPGAConfigFile, // name of signal processing FPGA configuration file
82  const char *TrigFPGAConfigFile, // name of trigger FPGA configuration file
83  const char *DSPCodeFile, // name of executable code file for digital signal processor (DSP)
84  const char *DSPParFile, // name of DSP parameter file
85  const char *DSPVarFile, // name of DSP variable names file
86  unsigned short ModNum, // pixie module number
87  unsigned short BootPattern ); // boot pattern bit mask
88 
89 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16AcquireADCTrace (
90  unsigned short ModNum ); // module number
91 
92 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadSglChanADCTrace (
93  unsigned short *Trace_Buffer, // trace data
94  unsigned int Trace_Length, // trace length
95  unsigned short ModNum, // module number
96  unsigned short ChanNum ); // channel number
97 
98 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16IMbufferIO (
99  unsigned int *Buffer, // buffer data
100  unsigned int NumWords, // number of buffer words to read or write
101  unsigned int Address, // buffer address
102  unsigned short Direction, // I/O direction
103  unsigned short ModNum ); // module number
104 
105 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16EMbufferIO (
106  unsigned int *Buffer, // buffer data
107  unsigned int NumWords, // number of buffer words to read or write
108  unsigned int Address, // buffer address
109  unsigned short Direction, // I/O direction
110  unsigned short ModNum ); // module number
111 
112 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16StartListModeRun (
113  unsigned short ModNum, // module number
114  unsigned short RunType, // run type
115  unsigned short mode ); // run mode
116 
117 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16StartHistogramRun (
118  unsigned short ModNum, // module number
119  unsigned short mode ); // run mode
120 
121 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16CheckRunStatus (
122  unsigned short ModNum ); // Pixie module number
123 
124 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16EndRun (
125  unsigned short ModNum ); // Pixie module number
126 
127 PIXIE16APP_EXPORT double PIXIE16APP_API Pixie16ComputeInputCountRate (
128  unsigned int *Statistics,
129  unsigned short ModNum,
130  unsigned short ChanNum );
131 
132 PIXIE16APP_EXPORT double PIXIE16APP_API Pixie16ComputeOutputCountRate (
133  unsigned int *Statistics,
134  unsigned short ModNum,
135  unsigned short ChanNum );
136 
137 PIXIE16APP_EXPORT double PIXIE16APP_API Pixie16ComputeLiveTime (
138  unsigned int *Statistics,
139  unsigned short ModNum,
140  unsigned short ChanNum );
141 
142 PIXIE16APP_EXPORT double PIXIE16APP_API Pixie16ComputeProcessedEvents (
143  unsigned int *Statistics,
144  unsigned short ModNum );
145 
146 PIXIE16APP_EXPORT double PIXIE16APP_API Pixie16ComputeRealTime (
147  unsigned int *Statistics,
148  unsigned short ModNum );
149 
150 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16complexFFT (
151  double *data,
152  unsigned int length );
153 
154 PIXIE16APP_EXPORT unsigned short PIXIE16APP_API APP16_TstBit (
155  unsigned short bit,
156  unsigned short value );
157 
158 PIXIE16APP_EXPORT unsigned short PIXIE16APP_API APP16_SetBit (
159  unsigned short bit,
160  unsigned short value );
161 
162 PIXIE16APP_EXPORT unsigned short PIXIE16APP_API APP16_ClrBit (
163  unsigned short bit,
164  unsigned short value );
165 
166 PIXIE16APP_EXPORT unsigned int PIXIE16APP_API APP32_SetBit (
167  unsigned short bit,
168  unsigned int value );
169 
170 PIXIE16APP_EXPORT unsigned int PIXIE16APP_API APP32_ClrBit (
171  unsigned short bit,
172  unsigned int value );
173 
174 PIXIE16APP_EXPORT unsigned int PIXIE16APP_API APP32_TstBit (
175  unsigned short bit,
176  unsigned int value );
177 
178 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16SetDACs (
179  unsigned short ModNum );
180 
181 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ProgramFippi (
182  unsigned short ModNum );
183 
184 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16AdjustOffsets (
185  unsigned short ModNum );
186 
187 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16AcquireBaselines (
188  unsigned short ModNum ); // module number
189 
190 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadSglChanBaselines (
191  double *Baselines, // returned baselines values
192  double *TimeStamps, // time stamp for each baseline value
193  unsigned short NumBases, // number of baseline values to read
194  unsigned short ModNum, // module number
195  unsigned short ChanNum ); // channel number
196 
197 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16RampOffsetDACs (
198  double *DCValues, // returned DC offset values
199  unsigned short NumDCVals, // number of DC values to read
200  unsigned short ModNum );
201 
202 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ControlTaskRun (
203  unsigned short ModNum, // Pixie module number
204  unsigned short ControlTask, // Control task number
205  unsigned int Max_Poll ); // Timeout control in unit of ms for control task run
206 
207 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16BLcutFinder (
208  unsigned short ModNum, // Pixie module number
209  unsigned short ChanNum, // Pixie channel number
210  unsigned int *BLcut ); // BLcut return value
211 
212 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16TauFinder (
213  unsigned short ModNum, // Pixie module number
214  double *Tau ); // 16 returned Tau values, in µs
215 
216 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16WriteSglModPar (
217  const char *ModParName, // the name of the module parameter
218  unsigned int ModParData, // the module parameter value to be written to the module
219  unsigned short ModNum ); // module number
220 
221 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadSglModPar (
222  const char *ModParName, // the name of the module parameter
223  unsigned int *ModParData, // the module parameter value to be read from the module
224  unsigned short ModNum ); // module number
225 
226 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16WriteSglChanPar (
227  const char *ChanParName, // the name of the channel parameter
228  double ChanParData, // the channel parameter value to be written to the module
229  unsigned short ModNum, // module number
230  unsigned short ChanNum ); // channel number
231 
232 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadSglChanPar (
233  const char *ChanParName, // the name of the channel parameter
234  double *ChanParData, // the channel parameter value to be read from the module
235  unsigned short ModNum, // module number
236  unsigned short ChanNum ); // channel number
237 
238 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadHistogramFromModule (
239  unsigned int *Histogram, // histogram data
240  unsigned int NumWords, // number of words to be read out
241  unsigned short ModNum, // module number
242  unsigned short ChanNum); // channel number
243 
244 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadStatisticsFromModule (
245  unsigned int *Statistics, // run statistics data
246  unsigned short ModNum ); // module number
247 
248 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16SaveHistogramToFile (
249  const char *FileName, // histogram data file name
250  unsigned short ModNum); // module number
251 
252 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16GetModuleEvents (
253  const char *FileName, // the list mode data file name (with complete path)
254  unsigned int *ModuleEvents ); // receives number of events for each module
255 
256 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16GetEventsInfo (
257  const char *FileName, // the list mode data file name (with complete path)
258  unsigned int *EventInformation, // to hold event information
259  unsigned short ModuleNumber); // the module whose events are to be retrieved
260 
261 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadListModeTrace (
262  const char *FileName, // list mode data file name
263  unsigned short *Trace_Data, // list mode trace data (16-bit words)
264  unsigned short NumWords, // number of 16-bit words to be read out
265  unsigned int FileLocation); // the location of the trace in the file
266 
267 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadHistogramFromFile (
268  const char *FileName, // the histogram data file name (with complete path)
269  unsigned int *Histogram, // histogram data
270  unsigned int NumWords, // number of words to be read out
271  unsigned short ModNum, // module number
272  unsigned short ChanNum); // channel number
273 
274 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16SaveDSPParametersToFile (
275  const char *FileName ); // the DSP parameters file name (with complete path)
276 
277 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16LoadDSPParametersFromFile (
278  const char *FileName ); // the DSP parameters file name (with complete path)
279 
280 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16CopyDSPParameters (
281  unsigned short BitMask, // copy items bit mask
282  unsigned short SourceModule, // source module
283  unsigned short SourceChannel, // source channel
284  unsigned short *DestinationMask ); // the destination module and channel bit mask
285 
286 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadMSGFile (
287  char *ReturnMsgStr );
288 
289 PIXIE16APP_EXPORT unsigned int PIXIE16APP_API Decimal2IEEEFloating(double DecimalNumber);
290 
291 PIXIE16APP_EXPORT double PIXIE16APP_API IEEEFloating2Decimal(unsigned int IEEEFloatingNumber);
292 
293 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16SaveExternalFIFODataToFile (
294  const char *FileName, // list mode data file name
295  unsigned int *nFIFOWords, // number of words read from external FIFO
296  unsigned short ModNum, // module number
297  unsigned short EndOfRunRead); // indicator whether this is the end of run read
298 
299 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16RegisterIO (
300  unsigned short ModNum, // the Pixie module to communicate to
301  unsigned int address, // register address
302  unsigned short direction, // either MOD_READ or MOD_WRITE
303  unsigned int *value ); // holds or receives the data
304 
305 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadCSR (
306  unsigned short ModNum,
307  unsigned int *CSR );
308 
309 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16WriteCSR (
310  unsigned short ModNum,
311  unsigned int CSR );
312 
313 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16CheckExternalFIFOStatus (
314  unsigned int *nFIFOWords,
315  unsigned short ModNum );
316 
317 PIXIE16APP_EXPORT int PIXIE16APP_API Pixie16ReadDataFromExternalFIFO (
318  unsigned int *ExtFIFO_Data, // To receive the external FIFO data
319  unsigned int nFIFOWords, // number of words to read from external FIFO
320  unsigned short ModNum ); // module number
321 
322 
323 #ifdef __cplusplus
324 }
325 #endif // End of notice for C++ compilers
326 
327 #endif // End of pixie16app_export.h
Definition: Tau.h:6
Definition: Histogram.h:5