Project
Loading...
Searching...
No Matches
o2::mch::raw::SampaHeader Class Reference

SampaHeader is the 50-bits header word used in Sampa data transmission protocol. More...

#include <SampaHeader.h>

Public Member Functions

 SampaHeader (uint64_t value=0)
 
 SampaHeader (uint8_t hamming, bool p, SampaPacketType pkt, uint16_t numWords, uint8_t h, SampaChannelAddress ch, uint32_t bx, bool dp)
 
bool operator== (const SampaHeader &rhs) const
 
bool operator!= (const SampaHeader &rhs) const
 
bool operator< (const SampaHeader &rhs) const
 
bool operator<= (const SampaHeader &rhs) const
 
bool operator> (const SampaHeader &rhs) const
 
bool operator>= (const SampaHeader &rhs) const
 
bool hasError () const
 whether the header has error (according to hamming and/or parity)
 
bool hasHammingError () const
 
bool hasParityError () const
 
constexpr uint64_t uint64 () const
 return the header as a 64-bits integer
 
void uint64 (uint64_t value)
 
bool isHeartbeat () const
 

Getters

uint8_t hammingCode () const
 
bool headerParity () const
 
SampaPacketType packetType () const
 
uint16_t nof10BitWords () const
 
uint8_t chipAddress () const
 
SampaChannelAddress channelAddress () const
 
uint32_t bunchCrossingCounter () const
 
bool payloadParity () const
 

Setters

Each setter throws if the value does not fit in the expected number of bits.

void hammingCode (uint8_t hamming)
 
void headerParity (bool p)
 
void packetType (SampaPacketType pkt)
 
void nof10BitWords (uint16_t nofwords)
 
void chipAddress (uint8_t h)
 
void channelAddress (SampaChannelAddress ch)
 
void bunchCrossingCounter (uint32_t bx)
 
void payloadParity (bool dp)
 

Detailed Description

SampaHeader is the 50-bits header word used in Sampa data transmission protocol.

  • hamming[0..5] (6 bits) is the Hamming code of the header itself
  • p[6] (1 bit) is the parity (odd) of the header including hamming
  • pkt[7..9] (3 bits) is the packet type
  • numWords[10..19] (10 bits) is the number of 10 bit words in the data payload
  • h[20..23] (4 bits) is the hardware address of the chip
  • ch[24..28] (5 bits) is the channel address
  • bx[29..48] (20 bits) is the bunch-crossing counter (40 MHz counter)
  • dp[49] (1 bit) is the parity (odd) of data payload

Definition at line 50 of file SampaHeader.h.

Constructor & Destructor Documentation

◆ SampaHeader() [1/2]

o2::mch::raw::SampaHeader::SampaHeader ( uint64_t  value = 0)
explicit

Definition at line 190 of file SampaHeader.cxx.

◆ SampaHeader() [2/2]

o2::mch::raw::SampaHeader::SampaHeader ( uint8_t  hamming,
bool  p,
SampaPacketType  pkt,
uint16_t  numWords,
uint8_t  h,
SampaChannelAddress  ch,
uint32_t  bx,
bool  dp 
)
explicit

Constructor.

Parameters
hamming6 bits
p1 bit
pkt3 bits
numWords10 bits
h4 bits
ch5 bits
bx20 bits
dp1 bit

if any of the parameter is not in its expected range, the ctor throws an exception

Definition at line 216 of file SampaHeader.cxx.

Member Function Documentation

◆ bunchCrossingCounter() [1/2]

uint32_t o2::mch::raw::SampaHeader::bunchCrossingCounter ( ) const

Definition at line 352 of file SampaHeader.cxx.

◆ bunchCrossingCounter() [2/2]

void o2::mch::raw::SampaHeader::bunchCrossingCounter ( uint32_t  bx)

Definition at line 259 of file SampaHeader.cxx.

◆ channelAddress() [1/2]

uint8_t o2::mch::raw::SampaHeader::channelAddress ( ) const

Definition at line 346 of file SampaHeader.cxx.

◆ channelAddress() [2/2]

void o2::mch::raw::SampaHeader::channelAddress ( SampaChannelAddress  ch)

Definition at line 253 of file SampaHeader.cxx.

◆ chipAddress() [1/2]

uint8_t o2::mch::raw::SampaHeader::chipAddress ( ) const

Definition at line 340 of file SampaHeader.cxx.

◆ chipAddress() [2/2]

void o2::mch::raw::SampaHeader::chipAddress ( uint8_t  h)

Definition at line 247 of file SampaHeader.cxx.

◆ hammingCode() [1/2]

uint8_t o2::mch::raw::SampaHeader::hammingCode ( ) const

Definition at line 317 of file SampaHeader.cxx.

◆ hammingCode() [2/2]

void o2::mch::raw::SampaHeader::hammingCode ( uint8_t  hamming)

Definition at line 265 of file SampaHeader.cxx.

◆ hasError()

bool o2::mch::raw::SampaHeader::hasError ( ) const

whether the header has error (according to hamming and/or parity)

Definition at line 200 of file SampaHeader.cxx.

◆ hasHammingError()

bool o2::mch::raw::SampaHeader::hasHammingError ( ) const

Definition at line 195 of file SampaHeader.cxx.

◆ hasParityError()

bool o2::mch::raw::SampaHeader::hasParityError ( ) const

Definition at line 205 of file SampaHeader.cxx.

◆ headerParity() [1/2]

bool o2::mch::raw::SampaHeader::headerParity ( ) const

Definition at line 323 of file SampaHeader.cxx.

◆ headerParity() [2/2]

void o2::mch::raw::SampaHeader::headerParity ( bool  p)

Definition at line 235 of file SampaHeader.cxx.

◆ isHeartbeat()

bool o2::mch::raw::SampaHeader::isHeartbeat ( ) const

Definition at line 313 of file SampaHeader.cxx.

◆ nof10BitWords() [1/2]

uint16_t o2::mch::raw::SampaHeader::nof10BitWords ( ) const

Definition at line 334 of file SampaHeader.cxx.

◆ nof10BitWords() [2/2]

void o2::mch::raw::SampaHeader::nof10BitWords ( uint16_t  nofwords)

Definition at line 271 of file SampaHeader.cxx.

◆ operator!=()

bool o2::mch::raw::SampaHeader::operator!= ( const SampaHeader rhs) const

Definition at line 308 of file SampaHeader.cxx.

◆ operator<()

bool o2::mch::raw::SampaHeader::operator< ( const SampaHeader rhs) const

Definition at line 283 of file SampaHeader.cxx.

◆ operator<=()

bool o2::mch::raw::SampaHeader::operator<= ( const SampaHeader rhs) const

Definition at line 293 of file SampaHeader.cxx.

◆ operator==()

bool o2::mch::raw::SampaHeader::operator== ( const SampaHeader rhs) const

Definition at line 303 of file SampaHeader.cxx.

◆ operator>()

bool o2::mch::raw::SampaHeader::operator> ( const SampaHeader rhs) const

Definition at line 288 of file SampaHeader.cxx.

◆ operator>=()

bool o2::mch::raw::SampaHeader::operator>= ( const SampaHeader rhs) const

Definition at line 298 of file SampaHeader.cxx.

◆ packetType() [1/2]

SampaPacketType o2::mch::raw::SampaHeader::packetType ( ) const

Definition at line 328 of file SampaHeader.cxx.

◆ packetType() [2/2]

void o2::mch::raw::SampaHeader::packetType ( SampaPacketType  pkt)

Definition at line 277 of file SampaHeader.cxx.

◆ payloadParity() [1/2]

bool o2::mch::raw::SampaHeader::payloadParity ( ) const

Definition at line 358 of file SampaHeader.cxx.

◆ payloadParity() [2/2]

void o2::mch::raw::SampaHeader::payloadParity ( bool  dp)

Definition at line 241 of file SampaHeader.cxx.

◆ uint64() [1/2]

constexpr uint64_t o2::mch::raw::SampaHeader::uint64 ( ) const
inlineconstexpr

return the header as a 64-bits integer

Definition at line 116 of file SampaHeader.h.

◆ uint64() [2/2]

void o2::mch::raw::SampaHeader::uint64 ( uint64_t  value)

sets the value from a 64-bits integer. if the value does not fit within 50 bits an exception is thrown.

Definition at line 210 of file SampaHeader.cxx.


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