pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
pflib::Elinks Class Reference

WishboneTarget for configuring the elinks. More...

#include <Elinks.h>

Inheritance diagram for pflib::Elinks:
[legend]
Collaboration diagram for pflib::Elinks:
[legend]

Public Member Functions

 Elinks (WishboneInterface *wb, int target=tgt_Elinks)
 wrap the wishbone interface and use the tgt_Elinks target
 
int nlinks () const
 Get the number of links stored in this class. More...
 
void markActive (int ilink, bool active)
 Mark a specific link as active (or inactive) depending on input. More...
 
bool isActive (int ilink) const
 Check if a link is active. More...
 
std::vector< uint8_t > spy (int ilink)
 spy into the passed link More...
 
void setBitslip (int ilink, int bitslip)
 set the bitslip value for the link More...
 
void setBitslipAuto (int ilink, bool enable)
 enable auto-setting of bitslip value More...
 
bool isBitslipAuto (int ilink)
 check if a link is auto-setting the bitslip More...
 
int getBitslip (int ilink)
 Get the bitslip value for a given link. More...
 
uint32_t getStatusRaw (int ilink)
 Get the status of the input link. More...
 
void clearErrorCounters (int ilink)
 Clear the error counters for the input link. More...
 
void readCounters (int link, uint32_t &nonidles, uint32_t &resyncs)
 Decode the counters for non-idles and resyncs from the status bytes for the input link. More...
 
void resetHard ()
 Hard reset the links.
 
void setupBigspy (int mode, int ilink, int presamples)
 Prepare for a big spy of the link. More...
 
void getBigspySetup (int &mode, int &ilink, int &presamples)
 Read the current setup for a bigspy. More...
 
bool bigspyDone ()
 Check if the current bigspy is done. More...
 
std::vector< uint32_t > bigspy ()
 Readout the bigspy and return the data. More...
 
void scanAlign (int ilink)
 scan the input link attempting to align it More...
 
void setDelay (int ilink, int idelay)
 Set the delay for the input link. More...
 
- Public Member Functions inherited from pflib::WishboneTarget
 WishboneTarget (WishboneInterface *wb, int target)
 simply store pointer to interface and target we will interact with
 
int target_type ()
 Get the Wishbone target type/flavor by number.
 
std::string target_type_str ()
 Get the Wishbone target type/flavor by name if known.
 
int firmware_version ()
 Get the subblock firmware version.
 

Private Attributes

int n_links
 number of links available, read from chip
 
std::vector< bool > m_linksActive
 which links are "active", set by user
 
std::vector< int > phaseDelay
 UNUSED.
 

Additional Inherited Members

- Protected Member Functions inherited from pflib::WishboneTarget
void wb_write (uint32_t addr, uint32_t data)
 Write data to an address on the target stored within us. More...
 
uint32_t wb_read (uint32_t addr)
 Read data from address on the target stored within us. More...
 
void wb_rmw (uint32_t addr, uint32_t data, uint32_t mask)
 Read the word at the address and then put our data bits into that address using the provided mask. More...
 
- Protected Attributes inherited from pflib::WishboneTarget
WishboneInterfacewb_
 Handle to the interface.
 
int target_
 Target id.
 

Detailed Description

WishboneTarget for configuring the elinks.

Member Function Documentation

◆ bigspy()

std::vector< uint32_t > pflib::Elinks::bigspy ( )

Readout the bigspy and return the data.

Returns
vector of 4-byte words readout from bigspy

◆ bigspyDone()

bool pflib::Elinks::bigspyDone ( )

Check if the current bigspy is done.

Returns
true if we are done with the bigspy

◆ clearErrorCounters()

void pflib::Elinks::clearErrorCounters ( int  ilink)

Clear the error counters for the input link.

Parameters
[in]ilinklink index

◆ getBigspySetup()

void pflib::Elinks::getBigspySetup ( int &  mode,
int &  ilink,
int &  presamples 
)

Read the current setup for a bigspy.

Parameters
[out]modetype of bigspy to setup
[out]ilinklink index
[out]presamplesnumber of presamples

◆ getBitslip()

int pflib::Elinks::getBitslip ( int  ilink)

Get the bitslip value for a given link.

Parameters
[in]ilinklink index
Returns
value of bitslip

◆ getStatusRaw()

uint32_t pflib::Elinks::getStatusRaw ( int  ilink)

Get the status of the input link.

Parameters
[in]ilinklink index
Returns
encoded 4-bytes of link status

◆ isActive()

bool pflib::Elinks::isActive ( int  ilink) const
inline

Check if a link is active.

Parameters
[in]ilinklink index
Returns
true if link is active, false if invalid index or link is inactive

◆ isBitslipAuto()

bool pflib::Elinks::isBitslipAuto ( int  ilink)

check if a link is auto-setting the bitslip

Parameters
[in]ilinklink index
Returns
true if auto-setting is enabled

◆ markActive()

void pflib::Elinks::markActive ( int  ilink,
bool  active 
)
inline

Mark a specific link as active (or inactive) depending on input.

If the passed link index is outside the range of valid links, then this does nothing.

Parameters
[in]ilinklink index
[in]activetrue if link is active

◆ nlinks()

int pflib::Elinks::nlinks ( ) const
inline

Get the number of links stored in this class.

This value is read at construction time using the passed WishboneInterface

◆ readCounters()

void pflib::Elinks::readCounters ( int  link,
uint32_t &  nonidles,
uint32_t &  resyncs 
)

Decode the counters for non-idles and resyncs from the status bytes for the input link.

Parameters
[in]linklink index
[out]nonidlesset to the number of non-idles
[out]resyncsset to the number or resyncs

◆ scanAlign()

void pflib::Elinks::scanAlign ( int  ilink)

scan the input link attempting to align it

Parameters
[in]ilinklink index

◆ setBitslip()

void pflib::Elinks::setBitslip ( int  ilink,
int  bitslip 
)

set the bitslip value for the link

Parameters
[in]ilinklink index
[in]bitslipvalue for bitslip

◆ setBitslipAuto()

void pflib::Elinks::setBitslipAuto ( int  ilink,
bool  enable 
)

enable auto-setting of bitslip value

Note
Auto-setting the bitslip value for a link is a firmware-level task which is not well implemented at this time.

This overrides any manual setting of the bitslip value.

Parameters
[in]ilinklink index
[in]enabletrue if you want the auto-setting enabled

◆ setDelay()

void pflib::Elinks::setDelay ( int  ilink,
int  idelay 
)

Set the delay for the input link.

Parameters
[in]ilinklink index
[in]idelaydelay to use

◆ setupBigspy()

void pflib::Elinks::setupBigspy ( int  mode,
int  ilink,
int  presamples 
)

Prepare for a big spy of the link.

Modes

  • 0 -> software
  • 1 -> L1A
  • 2 -> Non-idle
Parameters
[in]modetype of bigspy to setup
[in]ilinklink index
[in]presamplesnumber of presamples

◆ spy()

std::vector< uint8_t > pflib::Elinks::spy ( int  ilink)

spy into the passed link

Parameters
[in]ilinklink index
Returns
the bytes retreived from the spy

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