RMM API 2.0.0
Loading...
Searching...
No Matches
FrontEndBase.h
1#pragma once
2
3#include <cstdint>
4
5#include "FrontEndInterface.h"
6#include "RMMApi.h"
7#include "RMMParams.h"
8#include "RMMRegisterAccess.h"
9
10using FENRegMap = std::unordered_map<std::string, uint32_t>;
11
19 public:
20 FrontEndBase(RMMAPI* pRmmAPI, int ring, int node, FENRegMap addrMap, std::string name,
21 int lockTime = RMMRings::FE_DEFAULT_LOCK_TIME);
22 RMMResult userRegRead(const std::string& name) override;
23 RMMResult userRegRead(uint32_t addr) override;
24 RMMResult userRegWrite(const std::string& name, uint32_t data) override;
25 RMMResult userRegWrite(uint32_t addr, uint32_t data) override;
26 RMMResult userFieldRead(const std::string& reg, int bit_begin, int bit_width) override;
27 RMMResult userFieldRead(uint32_t addr, int bit_begin, int bit_width) override;
28 RMMResult userFieldWrite(const std::string& reg, int bit_begin, int bit_width, uint32_t data) override;
29 RMMResult userFieldWrite(uint32_t addr, int bit_begin, int bit_width, uint32_t data) override;
30 int getLockTime() const;
31 FENRegMap& getAddrMap();
32
37 int getRingId() const { return ring; };
38
43 int getNodeId() const { return node; };
44
49 const std::string& getName() const { return fe_name; };
50
51 /* Log management */
52 rmmStatus setLogMask(int mask);
53 std::string getFeType();
54
55 private:
56 RMMRegisterAccess& RMMRegs;
57 RMMLog rmmLog;
58 RMMAPI* rmmAPI;
59 FENRegMap regMap;
60 std::list<std::string> processMap(FENRegMap map);
61 rmmStatus getFeRegAddress(const std::string& name, std::string& reg_address, int regbank_offset = 0x0);
62 rmmStatus getFeRegAddress(const std::string& name, uint32_t& reg_address, int regbank_offset = 0x0);
63 rmmStatus getInternalRegAddress(const std::string& name, uint32_t& address);
64 int ring;
65 int node;
66 std::string fe_name;
67 int lock_time;
68};
RMMResult userRegRead(const std::string &name) override
Reads data from a register in the Front End.
Definition FrontEndBase.cpp:60
rmmStatus setLogMask(int mask)
set rmmLog log mask
Definition FrontEndBase.cpp:335
FrontEndBase(RMMAPI *pRmmAPI, int ring, int node, FENRegMap addrMap, std::string name, int lockTime=RMMRings::FE_DEFAULT_LOCK_TIME)
Constructor of the FrontEndBase class.
Definition FrontEndBase.cpp:12
std::string getFeType()
Retrieves the front-end firmware type as an ASCII string.
Definition FrontEndBase.cpp:351
FENRegMap & getAddrMap()
Returns the FEN's address map.
Definition FrontEndBase.cpp:338
const std::string & getName() const
Gets the name of the frontend device.
Definition FrontEndBase.h:49
int getRingId() const
Gets the ring index.
Definition FrontEndBase.h:37
RMMResult userFieldRead(const std::string &reg, int bit_begin, int bit_width) override
Reads a field from a frontend user space register.
Definition FrontEndBase.cpp:132
RMMResult userRegWrite(const std::string &name, uint32_t data) override
Writes data to a register in the Front End.
Definition FrontEndBase.cpp:94
RMMResult userFieldWrite(const std::string &reg, int bit_begin, int bit_width, uint32_t data) override
Writes to a field in a frontend user space register.
Definition FrontEndBase.cpp:185
int getNodeId() const
Gets the node index.
Definition FrontEndBase.h:43
int getLockTime() const
Retrieves the time taken for the front-end to achieve a stable lock.
Definition FrontEndBase.cpp:28
Interface for interacting with the frontends, providing methods for reading and writing user register...
Definition FrontEndInterface.h:16
Base class for controlling and monitoring the RMM system.
Definition RMMApi.h:37
Class for managing and writing log messages to different log levels and files.
Definition RMMLog.h:52
Class to handle register access over the ESS Readout Master Module.
Definition RMMRegisterAccess.h:57
static constexpr int FE_DEFAULT_LOCK_TIME
Seconds typical for a FE jitter cleaner to lock to 95BC.
Definition RMMRings.h:69
Struct to represent the result of an RMM register operation.
Definition RMMRegisterAccess.h:37