RMM API 2.0.0
Loading...
Searching...
No Matches
FrontEndBase Class Reference

Base class for frontend devices, providing common functionality. More...

#include <FrontEndBase.h>

Inheritance diagram for FrontEndBase:
Collaboration diagram for FrontEndBase:

Public Member Functions

 FrontEndBase (RMMAPI *pRmmAPI, int ring, int node, FENRegMap addrMap, std::string name, int lockTime=RMMRings::FE_DEFAULT_LOCK_TIME)
 Constructor of the FrontEndBase class.
 
RMMResult userRegRead (const std::string &name) override
 Reads data from a register in the Front End.
 
RMMResult userRegRead (uint32_t addr) override
 Reads data from a register in the Front End.
 
RMMResult userRegWrite (const std::string &name, uint32_t data) override
 Writes data to a register in the Front End.
 
RMMResult userRegWrite (uint32_t addr, uint32_t data) override
 Writes data to a register in the Front End.
 
RMMResult userFieldRead (const std::string &reg, int bit_begin, int bit_width) override
 Reads a field from a frontend user space register.
 
RMMResult userFieldRead (uint32_t addr, int bit_begin, int bit_width) override
 Reads a field from a frontend user space register.
 
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.
 
RMMResult userFieldWrite (uint32_t addr, int bit_begin, int bit_width, uint32_t data) override
 Writes to a field in a frontend user space register.
 
int getLockTime () const
 
FENRegMap & getAddrMap ()
 Returns the FEN's address map.
 
int getRing () const
 Gets the ring index.
 
int getNode () const
 Gets the node index.
 
rmmStatus setLogMask (int mask)
 set rmmLog log mask
 
std::string getFeType ()
 Retrieves the front-end firmware type as an ASCII string.
 
- Public Member Functions inherited from FrontEndInterface
virtual void configFE ()=0
 Configures the frontend.
 

Detailed Description

Base class for frontend devices, providing common functionality.

This class implements the FrontEndInterface and provides methods for reading and writing registers.

Constructor & Destructor Documentation

◆ FrontEndBase()

FrontEndBase::FrontEndBase ( RMMAPI * pRmmAPI,
int ring,
int node,
FENRegMap addrMap,
std::string name,
int lockTime = RMMRings::FE_DEFAULT_LOCK_TIME )

Constructor of the FrontEndBase class.

Parameters
[in]pRmmAPIPointer to the RMM API instance.
[in]ringThe ring ID where the frontend is located.
[in]nodeThe node ID within the ring.
[in]addrMapRegister address map for the FEN.
[in]lockTimeTime that FEN takes to Lock.
[in]nameThe name of the frontend device.

Member Function Documentation

◆ getFeType()

std::string FrontEndBase::getFeType ( )

Retrieves the front-end firmware type as an ASCII string.

This function reads the front-end firmware type from two user-defined registers, TYPE1_USR and TYPE2_USR, using little-endian byte order. It combines the two 32-bit values into a single 64-bit value and decodes it into an 8-character ASCII string.

If either register read fails, an error is logged and the string "Undefined" is returned.

Returns
A string representing the firmware type (8 ASCII characters), or "Undefined" if register access fails.

◆ getNode()

int FrontEndBase::getNode ( ) const
inline

Gets the node index.

Returns
The node index as an integer.

◆ getRing()

int FrontEndBase::getRing ( ) const
inline

Gets the ring index.

Returns
The ring index as an integer.

◆ setLogMask()

rmmStatus FrontEndBase::setLogMask ( int mask)

set rmmLog log mask

Parameters
maskmask to set.
Returns
rmmStatus. Success or Error if fail.

◆ userFieldRead() [1/2]

RMMResult FrontEndBase::userFieldRead ( const std::string & reg,
int bit_begin,
int bit_width )
overridevirtual

Reads a field from a frontend user space register.

Parameters
[in]regThe name of the register to read from.
[in]bit_beginThe index of the lowest bit in the register that is part of the field.
[in]bit_widthThe width of the field in bits.
Returns
RMMResult (Data field read and status).
Exceptions
std::invalid_argumentIf the field is larger than 32 bits, the sum of bit_begin and bit_width exceeds 32 bits, or if bit_width is 0.

Implements FrontEndInterface.

◆ userFieldRead() [2/2]

RMMResult FrontEndBase::userFieldRead ( uint32_t addr,
int bit_begin,
int bit_width )
overridevirtual

Reads a field from a frontend user space register.

Parameters
[in]addrThe addr of the register to read from.
[in]bit_beginThe index of the lowest bit in the register that is part of the field.
[in]bit_widthThe width of the field in bits.
Returns
RMMResult (Data field read and status).
Exceptions
std::invalid_argumentIf the field is larger than 32 bits, the sum of bit_begin and bit_width exceeds 32 bits, or if bit_width is 0.

Implements FrontEndInterface.

◆ userFieldWrite() [1/2]

RMMResult FrontEndBase::userFieldWrite ( const std::string & reg,
int bit_begin,
int bit_width,
uint32_t data )
overridevirtual

Writes to a field in a frontend user space register.

Parameters
[in]regThe name of the register to read from.
[in]bit_beginThe index of the lowest bit in the register that is part of the field.
[in]bit_widthThe width of the field in bits.
[in]dataData to write
Returns
RMMResult data recorded in the field register after the write operation and the status.
Exceptions
std::invalid_argumentIf the field is larger than 32 bits, the sum of bit_begin and bit_width exceeds 32 bits, or if bit_width is 0.

Implements FrontEndInterface.

◆ userFieldWrite() [2/2]

RMMResult FrontEndBase::userFieldWrite ( uint32_t addr,
int bit_begin,
int bit_width,
uint32_t data )
overridevirtual

Writes to a field in a frontend user space register.

Parameters
[in]addrThe addr of the register to read from.
[in]bit_beginThe index of the lowest bit in the register that is part of the field.
[in]bit_widthThe width of the field in bits.
[in]dataData to write
Returns
RMMResult data recorded in the field register after the write operation and the status.
Exceptions
std::invalid_argumentIf the field is larger than 32 bits, the sum of bit_begin and bit_width exceeds 32 bits, or if bit_width is 0.

Implements FrontEndInterface.

◆ userRegRead() [1/2]

RMMResult FrontEndBase::userRegRead ( const std::string & name)
overridevirtual

Reads data from a register in the Front End.

Parameters
[in]nameThe name of the register to read data from.
Returns
RMMResult (Data read and status)

Implements FrontEndInterface.

◆ userRegRead() [2/2]

RMMResult FrontEndBase::userRegRead ( uint32_t addr)
overridevirtual

Reads data from a register in the Front End.

Parameters
[in]addrThe addr base of the register to read data from.
Returns
RMMResult (Data read and status)

Implements FrontEndInterface.

◆ userRegWrite() [1/2]

RMMResult FrontEndBase::userRegWrite ( const std::string & name,
uint32_t data )
overridevirtual

Writes data to a register in the Front End.

Parameters
[in]nameThe name of the register to write data to.
[in]dataThe data to be written to the register.
Returns
RMMResult data recorded in the register after the write operation and the status.

Implements FrontEndInterface.

◆ userRegWrite() [2/2]

RMMResult FrontEndBase::userRegWrite ( uint32_t addr,
uint32_t data )
overridevirtual

Writes data to a register in the Front End.

Parameters
[in]addrThe addr base of the register to write data to.
[in]dataThe data to be written to the register.
Returns
RMMResult data recorded in the register after the write operation and the status.

Implements FrontEndInterface.


The documentation for this class was generated from the following files: