source: fact/FADctrl/FADBoard.h@ 10171

Last change on this file since 10171 was 10164, checked in by ogrimm, 14 years ago
Moved board initalisation to thread, added 'reconnect' command
File size: 1.6 KB
Line 
1#ifndef FADBoard_H_SEEN
2#define FADBoard_H_SEEN
3
4#include <ctype.h>
5#include <time.h>
6#include <math.h>
7#include <errno.h>
8#include <unistd.h>
9#include <dirent.h>
10#include <sys/time.h>
11
12#include <stdlib.h>
13#include <string.h>
14#include <iostream>
15#include <algorithm>
16#include <sys/socket.h>
17#include <netdb.h>
18
19#include "FAD.h"
20#include "FADFormat.h"
21
22const unsigned int READ_BUFFER_SIZE = 1000000;
23
24class FADBoard: public DimThread {
25
26 class FAD *m;
27 int Socket;
28 pthread_mutex_t Mutex;
29 DimService *DIM_Name, *DIM_ID, *DIM_Temp, *DIM_ROI, *DIM_DAC;
30
31 void ReadLoop();
32 static void LaunchThread(class FADBoard *);
33 void threadHandler();
34
35 public:
36 FADBoard(std::string, unsigned short, class FAD *, unsigned int);
37 ~FADBoard();
38
39 struct BoardStatus {
40 unsigned short BoardID;
41 unsigned short FirmwareRevision;
42 unsigned long TriggerID;
43 unsigned char TriggerType;
44 unsigned short TriggerCell[NChips];
45 unsigned short ROI[NChips][NChannels];
46 unsigned short DAC[NDAC];
47 float Temp[NTemp];
48 struct timeval Update;
49 } Status;
50
51 short Data[NChips][NChannels][NBins];
52 long int Sum[NChips][NChannels][NBins];
53 short Baseline[NChips][NChannels][NBins];
54 double Gain[NChips][NChannels][NBins];
55 double SecondaryBaseline[NChips][NChannels][NBins];
56 float ACalibTemp;
57 time_t ACalibTime;
58
59
60 void Send(const void *, size_t);
61 void Send(unsigned short);
62 struct BoardStatus GetStatus();
63 void AmplitudeCalibration();
64 void Lock();
65 void Unlock();
66
67 unsigned short Port;
68 char *Name;
69 bool CommOK;
70 bool Active;
71 bool Continue;
72 pthread_t Thread;
73 pthread_cond_t CondVar;
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.