Wiki source code of EPICS
Last modified by Sebastian Marsching on 2023/02/27 22:56
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{toc/}} |
2 | |||
![]() |
2.1 | 3 | # EPICS Base |
4 | |||
5 | ## Extracting the upper 32 bits from a 64-bit integer | ||
6 | |||
7 | Sometimes, it is necessary to extract individual bits from a 64-bit integer (e.g. one that is read from a hardware register through the `int64in` record). This is possible through some calc record magic. | ||
8 | |||
9 | Please note that this depends on some internal casting behavior, so it might not work on all platforms. It has been tested to work successfully with EPICS Base 7.0.6 running x86_64 Linux, but it seems like it does not work with the same version of EPICS running on ARM Linux. | ||
10 | |||
11 | record(int64in, "$(P)$(R)MyRegister") { | ||
12 | field(FLNK, "$(P)$(R)MyRegister:Low") | ||
13 | } | ||
14 | |||
15 | record(mbbiDirect, "$(P)$(R)MyRegister:Low") { | ||
16 | field(DTYP, "stream") | ||
17 | field(INP, "$(P)$(R)MyRegister MSI") | ||
18 | field(FLNK, "$(P)$(R)MyRegister:CalcHigh") | ||
19 | } | ||
20 | |||
21 | # This looks a bit strange, but it is a reliable way of extracting the upper | ||
22 | # 32 bits of the 64 bit register. This works, because the value is implicitly | ||
23 | # converted to a double, which preserves the upper 52 bits of the original | ||
24 | # value. From this value, we have to substract the unsigned value of the lower | ||
25 | # 32 bits (if we didn’t do this, we would get an off-by-one error under certain | ||
26 | # circumstances due to rounding), and then we can right-shift by 32 bits (which | ||
27 | # we have to do through division for a floating point number). Finally, we cut | ||
28 | # off any fractional parts that might be left due to rounding. | ||
29 | record(calc, "$(P)$(R)MyRegister:CalcHigh") { | ||
30 | field(CALC, "FLOOR((A-(B+((B<0)?(2^32):0)))/(2^32))") | ||
31 | field(INPA, "$(P)$(R)MyRegister MSI") | ||
32 | field(INPB, "$(P)$(R)MyRegister:Low MSI") | ||
33 | field(FLNK, "$(P)$(R)MyRegister:High") | ||
34 | } | ||
35 | |||
36 | record(mbbiDirect, "$(P)$(R)MyRegister:High") { | ||
37 | field(DTYP, "stream") | ||
38 | field(INP, "$(P)$(R)MyRegister:CalcHigh MSI") | ||
39 | } | ||
40 | |||
![]() |
1.1 | 41 | # EDM |
42 | |||
43 | In addition to the dependencies for MEDM I had to install the following packages: | ||
44 | |||
45 | * libgif-dev | ||
46 | * libpng-dev | ||
47 | * libxtst-dev | ||
48 | |||
49 | Under Ubuntu 14.04 LTS I had to modify the file `extensions/configure/os/CONFIG_SITE.linux-x86_64.linux-x86_64` in order to make `X11_LIB` and `MOTIF_LIB` to point to `/usr/lib/x86_64-linux-gnu`. In addition to that I had to modify the file `edmMain/Makefile` and add the line `USR_LDFLAGS_Linux += -Wl,--no-as-needed` as described on the [EPICS mailing-list](http://www.aps.anl.gov/epics/tech-talk/2012/msg01723.php). | ||
50 | |||
51 | # MEDM | ||
52 | |||
53 | ## Compiling MEDM on Ubuntu 10.04 LTS (lucid lynx) | ||
54 | |||
55 | If EPICS base is installed in `/my/epics/path/base`, you should extract the [EPICS extensions top directory bundle](http://www.aps.anl.gov/epics/download/extensions/extensionsTop_20070703.tar.gz) to `/my/epics/path`, so that a new directory `/my/epics/path/extensions` is created. The [MEDM source archive](http://www.aps.anl.gov/epics/download/extensions/medm3_1_5.tar.gz) should be extracted to `/my/epics/path/extensions/src`. You should then switch to `/my/epics/path/extensions/src/medm3_1_5` and run `make`. | ||
56 | |||
57 | In addition to a lot of development packages I had already installed, I had to install the following packages: | ||
58 | |||
59 | * libmotif-dev | ||
60 | * libxmu-dev | ||
61 | * libxp-dev | ||
62 | * libxt-dev | ||
63 | * x11proto-print-dev | ||
64 | |||
65 | # synApps | ||
66 | |||
67 | ## Compiling synApps on Ubuntu 10.04 LTS (lucid lynx) | ||
68 | |||
69 | In order to compile synApps 5.5 on Ubuntu 10.04 LTS, I had to install the following packages (other packages might be needed as well): | ||
70 | |||
71 | * flex | ||
72 | * libusb-dev | ||
73 | |||
74 | In order to compile synApps 5.6 on Ubuntu 10.04 LTS, I had to install the following packages (other packages might be needed as well): | ||
75 | |||
76 | * re2c | ||
77 | * libbz2-dev | ||
78 | * libfreetype6-dev | ||
79 | * libpng-dev | ||
80 | * libusb-dev | ||
81 | * libxext-dev | ||
82 | * libxml2-dev | ||
83 | |||
84 | # StripTool | ||
85 | |||
86 | In addition to the dependencies listed for EDM and MEDM I had to install the following packages: | ||
87 | |||
88 | * libxpm-dev | ||
89 | |||
90 | # Asyn | ||
91 | |||
92 | ## Codes for Tracing I/O Operations | ||
93 | |||
94 | ```c | ||
95 | /* traceMask definitions*/ | ||
96 | #define ASYN_TRACE_ERROR 0x0001 | ||
97 | #define ASYN_TRACEIO_DEVICE 0x0002 | ||
98 | #define ASYN_TRACEIO_FILTER 0x0004 | ||
99 | #define ASYN_TRACEIO_DRIVER 0x0008 | ||
100 | #define ASYN_TRACE_FLOW 0x0010 | ||
101 | |||
102 | /* traceIO mask definitions*/ | ||
103 | #define ASYN_TRACEIO_NODATA 0x0000 | ||
104 | #define ASYN_TRACEIO_ASCII 0x0001 | ||
105 | #define ASYN_TRACEIO_ESCAPE 0x0002 | ||
106 | #define ASYN_TRACEIO_HEX 0x0004 | ||
107 | ``` |