-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmodule.h
53 lines (47 loc) · 1.63 KB
/
dmodule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef DMODULE_H
#define DMODULE_H
#define BSIZE 0x120000
struct blkinfo_struct {
unsigned short int *data; // block data
int type; // block type
int lToken; // block long token
};
class Dmodule {
private:
int Serial; // Module serial number
int Status; // Module presence status - 0: not found 1: found
unsigned short int *buf; // Data buffer
int rptr; // read pointer, bytes
int wptr; // write pointer, bytes
char ChanParity[64]; // WFD Channel block last parity: 0/1/-1(undefined)
char SumParity[4]; // TRIGGER sum block last parity: 0/1/-1(undefined)
int DelimParity; // Delimiter block parity
int TrigToken; // Trigger source last token
int DelimToken; // Delimiter last token
short int SelfToken[64]; // self trig token
int ErrCnt[6]; // Error counters parity/presence WFDCHAN, TRIGSUM, TRIGTOKEN, DELIMTOKEN, SelfToken and length&other format errors
long BlkCnt; // data block counter
int SyncCnt; // Count synchronization
struct blkinfo_struct BlkInfo;
public:
Dmodule(int num);
~Dmodule(void);
void Add(char *data, int len); // add data to the buffer
struct blkinfo_struct *Get(void); // return pointer to data block in the buffer. Analyze format errors. NULL on the data end
inline int *GetErrCnt(void) { return ErrCnt;};
inline long GetBlkCnt(void) { return BlkCnt;};
void ClearCounters(void);
void ClearParity(void);
int GetLongDelim(void);
void Reset(void);
inline void SetStatus(int val) { Status = val;};
inline int GetStatus(void) { return Status;};
};
// Indexes in ErrCnt
#define ERR_WFDPAR 0
#define ERR_SUMPAR 1
#define ERR_TRIGTOK 2
#define ERR_DELIM 3
#define ERR_SELFTOK 4
#define ERR_OTHER 5
#endif