RMM API 2.0.0
Loading...
Searching...
No Matches
rmm-api

API for controlling and monitoring the Readout Master Module. Mainly, the API is supposed to be used by the epics module.

Compilation and usage:

Compilation should work with c++11 using the makefile:

Setting up the conda environment

Conda can be installed with the Miniconda installer

After installation, create a new environment rmmapi and activate it

conda create -n rmmapi && conda activate rmmapi

Then find the location of the "user config file" with conda info - typically it is ~/.condarc

conda info

Create the .condarc file if it doesn't already exist and add the following lines to add the ESS conda channel and mirrors:

channel_alias: https://artifactory.esss.lu.se/artifactory/api/conda
channels:
- conda-e3-virtual
use_only_tar_bz2: true

Rerunning conda info should now show the ESS Artifactory as a channel under channel URLs.

We can now use the conda-e3-virtual channel to install the specific C++ compiler and Make versions required by rmm-api.

conda install --override-channels -c conda-e3-virtual make compilers

We can confirm this was sucessful by looking at conda list - note that packages are sourced from the conda-forge channel we configured in the .condarc

(rmmapi) essdaq@ics-accordion-01:~/git$ conda list
List of packages in environment: /home/essdaq/miniconda3/envs/rmmapi:
Name Version Build Channel
───────────────────────────────────────────────────────────────────
_libgcc_mutex 0.1 conda_forge conda-e3-virtual
_openmp_mutex 4.5 0_gnu conda-e3-virtual
binutils-meta 1.0.4 0 conda-e3-virtual
binutils_impl_linux-64 2.34 h2122c62_9 conda-e3-virtual
binutils_linux-64 2.34 h47ac705_27 conda-e3-virtual
c-compiler 1.0.4 h516909a_0 conda-e3-virtual
compilers 1.0.4 0 conda-e3-virtual
cxx-compiler 1.0.4 hc9558a2_0 conda-e3-virtual
fortran-compiler 1.0.4 he991be0_0 conda-e3-virtual
gcc_impl_linux-64 7.5.0 hda68d29_13 conda-e3-virtual
gcc_linux-64 7.5.0 hf34d7eb_27 conda-e3-virtual
gfortran_impl_linux-64 7.5.0 h56cb351_20 conda-e3-virtual
gfortran_linux-64 7.5.0 ha781d05_27 conda-e3-virtual
gxx_impl_linux-64 7.5.0 h64c220c_13 conda-e3-virtual
gxx_linux-64 7.5.0 ha781d05_27 conda-e3-virtual
kernel-headers_linux-64 3.10.0 he073ed8_18 conda-e3-virtual
ld_impl_linux-64 2.34 hc38a660_9 conda-e3-virtual
libgcc 14.2.0 h77fa898_1 conda-e3-virtual
libgcc-ng 14.2.0 h69a702a_1 conda-e3-virtual
libgfortran-ng 7.5.0 h14aa051_20 conda-e3-virtual
libgfortran4 7.5.0 h14aa051_20 conda-e3-virtual
libgomp 14.2.0 h77fa898_1 conda-e3-virtual
libstdcxx 14.2.0 hc0a3c3a_1 conda-e3-virtual
libstdcxx-ng 14.2.0 h4852527_1 conda-e3-virtual
make 4.3 h516909a_0 conda-e3-virtual
sysroot_linux-64 2.17 h0157908_18 conda-e3-virtual
tzdata 2025a h78e105d_0 conda-e3-virtual

Building and Installing rmm-api

git clone https://gitlab.esss.lu.se/detectorgroup/software/slow-control/api/rmm-api
cd rmm-api
make -j3; make install;

There is a test program under the test/ directory. After compilation, you can use it with:

cd build/test
./test

A typical usage inside a program is:

RMMAPI myAPI("RMM-IP", 65535, "config_file.json"); # Instantiate api object
myAPI.getTemperature(); # Use communication functions...

Developer Guide - installing and running pre-commit

The Continuous Integration environment used enforces strict formatting guidelines to be adhered to. The easiest way is to install and run pre-commit locally:

conda install -c conda-forge pre-commit

and then run:

pre-commit run --all-files

Running pre-commit will make small edits (eg whitespace) to the files if needed when ran, and flag up any major errors that need tobe fixed. After running pre-commit, re-run git add and git commit as usual to commit these changes.

Editing the test program ring topology

Unlike previous ESS slow control software, with rmm-api the topology is assembled dynamically (instead of from a static JSON or TXT file).

When the createAndRegister method of the FrontEndFactory is called, this adds a new FEN to the system topology.

For example, this creates a two FENs on Ring 4, and one on Ring 11:

auto frontendTest_4_0 = FrontEndFactory::createAndRegister<MockupFE>(&rmmAPI, 4, 0, "myMock0", mock_register_map);
auto frontendTest_4_1 = FrontEndFactory::createAndRegister<MockupFE>(&rmmAPI, 4, 1, "myMock1", mock_register_map);
auto frontendTest_11_0 = FrontEndFactory::createAndRegister<MockupFE>(&rmmAPI, 11, 0, "myMock2", mock_register_map);

Enabling Logs

rmm-api has a lot of control over the granularity and verbosity of logging. Logs are enabled by Topic and Severity.

This example snipped will enable the full detailed Register Read/Write logging, and the debug/info logs from Ring Bringup.

rmmAPI.setLogMasks(RMMLOG_DEBUG_MASK | RMMLOG_ERROR_MASK | RMMLOG_INFO_MASK, RMMAPI::LogTopic::REGISTER_ACCESS);
rmmAPI.setLogMasks(RMMLOG_DEBUG_MASK | RMMLOG_INFO_MASK, RMMAPI::LogTopic::RINGS)

Log Topics

The following Log Topics are available:

enum class LogTopic : uint8_t {
ALL,
RMM_API,
REGISTER_ACCESS,
CLOCK,
OUTPUT_QUEUES,
RAILS,
RINGS,
UDP_CORE,
SIDE_CHANNELS
};