Subversion Repositories f9daq

Rev

Go to most recent revision | Details | 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
 
69
void sa02Tmlnk (int tout);
70
void sa02Tmulk (void );
71
void sa02Timerast (int signumber);
72
extern int sa02TimerOut;
73
int sa02Help(void);
74
extern int sa02Verbose;
75
extern int sa02TimerOut;
76
extern int sa02BltReadout;
77
int sa02MuxMap(int i );
78
 
79
uint32_t  sa02Write(uint32_t board, uint32_t regh, uint32_t regl, uint32_t *response);
80
int sa02Reset1( void );
81
 
82
int Sa02SEUTrigger (void);
83
int Sa02SoftwareTrigger (void);
84
int Sa02SelectTrigger (uint32_t trg);
85
int Sa02SelectTriggerWithMaskAndLength (uint32_t trg, uint32_t mask, uint32_t len);
86
int Sa02TestPulseEnable (uint32_t board, uint32_t rdy );
87
int Sa02DaqMode (uint32_t mode) ;
88
int Sa02SetNeve (uint32_t neve);
89
int Sa02SetPtsOutput(uint32_t mask);
90
uint32_t Sa02GetNeve (uint32_t*inputtriggers);
91
uint32_t Sa02GetCounter (uint32_t board, uint32_t *errors);
92
uint32_t Sa02GetChAddr (uint32_t board);
93
int sa02Reset( void );
94
int sa02Read( uint32_t mask, uint32_t * data);
95
uint32_t  sa02Cmd(uint32_t board,  uint32_t cmd, uint32_t data, int chip, int ch, int nload, uint32_t *response);
96
int sa02AsicWrite(uint32_t board, uint32_t reg, uint32_t data, int chip, int ch, uint32_t mask,  uint32_t shft );
97
uint32_t sa02GetCmdCode(char *optarg);
98
uint32_t sa02GetAsicCode(char *optarg, uint32_t *asicpar, uint32_t *asicshft);
99
int sa02Init( void );
100
int sa02LoadParametersFromFile( const char *fname, uint16_t mask);
101
int sa02GetSerial( uint32_t board, char * serial);
102
int sa02Status( uint32_t board, char * serial, double *data);
103
int sa02SetAddress(uint32_t address);
104
#endif