Subversion Repositories f9daq

Rev

Rev 326 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
326 f9daq 1
#ifndef _SA02LIB_H_
2
#define _SA02LIB_H_
3
 
4
#include "vme.h"
5
 
6
#include "SA02_DEF.h"
7
 
8
 
9
#ifdef WIN32
10
#ifdef  _CVI_
11
typedef signed char   int8_t;
12
typedef unsigned char  uint8_t;
13
typedef short  int16_t;
14
typedef unsigned short uint16_t;
15
typedef int  int32_t;
16
typedef unsigned int  uint32_t;
17
//  typedef INT64  int64_t;
18
//  typedef UINT64 uint64_t;
19
#else
20
typedef INT8   int8_t;
21
typedef UINT8  uint8_t;
22
typedef INT16  int16_t;
23
typedef UINT16 uint16_t;
24
typedef INT32  int32_t;
25
typedef UINT32 uint32_t;
26
typedef INT64  int64_t;
27
typedef UINT64 uint64_t;
28
#endif
29
#else
30
#include <stdlib.h>
31
#include <stdint.h>
32
#include <stdio.h>
33
#endif
34
 
35
typedef struct  {
36
  unsigned int phasecmps:2;
37
  unsigned int gain:2;
38
  unsigned int shapingtime:2;
39
  unsigned int comparator:1;
40
  unsigned int vrdrive:8;
41
  unsigned int monitor:2;
42
  unsigned int id:9;
43
  unsigned int unused:6;
44
} sa02AsicGlobalRegister;
45
 
46
typedef struct  {
47
  unsigned int decaytime:3;
48
  unsigned int offset:4;
49
  unsigned int fineadj_unipol:4;
50
  unsigned int fineadj_diff:4;
51
  unsigned int reserved:1;
52
  unsigned int tpenb:1;
53
  unsigned int kill:1;
54
  unsigned int unused:14;
55
} sa02AsicChannelRegister;
56
 
57
 
58
//extern uint32_t  sa02BoardNumber;
59
extern uint32_t  sa02BoardType;
60
 
61
void sa02PrintGREG(uint32_t *data, const char *txt);
62
void sa02PrintCREG(uint32_t *data, const char *txt);
63
#ifdef _CVI_
64
int sa02Printf(const char *format, ...);
65
#else
66
#define sa02Printf printf
67
#endif
68
 
357 f9daq 69
double sa02ampIb(int);
70
double sa02adc2V(int);
71
double sa02adc2Vp(int);
72
double sa02adc2Vm(int);
73
double sa02adc2V38(int);
74
double sa02adc2Va(int);
75
 
326 f9daq 76
void sa02Tmlnk (int tout);
77
void sa02Tmulk (void );
78
void sa02Timerast (int signumber);
79
extern int sa02TimerOut;
80
int sa02Help(void);
81
extern int sa02Verbose;
82
extern int sa02TimerOut;
83
extern int sa02BltReadout;
84
int sa02MuxMap(int i );
85
 
86
uint32_t  sa02Write(uint32_t board, uint32_t regh, uint32_t regl, uint32_t *response);
87
int sa02Reset1( void );
88
 
89
int Sa02SEUTrigger (void);
90
int Sa02SoftwareTrigger (void);
91
int Sa02SelectTrigger (uint32_t trg);
92
int Sa02SelectTriggerWithMaskAndLength (uint32_t trg, uint32_t mask, uint32_t len);
93
int Sa02TestPulseEnable (uint32_t board, uint32_t rdy );
94
int Sa02DaqMode (uint32_t mode) ;
95
int Sa02SetNeve (uint32_t neve);
96
int Sa02SetPtsOutput(uint32_t mask);
97
uint32_t Sa02GetNeve (uint32_t*inputtriggers);
98
uint32_t Sa02GetCounter (uint32_t board, uint32_t *errors);
99
uint32_t Sa02GetChAddr (uint32_t board);
100
int sa02Reset( void );
101
int sa02Read( uint32_t mask, uint32_t * data);
102
uint32_t  sa02Cmd(uint32_t board,  uint32_t cmd, uint32_t data, int chip, int ch, int nload, uint32_t *response);
103
int sa02AsicWrite(uint32_t board, uint32_t reg, uint32_t data, int chip, int ch, uint32_t mask,  uint32_t shft );
104
uint32_t sa02GetCmdCode(char *optarg);
105
uint32_t sa02GetAsicCode(char *optarg, uint32_t *asicpar, uint32_t *asicshft);
106
int sa02Init( void );
107
int sa02LoadParametersFromFile( const char *fname, uint16_t mask);
108
int sa02GetSerial( uint32_t board, char * serial);
109
int sa02Status( uint32_t board, char * serial, double *data);
110
int sa02SetAddress(uint32_t address);
111
#endif