versadac
1
versadac - Scalable Recorder Firmware
Main Page
Classes
Files
File List
File Members
core
dre
dre_uhh.h
1
/*****************************************************************************
2
FILE : dre_uhh.h
3
AUTHOR : Dave Storey
4
SYSTEM : Generic C/C++ header
5
DESCRIPTION : Data Recording Engine UHH file name & format definitions
6
UHH Specification: DEV1198 5.2.4.1
7
*****************************************************************************/
8
9
#ifndef __DRE_UHH_H
10
#define __DRE_UHH_H
11
12
/* UHH version, and compatibility sequence number. The latter should be
13
incremented whenever UHH files cannot coexist within the same history
14
as previous versions, due to changes either within or outside of the
15
DRE module. */
16
/* This file is currently inline with 5.2.4.1u */
17
#define DRE_UHH_VERSION "2.0"
18
#define DRE_UHH_SEQ_NUM 0x30
/* Review must never risk modified tags being non-unique. */
19
20
/* The following is used in self-testing (in the start record, but NOT the
21
file name) to avoid unimportant diffs being generated. */
22
#define DRE_UHH_SEQ_NUM_TEST 0
23
24
25
/******************/
26
/* UHH FILE NAMES */
27
/******************/
28
29
30
/* Date field added at UHH v1.10. See PDR9146/DCN1274. Ensures unique filenames
31
even when history drive reformatted. Does not need validating, so earlier
32
code still parses correctly, hence UHH SeqNo left unchanged.
33
*/
34
#define DRE_UHH_FNAME_DATE_L 9
/* Date field, incl. trailing '_'. */
35
36
/* Lengths of numeric name components. The parsing code assumes that each
37
of these can be read as an int, so they must be less than 8. */
38
39
#define DRE_UHH_FNAME_INSTR_L 6
/* Instrument name */
40
#define DRE_UHH_FNAME_UHHNO_L 2
/* UHH compatibility sequence number */
41
#define DRE_UHH_FNAME_GROUP_L 2
/* Group number */
42
#define DRE_UHH_FNAME_SEQNO_L 6
/* History sequence number */
43
44
/* Total length of numeric name components */
45
#define DRE_UHH_FNAME_NUM_L (DRE_UHH_FNAME_INSTR_L + DRE_UHH_FNAME_UHHNO_L + \
46
DRE_UHH_FNAME_GROUP_L + DRE_UHH_FNAME_SEQNO_L)
47
48
/* Radix for numeric name components */
49
#define DRE_UHH_FNAME_RADIX 16
50
51
/* names within overall file name NB +1 for tilde character */
52
#define DRE_UHH_FNAME_GNAME_L 20 + 1
53
#define DRE_UHH_FNAME_BNAME_L 41 + 1
/* Changed from 50 to a/c for date field in filename. */
54
/* File extension */
55
#define DRE_UHH_FNAME_EXTN ".uhh"
56
#define DRE_UHH_FNAME_EXTN_L 4
57
/* Match macro, for convenience when stricmp is not available */
58
#define DRE_UHH_MATCH_EXTN(s) ( (s)[0] == '.' && \
59
((s)[1] == 'u' || (s)[1] == 'U') && \
60
((s)[2] == 'h' || (s)[2] == 'H') && \
61
((s)[3] == 'h' || (s)[3] == 'H') && \
62
((s)[4] == '\0') )
63
64
/* Maximum sequence number */
65
#define DRE_UHH_MAX_SEQNO ( (1 << (DRE_UHH_FNAME_SEQNO_L*4)) - 1 )
66
67
68
69
70
/*******************/
71
/* UHH FILE FORMAT */
72
/*******************/
73
74
75
/* A UHH file is regarded as a sequence of 'meta-bytes'. Each of these takes
76
a value from 0x0 to 0x1fc inclusive, and represents either a data byte
77
(0x0 - 0xff) or a record id (0x100 - 0x1fc). Meta-bytes are represented
78
in the file using one/two-byte sequences, as follows.
79
80
Data bytes from 0x00 to 0xfd are self-representing.
81
Data byte 0xfe is represented as 0xfe,0xfc.
82
Data byte 0xff is represented as 0xfe,0xfd.
83
84
Record Ids from 0x100 to 0x1fb are represented as 0xfe,(Id & 0xff).
85
Record Id 0x1fc (data sample) is represented as 0xff.
86
87
The byte sequences 0xfe,0xfe and 0xfe,0xff are illegal. */
88
89
/* Record Id metabytes - header category: */
90
#define DRE_UHH_REC_START 0x100
91
#define DRE_UHH_REC_END 0x101
92
#define DRE_UHH_REC_HISTORY 0x102
93
#define DRE_UHH_REC_SEGMENT 0x103
94
#define DRE_UHH_REC_REAL_CHAN 0x104
95
#define DRE_UHH_REC_DERV_CHAN 0x105
96
#define DRE_UHH_REC_TOTALISER 0x106
97
#define DRE_UHH_REC_COUNTER 0x107
98
99
/* Record Id metabytes - recording category: */
100
#define DRE_UHH_REC_INTVL_INC 0x110
101
#define DRE_UHH_REC_INTVL_DEC 0x111
102
#define DRE_UHH_REC_REF_DATA 0x112
103
#define DRE_UHH_REC_ALL_ALM 0x113
104
#define DRE_UHH_REC_ONE_ALM 0x114
/* to 0x117 inclusive */
105
#define DRE_UHH_REC_MESSAGE 0x118
106
#define DRE_UHH_REC_LOST_DATA 0x119
107
#define DRE_UHH_REC_BATCH_START 0x11a
108
#define DRE_UHH_REC_BATCH_STOP 0x11b
109
#define DRE_UHH_REC_BATCH_HDR 0x11c
110
#define DRE_UHH_REC_MESSAGE_REF 0x11d
111
#define DRE_UHH_REC_SAMPLE 0x1fc
112
113
114
/* Checksum seed: */
115
#define DRE_UHH_CHECKSUM_SEED 43
116
117
118
/* Maximum string lengths, EXCLUDING terminating null */
119
120
/* - History header: */
121
122
#define DRE_UHH_SW_VERSION_L 8
123
#define DRE_UHH_UHH_VERSION_L 8
124
125
/* - Segment header: */
126
127
#define DRE_UHH_INSTR_NAME_L 20
128
#define DRE_UHH_GROUP_NAME_L 20
129
#define DRE_UHH_BATCH_NAME_L 20
130
#define DRE_UHH_LANGUAGE_L 5
131
#define DRE_UHH_COUNTRY_L 5
132
#define DRE_UHH_TIMEZONE_ID_L 5
133
#define DRE_UHH_TIMEZONE_RULE_L 20
134
135
/* - Point headers: */
136
137
#define DRE_UHH_PT_DESCRIPTOR_L 30
138
#define DRE_UHH_PT_UNITS_L 8
139
#define DRE_UHH_PT_ACTIVE_L 8
140
#define DRE_UHH_PT_INACTIVE_L DRE_UHH_PT_ACTIVE_L
141
142
/* - Batch */
143
#define DRE_UHH_MAX_BATCH_FIELDS 10
144
#define DRE_UHH_BATCH_ACTIONED_BY_L 20
145
#define DRE_UHH_BATCH_FIELD_DESC_L 20
146
#define DRE_UHH_BATCH_FIELD_DATA_L 60
147
148
/* values to indicate start or continuation of batch */
149
#define DRE_UHH_BATCH_CONT 0
150
#define DRE_UHH_BATCH_START 1
151
152
/* 'UintF' (flexible uint)data type. This is a sequence of bytes each of
153
which has 7 bits of data, plus a continuation bit if more bytes follow.
154
For example, 0x82,0x08 represents 1026. UHH files never require integers
155
too large to represent accurately as a double, so they will never be more
156
than 8 bytes (56 data bits) long. */
157
158
#define DRE_UHH_UINTF_MAX_BYTES 8
159
160
161
162
#endif
163
Generated on Wed Aug 19 2020 10:33:38 for versadac by
1.8.9.1