14 #include "interface/shared/i2oXFunctionCodes.h"
15 #include "interface/evb/i2oEVBMsgs.h"
17 #include "toolbox/mem/Reference.h"
18 #include "xcept/tools.h"
34 bool FUResource::doFedIdCheck_ =
true;
35 bool FUResource::useEvmBoard_ =
true;
45 FUResource::FUResource(
UInt_t fuResourceId, log4cplus::Logger
logger,
47 log_(logger), fuResourceId_(fuResourceId), superFragHead_(0),
48 superFragTail_(0), nbBytes_(0), superFragSize_(0), shmCell_(0),
49 frb_(frb), app_(app), nextEventWillHaveCRCError_(
false) {
95 "Failed to release superFragHead: "
96 << xcept::stdformat_exception_history(e));
128 LOG4CPLUS_ERROR(
log_,
"THIS SHOULD *NEVER* HAPPEN!.");
133 std::cout <<
"Started process() for bufRef: " << bufRef<< std::endl;
137 MemRef_t* next = itBufRef->getNextReference();
138 itBufRef->setNextReference(0);
145 LOG4CPLUS_ERROR(
log_,
146 "EVENT LOST:" << xcept::stdformat_exception_history(e));
148 itBufRef->setNextReference(next);
163 oss <<
"Failed to mark super fragment in shared mem buffer."
172 oss <<
"Failed to mark fed in buffer." <<
" evtNumber:"
174 <<
frb_->
size() <<
" fedAddr:0x" << hex
210 current->setNextReference(0);
219 frlh_t *frlHeader = 0;
223 UInt_t frameSize =
sizeof(I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME);
226 while (0 != bufRef) {
227 blockAddr = (
UChar_t*) bufRef->getDataLocation();
228 frlHeaderAddr = blockAddr + frameSize;
229 frlHeader = (frlh_t*) frlHeaderAddr;
231 bufRef = bufRef->getNextReference();
239 oss <<
"Event size exceeds maximum size." <<
" fuResourceId:"
254 frlh_t *frlHeader = 0;
259 while (bufRef != 0) {
260 blockAddr = (
UChar_t*) bufRef->getDataLocation();
261 frlHeaderAddr = blockAddr +
sizeof(I2O_EVENT_DATA_BLOCK_MESSAGE_FRAME);
262 fedAddr = frlHeaderAddr +
sizeof(frlh_t);
263 frlHeader = (frlh_t*) frlHeaderAddr;
264 nbBytes = frlHeader->segsize & FRL_SEGSIZE_MASK;
271 oss <<
"Reached end of buffer." <<
" fuResourceId:"
279 startPos = bufferPos;
282 bufRef = bufRef->getNextReference();
288 oss <<
"Failed to mark super fragment in shared mem buffer."
void process(MemRef_t *bufRef)
unsigned int size() const
void appendBlockToSuperFrag(MemRef_t *bufRef)
UInt_t nbErrors(bool reset=true)
UInt_t nbBytes(bool reset=true)
unsigned char * writeData(unsigned char *data, unsigned int dataSize)
toolbox::mem::Reference MemRef_t
void processDataBlock(MemRef_t *bufRef)
void fillSuperFragPayload()
bool markFed(unsigned int i, unsigned int size, unsigned char *addr)
void release(bool detachResource)
MemRef_t * superFragHead_
unsigned int fedId() const
evf::FUShmRawCell * shmCell_
MemRef_t * superFragTail_
void removeLastAppendedBlockFromSuperFrag()
bool markSuperFrag(unsigned int i, unsigned int size, unsigned char *addr)
unsigned int payloadSize() const
constexpr unsigned int gtpeId_
evf::FUShmRawCell * shmCell()
unsigned char *const getPayload()
void setFuResourceId(unsigned int id)
unsigned int nFed() const
unsigned int nSuperFrag() const
UInt_t nbCrcErrors(bool reset=true)
constexpr unsigned int gtpEvmId_
void reset(double vett[256])
void allocate(FUShmRawCell *shmCell)
void putHeader(unsigned int l1id, unsigned int bxid)