ACQ400_XRM (xrmIoc)
Toggle main menu visibility
Loading...
Searching...
No Matches
acq400_asyn_common.h
1
/*
2
* acq400_asyn_common.h
3
*
4
* Created on: 21 Feb 2025
5
* Author: pgm
6
*/
7
8
#ifndef ACQ400IOCAPP_SRC_ACQ400_ASYN_COMMON_H_
9
#define ACQ400IOCAPP_SRC_ACQ400_ASYN_COMMON_H_
10
11
#include <epicsExport.h>
12
#include <epicsTypes.h>
13
#include <epicsTime.h>
14
#include <epicsThread.h>
15
#include <epicsString.h>
16
#include <epicsTimer.h>
17
#include <epicsMutex.h>
18
#include <epicsEvent.h>
19
#include <iocsh.h>
20
21
#include <vector>
22
#include <split2.h>
23
24
#include "asynPortDriver.h"
25
#include "
acq400_asynPortDriver.h
"
26
#include "acq-util.h"
27
#include <unistd.h>
28
#include <stdio.h>
29
#include <string.h>
30
31
/* fix printf compiler warning */
32
#ifdef __arm__
33
#define FMTSZT "%u"
34
#define FML ""
35
#else
36
#define FMTSZT "%lu"
37
#define FML "l"
38
#endif
39
40
/** SP32 : Scratch Pad 32 bit values, up to 16 values, index 0..7 usable. @@todo
41
* @brief : the Scratch Pad appends padding/metadata to each sample
42
* WRV detail : 4 bit "seconds", 28 bit "ticks" with 25ns resolution;
43
* match seconds to WRS to get a full timestamp.
44
*/
45
namespace
SP32
{
46
const
int
SP0
= 0;
/**< Sample Count, inserted by HW */
47
const
int
SP1
= 1;
/**< usec count, inserted by HW */
48
const
int
SP2
= 2;
/**< WRV : White Rabbit Vernier time, inserted by HW. */
49
const
int
SP3
= 3;
/**< WRS : White Rabbit Seconds, inserted by SW. */
50
}
51
#define SP0 0
52
#define SP1 1
53
#define SP2 2
54
#define SP3 3
55
56
typedef
short
AI16_t;
57
typedef
unsigned
long
DI32_t;
58
typedef
unsigned
long
DO32_t;
59
typedef
unsigned
long
SP32_t;
60
61
std::vector<int> csv2int(
const
char
* csv);
62
63
bool
epicsTimeDiffLessThan(epicsTimeStamp& t1, epicsTimeStamp& t0,
double
tgts);
64
bool
epicsTimeDiffGreaterThan(epicsTimeStamp& t1, epicsTimeStamp& t0,
double
tgts);
65
66
#define TICKSPERUS 40
67
#define USPS 1000000
68
69
70
epicsInt64 getWrTsUs(
unsigned
wrse,
unsigned
wrv);
71
/**< create full Timestamp from <wrse> White Rabbit Seconds from Epoch and
72
* <wrv> : White Rabbit Vernier, the coded output from the WR firmware.
73
*/
74
75
#define NSPERTICK 25
76
#define NSPS 1000000000
77
78
epicsInt64 getWrTsNs(
unsigned
wrse,
unsigned
wrv);
79
/**< create full Timestamp from <wrse> White Rabbit Seconds from Epoch and
80
* <wrv> : White Rabbit Vernier, the coded output from the WR firmware.
81
* wrv max = 40e6. 40e6 * 25 = 0x369aca00 -> fits a u32
82
* .. our 28 bit vernier is good to 250MHz.
83
*/
84
85
epicsInt64 getWrTs(
unsigned
wrse,
unsigned
wrv);
86
87
88
const
char
* getenv_default(
const
char
* key,
const
char
* def =
"echo undefined"
);
89
90
#endif
/* ACQ400IOCAPP_SRC_ACQ400_ASYN_COMMON_H_ */
acq400_asynPortDriver.h
common base class connects all acq400 PortDriver implementations
SP32
: the Scratch Pad appends padding/metadata to each sample WRV detail : 4 bit "seconds",...
Definition
acq400_asyn_common.h:45
SP32::SP1
const int SP1
Definition
acq400_asyn_common.h:47
SP32::SP2
const int SP2
Definition
acq400_asyn_common.h:48
SP32::SP3
const int SP3
Definition
acq400_asyn_common.h:49
SP32::SP0
const int SP0
Definition
acq400_asyn_common.h:46
xrmIocApp
src
acq400_asyn_common.h
Generated by
1.17.0