CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
sistrip::FEDDAQTrailer Class Reference

#include <SiStripFEDBufferComponents.h>

Public Member Functions

bool badSourceID () const
 
bool cBit () const
 
uint16_t crc () const
 
const uint8_t * data () const
 
uint8_t eoeNibble () const
 
uint32_t eventLengthIn64BitWords () const
 
uint32_t eventLengthInBytes () const
 
uint8_t eventStatusNibble () const
 
bool fBit () const
 
 FEDDAQTrailer ()
 
 FEDDAQTrailer (const uint8_t *trailer)
 
 FEDDAQTrailer (const uint32_t eventLengthIn64BitWords, const uint16_t crc=0, const FEDTTSBits ttsBits=TTS_READY, const bool slinkTransmissionError=false, const bool badFEDID=false, const bool slinkCRCError=false, const uint8_t eventStatusNibble=0)
 
bool lastTrailer () const
 
void print (std::ostream &os) const
 
bool rBit () const
 
FEDDAQTrailersetBadSourceIDBit (const bool bitSet)
 
FEDDAQTrailersetCRC (const uint16_t crc)
 
FEDDAQTrailersetEventLengthIn64BitWords (const uint32_t eventLengthIn64BitWords)
 
FEDDAQTrailersetEventStatusNibble (const uint8_t eventStatusNibble)
 
FEDDAQTrailersetSLinkCRCErrorBit (const bool bitSet)
 
FEDDAQTrailersetSLinkTransmissionErrorBit (const bool bitSet)
 
FEDDAQTrailersetTTSBits (const FEDTTSBits ttsBits)
 
bool slinkCRCError () const
 
bool slinkTransmissionError () const
 
bool tBit () const
 
FEDTTSBits ttsBits () const
 
uint8_t ttsNibble () const
 

Private Attributes

uint8_t trailer_ [8]
 

Detailed Description

Definition at line 230 of file SiStripFEDBufferComponents.h.

Constructor & Destructor Documentation

◆ FEDDAQTrailer() [1/3]

sistrip::FEDDAQTrailer::FEDDAQTrailer ( )
inline

Definition at line 232 of file SiStripFEDBufferComponents.h.

232 {}

◆ FEDDAQTrailer() [2/3]

sistrip::FEDDAQTrailer::FEDDAQTrailer ( const uint8_t *  trailer)
inlineexplicit

Definition at line 1365 of file SiStripFEDBufferComponents.h.

References trailer_.

1365 { memcpy(trailer_, trailer, 8); }

◆ FEDDAQTrailer() [3/3]

sistrip::FEDDAQTrailer::FEDDAQTrailer ( const uint32_t  eventLengthIn64BitWords,
const uint16_t  crc = 0,
const FEDTTSBits  ttsBits = TTS_READY,
const bool  slinkTransmissionError = false,
const bool  badFEDID = false,
const bool  slinkCRCError = false,
const uint8_t  eventStatusNibble = 0 
)

Definition at line 979 of file SiStripFEDBufferComponents.cc.

References crc(), eventLengthIn64BitWords(), eventStatusNibble(), setBadSourceIDBit(), setCRC(), setEventLengthIn64BitWords(), setEventStatusNibble(), setSLinkCRCErrorBit(), setSLinkTransmissionErrorBit(), setTTSBits(), slinkCRCError(), slinkTransmissionError(), trailer_, and ttsBits().

985  {
986  //clear everything (T,x,$ all set to 0)
987  memset(trailer_, 0x0, 8);
988  //set the EoE nibble to indicate this is the last fragment
989  trailer_[7] = 0xA0;
990  //set variable fields vith values supplied
994  setCRC(crc);
996  setBadSourceIDBit(badFEDID);
998  }
FEDDAQTrailer & setSLinkCRCErrorBit(const bool bitSet)
FEDDAQTrailer & setTTSBits(const FEDTTSBits ttsBits)
FEDDAQTrailer & setSLinkTransmissionErrorBit(const bool bitSet)
FEDDAQTrailer & setEventLengthIn64BitWords(const uint32_t eventLengthIn64BitWords)
FEDDAQTrailer & setEventStatusNibble(const uint8_t eventStatusNibble)
FEDDAQTrailer & setCRC(const uint16_t crc)
FEDDAQTrailer & setBadSourceIDBit(const bool bitSet)

Member Function Documentation

◆ badSourceID()

bool sistrip::FEDDAQTrailer::badSourceID ( ) const
inline

Definition at line 244 of file SiStripFEDBufferComponents.h.

References fBit().

Referenced by sistrip::FEDBufferBase::checkNoUnexpectedSourceID().

244 { return fBit(); }

◆ cBit()

bool sistrip::FEDDAQTrailer::cBit ( ) const
inline

Definition at line 1377 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by slinkTransmissionError().

1377 { return (trailer_[1] & 0x80); }

◆ crc()

uint16_t sistrip::FEDDAQTrailer::crc ( void  ) const
inline

Definition at line 1375 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by sistrip::FEDBufferBase::daqCRC(), FEDDAQTrailer(), and setCRC().

1375 { return (trailer_[2] | (trailer_[3] << 8)); }

◆ data()

const uint8_t * sistrip::FEDDAQTrailer::data ( ) const
inline

Definition at line 1391 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by sistrip::FEDBufferGenerator::fillBuffer().

1391 { return trailer_; }

◆ eoeNibble()

uint8_t sistrip::FEDDAQTrailer::eoeNibble ( ) const
inline

Definition at line 1367 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by sistrip::FEDBufferBase::checkNoExtraHeadersOrTrailers().

1367 { return ((trailer_[7] & 0xF0) >> 4); }

◆ eventLengthIn64BitWords()

uint32_t sistrip::FEDDAQTrailer::eventLengthIn64BitWords ( ) const
inline

Definition at line 1369 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by sistrip::FEDBufferBase::daqEventLengthIn64bitWords(), eventLengthInBytes(), FEDDAQTrailer(), and setEventLengthIn64BitWords().

1369  {
1370  return (trailer_[4] | (trailer_[5] << 8) | (trailer_[6] << 16));
1371  }

◆ eventLengthInBytes()

uint32_t sistrip::FEDDAQTrailer::eventLengthInBytes ( ) const
inline

◆ eventStatusNibble()

uint8_t sistrip::FEDDAQTrailer::eventStatusNibble ( ) const
inline

Definition at line 1381 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by FEDDAQTrailer(), and setEventStatusNibble().

1381 { return (trailer_[1] & 0x0F); }

◆ fBit()

bool sistrip::FEDDAQTrailer::fBit ( ) const
inline

Definition at line 1379 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by badSourceID().

1379 { return (trailer_[1] & 0x40); }

◆ lastTrailer()

bool sistrip::FEDDAQTrailer::lastTrailer ( ) const
inline

Definition at line 250 of file SiStripFEDBufferComponents.h.

References tBit().

250 { return !tBit(); }

◆ print()

void sistrip::FEDDAQTrailer::print ( std::ostream &  os) const
inline

Definition at line 1389 of file SiStripFEDBufferComponents.h.

References sistrip::printHex(), and trailer_.

1389 { printHex(trailer_, 8, os); }
void printHex(const void *pointer, const size_t length, std::ostream &os)

◆ rBit()

bool sistrip::FEDDAQTrailer::rBit ( ) const
inline

Definition at line 1387 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by slinkCRCError().

1387 { return (trailer_[0] & 0x04); }

◆ setBadSourceIDBit()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setBadSourceIDBit ( const bool  bitSet)

Definition at line 1021 of file SiStripFEDBufferComponents.cc.

References trailer_.

Referenced by FEDDAQTrailer().

1021  {
1022  if (bitSet)
1023  trailer_[1] |= 0x40;
1024  else
1025  trailer_[1] &= (~0x40);
1026  return *this;
1027  }

◆ setCRC()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setCRC ( const uint16_t  crc)

Definition at line 1007 of file SiStripFEDBufferComponents.cc.

References crc(), and trailer_.

Referenced by FEDDAQTrailer(), and sistrip::FEDBufferGenerator::fillBuffer().

1007  {
1008  trailer_[2] = (crc & 0x00FF);
1009  trailer_[3] = ((crc >> 8) & 0x00FF);
1010  return *this;
1011  }

◆ setEventLengthIn64BitWords()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setEventLengthIn64BitWords ( const uint32_t  eventLengthIn64BitWords)

Definition at line 1000 of file SiStripFEDBufferComponents.cc.

References eventLengthIn64BitWords(), and trailer_.

Referenced by FEDDAQTrailer(), and sistrip::FEDBufferGenerator::fillBuffer().

1000  {
1001  trailer_[4] = (eventLengthIn64BitWords & 0x000000FF);
1002  trailer_[5] = ((eventLengthIn64BitWords & 0x0000FF00) >> 8);
1003  trailer_[6] = ((eventLengthIn64BitWords & 0x00FF0000) >> 16);
1004  return *this;
1005  }

◆ setEventStatusNibble()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setEventStatusNibble ( const uint8_t  eventStatusNibble)

Definition at line 1037 of file SiStripFEDBufferComponents.cc.

References eventStatusNibble(), and trailer_.

Referenced by FEDDAQTrailer().

1037  {
1038  trailer_[1] = ((trailer_[1] & 0xF0) | (eventStatusNibble & 0x0F));
1039  return *this;
1040  }

◆ setSLinkCRCErrorBit()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setSLinkCRCErrorBit ( const bool  bitSet)

Definition at line 1029 of file SiStripFEDBufferComponents.cc.

References trailer_.

Referenced by FEDDAQTrailer().

1029  {
1030  if (bitSet)
1031  trailer_[0] |= 0x04;
1032  else
1033  trailer_[0] &= (~0x40);
1034  return *this;
1035  }

◆ setSLinkTransmissionErrorBit()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setSLinkTransmissionErrorBit ( const bool  bitSet)

Definition at line 1013 of file SiStripFEDBufferComponents.cc.

References trailer_.

Referenced by FEDDAQTrailer().

1013  {
1014  if (bitSet)
1015  trailer_[1] |= 0x80;
1016  else
1017  trailer_[1] &= (~0x80);
1018  return *this;
1019  }

◆ setTTSBits()

FEDDAQTrailer & sistrip::FEDDAQTrailer::setTTSBits ( const FEDTTSBits  ttsBits)

Definition at line 1042 of file SiStripFEDBufferComponents.cc.

References trailer_, and ttsBits().

Referenced by FEDDAQTrailer().

1042  {
1043  trailer_[0] = ((trailer_[0] & 0x0F) | (ttsBits & 0xF0));
1044  return *this;
1045  }

◆ slinkCRCError()

bool sistrip::FEDDAQTrailer::slinkCRCError ( ) const
inline

Definition at line 253 of file SiStripFEDBufferComponents.h.

References rBit().

Referenced by sistrip::FEDBufferBase::checkNoSlinkCRCError(), and FEDDAQTrailer().

253 { return rBit(); }

◆ slinkTransmissionError()

bool sistrip::FEDDAQTrailer::slinkTransmissionError ( ) const
inline

Definition at line 241 of file SiStripFEDBufferComponents.h.

References cBit().

Referenced by sistrip::FEDBufferBase::checkNoSLinkTransmissionError(), and FEDDAQTrailer().

241 { return cBit(); }

◆ tBit()

bool sistrip::FEDDAQTrailer::tBit ( ) const
inline

Definition at line 1385 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by lastTrailer().

1385 { return (trailer_[0] & 0x08); }

◆ ttsBits()

FEDTTSBits sistrip::FEDDAQTrailer::ttsBits ( ) const

◆ ttsNibble()

uint8_t sistrip::FEDDAQTrailer::ttsNibble ( ) const
inline

Definition at line 1383 of file SiStripFEDBufferComponents.h.

References trailer_.

Referenced by ttsBits().

1383 { return ((trailer_[0] & 0xF0) >> 4); }

Member Data Documentation

◆ trailer_

uint8_t sistrip::FEDDAQTrailer::trailer_[8]
private