source: fact/hvcontrol/src/HV.h@ 13151

Last change on this file since 13151 was 229, checked in by ogrimm, 14 years ago
Config requests non-blocking if not made from main thread, adapted all servers to GetConfig() returning std::string, workaround for erroneous SERVICE_LIST
File size: 1.5 KB
Line 
1#ifndef HV_H_SEEN
2#define HV_H_SEEN
3
4#include <termios.h> // POSIX terminal control definitions
5#include <fcntl.h> // File control definitions => fcntl() in fcn OpenPort()
6#include <errno.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <sys/ioctl.h>
10#include <string>
11
12#include "dis.hxx"
13#define NUM_CHAINS 4
14#define NUM_CHANNELS 32
15
16#define BAUDRATE B115200
17
18// HV board control registers
19#define REG_HV0 0X20
20#define REG_HV1 0X28
21#define REG_HV2 0X30
22#define REG_HV3 0X38
23#define REG_RESET 0XF8
24#define REG_STATUS 0X80
25
26// HV board status bits
27#define BIT_OC0 (1<<3)
28#define BIT_OC1 (1<<4)
29#define BIT_OC2 (1<<5)
30#define BIT_OC3 (1<<6)
31#define BIT_RESET (1<<7)
32
33class ProcessIO;
34
35class HVBoard {
36
37 int BoardNumber;
38 class ProcessIO *m;
39
40 public:
41
42 HVBoard(int, std::string, class ProcessIO *);
43 ~HVBoard();
44
45 int fDescriptor;
46 bool Overcurrent[NUM_CHAINS];
47 bool ResetButton;
48 bool WrapOK;
49 int LastWrapCount;
50 double fTimeOut; // [s] timeout to return from read
51 int ErrorCount;
52
53 char *BoardName;
54 int HV[NUM_CHAINS][NUM_CHANNELS]; // HV value in DAC units
55 double HVV[NUM_CHAINS][NUM_CHANNELS]; // HV value in volts
56
57 DimService *NameService;
58 DimService *BiasVolt;
59
60 void ClearVoltageArrays();
61 int Reset();
62 int GetStatus();
63 int SetHV(int, unsigned int, int);
64 int GetBoardNumber() {return BoardNumber;}
65 int Communicate(unsigned char*, int);
66 void SetTimeOut(double);
67};
68
69#endif
Note: See TracBrowser for help on using the repository browser.