| 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 |
|
|---|
| 14 | #define MAX_NUM_BOARDS 13 // Maximum number of boards per crate
|
|---|
| 15 | #define NUM_CHANNELS 32 // Channels per bias board
|
|---|
| 16 | #define BAUDRATE B115200
|
|---|
| 17 |
|
|---|
| 18 | class ProcessIO;
|
|---|
| 19 |
|
|---|
| 20 | class Crate {
|
|---|
| 21 |
|
|---|
| 22 | class ProcessIO *m;
|
|---|
| 23 | int CrateNumber;
|
|---|
| 24 | int fDescriptor;
|
|---|
| 25 | DimService *NameService;
|
|---|
| 26 | bool LastOC;
|
|---|
| 27 | int LastCurrent;
|
|---|
| 28 |
|
|---|
| 29 | int Communicate(unsigned char*, int);
|
|---|
| 30 | void ClearVoltageArrays();
|
|---|
| 31 |
|
|---|
| 32 | public:
|
|---|
| 33 | Crate(std::string, int, class ProcessIO *);
|
|---|
| 34 | ~Crate();
|
|---|
| 35 |
|
|---|
| 36 | char *Name;
|
|---|
| 37 | DimService *BiasVolt;
|
|---|
| 38 |
|
|---|
| 39 | int Current[MAX_NUM_BOARDS][NUM_CHANNELS];
|
|---|
| 40 | bool OC[MAX_NUM_BOARDS][NUM_CHANNELS];
|
|---|
| 41 | bool ResetHit;
|
|---|
| 42 | bool WrapOK;
|
|---|
| 43 | int WrapCount;
|
|---|
| 44 | int ErrorCount;
|
|---|
| 45 |
|
|---|
| 46 | int DAC[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in DAC units
|
|---|
| 47 | double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt
|
|---|
| 48 |
|
|---|
| 49 | bool InitOK;
|
|---|
| 50 |
|
|---|
| 51 | int SystemReset();
|
|---|
| 52 | int ReadChannel(unsigned int, unsigned int);
|
|---|
| 53 | int GlobalSet(unsigned int);
|
|---|
| 54 | int ChannelSet(int, int, unsigned int);
|
|---|
| 55 | bool Synch();
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.