//_____________________________________________________________________________
AliAltroBufferV3::AliAltroBufferV3(const char* fileName, AliAltroMapping *mapping):
AliAltroBuffer(fileName,mapping),
- fN(0)
+ fN(0),
+ fFECERRA(0),
+ fFECERRB(0),
+ fERRREG2(0),
+ fERRREG3(0),
+ fActiveFECsA(0xffff),
+ fActiveFECsB(0xffff),
+ fALTROCFG1(0),
+ fALTROCFG2(0),
+ fTSample(0),
+ fL1Phase(0)
{
// Constructor
+ memset(fArray, 0, kMaxWords*sizeof(UShort_t));
}
//_____________________________________________________________________________
AliAltroBufferV3::~AliAltroBufferV3()
{
// destructor
-
- if (fVerbose) Info("~AliAltroBufferV3", "File Created");
-
- delete fFile;
-
}
//_____________________________________________________________________________
AliAltroBufferV3::AliAltroBufferV3(const AliAltroBufferV3& source):
AliAltroBuffer(source),
- fN(source.fN)
+ fN(source.fN),
+ fFECERRA(source.fFECERRA),
+ fFECERRB(source.fFECERRB),
+ fERRREG2(source.fERRREG2),
+ fERRREG3(source.fERRREG3),
+ fActiveFECsA(source.fActiveFECsA),
+ fActiveFECsB(source.fActiveFECsB),
+ fALTROCFG1(source.fALTROCFG1),
+ fALTROCFG2(source.fALTROCFG2),
+ fTSample(source.fTSample),
+ fL1Phase(source.fL1Phase)
{
// Copy Constructor
AliAltroBufferV3& AliAltroBufferV3::operator = (const AliAltroBufferV3& /*source*/)
{
//Assigment operator
+#if 0
+ fFECERRA = source.fFECERRA;
+ fFECERRB = source.fFECERRB;
+ fERRREG2 = source.fERRREG2;
+ fERRREG3 = source.fERRREG3;
+ fActiveFECsA = source.fActiveFECsA;
+ fActiveFECsB = source.fActiveFECsB;
+ fALTROCFG1 = source.fALTROCFG1;
+ fALTROCFG2 = source.fALTROCFG2;
+ fTSample = source.fTSample;
+ fL1Phase = source.fL1Phase;
+#endif
Fatal("operator =", "assignment operator not implemented");
return *this;
//Writes a trailer (header) of 32 bits using
//a given hardware adress
UInt_t temp = hwAddress & 0xFFF;
- temp = (wordsNumber << 16) & 0x3FF;
- temp |= (0x1 << 30);
+ temp |= ((wordsNumber & 0x3FF) << 16);
+ temp |= (0x1U << 30);
fFile->WriteBuffer((char *)(&temp),sizeof(UInt_t));
ReverseAndWrite();
}
+//_____________________________________________________________________________
+UInt_t AliAltroBufferV3::SetField(UInt_t& input, UShort_t start, UInt_t mask, UInt_t val) const
+{
+ UInt_t out = (mask << start);
+ UInt_t fld = (val << start) & out;
+ input &= ~out;
+ input |= fld;
+ return input;
+}
+
//_____________________________________________________________________________
void AliAltroBufferV3::ReverseAndWrite()
{
// write the buffer to the file
UInt_t temp = 0;
Int_t shift = 20;
- for(Int_t i = fN; i >= 0; i--) {
+ for(Int_t i = (fN-1); i >= 0; i--) {
temp |= (fArray[i] << shift);
shift -= 10;
if (shift < 0) {
}
//_____________________________________________________________________________
-void AliAltroBufferV3::WriteRCUTrailer(Int_t rcuId)
+UChar_t AliAltroBufferV3::WriteRCUTrailer(Int_t rcuId)
{
// Writes the RCU trailer
// rcuId the is serial number of the corresponding
UInt_t currentFilePos = fFile->Tellp();
UInt_t size = currentFilePos-fDataHeaderPos;
size -= sizeof(AliRawDataHeader);
+ size /= 4;
- if ((size % 5) != 0) {
- AliFatal(Form("The current raw data payload is not a mutiple of 5 (%d) ! Can not write the RCU trailer !",size));
- return;
+ if (size > 0x3FFFFFF) {
+ AliFatal(Form("The current raw data payload size of %d is bigger than the max possible one ! Can not write the RCU trailer !",size));
+ return 2;
}
- // Now put the size in unit of number of 40bit words
- size /= 5;
+ // Now add the the RCU trailer tag
+ size |= (1U << 31);
fFile->WriteBuffer((char *)(&size),sizeof(UInt_t));
- // Now several not yet full defined fields
- // In principle they are supposed to contain
- // information about the sampling frequency,
- // L1 phase, list of 'dead' FECs, etc.
- // UInt_t buffer[n];
- // fFile->WriteBuffer((char *)(buffer),sizeof(UInt_t)*n);
+ // Now several well defined fields contained
+ // in the trailer
+ // For details check the RCU manual
+ UInt_t buffer;
+
+ buffer = (0x1U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fERRREG2 & 0x3FFFFFF);
+ buffer |= (0x2U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fERRREG3 & 0x3FFFFFF);
+ buffer |= (0x3U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fActiveFECsA & 0x3FFFFFF);
+ buffer |= (0x4U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fActiveFECsB & 0x3FFFFFF);
+ buffer |= (0x5U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fALTROCFG1 & 0x3FFFFFF);
+ buffer |= (0x6U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+
+ buffer = (fALTROCFG2 & 0x3FFFFFF);
+ buffer |= (0x7U << 26);
+ buffer |= (0x1U << 31);
+ fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
// Now the RCU identifier and size of the trailer
- // FOr the moment the triler size is 2 32-bit words
- UInt_t buffer = (2 & 0x7F);
+ buffer = (9 & 0x7F);
buffer |= ((rcuId & 0x1FF) << 7);
- buffer |= 0xAAAA << 16;
+ buffer |= (0x2U << 16);
+ buffer |= (0x8U << 26);
+ buffer |= (0x3U << 30);
fFile->WriteBuffer((char *)(&buffer),sizeof(UInt_t));
+ return 2;
}